本文整理汇总了C++中GetAdaptersInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ GetAdaptersInfo函数的具体用法?C++ GetAdaptersInfo怎么用?C++ GetAdaptersInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetAdaptersInfo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sizeof
DWORD WINAPI CLuzj_ZTEDlg::GetMacIP(const char *adaptername, char *ip, unsigned char *mac)
{
PIP_ADAPTER_INFO AdapterInfo = NULL;
DWORD dwBufLen = sizeof(IP_ADAPTER_INFO);
DWORD dwStatus;
AdapterInfo = (PIP_ADAPTER_INFO)malloc(dwBufLen);
if(AdapterInfo == NULL) return -1;
dwStatus = GetAdaptersInfo(AdapterInfo,&dwBufLen);
if(dwStatus == ERROR_BUFFER_OVERFLOW) {
free(AdapterInfo);
AdapterInfo = (PIP_ADAPTER_INFO)malloc(dwBufLen);
dwStatus = GetAdaptersInfo(AdapterInfo,&dwBufLen);
if(AdapterInfo == NULL) return -1;
}
if(dwStatus != NO_ERROR) {
if(AdapterInfo != NULL) free(AdapterInfo);
return -2;
}
if(ip) memset(ip, 0, 16);
if(mac) memset(mac, 0, 6);
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
if(adaptername != NULL) {
while(pAdapterInfo) {
if (stricmp(adaptername,pAdapterInfo->AdapterName) == 0) {
if(mac) memcpy(mac, pAdapterInfo->Address, 6);
if(ip) strncpy(ip, pAdapterInfo->IpAddressList.IpAddress.String, 16);
break;
}
pAdapterInfo = pAdapterInfo->Next;
};
}
free(AdapterInfo);
if(pAdapterInfo == NULL) return -3;
return 0;
}
开发者ID:NullYing,项目名称:gxgk-zte,代码行数:42,代码来源:Luzj_ZTEDlg.cpp
示例2: main
int main(int argc, char** argv)
{
WSADATA wsaData;
PIP_ADAPTER_INFO pAdapterInfo = NULL, pAdapter = NULL;
ULONG ulOutBufLen;
u_char p[6];
WSAStartup(MAKEWORD(2,2), &wsaData);
if (GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW) {
free(pAdapterInfo);
pAdapterInfo = (PIP_ADAPTER_INFO) malloc(ulOutBufLen);
}
GetAdaptersInfo(pAdapterInfo, &ulOutBufLen);
pAdapter = pAdapterInfo;
while(pAdapter) {
printf("\tAdapter Name: \t%s\n", pAdapter->AdapterName);
printf("\tAdapter Desc: \t%s\n", pAdapter->Description);
memcpy(p, pAdapter->Address, 6);
printf("\tAdapter Addr: \t%02X:%02X:%02X:%02X:%02X:%02X\n",
p[0],p[1],p[2],p[3],p[4],p[5]);
printf("\tIP Addr: \t%s\n", pAdapter->IpAddressList.IpAddress.String);
printf("\tIP Mask: \t%s\n", pAdapter->IpAddressList.IpMask.String);
printf("\tIP Gateway: \t%s\n", pAdapter->GatewayList.IpAddress.String);
if (pAdapter->DhcpEnabled) {
printf("\tDHCP Enable: Yes\n");
printf("\tLease Obtained: %ld\n", pAdapter->LeaseObtained);
} else {
printf("\tDHCP Enable: No\n");
}
if (pAdapter->HaveWins) {
printf("\tHave Wins: Yes\n");
printf("\t\tPrimary Wins Server: \t%s\n", pAdapter->PrimaryWinsServer.IpAddress.String);
printf("\t\tSecondary Wins Server: \t%s\n", pAdapter->SecondaryWinsServer.IpAddress.String);
} else {
printf("\tHave Wins: No\n");
}
pAdapter = pAdapter->Next;
}
return 0;
}
开发者ID:geeeqie,项目名称:codes,代码行数:42,代码来源:LocalHostInfo.c
示例3: GetMACaddress
void GetMACaddress(char *mac_address)
{
IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information for up to 16 NICs
DWORD dwBufLen = sizeof(AdapterInfo); // Save the memory size of buffer
DWORD dwStatus = GetAdaptersInfo( // Call GetAdapterInfo
AdapterInfo, // [out] buffer to receive data
&dwBufLen); // [in] size of receive data buffer
assert(dwStatus == ERROR_SUCCESS); // Verify return value is valid, no buffer overflow
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;// Contains pointer to current adapter info
sprintf(mac_address,"%02X:%02X:%02X:%02X:%02X:%02X", pAdapterInfo->Address[0],pAdapterInfo->Address[1],pAdapterInfo->Address[2],pAdapterInfo->Address[3],pAdapterInfo->Address[4],pAdapterInfo->Address[5]);
}
开发者ID:M45T3Ryu,项目名称:eikasia,代码行数:11,代码来源:getmacaddress.cpp
示例4: getMAC
//////////////////////////////////////////////////////
//Anti Cheat
char* getMAC(){// By Yuri-BR
PIP_ADAPTER_INFO AdapterInfo;
DWORD dwBufLen = sizeof(AdapterInfo);
char *mac_addr = (char*)malloc(17);
AdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(IP_ADAPTER_INFO));
if (AdapterInfo == NULL)
{
printf("Error allocating memory needed to call GetAdaptersinfo\n");
}
// Make an initial call to GetAdaptersInfo to get the necessary size into the dwBufLen variable
if (GetAdaptersInfo(AdapterInfo, &dwBufLen) == ERROR_BUFFER_OVERFLOW)
{
AdapterInfo = (IP_ADAPTER_INFO *) malloc(dwBufLen);
if (AdapterInfo == NULL)
{
printf("Error allocating memory needed to call GetAdaptersinfo\n");
}
}
if (GetAdaptersInfo(AdapterInfo, &dwBufLen) == NO_ERROR)
{
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;// Contains pointer to current adapter info
do
{
sprintf(mac_addr, "%02X:%02X:%02X:%02X:%02X:%02X", // By Yuri-BR
pAdapterInfo->Address[0], pAdapterInfo->Address[1],
pAdapterInfo->Address[2], pAdapterInfo->Address[3],
pAdapterInfo->Address[4], pAdapterInfo->Address[5]);
return mac_addr;
printf("\n");
pAdapterInfo = pAdapterInfo->Next;
}
while(pAdapterInfo);
}
free(AdapterInfo);
}
开发者ID:Mateuus,项目名称:newundead,代码行数:43,代码来源:WOLoginHelper.cpp
示例5: udp_join_multicast_group_with_all_ip
static TinyRet udp_join_multicast_group_with_all_ip(int fd, const char *group)
{
IP_ADAPTER_INFO * pNextAdapter = NULL;
IP_ADAPTER_INFO * ipAdaptersInfo = NULL;
ULONG infolen = sizeof(IP_ADAPTER_INFO);
ipAdaptersInfo = (IP_ADAPTER_INFO *)tiny_malloc(infolen);
if (GetAdaptersInfo(ipAdaptersInfo, &infolen) == ERROR_BUFFER_OVERFLOW)
{
tiny_free(ipAdaptersInfo);
ipAdaptersInfo = (IP_ADAPTER_INFO *)tiny_malloc(infolen);
}
if (GetAdaptersInfo(ipAdaptersInfo, &infolen))
{
tiny_free(ipAdaptersInfo);
return TINY_RET_E_INTERNAL;
}
for (pNextAdapter = ipAdaptersInfo; pNextAdapter; pNextAdapter = pNextAdapter->Next)
{
IP_ADDR_STRING *pNextIp = NULL;
for (pNextIp = &(pNextAdapter->IpAddressList); pNextIp; pNextIp = pNextIp->Next)
{
unsigned long ip = inet_addr(pNextIp->IpAddress.String);
if (ip == 0)
{
break;
}
LOG_D(TAG, "join MultiGroup ip: %s", pNextIp->IpAddress.String);
udp_join_multicast_group_with_ip(fd, group, ip);
}
}
tiny_free(ipAdaptersInfo);
return TINY_RET_OK;
}
开发者ID:jxfengzi,项目名称:UpnpLan,代码行数:41,代码来源:tiny_socket.c
示例6: STDMETHODIMP_
// 是否存在网关
STDMETHODIMP_(BOOL) CStatistic::IsNetGatewayExists(void)
{
PIP_ADAPTER_INFO pAdapterInfo;
PIP_ADAPTER_INFO pAdapter = NULL;
BOOL bExists = FALSE;
DWORD dwRetVal = 0;
ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);
pAdapterInfo = (IP_ADAPTER_INFO *) malloc(ulOutBufLen);
if(pAdapterInfo)
{
dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
if(dwRetVal == ERROR_BUFFER_OVERFLOW )
{
free(pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) malloc (ulOutBufLen);
if(pAdapterInfo)
dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
}
if( dwRetVal == NO_ERROR)
{
pAdapter = pAdapterInfo;
while (pAdapter)
{
if(pAdapter->GatewayList.IpAddress.String[0])
{
bExists = TRUE;
break;
}
pAdapter = pAdapter->Next;
}
}
free(pAdapterInfo);
}
return bExists;
}
开发者ID:N2oBeef,项目名称:vc_scan,代码行数:42,代码来源:Statistics.cpp
示例7: malloc
char *macAddress(void)
{
IP_ADAPTER_INFO *adapterInfo;
ULONG adapterInfoSize = 0;
if (GetAdaptersInfo(NULL, &adapterInfoSize) != ERROR_SUCCESS)
{
adapterInfo = (IP_ADAPTER_INFO *) malloc(adapterInfoSize);
}
if (GetAdaptersInfo(adapterInfo, &adapterInfoSize) != ERROR_SUCCESS)
{
return NULL;
}
{
char *mac = String_asHex(adapterInfo->Address, adapterInfo->AddressLength);
free(adapterInfo);
return mac;
}
}
开发者ID:cdcarter,项目名称:io,代码行数:21,代码来源:WindowsMacAddress.c
示例8: getAdaptersInfo
int getAdaptersInfo()
{
char MacAddressStr[256]; //mac address converted to a string
char MacOneByteStr[10]; //used to hold one byte of mac address
int retval = 0; //return -1 if no adapters found
if (isIPHLPAvail()) //inits iphlpapi and returns true if dll loaded
{
//just return count if we already did this before
if (AdapterCount)
return AdapterCount;
IP_ADAPTER_INFO *pAdapterInfo; //points to buffer hold linked list adapter info
DWORD dwSize = (sizeof(IP_ADAPTER_INFO) * MAX_ADAPTERS) + sizeof(DWORD); //size for lots of adapters
char *buffer = new char[dwSize]; //allocate space for lots of adapters
if (buffer)
{
pAdapterInfo = (IP_ADAPTER_INFO *)buffer; //point to buffer
if (GetAdaptersInfo(
pAdapterInfo, // buffer for mapping table
&dwSize) == NO_ERROR) // sort the table
{
while (pAdapterInfo)
{
strcpy(adapters[AdapterCount].AdapterName, pAdapterInfo->Description);
strcpy(adapters[AdapterCount].IpAddress, (const char *)pAdapterInfo->IpAddressList.IpAddress.String);
//build mac address as a string
*MacAddressStr = '\0';
for (unsigned int loop = 0; loop < pAdapterInfo->AddressLength; loop++)
{
if (strlen(MacAddressStr))
strcat(MacAddressStr,"-");
sprintf(MacOneByteStr,"%02X",pAdapterInfo->Address[loop]);
strcat(MacAddressStr,MacOneByteStr);
}
strcpy((char *)adapters[AdapterCount].MacAddress, MacAddressStr);
AdapterCount++;
pAdapterInfo = pAdapterInfo->Next;
}
retval = AdapterCount;
}
delete [] buffer;
}
}
return retval;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:52,代码来源:WindowsAdapterInfo.cpp
示例9: GetAdaptersInfo
const char* wyDevice::getDeviceId() {
// Get the buffer length required for IP_ADAPTER_INFO.
ULONG bufLen = 0;
BYTE* buffer = 0;
if(GetAdaptersInfo(0, &bufLen) == ERROR_BUFFER_OVERFLOW) {
// Now the BufferLength contain the required buffer length.
// Allocate necessary buffer.
buffer = new BYTE[bufLen];
// Get the Adapter Information.
PIP_ADAPTER_INFO adapterInfo = reinterpret_cast<PIP_ADAPTER_INFO>(buffer);
GetAdaptersInfo(adapterInfo, &bufLen);
// Iterate the network adapters and print their MAC address.
if(adapterInfo) {
// Assuming pAdapterInfo->AddressLength is 6.
sprintf(sIMEI, "%02x:%02x:%02x:%02x:%02x:%02x",
adapterInfo->Address[0],
adapterInfo->Address[1],
adapterInfo->Address[2],
adapterInfo->Address[3],
adapterInfo->Address[4],
adapterInfo->Address[5]);
}
// make md5 for mac address
const char* md5 = wyMD5::md5(sIMEI);
memcpy(sIMEI, md5, strlen(md5));
wyFree((void*)md5);
// release buffer
delete[] buffer;
// return
return sIMEI;
} else {
return NULL;
}
}
开发者ID:Adoni,项目名称:WiEngine,代码行数:39,代码来源:wyDevice_win.cpp
示例10: UpdateData
void CIPFindDlg::OnCbnSelchangeCmbDevice()
{
UpdateData(FALSE);
int nCurSel = m_Device.GetCurSel();
ULONG len = 0;
GetAdaptersInfo(NULL, &len);
PIP_ADAPTER_INFO p = static_cast<PIP_ADAPTER_INFO>(malloc(len));
GetAdaptersInfo(p, &len);
int i=0;
for (PIP_ADAPTER_INFO q = p; q != NULL; q = q->Next)
{
if (i++ == nCurSel)
{
GetCurSelIPMask(q->IpAddressList.IpAddress.String, q->IpAddressList.IpMask.String);
}
}
free(p);
}
开发者ID:matrix207,项目名称:VC,代码行数:22,代码来源:IPFindDlg.cpp
示例11: mapport
bool mapport(short port)
{
UPnP UPnPvar;
PIP_ADAPTER_INFO pAdapterInfo = NULL;
DWORD dwRetVal = 0;
char strLocalIP[256];
pAdapterInfo = (IP_ADAPTER_INFO *) malloc( sizeof(IP_ADAPTER_INFO) );
ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);
// Make an initial call to GetAdaptersInfo to get
// the necessary size into the ulOutBufLen variable
if (GetAdaptersInfo( pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW)
{
free(pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) malloc (ulOutBufLen);
}
if ((dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen)) == NO_ERROR)
{
strcpy(strLocalIP,pAdapterInfo->IpAddressList.IpAddress.String);
}
else
{
strcpy(strLocalIP,"");
}
free(pAdapterInfo);
UPnPvar.Set_UPnP(strLocalIP,"TCP","UVNC",port);
UPnPvar.OpenPorts(true);
char testchar[256];
strcpy(testchar,UPnPvar.GetExternalIP());
UPnPvar.ClosePorts(true);
return 0;
}
开发者ID:runsoftdev,项目名称:ultravnc,代码行数:39,代码来源:upnp.cpp
示例12: GetAllAdaptersInfo
// 取得所有网卡的信息 David 2010.6.2 add
PIP_ADAPTER_INFO GetAllAdaptersInfo()
{
PIP_ADAPTER_INFO pAdapterInfo = (IP_ADAPTER_INFO *) malloc( sizeof(IP_ADAPTER_INFO) );
ASSERT(NULL != pAdapterInfo);
ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);
// 空间不够则重新分配空间
if (GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW)
{
free(pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) malloc (ulOutBufLen);
}
if (GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == NO_ERROR){
return pAdapterInfo;
}
else
{
free(pAdapterInfo);
return NULL;
}
}
开发者ID:jhbsz,项目名称:cpe,代码行数:24,代码来源:upgraderDoc.cpp
示例13: IP_ADAPTER_INFO
vector<ULONG>* SocketExtension::LocalIPs()
{
PIP_ADAPTER_INFO pIpAdapterInfo = new IP_ADAPTER_INFO();
unsigned long stSize = sizeof(IP_ADAPTER_INFO);
int nRel = GetAdaptersInfo(pIpAdapterInfo, &stSize);
if (ERROR_BUFFER_OVERFLOW == nRel)
{
delete pIpAdapterInfo;
pIpAdapterInfo = (PIP_ADAPTER_INFO)new BYTE[stSize];
nRel = GetAdaptersInfo(pIpAdapterInfo, &stSize);
}
vector<ULONG>* address = NULL;
if (ERROR_SUCCESS == nRel)
{
while (pIpAdapterInfo)
{
IP_ADDR_STRING *pIpAddrString = &(pIpAdapterInfo->IpAddressList);
do
{
ULONG addrnum = inet_addr(pIpAddrString->IpAddress.String);
if (addrnum != 0)
{
if (address == NULL)
{
address = new vector<ULONG>;
}
address->push_back(addrnum);
}
pIpAddrString = pIpAddrString->Next;
} while (pIpAddrString);
pIpAdapterInfo = pIpAdapterInfo->Next;
}
}
if (pIpAdapterInfo)
delete pIpAdapterInfo;
return address;
}
开发者ID:fbion,项目名称:PaperAirplane,代码行数:37,代码来源:SocketExtension.cpp
示例14: sizeof
void EnvironmentImpl::nodeIdImpl(NodeId& id)
{
std::memset(&id, 0, sizeof(id));
PIP_ADAPTER_INFO pAdapterInfo;
PIP_ADAPTER_INFO pAdapter = 0;
ULONG len = sizeof(IP_ADAPTER_INFO);
pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
// Make an initial call to GetAdaptersInfo to get
// the necessary size into len
DWORD rc = GetAdaptersInfo(pAdapterInfo, &len);
if (rc == ERROR_BUFFER_OVERFLOW)
{
delete [] reinterpret_cast<char*>(pAdapterInfo);
pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
}
else if (rc != ERROR_SUCCESS)
{
return;
}
if (GetAdaptersInfo(pAdapterInfo, &len) == NO_ERROR)
{
pAdapter = pAdapterInfo;
bool found = false;
while (pAdapter && !found)
{
if (pAdapter->Type == MIB_IF_TYPE_ETHERNET && pAdapter->AddressLength == sizeof(id))
{
found = true;
std::memcpy(&id, pAdapter->Address, pAdapter->AddressLength);
}
pAdapter = pAdapter->Next;
}
}
delete [] reinterpret_cast<char*>(pAdapterInfo);
}
开发者ID:jacobxy,项目名称:test,代码行数:36,代码来源:Environment_WIN32.cpp
示例15: FillAdaptersInfo
unsigned __int64 FillAdaptersInfo(unsigned int *pRet2)
{
IP_ADAPTER_INFO AdapterInfo[16], *pAdapter;
ULONG uBufLen = sizeof(AdapterInfo);
__int64 ret = 0;
if (GetAdaptersInfo(AdapterInfo, &uBufLen) == ERROR_SUCCESS)
{
for (pAdapter = AdapterInfo; pAdapter; pAdapter = pAdapter->Next)
{
if (pAdapter->AddressLength == 6 && pAdapter->Type == MIB_IF_TYPE_ETHERNET)
ret ^= BytesSHA1I64(pAdapter->Address, pAdapter->AddressLength);
}
}
return ret;
}
开发者ID:enesunal,项目名称:fakeskype,代码行数:16,代码来源:Random.cpp
示例16: sizeof
int NetUtils::FindNumberOfLocalNetworkInterfaces( void )
{
PIP_ADAPTER_INFO pAdapterInfo = new IP_ADAPTER_INFO;
unsigned long output_buffer_len = sizeof(IP_ADAPTER_INFO);
// Make call to GetAdaptersInfo to get number of addapters
DWORD ret = GetAdaptersInfo( pAdapterInfo, &output_buffer_len );
delete pAdapterInfo;
if( (ret == ERROR_BUFFER_OVERFLOW) || (ret == ERROR_SUCCESS) ) {
int nif = output_buffer_len / sizeof(IP_ADAPTER_INFO);
if( output_buffer_len > (nif * sizeof(IP_ADAPTER_INFO)) )
nif++;
return nif;
}
fprintf( stderr, "FindNumberOfLocalNetworkInterfaces() failed\n" );
return -1;
}
开发者ID:bwelton,项目名称:mrnet,代码行数:17,代码来源:NetUtils-win.C
示例17: GetMac
bool GetMac(std::vector<unsigned char>& mac)
{
IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information for 16 cards
DWORD dwBufLen = sizeof(AdapterInfo); // Save memory size of buffer
DWORD dwStatus = GetAdaptersInfo ( AdapterInfo, &dwBufLen); // Get info
if (dwStatus != NO_ERROR) return wxEmptyString; // Check status
for(size_t i = 0; i<sizeof(AdapterInfo); i++) {
mac.resize(AdapterInfo[i].AddressLength);
mac.assign(AdapterInfo[i].Address, AdapterInfo[i].Address + AdapterInfo[i].AddressLength);
for (size_t j=0; j< mac.size(); j++) {
if (mac[j] != 0) {
return true;
}
}
}
return false;
}
开发者ID:jgleesawn,项目名称:springlobby,代码行数:18,代码来源:socket.cpp
示例18: defined
inline long MACAddressUtility::GetMACAddressMSW(unsigned char * result)
{
#if defined(UNDER_CE)
IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information
DWORD dwBufLen = sizeof(AdapterInfo); // Save memory size of buffer
if(GetAdaptersInfo(AdapterInfo, &dwBufLen) == ERROR_SUCCESS)
{
memcpy(result, AdapterInfo->Address, 6);
}
else return -1;
#else
UUID uuid;
if(UuidCreateSequential(&uuid) == RPC_S_UUID_NO_ADDRESS) return -1;
memcpy(result, (char*)(uuid.Data4+2), 6);
#endif
return 0;
}
开发者ID:T-Rex,项目名称:wxMACAddressUtility,代码行数:18,代码来源:MACAddressUtility.cpp
示例19: pixie_get_mac_address
/**
* Retrieve the MAC address of the system
*/
unsigned pixie_get_mac_address(unsigned char macaddr[6])
{
memset(macaddr, 0, 6);
#ifdef WIN32
{
DWORD dwStatus;
IP_ADAPTER_INFO *p;
IP_ADAPTER_INFO AdapterInfo[16];
DWORD dwBufLen = sizeof(AdapterInfo);
DWORD interface_index = -1;
GetBestInterface(0x01010101, &interface_index);
dwStatus = GetAdaptersInfo(AdapterInfo, &dwBufLen);
if (dwStatus != ERROR_SUCCESS)
return 1;
for (p=AdapterInfo; p; p = p->Next) {
if (p->Index == interface_index || interface_index == -1) {
memcpy(macaddr, p->Address, 6);
return 0;
}
/*(
printf("[%02x:%02x:%02x:%02x:%02x:%02x]\n",
mac_address[0], mac_address[1], mac_address[2],
mac_address[3], mac_address[4], mac_address[5]
);
printf(" %s\n", p->AdapterName);
printf(" %s\n", p->Description);
printf(" IP: ");
for (a = &p->IpAddressList; a; a = a->Next) {
printf("%s ", a->IpAddress.String);
}
printf("\n");
*/
}
}
#else
return -1;
#endif
return -1;
}
开发者ID:carriercomm,项目名称:wifi-mon,代码行数:46,代码来源:pixie.c
示例20: enumAdapters
//
// Function: Iterate through all network adapters, for call the callback routine with adapter information
//
void enumAdapters( std::function<bool(IP_ADAPTER_INFO&)> callback )
{
// 20 adapaters on one machine is enough!
IP_ADAPTER_INFO rgInfo[20];
DWORD size = sizeof(rgInfo);
DWORD result;
result = GetAdaptersInfo( rgInfo, &size );
if( result != ERROR_SUCCESS ) {
throw Win32Exception(result, "GetAdaptersInfo");
}
bool totalOption15 = false;
for( IP_ADAPTER_INFO* pinfo = rgInfo; pinfo && !totalOption15; pinfo = pinfo->Next ) {
bool cont = callback( *pinfo );
if( !cont )
break;
}
}
开发者ID:uri247,项目名称:SIA,代码行数:22,代码来源:network.cpp
注:本文中的GetAdaptersInfo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论