Obtain unique host information by accessing the physical address in Windows 2000

Source: Internet
Author: User

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?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.