高分求获取主板、BIOS系列号源码?

Automatic 2005-11-09 08:07:11
如题!
为什么只能给200分啊?


Thanks all!
...全文
1572 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
he_sl 2006-02-22
  • 打赏
  • 举报
回复
mark
taianmonkey 2006-02-22
  • 打赏
  • 举报
回复
void CReadBiosIdDlg::OnButton1()
{
// TODO: Add your control notification handler code here
CString strBiosId = GetBiosId();
AfxMessageBox(strBiosId);
}

CString CReadBiosIdDlg::GetBiosId()
{
HANDLE physmem;
DWORD vaddress, paddress;
DWORD length=1;

CString strId;

char ch;


if(!ReadBiosIdClass.LocateNtdllEntryPoints())
{
AfxMessageBox("Unable to locate NTDLL entry points!");
return -1;
}
//
// Open physical memory
//
if( !(physmem = ReadBiosIdClass.OpenPhysicalMemory()))
{
return -1;
}

int i=0;
paddress=0x000fec71;//Award
ReadBiosIdClass.MapPhysicalMemory( physmem, &paddress, &length,&vaddress ) ;
paddress=0x000fec71-0x000fe000;

if(ReadBiosIdClass.biosCheckAward(vaddress+paddress))
{
strId = _T("Is Award Bios! ");
while(i<50)
{
if(*(PUCHAR)(vaddress+paddress+i) > 0x20 && *(PUCHAR)(vaddress+paddress+i) < 0x71)
{
ch = *(PCHAR)(vaddress+paddress+i);
strId = strId + ch;
//printf("%c", ch);
}
else
{
//printf("\r\n");
break;
}
i++;
}
}

paddress=0x000ff478;//AMI
ReadBiosIdClass.MapPhysicalMemory( physmem, &paddress, &length,&vaddress ) ;
paddress=0x000ff478-0x000ff000;

if(ReadBiosIdClass.biosCheckAMI(vaddress+paddress))
{
strId = _T("Is AMI Bios! ");
while(i<50)
{
if(*(PUCHAR)(vaddress+paddress+i) > 0x20 && *(PUCHAR)(vaddress+paddress+i) < 0x71)
{
ch = *(PCHAR)(vaddress+paddress+i);
strId = strId + ch;
//printf("%c", ch);
}
else
{
//printf("\r\n");
break;
}
i++;
}
}

paddress=0x000ff478;//AMI
ReadBiosIdClass.MapPhysicalMemory( physmem, &paddress, &length,&vaddress ) ;
paddress=0x000ff478-0x000ff000;

if(ReadBiosIdClass.biosCheckAMI(vaddress+paddress))
{
while(i<50)
{
if(*(PUCHAR)(vaddress+paddress+i) > 0x20 && *(PUCHAR)(vaddress+paddress+i) < 0x71)
{
ch = *(PCHAR)(vaddress+paddress+i);
strId = strId + ch;
//printf("%c", ch);
}
else
{
printf("\r\n");
break;

}
i++;
}
}

paddress=0x000f6577;//Phoenix
ReadBiosIdClass.MapPhysicalMemory( physmem, &paddress, &length,&vaddress ) ;
paddress=0x000f6577-0x000f6000;

if(ReadBiosIdClass.biosCheckPhoenix(vaddress+paddress))
{
strId = _T("Is Phoenix Bios! ");
while(i<50)
{
if(*(PUCHAR)(vaddress+paddress+i) > 0x20 && *(PUCHAR)(vaddress+paddress+i) < 0x71)
{
ch = *(PCHAR)(vaddress+paddress+i);
strId = strId + ch;
//printf("%c", ch);
}
else
{
//printf("\r\n");
break;
}
i++;
}
}

paddress=0x000f7196;//Phoenix
ReadBiosIdClass.MapPhysicalMemory( physmem, &paddress, &length,&vaddress ) ;
paddress=0x000f7196-0x000f7000;

if(ReadBiosIdClass.biosCheckPhoenix(vaddress+paddress))
{
strId = _T("Is Phoenix Bios! ");
while(i<50)
{
if(*(PUCHAR)(vaddress+paddress+i) > 0x20 && *(PUCHAR)(vaddress+paddress+i) < 0x71)
{
ch = *(PCHAR)(vaddress+paddress+i);
strId = strId + ch;
//printf("%c", ch);
}
else
{
//printf("\r\n");
break;
}
i++;
}
}
paddress=0x000f7550;//Phoenix
ReadBiosIdClass.MapPhysicalMemory( physmem, &paddress, &length,&vaddress ) ;
paddress=0x000f7550-0x000f7000;

if(ReadBiosIdClass.biosCheckPhoenix(vaddress+paddress))
{
strId = _T("Is Phoenix Bios! ");
while(i<50)
{
if(*(PUCHAR)(vaddress+paddress+i) > 0x20 && *(PUCHAR)(vaddress+paddress+i) < 0x71)
{
ch = *(PCHAR)(vaddress+paddress+i);
strId = strId + ch;
//printf("%c", ch);
}
else
{
//printf("\r\n");
break;
}
i++;
}
}
CloseHandle(physmem);
return strId;
}
taianmonkey 2006-02-22
  • 打赏
  • 举报
