#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay -1
SetWinDelay -1
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
#UseHook
#Persistent
#MaxThreadsPerHotkey 99
#NoTrayIcon
;感谢大佬的帖子https://www.autoahk.com/archives/18355
Clipboard:=""
SplitPath, A_WinDir,,,,,Root
Root:=Root . ""
DriveGet,SerialNumber,Serial, %Root% ;获取机器码
;修改SerialNumber计算方法
SerialNumber:=SerialNumber*6553565535655356553565535-32+2021
Clipboard:=SerialNumber
MsgBox,唯一ID已经复制到剪贴板
ExitApp
;==============下方复制到你的ahk里面==============
;检测机器码
;Clipboard:=""
;SplitPath, A_WinDir,,,,,Root
;Root:=Root . ""
;DriveGet,SerialNumber,Serial, %Root% ;获取机器码
;修改SerialNumber计算方法
;SerialNumber:=SerialNumber*6553565535655356553565535-32+2021
;If (SerialNumber<>9223372033885691528)
;{
; MsgBox, 验证码不对
; ExitApp
;}
;==============上方复制到你的ahk里面==============
;==============下方复制到你的ahk里面==============
;==============获得机器码主要参数==============
Serial:=MD5(SerialNumber,StrLen(SerialNumber))
MD5(ByRef Buf, L) {
Static P, Q, N, i, a,b,c,d, t, h0,h1,h2,h3, y = 0xFFFFFFFF
h0 := 0x67452301, h1 := 0xEFCDAB89, h2 := 0x98BADCFE, h3 := 0x10325476
N := Ceil((L+9)/64)*64
VarSetCapacity(Q,N,0)
P := &Q
DllCall("RtlMoveMemory", UInt,P, UInt,&Buf, UInt,L)
DllCall("RtlFillMemory", UInt,P+L, UInt,1, UInt,0x80)
DllCall("ntdll.dllRtlFillMemoryUlong",UInt,P+N-8,UInt,4,UInt,8*L)
Loop % N//64 {
Loop 16
i := A_Index-1, w%i% := *P | *(P+1)<<8 | *(P+2)<<16 | *(P+3)<<24, P += 4
a := h0, b := h1, c := h2, d := h3
Loop 64 {
i := A_Index-1
if i < 16
f := (b & c) | (~b & d), g := i
else if i < 32
f := (d & b) | (~d & c), g := 5*i+1 & 15
else if i < 48
f := b ^ c ^ d, g := 3*i+5 & 15
else
f := c ^ (b | ~d), g := 7*i & 15
t := d, d := c, c := b
b += rotate(a + f + k%i% + w%g%, r%i%)
a := t
}
h0 := h0+a & y, h1 := h1+b & y, h2 := h2+c & y, h3 := h3+d & y
}
return hex(h0) . hex(h1) . hex(h2) . hex(h3)
}
rotate(a,b) {
return a << b | (a & 0xFFFFFFFF) >> (32-b)
}
hex(x) {
SetFormat Integer, HEX
x += 0x100000000, x := SubStr(x,-1) . SubStr(x,8,2) . SubStr(x,6,2) . SubStr(x,4,2)
SetFormat Integer, DECIMAL
return x
}
Return
暂无讨论,说说你的看法吧