-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathMCODE_GetServerName.ahk
42 lines (33 loc) · 1.67 KB
/
MCODE_GetServerName.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
; Link: https://autohotkey.com/board/topic/75777-convert-ahk-code-into-machine-code/
; Author:
; Date:
; for: AHK_L
/*
*/
Ptr := A_PtrSize ? "Ptr" : "UInt"
If (A_PtrSize = 8){
MCode(GetServerName, "4885C9750E48F7DA481BC083E0184883C018C3C60152488D441101C6"
. "0073488D4C1001C60165488D441101C60064488D4C1001C60169488D441101C6006E488D4C1"
. "001C60167488D441101C60039488D4C1001C60131488D441101C60040488D4C1001C6014148"
. "8D441101C60075488D4C1001C60174488D441101C6006F488D441001C60048488D4C1001C601"
. "6F488D441101C60074488D4C1001C6014B488D441101C60065488D4C1001C60179488D441101"
. "C6002E488D4C1001488D441101C60163C6006FC64410016DC3")
DllCall("VirtualProtect",Ptr,&GetServerName,Ptr,VarSetCapacity(GetServerName),"uint",0x40,"uint*",0)
} Else {
MCode(GetServerName, "8B4C24048B44240885C9751533D20B44240C8D41300F85CE000000B8"
. "18000000C3C60152C6440101738D4C0101C6440101658D4C0101C6440101648D4C0101C6440"
. "101698D4C0101C64401016E8D4C0101C6440101678D4C0101C6440101398D4C0101C6440101"
. "318D4C0101C6440101408D4C0101C6440101418D4C0101C6440101758D4C0101C6440101748"
. "D4C0101C64401016F8D4C0101C6440101488D4C0101C64401016F8D4C0101C6440101748D4C"
. "0101C64401014B8D4C0101C6440101658D4C0101C6440101798D4C01018D4C0101C6012E8D4"
. "C0101C601638D4C0101C6016FC64408016DC3")
}
VarSetCapacity(Name,DllCall(&GetServerName,Ptr,0,"Int64",A_IsUnicode,"cdecl int64"),0)
DllCall(&GetServerName,Ptr,&Name,"Int64",A_IsUnicode,"cdecl int64")
VarSetCapacity(Name,-1)
MsgBox % Name
MCode(ByRef code, hex) { ; allocate memory and write Machine Code there
VarSetCapacity(code,StrLen(hex)//2)
Loop % StrLen(hex)//2
NumPut("0x" . SubStr(hex,2*A_Index-1,2), code, A_Index-1, "Char")
}