回复
// ReadBiosIdClass.cpp: implementation of the CReadBiosIdClass class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ReadBiosIdClass.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//
#define BYTESPERLINE 16
//
// Lines to print before pause
//
#define LINESPERSCREEN 25


NTSTATUS (__stdcall *NtUnmapViewOfSection)
(
IN HANDLE ProcessHandle,
IN PVOID BaseAddress
);
NTSTATUS (__stdcall *NtOpenSection)
(
OUT PHANDLE SectionHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes
);
NTSTATUS (__stdcall *NtMapViewOfSection)
(
IN HANDLE SectionHandle,
IN HANDLE ProcessHandle,
IN OUT PVOID *BaseAddress,
IN ULONG ZeroBits,
IN ULONG CommitSize,
IN OUT PLARGE_INTEGER SectionOffset, /* optional */
IN OUT PULONG ViewSize,
IN SECTION_INHERIT InheritDisposition,
IN ULONG AllocationType,
IN ULONG Protect
);
VOID (__stdcall *RtlInitUnicodeString)
(
IN OUT PUNICODE_STRING DestinationString,
IN PCWSTR SourceString
);
ULONG (__stdcall *RtlNtStatusToDosError)
(
IN NTSTATUS Status
);

CReadBiosIdClass::CReadBiosIdClass()
{

}

CReadBiosIdClass::~CReadBiosIdClass()
{

}

int CReadBiosIdClass::biosCheckAward(DWORD Add)
{
//Example
//AWard:07/08/2002-i845G-ITE8712-JF69VD0CC-00
// 10/10/98-xxx……
//Phoenix-Award:03/12/2002-sis645-p4s333
if(*(PUCHAR)(Add+2)=='/' && *(PUCHAR)(Add+5)=='/'){
CHAR *p=(CHAR*)Add;
while(*p){
if(*p < 0x20 || *p > 0x71)
goto NOT_AWARD;
p++;
}
return 1;

}

NOT_AWARD:
return 0;
}

int CReadBiosIdClass::biosCheckPhoenix(DWORD Add)
{
//Example
//Phoenix:NITELT0.86B.0044.P11.9910111055
if(*(PUCHAR)(Add+7)=='.' && *(PUCHAR)(Add+11)=='.'){
CHAR *p=(PCHAR)Add;
while(*p){
if(*p < 0x20 || *p > 0x71)
goto NOT_PHOENIX;
p++;
}
return 1;
}
NOT_PHOENIX:
return 0;
}

