用哪个函数可以读到主板bios上的信息?

wvvw 2004-11-01 09:57:27
在c#里头,我在wmi里找到了一个win32_bios找到我要的信息,但由于用.net都要安装framework,所以考虑用delphi来做,请各位帮帮忙。。
...全文
207 5 打赏 收藏 举报
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
wvvw 2004-11-01
  • 打赏
  • 举报
回复
ksaiy(消失在人海)
能不能把程序给全呢??
jinjazz 2004-11-01
  • 打赏
  • 举报
回复
http://www.applevb.com/sourcecode/ssystem.htm

里面有一个wmi的例子
ksaiy 2004-11-01
  • 打赏
  • 举报
回复
你需要哪些信息啊?

下面的代码能取这些东东:
WIN2000下:

BIOS 版本: Phoenix-Award BIOS v6.00PG
BIOS 版权信息: Copyright (C) 2002, Phoenix Technologies, LTD
BIOS 日期: 07/05/02
名称: 82845GL INTEL BIOS V1.1 Jul.17,2002
主板序列号: 07/05/2002-i845-W83627-6A69VQ1GC-00

串口 1 输入/输出范围: 3F8
串口 2 输入/输出范围: 2F8
串口 3 输入/输出范围: 0
串口 4 输入/输出范围: 0

并口 1 输入/输出范围: 378
并口 2 输入/输出范围: 0
并口 3 输入/输出范围: 0


98下可以直接用形如 StrPas(PChar(Ptr($FFFF5))) 取得,2000下因为权限的问题,不能直接访问
下面的程序可以直接读取物理内存,取出相应的信息

unit Main;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Aclapi, Accctrl, StdCtrls;

type
TMainForm = class(TForm)
InfoMemo: TMemo;
btGetInfo: TButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure btGetInfoClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
PUnicodeString = ^TUnicodeString;
TUnicodeString = packed record
Length: Word;
MaximunLength: Word;
Buffer: PWideChar;
end;
NTSTATUS = Integer;
PObjectAttributes = ^TObjectAttributes;
TObjectAttributes = packed record
Length: DWORD;
RootDirectory: THandle;
ObjectName: PUnicodeString;
Attributes: DWORD;
SecurityDescriptor: PSecurityDescriptor;
SecurityQualityOfService: PSecurityQualityOfService;
end;
TZwOpenSection = function(var SectionHandle: THandle; DesireAccess: ACCESS_MASK;
var ObjectAttributes: TObjectAttributes): NTSTATUS; stdcall;
TZwClose = procedure(SectionHandle: THandle); stdcall;
TRtlInitUnicodeString = procedure(var DestinationString: TUnicodeString;
vSourceString: WideString); stdcall;

const
STATUS_SUCCESS = NTSTATUS(0);
STATUS_INVALID_HANDLE = NTSTATUS($C0000008);
STATUS_ACCESS_DENIED = NTSTATUS($C0000022);

OBJ_INHERIT = $00000002;
OBJ_PERMANENT = $00000010;
OBJ_EXCLUSIVE = $00000020;
OBJ_CASE_INSENSITIVE = $00000040;
OBJ_OPENIF = $00000080;
OBJ_OPENLINK = $00000100;
OBJ_KERNEL_HANDLE = $00000200;
OBJ_VALID_ATTRIBUTES = $000003F2;

ObjectPhysicalMemoryDeviceName = '\Device\Physicalmemory';
NTDLL = 'ntdll.dll';

var
ZwOpenSection: TZwOpenSection;
ZwClose: TZwClose;
RtlInitUnicodeString: TRtlInitUnicodeString;

var
MainForm: TMainForm;
NtLayer: HMODULE;

implementation

{$R *.dfm}

function NT_SUCCESS(var Status: LongInt): Boolean;
begin
Result:=LongInt(Status) >= 0;
end;

procedure InitializeObjectAttributes(var p: TObjectAttributes; n: PUnicodeString;
a: DWORD; r: THandle; s: PSecurityDescriptor);
begin
p.Length:=SizeOf(TObjectAttributes);
p.RootDirectory:=r;
p.Attributes:=a;
p.ObjectName:=n;
p.SecurityDescriptor:=s;
p.SecurityQualityOfService:=Nil;
end;

function SetPhysicalMemorySectionCanBeWrited(hSection: THandle): Boolean;
var
pDacl: PACL;
pNewDacl: PACL;
pSD: PPSECURITY_DESCRIPTOR;
dwRes: Cardinal;
ea: EXPLICIT_ACCESS_A;
label CleanUp;
begin
Result:=False;

pDacl:=Nil;
pNewDacl:=Nil;
pSD:=Nil;

dwres:=GetSecurityInfo(hSection,SE_KERNEL_OBJECT,DACL_SECURITY_INFORMATION,nil,
nil,@pDacl,nil,pSD);
try
if dwres<>ERROR_SUCCESS then
Exit;

FillChar(ea,SizeOf(EXPLICIT_ACCESS),0);
ea.grfAccessPermissions:=SECTION_MAP_WRITE;
ea.grfAccessMode:=GRANT_ACCESS;
ea.grfInheritance:=NO_INHERITANCE;
ea.Trustee.TrusteeForm:=TRUSTEE_IS_NAME;
ea.Trustee.TrusteeType:=TRUSTEE_IS_USER;
ea.Trustee.ptstrName:='CURRENT_USER';
SetEntriesInAcl(1,@ea,Nil,pNewDacl);

dwRes:=SetSecurityInfo(hSection,SE_KERNEL_OBJECT,DACL_SECURITY_INFORMATION,
Nil,Nil,pNewDacl,Nil);
if dwRes=ERROR_SUCCESS then
Exit;

Result:=True;
finally
if pSD<>Nil then
LocalFree(Cardinal(pSD^));
if pNewDacl<>Nil then
LocalFree(Cardinal(pSD^));
end;
end;

function OpenPhysicalMemory(ReadOrNot: Boolean): THandle;
var
Status: NTSTATUS;
PhysMem: THandle;
PhysMemString: TUnicodeString;
Attributes: TObjectAttributes;
SectionAttrib: Integer;
PhysMemName: WideString;
begin
Result:=0;
PhysMemName:=ObjectPhysicalMemoryDeviceName;
RtlInitUnicodeString(PhysMemString,PhysMemName);
InitializeObjectAttributes(Attributes,@PhysMemString,OBJ_CASE_INSENSITIVE
or OBJ_KERNEL_HANDLE,0,Nil);

wvvw 2004-11-01
  • 打赏
  • 举报
回复
加分一下。
用bioshelp.pas里给的例子,我需要的主板序列号出不来。

ksaiy(消失在人海) ,能不能将一下怎么调用你程序里的那些函数?
ly_liuyang 2004-11-01
  • 打赏
  • 举报
回复
Google上找Bioshelp.pas就OK了

http://lysoft.7u7.net
发帖
Windows SDK/API

1177

社区成员

Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
帖子事件
创建了帖子
2004-11-01 09:57
社区公告
暂无公告