DLLs
These
DLLs forward calls to WinAPI functions to the appropriate and undocumented (for user mode)
Native API functions that are exported in
ntdll.dll
(and still run in user mode).
Base services for accessing the file system, managing processes and handling devices are implemented in
kernel32.dll
.
Apparently, with Windows 7, these system libraries were refactored into
Kernelbase32.dll
.
Native System Services / Kernel support functions
WinAPI functions must be distinguished from
native system services and
kernel support functions: Only WinAPI functions are documented.
Native system services are functions that are callable from user mode. For example, an application might call the WinAPI CreateProcess()
function which in turn calls the native system service function NtCreateService()
.
A Kernel support function can only be called from within kernel mode, very possibly by device drivers
An example is ExAllocatePoolWithTag
to allocate memory.
No hooking functionality
Some skilled developers have therefore developped kernel drivers (rootkits) that hooked the System Service Descriptor Table (SSDT) which then allowed to trace system calls on Windows.
Querying functions
For a given function, query the DLL where it is located, the header file where it is defined, the return type and its arguments:
$winApiFunc = (invoke-RestMethod -useBasicParsing https://raw.githubusercontent.com/reverseame/winapi-categories/refs/heads/main/winapi_categories.json).DrawText
$winApiFunc.dll
$winApiFunc.header
$winApiFunc.return_type
$winApiFunc.n_arguments
foreach ($arg in $winApiFunc.arguments) { $arg }
(invoke-webRequest -useBasicParsing https://raw.githubusercontent.com/reverseame/winapi-categories/refs/heads/main/winapi_functions_by_category.json).content | jq -r 'to_entries[] | select(.value[] == "d") | .key'
Display all functions of a given category:
(invoke-RestMethod -useBasicParsing https://raw.githubusercontent.com/reverseame/winapi-categories/refs/heads/main/winapi_functions_by_category.json)."Font and Text"
Find categories:
invoke-restMethod https://raw.githubusercontent.com/reverseame/winapi-categories/refs/heads/main/categories.txt | findstr.exe /i management | sort.exe
Find functions that match a given regular expression and print their associated category in tabular form:
(invoke-webrequest -useBasicParsing https://raw.githubusercontent.com/reverseame/winapi-categories/refs/heads/main/winapi_categories.json).content |
jq -r '["Key", "Category"], (to_entries | map(select(.key | test("font"; "i"))) | map([.key, .value.category] ) | .[] ) | @tsv'