haifon 发表于 2014-6-3 14:32:05

获取硬盘序列号

[ post] .]E"w9~
//--------------------------------------------------------------------------- r]6+&K
<< =cZ.HP
#include <vcl.h> h,y_ ^cf
#pragma hdrstop 0J?443A Y
7x.j:{2
#include "Main_Unit.h" (6/aHSXI
//--------------------------------------------------------------------------- S? Cd,WxT
#pragma package(smart_init) <:AA R2=
#pragma resource "*.dfm" N5W!(h)
TMainFrm *MainFrm; zvGncjMkC
HINSTANCE ins; 4-HBXG9#/
FARPROC procCPU,procDisk; DI(XB6
typedef char * (__stdcall *TGetStrFun)(LPCSTR); Eve,*ATI
typedef void (__stdcall *TDes)(char*,char*,char*,int); mph9/ %]S
3rMi:*?
TGetStrFun procMD5,procSN; Gv]94$'J9
TDes procDes; !r6Yq,3
//--------------------------------------------------------------------------- Vug32[q=i
__fastcall TMainFrm::TMainFrm(TComponent* Owner) Za ?BpV~
: TForm(Owner) OW6dK #XFt
{ Zcw <USF8
} }s"].Xm^2
//--------------------------------------------------------------------------- -ert42fN
void __fastcall TMainFrm::pnlTitleMouseDown(TObject *Sender, d~6UJ=]@8
TMouseButton Button, TShiftState Shift, int X, int Y) ~Hd *Xl
{ }Q9+krrow
// 移动没有标题栏的窗体 I\-M`^@
Refresh(); :}q)32]W
if(Button == mbLeft) o:*$G~. k
{ lSoAw-@At8
ReleaseCapture(); Z:<wB#G
Perform(WM_SYSCOMMAND, 0xF017, 0); 'n"we# [
} u] G
} !?J- Y
//--------------------------------------------------------------------------- 0"GLgj:9
;32;C2t&(
void __fastcall TMainFrm::btnMenuUpDownClick(TObject *Sender) oLq N
{ b>#=7;
if(btnMenuUpDown->Caption == "6") VV 5 4$ a
{ 4hfq7kq7(
// 还原窗体 eR`Q7]j] -
btnMenuUpDown->Caption = "5"; %2B1E( r%M
Height = 350; jS8 B:>
}  M_%c9g@x
else < $Sl%DoS
{ 19[!9ci
// 上卷窗体 sO32(4F8cpU
btnMenuUpDown->Caption = "6"; *XYp~b
Height = 25; EDh-pK
} yh|+Usa
} m],.w M8
//--------------------------------------------------------------------------- i\DU<lD5VN
p8?"}
void __fastcall TMainFrm::imgLogoMouseDown(TObject *Sender, jT F "
TMouseButton Button, TShiftState Shift, int X, int Y) z!.cc6R
{ D,lY_6=
ShellExecute(Handle, NULL, "http://zydlm.wxhc.com.cn", NULL, NULL, SW_SHOWNORMAL); CBpwtI>p
} _ yDDPuAi
//--------------------------------------------------------------------------- % -+7=x
BgDWl{pm
void __fastcall TMainFrm::btnMenuCloseClick(TObject *Sender) UlNV%34"
{ o61rTj
Close(); QP%Hwt]+
} /& c2y=/'C
//--------------------------------------------------------------------------- ^SsnCn-e
f4F%\ "
void __fastcall TMainFrm::FormCreate(TObject *Sender) P|p X F~
{ n\<7`,
ins=LoadLibrary("Reg.dll"); D&G?32Klq
if (ins!=NULL) '$'a .q1q9
btnGet->Enabled =true; /0fHkj/J=B
} `g)
//--------------------------------------------------------------------------- 6%:~.ZfN
R ?/xH32=u>
void __fastcall TMainFrm::btnGetClick(TObject *Sender) o2hZ=+w>
{ j{2 0
if (ins!=NULL) }`dO
{ ^6F, lS_t
//取硬盘序列号的函数 YjJ^SU`*
procDisk=GetProcAddress(ins,"ReadPhysicalDrive"); 8O60pB;4
#Ufb
//取CPU序列号的函数 [wiB1{/Ls.
procCPU=GetProcAddress(ins,"GetCPUID"); SDNRcSbOD6
K :+q 9;g
//得到DES函数的函数 yJO Jw o^
procDes=(TDes)GetProcAddress(ins,"Des"); Y6hV ;[\F
{Oq8A.daJ
//得到MD5函数的函数 PYs0w6o
procMD5=(TGetStrFun)GetProcAddress(ins,"GetMD5Str"); X eY[ ;} 9
<SOG?Lh~
//产生序列号 a}|<*!4zUQ
procSN=(TGetStrFun)GetProcAddress(ins,"CreateSerialNumber"); 9 BU#THDm
hNkv lk'Ui
if ((procDisk)&&(procDes)&&(procCPU)&&(procMD5)) w`+-xT%
{ z7L+wNYwg
char *p; u*uHdV5
char buf; ?$tD
_h,_HW)G
//取硬盘序列号 7IkEud
p=(char*)procDisk(); +j+ v(-
edtDiskID->Text=p; q32@XJ,e1A
Ygkf}n
edtDiskDes->Text=procMD5(edtDiskID->Text.c_str()); a_{'I6a*,
// procDes(p,buf,"2004",0); )\2KDXc
// edtDiskDes->Text=buf; f? GoBh<
Fs=x32+8'M
//取CPU序列号 'Z9UqEGV
p=(char*)procCPU(); upZc~k!1\
edtCPU->Text=p; 4^nHq 4_
^J^FGo|M
edtCPUDes->Text=procMD5(edtCPU->Text.c_str()); Fn4yx~0
// procDes(p,buf,"2004",0); |]?W`KN0
// edtCPUDes->Text=buf; +_S0
}|v
// edtCode->Text=edtDiskID->Text+"-"+edtCPU->Text; 4@<wN \'
btnCount->Enabled =true; 5T(cy
btnCount->Visible =true; ycOnPTh
} y x#ub-A8
} VnB HQ.C
} ^32*B@=
//--------------------------------------------------------------------------- }opMf6`w
]F>#0Rdc
void __fastcall TMainFrm::FormDestroy(TObject *Sender) 9h)8Mq+M
{ Vmh$c*TE
FreeLibrary(ins); 2g?q4e,
} R-OO1~W32=
//--------------------------------------------------------------------------- 94t`&jZ&|u
l`:u5\ rM
void __fastcall TMainFrm::btnCountClick(TObject *Sender) p>3QW3<
{ K[/L!.Ag
if (ins!=NULL) Ij =NcP
{ BYhiP/^
procMD5=(TGetStrFun)GetProcAddress(ins,"CreateSerialNumber"); {[Y7h}7
if (procMD5!=NULL) *!*%~h8V
{ yJ0 %6],^g
char *p; "X;5* 4+
p=(char*)procMD5(edtCode->Text.c_str()); IhZn32
edtSN->Text=p; U/cj_}uX
} f>4|>kS
} !~R<Il|B
} fc<y(uX
//--------------------------------------------------------------------------- 6<QC|>p
f_xvXf:
void __fastcall TMainFrm::edtCodeChange(TObject *Sender) zn&ZXFgN
{ Jp}\@T.
btnCountClick(NULL); kN{$-v=K
} Cc%{e9e*
//--------------------------------------------------------------------------- Aaq%'07ihW
[+R_3'aK

左手の天空 发表于 2014-7-10 06:26:08

淡定,淡定,淡定……

ghosthand 发表于 2014-7-24 19:46:27

我常来...支持 海论坛

zhuzhuli 发表于 2014-8-6 18:52:29

楼主 有想法

ァ瘛鈊依旧← 发表于 2014-8-17 05:08:05

看帖必须回复 顺便赚点

BruceLee 发表于 2014-8-27 21:57:23

强烈支持楼主ing……

weiziji 发表于 2014-9-3 12:40:50

支持楼主、楼主英明啊!!!

hjwgjd 发表于 2014-12-24 16:44:49

求沙发

作废游戏 发表于 2014-12-25 00:10:01

前排,哇咔咔

aumkb 发表于 2015-4-18 22:36:59

硬实厉害啊
页: [1] 2
查看完整版本: 获取硬盘序列号