请问如何获取主板序列号 能提供源代码吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.driverdevelop.com/forum/viewthread.php?tid=13197#pid138719Windows 2000 下通过访问物理地址取主机唯一信息(WSS-SourceCode-02005) Author: sinisterEmail: [email protected]Homepage:http://www.whitecell.org Date: 2002-05-28在9x下取得主版序列号非常简单,但此方法在NT/2K下行不通。还好NT/2K下 提供了 \Device\PhysicalMemory 设备,通过它可以得到物理地址。在9x下 通过访问地址 FEC71H 可以得到主板序列号。NT/2K下虽不保证是主板序列号, 但经过多台机器反复测试,此地址的值是不变且唯一的。下面是我 DRIVE 中 取主机唯一信息的代码,错误之处还望各位指正。 BOOLEAN MainBoardBiosSerialNo(){HANDLE physmem;UNICODE_STRING physmemString;OBJECT_ATTRIBUTES attributes;WCHAR physmemName[] = L"\\Device\\PhysicalMemory";NTSTATUS 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 )){ DbgPrint("ZwOpenSection() is error\n");return FALSE;}DbgPrint("ZwOpenSection() is OK\n");if (!MapView(physmem,&RAdd,&LAdd,&OAdd)){ DbgPrint("MapView() is error\n");return FALSE;}DbgPrint("MapView() is OK\n");for ( i = 0; i < LAdd; i ++){DbgPrint("%x",*(PUCHAR)(OAdd + i));}ntStatus = ZwUnmapViewOfSection( (HANDLE) -1, (PVOID) OAdd );if( !NT_SUCCESS(ntStatus)){DbgPrint("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;} 请教WSARecv和WSARecvFrom的区别? 宏定义,关于如果取得变量类型的 关于Dialog对话框~~~ 请问如何在一篇word文档的最后,添加新的一行或段落。 请教关于tree control 请教,谁帮我看下,怎么引入双内存画图后,画图内容消失了 真正的程序员用C,大家都是高智商的同志。请问各位如何管理自己非常多的资料,文章。方便检索和管理? 如何启动控件工具箱? 望高手赐教 比一比,到底谁的问题最菜! ^0^:送分啦~~~~~考考老鸟们的基本功[№0001] 两个问题
Windows 2000 下通过访问物理地址取主机唯一信息(WSS-SourceCode-02005) Author: sinister
Email: [email protected]
Homepage:http://www.whitecell.org
Date: 2002-05-28在9x下取得主版序列号非常简单,但此方法在NT/2K下行不通。还好NT/2K下
提供了 \Device\PhysicalMemory 设备,通过它可以得到物理地址。在9x下
通过访问地址 FEC71H 可以得到主板序列号。NT/2K下虽不保证是主板序列号,
但经过多台机器反复测试,此地址的值是不变且唯一的。下面是我 DRIVE 中
取主机唯一信息的代码,错误之处还望各位指正。 BOOLEAN MainBoardBiosSerialNo()
{HANDLE physmem;
UNICODE_STRING physmemString;
OBJECT_ATTRIBUTES attributes;
WCHAR physmemName[] = L"\\Device\\PhysicalMemory";NTSTATUS 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 ))
{
DbgPrint("ZwOpenSection() is error\n");
return FALSE;
}DbgPrint("ZwOpenSection() is OK\n");if (!MapView(physmem,&RAdd,&LAdd,&OAdd))
{
DbgPrint("MapView() is error\n");
return FALSE;
}DbgPrint("MapView() is OK\n");for ( i = 0; i < LAdd; i ++)
{
DbgPrint("%x",*(PUCHAR)(OAdd + i));}ntStatus = ZwUnmapViewOfSection( (HANDLE) -1, (PVOID) OAdd );if( !NT_SUCCESS(ntStatus))
{
DbgPrint("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;
}