我这里只有能过的各种序列号的控件,但是没有源代码。
希望能得到,cpu,主板,硬盘,网卡的全球唯一号
希望能得到,cpu,主板,硬盘,网卡的全球唯一号
解决方案 »
- 怎样看到另一台机器上的文件?
- 急~~请问如何在程序的客户区绘制数据曲线?
- 请问哪有《DELPHI5.x分布式多层应用系统编》的附书源码下载? ——不是书,是源码!
- 请问谁有关于用ADO数据库编程的程序代码,给我粘点。谢谢!来着有分!
- 为什么我用tblobfield(afield).savetofile('file.exe')总出错。
- dephi向SQL传递参数出现转换错误
- 如何知道ServerSocket.SendText()已经成功被客户端ClientSocket收到?
- 谁知道MSComn控件的注册信息怎么加啊?
- 请问那里可以下载一个叫 codeview 的软件,它好像是用力调试程序用的。.
- 小毛病,大问题
- TO 多文档窗体问题。
- 关于程序只运行一个实例的讨论。
playicq
delphibox
codesky
....
这些地方找一定能找到
不过硬盘有关的代码好像用来宾身份进去系统不能获得硬盘的序列号
1.CPU的。
function GetCPUID: TCPUID; assembler;register;
begin
asm
PUSH EBX {Save affected register}
PUSH EDI
MOV EDI,EAX {@Resukt}
MOV EAX,1
DW $A20F {CPUID Command}
STOSD {CPUID[1]}
MOV EAX,EBX
STOSD {CPUID[2]}
MOV EAX,ECX
STOSD {CPUID[3]}
MOV EAX,EDX
STOSD {CPUID[4]}
POP EDI {Restore registers}
POP EBX
end;
end;
这样应用:
MyCPUID: TCPUID;
str: string;
begin
MyCPUID := GetCPUID;
str := IntToStr(MyCPUID[1])
+ IntToStr(MyCPUID[2])
+ IntToStr(MyCPUID[3])
+ IntToStr(MyCPUID[4]);
str即为得到的CPUID。
function GetHDNumber(Index:byte=0): PChar;
//Index为硬盘号,如果有一块硬盘,Index为0时是取第一块盘的号。
const IDENTIFY_BUFFER_SIZE = 512;
type
TIDERegs = packed record
bFeaturesReg: BYTE; // Used for specifying SMART "commands".
bSectorCountReg: BYTE; // IDE sector count register
bSectorNumberReg: BYTE; // IDE sector number register
bCylLowReg: BYTE; // IDE low order cylinder value
bCylHighReg: BYTE; // IDE high order cylinder value
bDriveHeadReg: BYTE; // IDE drive/head register
bCommandReg: BYTE; // Actual IDE command.
bReserved: BYTE; // reserved for future use. Must be zero.
end;
TSendCmdInParams = packed record
// Buffer size in bytes
cBufferSize: DWORD;
// Structure with drive register values.
irDriveRegs: TIDERegs;
// Physical drive number to send command to (0,1,2,3).
bDriveNumber: BYTE;
bReserved: array[0..2] of Byte;
dwReserved: array[0..3] of DWORD;
bBuffer: array[0..0] of Byte; // Input buffer.
end;
TIdSector = packed record
wGenConfig: Word;
wNumCyls: Word;
wReserved: Word;
wNumHeads: Word;
wBytesPerTrack: Word;
wBytesPerSector: Word;
wSectorsPerTrack: Word;
wVendorUnique: array[0..2] of Word;
sSerialNumber: array[0..19] of CHAR;
wBufferType: Word;
wBufferSize: Word;
wECCSize: Word;
sFirmwareRev: array[0..7] of Char;
sModelNumber: array[0..39] of Char;
wMoreVendorUnique: Word;
wDoubleWordIO: Word;
wCapabilities: Word;
wReserved1: Word;
wPIOTiming: Word;
wDMATiming: Word;
wBS: Word;
wNumCurrentCyls: Word;
wNumCurrentHeads: Word;
wNumCurrentSectorsPerTrack: Word;
ulCurrentSectorCapacity: DWORD;
wMultSectorStuff: Word;
ulTotalAddressableSectors: DWORD;
wSingleWordDMA: Word;
wMultiWordDMA: Word;
bReserved: array[0..127] of BYTE;
end;
PIdSector = ^TIdSector;
TDriverStatus = packed record
// Çý¶¯Æ÷·µ»ØµÄ´íÎó´úÂ룬ÎÞ´íÔò·µ»Ø0
bDriverError: Byte;
// IDE³ö´í¼Ä´æÆ÷µÄÄÚÈÝ£¬Ö»Óе±bDriverError Ϊ SMART_IDE_ERROR ʱÓÐЧ
bIDEStatus: Byte;
bReserved: array[0..1] of Byte;
dwReserved: array[0..1] of DWORD;
end;
TSendCmdOutParams = packed record
// bBufferµÄ´óС
cBufferSize: DWORD;
// Çý¶¯Æ÷״̬
DriverStatus: TDriverStatus;
// ÓÃÓÚ±£´æ´ÓÇý¶¯Æ÷¶Á³öµÄÊý¾ÝµÄ»º³åÇø£¬Êµ¼Ê³¤¶ÈÓÉcBufferSize¾ö¶¨
bBuffer: array[0..0] of BYTE;
end;
var
hDevice: Thandle;
cbBytesReturned: DWORD;
SCIP: TSendCmdInParams;
aIdOutCmd: array[0..(SizeOf(TSendCmdOutParams) + IDENTIFY_BUFFER_SIZE - 1) - 1] of Byte;
IdOutCmd: TSendCmdOutParams absolute aIdOutCmd;
procedure ChangeByteOrder(var Data; Size: Integer);
var
ptr: Pchar;
i: Integer;
c: Char;
begin
ptr := @Data;
for I := 0 to (Size shr 1) - 1 do begin
c := ptr^;
ptr^ := (ptr + 1)^;
(ptr + 1)^ := c;
Inc(ptr, 2);
end;
end;
begin
Result := ''; // Èç¹û³ö´íÔò·µ»Ø¿Õ´®
if SysUtils.Win32Platform = VER_PLATFORM_WIN32_NT then
begin // Windows NT/2000/XP/.net ¸Ä±äÃû³Æ¿ÉÊÊÓÃÓÚÆäËüÇý¶¯Æ÷£¬ÈçµÚ¶þ¸öÇý¶¯Æ÷£º '\\.\PhysicalDrive1\'
// also can be SCSI0 SCSI1
hDevice := CreateFile(PChar('\\.\PhysicalDrive'+IntToStr(Index)), GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING, 0, 0);
end else // Version Windows 95 OSR2, Windows 98
hDevice := CreateFile('\\.\SMARTVSD', 0, 0, nil, CREATE_NEW, 0, 0);
if hDevice = INVALID_HANDLE_VALUE then Exit;
try
FillChar(SCIP, SizeOf(TSendCmdInParams) - 1, #0);
FillChar(aIdOutCmd, SizeOf(aIdOutCmd), #0);
cbBytesReturned := 0;
// Set up data structures for IDENTIFY command.
with SCIP do
begin
cBufferSize := IDENTIFY_BUFFER_SIZE;
// bDriveNumber := 0;
with irDriveRegs do
begin
bSectorCountReg := 1;
bSectorNumberReg := 1;
// if Win32Platform=VER_PLATFORM_WIN32_NT then bDriveHeadReg := $A0
// else bDriveHeadReg := $A0 or ((bDriveNum and 1) shl 4);
bDriveHeadReg := $A0;
bCommandReg := $EC;
end;
end;
if not DeviceIoControl(hDevice, $0007C088, @SCIP, SizeOf(TSendCmdInParams) - 1,
@aIdOutCmd, SizeOf(aIdOutCmd), cbBytesReturned, nil) then Exit;
finally
CloseHandle(hDevice);
end;
with PIdSector(@IdOutCmd.bBuffer)^ do
begin
ChangeByteOrder(sSerialNumber, SizeOf(sSerialNumber));
(Pchar(@sSerialNumber) + SizeOf(sSerialNumber))^ := #0;
Result := Pchar(@sSerialNumber);
end;
end;
下面的是检查网卡的,摘自《猛料》,没有经过我测试。unit Main;
interfaceusesSysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,Nb, ExtCtrls;typeTForm1 = class(TForm)Panel1: TPanel;Memo1: TMemo;Panel2: TPanel;Button1: TButton;procedure Button1Click(Sender: TObject);procedure FormCreate(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm1: TForm1;implementation{$R *.DFM} {---------------------------------------------}{ enumerate the lana's - works only on WIN32 }{---------------------------------------------}function NbLanaEnum: TLana_Enum;varNCB: TNCB;L_Enum: TLana_Enum;RetCode: Word;begin{$IFDEF WIN32}FillChar(NCB, SizeOf(NCB), 0);FillChar(L_Enum, SizeOf(TLana_Enum), 0);NCB.Command := NCB_ENUM;NCB.Buf := @L_Enum;NCB.Length := Sizeof(L_Enum);RetCode := NetBiosCmd(NCB);if RetCode <> NRC_GOODRET then beginL_Enum.Length := 0;L_Enum.Lana[0] := Byte(RetCode);end;{$ELSE} { not supported for WIN16, fake LANA 0 }L_Enum.Length := 1;L_Enum.Lana[0] := 0;{$ENDIF}Result := L_Enum;end;{----------------------------------------}{ Reset the lana - don't for WIN16 ! }{----------------------------------------}function NbReset(l: Byte): Word;varNCB: TNCB;begin{$IFNDEF WIN32} { will reset all your connections for WIN1 6 }Result := NRC_GOODRET; { so just fake a reset for Win16 }{$ELSE}FillChar(NCB, SizeOf(NCB), 0);NCB.Command := NCB_RESET;NCB.Lana_Num := l;Result := NetBiosCmd(NCB);{$ENDIF}end;{----------------------------------------}{ return the MAC address of an interface }{ in the form of a string like : }{ 'xx:xx:xx:xx:xx:xx' }{ using the definitions in nb.pas }{----------------------------------------}function NbGetMacAddr(LanaNum: Integer): String;varNCB: TNCB;AdpStat: TAdpStat;RetCode: Word;beginFillChar(NCB, SizeOf(NCB), 0);FillChar(AdpStat, SizeOf(AdpStat), 0);NCB.Command := NCB_ADPSTAT;NCB.Buf := @AdpStat;NCB.Length := Sizeof(AdpStat);FillChar(NCB.CallName, Sizeof(TNBName), $20);NCB.CallName[0] := Byte('*');NCB.Lana_Num := LanaNum;RetCode := NetBiosCmd(NCB);if RetCode = NRC_GOODRET then beginResult := Format('%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x',[AdpStat.ID[0],AdpStat.ID[1],AdpStat.ID[2],AdpStat.ID[3],AdpStat.ID[4],AdpStat.ID[5]]);end else beginResult := '??:??:??:??:??:??';end;end; procedure TForm1.Button1Click(Sender: TObject);beginClose;end;procedure TForm1.FormCreate(Sender: TObject);varL_Enum : TLana_Enum;RetCode: Word;i: Integer;beginL_Enum := NbLanaEnum; { enumerate lanas for WI N NT }if L_Enum.Length = 0 then beginButton1.Caption := Format('LanaEnum err=%2.2x', [L_Enum.Lana[0]]); exit;end;for i := 0 to (L_Enum.Length - 1)do begin { for every lana found }RetCode := NbReset(L_Enum.Lana[i]); { Reset lana for WIN NT }if RetCode <> NRC_GOODRET then beginButton1.Caption := Format('Reset Lana %d err=%2.2x',[i, RetCode ]);exit;end;{ Get MAC Address }Memo1.Lines.Add(Format('Lana %x = %s', [L_Enum.Lana[i], NbGetMacAd dr(i)]));end;Button1.Caption := 'Stop';end;end.—————————————————————————————————— - unit Nb;{$F+}{ nb.pas16/32 bit windows netbios access (follows IBM's Netbios 3.0 spec) (C) CEVI VZW - 29 april 1998 -- DH ([email protected]) --You can (ab)use this code as you like, but please do not remove the credits.I used reference material from IBM, Microsoft, Syntax and Byte when I wrotethe 16-bit (DOS) c-version ages ago (in Borland Turbo C 2.0 on a 38 6SX PC)with a Syntax SMB server running on Interactive Unix.I now converted this to 16 and 32 bit Delphi code.}interface uses SysUtils, Winprocs, Wintypes;const { size of a netbios name }NBNAMESIZE = 16;{ max number of network adapters }{ remeber it's BIG Blue, right ? }MAXLANAS = 254;{ NCB Command codes }NCB_ASYNC = $80; { asynch command bit to be or-ed into command }NCB_CALL = $10; { open a session }NCB_LISTEN = $11; { wait for a call }NCB_HANGUP = $12; { end session }NCB_SEND = $14; { send data }NCB_RECV = $15; { receive data }NCB_RECVANY = $16; { receive data on any session }NCB_CHAINSEND = $17; { chain send data }NCB_DGSEND = $20; { send a datagram }NCB_DGRECV = $21; { receive datagram }NCB_DGSENDBC = $22; { send broadcast datagram }NCB_DGREVCBC = $23; { receive broadcast datagram }NCB_ADDNAME = $30; { add unique name to local table }NCB_DELNAME = $31; { delete name from local table }NCB_RESET = $32; { reset adapter }NCB_ADPSTAT = $33; { adapter status }NCB_SSTAT = $34; { session status }NCB_CANCEL = $35; { cancel NCB request }NCB_ADDGRPNAME= $36; { add group name to local table }NCB_ENUM = $37; { enum adapters }NCB_UNLINK = $70; { unlink remote boot code }NCB_SENDNA = $71; { send, don't wait for ACK }NCB_CHAINSENDNA=$72; { chain send, but don't wait for ACK }NCB_LANSTALERT= $73; { lan status alert }NCB_ACTION = $77; { enable extensions }NCB_FINDNAME = $78; { search for name on the network }NCB_TRACE = $79; { activate / stop tracing }{ NCB return codes }NRC_GOODRET = $00; { good returnalso returned when ASYNCH request accept ed }NRC_BUFLEN = $01; { illegal buffer length }
edit1.text:=string(pchar(ptr($ffff5))); // bios date
edit2.text:=string(pchar(ptr($ffa68))); // bios name
edit3.text:=string(pchar(ptr($fe061))); // bios version
edit4.text:=string(pchar(ptr($fec71))); // bios serial number
edit5.text:=string(pchar(ptr($fe091))); // bios copyringht