本帖最后由 castle921 于 2016-3-25 20:22 编辑
求助论坛版主及各位,这是我从网上找的能够读取硬盘物理序列号的DiskID32.dll,实在不知道怎么调用。
另外我从https://www.winsim.com/diskid32/diskid32.html下载的diskid32.cpp源码,还能读取U盘物理序列号、MAC地址,是我认为读取磁盘物理序列号最好的源码,但它是控制台的,请问如何改为DLL。我是想用来做硬件绑定。$dll = DllOpen(@ScriptDir&"diskid32.dll")
If @error Then
MsgBox(4096,"DllOpen Error", @error)
EndIf
Local $getInfo = DllStructCreate("str controllerType[1024];str type[1024];str modelNumber[1024];str serialNumber[1024];str revisionNumber[1024];str driveType[1024];DWORD bufferSize;DWORD cylinders;DWORD heads;WORD sectors")
$result = DLLCall($dll, "none","getDiskInfo","PTR",DllStructGetPtr($getInfo))
If @error Then
;@error: 1 = unable to use the DLL file,
;2 = unknown "return type",
;3 = "function" not found in the DLL file,
;4 = bad number of parameters,
;5 = bad parameter.
;MsgBox(4096,"I am here 2","" )
MsgBox(4096,"DllCall Error", @error )
Else
MsgBox(4096,"Disk SN is", DllStructGetData($getInfo ,"serialNumber"))
EndIf
DllClose($dll)
|