Jump to content
  • Advertisement
Sign in to follow this  
Robinhood

HOW TO get Hareware ID by using API

This topic is 4675 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
By calling a function.

"Which function?"
Which API/Hardware ID?

"API X, Hardware ID Y"
Likely answers:
Google Search: C++ X Y ID
MSDN Search: C++ X Y ID
Note: Substitute C++ for language of your choice.

For guessing two steps ahead, I win!

As a prize... I recieve... a door!!!

I'm going to go install that door now. Finally get some privacy to change/blare loud music.

"I don't suffer from insanity, I enjoy every last minute of it!"

~Mike

Share this post


Link to post
Share on other sites
If I read you correctly, you want some form of unique identifier for the computer, generated by hashing the disk ID / NIC ID, maybe a couple of other values.

Correct?

The following source shows how to extract eh NIC information.. maybe someone else has DiskID info?

I'd be carefull about trusting it too far though; the user will hate you if installing a new network card disables his game. NICs can also be faked using programs that overwrite the NIC ID.



// Retrieve network interface information
//


DWORD sizeReq = 0 ;
PMIB_IFTABLE pInfo = NULL;
// Get size information
::GetIfTable(NULL, &sizeReq, FALSE) ;

// Allocate required memory
pInfo = (PMIB_IFTABLE)( new BYTE [sizeReq] );
memset (pInfo, 0, sizeReq) ;

DWORD sizeToUse = sizeReq ;

// Retrieve network interface information
bool result = ( ::GetIfTable( (PMIB_IFTABLE)pInfo, &sizeToUse, FALSE) == NO_ERROR );
if( !result )
{
delete [] (PMIB_IFTABLE)pInfo;
pInfo = NULL;
_LOG(MSG_WARNING, "Couldn't retrieve network interface information!");
return ;
}

m_NIC = "";
// Print all interface information
for( unsigned int index = 0; index <((PMIB_IFTABLE)pInfo)->dwNumEntries; index ++ )
{
// Get interface description
MIB_IFROW& details = ((PMIB_IFTABLE)pInfo)->table[index];

// Format physical address
char macStr[50];
memset(macStr, 0, sizeof(macStr));
for (DWORD j = 0 ; j < details.dwPhysAddrLen ; ++j)
{
sprintf( &macStr[j*3], "%02X-", details.bPhysAddr[j] );
}
macStr[j*3-1] = '\0';

m_NIC = macStr;
return;



Allan

[Edited by - __ODIN__ on January 1, 2006 10:56:44 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!