I need something like a serial number of the Hardware that my program could get from any hardware lik HDD, Screen or anything, If you have an Ideea about what i am talkin, respond...
If all you want is the serial number of the Hard Drive for example simply use GetVolumeInformation()
If you want the MAC address of your network card it's a little more involved.
You will need the following API functions :
Netbios (NCB pncb);
CopyMemory (PVOID hpvDest,LONG hpvSource LONG cbcopy);
GetProcessHeap();
HeapAlloc (LONG hHeap,LONG dwFlags, LONG dwBytes);
HeapFree (LONG hHeap LONG dwFlags, LPVOID lpMem);
If you can't be bothered or want to see an example (albeit in VB) an open source sample is available here <
The MAC address just needs a call to UuidCreateSequential. The last 6 bytes of the resulting GUID represent the MAC address.
Note that you may find solutions suggesting the use of CoCreateGuid. However, this is just a wrapper for UuidCreate which, as of W2000, no longer returns the MAC portion. So, on the older OSs you can use CoCreateGuid or UuidCreate, and on W2000/XP/W2003 use UuidCreateSequential
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.