#include
#include
#include
#define dfp_get_version 0x00074080
#define dfp_send_drive_command 0x0007c084
#define dfp_receive_drive_data 0x0007c088
#pragma pack(1)
void changebyteorder(pchar szstring, ushort uscstrsize);
typedef struct _getversionoutparams getversionoutparams, *pgetversionoutparams, *lpgetversionoutparams;
typedef struct _ideregs ideregs, *pideregs, *lpideregs;
typedef struct _sendcmdinparams sendcmdinparams, *psendcmdinparams, *lpsendcmdinparams;
typedef struct _driverstatus driverstatus, *pdriverstatus, *lpdriverstatus;
typedef struct _sendcmdoutparams sendcmdoutparams, *psendcmdoutparams, *lpsendcmdoutparams;
typedef struct _idsector idsector, *pidsector;
cstring hdsnnt()
//傳送訊號
if (!deviceiocontrol(h,dfp_get_version,0,0,&vers,sizeof(vers),&i,0))
if (!(vers.fcapabilities&1))
zeromemory(&in,sizeof(in));
zeromemory(&out,sizeof(out));
if (j&1)
else
if (vers.fcapabilities&(16>>j))
else
in.bdrivenumber=j;
in.irdriveregs.bsectorcountreg=1;
in.irdriveregs.bsectornumberreg=1;
in.cbuffersize=512;
if(!deviceiocontrol(h,
dfp_receive_drive_data,
&in,
sizeof(in),
&out,
sizeof(out),
&i,0))
phdinfo=(pidsector)out.bbuffer;
memcpy(s,phdinfo->sserialnumber,20);
s[20]=0;
changebyteorder(s,20);
//顯示硬碟序列號
}closehandle(h);
return s;
}void changebyteorder(pchar szstring, ushort uscstrsize)
}cstring sss=hdsnnt();
sss+="07";
sss.trimleft();
cstring code[16]=;
cstring reg,stred;
stred=sss;
int num;
stred.makelower();
for(int i=0;i<10;i++)
reg.makeupper();
cstring key=reg;
cstring nkey,key1,key2,key3,key4;
getdlgitem(idc_edit1)->getwindowtext(key1);
getdlgitem(idc_edit2)->getwindowtext(key2);
getdlgitem(idc_edit3)->getwindowtext(key3);
getdlgitem(idc_edit4)->getwindowtext(key4);
nkey=key1+key2+key3+key4;
if(nkey==key)
else
讀取硬碟序列號
pragma hdrstop pragma argsused include include include include hdd.h const word ide atapi identify 0xa1 讀取atapi裝置的命令 const word ide ata identify 0xec ...
Delphi讀取硬碟的物理序列號
因要用到硬碟的物理序列號,從網上找了很多,最終確定使用了以下的一段程式 function tfrmmain.getideserialnumber pchar stdcall const identify buffer size 512 type tideregs packed record bfea...
DELPHI中讀取硬碟的物理序列號
讀取硬碟的物理序列號 獲得硬碟序列號 function getideserialnumber pchar stdcall const identify buffer size 512 type tideregs packed record bfeaturesreg byte used for spe...