Obtain unique host information by accessing the physical address in Windows 2000
Author: sinister
Email: sinister@whitecell.org
Homepage: http://www.whitecell.org
It is very easy to get the serial number of the main version in 9x, but this method does not work in NT/2 K. Okay, NT/2 K
The/device/physicalmemory device is provided to obtain the physical address. Under 9x
The serial number of the motherboard can be obtained through the access address fec71h. Although the serial number of the motherboard is not guaranteed for NT/2 K,
However, after repeated tests on multiple machines, the value of this address remains unchanged and unique. Below is my drive
TheCodeAnd I hope you can correct the error.
Boolean mainboardbiosserialno ()
{
Handle physmem;
Unicode_string physmemstring;
Object_attributes attributes;
Wchar physmemname [] = L // device // physicalmemory;
Ntstatus;
DWORD Radd = 0xfec71;
DWORD ladd= 100;
DWORD oadd;
Dword I;
Rtlinitunicodestring (& physmemstring, physmemname );
Initializeobjectattributes (& attributes,
& Physmemstring,
Obj_case_insensitive,
Null,
Null
);
Ntstatus = zwopensection (& physmem,
Section_map_read,
& Attributes
);
If (! Nt_success (ntstatus ))
{
Dbuplint ("zwopensection () is error/N ");
Return false;
}
Dbuplint ("zwopensection () is OK/N ");
If (! Mapview (physmem, & Radd, & Ladd, & oadd ))
{
Dbuplint ("mapview () is error/N ");
Return false;
}
Dbuplint ("mapview () is OK/N ");
For (I = 0; I <Ladd; I ++)
{
Dbuplint ("% x", * (puchar) (oadd + I ));
}
Ntstatus = zwunmapviewofsection (handle)-1, (pvoid) oadd );
If (! Nt_success (ntstatus ))
{
Dbuplint ("unable to unmap View ");
Return false;
}
Return true;
}
Boolean mapview (handle hpmemory, DWORD * dwaddress, DWORD * dwlength, DWORD * dwvaddress)
{
Ntstatus status;
Physical_address viewbaseaddress;
* Dwvaddress = 0;
Viewbaseaddress. quadpart = (ulonglong) (* dwaddress );
Status = zwmapviewofsection (hpmemory,
(Handle)-1,
(Pvoid) dwvaddress,
0,
* Dwlength,
& Viewbaseaddress,
Dwlength,
Viewshare,
0,
Page_readonly
);
If (! Nt_success (Status ))
{
Return false;
}
Return true;
}
Http://topic.csdn.net/t/20030379/07/1661170.htmlhow can I use vcpus to obtain the CPU serial number?