WinApi
https://hotkeyit.github.io/v2/docs/commands/WinApi.htm
I created a list of all the raw parameter descriptions for each dll function, and removed the duplicates to give 7686 unique parameter names.
- I then attempted to create a struct definition based on each of these parameters and retrieve the size of them of in C++, the x64 and x32 sizes.
- I obtained all of the uppercase words and kept including .h files, and adding custom definitions, until all of them were defined.
- I pasted in definitions for all the structs, and tried multiple times to compile the script, retrieving a list of lines that had errors and commenting out those lines until the script compiled. I had to comment out about 10% of the struct definitions.
I used this AutoHotkey code to generate the list of structs.
Code: Select all
q:: ;Winapi.htm - list unique parameters
;WinApi
;https://hotkeyit.github.io/v2/docs/commands/WinApi.htm
;warning: there is one awkward parameter: DWORD dwFlags = SHPPFW_DEFAULT
vPath = %A_Desktop%\WinApi [hotkeyit.github.io].htm
oHTML := ComObjCreate("HTMLFile")
vHtml = <meta http-equiv="X-UA-Compatible" content="IE=9">
oHTML.write(vHtml)
FileRead, vHtml, % vPath
oHTML.write(vHtml)
oArray := {}
Loop, % oHTML.getElementsByTagName("table").length
{
if (A_Index = 1)
continue
oTable := oHTML.getElementsByTagName("table")[A_Index-1]
oRows := oTable.rows
;vDll := oHTML.getElementsByTagName("h2")[A_Index-2].innerText
;if (SubStr(vDll, StrLen(vTemp)+1-4) = ".dll")
; vDll := SubStr(vDll, 1, -4)
Loop % oRows.length
{
oCells := oRows[A_Index-1].cells
vDef := oCells[2].innerText
vDef := RegExReplace(vDef, "^\w+\(")
vDef := RegExReplace(vDef, "\)$")
Loop, Parse, vDef, % ","
{
vTemp := Trim(A_LoopField)
if !oArray.HasKey("z" vTemp)
oArray["z" vTemp] := ""
}
}
}
VarSetCapacity(vOutput, 1000000*2)
;for vKey, vValue in oArray
; vOutput .= SubStr(vKey, 2) "`r`n"
;struct TEST1 { LIST; }; printf("LIST=%d\n", sizeof(TEST1));
for vKey, vValue in oArray
{
vTemp := SubStr(vKey, 2)
vNum := A_Index
vOutput .= "struct TEST" vNum " { " vTemp "; }; printf(" Chr(34) vTemp "=%d\n" Chr(34) ", sizeof(TEST" vNum "));" "`r`n"
}
oHTML := oTable := oRows := oCells := ""
Clipboard := vOutput
MsgBox, % "done"
return
Code: Select all
q:: ;Winapi.htm - list unique parameters and their sizes
;WinApi
;https://hotkeyit.github.io/v2/docs/commands/WinApi.htm
;warning: there is one awkward parameter: DWORD dwFlags = SHPPFW_DEFAULT
vPath = %A_Desktop%\WinApi [hotkeyit.github.io].htm
oHTML := ComObjCreate("HTMLFile")
vHtml = <meta http-equiv="X-UA-Compatible" content="IE=9">
oHTML.write(vHtml)
FileRead, vHtml, % vPath
oHTML.write(vHtml)
oSize := {c:"1:1",h:"2:2",i:"4:4",6:"8:8",t:"8:4",f:"4:4",d:"8:8",x:"4:2",z:"2:2"}
oSize["6"] := "8:8"
oArray := {}
Loop, % oHTML.getElementsByTagName("table").length
{
if (A_Index = 1)
continue
oTable := oHTML.getElementsByTagName("table")[A_Index-1]
oRows := oTable.rows
;vDll := oHTML.getElementsByTagName("h2")[A_Index-2].innerText
;if (SubStr(vDll, StrLen(vTemp)+1-4) = ".dll")
; vDll := SubStr(vDll, 1, -4)
Loop % oRows.length
{
oCells := oRows[A_Index-1].cells
vList := oCells[0].innerText
vList := StrReplace(vList, "u")
vList := StrReplace(vList, "i6", "6")
vList := RegExReplace(vList, "[asw]", "t")
vList := StrReplace(vList, "v", "x")
vList := StrReplace(vList, "y", "z")
vDef := oCells[2].innerText
vDef := RegExReplace(vDef, "^\w+\(")
vDef := RegExReplace(vDef, "\)$")
Loop, Parse, vDef, % ","
{
vTemp := Trim(A_LoopField)
if !oArray.HasKey("z" vTemp)
oArray["z" vTemp] := oSize[SubStr(vList, A_Index, 1)]
}
}
}
VarSetCapacity(vOutput, 1000000*2)
for vKey, vValue in oArray
vOutput .= SubStr(vKey, 2) "=" vValue "`r`n"
oHTML := oTable := oRows := oCells := ""
Clipboard := vOutput
MsgBox, % "done"
return
Code: Select all
_In_ CLSID clsid=16:16
_In_ const SYSTEMTIME lpSysTime=16:16
_In_ CRYPT_PKCS8_IMPORT_PARAMS sPrivateKeyAndParams=48:24
_In_ STGMEDIUM pmedium=24:12
_In_ VARIANT varFileName=24:16
_Out_ STGMEDIUM pmedium=24:12
WCHAR name[LF_FACESIZE]=64:64
Code: Select all
q:: ;console application - get output
vPath = C:\Users\%A_UserName%\Documents\visual studio 2013\Projects\ConsoleApplication14\Debug\ConsoleApplication14.exe
;vPath = C:\Users\%A_UserName%\Documents\visual studio 2013\Projects\ConsoleApplication14\x64\Debug\ConsoleApplication14.exe
Clipboard := JEE_RunGetStdOut(vPath)
return
;==================================================
JEE_RunGetStdOut(vTarget, vSize:="")
{
DetectHiddenWindows, On
vComSpec := A_ComSpec ? A_ComSpec : ComSpec
Run, % vComSpec,, Hide, vPID
WinWait, % "ahk_pid " vPID
DllCall("kernel32\AttachConsole", UInt,vPID)
oShell := ComObjCreate("WScript.Shell")
oExec := oShell.Exec(vTarget)
vStdOut := ""
if !(vSize = "")
VarSetCapacity(vStdOut, vSize)
while !oExec.StdOut.AtEndOfStream
vStdOut := oExec.StdOut.ReadAll()
DllCall("kernel32\FreeConsole")
Process, Close, % vPID
return vStdOut
}