// Get Adapters Info
PIP_ADAPTER_INFO pAdapterInfo = NULL;
PIP_ADAPTER_INFO pOriginalPtr;
ULONG ulSizeAdapterInfo = 0;
DWORD dwStatus;// Find out how big our buffer needs to be to hold the data
dwStatus = GetAdaptersInfo(pAdapterInfo, &ulSizeAdapterInfo);
if (dwStatus == ERROR_BUFFER_OVERFLOW) {
// Allocate a buffer of the appropriate size
if (!(pAdapterInfo = (PIP_ADAPTER_INFO)malloc(ulSizeAdapterInfo))) {
printf(“\n Insufficient Memory ");
return(1);
} // Obtain the Adapter Info
dwStatus = GetAdaptersInfo(pAdapterInfo, &ulSizeAdapterInfo);
}
if (dwStatus != ERROR_SUCCESS) {
return(1);
}pOriginalPtr = pAdapterInfo;if (pAdapterInfo == NULL)
printf("\n No Interfaces Present.\n");
// Step through the adapter list
while (pAdapterInfo != NULL) { // Print the Ip Addresses
printf(" \n\n\t IpAddressList:: ");
PIP_ADDR_STRING pAddressList = &(pAdapterInfo->IpAddressList); do {
printf("\n\t IpAddress = %hs", pAddressList->IpAddress.String);
pAddressList = pAddressList->Next;
} while (pAddressList != NULL); // And so on with other members of the Adapter info structure….. pAdapterInfo = pAdapterInfo->Next;
} // while(pAdapterInfo!=NULL){
}
PIP_ADAPTER_INFO pAdapterInfo = NULL;
PIP_ADAPTER_INFO pOriginalPtr;
ULONG ulSizeAdapterInfo = 0;
DWORD dwStatus;// Find out how big our buffer needs to be to hold the data
dwStatus = GetAdaptersInfo(pAdapterInfo, &ulSizeAdapterInfo);
if (dwStatus == ERROR_BUFFER_OVERFLOW) {
// Allocate a buffer of the appropriate size
if (!(pAdapterInfo = (PIP_ADAPTER_INFO)malloc(ulSizeAdapterInfo))) {
printf(“\n Insufficient Memory ");
return(1);
} // Obtain the Adapter Info
dwStatus = GetAdaptersInfo(pAdapterInfo, &ulSizeAdapterInfo);
}
if (dwStatus != ERROR_SUCCESS) {
return(1);
}pOriginalPtr = pAdapterInfo;if (pAdapterInfo == NULL)
printf("\n No Interfaces Present.\n");
// Step through the adapter list
while (pAdapterInfo != NULL) { // Print the Ip Addresses
printf(" \n\n\t IpAddressList:: ");
PIP_ADDR_STRING pAddressList = &(pAdapterInfo->IpAddressList); do {
printf("\n\t IpAddress = %hs", pAddressList->IpAddress.String);
pAddressList = pAddressList->Next;
} while (pAddressList != NULL); // And so on with other members of the Adapter info structure….. pAdapterInfo = pAdapterInfo->Next;
} // while(pAdapterInfo!=NULL){
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货