DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: snarv
今日帖子: 11
在线用户: 16
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 power (老刘) ★☆☆☆☆ -
普通会员
2003/9/14 13:24:53
标题:
请教各位高手: 浏览:2497
加入我的收藏
楼主: 如何取出电脑主板、CPU及网卡的序列号?

----------------------------------------------
老刘
作者:
男 power (老刘) ★☆☆☆☆ -
普通会员
2003/9/14 13:29:22
1楼: 新手求教:如何取出电脑主板、CPU及网卡的序列号?
----------------------------------------------
老刘
作者:
男 cjrb (Thinking In 魂) ★☆☆☆☆ -
盒子活跃会员
2003/9/14 13:42:27
2楼: (找本CHM查查)

网卡
在iphlpapi.dll里面有一个函数:GetAdaptersInfo() 
好像是干这个用的。说明如下:

GetAdaptersInfo

The GetAdaptersInfo function retrieves adapter information for the local computer.

DWORD GetAdaptersInfo(

PIP_ADAPTER_INFO pAdapterInfo, // buffer to receive data

PULONG pOutBufLen // size of data returned

);

Parameters

pAdapterInfo

[out] Pointer to a buffer that, , receives a linked list of IP_ADAPTER_INFO structures.

pOutBufLen

[in] Pointer to a ULONG variable that specifies the size of the buffer pointed to by the pAdapterInfo parameter. If this size is insufficient to hold the adapter information, GetAdaptersInfo fills in this variable with the required size, and returns an error code of ERROR_BUFFER_OVERFLOW.

Return Values

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is one of the following error codes.

Value Meaning

ERROR_BUFFER_OVERFLOW The buffer size indicated by the pOutBufLen parameter is too small to hold the adapter information. The pOutBufLen parameter points to the required size.

ERROR_INVALID_PARAMETER The pOutBufLen parameter is NULL, or the calling process does not have read/write access to the memory pointed to by pOutBufLen, or the calling process does not have write access to the memory pointed to by the pAdapterInfo parameter.

ERROR_NO_DATA No adapter information exists for the local computer.

ERROR_NOT_SUPPORTED GetAdaptersInfo is not supported by the operating system running on the local computer.

Other If the function fails, use FormatMessage to obtain the message string for the returned error.

 

Requirements

Windows NT/2000: Requires Windows 2000.

Windows 95/98: Requires Windows 98.

Header: Declared in Iphlpapi.h.//没有

Library: Use Iphlpapi.lib.//没有

 

 

IP_ADAPTER_INFO

The IP_ADAPTER_INFO structure contains information about a particular network adapter on the local computer.

typedef struct _IP_ADAPTER_INFO {

struct _IP_ADAPTER_INFO* Next;

DWORD ComboIndex;

char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];

char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];

UINT AddressLength;

BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];

DWORD Index;

UINT Type;

UINT DhcpEnabled;

PIP_ADDR_STRING CurrentIpAddress;

IP_ADDR_STRING IpAddressList;

IP_ADDR_STRING GatewayList;

IP_ADDR_STRING DhcpServer;

BOOL HaveWins;

IP_ADDR_STRING PrimaryWinsServer;

IP_ADDR_STRING SecondaryWinsServer;

time_t LeaseObtained;

time_t LeaseExpires;

} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;

Members

Next

Pointer to the next adapter in the linked list of adapters.

ComboIndex

This member is unused.

AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]

Specifies the name of the adapter.

Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]

Specifies a description for the adapter.

AddressLength

Specifies the length of the hardware address for the adapter.

Address[MAX_ADAPTER_ADDRESS_LENGTH]

Specifies the hardware address for the adapter. //这个是不是你想要的?

Index

Specifies the adapter index.

Type

Specifies the adapter type.

DhcpEnabled

Specifies whether dynamic host configuration protocol (DHCP) is enabled for this adapter.

CurrentIpAddress

Specifies the current IP address for this adapter.

IpAddressList

Specifies the list of IP addresses associated with this adapter.

GatewayList

Specifies the IP address of the default gateway for this adapter.

DhcpServer

Specifies the IP address of the DHCP server for this adapter.

HaveWins

