0

For a project I'm in need of a parseable version of the Windows API (i.e. the functions described in msdn).

I tried to crawl it myself, but there seem to be more than 5 formats for signatures and parameters used. The MsdnApiExtractor project does not seem to work anymore.

I've seen some projects using help files, but I can't seem anything to parse .hlp files. Sadly, using the header files is no alternative, since it lacks argument names.

I'm mainly interested in the High-Level API (e.g. ReadFile, CloseHandle etc.)

edit:

Seems I've been looking at the wrong header files

  • Do you just need signature information? Or did you want the documentation text as well? – josh poley Feb 23 '17 at 18:05
  • Do you want to extract something like int stdcall foo.( float a, ......) From header files what exactly does header files lack arg names mean – blabb Feb 24 '17 at 5:44
  • Why not use windows.h ? – marshal craft Feb 24 '17 at 6:57
1

this should be a comment but the content is long for a comment so an answer

your statement /subsequent edit / that header files does not contain names is not correct

:\>echo %cd%
E:\ewdk\Program Files\Windows Kits\10\Include\10.0.10586.0\um

:\>grep -irn -B 3 -A 3 GetLocalTime  *
sysinfoapi.h-180-WINBASEAPI
sysinfoapi.h-181-VOID
sysinfoapi.h-182-WINAPI
sysinfoapi.h:183:GetLocalTime(
sysinfoapi.h-184-    _Out_ LPSYSTEMTIME lpSystemTime
sysinfoapi.h-185-    );
sysinfoapi.h-186-
--

in fact i have around 49547 apis parsed from ewdk win10 headers

:\>wc -l uniqtags.txt
49547 uniqtags.txt 

here is what it spits out for your GetLocalTime

:\>grep -n GetLocalTime uniqtags.txt
9715:GetLocalTime       ( _Out_ LPSYSTEMTIME lpSystemTime )
15926:InternetDebugGetLocalTime ( _Out_ SYSTEMTIME * pstLocalTime, _Out_opt_ DWORD * pdwReserved )

here is what the possibly undocumented zwrecover functions with arguments parsed from headers look like

:\>grep -n ZwRec uniqtags.txt
33290:ZwRecoverEnlistment       ( _In_ HANDLE EnlistmentHandle, _In_opt_ PVOID EnlistmentKey )
33291:ZwRecoverResourceManager  ( _In_ HANDLE ResourceManagerHandle )
33292:ZwRecoverTransactionManager       ( _In_ HANDLE TransactionManagerHandle )

just to make it clear if you want to print out all the Zw.Enlist. functions with thier arguments you could do some thing like this

:\>for /f %I in ( 'awk "{print $1}" uniqtags.txt ^| grep -i Zw ^| grep  Enlist ')  do grep %I uniqta
gs.txt

:\>grep ZwCommitEnlistment uniqtags.txt
ZwCommitEnlistment      ( _In_ HANDLE EnlistmentHandle, _In_opt_ PLARGE_INTEGER TmVirtualClock )

:\>grep ZwCreateEnlistment uniqtags.txt
ZwCreateEnlistment      ( _Out_ PHANDLE EnlistmentHandle, _In_ ACCESS_MASK DesiredAccess, _In_ HANDL
E ResourceManagerHandle, _In_ HANDLE TransactionHandle, _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes
, _In_opt_ ULONG CreateOptions, _In_ NOTIFICATION_MASK NotificationMask, _In_opt_ PVOID EnlistmentKe
y )

:\>grep ZwOpenEnlistment uniqtags.txt
ZwOpenEnlistment        ( _Out_ PHANDLE EnlistmentHandle, _In_ ACCESS_MASK DesiredAccess, _In_ HANDL
E RmHandle, _In_ LPGUID EnlistmentGuid, _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes )

:\>grep ZwPrePrepareEnlistment uniqtags.txt
ZwPrePrepareEnlistment  ( _In_ HANDLE EnlistmentHandle, _In_opt_ PLARGE_INTEGER TmVirtualClock )

:\>grep ZwPrepareEnlistment uniqtags.txt
ZwPrepareEnlistment     ( _In_ HANDLE EnlistmentHandle, _In_opt_ PLARGE_INTEGER TmVirtualClock )

:\>grep ZwQueryInformationEnlistment uniqtags.txt
ZwQueryInformationEnlistment    ( _In_ HANDLE EnlistmentHandle, _In_ ENLISTMENT_INFORMATION_CLASS En
listmentInformationClass, _Out_writes_bytes_(EnlistmentInformationLength) PVOID EnlistmentInformatio
n, _In_ ULONG EnlistmentInformationLength, _Out_opt_ PULONG ReturnLength )

:\>grep ZwReadOnlyEnlistment uniqtags.txt
ZwReadOnlyEnlistment    ( _In_ HANDLE EnlistmentHandle, _In_opt_ PLARGE_INTEGER TmVirtualClock )

:\>grep ZwRecoverEnlistment uniqtags.txt
ZwRecoverEnlistment     ( _In_ HANDLE EnlistmentHandle, _In_opt_ PVOID EnlistmentKey )

:\>grep ZwRollbackEnlistment uniqtags.txt
ZwRollbackEnlistment    ( _In_ HANDLE EnlistmentHandle, _In_opt_ PLARGE_INTEGER TmVirtualClock )

:\>grep ZwSetInformationEnlistment uniqtags.txt
ZwSetInformationEnlistment      ( _In_ HANDLE EnlistmentHandle, _In_ ENLISTMENT_INFORMATION_CLASS En
listmentInformationClass, _In_reads_bytes_(EnlistmentInformationLength) PVOID EnlistmentInformation,
 _In_ ULONG EnlistmentInformationLength )

:\>
  • I'm sorry, I confused the header files. Sadly it seems like I'll have to set up a vm and install the sdk to access the header files – Nordwald Feb 24 '17 at 8:56
1

There is msdn-crawler, created by Zynamics and then amended by FireEye. I was not able to get it working but maybe you'll have more luck. Alternatively, you can find an old MSDN CD with CHM files, decompile them to HTML and parse that.

  • Thats a nice idea, must all I can find coping with .hlp and .chm files are old shareware programs. Also, I'm not eager to download the sdk and compile help files. – Nordwald Feb 24 '17 at 7:58
  • hh.exe can decompile CHMs, you don't need any extra tools. – Igor Skochinsky Feb 24 '17 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.