int CReadBiosIdClass::biosCheckAMI(DWORD Add)
{
//Example
//AMI:51-2300-000000-00101111-030199-
if(*(PUCHAR)(Add+2)=='-' && *(PUCHAR)(Add+7)=='-'){
CHAR *p=(PCHAR)Add;
while(*p){
if(*p < 0x20 || *p > 0x71)
goto NOT_AMI;
p++;
}
return 1;

}
NOT_AMI:
return 0;
}

VOID CReadBiosIdClass::UnmapPhysicalMemory(DWORD Address)
{
NTSTATUS status;
status = NtUnmapViewOfSection( (HANDLE) -1, (PVOID) Address );
if( !NT_SUCCESS(status))
{
PrintError("Unable to unmap view", status );
}
}

BOOL CReadBiosIdClass::MapPhysicalMemory(HANDLE PhysicalMemory, PDWORD Address, PDWORD Length, PDWORD VirtualAddress)
{
NTSTATUS ntStatus;
PHYSICAL_ADDRESS viewBase;
char error[256];
*VirtualAddress = 0;
viewBase.QuadPart = (ULONGLONG) (*Address);
ntStatus = NtMapViewOfSection (PhysicalMemory,
(HANDLE) -1,
(PVOID *) VirtualAddress,
0L,
*Length,
&viewBase,
Length,
ViewShare,
0,
PAGE_READONLY );
if( !NT_SUCCESS( ntStatus ))
{
sprintf( error, "Could not map view of %X length %X",
*Address, *Length );
PrintError( error, ntStatus );
return FALSE;
}
*Address = viewBase.LowPart;
return TRUE;
}

HANDLE CReadBiosIdClass::OpenPhysicalMemory()
{
NTSTATUS status;
HANDLE physmem;
UNICODE_STRING physmemString;
OBJECT_ATTRIBUTES attributes;
WCHAR physmemName[] = L"\\device\\physicalmemory";
RtlInitUnicodeString( &physmemString, physmemName );
InitializeObjectAttributes( &attributes, &physmemString,
OBJ_CASE_INSENSITIVE, NULL, NULL );
status = NtOpenSection( &physmem, SECTION_MAP_READ, &attributes );
if( !NT_SUCCESS( status ))
{
PrintError( "Could not open \\device\\physicalmemory", status );
return NULL;
}
return physmem;
}

BOOL CReadBiosIdClass::LocateNtdllEntryPoints()
{
if( !(RtlInitUnicodeString = (void (__stdcall *)(PUNICODE_STRING,PCWSTR)) GetProcAddress( GetModuleHandle("ntdll.dll"),"RtlInitUnicodeString" )) )
{
return FALSE;
}
if( !(NtUnmapViewOfSection = (NTSTATUS (__stdcall *)(HANDLE,PVOID)) GetProcAddress( GetModuleHandle("ntdll.dll"),"NtUnmapViewOfSection" )) )
{
return FALSE;
}
if( !(NtOpenSection = (NTSTATUS (__stdcall *)(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES)) GetProcAddress( GetModuleHandle("ntdll.dll"),"NtOpenSection" )) )
{
return FALSE;
}
if( !(NtMapViewOfSection = (NTSTATUS (__stdcall *)(IN HANDLE,
IN HANDLE,
IN OUT PVOID *,
IN ULONG ,
IN ULONG ,
IN OUT PLARGE_INTEGER ,
IN OUT PULONG,
IN SECTION_INHERIT ,
IN ULONG ,
IN ULONG )) GetProcAddress( GetModuleHandle("ntdll.dll"),"NtMapViewOfSection" )) )
{
return FALSE;
}
if( !(RtlNtStatusToDosError = (ULONG (__stdcall *)(NTSTATUS)) GetProcAddress( GetModuleHandle("ntdll.dll"),"RtlNtStatusToDosError" )) )
{
return FALSE;
}
return TRUE;
}