Specifies whether this adapter uses Windows Internet Name Service (WINS).

PrimaryWinsServer

Specifies the IP address of the primary WINS server.

SecondaryWinsServer

Specifies the IP address of the secondary WINS server.

LeaseObtained

Specifies the time when the current DHCP lease was obtained.

LeaseExpires

Specifies the time when the current DHCP lease will expire.

Requirements

Windows NT/2000: Requires Windows 2000.

Windows 95/98: Requires Windows 98.

Header: Declared in Iptypes.h.
-------------------------
cpuID:
procedure TForm1.Button1Click(Sender: TObject); 
var rebx,recx,redx:dword;

str1:string;

begin

asm

mov eax,0

db 0fh,0a2h // cpuid

mov rebx,ebx

mov recx,ecx

mov redx,edx

end;

str1:=chr(rebx mod $100)+chr((rebx div $100) mod $100)+chr((rebx div

$10000) mod $100)+chr((rebx div $1000000) mod $100);

str1:=str1+chr(redx mod $100)+chr((redx div $100) mod $100)+chr((redx div

$10000) mod $100)+chr((redx div $1000000) mod $100);

str1:=str1+chr(recx mod $100)+chr((recx div $100) mod $100)+chr((recx div

$10000) mod $100)+chr((recx div $1000000) mod $100);

edit1.text:=str1; {一执行此句就出错}

end;

end.

eax, ebx都是比较重要的寄存器,建议你用它们之前先将其入栈(最好将所有寄存器入

栈比较保险:pushad/popad),在用完后弹出栈。

*************

有这样一段代码得出CPU厂家:

int mycpuid[20];

tchar zzz[20];

_asm

{

mov eax,0

cpuid

mov mycpuid[0],ebx

mov mycpuid[4],edx

mov mycpuid[8],ecx

}

sprintf(zzz,"CPU厂家为:",mycpuid);

在VC中编译通过。

然而我在DELPHI中却总是无法通过!并且不认cpuid(注:CPUID为微处理器中的一条指令)

:温柔一刀 时间:00-12-27 16:34:36 ID:426417

CPUID这一句换成:

DW $A20F

 

 

--------------------------------------------------------------------------------

来自:chentf 时间:00-12-28 10:06:14 ID:426985

var

a:array of integer;

begin

asm

mov eax,0

DW $A20F

mov a[0],ebx

mov a[4],edx

mov a[8],ecx

end;

按F9执行,出现错误提示框:

project project1.exe raised exception class ezccessviolation with message 'accessviolation at address 00404B58 in module 'project1.exe',write of address 7563653f'.

然后由于水平有限,也看不懂CPU中的消息.

 

 

--------------------------------------------------------------------------------

来自:Iknow 时间:00-12-28 11:12:33 ID:427051

试试以下代码:

var

a:array[0..15] of byte;

dword save_edi, save_esi, save_esp, save_ebp, save_ebx;

begin

asm

mov save_edi, EDI

mov save_esi, ESI

mov save_esp, ESP

mov save_ebp, EBP

mov save_ebx, EBX

mov eax,0

DW $A20F

lea esi, a

mov edi, 0

 

// mov a[0],ebx

mov dword ptr [esi+edi], ebx

add edi, 4

// mov a[4],edx

mov dword ptr [esi+edi], edx

add edi, 4

// mov a[8],ecx

mov dword ptr [esi+edi], ecx

 

mov ebx, save_ebx

mov ebp, save_ebp

mov esp, save_esp

mov esi, save_esi

mov EDI, save_edi

end;

end;

 
 
   


----------------------------------------------
按此在新窗口浏览图片 充电..........
作者:
男 power (老刘) ★☆☆☆☆ -
普通会员
2003/9/14 17:10:19
3楼: 向您请教:使用EDIT空件,如何实现类似与FOXPRO中Picture 子句的功能?最主要是能严格控制小数点位置
----------------------------------------------
老刘
作者:
男 cjrb (Thinking In 魂) ★☆☆☆☆ -
盒子活跃会员
2003/9/14 18:16:57
4楼: 用format可控制小数点
----------------------------------------------
按此在新窗口浏览图片 充电..........
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行89.84375毫秒 RSS