I am getting this error and I don't know why. I would like to create a library to operate with WinPcap, and public some of their functions. I attach part of my code:
class WinPcap
{
private:
bool discoverDone;
std::list<Device> discoverDeviceList;
void Listen();
public:
WinPcap();
~WinPcap();
//This process is bloking, remain throw it in a different thread.
std::list<Device> Discover();
static void GetHostMacAddress(UINT8* macAddress, int pointerSize);
};
And now I found this method to get the host mac address in c++:
void WinPcap::GetHostMacAddress(UINT8* macAddress, int pointerSize)
{
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
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo; // Contains pointer to current adapter info
}
I am getting the error in that function. But if I comment the GetAdaptersInfo function, I don't get it.
Why is this happening?