void CReadBiosIdClass::PrintError(char *message, NTSTATUS status)
{
char *errMsg;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, RtlNtStatusToDosError( status ),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &errMsg, 0, NULL );
TCHAR errMessage[MAX_PATH];
sprintf(errMessage, _T("%s: %s"), message, errMsg);
//printf("", );
LocalFree( errMsg );
AfxMessageBox(errMessage);
}
taianmonkey 2006-02-22
  • 打赏
  • 举报
回复
// ReadBiosIdClass.h: interface for the CReadBiosIdClass class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_READBIOSIDCLASS_H__70BE242F_AA8A_4E12_9F03_80EF82BD053D__INCLUDED_)
#define AFX_READBIOSIDCLASS_H__70BE242F_AA8A_4E12_9F03_80EF82BD053D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define PAGE_NOACCESS 0x01 // winnt
#define PAGE_READONLY 0x02 // winnt
#define PAGE_READWRITE 0x04 // winnt
#define PAGE_WRITECOPY 0x08 // winnt
#define PAGE_EXECUTE 0x10 // winnt
#define PAGE_EXECUTE_READ 0x20 // winnt
#define PAGE_EXECUTE_READWRITE 0x40 // winnt
#define PAGE_EXECUTE_WRITECOPY 0x80 // winnt
#define PAGE_GUARD 0x100 // winnt
#define PAGE_NOCACHE 0x200 // winnt
typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS; // windbgkd
typedef LONG NTSTATUS;
#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)

typedef struct _UNICODE_STRING
{
USHORT Length;
USHORT MaximumLength;
#ifdef MIDL_PASS
[size_is(MaximumLength / 2), length_is((Length) / 2) ] USHORT * Buffer;
#else // MIDL_PASS
PWSTR Buffer;
#endif // MIDL_PASS
} UNICODE_STRING;

typedef UNICODE_STRING *PUNICODE_STRING;

typedef enum _SECTION_INHERIT
{
ViewShare = 1,
ViewUnmap = 2
} SECTION_INHERIT;

#define OBJ_INHERIT 0x00000002L
#define OBJ_PERMANENT 0x00000010L
#define OBJ_EXCLUSIVE 0x00000020L
#define OBJ_CASE_INSENSITIVE 0x00000040L
#define OBJ_OPENIF 0x00000080L
#define OBJ_OPENLINK 0x00000100L
#define OBJ_VALID_ATTRIBUTES 0x000001F2L

typedef struct _OBJECT_ATTRIBUTES
{
ULONG Length;
HANDLE RootDirectory;
PUNICODE_STRING ObjectName;
ULONG Attributes;
PVOID SecurityDescriptor; // Points to type SECURITY_DESCRIPTOR
PVOID SecurityQualityOfService; // Points to type SECURITY_QUALITY_OF_SERVICE
} OBJECT_ATTRIBUTES;

typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES;
#define InitializeObjectAttributes( p, n, a, r, s ) { \
(p)->Length = sizeof( OBJECT_ATTRIBUTES ); \
(p)->RootDirectory = r; \
(p)->Attributes = a; \
(p)->ObjectName = n; \
(p)->SecurityDescriptor = s; \
(p)->SecurityQualityOfService = NULL; \
}

class CReadBiosIdClass
{
public:
void PrintError( char *message, NTSTATUS status );
BOOL LocateNtdllEntryPoints();
HANDLE OpenPhysicalMemory();
BOOL MapPhysicalMemory( HANDLE PhysicalMemory,PDWORD Address, PDWORD Length,PDWORD VirtualAddress );
VOID UnmapPhysicalMemory( DWORD Address );
int biosCheckAMI(DWORD Add);
int biosCheckPhoenix(DWORD Add);
int biosCheckAward(DWORD Add);
CReadBiosIdClass();
virtual ~CReadBiosIdClass();

};

