Retrieving Machine ID
-
Hi All, I have a requirement, where I need to get the following information. 1. MAC Address. 2. HDD Serial Number 3. CD/DVD Drive Serial Number. 4. CPU Processor ID. I have my application in VC++ using MFC. Any help will be highly appreciated. Thanks, Sachin.
-
Hi All, I have a requirement, where I need to get the following information. 1. MAC Address. 2. HDD Serial Number 3. CD/DVD Drive Serial Number. 4. CPU Processor ID. I have my application in VC++ using MFC. Any help will be highly appreciated. Thanks, Sachin.
GetVolumeInformation() will do more than half the work. For MAC Address - (this is only my opinion) one thing that would work all the time is run a shell "arp -a" and internally search the output for the needed MAC. The other thing you can do is WMI(Read it somewhere don't know how it's done) Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_
-
Hi All, I have a requirement, where I need to get the following information. 1. MAC Address. 2. HDD Serial Number 3. CD/DVD Drive Serial Number. 4. CPU Processor ID. I have my application in VC++ using MFC. Any help will be highly appreciated. Thanks, Sachin.
Perhaps you will found methods based on querying the System Registry. Nevertheless, consider that the data you need can be obtained using Windows Management Instrumentation (WMI):
- MAC Address -- see
Win32_NetworkAdapter
WMI class; - HDD Serial Number -- see
Win32_DiskDrive
WMI class; - CD/DVD Drive Serial Number -- see
Win32_CDROMDrive
WMI class; - CPU Processor ID -- see
Win32_Processor
WMI class.
WMI seems to be difficult to use in C++. So use it if no easier equivalent methods.
- MAC Address -- see
-
GetVolumeInformation() will do more than half the work. For MAC Address - (this is only my opinion) one thing that would work all the time is run a shell "arp -a" and internally search the output for the needed MAC. The other thing you can do is WMI(Read it somewhere don't know how it's done) Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_
_AnShUmAn_ wrote:
GetVolumeInformation() will do more than half the work.
How so? While it may be used to get the serial number of the hard drive or the CD drive, how do you propose it getting the MAC address or the CPU id?
_AnShUmAn_ wrote:
For MAC Address - (this is only my opinion) one thing that would work all the time is run a shell "arp -a" and internally search the output for the needed MAC.
Even though APIs exist for obtaining MAC addresses, capturing the output or arp -a is not going to work. You should use ipconfig /all instead.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb