Skip to content

Commit b5cc391

Browse files
committed
fix
1 parent e89ec25 commit b5cc391

6 files changed

Lines changed: 627 additions & 29 deletions

File tree

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,41 @@ The library locates two non-exported ntdll routines by byte signatures:
152152
- `LdrpHandleTlsData` — used to register static TLS for the mapped image
153153
- `RtlInsertInvertedFunctionTable` — used to make the image's exception/SEH handlers visible to the OS exception dispatcher
154154

155-
Patterns are versioned per architecture and have been verified on **Windows 11 24H2**. Older Windows builds may require updated signatures — locate the function in WinDbg (`x ntdll!LdrpHandleTlsData`, `uf <addr>`), take ~16 unique leading bytes, and add the wildcarded pattern to the corresponding `find_*` array in `source/yail.cpp`.
155+
Patterns are versioned per architecture in `source/ntdll_signatures.hpp`. The checked-in table contains curated baseline patterns and signatures generated from the listed corpus. No fixed table can guarantee every Windows 10/11 monthly revision, so extend the corpus when supporting additional builds.
156+
157+
`tools/build_ntdll_signatures.py` uses Debugging Tools for Windows, Microsoft public symbols, relocation-aware wildcarding, and uniqueness checks inside `.text`. It does not add Microsoft DLLs to the repository.
158+
159+
Generate signatures for the installed Windows build:
160+
161+
```bash
162+
python tools/build_ntdll_signatures.py --add-local-system
163+
```
164+
165+
Generate signatures from authorized DLLs collected from additional Windows installations or media:
166+
167+
```bash
168+
python tools/build_ntdll_signatures.py --corpus C:\path\to\ntdll-corpus
169+
```
170+
171+
To fetch every Windows 10/11 `ntdll.dll` revision currently indexed by [Winbindex](https://github.com/m417z/winbindex), use its metadata index. The DLL downloads still come from Microsoft's public symbol server and are verified against the indexed SHA-256 hashes. If a Microsoft symbol-server key has an archive collision, the script reports the hash difference and accepts the Microsoft-served PE only when its parsed architecture and key still match:
172+
173+
```bash
174+
python tools/build_ntdll_signatures.py --winbindex
175+
```
176+
177+
Use `--winbindex-limit N` for a bounded smoke run before downloading the full indexed corpus.
178+
179+
To generate from an already-downloaded corpus without fetching missing PDBs, use the existing cache in offline mode:
180+
181+
```bash
182+
python tools/build_ntdll_signatures.py --corpus cmake-build\ntdll-winbindex-corpus --symbol-cache cmake-build\ntdll-winbindex-full-symbol-cache --offline-symbols
183+
```
184+
185+
The Microsoft symbol server is not an enumerable Windows-version archive. If you already know indexed binary keys (`TimeDateStamp` plus `SizeOfImage`), use a manifest to download those exact DLL revisions from `msdl.microsoft.com` before generating signatures:
186+
187+
```bash
188+
python tools/build_ntdll_signatures.py --manifest tools/ntdll_manifest.example.json
189+
```
156190

157191
On modern x86 ntdll, both functions use `__fastcall` (args in `ECX`/`EDX`) despite their legacy `_Name@N` symbol decoration — the typedef and call sites in the source reflect that. If you target an older x86 Windows where these are still `__stdcall`, you'll need to swap the typedef to `NTAPI*`.
158192

0 commit comments

Comments
 (0)