#endif // !defined(AFX_READBIOSIDCLASS_H__70BE242F_AA8A_4E12_9F03_80EF82BD053D__INCLUDED_)
yanglimei 2006-02-20
  • 打赏
  • 举报
回复
如何获取显卡的型号呢?(在未装显卡驱动之前)也请大家帮帮我呀
我发了贴,怎么都没人回呢,是分不够吗?
__mu 2006-02-20
  • 打赏
  • 举报
回复
楼主,我刚用了WMI方法得到了主板型号,至于bios,注册表就可以了,很简单,试试吧
yayaniuniu502 2005-11-20
  • 打赏
  • 举报
回复
帮顶一个
38062708 2005-11-16
  • 打赏
  • 举报
回复
来接点分哈
0011411 2005-11-15
  • 打赏
  • 举报
回复
简单啊
DrSmart 2005-11-15
  • 打赏
  • 举报
回复
恩,四楼的跳进ring0方法在xp的sp2和2003的sp1中禁止了,并且用了本机api,有些麻烦,不过你还是可以用读取注册表的方法搞定的,楼上的方法不错
屋顶上的老猫 2005-11-15
  • 打赏
  • 举报
回复
void CTestDlg::OnBnClickedBtnupdate()
{
HKEY hKey;
LPCTSTR StrKey="HARDWARE\\DESCRIPTION\\System";
if (ERROR_SUCCESS==::RegOpenKeyEx(HKEY_LOCAL_MACHINE,StrKey,NULL,KEY_ALL_ACCESS,&hKey))
{
DWORD dwSize=255,dwType=REG_SZ;
char String[256];
LPCSTR KeyValue="VideoBiosDate";
if (ERROR_SUCCESS==::RegQueryValueEx(hKey,KeyValue,0,&dwType,(BYTE *)String,&dwSize))
{
CString StrData=String;
MessageBox("显卡BIOS的更新日期为:"+StrData,"信息提示",MB_OK);
}
::RegCloseKey(hKey);
}
}

void CTestDlg::OnBnClickedBtnsysver()
{
HKEY hKey;
LPCTSTR StrKey="HARDWARE\\DESCRIPTION\\System";
if (ERROR_SUCCESS==::RegOpenKeyEx(HKEY_LOCAL_MACHINE,StrKey,NULL,KEY_ALL_ACCESS,&hKey))
{
DWORD dwSize=255,dwType=REG_MULTI_SZ;
char String[256];
LPCSTR KeyValue="SystemBiosVersion";
if (ERROR_SUCCESS==::RegQueryValueEx(hKey,KeyValue,0,&dwType,(BYTE *)String,&dwSize))
{
CString StrData=String;
MessageBox("系统BIOS的版本号为:"+StrData,"信息提示",MB_OK);
}
::RegCloseKey(hKey);
}
}

void CTestDlg::OnBnClickedBtnsysupdate()
{
HKEY hKey;
LPCTSTR StrKey="HARDWARE\\DESCRIPTION\\System";
if (ERROR_SUCCESS==::RegOpenKeyEx(HKEY_LOCAL_MACHINE,StrKey,NULL,KEY_ALL_ACCESS,&hKey))
{
DWORD dwSize=255,dwType=REG_SZ;
char String[256];
LPCSTR KeyValue="SystemBiosDate";
if (ERROR_SUCCESS==::RegQueryValueEx(hKey,KeyValue,0,&dwType,(BYTE *)String,&dwSize))
{
CString StrData=String;
MessageBox("系统BIOS的更新日期为:"+StrData,"信息提示",MB_OK);
}
::RegCloseKey(hKey);
}
}
屋顶上的老猫 2005-11-15
  • 打赏
  • 举报
