M
marccruz
Is there an API where I can get the mac address/es of a computer using
C for Windows XP?
C for Windows XP?
Is there an API where I can get the mac address/es of a computer using
C for Windows XP?
Is there an API where I can get the mac address/es of a computer using
C for Windows XP?
goose said:You mean that you'd rather get flamed instead of OP? How odd.
jmcgill said:Before you get flamed for asking a not-strictly-on-topic question,
ponder this (from an old MSDN source). I'm a Unix systems programmer
that rarely touches windows, so you get the usual money back guarantee
on this:
// Fetches the MAC addresses and prints them
static void GetMACaddress(void)
{
IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information
// for up to 16 NICs
DWORD dwBufLen = sizeof(AdapterInfo); // Save 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
do {
PrintMACaddress(pAdapterInfo->Address); // Print MAC address
pAdapterInfo = pAdapterInfo->Next; // Progress through
// linked list
}
while(pAdapterInfo); // Terminate if last adapter
}
goose said:IP_ADAPTER_INFO is not a known type.
> DWORD? Whats that?
> PIP_ADAPTER_INFO also not know at this point.
jmcgill said:#include <windows.h>
#include <winsock2.h>
#include <stdio.h>
#include <iphlpapi.h>
I'll try to refrain from answering any more windows programming
questions from now on. Just trying to help. Sheesh
I'll try to refrain from answering any more windows programming
questions from now on. Just trying to help. Sheesh
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.