AutoHotkey Community

It is currently May 26th, 2012, 2:00 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: January 8th, 2009, 10:45 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Newer Version

Image


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

Image

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.

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Last edited by SKAN on August 26th, 2010, 8:00 pm, edited 8 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2009, 11:00 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Thanks a lot, this will help for sure.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2009, 11:54 pm 
Offline

Joined: November 4th, 2008, 10:25 pm
Posts: 222
Location: Memphis, TN
Thanks a million SKAN...

I really appreciate you doing this to help me and everyone else.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2009, 8:47 am 
Offline

Joined: August 20th, 2008, 4:25 pm
Posts: 256
Nice idea, and it'll really help, but the auto-download part doesn't work, at least not here ;D

_________________
-Chavez.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2009, 11:06 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Chavez wrote:
but the auto-download part doesn't work


It works fine for me.
AutoHotkey.net might have been busy or maybe you have to check your firewall settings.

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2009, 3:40 pm 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
Wow, another excellent piece of coding. But I must know; where on earth do you find the time to make these mass lists?

_________________
Religion is false. >_>


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2009, 8:58 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Trikster wrote:
where on earth do you find the time to make these mass lists?


I just use AHK Bots, but in this case, I needed a lot of patience. Google is very sensitive in detecting bots and it took me many weeks to acquire this information. Even with 3 second sleep, it randomly detected my bot and refused to cooperate. I had to disable cookies and turn on/off my ADSL modem many times to switch IP address.

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 7:42 pm 
Offline

Joined: June 14th, 2008, 5:09 pm
Posts: 9
I get this error when running the script ?

Code:
---------------------------
api.ahk
---------------------------
Error: "URLDownloadToFile" requires at least 2 parameters.

Specifically: UrlDownloadToFile

   Line#
   002: SetBatchLines,-1
   003: SetWorkingDir,%A_ScriptDir%
--->   004: IfNotExist,WinAPI.txt

The program will exit.
---------------------------
OK   
---------------------------



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 8:24 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
There is no problem with the script. Try copy/paste by blocking the text manually with mouse.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 17th, 2009, 10:05 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5478
Location: the tunnel(?=light)
SKAN wrote:
There is no problem with the script.


Actually, I had the same problem after I copied the script but I was pretty sure I could see where it was coming from. Here's what gets copied from your script on line 4:

Code:
IfNotExist, WinAPI.txt, UrlDownloadToFile
, http://www.autohotkey.net/~Skan/Utils/MSDN/WinAPI.txt, WinAPI.txt


The URL will have to overflow to the next line but the comma following UrlDownloadToFile should not, it should remain on line 4:

Code:
IfNotExist, WinAPI.txt, UrlDownloadToFile,
 http://www.autohotkey.net/~Skan/Utils/MSDN/WinAPI.txt, WinAPI.txt


Once I corrected that everything worked fine. Of course I'm using Notepad as my editor, you might be using something different that fits that line correctly where Notepad cannot.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 17th, 2009, 12:47 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
I hve changed the offending line as:

Code:
IfNotExist, WinAPI.txt
   UrlDownloadToFile, http://www.autohotkey.net/~Skan/Utils/MSDN/WinAPI.txt, WinAPI.txt


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2009, 6:42 am 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
awesome, thanks very much for this tool.
i wonder when you'll release an unified tool, grouping windows constants, winapi etc..

_________________
                                  [ profile | ahk.net | ahk.talk ]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 25th, 2009, 5:27 am 
Offline

Joined: February 20th, 2007, 1:37 pm
Posts: 198
Location: D.C.
WOW!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 26th, 2009, 1:43 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
Quite useful script, thank you! I could think of one possible addition that would however require a great amount of work and most likely processing time: check against the libraries in the current OS and only list the existing libraries that match the searched function.

The Google / MSDN goto is a most welcome function. 8)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 26th, 2010, 7:53 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Update: A newer dynamic version has been posted. Please refer the Title post


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: c0ntinuity, Yahoo [Bot] and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group