回复
void CTestDlg::OnBnClickedBtnver()
{
HKEY hKey;
LPCTSTR StrKey="HARDWARE\\DESCRIPTION\\System";
if (ERROR_SUCCESS==::RegOpenKeyEx(HKEY_LOCAL_MACHINE,StrKey,NULL,KEY_ALL_ACCESS,&hKey))
{
DWORD dwSize=255,dwType=REG_MULTI_SZ;
char String[256];
LPCSTR KeyValue="VideoBiosVersion";
if (ERROR_SUCCESS==::RegQueryValueEx(hKey,KeyValue,0,&dwType,(BYTE *)String,&dwSize))
{
CString StrData=String;
MessageBox("显卡BIOS的版本号为:"+StrData,"信息提示",MB_OK);
}
::RegCloseKey(hKey);
}
}
Kudeet 2005-11-15
  • 打赏
  • 举报
回复
可以用SetupDi系列的API函数取系统信息
GoAround 2005-11-11
  • 打赏
  • 举报
回复
来个WMI的

#define _WIN32_DCOM

#include <stdio.h>
#include <objbase.h>
#include <comdef.h>
#include <wbemidl.h>

void PrintBiosUuid();

void main(void)
{
PrintBiosUuid();

return;
};

void PrintBiosUuid()
{
BOOL bRet = FALSE;
HRESULT hr = S_OK;
BSTR bstrNamespace = L"root\\cimv2";
BSTR bstrQuery = L"SELECT * FROM Win32_ComputerSystemProduct";
VARIANT vVal;
ULONG uEnumRet = 0;
IWbemLocator *pWbemLocator = NULL;
IWbemServices *pServices = NULL;
IEnumWbemClassObject *pEnum = NULL;
IWbemClassObject *pObj = NULL;

hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
hr = CoInitializeSecurity(NULL, -1, NULL, NULL,
RPC_C_AUTHN_LEVEL_CONNECT,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL, EOAC_NONE, 0);
if (FAILED(hr))
{
CoUninitialize();
#ifdef _DEBUG
printf("Failed to initialize security. "); printf("Error code = [0x%8X]\n", hr);
#endif
goto EXIT;
}

hr = CoCreateInstance(CLSID_WbemLocator, NULL,
CLSCTX_INPROC_SERVER, IID_IWbemLocator,
(void**) &pWbemLocator);
if( FAILED(hr) )
{
#ifdef _DEBUG
printf("CoCreateInstance failed. "); printf("Error code = [0x%8X]\n", hr);
#endif
goto EXIT;
}

hr = pWbemLocator->ConnectServer(bstrNamespace, NULL, NULL, NULL,
0, NULL, NULL, &pServices);
if(FAILED(hr))
{
#ifdef _DEBUG
printf("pWbemLocator->ConnectServer failed. "); printf("Error code = [0x%8X]\n", hr);
#endif
goto EXIT;
}

pWbemLocator->Release();
pWbemLocator = NULL;

#ifdef _DEBUG
printf("Successfully connected to namespace [%S]\n", bstrNamespace);
#endif

hr = pServices->ExecQuery(L"WQL", bstrQuery, 0, NULL, &pEnum);

if(FAILED(hr))
{
#ifdef _DEBUG
printf("IWbemServices::ExecQuery failed. "); printf("Error code = [0x%X]\n", hr);
#endif
goto EXIT;
}

hr = pEnum->Reset();
hr = pEnum->Next(WBEM_INFINITE, 1, &pObj, &uEnumRet);

while(S_OK == hr)
{
hr = pObj->Get(L"UUID", 0, &vVal, NULL, NULL);
wprintf(L"BIOS UUID is: [%s]\n", vVal.bstrVal);
hr = pObj->Get(L"Vendor", 0, &vVal, NULL, NULL);
wprintf(L"Vendor is: [%s]\n", vVal.bstrVal);

hr = pEnum->Next(WBEM_INFINITE, 1, &pObj, &uEnumRet);
}

if(FAILED(hr))
{
#ifdef _DEBUG
printf("IEnumWbemClassObject::Next failed. "); printf("Error code = [0x%8X]\n", hr);
#endif
goto EXIT;
}

EXIT:
if(pObj)
pObj->Release();

if(pEnum)
pEnum->Release();

if(pServices)
pServices->Release();

if(pWbemLocator)
pWbemLocator->Release();

CoUninitialize();
}
masterz 2005-11-11
  • 打赏
  • 举报
