Newer Version
Code:
/*
___ _ _ ___ _ _ ___ _
| . \| | | | | __>_ _ ._ _ ___ _| |_ <_> ___ ._ _ | __>__ ___ ___ _ _ _| |_ ___
| | || |_ | |_ | _>| | || ' |/ | ' | | | |/ . \| ' | | _> \ \/| . \/ . \| '_> | | <_-<
|___/|___||___| |_| `___||_|_|\_|_. |_| |_|\___/|_|_| |___>/\_\| _/\___/|_| |_| /__/
|_|
AutoHotkey PE Tool : Lists all Exported Functions found in all \System Folder\DLL files.
Author: SKAN - Suresh Kumar A N ( arian.suresh@gmail.com ) | CD:20090109 / LM:20100827
*/
#SingleInstance, Force
SetBatchLines -1
Sps := " "
VarSetCapacity( A_SysDir,520 ), DllCall( "GetSystemDirectory", Str,A_SysDir, UInt,260 )
TrayTip, Function Exports - Viewer, Scanning %A_sysDir%
Loop %A_SysDir%\*.dll
If ( Funx := PE_FunctionExports( A_LoopFileLongPath ) )
&& ( File := SubStr(A_LoopFileName,1,StrLen(A_LoopFileName)-4 ) )
Loop, Parse, Funx, `n
If InStr( A_LoopField, "@" ) || ! A_LoopField
Continue
Else Data .= SubStr( File . Sps, 1,16 ) A_LoopField "`n"
StringReplace, Data, Data, `n, `n, UseErrorLevel
TotalFunctions := ErrorLevel
StringTrimRight, Data, Data, 1
Sort, Data, P17 D`n
Gui, Font, s10, Arial
Gui, Add, Edit, w439 h20 -E0x200 UpperCase hWndhEdit cAA1010 Border vQuery gSTimer
SendMessage, 0xD3, 0x1,5,, ahk_id %hEdit%
Gui, Add, ListView, Yp+19 R15 w439 -E0x200 +Border gDClick, Function|Library
LV_ModifyCol( 1, "290" ), LV_ModifyCol( 2, "125" )
TrayTip, Function Exports - Viewer, Loading List of Functions
Loop, Parse, Data, `n
LV_Add( "", SubStr(A_LoopField,17 ), SubStr( A_LoopField,1,16) )
TrayTip
Gui, Show,, Function Exports: %TotalFunctions% in [ %A_SysDir% ]
Return ; // end of auto-execute function //
GuiClose:
Exitapp
sTimer:
SetTimer, FunctionSearch, -250
Return
FunctionSearch:
Critical
GuiControlGet, Query
LV_Delete()
If ( Query="" ) {
Loop, Parse, Data, `n
LV_Add( "", SubStr(A_LoopField,17 ), SubStr( A_LoopField,1,16) )
Return
} StringReplace, Query, Query, +, +, UseErrorLevel
SearchItems := ErrorLevel+1
Loop, Parse, Data, `n
{ Line := A_LoopField, Result := 0
Loop, Parse, Query, +
Result := InStr( Line,A_LoopField,0,17 ) ? Result+1 : Result
If ( Result = SearchItems )
LV_Add( "", SubStr(A_LoopField,17 ), SubStr( A_LoopField,1,16) )
} Return
DClick:
IfNotEqual, A_GuiEvent, DoubleClick, Return
GotoURL:
Critical
Row := LV_GetNext( 0, "Focused" ), LV_GetText( Func,Row,1 )
If ( SubStr(Func,0) == "A" || SubStr(Func,0) == "W" )
StringTrimRight, Func, Func, 1
URL1 := "http://www.google.com/search?hl=en&q=" Func
. "+Function+site:microsoft.com&btnI=I'm+Feeling+Lucky"
URL2 := "http://www.google.com/search?hl=en&q=" Func "&btnI=I'm+Feeling+Lucky"
If GetKeyState( "LControl", "P" )
Run, %Url2%,,Max
Else Run, %Url1%,,Max
Return
PE_FunctionExports( PEFile ) { ;List of Exported Functions / Comp@t: WIN32_NT +AHK +LA +LW
; By SKAN www.autohotkey.com/forum/viewtopic.php?p=379086#379086 CD:20100825/LM:20100827
VarSetCapacity( $LI,48,0 ), DllCall( "ImageHlp\MapAndLoad", A_IsUnicode ? "AStr" : "Str"
,PEFile, Int,0, UInt,&$LI, Int,1, Int,1 )
nPtr := DllCall( "ImageHlp\ImageRvaToVa", UInt,Numget( $LI,12 ), UInt,Numget( $LI,08 )
, UInt, NumGet( ( P := DllCall( "ImageHlp\ImageDirectoryEntryToData", UInt
, NumGet( $LI,8 ), Int,0, UShort,0, UIntP,nSz )) + 12 ), UInt,0 )
VarSetCapacity( Var,1024,0 ), VarSetCapacity( List,10240,0 )
IfEqual,nPtr,0, Return SubStr( DllCall( "ImageHlp\UnMapAndLoad", UInt,&$LI ), 0,0 )
Loop % NumGet( P+24 ) + 1
A_IsUnicode ? Var := DllCall( "MulDiv", Int,nPtr, Int,1, Int,1, AStr )
: DllCall( "lstrcpy", Str,Var, UInt,nPtr )
, nPtr := nPtr+StrLen( Var )+1, List .= "`n" Var, A_Index=1 ? Omit := StrLen( Var )+2 :
StringTrimLeft, List, List, %Omit%
DllCall( "ImageHlp\UnMapAndLoad", UInt,&$LI )
Return List
}
- Double-click on a row should take you directly to the relevant page on MSDN, provided the function is documented.
The above uses 'site-specific' Google I'm Feeling Lucky feature on microsoft.com
- Left control + Double-click on a row does a open Google I'm Feeling Lucky search.
The above is useful in cases where documentation is available from a third party.
For example: RtlComputeCrc32() is documented at winehq.org but not available in MSDN
Previous Version
Just a vague try in building a useful API function list, please refer:
Index of .dll files
Download
WinAPI.ahk
The scripts requires
WinAPI.txt 183.06 KiB, which will be auto-downloaded with first run and whenever missing.
Run the script and double-click on a function name to open the relevant MSDN link. However, be informed that these links have been collected by running a bot in google, and so I cannot assure every link is correct. If you find a wrong link, double-click again with
Left-Control Key down to do a Google search on microsoft.com for the particular function. The correct result should be in first few entries.