回复
http://www.winsim.com/diskid32/diskid32.html
GoAround 2005-11-10
  • 打赏
  • 举报
回复
还是用WMI接口好,\\device\\physicalmemory在w2k3 sp1里不能从用户态访问了,估计XP sp3也会这样。
rageliu 2005-11-09
  • 打赏
  • 举报
回复
// BIOS 编号,支持 AMI, AWARD, PHOENIX
{
SIZE_T ssize;

LARGE_INTEGER so;
so.LowPart=0x000f0000;
so.HighPart=0x00000000;
ssize=0xffff;
wchar_t strPH[30]=L"\\device\\physicalmemory";

DWORD ba=0;

UNICODE_STRING struniph;
struniph.Buffer=strPH;
struniph.Length=0x2c;
struniph.MaximumLength =0x2e;

OBJECT_ATTRIBUTES obj_ar;
obj_ar.Attributes =64;
obj_ar.Length =24;
obj_ar.ObjectName=&struniph;
obj_ar.RootDirectory=0;
obj_ar.SecurityDescriptor=0;
obj_ar.SecurityQualityOfService =0;

HMODULE hinstLib = LoadLibrary("ntdll.dll");
ZWOS ZWopenS=(ZWOS)GetProcAddress(hinstLib,"ZwOpenSection");
ZWMV ZWmapV=(ZWMV)GetProcAddress(hinstLib,"ZwMapViewOfSection");
ZWUMV ZWunmapV=(ZWUMV)GetProcAddress(hinstLib,"ZwUnmapViewOfSection");

//调用函数,对物理内存进行映射
HANDLE hSection;
if( 0 == ZWopenS(&hSection,4,&obj_ar) &&
0 == ZWmapV(
( HANDLE )hSection, //打开Section时得到的句柄
( HANDLE )0xFFFFFFFF, //将要映射进程的句柄,
&ba, //映射的基址
0,
0xFFFF, //分配的大小
&so, //物理内存的地址
&ssize, //指向读取内存块大小的指针
1, //子进程的可继承性设定
0, //分配类型
2 //保护类型
) )
//执行后会在当前进程的空间开辟一段64k的空间,并把f000:0000到f000:ffff处的内容映射到这里
//映射的基址由ba返回,如果映射不再有用,应该用ZwUnmapViewOfSection断开映射
{
BYTE* pBiosSerial = ( BYTE* )ba;
UINT uBiosSerialLen = FindAwardBios( &pBiosSerial );
if( uBiosSerialLen == 0U )
{
uBiosSerialLen = FindAmiBios( &pBiosSerial );
if( uBiosSerialLen == 0U )
{
uBiosSerialLen = FindPhoenixBios( &pBiosSerial );
}
}
if( uBiosSerialLen != 0U )
{
CopyMemory( szSystemInfo + uSystemInfoLen, pBiosSerial, uBiosSerialLen );
uSystemInfoLen += uBiosSerialLen;
}
ZWunmapV( ( HANDLE )0xFFFFFFFF, ( void* )ba );
}
}
flyelf 2005-11-09
  • 打赏
  • 举报
回复
可以通过IWbem接口来获取:IWbemClassObject等
lixiaosan 2005-11-09
  • 打赏
  • 举报
回复
http://www.lihuasoft.net/news/show.php?id=2368

以下是dephi的,
注意其中用到的一写api,

应该很容易改成vc的
lixiaosan 2005-11-09
  • 打赏
  • 举报
回复
http://www.pgsun.com/download/doc/2005714102153.htm
加载更多回复(1)

2,641

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 硬件/系统
社区管理员
  • 硬件/系统社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