From 8e98027f3f4baa63a1bc8481e735021df3c7e42c Mon Sep 17 00:00:00 2001 From: Kuba Sunderland-Ober Date: Sun, 22 Nov 2026 17:35:35 +0100 Subject: [PATCH 1/4] tbKMode: documented at 0.3.0.8; every item of #4's reply fixed, nine callouts removed, ImageMachineType's module and the 32-bit FastCall KeAcquireSpinLock documented --- WIP.BugHunt.md | 21 +- WIP.tbKMode.md | 28 ++- docs/Community/Experimental.md | 2 +- docs/Reference/Contributed/tbKMode/index.md | 19 +- .../Reference/Contributed/tbKMode/modImage.md | 11 +- docs/Reference/Contributed/tbKMode/modWDM.md | 97 ++++----- .../snapshots/contributed/tbKMode/api.json | 189 ++++++++++-------- .../contributed-tbKMode/Settings | 4 +- .../tbKMode/Sources/ImageValueTests.twin | 80 ++++---- .../package-tests/tbKMode/Sources/RunAll.twin | 16 +- .../tbKMode/Sources/WDMExportTests.twin | 2 +- .../tbKMode/Sources/WDMFieldTests.twin | 2 +- .../tbKMode/Sources/WDMLayoutTests.twin | 23 ++- .../tbKMode/exe/KernelHelperTests.twin | 42 ++-- .../tbKMode/exe/fake-kernel/hal.c | 2 +- .../tbKMode/exe/fake-kernel/ntoskrnl.c | 24 +-- test/package-tests/tbKMode/expect.json | 48 +---- test/package-tests/tbKMode/probe/README.md | 10 +- .../tbKMode/probe/src/x86exports.twin | 30 +-- .../tbKMode/verifier/config/tbKMode.json | 10 +- test/package-tests/tbKMode/wdk/api.mjs | 22 +- .../tbKMode/wdk/learn/modImage.json | 10 +- .../tbKMode/wdk/learn/modWDM.json | 12 +- .../tbKMode/writer/modImage/frame.md | 7 +- .../tbKMode/writer/modImage/names.json | 2 +- .../tbKMode/writer/modWDM/frame.md | 35 ++-- .../tbKMode/writer/modWDM/names.json | 28 +-- .../tbKMode/writer/modWDM/procedures.md | 30 +-- test/package-tests/tbKMode/writer/writer.mjs | 9 +- 29 files changed, 381 insertions(+), 434 deletions(-) diff --git a/WIP.BugHunt.md b/WIP.BugHunt.md index 498cae44..953fdb11 100644 --- a/WIP.BugHunt.md +++ b/WIP.BugHunt.md @@ -168,22 +168,15 @@ Seen on BETA 1042 by the `commonctls` setup (fixture `test/shots/commonctls`). ### tbKMode -tbKMode 0.3.0.6, BETA 1042, met while moving its section to that version. Neither is checked. - -- **RtlFailFast** (modWDM.twin line 5837) is a `cdecl naked` Sub whose code is `mov ecx, 7` then - `int 29h`: it loads 7 (`FAST_FAIL_FATAL_APP_EXIT`), not its *code* argument, so - **FatalListEntryError**, which passes `FAST_FAIL_CORRUPT_LIST_ENTRY` (3), raises 7. The WDK's - `RtlFailFast` is `__fastfail(Code)`. Read from the source only: a case would end the process. - **Page affected**: modWDM's sections of **RtlFailFast** and **FatalListEntryError**. -- **SE_SELF_RELATIVE** (`SECURITY_DESCRIPTOR_CONTROL`, modWDM.twin line 4954) is `&H8000&`, a +BETA 1042: met while moving the section to 0.3.0.6, and still in 0.3.0.8, which fixed the other +two leads of 0.3.0.6 (RtlFailFast's fixed reason, MmCopyMemory's 4-byte *NumberOfBytes*). + +- **SE_SELF_RELATIVE** (`SECURITY_DESCRIPTOR_CONTROL`, modWDM.twin line 4964) is `&H8000&`, a Long 32768, which an Integer cannot hold: **SECURITY_DESCRIPTOR.Control** (line 236) and the *Control* of RtlGetControlSecurityDescriptor and RtlSetControlSecurityDescriptor (lines - 5155-5156) are Integers, so assigning the flag to one may raise overflow, and comparing one with - it is never true. Not run. -- **MmCopyMemory** (modWDM.twin line 5354) takes *NumberOfBytes* `ByVal As Long`, where the WDK's - routine takes a `SIZE_T`: 8 bytes in a 64-bit build, passed in a register whose high 32 bits the - call may leave as they were. The verifier's `check` reports it (0.3.0.5 and 0.3.0.6); no case and - no page states it. **Page affected**: modWDM's Declares, if it is a defect. + 5164-5165) are Integers, so assigning the flag to one may raise overflow, and comparing one with + it is never true. Not run. By the package's convention for 16-bit values (0.3.0.8's + ImageMachineType) it would be `&H8000`. ### User-defined types (from the GdiPlus work) diff --git a/WIP.tbKMode.md b/WIP.tbKMode.md index 6cd6446d..c855103e 100644 --- a/WIP.tbKMode.md +++ b/WIP.tbKMode.md @@ -22,10 +22,15 @@ about the package beyond its pages; the rules for every contributed package are writer joins: the snapshot keeps no `#If` of an alias). A name that is a procedure in one build and a Declare in the other (InterlockedIncrement, KeAcquireSpinLock, KeQuerySystemTime) is a `###` section in `procedures.md` with a syntax for each build. -- **Callouts** are labelled with the package version (`0.3.0.6`) or `timeless`, each backed by +- **Callouts** are labelled with the package version (`0.3.0.8`) or `timeless`, each backed by cases or the probe; the one about twinBASIC itself, under *Building a driver*, is labelled `BETA 1042` and names its reproducer, `bugs/declare-fastcall-static-binding-32bit`. - The owner reviewed the 0.3.0.5 pages, the verifier's included (2026-11-17). +- **A page holds every Module of its file** (0.3.0.8): ImageMachineType moved into a Module + SuppressedWarnings of modImage.twin, under `[IgnoreWarnings(TB0012)]`, so the writer and + `wdk/api.mjs` take a module's names from every Module whose file is `.twin`, and + modImage's page lists it. Its members above `&H7FFF` are Integer literals from 0.3.0.8, the + 16-bit convention, so the `values` of `verifier/config/tbKMode.json` give their negative values. - **A declaration right for the kit the package was written from is no defect**: modSysInfo follows the 10.0.22621 SDK (`POLICY_AUDIT_SUBCATEGORY_COUNT` 59, no `FileFsGuidInformation`), and its cases check that kit's values (`wdk/modSysInfo.json`, `values` and `sizes`). From 0.3.0.6 the load @@ -70,11 +75,13 @@ package*). Each folder's README says how. `tbrun --beside` copies them into the exe's folder, where the loader finds them before System32; a routine the exe imports that a stand-in lacks stops the exe from starting (0xC0000139), so a routine a new case reaches is added to the stand-in and its `.def`. A routine called in the wrong - convention gets an x86 naked stand-in that pops what the defective caller pushed; its comment - says what to change once fixed (KfAcquireSpinLock, 0.3.0.6). **A 32-bit exe ends at its first - FastCall case** (twinBASIC BETA 1042, `bugs/declare-fastcall-static-binding-32bit`): those cases - are last in the file and record *no result*; the cases that call no FastCall Declare come before - them. + convention gets an x86 naked stand-in that pops what the defective caller pushed, and a comment + that says what to change once fixed (none from 0.3.0.8, which declares KfAcquireSpinLock + FastCall). **A 32-bit exe ends at its first FastCall case** (twinBASIC BETA 1042, + `bugs/declare-fastcall-static-binding-32bit`): those cases are last in the file and record *no + result*; the cases that call no FastCall Declare come before them. The first of them, + KeAcquireSpinLock_PassesTheLock, passes on 0.3.0.8 (two runs): ECX holds the lock's address at the + call, but the call leaves the stack 4 bytes off, and the next case ends the exe. - `probe/`: builds small drivers with `tbbuild --build` and judges their import tables with the verifier's `checkDriver`; it backs the landing page's warning on the package's own settings. - `verifier/`: published as `tbKMode-verifier.zip` (its page, `Verifier.md`). `check` checks each @@ -129,12 +136,13 @@ posts them. #1 (modFltMgr, modDisk) and #2 (modSysInfo) were answered by 0.3.0.5 `tbkmode-issue-2-comment.md`). #3 (the package's Settings) and #4 (the declarations of modWDM and modImage) are filed (2026-11-17), from `tbkmode-issue-3.md` and `tbkmode-issue-4.md`. 0.3.0.6 answered #3 (its Settings set the five) and most of #4; fafalone's replies on #2 and #4 decided the conventions above. The -reply to #4 on 0.3.0.6 is drafted in `tbkmode-issue-4-comment.md`. +reply to #4 on 0.3.0.6 is drafted in `tbkmode-issue-4-comment.md`. 0.3.0.8 fixed every item of +its list (1-12); what is left is IO_DRIVER_CREATE_CONTEXT.SiloContext, KUSER_SHARED_DATA (fine as it +is) and the names shared with VBA. ## Leads, not on the pages -In [WIP.BugHunt.md](WIP.BugHunt.md#tbkmode): RtlFailFast's fixed reason (on the page as a NOTE -marked `none`), `SE_SELF_RELATIVE` `&H8000&` against the Integer `Control` field, and MmCopyMemory's -4-byte *NumberOfBytes* in a 64-bit build, which the verifier reports and no page states yet. Omissions, not defects: newer +In [WIP.BugHunt.md](WIP.BugHunt.md#tbkmode): `SE_SELF_RELATIVE` `&H8000&` against the Integer +`Control` field. Omissions, not defects: newer members missing from `IMAGE_DEBUG_EX_CH` and `ImageMachineType`, `SYMBOLIC_LINK_SET`; optional pointers declared `ByRef` (the `ByVal vbNullPtr` paragraph covers them). diff --git a/docs/Community/Experimental.md b/docs/Community/Experimental.md index e61c19a4..a4b1bf6d 100644 --- a/docs/Community/Experimental.md +++ b/docs/Community/Experimental.md @@ -16,7 +16,7 @@ These packages are published through TWINSERV, as the [Contributed Packages](../ - [**GdiPlus**](../Contributed/GdiPlus/) -- Windows GDI+: lines, shapes, text and images drawn with pens, brushes, fonts, paths and transformations. Version 0.9.45.0 compiles, and has many members that give wrong results, fail or do not return: a colour given as a **Long** has its red and blue swapped and loses its alpha, saving an image with encoder parameters fails, the font collections cannot be created, and several path, metafile and effect members fail. - [**Generics**](../Contributed/Generics/) -- tuples, read-only objects that hold one to seven values of declared types. Version 1.0.0.0 does not compile in twinBASIC BETA 1042: the **WinDevLib** package it embeds declares six delegates with no return type, which this build reports as TB0003, an error under WinDevLib's own settings. - [**NewTabCtl**](../Contributed/NewTabCtl/) -- the **NewTab** control, a container with a row of tabs. Version 10.0.289.0 does not compile in twinBASIC BETA 1042: four properties of the control name property pages that the package does not hold, which this build reports as TB5259. -- [**tbKMode**](../Contributed/tbKMode/) -- declarations for writing a Windows kernel-mode driver: the Windows Driver Model, the Filter Manager, system information classes, disk structures and the PE image format. Version 0.3.0.6 compiles, and some of its Windows Driver Model declarations do not match the Windows Driver Kit: a structure with another layout, procedures that lower their caller's IRQL, and in a 32-bit driver a routine called in the wrong convention and routines that the 32-bit kernel does not export. A 32-bit driver also cannot call a `__fastcall` routine of the kernel, because of a defect of twinBASIC BETA 1042. +- [**tbKMode**](../Contributed/tbKMode/) -- declarations for writing a Windows kernel-mode driver: the Windows Driver Model, the Filter Manager, system information classes, disk structures and the PE image format. Version 0.3.0.8 compiles, and fixes the declarations of earlier versions that did not match the Windows Driver Kit; two structures are still smaller than C's. A 32-bit driver cannot call a `__fastcall` routine of the kernel, because of a defect of twinBASIC BETA 1042, and a call of the package's **LCase**, **UCase**, **InStr** or **MsgBox** without its module name calls VBA's function. - [**TBMANLIB**](../Contributed/TBMANLIB/) -- a toolkit of helpers: JSON, an HTTP client, logs, INI and CSV files, timers, strings, bytes, files and dictionaries. Version 1.0.0.29 compiles for 32-bit programs, does not compile in a 64-bit build, and has several members that fail or give wrong results. - [**TBMANLIB_Aes**](../Contributed/TBMANLIB_Aes/) -- AES encryption of text and byte arrays. Version 1.0.0.4 compiles, and its cipher modes are not the ones their names say: the default mode, CBC, runs ECB, and the output does not match the standard test vectors. - [**TBMANLIB_ConsoleComponents**](../Contributed/TBMANLIB_ConsoleComponents/) -- text-interface components for console programs: progress bars, charts, tables and panels. Version 1.0.0.1 compiles, and its components cannot use a console object of the published TBMANLIB_ConsoleCore, since the package carries a copy of that package whose types the compiler treats as different. diff --git a/docs/Reference/Contributed/tbKMode/index.md b/docs/Reference/Contributed/tbKMode/index.md index 747488ee..f26f1c39 100644 --- a/docs/Reference/Contributed/tbKMode/index.md +++ b/docs/Reference/Contributed/tbKMode/index.md @@ -2,30 +2,19 @@ title: tbKMode Package parent: Experimental Packages has_toc: false -indexed_from: 0.3.0.6 +indexed_from: 0.3.0.8 permalink: /tB/Packages/Contributed/tbKMode/ --- # tbKMode Package {: .no_toc } -**Author:** fafalone. **Version:** 0.3.0.6. **On GitHub:** [fafalone/tbKMode](https://github.com/fafalone/tbKMode). +**Author:** fafalone. **Version:** 0.3.0.8. **On GitHub:** [fafalone/tbKMode](https://github.com/fafalone/tbKMode). Declarations for writing a Windows kernel-mode driver in twinBASIC. The **tbKMode** contributed package declares types, routines, constants and macros of the Windows Driver Kit (WDK), from its headers `wdm.h`, `ntddk.h`, `ntifs.h`, `fltkernel.h`, `ntdddisk.h`, `mountmgr.h` and `ntimage.h`, for a driver built as a `.sys` file. It covers a part of the WDK: its author describes it as a start, to be extended by each project that uses it. - -> [!WARNING] 0.3.0.6 -> The package compiles, and a driver can be built with it, but some of its declarations do not match the WDK, and fail with no error. The main ones: -> -> - [**OB_PRE_OPERATION_INFORMATION**](modWDM#OB_PRE_OPERATION_INFORMATION) has another layout than the C structure, so that its **Parameters** holds other data: see [modWDM](modWDM#types). -> - [**InterlockedAdd64**](modWDM#InterlockedAdd64), and in a 64-bit driver [**InterlockedIncrement**](modWDM#InterlockedIncrement), release a spin lock that they never acquired, which lowers the IRQL of their caller to `PASSIVE_LEVEL`. -> - In a 32-bit driver, [**KeAcquireSpinLock**](modWDM#KeAcquireSpinLock) calls its routine in another calling convention than the one of `hal.dll`, and [**KeLowerIrql**](modWDM#KeLowerIrql) and the `Rtl...BitsEx` routines name routines that the 32-bit kernel does not export: see [modWDM](modWDM#declares). -> - The members of [**ImageMachineType**](modImage#ImageMachineType) above `&H7FFF` are not equal to the **Machine** field of an image that holds them. -> -> Each page states the defects of its own declarations, in a warning or a note below its table or in the section of the procedure. - * TOC {:toc} @@ -44,7 +33,7 @@ The package's own procedures are compiled with the package's settings, not the d > [!WARNING] BETA 1042 -> In a 32-bit driver no call of a `FastCall` declaration reaches its routine as it should. With **Runtime Binding Of DLL Declares** set to **No**, as a driver has it and as the package sets it for its own declarations, twinBASIC calls a `FastCall` declaration without its arguments in the registers where a `__fastcall` routine reads them: the routine works on other values, and the driver's stack is left wrong. The 32-bit kernel exports many routines as `__fastcall`, among them **IofCallDriver**, which [**IoCallDriver**](modWDM#IoCallDriver) calls, **ObfDereferenceObject**, the fast mutexes, **KfRaiseIrql** and **InterlockedIncrement**, and the package declares each of them `FastCall`. A 64-bit driver is not affected: it has one calling convention. +> In a 32-bit driver no call of a `FastCall` declaration reaches its routine as it should. With **Runtime Binding Of DLL Declares** set to **No**, as a driver has it and as the package sets it for its own declarations, twinBASIC calls a `FastCall` declaration without its arguments in the registers where a `__fastcall` routine reads them: the routine works on other values, and the driver's stack is left wrong. The 32-bit kernel exports many routines as `__fastcall`, among them **IofCallDriver**, which [**IoCallDriver**](modWDM#IoCallDriver) calls, **ObfDereferenceObject**, **KfAcquireSpinLock**, which [**KeAcquireSpinLock**](modWDM#KeAcquireSpinLock) calls, the fast mutexes, **KfRaiseIrql** and **InterlockedIncrement**, and the package declares each of them `FastCall`. A 64-bit driver is not affected: it has one calling convention. The [Build Output Path](../../../IDE/Project-Settings#build-output-path) ends in `.sys` in place of `.${FileExtension}`. A driver is built for the architecture of the Windows it runs on: the kernel runs no 32-bit code on 64-bit Windows. [Project Types](../../../../Features/Project-Configuration/Project-Types#kernel-mode-drivers) says more about kernel-mode projects. @@ -53,7 +42,7 @@ The [Build Output Path](../../../IDE/Project-Settings#build-output-path) ends in **modWDM** has procedures named [**LCase**](modWDM#LCase), [**UCase**](modWDM#UCase), [**InStr**](modWDM#InStr) and [**MsgBox**](modWDM#MsgBox), as VBA's functions are. They take the addresses of null-terminated strings, since a driver works on the kernel's strings, and the package's changelog calls them overrides of VBA's. -> [!WARNING] 0.3.0.6 +> [!WARNING] 0.3.0.8 > A call of one of these names without a module name calls VBA's function, not the package's. `LCase(StrPtr(s))` and `UCase(StrPtr(s))` leave the string as it was, `InStr(StrPtr(a), StrPtr(b))` returns 0 when *a* holds *b*, and `MsgBox "text"` compiles as VBA's **MsgBox**. A driver writes the module name to call the package's procedures: `modWDM.LCase`, `modWDM.UCase`, `modWDM.InStr` and `modWDM.MsgBox`. ## Modules diff --git a/docs/Reference/Contributed/tbKMode/modImage.md b/docs/Reference/Contributed/tbKMode/modImage.md index d34b2b41..48e7f27a 100644 --- a/docs/Reference/Contributed/tbKMode/modImage.md +++ b/docs/Reference/Contributed/tbKMode/modImage.md @@ -100,7 +100,7 @@ Each structure that the WDK's `ntimage.h` declares has the size of its C structu ## Enumerations - + Every member that `ntimage.h` declares has the value of its constant or enumerator of the same name. | Name | Description | @@ -136,14 +136,15 @@ Every member that `ntimage.h` declares has the value of its constant or enumerat | **ImageDllCharacteristics**{: #ImageDllCharacteristics } | The `IMAGE_DLLCHARACTERISTICS_` flags of the optional header's **DllCharacteristics**, such as `IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE`, `IMAGE_DLLCHARACTERISTICS_NX_COMPAT` and `IMAGE_DLLCHARACTERISTICS_WDM_DRIVER`, with the reserved `IMAGE_LIBRARY_` flags. | | **ImageFileCharacteristics**{: #ImageFileCharacteristics } | The `IMAGE_FILE_` flags of **IMAGE_FILE_HEADER.Characteristics**, such as `IMAGE_FILE_EXECUTABLE_IMAGE`, `IMAGE_FILE_LARGE_ADDRESS_AWARE` and `IMAGE_FILE_DLL`. | | **ImageLoadConfigGuardFlags**{: #ImageLoadConfigGuardFlags } | The `IMAGE_GUARD_` flags of the load configuration directory's **GuardFlags**: which Control Flow Guard, return flow and related protections the image has, such as `IMAGE_GUARD_CF_INSTRUMENTED`, with the mask and shift of the stride of the guard function table. | -| **ImageMachineType**{: #ImageMachineType } | The `IMAGE_FILE_MACHINE_` values of **IMAGE_FILE_HEADER.Machine**: the processor the file is for, such as `IMAGE_FILE_MACHINE_I386`, `IMAGE_FILE_MACHINE_AMD64` and `IMAGE_FILE_MACHINE_ARM64`. See the warning below. | +| **ImageMachineType**{: #ImageMachineType } | The `IMAGE_FILE_MACHINE_` values of **IMAGE_FILE_HEADER.Machine**: the processor the file is for, such as `IMAGE_FILE_MACHINE_I386`, `IMAGE_FILE_MACHINE_AMD64` and `IMAGE_FILE_MACHINE_ARM64`. See below the table. | | **ImageSectionCharacteristics**{: #ImageSectionCharacteristics } | The `IMAGE_SCN_` flags of **IMAGE_SECTION_HEADER.Characteristics**: what the section contains, its alignment in an object file (`IMAGE_SCN_ALIGN_`), and how it is mapped, such as `IMAGE_SCN_MEM_EXECUTE` and `IMAGE_SCN_MEM_NOT_PAGED`. | | **ImageSubsystemType**{: #ImageSubsystemType } | The `IMAGE_SUBSYSTEM_` values of the optional header's **Subsystem**: the subsystem an image runs in, such as `IMAGE_SUBSYSTEM_NATIVE` for a driver and `IMAGE_SUBSYSTEM_WINDOWS_GUI`. | - -> [!WARNING] 0.3.0.6 -> The members of **ImageMachineType** above `&H7FFF`, such as **IMAGE_FILE_MACHINE_AMD64** (`&H8664&`) and **IMAGE_FILE_MACHINE_ARM64** (`&HAA64&`), are positive **Long** values, but **IMAGE_FILE_HEADER.Machine** is an **Integer**, which holds them as negative numbers: `hdr.Machine = IMAGE_FILE_MACHINE_AMD64` is **False** for the header of an AMD64 image. A driver compares `hdr.Machine And &HFFFF&` with the constant. + +The members of **ImageMachineType** above `&H7FFF`, such as **IMAGE_FILE_MACHINE_AMD64** and **IMAGE_FILE_MACHINE_ARM64**, hold the bits of the C value as an **Integer** does: **IMAGE_FILE_MACHINE_AMD64** is `&H8664`, -31132, not the **Long** 34404. **IMAGE_FILE_HEADER.Machine** is an **Integer**, so `hdr.Machine = IMAGE_FILE_MACHINE_AMD64` is **True** for the header of an AMD64 image. The enumeration is declared in a module of its own in the package's file `modImage.twin`, **SuppressedWarnings**, which turns off [TB0012](../../../../Features/Compiler-IDE/Compiler-Warnings#tb0012-possible-hex-literal-misuse) for these literals; its members are used without a module name. + + ## Constants diff --git a/docs/Reference/Contributed/tbKMode/modWDM.md b/docs/Reference/Contributed/tbKMode/modWDM.md index 391cdf4d..d89eef13 100644 --- a/docs/Reference/Contributed/tbKMode/modWDM.md +++ b/docs/Reference/Contributed/tbKMode/modWDM.md @@ -130,7 +130,7 @@ A parameter that C declares optional, and that is a structure passed by referenc | [**KeGetCurrentIrql**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-kegetcurrentirql){: #KeGetCurrentIrql } | Returns the current IRQL. In a 32-bit build it is a routine of `hal.dll`. | | [**KeInitializeEvent**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-keinitializeevent){: #KeInitializeEvent } | Initializes a **KEVENT** as a notification or synchronization event, signaled or not signaled. | | [**KeInitializeSpinLock**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-keinitializespinlock){: #KeInitializeSpinLock } | Initializes a spin lock variable, a **LongPtr**. The C routine returns nothing, so the **Long** it returns here has no meaning. | -| [**KeLowerIrql**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-kelowerirql){: #KeLowerIrql } | Restores the IRQL of the current processor to *NewIrql*, the value that **KeRaiseIrql** saved or **KfRaiseIrql** or **KeRaiseIrqlToDpcLevel** returned. In a 32-bit build it names `KfLowerIrql` of `ntoskrnl.exe`: see the note below. | +| [**KeLowerIrql**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-kelowerirql){: #KeLowerIrql } | Restores the IRQL of the current processor to *NewIrql*, the value that **KeRaiseIrql** saved or **KfRaiseIrql** or **KeRaiseIrqlToDpcLevel** returned. In a 32-bit build it is a declaration of `KfLowerIrql` of `hal.dll`. | | [**KeQuerySystemTimePrecise**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-kequerysystemtimeprecise){: #KeQuerySystemTimePrecise } | Writes the current system time into *CurrentTime*, as **KeQuerySystemTime** does but more precisely. | | [**KeRaiseIrqlToDpcLevel**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-keraiseirqltodpclevel){: #KeRaiseIrqlToDpcLevel } | Raises the IRQL of the current processor to `DISPATCH_LEVEL` and returns the IRQL from before, which **KeLowerIrql** takes back. In a 32-bit build it is a routine of `hal.dll`. | | [**KeReleaseSpinLock**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-kereleasespinlock){: #KeReleaseSpinLock } | Releases a spin lock and sets the IRQL to *NewIrql*, the IRQL that **KeAcquireSpinLock** returned. In a 32-bit build it is a routine of `hal.dll`. | @@ -196,9 +196,9 @@ A parameter that C declares optional, and that is a structure passed by referenc | [**RtlAreBitsClear**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlarebitsclear){: #RtlAreBitsClear } | Returns nonzero when the *Length* bits of a bitmap from bit *StartingIndex* are all clear. | | [**RtlAreBitsSet**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlarebitsset){: #RtlAreBitsSet } | Returns nonzero when the *Length* bits of a bitmap from bit *StartingIndex* are all set. | | [**RtlClearAllBits**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlclearallbits){: #RtlClearAllBits } | Clears every bit of a bitmap. | -| **RtlClearAllBitsEx**{: #RtlClearAllBitsEx } | As **RtlClearAllBits**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. | +| **RtlClearAllBitsEx**{: #RtlClearAllBitsEx } | As **RtlClearAllBits**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only. | | [**RtlClearBit**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlclearbit){: #RtlClearBit } | Clears bit *BitNumber* of a bitmap. | -| **RtlClearBitEx**{: #RtlClearBitEx } | As **RtlClearBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. | +| **RtlClearBitEx**{: #RtlClearBitEx } | As **RtlClearBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only. | | [**RtlClearBits**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlclearbits){: #RtlClearBits } | Clears *NumberToClear* bits of a bitmap, from bit *StartingIndex*. | | [**RtlCompareUnicodeString**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlcompareunicodestring){: #RtlCompareUnicodeString } | Compares two strings, with or without case, and returns a value less than, equal to or greater than zero. | | **RtlCompareUnicodeStrings**{: #RtlCompareUnicodeStrings } | Compares two UTF-16 strings given by their addresses and their lengths in characters, with or without case, and returns a value less than, equal to or greater than zero. | @@ -223,10 +223,9 @@ A parameter that C declares optional, and that is a structure passed by referenc | [**RtlFindNextForwardRunClear**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlfindnextforwardrunclear){: #RtlFindNextForwardRunClear } | Returns the number of bits in the next run of clear bits of a bitmap from bit *FromIndex*, and its first bit in *StartingRunIndex*. | | [**RtlFindSetBits**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlfindsetbits){: #RtlFindSetBits } | Returns the first bit of a run of *NumberToFind* set bits in a bitmap, searching from bit *HintIndex*, or `&HFFFFFFFF` when there is none. | | [**RtlFindSetBitsAndClear**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlfindsetbitsandclear){: #RtlFindSetBitsAndClear } | As **RtlFindSetBits**, and clears the bits it finds. | -| **RtlFindSetBitsAndClearEx**{: #RtlFindSetBitsAndClearEx } | As **RtlFindSetBitsAndClear**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. | -| **RtlFindSetBitsEx**{: #RtlFindSetBitsEx } | As **RtlFindSetBits**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. | +| **RtlFindSetBitsAndClearEx**{: #RtlFindSetBitsAndClearEx } | As **RtlFindSetBitsAndClear**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only. | +| **RtlFindSetBitsEx**{: #RtlFindSetBitsEx } | As **RtlFindSetBits**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only. | | [**RtlFreeHeap**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-rtlfreeheap){: #RtlFreeHeap } | Frees a block that **RtlAllocateHeap** allocated, and returns nonzero when it succeeds. | -| [**RtlFreeSid**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-rtlfreesid){: #RtlFreeSid } | Frees a SID that `RtlAllocateAndInitializeSid` allocated. See the note below. | | [**RtlFreeUnicodeString**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlfreeunicodestring){: #RtlFreeUnicodeString } | Frees the buffer of a string that a routine allocated, such as **RtlUpcaseUnicodeString** with *AllocateDestinationString* nonzero. | | **RtlGetControlSecurityDescriptor**{: #RtlGetControlSecurityDescriptor } | Returns the control flags and the revision of a security descriptor in *Control* and *Revision*. | | [**RtlGetDaclSecurityDescriptor**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-rtlgetdaclsecuritydescriptor){: #RtlGetDaclSecurityDescriptor } | Returns in *DaclPresent* whether a security descriptor has a discretionary access control list (DACL), and in *Dacl* and *DaclDefaulted* its address and whether it was defaulted. | @@ -236,7 +235,7 @@ A parameter that C declares optional, and that is a structure passed by referenc | **RtlImageDirectoryEntryToData**{: #RtlImageDirectoryEntryToData } | Returns the address of a data directory of the image at *BaseAddress*, such as its export directory, and its size in *size*; *Directory* is an **ImageDirectories** value. Not documented by Microsoft. | | **RtlImageNtHeader**{: #RtlImageNtHeader } | Returns the address of the NT headers of the image loaded at *ModuleBase*. Not documented by Microsoft. | | [**RtlInitializeBitMap**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlinitializebitmap){: #RtlInitializeBitMap } | Initializes the header of a bitmap of *SizeOfBitmap* bits, which then points at the buffer and does not copy it. *BitmapBuffer* is `As Any`: pass the first element of a **Long** array, or an address as `ByVal`. | -| **RtlInitializeBitMapEx**{: #RtlInitializeBitMapEx } | As **RtlInitializeBitMap**, for an **RTL_BITMAP_EX**, whose size and bit numbers are **LongLong**. Not documented by Microsoft. | +| **RtlInitializeBitMapEx**{: #RtlInitializeBitMapEx } | As **RtlInitializeBitMap**, for an **RTL_BITMAP_EX**, whose size and bit numbers are **LongLong**. Not documented by Microsoft. Declared in a 64-bit build only. | | [**RtlInitializeSid**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-rtlinitializesid){: #RtlInitializeSid } | Initializes the SID at the address *Sid* with an identifier authority and a number of subauthorities, whose values it does not set. | | [**RtlInitializeSidEx**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-rtlinitializesidex){: #RtlInitializeSidEx } | As **RtlInitializeSid**, with the values of the subauthorities passed after *SubAuthorityCount*. | | [**RtlInitUnicodeString**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlinitunicodestring){: #RtlInitUnicodeString } | Sets a **UNICODE_STRING** to the null-terminated UTF-16 string at the address *SourceString*, which the structure then points at and which is not copied. | @@ -255,7 +254,7 @@ A parameter that C declares optional, and that is a structure passed by referenc | [**RtlQueryRegistryValues**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlqueryregistryvalues){: #RtlQueryRegistryValues } | Reads several values of one registry key in a single call, as an array of **RTL_QUERY_REGISTRY_TABLE** describes them. *RelativeTo* is an `RTL_REGISTRY_` constant and *Path* the address of a null-terminated UTF-16 string. | | [**RtlSetAllBits**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlsetallbits){: #RtlSetAllBits } | Sets every bit of a bitmap. | | [**RtlSetBit**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlsetbit){: #RtlSetBit } | Sets bit *BitNumber* of a bitmap. | -| **RtlSetBitEx**{: #RtlSetBitEx } | As **RtlSetBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. | +| **RtlSetBitEx**{: #RtlSetBitEx } | As **RtlSetBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only. | | [**RtlSetBits**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlsetbits){: #RtlSetBits } | Sets *NumberToSet* bits of a bitmap, from bit *StartingIndex*. | | [**RtlSetControlSecurityDescriptor**](https://learn.microsoft.com/en-us/windows/win32/devnotes/rtlsetcontrolsecuritydescriptor){: #RtlSetControlSecurityDescriptor } | Sets the control flags *ControlBitsOfInterest* of a security descriptor to their values in *ControlBitsToSet*. | | [**RtlSetDaclSecurityDescriptor**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlsetdaclsecuritydescriptor){: #RtlSetDaclSecurityDescriptor } | Sets the discretionary access control list (DACL) of an absolute security descriptor and its flags; *Dacl* is the ACL's address, or 0 for a null DACL. | @@ -263,7 +262,7 @@ A parameter that C declares optional, and that is a structure passed by referenc | **RtlSidHashInitialize**{: #RtlSidHashInitialize } | Fills a **SID_AND_ATTRIBUTES_HASH** for lookups in the array of *SidCount* **SID_AND_ATTRIBUTES** that starts at *SidAttr*. Not documented by Microsoft. | | **RtlSidHashLookup**{: #RtlSidHashLookup } | Returns the address of the **SID_AND_ATTRIBUTES** of the SID at *Sid* in a hash that **RtlSidHashInitialize** filled. Not documented by Microsoft. | | [**RtlTestBit**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtltestbit){: #RtlTestBit } | Returns nonzero when bit *BitNumber* of a bitmap is set. | -| **RtlTestBitEx**{: #RtlTestBitEx } | As **RtlTestBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. | +| **RtlTestBitEx**{: #RtlTestBitEx } | As **RtlTestBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only. | | [**RtlUpcaseUnicodeString**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-rtlupcaseunicodestring){: #RtlUpcaseUnicodeString } | Writes an uppercase copy of *SourceString* into *DestinationString*, allocating its buffer when *AllocateDestinationString* is nonzero, to be freed with **RtlFreeUnicodeString**. | | [**RtlValidRelativeSecurityDescriptor**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlvalidrelativesecuritydescriptor){: #RtlValidRelativeSecurityDescriptor } | Returns nonzero when a self-relative security descriptor of *SecurityDescriptorLength* bytes is valid and holds the parts that *RequiredInformation* names. | | [**RtlValidSecurityDescriptor**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlvalidsecuritydescriptor){: #RtlValidSecurityDescriptor } | Returns nonzero when a security descriptor is valid. | @@ -342,20 +341,18 @@ A parameter that C declares optional, and that is a structure passed by referenc | [**ZwUnmapViewOfSection**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-zwunmapviewofsection){: #ZwUnmapViewOfSection } | Unmaps a view that **ZwMapViewOfSection** mapped from the address space of a process. | | [**ZwWriteFile**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-zwwritefile){: #ZwWriteFile } | Writes *Length* bytes from *Buffer* to an open file, at *ByteOffset*. | - -> [!WARNING] 0.3.0.6 -> In a 32-bit driver [**KeAcquireSpinLock**](#KeAcquireSpinLock) is a declaration of `KfAcquireSpinLock` of `hal.dll`, a `__fastcall` routine that takes the lock in a register, but the package declares it without `FastCall` and calls it as a `__stdcall` routine, which pushes the lock on the stack. The routine acquires some other spin lock than the driver's, and the call leaves the stack 4 bytes off. A 64-bit driver is not affected. + +In a 32-bit build the routines that the 32-bit kernel has in `hal.dll`, such as `KfAcquireSpinLock` and `KfLowerIrql`, which [**KeAcquireSpinLock**](#KeAcquireSpinLock) and **KeLowerIrql** call there, are declarations of `hal.dll`. **RtlInitializeBitMapEx**, **RtlClearAllBitsEx**, **RtlClearBitEx**, **RtlSetBitEx**, **RtlTestBitEx**, **RtlFindSetBitsEx** and **RtlFindSetBitsAndClearEx** are declared in a 64-bit build only, since no 32-bit file exports them. + - -> [!NOTE] 0.3.0.6 -> The 64-bit kernel of Windows 10 version 22H2 does not export **RtlFreeSid**, and **ExFreePool2** is exported from Windows 11 and Windows Server 2022 on, as [its page](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-exfreepool2) says. A driver imports only the routines that it calls, so a driver that calls neither is not affected; one that calls **RtlFreeSid**, or **ExFreePool2** on Windows 10, does not load. -> -> A 32-bit driver has more of them. In a 32-bit build **KeLowerIrql** names `KfLowerIrql` of `ntoskrnl.exe`, which only the 32-bit `hal.dll` exports, and no 32-bit file exports **RtlInitializeBitMapEx**, **RtlClearAllBitsEx**, **RtlClearBitEx**, **RtlSetBitEx**, **RtlTestBitEx**, **RtlFindSetBitsEx** and **RtlFindSetBitsAndClearEx**. A 32-bit driver that calls any of them does not load; it calls **KfLowerIrql** in place of **KeLowerIrql**. The 64-bit kernel exports all of them. + +> [!NOTE] 0.3.0.8 +> **ExFreePool2** is exported from Windows 11 and Windows Server 2022 on, as [its page](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-exfreepool2) says: the 64-bit kernel of Windows 10 version 22H2 does not export it. A driver imports only the routines that it calls, so a driver that does not call it is not affected; one that calls it on Windows 10 does not load. ## Types - -Each structure that the WDK's kernel-mode headers declare has the size of its C structure, and its fields are at the C fields' offsets, in a 32-bit and in a 64-bit build, apart from those of the warning and the note below. + +Each structure that the WDK's kernel-mode headers declare has the size of its C structure, and its fields are at the C fields' offsets, in a 32-bit and in a 64-bit build, apart from those of the note below. | Name | Description | |------|-------------| @@ -363,7 +360,7 @@ Each structure that the WDK's kernel-mode headers declare has the size of its C | **ANSI_STRING**{: #ANSI_STRING } | A counted string of 8-bit ANSI characters, laid out as **UNICODE_STRING**: its length and its buffer's size in bytes and the buffer's address. | | **CLIENT_ID**{: #CLIENT_ID } | A process ID and a thread ID, as **ZwOpenProcess** takes them and **PS_CREATE_NOTIFY_INFO.CreatingThreadId** holds them. | | **CM_EXTENDED_PARAMETER**{: #CM_EXTENDED_PARAMETER } | One extended parameter of **ZwLoadKey3**. **uType** holds the C bit fields, the 8-bit type (a **CM_EXTENDED_PARAMETER_TYPE** value) and the reserved bits, and **u** holds the C union of the parameter's value. | -| [**DEVICE_OBJECT**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_device_object){: #DEVICE_OBJECT } | A device, as **IoCreateDevice** creates it and **IoAttachDeviceToDeviceStack**, **IofCallDriver** and **IoDetachDevice** take it: its driver, the next and the attached device, flags, device extension, device type and stack size. The C union **Queue** is a **Byte** array. See the note below. | +| [**DEVICE_OBJECT**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_device_object){: #DEVICE_OBJECT } | A device, as **IoCreateDevice** creates it and **IoAttachDeviceToDeviceStack**, **IofCallDriver** and **IoDetachDevice** take it: its driver, the next and the attached device, flags, device extension, device type and stack size. The C union **Queue** is a **Byte** array. | | **DEVICEIOCTL**{: #DEVICEIOCTL } | The **DeviceIoControl** member of the C union **Parameters** of **IO_STACK_LOCATION**, for `IRP_MJ_DEVICE_CONTROL` and `IRP_MJ_INTERNAL_DEVICE_CONTROL`: the two buffer lengths, the control code and the input buffer of a `METHOD_NEITHER` request. In a 64-bit build **zPtrAlign2** and **zPtrAlign3** are the padding C puts before **InputBufferLength** and **IoControlCode**. | | **DISPATCHER_HEADER**{: #DISPATCHER_HEADER } | The header that every kernel object a thread can wait on begins with, as **KEVENT.Header** holds it: its signal state and the list of waiting threads. **Lock** stands for the C union of the object's type, size and flag bytes. | | **DRIVER_EXTENSION**{: #DRIVER_EXTENSION } | The driver extension that **DRIVER_OBJECT.DriverExtension** points to: the driver's **AddDevice** routine and the name of its service key in the registry. | @@ -407,7 +404,7 @@ Each structure that the WDK's kernel-mode headers declare has the size of its C | [**LUID**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/igpupvdev/ns-igpupvdev-_luid){: #LUID } | A locally unique identifier: a 64-bit value that is unique on the system that made it, such as a privilege's. | | [**LUID_AND_ATTRIBUTES**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_luid_and_attributes){: #LUID_AND_ATTRIBUTES } | A **LUID** and its attributes, such as a privilege and whether it is enabled (**SE_PRIVILEGE_ATTR**). | | [**MDL**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_mdl){: #MDL } | A memory descriptor list, which describes the physical pages of a buffer, as **IRP.MdlAddress** points to it and **MmGetSystemAddressForMdlSafe** and **MmMapLockedPagesSpecifyCache** take its address. | -| **NPAGED_LOOKASIDE_LIST**{: #NPAGED_LOOKASIDE_LIST } | A lookaside list of entries in nonpaged pool, whose address **ExInitializeNPagedLookasideList** takes. It holds a **GENERAL_LOOKASIDE**, followed by C's obsolete lock field in a 32-bit build and by a padding array, **align**, in a 64-bit one. See the note below. | +| **NPAGED_LOOKASIDE_LIST**{: #NPAGED_LOOKASIDE_LIST } | A lookaside list of entries in nonpaged pool, whose address **ExInitializeNPagedLookasideList** takes. It holds a **GENERAL_LOOKASIDE**, followed in a 32-bit build by C's obsolete lock field. | | [**OB_CALLBACK_REGISTRATION**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_ob_callback_registration){: #OB_CALLBACK_REGISTRATION } | What a driver registers with **ObRegisterCallbacks**: the version, the altitude, a context and **OperationRegistration**, which points to an array of **OperationRegistrationCount** **OB_OPERATION_REGISTRATION** items. | | [**OB_OPERATION_REGISTRATION**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_ob_operation_registration){: #OB_OPERATION_REGISTRATION } | One object type to watch, with the handle operations (**OB_OPERATION**) and the pre-operation and post-operation callbacks. **ObjectType** is the address that **PsProcessType** or **PsThreadType** returns. | | [**OB_POST_CREATE_HANDLE_INFORMATION**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_ob_post_create_handle_information){: #OB_POST_CREATE_HANDLE_INFORMATION } | The access granted to a process or thread handle that has been opened, as a post-operation callback receives it. | @@ -416,7 +413,8 @@ Each structure that the WDK's kernel-mode headers declare has the size of its C | [**OB_POST_OPERATION_PARAMETERS**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_ob_post_operation_parameters){: #OB_POST_OPERATION_PARAMETERS } | The parameters of a post-operation callback. Both members of the C union have the one field **GrantedAccess**, so the package gives that field. | | [**OB_PRE_CREATE_HANDLE_INFORMATION**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_ob_pre_create_handle_information){: #OB_PRE_CREATE_HANDLE_INFORMATION } | The access asked for a process or thread handle that is being opened, which a pre-operation callback can reduce in **DesiredAccess**. | | [**OB_PRE_DUPLICATE_HANDLE_INFORMATION**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_ob_pre_duplicate_handle_information){: #OB_PRE_DUPLICATE_HANDLE_INFORMATION } | The access asked for a process or thread handle that is being duplicated, which a pre-operation callback can reduce in **DesiredAccess**, with the source and the target process. | -| [**OB_PRE_OPERATION_INFORMATION**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_ob_pre_operation_information){: #OB_PRE_OPERATION_INFORMATION } | A process or thread handle operation, as a pre-operation callback receives it: the operation, whether the handle is a kernel handle, the object and its type, and the context to pass to the post-operation callback. **KernelHandle** stands for the C union of the flags and the **KernelHandle** bit. **Parameters** is a **Byte** array the size of the union of **OB_PRE_CREATE_HANDLE_INFORMATION** and **OB_PRE_DUPLICATE_HANDLE_INFORMATION**, where C has a pointer to that union. See the warning below. | +| [**OB_PRE_OPERATION_INFORMATION**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_ob_pre_operation_information){: #OB_PRE_OPERATION_INFORMATION } | A process or thread handle operation, as a pre-operation callback receives it: the operation, whether the handle is a kernel handle, the object and its type, and the context to pass to the post-operation callback. **KernelHandle** stands for the C union of the flags and the **KernelHandle** bit. **Parameters** is the address of its **OB_PRE_OPERATION_PARAMETERS**. | +| [**OB_PRE_OPERATION_PARAMETERS**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_ob_pre_operation_parameters){: #OB_PRE_OPERATION_PARAMETERS } | The parameters of a process or thread handle operation, at the address in **OB_PRE_OPERATION_INFORMATION.Parameters**: the C union of **OB_PRE_CREATE_HANDLE_INFORMATION** and **OB_PRE_DUPLICATE_HANDLE_INFORMATION**, declared with the fields of the larger, **OB_PRE_DUPLICATE_HANDLE_INFORMATION**. | | [**OBJECT_ATTRIBUTES**](https://learn.microsoft.com/en-us/windows/win32/api/ntdef/ns-ntdef-_object_attributes){: #OBJECT_ATTRIBUTES } | The name, root directory, attributes (**ObjectAttributeValues**) and security of an object to open or create, as **InitializeObjectAttributes** fills it and **ZwCreateFile**, **ZwOpenKey** and the other **Zw** routines take it. | | **OBJECT_HANDLE_INFORMATION**{: #OBJECT_HANDLE_INFORMATION } | The attributes of a handle and the access it grants, as **ObReferenceObjectByHandle** and **ObReferenceObjectByHandleWithTag** fill it. | | **OEM_STRING**{: #OEM_STRING } | A counted string in the OEM code page, laid out as **ANSI_STRING**, such as the 8.3 name that **RtlIsNameLegalDOS8Dot3** returns in *OemName*. | @@ -466,7 +464,7 @@ Each structure that the WDK's kernel-mode headers declare has the size of its C | **RTL_OSVERSIONINFOEXW**{: #RTL_OSVERSIONINFOEXW } | As **RTL_OSVERSIONINFOW**, with the service pack version, suite mask and product type. **RtlGetVersion** fills it when **dwOSVersionInfoSize** is its size. | | **RTL_OSVERSIONINFOW**{: #RTL_OSVERSIONINFOW } | The Windows version, as **RtlGetVersion** fills it: the major and minor version, build number, platform and service pack string. The caller sets **dwOSVersionInfoSize** to its size first. | | **RTL_QUERY_REGISTRY_TABLE**{: #RTL_QUERY_REGISTRY_TABLE } | One entry of the table that **RtlQueryRegistryValues** takes: the routine or the variable that receives a value, its name, flags and default. The table ends with an entry whose **QueryRoutine** and **Name** are 0. | -| [**SE_SID**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_se_sid){: #SE_SID } | A buffer of **SECURITY_MAX_SID_SIZE** bytes for a **SID**, which a driver can declare as a local variable. Of the C union it has the **Buffer** member only. See the note below. | +| [**SE_SID**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_se_sid){: #SE_SID } | A buffer of **SECURITY_MAX_SID_SIZE** bytes for a **SID**, which a driver can declare as a local variable. Of the C union it has the **Buffer** member only. | | [**SECTION_OBJECT_POINTERS**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_section_object_pointers){: #SECTION_OBJECT_POINTERS } | The memory manager's and cache manager's data for a file stream, which the file system allocates and **FILE_OBJECT.SectionObjectPointer** points to. | | [**SECURITY_DESCRIPTOR**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_security_descriptor){: #SECURITY_DESCRIPTOR } | The security of an object in absolute form: its revision, control flags and pointers to the owner, the group, the SACL and the DACL. | | [**SECURITY_SUBJECT_CONTEXT**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_security_subject_context){: #SECURITY_SUBJECT_CONTEXT } | The security context of the thread that asks for access, as **ACCESS_STATE.SubjectSecurityContext** holds it and **SeLockSubjectContext**, **SeAssignSecurity** and **SeAccessCheck** take it: its client token, impersonation level and primary token. | @@ -482,19 +480,16 @@ Each structure that the WDK's kernel-mode headers declare has the size of its C | [**VPB**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_vpb){: #VPB } | A volume parameter block, which links the device object of a mounted file system volume to the device object of its disk: flags, serial number, reference count and a volume label of up to 32 characters. **FILE_OBJECT.Vpb** and **DEVICE_OBJECT.Vpb** point to it. | - -> [!WARNING] 0.3.0.6 -> **OB_PRE_OPERATION_INFORMATION.Parameters** is a **Byte** array of the size of the parameters' union where wdm.h has a pointer to the union: 16 bytes where the pointer is 4 in a 32-bit build, and 24 where it is 8 in a 64-bit one. The structure is 36 bytes where C's is 24, and 56 where C's is 40. The array starts at the pointer's offset, so its first 4 or 8 bytes are the pointer, and the rest is past the end of the structure the kernel passes. A driver that reads the parameters reads them at the address in the first 4 or 8 bytes. + +**OB_PRE_OPERATION_INFORMATION.Parameters** is the address of the parameters, as in wdm.h. The C type it points to is a union of **OB_PRE_CREATE_HANDLE_INFORMATION** and **OB_PRE_DUPLICATE_HANDLE_INFORMATION**, which **OB_PRE_OPERATION_PARAMETERS** declares as the larger of the two: a driver reads **DesiredAccess** and **OriginalDesiredAccess** of either from it, and **SourceProcess** and **TargetProcess** when the operation is `OB_OPERATION_HANDLE_DUPLICATE`. + - -> [!NOTE] 0.3.0.6 -> These structures differ from the C structures in size, and one in the start of a field: + +> [!NOTE] 0.3.0.8 +> These structures are smaller than the C structures: > -> - In a 32-bit build **DEVICE_OBJECT.Queue** starts 3 bytes before C's **Queue**, at offset 49 where C's is at 52: its first 3 bytes are the padding after **StackSize**. Its other fields are at their places, and a 64-bit build has C's layout. > - **IO_DRIVER_CREATE_CONTEXT** lacks C's last field, **SiloContext**: it is 16 bytes where C's is 20 in a 32-bit build, and 32 where C's is 40 in a 64-bit one. The package declares the field under `#If NTDDI_VERSION >= NTDDI_WIN10_RS1`, as the WDK does, but defines no `NTDDI_VERSION`, and a project's conditional constants do not reach a package's code, so the field is never there. Its other fields are at their places. > - **KUSER_SHARED_DATA** ends at **Cookie**: it is 824 bytes where the WDK's is 1848, and has none of the WDK's fields after **Cookie**. Its other fields are at their places. -> - In a 64-bit build **NPAGED_LOOKASIDE_LIST** is 144 bytes where C's is 128: its padding array, **align**, follows the **GENERAL_LOOKASIDE**, which already has C's size. A 32-bit build has C's size. -> - **SE_SID** is a buffer of **SECURITY_MAX_SID_SIZE** bytes, 60, where C's is 68 (see the note under [Constants](#constants)), so it cannot hold a SID of **SID_MAX_SUB_AUTHORITIES** subauthorities. ## Aliases @@ -509,7 +504,7 @@ Other names for a type, which the declarations use where C has the type of the s ## Enumerations - + Every member that the WDK's kernel-mode headers declare has the value of the WDK's constant or enumerator of the same name. | Name | Description | @@ -869,7 +864,7 @@ The major and minor function codes of an IRP, the parts of an I/O control code t | **SECURITY_DESCRIPTOR_MIN_LENGTH**{: #SECURITY_DESCRIPTOR_MIN_LENGTH } | `40` (64-bit), `&H14` (32-bit) | The size in bytes of an absolute **SECURITY_DESCRIPTOR**, 40 in a 64-bit build and 20 in a 32-bit one. | | **SECURITY_DESCRIPTOR_REVISION**{: #SECURITY_DESCRIPTOR_REVISION } | `(1)` | The revision of a **SECURITY_DESCRIPTOR**. | | **SECURITY_DESCRIPTOR_REVISION1**{: #SECURITY_DESCRIPTOR_REVISION1 } | `(1)` | The first revision of a **SECURITY_DESCRIPTOR**, the same as **SECURITY_DESCRIPTOR_REVISION**. | -| **SECURITY_MAX_SID_SIZE**{: #SECURITY_MAX_SID_SIZE } | `(60)` | The size in bytes of the largest **SID**, the one with **SID_MAX_SUB_AUTHORITIES** subauthorities. See the note below. | +| **SECURITY_MAX_SID_SIZE**{: #SECURITY_MAX_SID_SIZE } | `(68)` | The size in bytes of the largest **SID**, the one with **SID_MAX_SUB_AUTHORITIES** subauthorities. | | **SEMAPHORE_INCREMENT**{: #SEMAPHORE_INCREMENT } | `1` | The priority boost of a thread whose wait on a semaphore ends when the semaphore is released. | | **SharedInterruptTime**{: #SharedInterruptTime } | `(KI_USER_SHARED_DATA + &H8)` | The address of **KUSER_SHARED_DATA.InterruptTime**: the time since the system started, in 100-nanosecond units. | | **SharedSystemTime**{: #SharedSystemTime } | `(KI_USER_SHARED_DATA + &H14)` | The address of **KUSER_SHARED_DATA.SystemTime**, which the package's **KeQuerySystemTime** reads in a 64-bit build. | @@ -898,10 +893,6 @@ The major and minor function codes of an IRP, the parts of an I/O control code t The limits of the 16-bit types hold the bits of the C value in an **Integer**, as the package's fields of those types are **Integers**: **MAXUINT16**, **MAXUSHORT**, **MAXWORD**, **USHRT_MAX** and **_UI16_MAX** are `&HFFFF`, -1, and **MINSHORT** is `&H8000`, -32768. Each equals a field that holds the bits of a `USHORT` of 65535, or a `SHORT` of -32768, but not the **Long** 65535 or 32768. **SCHAR_MIN** is the **Byte** `&H80`, 128, the bits of C's -128, as the package takes a `char` as a **Byte**. - -> [!NOTE] 0.3.0.6 -> **SECURITY_MAX_SID_SIZE** is 60, where the WDK's is 68: a buffer of that size cannot hold a SID of **SID_MAX_SUB_AUTHORITIES** subauthorities. - ## Variables @@ -1173,14 +1164,10 @@ Syntax: **InterlockedAdd64** *Addend*, *Value* *Value* : *required* A **LongLong**: the value to add. - -Each call initializes a spin lock of its own with [**KeInitializeSpinLock**](#KeInitializeSpinLock), passes it with *Addend* and *Value* to [**ExInterlockedAddLargeInteger**](#ExInterlockedAddLargeInteger), which acquires and releases it, and then calls [**KeReleaseSpinLock**](#KeReleaseSpinLock) with it. The procedure is a **Sub**: it returns nothing, where the WDK's `InterlockedAdd64`, a compiler intrinsic, returns the sum. The package describes it as not usable in a 32-bit driver. + +Each call initializes a spin lock of its own with [**KeInitializeSpinLock**](#KeInitializeSpinLock) and passes it with *Addend* and *Value* to [**ExInterlockedAddLargeInteger**](#ExInterlockedAddLargeInteger), which acquires and releases it; the IRQL is left as it was. The procedure is a **Sub**: it returns nothing, where the WDK's `InterlockedAdd64`, a compiler intrinsic, returns the sum. The package describes it as not usable in a 32-bit driver. - -> [!WARNING] 0.3.0.6 -> **InterlockedAdd64** calls **KeReleaseSpinLock** with a lock that it never acquired and an IRQL of 0. **KeReleaseSpinLock** sets the IRQL to the one it is given, so a call made at `APC_LEVEL` or `DISPATCH_LEVEL` returns at `PASSIVE_LEVEL`, and the driver goes on at an IRQL lower than the one it was at. A driver calls **ExInterlockedAddLargeInteger** itself, with a spin lock that it has initialized with **KeInitializeSpinLock**. - ### InterlockedIncrement {: #InterlockedIncrement } @@ -1193,16 +1180,12 @@ Syntax (32-bit): **InterlockedIncrement**( *Addend* ) *Addend* : *required* A **Long**, passed by reference: the variable to increment. - -In a 64-bit build **InterlockedIncrement** is a **Sub** of the package: each call initializes a spin lock of its own with [**KeInitializeSpinLock**](#KeInitializeSpinLock), passes it to [**ExInterlockedAddUlong**](#ExInterlockedAddUlong) with *Addend* and 1, which acquires and releases it, and then calls [**KeReleaseSpinLock**](#KeReleaseSpinLock) with it, as [**InterlockedAdd64**](#InterlockedAdd64) does. In a 32-bit build it is a **Declare** of the kernel's `InterlockedIncrement`, a `__fastcall` routine there, which returns the incremented value. The WDK's [**InterlockedIncrement**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-interlockedincrement) is a compiler intrinsic that returns the incremented value. + +In a 64-bit build **InterlockedIncrement** is a **Sub** of the package: each call initializes a spin lock of its own with [**KeInitializeSpinLock**](#KeInitializeSpinLock) and passes it to [**ExInterlockedAddUlong**](#ExInterlockedAddUlong) with *Addend* and 1, which acquires and releases it, as [**InterlockedAdd64**](#InterlockedAdd64) does. In a 32-bit build it is a **Declare** of the kernel's `InterlockedIncrement`, a `__fastcall` routine there, which returns the incremented value. The WDK's [**InterlockedIncrement**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-interlockedincrement) is a compiler intrinsic that returns the incremented value. - -> [!WARNING] 0.3.0.6 -> In a 64-bit driver **InterlockedIncrement** calls **KeReleaseSpinLock** with a lock that it never acquired and an IRQL of 0, as **InterlockedAdd64** does: a call made at `APC_LEVEL` or `DISPATCH_LEVEL` returns at `PASSIVE_LEVEL`. A driver calls **ExInterlockedAddUlong** itself, with a spin lock that it has initialized with **KeInitializeSpinLock**. - -> [!NOTE] 0.3.0.6 +> [!NOTE] 0.3.0.8 > In a 64-bit build **InterlockedIncrement** is a **Sub**, so `n = InterlockedIncrement(v)` is refused with TB5033. In a 32-bit build it compiles. ### IoAcquireRemoveLock @@ -1419,11 +1402,9 @@ Syntax: **KeAcquireSpinLock**( *SpinLock* ) *SpinLock* : *required* A **LongPtr**, passed by reference: the spin lock, as [**KeInitializeSpinLock**](#KeInitializeSpinLock) initialized it. -In a 64-bit build the function calls [**KeAcquireSpinLockRaiseToDpc**](#KeAcquireSpinLockRaiseToDpc) and returns what it returns. In a 32-bit build it is a **Declare** of `KfAcquireSpinLock` of `hal.dll`. The WDK's `KeAcquireSpinLock` macro writes the IRQL to a second argument instead of returning it. - -> [!WARNING] 0.3.0.6 -> In a 32-bit driver `KfAcquireSpinLock` is a `__fastcall` routine, which takes the lock in a register, but the package declares it without `FastCall` and calls it as a `__stdcall` routine, which pushes the lock on the stack. The routine acquires some other spin lock than the driver's. A driver declares `KfAcquireSpinLock` itself, `FastCall` and with `Lib "hal.dll"`. +In a 64-bit build the function calls [**KeAcquireSpinLockRaiseToDpc**](#KeAcquireSpinLockRaiseToDpc) and returns what it returns. In a 32-bit build it is a `FastCall` **Declare** of `KfAcquireSpinLock` of `hal.dll`, a `__fastcall` routine: see the warning under [Building a driver](.#building-a-driver). The WDK's `KeAcquireSpinLock` macro writes the IRQL to a second argument instead of returning it. + ### KeQuerySystemTime {: #KeQuerySystemTime } @@ -1675,11 +1656,7 @@ Syntax: **RtlFailFast** *code* *code* : *required* A **Long**: the reason, such as `FAST_FAIL_CORRUPT_LIST_ENTRY` of [**RTL_FAST_FAIL**](#RTL_FAST_FAIL). -The procedure is `Naked` and `CDecl`. The WDK's `RtlFailFast`, the intrinsic `__fastfail`, loads *code* into ECX and raises `int 29h`. - - -> [!NOTE] 0.3.0.6 -> The procedure's code is `mov ecx, 7` and `int 29h`: it raises the fast fail with the reason 7, `FAST_FAIL_FATAL_APP_EXIT`, whatever *code* is, so the bug check names that reason. [**FatalListEntryError**](#FatalListEntryError) passes `FAST_FAIL_CORRUPT_LIST_ENTRY`, 3. +The procedure is `Naked` and `CDecl`. As the WDK's `RtlFailFast`, the intrinsic `__fastfail`, does, it loads *code* into ECX and raises `int 29h`, so the bug check names *code* as the reason. [**FatalListEntryError**](#FatalListEntryError) passes `FAST_FAIL_CORRUPT_LIST_ENTRY`, 3. ### SeQuerySubjectContextToken {: #SeQuerySubjectContextToken } diff --git a/indexer/snapshots/contributed/tbKMode/api.json b/indexer/snapshots/contributed/tbKMode/api.json index 6e32f133..3de5f232 100644 --- a/indexer/snapshots/contributed/tbKMode/api.json +++ b/indexer/snapshots/contributed/tbKMode/api.json @@ -2,8 +2,61 @@ "format": 4, "package": "tbKMode", "project": "tbKMode", - "version": "0.3.0.6", + "version": "0.3.0.8", "types": [ + { + "name": "SuppressedWarnings", + "kind": "module", + "vis": "public", + "file": "modImage.twin", + "signature": "Module SuppressedWarnings", + "attrs": [{"name":"IgnoreWarnings","args":"TB0012"}], + "members": [] + }, + { + "name": "ImageMachineType", + "kind": "enum", + "in": "SuppressedWarnings", + "vis": "public", + "file": "modImage.twin", + "signature": "Public Enum ImageMachineType", + "values": [ + {"name":"IMAGE_FILE_MACHINE_UNKNOWN","value":"0"}, + {"name":"IMAGE_FILE_MACHINE_TARGET_HOST","value":"&H0001"}, + {"name":"IMAGE_FILE_MACHINE_I386","value":"&H014c"}, + {"name":"IMAGE_FILE_MACHINE_R3000","value":"&H0162"}, + {"name":"IMAGE_FILE_MACHINE_R4000","value":"&H0166"}, + {"name":"IMAGE_FILE_MACHINE_R10000","value":"&H0168"}, + {"name":"IMAGE_FILE_MACHINE_WCEMIPSV2","value":"&H0169"}, + {"name":"IMAGE_FILE_MACHINE_ALPHA","value":"&H0184"}, + {"name":"IMAGE_FILE_MACHINE_SH3","value":"&H01a2"}, + {"name":"IMAGE_FILE_MACHINE_SH3DSP","value":"&H01a3"}, + {"name":"IMAGE_FILE_MACHINE_SH3E","value":"&H01a4"}, + {"name":"IMAGE_FILE_MACHINE_SH4","value":"&H01a6"}, + {"name":"IMAGE_FILE_MACHINE_SH5","value":"&H01a8"}, + {"name":"IMAGE_FILE_MACHINE_ARM","value":"&H01c0"}, + {"name":"IMAGE_FILE_MACHINE_THUMB","value":"&H01c2"}, + {"name":"IMAGE_FILE_MACHINE_ARMNT","value":"&H01c4"}, + {"name":"IMAGE_FILE_MACHINE_AM33","value":"&H01d3"}, + {"name":"IMAGE_FILE_MACHINE_POWERPC","value":"&H01F0"}, + {"name":"IMAGE_FILE_MACHINE_POWERPCFP","value":"&H01f1"}, + {"name":"IMAGE_FILE_MACHINE_IA64","value":"&H0200"}, + {"name":"IMAGE_FILE_MACHINE_MIPS16","value":"&H0266"}, + {"name":"IMAGE_FILE_MACHINE_ALPHA64","value":"&H0284"}, + {"name":"IMAGE_FILE_MACHINE_MIPSFPU","value":"&H0366"}, + {"name":"IMAGE_FILE_MACHINE_MIPSFPU16","value":"&H0466"}, + {"name":"IMAGE_FILE_MACHINE_AXP64","value":"IMAGE_FILE_MACHINE_ALPHA64"}, + {"name":"IMAGE_FILE_MACHINE_TRICORE","value":"&H0520"}, + {"name":"IMAGE_FILE_MACHINE_CEF","value":"&H0CEF"}, + {"name":"IMAGE_FILE_MACHINE_EBC","value":"&H0EBC"}, + {"name":"IMAGE_FILE_MACHINE_AMD64","value":"&H8664"}, + {"name":"IMAGE_FILE_MACHINE_M32R","value":"&H9041"}, + {"name":"IMAGE_FILE_MACHINE_ARM64","value":"&HAA64"}, + {"name":"IMAGE_FILE_MACHINE_CEE","value":"&HC0EE"}, + {"name":"IMAGE_FILE_MACHINE_ARM64EC","value":"&HA641"}, + {"name":"IMAGE_FILE_MACHINE_ARM64X","value":"&HA64E"} + ] + }, { "name": "modDisk", "kind": "module", @@ -2876,50 +2929,6 @@ {"name":"IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_SHIFT","value":"28"} ] }, - { - "name": "ImageMachineType", - "kind": "enum", - "in": "modImage", - "vis": "public", - "file": "modImage.twin", - "signature": "Public Enum ImageMachineType", - "values": [ - {"name":"IMAGE_FILE_MACHINE_UNKNOWN","value":"0"}, - {"name":"IMAGE_FILE_MACHINE_TARGET_HOST","value":"&H0001"}, - {"name":"IMAGE_FILE_MACHINE_I386","value":"&H014c"}, - {"name":"IMAGE_FILE_MACHINE_R3000","value":"&H0162"}, - {"name":"IMAGE_FILE_MACHINE_R4000","value":"&H0166"}, - {"name":"IMAGE_FILE_MACHINE_R10000","value":"&H0168"}, - {"name":"IMAGE_FILE_MACHINE_WCEMIPSV2","value":"&H0169"}, - {"name":"IMAGE_FILE_MACHINE_ALPHA","value":"&H0184"}, - {"name":"IMAGE_FILE_MACHINE_SH3","value":"&H01a2"}, - {"name":"IMAGE_FILE_MACHINE_SH3DSP","value":"&H01a3"}, - {"name":"IMAGE_FILE_MACHINE_SH3E","value":"&H01a4"}, - {"name":"IMAGE_FILE_MACHINE_SH4","value":"&H01a6"}, - {"name":"IMAGE_FILE_MACHINE_SH5","value":"&H01a8"}, - {"name":"IMAGE_FILE_MACHINE_ARM","value":"&H01c0"}, - {"name":"IMAGE_FILE_MACHINE_THUMB","value":"&H01c2"}, - {"name":"IMAGE_FILE_MACHINE_ARMNT","value":"&H01c4"}, - {"name":"IMAGE_FILE_MACHINE_AM33","value":"&H01d3"}, - {"name":"IMAGE_FILE_MACHINE_POWERPC","value":"&H01F0"}, - {"name":"IMAGE_FILE_MACHINE_POWERPCFP","value":"&H01f1"}, - {"name":"IMAGE_FILE_MACHINE_IA64","value":"&H0200"}, - {"name":"IMAGE_FILE_MACHINE_MIPS16","value":"&H0266"}, - {"name":"IMAGE_FILE_MACHINE_ALPHA64","value":"&H0284"}, - {"name":"IMAGE_FILE_MACHINE_MIPSFPU","value":"&H0366"}, - {"name":"IMAGE_FILE_MACHINE_MIPSFPU16","value":"&H0466"}, - {"name":"IMAGE_FILE_MACHINE_AXP64","value":"IMAGE_FILE_MACHINE_ALPHA64"}, - {"name":"IMAGE_FILE_MACHINE_TRICORE","value":"&H0520"}, - {"name":"IMAGE_FILE_MACHINE_CEF","value":"&H0CEF"}, - {"name":"IMAGE_FILE_MACHINE_EBC","value":"&H0EBC"}, - {"name":"IMAGE_FILE_MACHINE_AMD64","value":"&H8664&"}, - {"name":"IMAGE_FILE_MACHINE_M32R","value":"&H9041&"}, - {"name":"IMAGE_FILE_MACHINE_ARM64","value":"&HAA64&"}, - {"name":"IMAGE_FILE_MACHINE_CEE","value":"&HC0EE&"}, - {"name":"IMAGE_FILE_MACHINE_ARM64EC","value":"&HA641&"}, - {"name":"IMAGE_FILE_MACHINE_ARM64X","value":"&HA64E&"} - ] - }, { "name": "ImageSectionCharacteristics", "kind": "enum", @@ -8251,13 +8260,13 @@ {"name":"CULngToLng","kind":"function","vis":"public","signature":"Public Function CULngToLng(ByVal Value As LongLong) As Long","returnType":"Long"}, {"name":"CmCallbackGetKeyObjectID","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function CmCallbackGetKeyObjectID Lib \"ntoskrnl.exe\" (Cookie As LARGE_INTEGER, ByVal Object As LongPtr, ObjectId As LongPtr, ObjectName As LongPtr) as NTSTATUS","lib":"ntoskrnl.exe","entry":"CmCallbackGetKeyObjectID","params":["Cookie As LARGE_INTEGER","ByVal Object As LongPtr","ObjectId As LongPtr","ObjectName As LongPtr"],"returnType":"NTSTATUS"}, {"name":"CmCallbackGetKeyObjectIDEx","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function CmCallbackGetKeyObjectIDEx Lib \"ntoskrnl.exe\" (Cookie As LARGE_INTEGER, ByVal Object As LongPtr, ObjectId As LongPtr, ObjectName As LongPtr, ByVal Flags As Long) As NTSTATUS","lib":"ntoskrnl.exe","entry":"CmCallbackGetKeyObjectIDEx","params":["Cookie As LARGE_INTEGER","ByVal Object As LongPtr","ObjectId As LongPtr","ObjectName As LongPtr","ByVal Flags As Long"],"returnType":"NTSTATUS"}, - {"name":"CmCallbackReleaseKeyObjectIDEx","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub CmCallbackReleaseKeyObjectIDEx Lib \"ntoskrnl.exe\" (byval ObjectName As LongPtr)","lib":"ntoskrnl.exe","entry":"CmCallbackReleaseKeyObjectIDEx","params":["byval ObjectName As LongPtr"]}, + {"name":"CmCallbackReleaseKeyObjectIDEx","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub CmCallbackReleaseKeyObjectIDEx Lib \"ntoskrnl.exe\" (ByVal ObjectName As LongPtr)","lib":"ntoskrnl.exe","entry":"CmCallbackReleaseKeyObjectIDEx","params":["ByVal ObjectName As LongPtr"]}, {"name":"CmGetBoundTransaction","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function CmGetBoundTransaction Lib \"ntoskrnl.exe\" (Cookie As LARGE_INTEGER, ByVal Object As LongPtr) As LongPtr","lib":"ntoskrnl.exe","entry":"CmGetBoundTransaction","params":["Cookie As LARGE_INTEGER","ByVal Object As LongPtr"],"returnType":"LongPtr"}, - {"name":"CmGetCallbackVersion","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe sub CmGetCallbackVersion Lib \"ntoskrnl.exe\" (Major as Long, Minor as Long)","lib":"ntoskrnl.exe","entry":"CmGetCallbackVersion","params":["Major as Long","Minor as Long"]}, + {"name":"CmGetCallbackVersion","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe sub CmGetCallbackVersion Lib \"ntoskrnl.exe\" (Major As Long, Minor As Long)","lib":"ntoskrnl.exe","entry":"CmGetCallbackVersion","params":["Major As Long","Minor As Long"]}, {"name":"CmKeyObjectType","kind":"function","vis":"public","signature":"Public Function CmKeyObjectType() As LongPtr","returnType":"LongPtr"}, {"name":"CmRegisterCallback","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function CmRegisterCallback Lib \"ntoskrnl.exe\" (ByVal lpfn As LongPtr, Context As Any, Cookie As LARGE_INTEGER) As NTSTATUS","lib":"ntoskrnl.exe","entry":"CmRegisterCallback","params":["ByVal lpfn As LongPtr","Context As Any","Cookie As LARGE_INTEGER"],"returnType":"NTSTATUS"}, {"name":"CmRegisterCallbackEx","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function CmRegisterCallbackEx Lib \"ntoskrnl.exe\" (ByVal lpfn As LongPtr, Altitude As UNICODE_STRING, Driver As Any, Context As Any, Cookie As LARGE_INTEGER, ByVal Reserved As LongPtr) As NTSTATUS","lib":"ntoskrnl.exe","entry":"CmRegisterCallbackEx","params":["ByVal lpfn As LongPtr","Altitude As UNICODE_STRING","Driver As Any","Context As Any","Cookie As LARGE_INTEGER","ByVal Reserved As LongPtr"],"returnType":"NTSTATUS"}, - {"name":"CmSetCallbackObjectContext","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function CmSetCallbackObjectContext Lib \"ntoskrnl.exe\" (ByVal Object As LongPtr, Cookie As LARGE_INTEGER, byval NewContext as LongPtr, Optional OldContext As LongPtr) As NTSTATUS","lib":"ntoskrnl.exe","entry":"CmSetCallbackObjectContext","params":["ByVal Object As LongPtr","Cookie As LARGE_INTEGER","byval NewContext as LongPtr","Optional OldContext As LongPtr"],"returnType":"NTSTATUS"}, + {"name":"CmSetCallbackObjectContext","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function CmSetCallbackObjectContext Lib \"ntoskrnl.exe\" (ByVal Object As LongPtr, Cookie As LARGE_INTEGER, ByVal NewContext As LongPtr, Optional OldContext As LongPtr) As NTSTATUS","lib":"ntoskrnl.exe","entry":"CmSetCallbackObjectContext","params":["ByVal Object As LongPtr","Cookie As LARGE_INTEGER","ByVal NewContext As LongPtr","Optional OldContext As LongPtr"],"returnType":"NTSTATUS"}, {"name":"CmUnRegisterCallback","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function CmUnRegisterCallback Lib \"ntoskrnl.exe\" (ByVal Cookie As LongLong) As NTSTATUS","lib":"ntoskrnl.exe","entry":"CmUnRegisterCallback","params":["ByVal Cookie As LongLong"],"returnType":"NTSTATUS","description":"Pass Cookie.QuadPart"}, {"name":"CompareMemory","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function CompareMemory Lib \"ntoskrnl.exe\" Alias \"RtlCompareMemory\" (Source1 As Any, Source2 As Any, ByVal Length As LongPtr) As LongPtr","lib":"ntoskrnl.exe","entry":"RtlCompareMemory","params":["Source1 As Any","Source2 As Any","ByVal Length As LongPtr"],"returnType":"LongPtr"}, {"name":"CopyMemory","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub CopyMemory Lib \"ntoskrnl.exe\" Alias \"RtlMoveMemory\" (Destination As Any, Source As Any, ByVal Length As LongPtr)","lib":"ntoskrnl.exe","entry":"RtlMoveMemory","params":["Destination As Any","Source As Any","ByVal Length As LongPtr"]}, @@ -8278,9 +8287,9 @@ {"name":"DbgPrint2","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function DbgPrint2 CDecl Lib \"ntoskrnl.exe\" Alias \"DbgPrint\" (ByVal Format As LongPtr, Arg1 As Any, Arg2 As Any) As Long","lib":"ntoskrnl.exe","entry":"DbgPrint","cdecl":true,"params":["ByVal Format As LongPtr","Arg1 As Any","Arg2 As Any"],"returnType":"Long"}, {"name":"DbgPrint3","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function DbgPrint3 CDecl Lib \"ntoskrnl.exe\" Alias \"DbgPrint\" (ByVal Format As LongPtr, Arg1 As Any, Arg2 As Any, Arg3 As Any) As Long","lib":"ntoskrnl.exe","entry":"DbgPrint","cdecl":true,"params":["ByVal Format As LongPtr","Arg1 As Any","Arg2 As Any","Arg3 As Any"],"returnType":"Long"}, {"name":"DbgPrintEx","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function DbgPrintEx CDecl Lib \"ntoskrnl.exe\" (ByVal ComponentId As DPFLTR_TYPE, ByVal Level As DbgPrntLevels, ByVal Format As LongPtr ) As Long","lib":"ntoskrnl.exe","entry":"DbgPrintEx","cdecl":true,"params":["ByVal ComponentId As DPFLTR_TYPE","ByVal Level As DbgPrntLevels","ByVal Format As LongPtr"],"returnType":"Long"}, - {"name":"DbgPrintEx1","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function DbgPrintEx1 CDecl Lib \"ntoskrnl.exe\" Alias \"DbgPrintEx\" (ByVal ComponentId as Long, byval Level As Long, ByVal Format As LongPtr, Arg1 As Any) As Long","lib":"ntoskrnl.exe","entry":"DbgPrintEx","cdecl":true,"params":["ByVal ComponentId as Long","byval Level As Long","ByVal Format As LongPtr","Arg1 As Any"],"returnType":"Long"}, - {"name":"DbgPrintEx2","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function DbgPrintEx2 CDecl Lib \"ntoskrnl.exe\" Alias \"DbgPrintEx\" (ByVal ComponentId as Long, ByVal Level As Long, ByVal Format As LongPtr, Arg1 As Any, Arg2 As Any) As Long","lib":"ntoskrnl.exe","entry":"DbgPrintEx","cdecl":true,"params":["ByVal ComponentId as Long","ByVal Level As Long","ByVal Format As LongPtr","Arg1 As Any","Arg2 As Any"],"returnType":"Long"}, - {"name":"DbgPrintEx3","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function DbgPrintEx3 CDecl Lib \"ntoskrnl.exe\" Alias \"DbgPrintEx\" (ByVal ComponentId as Long, ByVal Level As Long, ByVal Format As LongPtr, Arg1 As Any, Arg2 As Any, Arg3 As Any) As Long","lib":"ntoskrnl.exe","entry":"DbgPrintEx","cdecl":true,"params":["ByVal ComponentId as Long","ByVal Level As Long","ByVal Format As LongPtr","Arg1 As Any","Arg2 As Any","Arg3 As Any"],"returnType":"Long"}, + {"name":"DbgPrintEx1","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function DbgPrintEx1 CDecl Lib \"ntoskrnl.exe\" Alias \"DbgPrintEx\" (ByVal ComponentId As Long, ByVal Level As Long, ByVal Format As LongPtr, Arg1 As Any) As Long","lib":"ntoskrnl.exe","entry":"DbgPrintEx","cdecl":true,"params":["ByVal ComponentId As Long","ByVal Level As Long","ByVal Format As LongPtr","Arg1 As Any"],"returnType":"Long"}, + {"name":"DbgPrintEx2","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function DbgPrintEx2 CDecl Lib \"ntoskrnl.exe\" Alias \"DbgPrintEx\" (ByVal ComponentId As Long, ByVal Level As Long, ByVal Format As LongPtr, Arg1 As Any, Arg2 As Any) As Long","lib":"ntoskrnl.exe","entry":"DbgPrintEx","cdecl":true,"params":["ByVal ComponentId As Long","ByVal Level As Long","ByVal Format As LongPtr","Arg1 As Any","Arg2 As Any"],"returnType":"Long"}, + {"name":"DbgPrintEx3","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function DbgPrintEx3 CDecl Lib \"ntoskrnl.exe\" Alias \"DbgPrintEx\" (ByVal ComponentId As Long, ByVal Level As Long, ByVal Format As LongPtr, Arg1 As Any, Arg2 As Any, Arg3 As Any) As Long","lib":"ntoskrnl.exe","entry":"DbgPrintEx","cdecl":true,"params":["ByVal ComponentId As Long","ByVal Level As Long","ByVal Format As LongPtr","Arg1 As Any","Arg2 As Any","Arg3 As Any"],"returnType":"Long"}, {"name":"EVENT_INCREMENT","kind":"const","vis":"public","signature":"Public Const EVENT_INCREMENT As Long = &H1"}, {"name":"EtwActivityIdControl","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function EtwActivityIdControl Lib \"ntoskrnl.exe\" (ByVal ControlCode As Long, ByRef ActivityId As UUID) As NTSTATUS","lib":"ntoskrnl.exe","entry":"EtwActivityIdControl","params":["ByVal ControlCode As Long","ByRef ActivityId As UUID"],"returnType":"NTSTATUS"}, {"name":"EtwEventEnabled","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function EtwEventEnabled Lib \"ntoskrnl.exe\" (ByVal RegHandle As LongLong, ByRef EventDescriptor As EVENT_DESCRIPTOR) As CBoolean","lib":"ntoskrnl.exe","entry":"EtwEventEnabled","params":["ByVal RegHandle As LongLong","ByRef EventDescriptor As EVENT_DESCRIPTOR"],"returnType":"CBoolean"}, @@ -8353,7 +8362,7 @@ {"name":"FSCTL_OFFLOAD_WRITE","kind":"const","vis":"public","signature":"Public Const FSCTL_OFFLOAD_WRITE = &H98268"}, {"name":"FTTYPE","kind":"const","vis":"public","signature":"Public Const FTTYPE As Long = &H66"}, {"name":"FT_BALANCED_READ_MODE","kind":"field","vis":"public","signature":"Public FT_BALANCED_READ_MODE As Long"}, - {"name":"FatalListEntryError","kind":"sub","vis":"public","signature":"public sub FatalListEntryError(byval p1 as longptr, byval p2 as longptr, byval p3 as longptr)"}, + {"name":"FatalListEntryError","kind":"sub","vis":"public","signature":"Public Sub FatalListEntryError(ByVal p1 As LongPtr, ByVal p2 As LongPtr, ByVal p3 As LongPtr)"}, {"name":"FsRtlGetFileNameInformation","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function FsRtlGetFileNameInformation Lib \"ntoskrnl.exe\" (FileObject As FILE_OBJECT, ByVal NameOptions As Long, FileName As UNICODE_STRING, FileNameInformation As FLT_FILE_NAME_INFORMATION) As NTSTATUS","lib":"ntoskrnl.exe","entry":"FsRtlGetFileNameInformation","params":["FileObject As FILE_OBJECT","ByVal NameOptions As Long","FileName As UNICODE_STRING","FileNameInformation As FLT_FILE_NAME_INFORMATION"],"returnType":"NTSTATUS"}, {"name":"FsRtlGetFileSize","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function FsRtlGetFileSize Lib \"ntoskrnl.exe\" (FileObject As FILE_OBJECT, FileSize As LARGE_INTEGER) As NTSTATUS","lib":"ntoskrnl.exe","entry":"FsRtlGetFileSize","params":["FileObject As FILE_OBJECT","FileSize As LARGE_INTEGER"],"returnType":"NTSTATUS"}, {"name":"FsRtlIsNameInExpression","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function FsRtlIsNameInExpression Lib \"ntoskrnl.exe\" (Expression As UNICODE_STRING, pName As UNICODE_STRING, ByVal IgnoreCase As CBoolean, ByVal UpcaseTable As LongPtr) As CBoolean","lib":"ntoskrnl.exe","entry":"FsRtlIsNameInExpression","params":["Expression As UNICODE_STRING","pName As UNICODE_STRING","ByVal IgnoreCase As CBoolean","ByVal UpcaseTable As LongPtr"],"returnType":"CBoolean"}, @@ -8500,17 +8509,17 @@ {"name":"IoThreadToProcess","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function IoThreadToProcess Lib \"ntoskrnl.exe\" (ByVal Thread As LongPtr) As LongPtr","lib":"ntoskrnl.exe","entry":"IoThreadToProcess","params":["ByVal Thread As LongPtr"],"returnType":"LongPtr"}, {"name":"IofCallDriver","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function IofCallDriver FastCall Lib \"ntoskrnl.exe\" (DeviceObject As DEVICE_OBJECT, pIrp As IRP) As Long","lib":"ntoskrnl.exe","entry":"IofCallDriver","fastcall":true,"params":["DeviceObject As DEVICE_OBJECT","pIrp As IRP"],"returnType":"Long"}, {"name":"IsListEmpty","kind":"function","vis":"public","signature":"Public Function IsListEmpty(ListHead As LIST_ENTRY) As Byte","returnType":"Byte"}, - {"name":"KI_USER_SHARED_DATA","kind":"const","vis":"public","signatures":[{"cond":"Win64","signature":"Public const KI_USER_SHARED_DATA as LongPtr = &HFFFFF78000000000^"},{"cond":"Not (Win64)","signature":"Public const KI_USER_SHARED_DATA as longptr = &Hffdf0000&"}]}, - {"name":"KeAcquireSpinLock","kind":"function","vis":"public","cond":"Win64","signature":"public function KeAcquireSpinLock(SpinLock as longptr) as kirql","returnType":"kirql"}, - {"name":"KeAcquireSpinLock","kind":"function","vis":"public","cond":"Not (Win64)","declare":true,"signature":"Public Declare PtrSafe Function KeAcquireSpinLock Lib \"hal.dll\" Alias \"KfAcquireSpinLock\" (SpinLock As LongPtr) As KIRQL","lib":"hal.dll","entry":"KfAcquireSpinLock","params":["SpinLock As LongPtr"],"returnType":"KIRQL"}, + {"name":"KI_USER_SHARED_DATA","kind":"const","vis":"public","signatures":[{"cond":"Win64","signature":"Public const KI_USER_SHARED_DATA As LongPtr = &HFFFFF78000000000^"},{"cond":"Not (Win64)","signature":"Public const KI_USER_SHARED_DATA As LongPtr = &Hffdf0000&"}]}, + {"name":"KeAcquireSpinLock","kind":"function","vis":"public","cond":"Win64","signature":"public function KeAcquireSpinLock(SpinLock As LongPtr) as kirql","returnType":"kirql"}, + {"name":"KeAcquireSpinLock","kind":"function","vis":"public","cond":"Not (Win64)","declare":true,"signature":"Public Declare PtrSafe Function KeAcquireSpinLock FastCall Lib \"hal.dll\" Alias \"KfAcquireSpinLock\" (SpinLock As LongPtr) As KIRQL","lib":"hal.dll","entry":"KfAcquireSpinLock","fastcall":true,"params":["SpinLock As LongPtr"],"returnType":"KIRQL"}, {"name":"KeAcquireSpinLockRaiseToDpc","kind":"function","vis":"public","cond":"Win64","declare":true,"signature":"Public Declare PtrSafe Function KeAcquireSpinLockRaiseToDpc Lib \"ntoskrnl.exe\" (SpinLock As LongPtr) As KIRQL","lib":"ntoskrnl.exe","entry":"KeAcquireSpinLockRaiseToDpc","params":["SpinLock As LongPtr"],"returnType":"KIRQL"}, - {"name":"KeAttachProcess","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub KeAttachProcess Lib \"ntoskrnl.exe\" (byval Process As LongPtr)","lib":"ntoskrnl.exe","entry":"KeAttachProcess","params":["byval Process As LongPtr"]}, + {"name":"KeAttachProcess","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub KeAttachProcess Lib \"ntoskrnl.exe\" (ByVal Process As LongPtr)","lib":"ntoskrnl.exe","entry":"KeAttachProcess","params":["ByVal Process As LongPtr"]}, {"name":"KeDelayExecutionThread","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function KeDelayExecutionThread Lib \"ntoskrnl.exe\" ([TypeHint(eKPROCESSOR_MODE)] ByVal WaitMode As KPROCESSOR_MODE, ByVal Alertable As CBoolean, Interval As LARGE_INTEGER) As NTSTATUS","lib":"ntoskrnl.exe","entry":"KeDelayExecutionThread","params":["ByVal WaitMode As KPROCESSOR_MODE","ByVal Alertable As CBoolean","Interval As LARGE_INTEGER"],"returnType":"NTSTATUS"}, {"name":"KeDetachProcess","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub KeDetachProcess Lib \"ntoskrnl.exe\" ()","lib":"ntoskrnl.exe","entry":"KeDetachProcess","params":[]}, {"name":"KeGetCurrentIrql","kind":"function","vis":"public","declare":true,"entry":"KeGetCurrentIrql","params":[],"returnType":"KIRQL","signatures":[{"cond":"Win64","signature":"Public Declare PtrSafe Function KeGetCurrentIrql Lib \"ntoskrnl.exe\" () As KIRQL","lib":"ntoskrnl.exe"},{"cond":"Not (Win64)","signature":"Public Declare PtrSafe Function KeGetCurrentIrql Lib \"hal.dll\" () As KIRQL","lib":"hal.dll"}]}, {"name":"KeInitializeEvent","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub KeInitializeEvent Lib \"ntoskrnl.exe\" (Event As KEVENT, ByVal Type As EVENT_TYPE, ByVal State As Byte)","lib":"ntoskrnl.exe","entry":"KeInitializeEvent","params":["Event As KEVENT","ByVal Type As EVENT_TYPE","ByVal State As Byte"]}, {"name":"KeInitializeSpinLock","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function KeInitializeSpinLock Lib \"ntoskrnl.exe\" (SpinLock As LongPtr) As Long","lib":"ntoskrnl.exe","entry":"KeInitializeSpinLock","params":["SpinLock As LongPtr"],"returnType":"Long"}, - {"name":"KeLowerIrql","kind":"sub","vis":"public","declare":true,"lib":"ntoskrnl.exe","fastcall":true,"params":["ByVal NewIrql As KIRQL"],"signatures":[{"cond":"Win64","signature":"Public Declare PtrSafe Sub KeLowerIrql FastCall Lib \"ntoskrnl.exe\" ([TypeHint(eKIRQL)] ByVal NewIrql As KIRQL)","entry":"KeLowerIrql"},{"cond":"Not (Win64)","signature":"Public Declare PtrSafe Sub KeLowerIrql FastCall Lib \"ntoskrnl.exe\" Alias \"KfLowerIrql\" ([TypeHint(eKIRQL)] ByVal NewIrql As KIRQL)","entry":"KfLowerIrql"}]}, + {"name":"KeLowerIrql","kind":"sub","vis":"public","declare":true,"fastcall":true,"params":["ByVal NewIrql As KIRQL"],"signatures":[{"cond":"Win64","signature":"Public Declare PtrSafe Sub KeLowerIrql FastCall Lib \"ntoskrnl.exe\" ([TypeHint(eKIRQL)] ByVal NewIrql As KIRQL)","lib":"ntoskrnl.exe","entry":"KeLowerIrql"},{"cond":"Not (Win64)","signature":"Public Declare PtrSafe Sub KeLowerIrql FastCall Lib \"hal.dll\" Alias \"KfLowerIrql\" ([TypeHint(eKIRQL)] ByVal NewIrql As KIRQL)","lib":"hal.dll","entry":"KfLowerIrql"}]}, {"name":"KeQuerySystemTime","kind":"sub","vis":"public","cond":"Win64","signature":"Public Sub KeQuerySystemTime(CurrentTime As LARGE_INTEGER)"}, {"name":"KeQuerySystemTime","kind":"sub","vis":"public","cond":"Not (Win64)","declare":true,"signature":"Public Declare PtrSafe Sub KeQuerySystemTime Lib \"ntoskrnl.exe\" (CurrentTime As LARGE_INTEGER)","lib":"ntoskrnl.exe","entry":"KeQuerySystemTime","params":["CurrentTime As LARGE_INTEGER"]}, {"name":"KeQuerySystemTimePrecise","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub KeQuerySystemTimePrecise Lib \"ntoskrnl.exe\" (CurrentTime As LARGE_INTEGER)","lib":"ntoskrnl.exe","entry":"KeQuerySystemTimePrecise","params":["CurrentTime As LARGE_INTEGER"]}, @@ -8572,7 +8581,7 @@ {"name":"MINSHORT","kind":"const","vis":"public","signature":"Public Const MINSHORT = &H8000"}, {"name":"MOUNTDEVCONTROLTYPE","kind":"const","vis":"public","signature":"Public Const MOUNTDEVCONTROLTYPE = &H0000004D"}, {"name":"MOUNTMGRCONTROLTYPE","kind":"const","vis":"public","signature":"Public Const MOUNTMGRCONTROLTYPE = &H0000006D"}, - {"name":"MmCopyMemory","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function MmCopyMemory Lib \"ntoskrnl.exe\" (TargetAddress As Any, ByVal SourceAddress As LongLong, ByVal NumberOfBytes As Long, ByVal Flags As MM_COPY_FLAGS, NumberOfBytesTransferred As LongPtr) As Long","lib":"ntoskrnl.exe","entry":"MmCopyMemory","params":["TargetAddress As Any","ByVal SourceAddress As LongLong","ByVal NumberOfBytes As Long","ByVal Flags As MM_COPY_FLAGS","NumberOfBytesTransferred As LongPtr"],"returnType":"Long"}, + {"name":"MmCopyMemory","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function MmCopyMemory Lib \"ntoskrnl.exe\" (TargetAddress As Any, ByVal SourceAddress As LongLong, ByVal NumberOfBytes As LongPtr, ByVal Flags As MM_COPY_FLAGS, NumberOfBytesTransferred As LongPtr) As NTSTATUS","lib":"ntoskrnl.exe","entry":"MmCopyMemory","params":["TargetAddress As Any","ByVal SourceAddress As LongLong","ByVal NumberOfBytes As LongPtr","ByVal Flags As MM_COPY_FLAGS","NumberOfBytesTransferred As LongPtr"],"returnType":"NTSTATUS"}, {"name":"MmGetSystemAddressForMdlSafe","kind":"function","vis":"public","signature":"Public Function MmGetSystemAddressForMdlSafe(ByVal Mdl As LongPtr, [TypeHint(MM_PAGE_PRIORITY, MdlMappingFlags)] ByVal Priority As Long) As LongPtr","returnType":"LongPtr","attrs":[{"name":"IgnoreWarnings","args":"TB0018"}]}, {"name":"MmGetSystemRoutineAddress","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function MmGetSystemRoutineAddress Lib \"ntoskrnl.exe\" (SystemRoutineName As UNICODE_STRING) As LongPtr","lib":"ntoskrnl.exe","entry":"MmGetSystemRoutineAddress","params":["SystemRoutineName As UNICODE_STRING"],"returnType":"LongPtr"}, {"name":"MmIsAddressValid","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function MmIsAddressValid Lib \"ntoskrnl.exe\" (ByVal VirtualAddress As LongPtr) As Byte","lib":"ntoskrnl.exe","entry":"MmIsAddressValid","params":["ByVal VirtualAddress As LongPtr"],"returnType":"Byte"}, @@ -8688,9 +8697,9 @@ {"name":"RtlAreBitsSet","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlAreBitsSet Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal StartingIndex As Long, ByVal Length As Long) As Byte","lib":"ntoskrnl.exe","entry":"RtlAreBitsSet","params":["BitmapHeader As RTL_BITMAP","ByVal StartingIndex As Long","ByVal Length As Long"],"returnType":"Byte","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlCheckBit","kind":"function","vis":"public","signature":"Public Function RtlCheckBit(BitmapHeader As RTL_BITMAP, ByVal BitPosition As Long) As Byte","returnType":"Byte"}, {"name":"RtlClearAllBits","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlClearAllBits Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP)","lib":"ntoskrnl.exe","entry":"RtlClearAllBits","params":["BitmapHeader As RTL_BITMAP"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, - {"name":"RtlClearAllBitsEx","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlClearAllBitsEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX)","lib":"ntoskrnl.exe","entry":"RtlClearAllBitsEx","params":["BitmapHeader As RTL_BITMAP_EX"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, + {"name":"RtlClearAllBitsEx","kind":"sub","vis":"public","cond":"Win64","declare":true,"signature":"Public Declare PtrSafe Sub RtlClearAllBitsEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX)","lib":"ntoskrnl.exe","entry":"RtlClearAllBitsEx","params":["BitmapHeader As RTL_BITMAP_EX"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlClearBit","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlClearBit Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal BitNumber As Long)","lib":"ntoskrnl.exe","entry":"RtlClearBit","params":["BitmapHeader As RTL_BITMAP","ByVal BitNumber As Long"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, - {"name":"RtlClearBitEx","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlClearBitEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, ByVal BitNumber As LongLong)","lib":"ntoskrnl.exe","entry":"RtlClearBitEx","params":["BitmapHeader As RTL_BITMAP_EX","ByVal BitNumber As LongLong"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, + {"name":"RtlClearBitEx","kind":"sub","vis":"public","cond":"Win64","declare":true,"signature":"Public Declare PtrSafe Sub RtlClearBitEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, ByVal BitNumber As LongLong)","lib":"ntoskrnl.exe","entry":"RtlClearBitEx","params":["BitmapHeader As RTL_BITMAP_EX","ByVal BitNumber As LongLong"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlClearBits","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlClearBits Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal StartingIndex As Long, ByVal NumberToClear As Long)","lib":"ntoskrnl.exe","entry":"RtlClearBits","params":["BitmapHeader As RTL_BITMAP","ByVal StartingIndex As Long","ByVal NumberToClear As Long"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlCompareUnicodeString","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlCompareUnicodeString Lib \"ntoskrnl.exe\" (String1 As UNICODE_STRING, String2 As UNICODE_STRING, ByVal CaseInSensitive As Byte) As Long","lib":"ntoskrnl.exe","entry":"RtlCompareUnicodeString","params":["String1 As UNICODE_STRING","String2 As UNICODE_STRING","ByVal CaseInSensitive As Byte"],"returnType":"Long","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlCompareUnicodeStrings","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlCompareUnicodeStrings Lib \"ntoskrnl.exe\" (ByVal String1 As LongPtr, ByVal String1Length As LongPtr, ByVal String2 As LongPtr, ByVal String2Length As LongPtr, ByVal CaseInSensitive As CBoolean) As Long","lib":"ntoskrnl.exe","entry":"RtlCompareUnicodeStrings","params":["ByVal String1 As LongPtr","ByVal String1Length As LongPtr","ByVal String2 As LongPtr","ByVal String2Length As LongPtr","ByVal CaseInSensitive As CBoolean"],"returnType":"Long","attrs":[{"name":"UseGetLastError","args":"False"}]}, @@ -8703,7 +8712,7 @@ {"name":"RtlDuplicateUnicodeString","kind":"function","vis":"public","declare":true,"signature":"Public DeclareWide PtrSafe Function RtlDuplicateUnicodeString Lib \"ntoskrnl.exe\" (ByVal Flags As RtlDupUnicodeStrFlags, StringIn As UNICODE_STRING, StringOut As UNICODE_STRING) As NTSTATUS","lib":"ntoskrnl.exe","entry":"RtlDuplicateUnicodeString","wide":true,"params":["ByVal Flags As RtlDupUnicodeStrFlags","StringIn As UNICODE_STRING","StringOut As UNICODE_STRING"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlEqualUnicodeString","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlEqualUnicodeString Lib \"ntoskrnl.exe\" (String1 As UNICODE_STRING, String2 As UNICODE_STRING, ByVal CaseInSensitive As Byte) As Byte","lib":"ntoskrnl.exe","entry":"RtlEqualUnicodeString","params":["String1 As UNICODE_STRING","String2 As UNICODE_STRING","ByVal CaseInSensitive As Byte"],"returnType":"Byte"}, {"name":"RtlExtractBitMap","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlExtractBitMap Lib \"ntoskrnl.exe\" (Source As RTL_BITMAP, Destination As RTL_BITMAP, ByVal TargetBit As Long, ByVal NumberOfBits As Long)","lib":"ntoskrnl.exe","entry":"RtlExtractBitMap","params":["Source As RTL_BITMAP","Destination As RTL_BITMAP","ByVal TargetBit As Long","ByVal NumberOfBits As Long"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, - {"name":"RtlFailFast","kind":"sub","vis":"public","signature":"public sub RtlFailFast cdecl naked(byval code as Long)"}, + {"name":"RtlFailFast","kind":"sub","vis":"public","signature":"Public Sub RtlFailFast CDecl Naked(ByVal code As Long)"}, {"name":"RtlFindClearBits","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlFindClearBits Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal NumberToFind As Long, ByVal HintIndex As Long) As Long","lib":"ntoskrnl.exe","entry":"RtlFindClearBits","params":["BitmapHeader As RTL_BITMAP","ByVal NumberToFind As Long","ByVal HintIndex As Long"],"returnType":"Long","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlFindClearBitsAndSet","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlFindClearBitsAndSet Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal NumberToFind As Long, ByVal HintIndex As Long) As Long","lib":"ntoskrnl.exe","entry":"RtlFindClearBitsAndSet","params":["BitmapHeader As RTL_BITMAP","ByVal NumberToFind As Long","ByVal HintIndex As Long"],"returnType":"Long","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlFindClearRuns","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlFindClearRuns Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, RunArray As RTL_BITMAP_RUN, ByVal SizeOfRunArray As Long, ByVal LocateLongestRuns As Byte) As Long","lib":"ntoskrnl.exe","entry":"RtlFindClearRuns","params":["BitmapHeader As RTL_BITMAP","RunArray As RTL_BITMAP_RUN","ByVal SizeOfRunArray As Long","ByVal LocateLongestRuns As Byte"],"returnType":"Long","attrs":[{"name":"UseGetLastError","args":"False"}]}, @@ -8716,10 +8725,9 @@ {"name":"RtlFindNextForwardRunClear","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlFindNextForwardRunClear Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal FromIndex As Long, StartingRunIndex As Long) As Long","lib":"ntoskrnl.exe","entry":"RtlFindNextForwardRunClear","params":["BitmapHeader As RTL_BITMAP","ByVal FromIndex As Long","StartingRunIndex As Long"],"returnType":"Long","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlFindSetBits","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlFindSetBits Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal NumberToFind As Long, ByVal HintIndex As Long) As Long","lib":"ntoskrnl.exe","entry":"RtlFindSetBits","params":["BitmapHeader As RTL_BITMAP","ByVal NumberToFind As Long","ByVal HintIndex As Long"],"returnType":"Long","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlFindSetBitsAndClear","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlFindSetBitsAndClear Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal NumberToFind As Long, ByVal HintIndex As Long) As Long","lib":"ntoskrnl.exe","entry":"RtlFindSetBitsAndClear","params":["BitmapHeader As RTL_BITMAP","ByVal NumberToFind As Long","ByVal HintIndex As Long"],"returnType":"Long","attrs":[{"name":"UseGetLastError","args":"False"}]}, - {"name":"RtlFindSetBitsAndClearEx","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlFindSetBitsAndClearEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, ByVal NumberToFind As LongLong, ByVal HintIndex As LongLong) As LongLong","lib":"ntoskrnl.exe","entry":"RtlFindSetBitsAndClearEx","params":["BitmapHeader As RTL_BITMAP_EX","ByVal NumberToFind As LongLong","ByVal HintIndex As LongLong"],"returnType":"LongLong","attrs":[{"name":"UseGetLastError","args":"False"}]}, - {"name":"RtlFindSetBitsEx","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlFindSetBitsEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, ByVal NumberToFind As LongLong, ByVal HintIndex As LongLong) As LongLong","lib":"ntoskrnl.exe","entry":"RtlFindSetBitsEx","params":["BitmapHeader As RTL_BITMAP_EX","ByVal NumberToFind As LongLong","ByVal HintIndex As LongLong"],"returnType":"LongLong","attrs":[{"name":"UseGetLastError","args":"False"}]}, + {"name":"RtlFindSetBitsAndClearEx","kind":"function","vis":"public","cond":"Win64","declare":true,"signature":"Public Declare PtrSafe Function RtlFindSetBitsAndClearEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, ByVal NumberToFind As LongLong, ByVal HintIndex As LongLong) As LongLong","lib":"ntoskrnl.exe","entry":"RtlFindSetBitsAndClearEx","params":["BitmapHeader As RTL_BITMAP_EX","ByVal NumberToFind As LongLong","ByVal HintIndex As LongLong"],"returnType":"LongLong","attrs":[{"name":"UseGetLastError","args":"False"}]}, + {"name":"RtlFindSetBitsEx","kind":"function","vis":"public","cond":"Win64","declare":true,"signature":"Public Declare PtrSafe Function RtlFindSetBitsEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, ByVal NumberToFind As LongLong, ByVal HintIndex As LongLong) As LongLong","lib":"ntoskrnl.exe","entry":"RtlFindSetBitsEx","params":["BitmapHeader As RTL_BITMAP_EX","ByVal NumberToFind As LongLong","ByVal HintIndex As LongLong"],"returnType":"LongLong","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlFreeHeap","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlFreeHeap Lib \"ntoskrnl.exe\" (ByVal HeapHandle As LongPtr, ByVal Flags As HeapFlags, ByVal BaseAddress As LongPtr) As Long","lib":"ntoskrnl.exe","entry":"RtlFreeHeap","params":["ByVal HeapHandle As LongPtr","ByVal Flags As HeapFlags","ByVal BaseAddress As LongPtr"],"returnType":"Long","attrs":[{"name":"UseGetLastError","args":"False"}]}, - {"name":"RtlFreeSid","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlFreeSid Lib \"ntoskrnl.exe\" (ByVal psid As LongPtr) As LongPtr","lib":"ntoskrnl.exe","entry":"RtlFreeSid","params":["ByVal psid As LongPtr"],"returnType":"LongPtr","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlFreeUnicodeString","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlFreeUnicodeString Lib \"ntoskrnl.exe\" (UnicodeString As UNICODE_STRING)","lib":"ntoskrnl.exe","entry":"RtlFreeUnicodeString","params":["UnicodeString As UNICODE_STRING"]}, {"name":"RtlGUIDFromString","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlGUIDFromString Lib \"ntoskrnl.exe\" (GuidString As UNICODE_STRING, Guid As UUID) As NTSTATUS","lib":"ntoskrnl.exe","entry":"RtlGUIDFromString","params":["GuidString As UNICODE_STRING","Guid As UUID"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlGetControlSecurityDescriptor","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlGetControlSecurityDescriptor Lib \"ntoskrnl.exe\" (SecurityDescriptor As SECURITY_DESCRIPTOR, [TypeHint(SECURITY_DESCRIPTOR_CONTROL)] Control As Integer, Revision As Long) As NTSTATUS","lib":"ntoskrnl.exe","entry":"RtlGetControlSecurityDescriptor","params":["SecurityDescriptor As SECURITY_DESCRIPTOR","Control As Integer","Revision As Long"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}]}, @@ -8730,7 +8738,7 @@ {"name":"RtlImageNtHeader","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlImageNtHeader Lib \"ntoskrnl.exe\" (ByVal ModuleBase As LongPtr) As LongPtr","lib":"ntoskrnl.exe","entry":"RtlImageNtHeader","params":["ByVal ModuleBase As LongPtr"],"returnType":"LongPtr","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlInitUnicodeString","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlInitUnicodeString Lib \"ntoskrnl.exe\" (DestinationString As UNICODE_STRING, ByVal SourceString As LongPtr)","lib":"ntoskrnl.exe","entry":"RtlInitUnicodeString","params":["DestinationString As UNICODE_STRING","ByVal SourceString As LongPtr"]}, {"name":"RtlInitializeBitMap","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlInitializeBitMap Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, BitmapBuffer As Any, ByVal SizeOfBitmap As Long)","lib":"ntoskrnl.exe","entry":"RtlInitializeBitMap","params":["BitmapHeader As RTL_BITMAP","BitmapBuffer As Any","ByVal SizeOfBitmap As Long"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, - {"name":"RtlInitializeBitMapEx","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlInitializeBitMapEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, BitMapBuffer As Any, ByVal SizeOfBitMap As LongLong)","lib":"ntoskrnl.exe","entry":"RtlInitializeBitMapEx","params":["BitmapHeader As RTL_BITMAP_EX","BitMapBuffer As Any","ByVal SizeOfBitMap As LongLong"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, + {"name":"RtlInitializeBitMapEx","kind":"sub","vis":"public","cond":"Win64","declare":true,"signature":"Public Declare PtrSafe Sub RtlInitializeBitMapEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, BitMapBuffer As Any, ByVal SizeOfBitMap As LongLong)","lib":"ntoskrnl.exe","entry":"RtlInitializeBitMapEx","params":["BitmapHeader As RTL_BITMAP_EX","BitMapBuffer As Any","ByVal SizeOfBitMap As LongLong"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlInitializeSid","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlInitializeSid Lib \"ntoskrnl.exe\" (ByVal Sid As LongPtr, IdentifierAuthority As SID_IDENTIFIER_AUTHORITY, ByVal SubAuthorityCount As Byte) As NTSTATUS","lib":"ntoskrnl.exe","entry":"RtlInitializeSid","params":["ByVal Sid As LongPtr","IdentifierAuthority As SID_IDENTIFIER_AUTHORITY","ByVal SubAuthorityCount As Byte"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlInitializeSidEx","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlInitializeSidEx CDecl Lib \"ntoskrnl.exe\" (ByVal Sid As LongPtr, IdentifierAuthority As SID_IDENTIFIER_AUTHORITY, ByVal SubAuthorityCount As Byte, ByVal ParamArray vargs As Any()) As NTSTATUS","lib":"ntoskrnl.exe","entry":"RtlInitializeSidEx","cdecl":true,"params":["ByVal Sid As LongPtr","IdentifierAuthority As SID_IDENTIFIER_AUTHORITY","ByVal SubAuthorityCount As Byte","ByVal ParamArray vargs As Any()"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlInterlockedClearBitRun","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlInterlockedClearBitRun Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal StartingIndex As Long, ByVal NumberToClear As Long)","lib":"ntoskrnl.exe","entry":"RtlInterlockedClearBitRun","params":["BitmapHeader As RTL_BITMAP","ByVal StartingIndex As Long","ByVal NumberToClear As Long"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, @@ -8748,7 +8756,7 @@ {"name":"RtlQueryRegistryValues","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlQueryRegistryValues Lib \"ntoskrnl.exe\" (ByVal RelativeTo As Long, ByVal Path As LongPtr, QueryTable As RTL_QUERY_REGISTRY_TABLE, ByVal Context As LongPtr, ByVal Environment As LongPtr) As Long","lib":"ntoskrnl.exe","entry":"RtlQueryRegistryValues","params":["ByVal RelativeTo As Long","ByVal Path As LongPtr","QueryTable As RTL_QUERY_REGISTRY_TABLE","ByVal Context As LongPtr","ByVal Environment As LongPtr"],"returnType":"Long"}, {"name":"RtlSetAllBits","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlSetAllBits Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP)","lib":"ntoskrnl.exe","entry":"RtlSetAllBits","params":["BitmapHeader As RTL_BITMAP"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlSetBit","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlSetBit Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal BitNumber As Long)","lib":"ntoskrnl.exe","entry":"RtlSetBit","params":["BitmapHeader As RTL_BITMAP","ByVal BitNumber As Long"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, - {"name":"RtlSetBitEx","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlSetBitEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, ByVal BitNumber As LongLong)","lib":"ntoskrnl.exe","entry":"RtlSetBitEx","params":["BitmapHeader As RTL_BITMAP_EX","ByVal BitNumber As LongLong"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, + {"name":"RtlSetBitEx","kind":"sub","vis":"public","cond":"Win64","declare":true,"signature":"Public Declare PtrSafe Sub RtlSetBitEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, ByVal BitNumber As LongLong)","lib":"ntoskrnl.exe","entry":"RtlSetBitEx","params":["BitmapHeader As RTL_BITMAP_EX","ByVal BitNumber As LongLong"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlSetBits","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub RtlSetBits Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal StartingIndex As Long, ByVal NumberToSet As Long)","lib":"ntoskrnl.exe","entry":"RtlSetBits","params":["BitmapHeader As RTL_BITMAP","ByVal StartingIndex As Long","ByVal NumberToSet As Long"],"attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlSetControlSecurityDescriptor","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlSetControlSecurityDescriptor Lib \"ntoskrnl.exe\" (SecurityDescriptor As SECURITY_DESCRIPTOR, [TypeHint(SECURITY_DESCRIPTOR_CONTROL)] ByVal ControlBitsOfInterest As Integer, [TypeHint(SECURITY_DESCRIPTOR_CONTROL)] ByVal ControlBitsToSet As Integer) As NTSTATUS","lib":"ntoskrnl.exe","entry":"RtlSetControlSecurityDescriptor","params":["SecurityDescriptor As SECURITY_DESCRIPTOR","ByVal ControlBitsOfInterest As Integer","ByVal ControlBitsToSet As Integer"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlSetDaclSecurityDescriptor","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlSetDaclSecurityDescriptor Lib \"ntoskrnl.exe\" (SecurityDescriptor As SECURITY_DESCRIPTOR, ByVal DaclPresent As Byte, ByVal Dacl As LongPtr, ByVal DaclDefaulted As Byte) As NTSTATUS","lib":"ntoskrnl.exe","entry":"RtlSetDaclSecurityDescriptor","params":["SecurityDescriptor As SECURITY_DESCRIPTOR","ByVal DaclPresent As Byte","ByVal Dacl As LongPtr","ByVal DaclDefaulted As Byte"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}]}, @@ -8756,7 +8764,7 @@ {"name":"RtlSidHashInitialize","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlSidHashInitialize Lib \"ntoskrnl.exe\" (SidAttr As SID_AND_ATTRIBUTES, ByVal SidCount As Long, SidAttrHash As SID_AND_ATTRIBUTES_HASH) As NTSTATUS","lib":"ntoskrnl.exe","entry":"RtlSidHashInitialize","params":["SidAttr As SID_AND_ATTRIBUTES","ByVal SidCount As Long","SidAttrHash As SID_AND_ATTRIBUTES_HASH"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlSidHashLookup","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlSidHashLookup Lib \"ntoskrnl.exe\" (SidAttrHash As SID_AND_ATTRIBUTES_HASH, ByVal Sid As LongPtr) As LongPtr","lib":"ntoskrnl.exe","entry":"RtlSidHashLookup","params":["SidAttrHash As SID_AND_ATTRIBUTES_HASH","ByVal Sid As LongPtr"],"returnType":"LongPtr","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlTestBit","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlTestBit Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP, ByVal BitNumber As Long) As Byte","lib":"ntoskrnl.exe","entry":"RtlTestBit","params":["BitmapHeader As RTL_BITMAP","ByVal BitNumber As Long"],"returnType":"Byte","attrs":[{"name":"UseGetLastError","args":"False"}]}, - {"name":"RtlTestBitEx","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlTestBitEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, ByVal BitNumber As LongLong) As Byte","lib":"ntoskrnl.exe","entry":"RtlTestBitEx","params":["BitmapHeader As RTL_BITMAP_EX","ByVal BitNumber As LongLong"],"returnType":"Byte","attrs":[{"name":"UseGetLastError","args":"False"}]}, + {"name":"RtlTestBitEx","kind":"function","vis":"public","cond":"Win64","declare":true,"signature":"Public Declare PtrSafe Function RtlTestBitEx Lib \"ntoskrnl.exe\" (BitmapHeader As RTL_BITMAP_EX, ByVal BitNumber As LongLong) As Byte","lib":"ntoskrnl.exe","entry":"RtlTestBitEx","params":["BitmapHeader As RTL_BITMAP_EX","ByVal BitNumber As LongLong"],"returnType":"Byte","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"RtlUpcaseUnicodeString","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlUpcaseUnicodeString Lib \"ntoskrnl.exe\" (DestinationString As UNICODE_STRING, SourceString As UNICODE_STRING, ByVal AllocateDestinationString As Byte) As Long","lib":"ntoskrnl.exe","entry":"RtlUpcaseUnicodeString","params":["DestinationString As UNICODE_STRING","SourceString As UNICODE_STRING","ByVal AllocateDestinationString As Byte"],"returnType":"Long"}, {"name":"RtlValidRelativeSecurityDescriptor","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlValidRelativeSecurityDescriptor Lib \"ntoskrnl.exe\" (SecurityDescriptorInput As SECURITY_DESCRIPTOR, ByVal SecurityDescriptorLength As Long, ByVal RequiredInformation As SECURITY_INFORMATION) As Byte","lib":"ntoskrnl.exe","entry":"RtlValidRelativeSecurityDescriptor","params":["SecurityDescriptorInput As SECURITY_DESCRIPTOR","ByVal SecurityDescriptorLength As Long","ByVal RequiredInformation As SECURITY_INFORMATION"],"returnType":"Byte"}, {"name":"RtlValidSecurityDescriptor","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function RtlValidSecurityDescriptor Lib \"ntoskrnl.exe\" (SecurityDescriptor As SECURITY_DESCRIPTOR) As Byte","lib":"ntoskrnl.exe","entry":"RtlValidSecurityDescriptor","params":["SecurityDescriptor As SECURITY_DESCRIPTOR"],"returnType":"Byte"}, @@ -8767,7 +8775,7 @@ {"name":"SECURITY_DESCRIPTOR_MIN_LENGTH","kind":"const","vis":"public","signatures":[{"cond":"Win64","signature":"Public Const SECURITY_DESCRIPTOR_MIN_LENGTH = 40"},{"cond":"Not (Win64)","signature":"Public Const SECURITY_DESCRIPTOR_MIN_LENGTH = &H14"}]}, {"name":"SECURITY_DESCRIPTOR_REVISION","kind":"const","vis":"public","signature":"Public Const SECURITY_DESCRIPTOR_REVISION = (1)"}, {"name":"SECURITY_DESCRIPTOR_REVISION1","kind":"const","vis":"public","signature":"Public Const SECURITY_DESCRIPTOR_REVISION1 = (1)"}, - {"name":"SECURITY_MAX_SID_SIZE","kind":"const","vis":"public","signature":"Public Const SECURITY_MAX_SID_SIZE = (60)"}, + {"name":"SECURITY_MAX_SID_SIZE","kind":"const","vis":"public","signature":"Public Const SECURITY_MAX_SID_SIZE = (68)"}, {"name":"SEMAPHORE_INCREMENT","kind":"const","vis":"public","signature":"Public Const SEMAPHORE_INCREMENT = 1"}, {"name":"SHRT_MAX","kind":"const","vis":"public","signature":"Public Const SHRT_MAX = 32767"}, {"name":"SHRT_MIN","kind":"const","vis":"public","signature":"Public Const SHRT_MIN = (-32768)"}, @@ -8782,15 +8790,15 @@ {"name":"SL_INVOKE_ON_SUCCESS","kind":"const","vis":"public","signature":"Public Const SL_INVOKE_ON_SUCCESS = &H40"}, {"name":"SL_PENDING_RETURNED","kind":"const","vis":"public","signature":"Public Const SL_PENDING_RETURNED = &H01"}, {"name":"SOURCE_FILE","kind":"field","vis":"public","signature":"Public SOURCE_FILE As String"}, - {"name":"SeAccessCheck","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeAccessCheck Lib \"ntoskrnl.exe\" (ByVal SecurityDescriptor as LongPtr, SubjectContext As SECURITY_SUBJECT_CONTEXT, byval SubjectContextLocked as Byte, ByVal DesiredAccess as Long, ByVal PreviouslyGrantedAccess as Long, Priveleges as LongPtr, GenericMapping As GENERIC_MAPPING, [typehint( KPROCESSOR_MODE)] ByVal AccessMode as Byte, GrantedAccess As Long, AccessStatus As NTSTATUS) As Byte","lib":"ntoskrnl.exe","entry":"SeAccessCheck","params":["ByVal SecurityDescriptor as LongPtr","SubjectContext As SECURITY_SUBJECT_CONTEXT","byval SubjectContextLocked as Byte","ByVal DesiredAccess as Long","ByVal PreviouslyGrantedAccess as Long","Priveleges as LongPtr","GenericMapping As GENERIC_MAPPING","ByVal AccessMode as Byte","GrantedAccess As Long","AccessStatus As NTSTATUS"],"returnType":"Byte"}, - {"name":"SeAssignSecurity","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeAssignSecurity Lib \"ntoskrnl.exe\" (ByVal ParentDescriptor as LongPtr, ByVal ExplicitDescriptor as LongPtr, NewDescriptor as LongPtr, ByVal IsDirectoryObject as Byte,SubjectContext As SECURITY_SUBJECT_CONTEXT, GenericMapping as GENERIC_MAPPING, ByVal PoolType as POOL_TYPE) as NTSTATUS","lib":"ntoskrnl.exe","entry":"SeAssignSecurity","params":["ByVal ParentDescriptor as LongPtr","ByVal ExplicitDescriptor as LongPtr","NewDescriptor as LongPtr","ByVal IsDirectoryObject as Byte","SubjectContext As SECURITY_SUBJECT_CONTEXT","GenericMapping as GENERIC_MAPPING","ByVal PoolType as POOL_TYPE"],"returnType":"NTSTATUS"}, - {"name":"SeAssignSecurityEx","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeAssignSecurityEx Lib \"ntoskrnl.exe\" (ByVal ParentDescriptor as LongPtr, ByVal ExplicitDescriptor as LongPtr, NewDescriptor as LongPtr, ObjectType as UUID, ByVal IsDirectoryObject as Byte, ByVal AutoInheritFlags as SEF_FLAGS, SubjectContext As SECURITY_SUBJECT_CONTEXT, GenericMapping As GENERIC_MAPPING, ByVal PoolType As POOL_TYPE) As NTSTATUS","lib":"ntoskrnl.exe","entry":"SeAssignSecurityEx","params":["ByVal ParentDescriptor as LongPtr","ByVal ExplicitDescriptor as LongPtr","NewDescriptor as LongPtr","ObjectType as UUID","ByVal IsDirectoryObject as Byte","ByVal AutoInheritFlags as SEF_FLAGS","SubjectContext As SECURITY_SUBJECT_CONTEXT","GenericMapping As GENERIC_MAPPING","ByVal PoolType As POOL_TYPE"],"returnType":"NTSTATUS"}, - {"name":"SeComputeAutoInheritByObjectType","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeComputeAutoInheritByObjectType Lib \"ntoskrnl.exe\" (ByVal ObjectType as LongPtr, Optional ByVal SecurityDescriptor as LongPtr = 0, Optional ByVal ParentSecurityDescriptor As LongPtr = 0) As Long","lib":"ntoskrnl.exe","entry":"SeComputeAutoInheritByObjectType","params":["ByVal ObjectType as LongPtr","Optional ByVal SecurityDescriptor as LongPtr = 0","Optional ByVal ParentSecurityDescriptor As LongPtr = 0"],"returnType":"Long"}, + {"name":"SeAccessCheck","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeAccessCheck Lib \"ntoskrnl.exe\" (ByVal SecurityDescriptor As LongPtr, SubjectContext As SECURITY_SUBJECT_CONTEXT, ByVal SubjectContextLocked As Byte, ByVal DesiredAccess As Long, ByVal PreviouslyGrantedAccess As Long, Priveleges As LongPtr, GenericMapping As GENERIC_MAPPING, [typehint( KPROCESSOR_MODE)] ByVal AccessMode As Byte, GrantedAccess As Long, AccessStatus As NTSTATUS) As Byte","lib":"ntoskrnl.exe","entry":"SeAccessCheck","params":["ByVal SecurityDescriptor As LongPtr","SubjectContext As SECURITY_SUBJECT_CONTEXT","ByVal SubjectContextLocked As Byte","ByVal DesiredAccess As Long","ByVal PreviouslyGrantedAccess As Long","Priveleges As LongPtr","GenericMapping As GENERIC_MAPPING","ByVal AccessMode As Byte","GrantedAccess As Long","AccessStatus As NTSTATUS"],"returnType":"Byte"}, + {"name":"SeAssignSecurity","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeAssignSecurity Lib \"ntoskrnl.exe\" (ByVal ParentDescriptor As LongPtr, ByVal ExplicitDescriptor As LongPtr, NewDescriptor As LongPtr, ByVal IsDirectoryObject As Byte,SubjectContext As SECURITY_SUBJECT_CONTEXT, GenericMapping as GENERIC_MAPPING, ByVal PoolType as POOL_TYPE) as NTSTATUS","lib":"ntoskrnl.exe","entry":"SeAssignSecurity","params":["ByVal ParentDescriptor As LongPtr","ByVal ExplicitDescriptor As LongPtr","NewDescriptor As LongPtr","ByVal IsDirectoryObject As Byte","SubjectContext As SECURITY_SUBJECT_CONTEXT","GenericMapping as GENERIC_MAPPING","ByVal PoolType as POOL_TYPE"],"returnType":"NTSTATUS"}, + {"name":"SeAssignSecurityEx","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeAssignSecurityEx Lib \"ntoskrnl.exe\" (ByVal ParentDescriptor As LongPtr, ByVal ExplicitDescriptor As LongPtr, NewDescriptor As LongPtr, ObjectType as UUID, ByVal IsDirectoryObject As Byte, ByVal AutoInheritFlags as SEF_FLAGS, SubjectContext As SECURITY_SUBJECT_CONTEXT, GenericMapping As GENERIC_MAPPING, ByVal PoolType As POOL_TYPE) As NTSTATUS","lib":"ntoskrnl.exe","entry":"SeAssignSecurityEx","params":["ByVal ParentDescriptor As LongPtr","ByVal ExplicitDescriptor As LongPtr","NewDescriptor As LongPtr","ObjectType as UUID","ByVal IsDirectoryObject As Byte","ByVal AutoInheritFlags as SEF_FLAGS","SubjectContext As SECURITY_SUBJECT_CONTEXT","GenericMapping As GENERIC_MAPPING","ByVal PoolType As POOL_TYPE"],"returnType":"NTSTATUS"}, + {"name":"SeComputeAutoInheritByObjectType","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeComputeAutoInheritByObjectType Lib \"ntoskrnl.exe\" (ByVal ObjectType As LongPtr, Optional ByVal SecurityDescriptor As LongPtr = 0, Optional ByVal ParentSecurityDescriptor As LongPtr = 0) As Long","lib":"ntoskrnl.exe","entry":"SeComputeAutoInheritByObjectType","params":["ByVal ObjectType As LongPtr","Optional ByVal SecurityDescriptor As LongPtr = 0","Optional ByVal ParentSecurityDescriptor As LongPtr = 0"],"returnType":"Long"}, {"name":"SeEtwWriteKMCveEvent","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeEtwWriteKMCveEvent Lib \"ntoskrnl.exe\" (ByRef CveId As UNICODE_STRING, ByRef AdditionalDetails As UNICODE_STRING) As NTSTATUS","lib":"ntoskrnl.exe","entry":"SeEtwWriteKMCveEvent","params":["ByRef CveId As UNICODE_STRING","ByRef AdditionalDetails As UNICODE_STRING"],"returnType":"NTSTATUS"}, {"name":"SeLocateProcessImageName","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeLocateProcessImageName Lib \"ntoskrnl.exe\" (ByVal Process As LongPtr, ImageFileName As LongPtr) As NTSTATUS","lib":"ntoskrnl.exe","entry":"SeLocateProcessImageName","params":["ByVal Process As LongPtr","ImageFileName As LongPtr"],"returnType":"NTSTATUS","description":"Returns the full path of a process given an EPROCESS pointer."}, {"name":"SeLockSubjectContext","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub SeLockSubjectContext Lib \"ntoskrnl.exe\" (SubjectContext As SECURITY_SUBJECT_CONTEXT)","lib":"ntoskrnl.exe","entry":"SeLockSubjectContext","params":["SubjectContext As SECURITY_SUBJECT_CONTEXT"]}, - {"name":"SeQueryInformationToken","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeQueryInformationToken Lib \"ntoskrnl.exe\" (ByVal Token as LongPtr, ByVal TokenInformationClass as TOKEN_INFORMATION_CLASS, TokenInformation as Any) as NTSTATUS","lib":"ntoskrnl.exe","entry":"SeQueryInformationToken","params":["ByVal Token as LongPtr","ByVal TokenInformationClass as TOKEN_INFORMATION_CLASS","TokenInformation as Any"],"returnType":"NTSTATUS"}, - {"name":"SeQuerySubjectContextToken","kind":"function","vis":"public","signature":"Public Function SeQuerySubjectContextToken(SubjectContext As SECURITY_SUBJECT_CONTEXT) as LongPtr","returnType":"LongPtr"}, + {"name":"SeQueryInformationToken","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function SeQueryInformationToken Lib \"ntoskrnl.exe\" (ByVal Token As LongPtr, ByVal TokenInformationClass as TOKEN_INFORMATION_CLASS, TokenInformation as Any) as NTSTATUS","lib":"ntoskrnl.exe","entry":"SeQueryInformationToken","params":["ByVal Token As LongPtr","ByVal TokenInformationClass as TOKEN_INFORMATION_CLASS","TokenInformation as Any"],"returnType":"NTSTATUS"}, + {"name":"SeQuerySubjectContextToken","kind":"function","vis":"public","signature":"Public Function SeQuerySubjectContextToken(SubjectContext As SECURITY_SUBJECT_CONTEXT) As LongPtr","returnType":"LongPtr"}, {"name":"SeTokenObjectType","kind":"function","vis":"public","signature":"Public Function SeTokenObjectType() As LongPtr","returnType":"LongPtr"}, {"name":"SeUnlockSubjectContext","kind":"sub","vis":"public","declare":true,"signature":"Public Declare PtrSafe Sub SeUnlockSubjectContext Lib \"ntoskrnl.exe\" (SubjectContext As SECURITY_SUBJECT_CONTEXT)","lib":"ntoskrnl.exe","entry":"SeUnlockSubjectContext","params":["SubjectContext As SECURITY_SUBJECT_CONTEXT"]}, {"name":"SharedInterruptTime","kind":"const","vis":"public","signature":"Public Const SharedInterruptTime = (KI_USER_SHARED_DATA + &H8)"}, @@ -8838,7 +8846,7 @@ {"name":"ZwLoadKeyEx","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function ZwLoadKeyEx Lib \"ntoskrnl.exe\" (TargetKey As OBJECT_ATTRIBUTES, SourceFile As OBJECT_ATTRIBUTES, ByVal Flags As NtLoadKeyExFlags, ByVal TrustClassKey As LongPtr, ByVal Event As LongPtr, [TypeHint(REGSAM, StandardAccessTypes, GenericRights)] ByVal DesiredAccess As Long, RootHandle As LongPtr, ByVal Reserved As LongPtr) As NTSTATUS","lib":"ntoskrnl.exe","entry":"ZwLoadKeyEx","params":["TargetKey As OBJECT_ATTRIBUTES","SourceFile As OBJECT_ATTRIBUTES","ByVal Flags As NtLoadKeyExFlags","ByVal TrustClassKey As LongPtr","ByVal Event As LongPtr","ByVal DesiredAccess As Long","RootHandle As LongPtr","ByVal Reserved As LongPtr"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}],"description":"NOTE: This function existed prior to Vista but only had 4 arguments."}, {"name":"ZwLockFile","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function ZwLockFile Lib \"ntoskrnl.exe\" (ByVal FileHandle As LongPtr, ByVal hEvent As LongPtr, ByVal ApcRoutine As LongPtr, ByVal ApcContext As LongPtr, ByRef IoStatusBlock As IO_STATUS_BLOCK, ByteOffset As LARGE_INTEGER, Length As LARGE_INTEGER, ByVal Key As Long, ByVal FailImmediately As Byte, ByVal ExclusiveLock As Byte) As NTSTATUS","lib":"ntoskrnl.exe","entry":"ZwLockFile","params":["ByVal FileHandle As LongPtr","ByVal hEvent As LongPtr","ByVal ApcRoutine As LongPtr","ByVal ApcContext As LongPtr","ByRef IoStatusBlock As IO_STATUS_BLOCK","ByteOffset As LARGE_INTEGER","Length As LARGE_INTEGER","ByVal Key As Long","ByVal FailImmediately As Byte","ByVal ExclusiveLock As Byte"],"returnType":"NTSTATUS"}, {"name":"ZwLockProductActivationKeys","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function ZwLockProductActivationKeys Lib \"ntoskrnl.exe\" (pPrivateVer As Long, pSafeMode As Long) As NTSTATUS","lib":"ntoskrnl.exe","entry":"ZwLockProductActivationKeys","params":["pPrivateVer As Long","pSafeMode As Long"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}]}, - {"name":"ZwMapViewOfSection","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function ZwMapViewOfSection Lib \"ntoskrnl.exe\" (ByVal SectionHandle As LongPtr, ByVal ProcessHandle As LongPtr, BaseAddress As LongPtr, ByVal ZeroBits As LongPtr, ByVal CommitSize As LongPtr, SectionOffset As LARGE_INTEGER, ViewSize As LongPtr, byval InheritDisposition As SECTION_INHERIT, ByVal AllocationType As MemAllocType, ByVal Win32Protect As MemProtectFlags) As NTSTATUS","lib":"ntoskrnl.exe","entry":"ZwMapViewOfSection","params":["ByVal SectionHandle As LongPtr","ByVal ProcessHandle As LongPtr","BaseAddress As LongPtr","ByVal ZeroBits As LongPtr","ByVal CommitSize As LongPtr","SectionOffset As LARGE_INTEGER","ViewSize As LongPtr","byval InheritDisposition As SECTION_INHERIT","ByVal AllocationType As MemAllocType","ByVal Win32Protect As MemProtectFlags"],"returnType":"NTSTATUS"}, + {"name":"ZwMapViewOfSection","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function ZwMapViewOfSection Lib \"ntoskrnl.exe\" (ByVal SectionHandle As LongPtr, ByVal ProcessHandle As LongPtr, BaseAddress As LongPtr, ByVal ZeroBits As LongPtr, ByVal CommitSize As LongPtr, SectionOffset As LARGE_INTEGER, ViewSize As LongPtr, ByVal InheritDisposition As SECTION_INHERIT, ByVal AllocationType As MemAllocType, ByVal Win32Protect As MemProtectFlags) As NTSTATUS","lib":"ntoskrnl.exe","entry":"ZwMapViewOfSection","params":["ByVal SectionHandle As LongPtr","ByVal ProcessHandle As LongPtr","BaseAddress As LongPtr","ByVal ZeroBits As LongPtr","ByVal CommitSize As LongPtr","SectionOffset As LARGE_INTEGER","ViewSize As LongPtr","ByVal InheritDisposition As SECTION_INHERIT","ByVal AllocationType As MemAllocType","ByVal Win32Protect As MemProtectFlags"],"returnType":"NTSTATUS"}, {"name":"ZwNotifyChangeKey","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function ZwNotifyChangeKey Lib \"ntoskrnl.exe\" (ByVal KeyHandle As LongPtr, ByVal Event As LongPtr, ByVal ApcRoutine As LongPtr, ByVal ApcContext As LongPtr, IoStatusBlock As IO_STATUS_BLOCK, ByVal CompletionFilter As RegNotifyChangeValues, ByVal WatchTree As Byte, Buffer As Any, ByVal BufferSize As Long, ByVal Asynchronous As Byte) As NTSTATUS","lib":"ntoskrnl.exe","entry":"ZwNotifyChangeKey","params":["ByVal KeyHandle As LongPtr","ByVal Event As LongPtr","ByVal ApcRoutine As LongPtr","ByVal ApcContext As LongPtr","IoStatusBlock As IO_STATUS_BLOCK","ByVal CompletionFilter As RegNotifyChangeValues","ByVal WatchTree As Byte","Buffer As Any","ByVal BufferSize As Long","ByVal Asynchronous As Byte"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}]}, {"name":"ZwOpenDirectoryObject","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function ZwOpenDirectoryObject Lib \"ntoskrnl.exe\" (DirectoryHandle As LongPtr, [TypeHint(GenericRights, DirectoryAccessRights)] ByVal DesiredAccess As Long, ObjectAttributes As OBJECT_ATTRIBUTES) As NTSTATUS","lib":"ntoskrnl.exe","entry":"ZwOpenDirectoryObject","params":["DirectoryHandle As LongPtr","ByVal DesiredAccess As Long","ObjectAttributes As OBJECT_ATTRIBUTES"],"returnType":"NTSTATUS"}, {"name":"ZwOpenKey","kind":"function","vis":"public","declare":true,"signature":"Public Declare PtrSafe Function ZwOpenKey Lib \"ntoskrnl.exe\" (KeyHandle As LongPtr, [TypeHint(REGSAM, StandardAccessTypes, GenericRights)] ByVal DesiredAccess As Long, ObjectAttributes As OBJECT_ATTRIBUTES) As NTSTATUS","lib":"ntoskrnl.exe","entry":"ZwOpenKey","params":["KeyHandle As LongPtr","ByVal DesiredAccess As Long","ObjectAttributes As OBJECT_ATTRIBUTES"],"returnType":"NTSTATUS","attrs":[{"name":"UseGetLastError","args":"False"}]}, @@ -9072,7 +9080,7 @@ {"name":"DeviceExtension","vis":"public","signature":"DeviceExtension As LongPtr"}, {"name":"DeviceType","vis":"public","signature":"DeviceType As Long"}, {"name":"StackSize","vis":"public","signature":"StackSize As Byte"}, - {"name":"__pad","vis":"public","cond":"Win64","signature":"__pad(2) As Byte"}, + {"name":"__pad","vis":"public","signature":"__pad(2) As Byte"}, {"name":"Queue","vis":"public","cond":"Win64","signature":"Queue(71) As Byte"}, {"name":"Queue","vis":"public","cond":"Not (Win64)","signature":"Queue(39) As Byte"}, {"name":"AlignRequirement","vis":"public","signature":"AlignRequirement As Long"}, @@ -10391,8 +10399,8 @@ "signature": "public type KAPC_STATE", "fields": [ {"name":"ApcListHead","vis":"public","signature":"ApcListHead(MaximumMode-1) as LIST_ENTRY"}, - {"name":"Process","vis":"public","signature":"Process as longptr"}, - {"name":"InProgressFlags","vis":"public","signature":"InProgressFlags as byte"}, + {"name":"Process","vis":"public","signature":"Process As LongPtr"}, + {"name":"InProgressFlags","vis":"public","signature":"InProgressFlags As Byte"}, {"name":"KernelApcPending","vis":"public","signature":"KernelApcPending As CBoolean"}, {"name":"UserApcPendingAll","vis":"public","signature":"UserApcPendingAll As CBoolean"} ], @@ -11078,8 +11086,7 @@ "signature": "Public Type NPAGED_LOOKASIDE_LIST", "fields": [ {"name":"L","vis":"public","signature":"L As GENERAL_LOOKASIDE"}, - {"name":"Lock__ObsoleteButDoNotDelete","vis":"public","cond":"Win64 = 0","signature":"Lock__ObsoleteButDoNotDelete As Long"}, - {"name":"align","vis":"public","cond":"Not (Win64 = 0)","signature":"align(15) As Byte"} + {"name":"Lock__ObsoleteButDoNotDelete","vis":"public","cond":"Win64 = 0","signature":"Lock__ObsoleteButDoNotDelete As Long"} ], "members": [] }, @@ -12977,8 +12984,22 @@ {"name":"Object","vis":"public","signature":"Object As LongPtr"}, {"name":"ObjectType","vis":"public","signature":"ObjectType As LongPtr"}, {"name":"CallContext","vis":"public","signature":"CallContext As LongPtr"}, - {"name":"Parameters","vis":"public","cond":"Win64","signature":"Parameters(23) As Byte","description":"Union: OB_PRE_DUPLICATE_HANDLE_INFORMATION or OB_PRE_CREATE_HANDLE_INFORMATION"}, - {"name":"Parameters","vis":"public","cond":"Not (Win64)","signature":"Parameters(15) As Byte","description":"Union: OB_PRE_DUPLICATE_HANDLE_INFORMATION or OB_PRE_CREATE_HANDLE_INFORMATION"} + {"name":"Parameters","vis":"public","signature":"Parameters As LongPtr","description":"Union: OB_PRE_DUPLICATE_HANDLE_INFORMATION or OB_PRE_CREATE_HANDLE_INFORMATION"} + ], + "members": [] + }, + { + "name": "OB_PRE_OPERATION_PARAMETERS", + "kind": "type", + "in": "modWDM", + "vis": "public", + "file": "modWDM.twin", + "signature": "Public type OB_PRE_OPERATION_PARAMETERS", + "fields": [ + {"name":"DesiredAccess","vis":"public","signature":"DesiredAccess As ProcessAccessRights"}, + {"name":"OriginalDesiredAccess","vis":"public","signature":"OriginalDesiredAccess As ProcessAccessRights"}, + {"name":"SourceProcess","vis":"public","signature":"SourceProcess As LongPtr"}, + {"name":"TargetProcess","vis":"public","signature":"TargetProcess As LongPtr"} ], "members": [] }, @@ -13052,8 +13073,8 @@ "file": "modWDM.twin", "signature": "Public Type POOL_EXTENDED_PARAMETER", "fields": [ - {"name":"Type","vis":"public","signature":"Type as Byte"}, - {"name":"Optional","vis":"public","signature":"Optional as Byte"}, + {"name":"Type","vis":"public","signature":"Type As Byte"}, + {"name":"Optional","vis":"public","signature":"Optional As Byte"}, {"name":"Reserved","vis":"public","signature":"Reserved(5) As Byte"}, {"name":"u","vis":"public","signature":"u As LongLong"} ], diff --git a/test/example-projects/contributed-tbKMode/Settings b/test/example-projects/contributed-tbKMode/Settings index 2f4398c6..33bc305c 100644 --- a/test/example-projects/contributed-tbKMode/Settings +++ b/test/example-projects/contributed-tbKMode/Settings @@ -51,11 +51,11 @@ "autoCtlExt": true, "id": "{B94B0CA7-4E84-44EA-BCF3-3F541FC64C0F}", "licence": "MIT", - "name": "[IMPORTED] twinBASIC Kernel Mode Support Package, v0.3.6", + "name": "[IMPORTED] twinBASIC Kernel Mode Support Package, v0.3.8", "path32": "/Packages/tbKMode", "path64": "/Packages/tbKMode", "symbolId": "tbKMode", - "versionBuild": "6", + "versionBuild": "8", "versionMajor": "0", "versionMinor": "3", "versionRevision": "0" diff --git a/test/package-tests/tbKMode/Sources/ImageValueTests.twin b/test/package-tests/tbKMode/Sources/ImageValueTests.twin index f72eb788..a5aaf7bc 100644 --- a/test/package-tests/tbKMode/Sources/ImageValueTests.twin +++ b/test/package-tests/tbKMode/Sources/ImageValueTests.twin @@ -4,6 +4,46 @@ Module ImageValueTests ' Each enumeration member and constant against the WDK's value for it (10.0.22621.0). ' Generated by wdk/wdkcheck.mjs modImage: do not edit, run it again. + [TestCase] + Public Sub ImageMachineType_Values() + Expect.Begin + Expect.AreEqual 0, CLng(IMAGE_FILE_MACHINE_UNKNOWN), "IMAGE_FILE_MACHINE_UNKNOWN" + Expect.AreEqual 1, CLng(IMAGE_FILE_MACHINE_TARGET_HOST), "IMAGE_FILE_MACHINE_TARGET_HOST" + Expect.AreEqual 332, CLng(IMAGE_FILE_MACHINE_I386), "IMAGE_FILE_MACHINE_I386" + Expect.AreEqual 354, CLng(IMAGE_FILE_MACHINE_R3000), "IMAGE_FILE_MACHINE_R3000" + Expect.AreEqual 358, CLng(IMAGE_FILE_MACHINE_R4000), "IMAGE_FILE_MACHINE_R4000" + Expect.AreEqual 360, CLng(IMAGE_FILE_MACHINE_R10000), "IMAGE_FILE_MACHINE_R10000" + Expect.AreEqual 361, CLng(IMAGE_FILE_MACHINE_WCEMIPSV2), "IMAGE_FILE_MACHINE_WCEMIPSV2" + Expect.AreEqual 388, CLng(IMAGE_FILE_MACHINE_ALPHA), "IMAGE_FILE_MACHINE_ALPHA" + Expect.AreEqual 418, CLng(IMAGE_FILE_MACHINE_SH3), "IMAGE_FILE_MACHINE_SH3" + Expect.AreEqual 419, CLng(IMAGE_FILE_MACHINE_SH3DSP), "IMAGE_FILE_MACHINE_SH3DSP" + Expect.AreEqual 420, CLng(IMAGE_FILE_MACHINE_SH3E), "IMAGE_FILE_MACHINE_SH3E" + Expect.AreEqual 422, CLng(IMAGE_FILE_MACHINE_SH4), "IMAGE_FILE_MACHINE_SH4" + Expect.AreEqual 424, CLng(IMAGE_FILE_MACHINE_SH5), "IMAGE_FILE_MACHINE_SH5" + Expect.AreEqual 448, CLng(IMAGE_FILE_MACHINE_ARM), "IMAGE_FILE_MACHINE_ARM" + Expect.AreEqual 450, CLng(IMAGE_FILE_MACHINE_THUMB), "IMAGE_FILE_MACHINE_THUMB" + Expect.AreEqual 452, CLng(IMAGE_FILE_MACHINE_ARMNT), "IMAGE_FILE_MACHINE_ARMNT" + Expect.AreEqual 467, CLng(IMAGE_FILE_MACHINE_AM33), "IMAGE_FILE_MACHINE_AM33" + Expect.AreEqual 496, CLng(IMAGE_FILE_MACHINE_POWERPC), "IMAGE_FILE_MACHINE_POWERPC" + Expect.AreEqual 497, CLng(IMAGE_FILE_MACHINE_POWERPCFP), "IMAGE_FILE_MACHINE_POWERPCFP" + Expect.AreEqual 512, CLng(IMAGE_FILE_MACHINE_IA64), "IMAGE_FILE_MACHINE_IA64" + Expect.AreEqual 614, CLng(IMAGE_FILE_MACHINE_MIPS16), "IMAGE_FILE_MACHINE_MIPS16" + Expect.AreEqual 644, CLng(IMAGE_FILE_MACHINE_ALPHA64), "IMAGE_FILE_MACHINE_ALPHA64" + Expect.AreEqual 870, CLng(IMAGE_FILE_MACHINE_MIPSFPU), "IMAGE_FILE_MACHINE_MIPSFPU" + Expect.AreEqual 1126, CLng(IMAGE_FILE_MACHINE_MIPSFPU16), "IMAGE_FILE_MACHINE_MIPSFPU16" + Expect.AreEqual 644, CLng(IMAGE_FILE_MACHINE_AXP64), "IMAGE_FILE_MACHINE_AXP64" + Expect.AreEqual 1312, CLng(IMAGE_FILE_MACHINE_TRICORE), "IMAGE_FILE_MACHINE_TRICORE" + Expect.AreEqual 3311, CLng(IMAGE_FILE_MACHINE_CEF), "IMAGE_FILE_MACHINE_CEF" + Expect.AreEqual 3772, CLng(IMAGE_FILE_MACHINE_EBC), "IMAGE_FILE_MACHINE_EBC" + Expect.AreEqual &HFFFF8664&, CLng(IMAGE_FILE_MACHINE_AMD64), "IMAGE_FILE_MACHINE_AMD64" + Expect.AreEqual &HFFFF9041&, CLng(IMAGE_FILE_MACHINE_M32R), "IMAGE_FILE_MACHINE_M32R" + Expect.AreEqual &HFFFFAA64&, CLng(IMAGE_FILE_MACHINE_ARM64), "IMAGE_FILE_MACHINE_ARM64" + Expect.AreEqual &HFFFFC0EE&, CLng(IMAGE_FILE_MACHINE_CEE), "IMAGE_FILE_MACHINE_CEE" + Expect.AreEqual &HFFFFA641&, CLng(IMAGE_FILE_MACHINE_ARM64EC), "IMAGE_FILE_MACHINE_ARM64EC" + Expect.AreEqual &HFFFFA64E&, CLng(IMAGE_FILE_MACHINE_ARM64X), "IMAGE_FILE_MACHINE_ARM64X" + Expect.Done + End Sub + [TestCase] Public Sub FPO_FRAME_Values() Expect.Begin @@ -609,46 +649,6 @@ Module ImageValueTests Expect.Done End Sub - [TestCase] - Public Sub ImageMachineType_Values() - Expect.Begin - Expect.AreEqual 0, CLng(IMAGE_FILE_MACHINE_UNKNOWN), "IMAGE_FILE_MACHINE_UNKNOWN" - Expect.AreEqual 1, CLng(IMAGE_FILE_MACHINE_TARGET_HOST), "IMAGE_FILE_MACHINE_TARGET_HOST" - Expect.AreEqual 332, CLng(IMAGE_FILE_MACHINE_I386), "IMAGE_FILE_MACHINE_I386" - Expect.AreEqual 354, CLng(IMAGE_FILE_MACHINE_R3000), "IMAGE_FILE_MACHINE_R3000" - Expect.AreEqual 358, CLng(IMAGE_FILE_MACHINE_R4000), "IMAGE_FILE_MACHINE_R4000" - Expect.AreEqual 360, CLng(IMAGE_FILE_MACHINE_R10000), "IMAGE_FILE_MACHINE_R10000" - Expect.AreEqual 361, CLng(IMAGE_FILE_MACHINE_WCEMIPSV2), "IMAGE_FILE_MACHINE_WCEMIPSV2" - Expect.AreEqual 388, CLng(IMAGE_FILE_MACHINE_ALPHA), "IMAGE_FILE_MACHINE_ALPHA" - Expect.AreEqual 418, CLng(IMAGE_FILE_MACHINE_SH3), "IMAGE_FILE_MACHINE_SH3" - Expect.AreEqual 419, CLng(IMAGE_FILE_MACHINE_SH3DSP), "IMAGE_FILE_MACHINE_SH3DSP" - Expect.AreEqual 420, CLng(IMAGE_FILE_MACHINE_SH3E), "IMAGE_FILE_MACHINE_SH3E" - Expect.AreEqual 422, CLng(IMAGE_FILE_MACHINE_SH4), "IMAGE_FILE_MACHINE_SH4" - Expect.AreEqual 424, CLng(IMAGE_FILE_MACHINE_SH5), "IMAGE_FILE_MACHINE_SH5" - Expect.AreEqual 448, CLng(IMAGE_FILE_MACHINE_ARM), "IMAGE_FILE_MACHINE_ARM" - Expect.AreEqual 450, CLng(IMAGE_FILE_MACHINE_THUMB), "IMAGE_FILE_MACHINE_THUMB" - Expect.AreEqual 452, CLng(IMAGE_FILE_MACHINE_ARMNT), "IMAGE_FILE_MACHINE_ARMNT" - Expect.AreEqual 467, CLng(IMAGE_FILE_MACHINE_AM33), "IMAGE_FILE_MACHINE_AM33" - Expect.AreEqual 496, CLng(IMAGE_FILE_MACHINE_POWERPC), "IMAGE_FILE_MACHINE_POWERPC" - Expect.AreEqual 497, CLng(IMAGE_FILE_MACHINE_POWERPCFP), "IMAGE_FILE_MACHINE_POWERPCFP" - Expect.AreEqual 512, CLng(IMAGE_FILE_MACHINE_IA64), "IMAGE_FILE_MACHINE_IA64" - Expect.AreEqual 614, CLng(IMAGE_FILE_MACHINE_MIPS16), "IMAGE_FILE_MACHINE_MIPS16" - Expect.AreEqual 644, CLng(IMAGE_FILE_MACHINE_ALPHA64), "IMAGE_FILE_MACHINE_ALPHA64" - Expect.AreEqual 870, CLng(IMAGE_FILE_MACHINE_MIPSFPU), "IMAGE_FILE_MACHINE_MIPSFPU" - Expect.AreEqual 1126, CLng(IMAGE_FILE_MACHINE_MIPSFPU16), "IMAGE_FILE_MACHINE_MIPSFPU16" - Expect.AreEqual 644, CLng(IMAGE_FILE_MACHINE_AXP64), "IMAGE_FILE_MACHINE_AXP64" - Expect.AreEqual 1312, CLng(IMAGE_FILE_MACHINE_TRICORE), "IMAGE_FILE_MACHINE_TRICORE" - Expect.AreEqual 3311, CLng(IMAGE_FILE_MACHINE_CEF), "IMAGE_FILE_MACHINE_CEF" - Expect.AreEqual 3772, CLng(IMAGE_FILE_MACHINE_EBC), "IMAGE_FILE_MACHINE_EBC" - Expect.AreEqual 34404, CLng(IMAGE_FILE_MACHINE_AMD64), "IMAGE_FILE_MACHINE_AMD64" - Expect.AreEqual 36929, CLng(IMAGE_FILE_MACHINE_M32R), "IMAGE_FILE_MACHINE_M32R" - Expect.AreEqual 43620, CLng(IMAGE_FILE_MACHINE_ARM64), "IMAGE_FILE_MACHINE_ARM64" - Expect.AreEqual 49390, CLng(IMAGE_FILE_MACHINE_CEE), "IMAGE_FILE_MACHINE_CEE" - Expect.AreEqual 42561, CLng(IMAGE_FILE_MACHINE_ARM64EC), "IMAGE_FILE_MACHINE_ARM64EC" - Expect.AreEqual 42574, CLng(IMAGE_FILE_MACHINE_ARM64X), "IMAGE_FILE_MACHINE_ARM64X" - Expect.Done - End Sub - [TestCase] Public Sub ImageSectionCharacteristics_Values() Expect.Begin diff --git a/test/package-tests/tbKMode/Sources/RunAll.twin b/test/package-tests/tbKMode/Sources/RunAll.twin index 667b1928..f1dd2625 100644 --- a/test/package-tests/tbKMode/Sources/RunAll.twin +++ b/test/package-tests/tbKMode/Sources/RunAll.twin @@ -1,11 +1,11 @@ ' Generated by scripts/package_tests.mjs from this project's [TestCase] Subs and expect.json: ' do not edit. Run Sub Main: each case prints PASS, FAIL or SKIP in the DEBUG CONSOLE. -' The cases are written for the package tbKMode, version 0.3.0.6. Each one checks what is +' The cases are written for the package tbKMode, version 0.3.0.8. Each one checks what is ' correct, so a case that fails names a defect of the package. Module RunAll Public Sub Main() - Expect.StartRun "tbKMode 0.3.0.6: 483 test cases" + Expect.StartRun "tbKMode 0.3.0.8: 484 test cases" On Error Resume Next Expect.StartCase Err.Clear @@ -409,6 +409,10 @@ Module RunAll Expect.EndCase "ImageLayoutTests.IMAGE_TLS_DIRECTORY64_Layout", Err.Number, Err.Description Expect.StartCase Err.Clear + ImageValueTests.ImageMachineType_Values + Expect.EndCase "ImageValueTests.ImageMachineType_Values", Err.Number, Err.Description + Expect.StartCase + Err.Clear ImageValueTests.FPO_FRAME_Values Expect.EndCase "ImageValueTests.FPO_FRAME_Values", Err.Number, Err.Description Expect.StartCase @@ -533,10 +537,6 @@ Module RunAll Expect.EndCase "ImageValueTests.ImageLoadConfigGuardFlags_Values", Err.Number, Err.Description Expect.StartCase Err.Clear - ImageValueTests.ImageMachineType_Values - Expect.EndCase "ImageValueTests.ImageMachineType_Values", Err.Number, Err.Description - Expect.StartCase - Err.Clear ImageValueTests.ImageSectionCharacteristics_Values Expect.EndCase "ImageValueTests.ImageSectionCharacteristics_Values", Err.Number, Err.Description Expect.StartCase @@ -1417,6 +1417,10 @@ Module RunAll Expect.EndCase "WDMLayoutTests.OB_PRE_OPERATION_INFORMATION_Layout", Err.Number, Err.Description Expect.StartCase Err.Clear + WDMLayoutTests.OB_PRE_OPERATION_PARAMETERS_Layout + Expect.EndCase "WDMLayoutTests.OB_PRE_OPERATION_PARAMETERS_Layout", Err.Number, Err.Description + Expect.StartCase + Err.Clear WDMLayoutTests.OEM_STRING_Layout Expect.EndCase "WDMLayoutTests.OEM_STRING_Layout", Err.Number, Err.Description Expect.StartCase diff --git a/test/package-tests/tbKMode/Sources/WDMExportTests.twin b/test/package-tests/tbKMode/Sources/WDMExportTests.twin index 39042548..a20d8baa 100644 --- a/test/package-tests/tbKMode/Sources/WDMExportTests.twin +++ b/test/package-tests/tbKMode/Sources/WDMExportTests.twin @@ -41,7 +41,7 @@ Module WDMExportTests s &= "RtlCompareUnicodeString RtlCompareUnicodeStrings RtlCopyBitMap RtlCopyUnicodeString RtlCreateHeap RtlCreateSecurityDescriptor RtlDeriveCapabilitySidsFromName RtlDestroyHeap " s &= "RtlDuplicateUnicodeString RtlEqualUnicodeString RtlExtractBitMap RtlFindClearBits RtlFindClearBitsAndSet RtlFindClearRuns RtlFindExportedRoutineByName RtlFindFirstRunClear " s &= "RtlFindLastBackwardRunClear RtlFindLeastSignificantBit RtlFindLongestRunClear RtlFindMostSignificantBit RtlFindNextForwardRunClear RtlFindSetBits RtlFindSetBitsAndClear RtlFindSetBitsAndClearEx " - s &= "RtlFindSetBitsEx RtlFreeHeap RtlFreeSid RtlFreeUnicodeString RtlGUIDFromString RtlGetControlSecurityDescriptor RtlGetDaclSecurityDescriptor RtlGetSaclSecurityDescriptor " + s &= "RtlFindSetBitsEx RtlFreeHeap RtlFreeUnicodeString RtlGUIDFromString RtlGetControlSecurityDescriptor RtlGetDaclSecurityDescriptor RtlGetSaclSecurityDescriptor " s &= "RtlGetVersion RtlImageDirectoryEntryToData RtlImageNtHeader RtlInitUnicodeString RtlInitializeBitMap RtlInitializeBitMapEx RtlInitializeSid RtlInitializeSidEx " s &= "RtlInterlockedClearBitRun RtlInterlockedSetBitRun RtlIsElevatedRid RtlIsNameLegalDOS8Dot3 RtlLengthSecurityDescriptor RtlLocalTimeToSystemTime RtlMoveMemory RtlNtStatusToDosError " s &= "RtlNumberOfClearBits RtlNumberOfClearBitsInRange RtlNumberOfSetBits RtlNumberOfSetBitsInRange RtlNumberOfSetBitsUlongPtr RtlQueryRegistryValues RtlSetAllBits RtlSetBit " diff --git a/test/package-tests/tbKMode/Sources/WDMFieldTests.twin b/test/package-tests/tbKMode/Sources/WDMFieldTests.twin index c99e498f..c1e8d590 100644 --- a/test/package-tests/tbKMode/Sources/WDMFieldTests.twin +++ b/test/package-tests/tbKMode/Sources/WDMFieldTests.twin @@ -12,7 +12,7 @@ Module WDMFieldTests Public Sub OB_PRE_OPERATION_INFORMATION_ParametersIsAPointer() Expect.Begin Dim t As OB_PRE_OPERATION_INFORMATION - Dim n As Long = (UBound(t.Parameters) - LBound(t.Parameters) + 1) * LenB(t.Parameters(0)) + Dim n As Long = LenB(t.Parameters) Expect.AreEqual CLng(LenB(Of LongPtr)), n, "size of OB_PRE_OPERATION_INFORMATION.Parameters (a POB_PRE_OPERATION_PARAMETERS in wdm.h)" #If Win64 Then Expect.AreEqual 40, LenB(t), "LenB of OB_PRE_OPERATION_INFORMATION" diff --git a/test/package-tests/tbKMode/Sources/WDMLayoutTests.twin b/test/package-tests/tbKMode/Sources/WDMLayoutTests.twin index 44a5595b..84acdca1 100644 --- a/test/package-tests/tbKMode/Sources/WDMLayoutTests.twin +++ b/test/package-tests/tbKMode/Sources/WDMLayoutTests.twin @@ -1731,7 +1731,11 @@ Module WDMLayoutTests Expect.Begin Dim t As OB_PRE_OPERATION_INFORMATION Dim b As LongPtr = VarPtr(t) - ' Variable-length in C: its size is not compared. + #If Win64 Then + Expect.AreEqual 40, LenB(t), "LenB of OB_PRE_OPERATION_INFORMATION" + #Else + Expect.AreEqual 24, LenB(t), "LenB of OB_PRE_OPERATION_INFORMATION" + #End If Expect.AreEqual 0, Off(b, VarPtr(t.Operation)), "offset of OB_PRE_OPERATION_INFORMATION.Operation" Expect.AreEqual 4, Off(b, VarPtr(t.KernelHandle)), "offset of OB_PRE_OPERATION_INFORMATION.KernelHandle" Expect.AreEqual 8, Off(b, VarPtr(t.Object)), "offset of OB_PRE_OPERATION_INFORMATION.Object" @@ -1746,9 +1750,22 @@ Module WDMLayoutTests Expect.AreEqual 16, Off(b, VarPtr(t.CallContext)), "offset of OB_PRE_OPERATION_INFORMATION.CallContext" #End If #If Win64 Then - Expect.AreEqual 32, Off(b, VarPtr(t.Parameters(0))), "offset of OB_PRE_OPERATION_INFORMATION.Parameters" + Expect.AreEqual 32, Off(b, VarPtr(t.Parameters)), "offset of OB_PRE_OPERATION_INFORMATION.Parameters" + #Else + Expect.AreEqual 20, Off(b, VarPtr(t.Parameters)), "offset of OB_PRE_OPERATION_INFORMATION.Parameters" + #End If + Expect.Done + End Sub + + [TestCase] + Public Sub OB_PRE_OPERATION_PARAMETERS_Layout() + Expect.Begin + Dim t As OB_PRE_OPERATION_PARAMETERS + Dim b As LongPtr = VarPtr(t) + #If Win64 Then + Expect.AreEqual 24, LenB(t), "LenB of OB_PRE_OPERATION_PARAMETERS" #Else - Expect.AreEqual 20, Off(b, VarPtr(t.Parameters(0))), "offset of OB_PRE_OPERATION_INFORMATION.Parameters" + Expect.AreEqual 16, LenB(t), "LenB of OB_PRE_OPERATION_PARAMETERS" #End If Expect.Done End Sub diff --git a/test/package-tests/tbKMode/exe/KernelHelperTests.twin b/test/package-tests/tbKMode/exe/KernelHelperTests.twin index cab1fa06..20a249fa 100644 --- a/test/package-tests/tbKMode/exe/KernelHelperTests.twin +++ b/test/package-tests/tbKMode/exe/KernelHelperTests.twin @@ -480,27 +480,6 @@ Module KernelHelperTests Expect.Done End Sub - ' KeAcquireSpinLock acquires the lock whose address it is given: in a 64-bit build the package's - ' function calls KeAcquireSpinLockRaiseToDpc; in a 32-bit build it is a Declare of hal.dll's - ' KfAcquireSpinLock, a __fastcall routine that reads the address from ECX. Not FastCall, so the - ' call is made whatever the binding; the stand-ins record what they receive. - [TestCase] - Public Sub KeAcquireSpinLock_PassesTheLock() - Expect.Begin - If Not FakeLoaded() Then Expect.Fail "the stand-in for ntoskrnl.exe is not loaded": Expect.Done: Exit Sub - Dim lock As LongPtr - KeInitializeSpinLock lock - FakeKernel_ResetCall - Dim irql As KIRQL = KeAcquireSpinLock(lock) - #If Win64 Then - Expect.AreEqual "KeAcquireSpinLockRaiseToDpc", LastCall(), "the routine KeAcquireSpinLock calls" - #Else - Expect.AreEqual "KfAcquireSpinLock", LastCall(), "the routine KeAcquireSpinLock calls" - #End If - Expect.AreEqual "the argument", Got(0, VarPtr(lock)), "the spin lock the routine received" - Expect.Done - End Sub - ' The WDK's RtlCheckBit is 1 when bit BitPosition of the bitmap's buffer is set, counted from the ' lowest bit of its first ULONG. The package's reads the buffer with CopyMemory (RtlMoveMemory), ' which the stand-in moves as the kernel does. @@ -562,6 +541,27 @@ Module KernelHelperTests Return StrConv(b, vbUnicode) End Function + ' KeAcquireSpinLock acquires the lock whose address it is given: in a 64-bit build the package's + ' function calls KeAcquireSpinLockRaiseToDpc; in a 32-bit build it is a FastCall Declare of + ' hal.dll's KfAcquireSpinLock, a __fastcall routine that reads the address from ECX. The + ' stand-ins record what they receive. + [TestCase] + Public Sub KeAcquireSpinLock_PassesTheLock() + Expect.Begin + If Not FakeLoaded() Then Expect.Fail "the stand-in for ntoskrnl.exe is not loaded": Expect.Done: Exit Sub + Dim lock As LongPtr + KeInitializeSpinLock lock + FakeKernel_ResetCall + Dim irql As KIRQL = KeAcquireSpinLock(lock) + #If Win64 Then + Expect.AreEqual "KeAcquireSpinLockRaiseToDpc", LastCall(), "the routine KeAcquireSpinLock calls" + #Else + Expect.AreEqual "KfAcquireSpinLock", LastCall(), "the routine KeAcquireSpinLock calls" + #End If + Expect.AreEqual "the argument", Got(0, VarPtr(lock)), "the spin lock the routine received" + Expect.Done + End Sub + [TestCase] Public Sub IoCallDriver_PassesTheDeviceAndTheIrp() Expect.Begin diff --git a/test/package-tests/tbKMode/exe/fake-kernel/hal.c b/test/package-tests/tbKMode/exe/fake-kernel/hal.c index 71db285d..d6bf5a10 100644 --- a/test/package-tests/tbKMode/exe/fake-kernel/hal.c +++ b/test/package-tests/tbKMode/exe/fake-kernel/hal.c @@ -1,6 +1,6 @@ /* * A user-mode stand-in for the 32-bit hal.dll, for tbKMode's exe cases: the routines the x86 - * kernel's hal.dll exports and the package's 32-bit Declares name there (from tbKMode 0.3.0.6). Each + * kernel's hal.dll exports and the package's 32-bit Declares name there (from tbKMode 0.3.0.8). Each * passes its call to the routine of the same name in the stand-in for ntoskrnl.exe (ntoskrnl.c), * which records it, so that the cases read one record whichever file the Declare names. It is * never a kernel and starts nothing. Built by ../prepare.mjs for x86 only: the x64 kernel exports diff --git a/test/package-tests/tbKMode/exe/fake-kernel/ntoskrnl.c b/test/package-tests/tbKMode/exe/fake-kernel/ntoskrnl.c index d27ee11b..5dcdb304 100644 --- a/test/package-tests/tbKMode/exe/fake-kernel/ntoskrnl.c +++ b/test/package-tests/tbKMode/exe/fake-kernel/ntoskrnl.c @@ -171,31 +171,13 @@ static void record(const char *name, ULONG_PTR a, ULONG_PTR b) { } /* KfAcquireSpinLock, the x86 hal.dll's __fastcall routine that the package's 32-bit KeAcquireSpinLock - names (the stand-in for hal.dll jumps here). It reads the lock from ECX. The package declares it - without FastCall (tbKMode 0.3.0.6), whose call pushes the lock: this records ECX, where the - routine reads the lock, and the address pushed, and pops the 4 bytes pushed, so that the exe goes - on. Once the package declares it FastCall, this must pop nothing (`ret 0`). The x64 kernel has no - such routine; the x64 build exports one so that both builds share ntoskrnl.def. */ -#ifdef _M_IX86 -static void __stdcall record_std(const char *name, ULONG_PTR a, ULONG_PTR b) { record(name, a, b); } -static const char nm_KfAcquireSpinLock[] = "KfAcquireSpinLock"; - -__declspec(naked) void KfAcquireSpinLock(void) { - __asm { - push dword ptr [esp + 4] - push ecx - push offset nm_KfAcquireSpinLock - call record_std - xor eax, eax - ret 4 - } -} -#else + names (the stand-in for hal.dll jumps here). It reads the lock from ECX; from tbKMode 0.3.0.8 the + package declares it FastCall. The x64 kernel has no such routine; the x64 build exports one so + that both builds share ntoskrnl.def. */ UCHAR __fastcall KfAcquireSpinLock(ULONG_PTR *lock) { record("KfAcquireSpinLock", (ULONG_PTR)lock, 0); return 0; } -#endif /* Records the lock it was given, and Addend and Value, and adds as the kernel's does. */ ULONG __fastcall ExInterlockedAddUlong(ULONG *addend, ULONG value, ULONG_PTR *lock) { diff --git a/test/package-tests/tbKMode/expect.json b/test/package-tests/tbKMode/expect.json index ae93d2a1..a4f6c5fa 100644 --- a/test/package-tests/tbKMode/expect.json +++ b/test/package-tests/tbKMode/expect.json @@ -1,5 +1,5 @@ { - "version": "0.3.0.6", + "version": "0.3.0.8", "cases": { "InterlockedIncrementReturnsTheValue": { "win32": "pass", @@ -15,25 +15,8 @@ "fails": "expected an error on WDMCompileTests.twin line 99, got none; the compiler reported TB5033 wdmcompiletests.twin:42" } }, - "ImageFieldTests.MachineTypes_EqualTheMachineField": { - "fails": "2 of 3 checks failed: IMAGE_FILE_HEADER.Machine of an AMD64 image (&H8664) = IMAGE_FILE_MACHINE_AMD64: expected True, got False; IMAGE_FILE_HEADER.Machine of an ARM64 image (&HAA64) = IMAGE_FILE_MACHINE_ARM64: expected True, got False" - }, "WDMExportTests.Declares_NameExportsOfTheKernel": { - "fails": "2 of 297 checks failed: the x64 kernel exports ExFreePool2: expected True, got False; the x64 kernel exports RtlFreeSid: expected True, got False" - }, - "WDMFieldTests.OB_PRE_OPERATION_INFORMATION_ParametersIsAPointer": { - "win32": { - "fails": "2 of 2 checks failed: size of OB_PRE_OPERATION_INFORMATION.Parameters (a POB_PRE_OPERATION_PARAMETERS in wdm.h): expected 4, got 16; LenB of OB_PRE_OPERATION_INFORMATION: expected 24, got 36" - }, - "win64": { - "fails": "2 of 2 checks failed: size of OB_PRE_OPERATION_INFORMATION.Parameters (a POB_PRE_OPERATION_PARAMETERS in wdm.h): expected 8, got 24; LenB of OB_PRE_OPERATION_INFORMATION: expected 40, got 56" - } - }, - "WDMLayoutTests.DEVICE_OBJECT_Layout": { - "win32": { - "fails": "1 of 26 checks failed: offset of DEVICE_OBJECT.Queue: expected 52, got 49" - }, - "win64": "pass" + "fails": "1 of 296 checks failed: the x64 kernel exports ExFreePool2: expected True, got False" }, "WDMLayoutTests.IO_DRIVER_CREATE_CONTEXT_Layout": { "win32": { @@ -46,36 +29,9 @@ "WDMLayoutTests.KUSER_SHARED_DATA_Layout": { "fails": "1 of 51 checks failed: LenB of KUSER_SHARED_DATA: expected 1848, got 824" }, - "WDMLayoutTests.NPAGED_LOOKASIDE_LIST_Layout": { - "win32": "pass", - "win64": { - "fails": "1 of 2 checks failed: LenB of NPAGED_LOOKASIDE_LIST: expected 128, got 144" - } - }, - "WDMLayoutTests.SE_SID_Layout": { - "fails": "1 of 2 checks failed: LenB of SE_SID: expected 68, got 60" - }, - "WDMValueTests.Constants_Values": { - "fails": "1 of 227 checks failed: SECURITY_MAX_SID_SIZE: expected 68, got 60" - }, "KernelHelperTests.BareNames_CallTheModulesProcedures": { "fails": "3 of 3 checks failed: the string after a call of LCase with no module name: expected \"kernel mode\", got \"Kernel Mode\"; the string after a call of UCase with no module name: expected \"KERNEL MODE\", got \"Kernel Mode\"; InStr with no module name, against modWDM.InStr: expected 8, got 0" }, - "KernelHelperTests.InterlockedAdd64_LeavesTheIrqlAsItWas": { - "fails": "1 of 1 checks failed: the spin locks released that KeAcquireSpinLock had not acquired: expected 0, got 1" - }, - "KernelHelperTests.InterlockedIncrement_LeavesTheIrqlAsItWas": { - "win32": "pass", - "win64": { - "fails": "1 of 1 checks failed: the spin locks released that KeAcquireSpinLock had not acquired: expected 0, got 1" - } - }, - "KernelHelperTests.KeAcquireSpinLock_PassesTheLock": { - "win32": { - "fails": "1 of 2 checks failed: the spin lock the routine received: expected \"the argument\", got \"something else\"" - }, - "win64": "pass" - }, "KernelHelperTests.IoCallDriver_PassesTheDeviceAndTheIrp": { "win32": { "fails": "no result: the exe exited with code -1073741819" diff --git a/test/package-tests/tbKMode/probe/README.md b/test/package-tests/tbKMode/probe/README.md index 51cd3904..2a97b067 100644 --- a/test/package-tests/tbKMode/probe/README.md +++ b/test/package-tests/tbKMode/probe/README.md @@ -42,12 +42,12 @@ embedded from the store, and `src/.twin` as its one module, built with `tbbu | `stack` | `IoGetNextIrpStackLocation` and `IoSkipCurrentIrpStackLocation`, procedures of the package that call no routine of the kernel | | `copied` | the same two procedures copied into the driver's own module under other names | | `ordinal` | `ZwCreateUserProcess` through a Declare of the driver's own with `Alias "#2"`, which the 64-bit kernel exports with no name; the driver imports `#2` | -| `x86exports` | Declares of the package that name, in a 32-bit build, routines the 32-bit `ntoskrnl.exe` does not export: the fast mutexes, `KeGetCurrentIrql`, `KeRaiseIrqlToDpcLevel`, `KfRaiseIrql`, `KeAcquireSpinLock` (`KfAcquireSpinLock`) and `KeReleaseSpinLock`, which the package names in the 32-bit `hal.dll` from 0.3.0.6, `KeLowerIrql`, which names `KfLowerIrql` of `ntoskrnl.exe`, and the `Rtl...BitsEx` routines, which no 32-bit file exports | +| `x86exports` | Declares of the package that name, in a 32-bit build, routines the 32-bit `ntoskrnl.exe` does not export: the fast mutexes, `KeGetCurrentIrql`, `KeRaiseIrqlToDpcLevel`, `KfRaiseIrql`, `KeAcquireSpinLock` (`KfAcquireSpinLock`) and `KeReleaseSpinLock`, which the package names in the 32-bit `hal.dll` from 0.3.0.6, and `KeLowerIrql` (`KfLowerIrql`), which it names there from 0.3.0.8; in a 64-bit build the `Rtl...BitsEx` routines too, which no 32-bit file exports and which the package declares for a 64-bit build only from 0.3.0.8 | The twinBASIC compiler compiles a package's code with the package's own settings, not the project's. In 0.3.0.5 the package's `Settings` set none of a driver's, so its procedures were compiled as user-mode code: `interlocked` (64-bit) and `stack` failed with the published settings, -and passed with the suggested ones. From 0.3.0.6 the package's `Settings` set the five, and on BETA -1042 every scenario passes with the published settings but `x86exports` in a 32-bit build: its -imports are the package's Declares, of which `KeLowerIrql` names the wrong file and the -`Rtl...BitsEx` name routines the 32-bit kernel lacks, whatever the settings. +and passed with the suggested ones. From 0.3.0.6 the package's `Settings` set the five. In 0.3.0.6 `x86exports` failed in a 32-bit +build, since `KeLowerIrql` named the wrong file and the `Rtl...BitsEx` routines the 32-bit kernel +lacks, whatever the settings; with 0.3.0.8, on BETA 1042, every scenario passes with the published +settings. diff --git a/test/package-tests/tbKMode/probe/src/x86exports.twin b/test/package-tests/tbKMode/probe/src/x86exports.twin index d6022805..d37ba001 100644 --- a/test/package-tests/tbKMode/probe/src/x86exports.twin +++ b/test/package-tests/tbKMode/probe/src/x86exports.twin @@ -1,9 +1,9 @@ ' Calls the Declares of the package that name, in a 32-bit build, routines the 32-bit ntoskrnl.exe ' does not export: those the 32-bit hal.dll exports (the fast mutexes, the IRQL routines, -' KfAcquireSpinLock, which KeAcquireSpinLock names, and KeReleaseSpinLock), which the package names -' there from 0.3.0.6, KeLowerIrql, which names KfLowerIrql of ntoskrnl.exe, and the Rtl...BitsEx -' routines, which no 32-bit file exports. The 64-bit kernel exports each of them, or the package's -' 64-bit procedure calls one it does. +' KfAcquireSpinLock, which KeAcquireSpinLock names, KfLowerIrql, which KeLowerIrql names from +' 0.3.0.8, and KeReleaseSpinLock), which the package names there. The Rtl...BitsEx routines, which +' no 32-bit file exports, are declared in a 64-bit build only from 0.3.0.8, and called in one only. +' The 64-bit kernel exports each of them, or the package's 64-bit procedure calls one it does. Module Driver Public Function DriverEntry(DriverObject As DRIVER_OBJECT, RegistryPath As UNICODE_STRING) As NTSTATUS Dim fm As FAST_MUTEX @@ -17,16 +17,18 @@ Module Driver Dim spinLock As LongPtr irql = KeAcquireSpinLock(spinLock) KeReleaseSpinLock spinLock, irql - Dim bm As RTL_BITMAP_EX - ' A buffer of 64 bits; an array would be a SAFEARRAY, which a driver cannot have. - Dim bits As LongLong - RtlInitializeBitMapEx bm, bits, 64 - RtlClearAllBitsEx bm - RtlSetBitEx bm, 1 - RtlClearBitEx bm, 1 - Dim b As Byte = RtlTestBitEx(bm, 1) - Dim n As LongLong = RtlFindSetBitsEx(bm, 1, 0) - n = RtlFindSetBitsAndClearEx(bm, 1, 0) + #If Win64 Then + Dim bm As RTL_BITMAP_EX + ' A buffer of 64 bits; an array would be a SAFEARRAY, which a driver cannot have. + Dim bits As LongLong + RtlInitializeBitMapEx bm, bits, 64 + RtlClearAllBitsEx bm + RtlSetBitEx bm, 1 + RtlClearBitEx bm, 1 + Dim b As Byte = RtlTestBitEx(bm, 1) + Dim n As LongLong = RtlFindSetBitsEx(bm, 1, 0) + n = RtlFindSetBitsAndClearEx(bm, 1, 0) + #End If Return STATUS_SUCCESS End Function End Module diff --git a/test/package-tests/tbKMode/verifier/config/tbKMode.json b/test/package-tests/tbKMode/verifier/config/tbKMode.json index ede89497..2a6559a2 100644 --- a/test/package-tests/tbKMode/verifier/config/tbKMode.json +++ b/test/package-tests/tbKMode/verifier/config/tbKMode.json @@ -116,12 +116,18 @@ "USHRT_MAX": -1, "_UI16_MAX": -1, "MINSHORT": -32768, - "SCHAR_MIN": 128 + "SCHAR_MIN": 128, + "IMAGE_FILE_MACHINE_AMD64": -31132, + "IMAGE_FILE_MACHINE_M32R": -28607, + "IMAGE_FILE_MACHINE_ARM64": -21916, + "IMAGE_FILE_MACHINE_CEE": -16146, + "IMAGE_FILE_MACHINE_ARM64EC": -22975, + "IMAGE_FILE_MACHINE_ARM64X": -22962 }, "comments": { "modWDM": "The fields are the package's names for C fields of other names, or for a member of a C union or nested structure that it flattens (IRP's Tail.Overlay, IO_STACK_LOCATION's Parameters). The skipped fields are padding, a wrapper (GENERAL_LOOKASIDE.L holds the layout C spells out in place) or a bitfield (IsTombstone); the KernelHandle bitfields are checked as the Flags they share with. GENERAL_LOOKASIDE_LAYOUT is a macro in wdm.h, the body of GENERAL_LOOKASIDE, whose size includes the cache-line alignment the package puts in GENERAL_LOOKASIDE. MDL_MAPPING_FLAGS is an enum member named like the C enum type, which has no value. IO_DRIVER_CREATE_CONTEXT.SiloContext is declared under #If NTDDI_VERSION >= NTDDI_WIN10_RS1, and the package never defines NTDDI_VERSION, so the field is never there: its size case says so. MaximumWaitReason ends its enumeration and grows with each SDK. KEY_VALUE_FULL_INFORMATION has no Name field: the name follows its last field, where C's Name[1] starts, and C's size counts that one character and its padding. PS_ATTRIBUTE_NUMBER_MASK is of the Native API's headers (0x0000ffff), which the kernel's do not include. The 16-bit limits are the package's convention (fafalone, tbKMode#4, 2026-11-19; owner, 2026-11-22): an Integer or a Byte holding the bits of the unsigned or signed C value, as the package's USHORT fields are Integers. MAXUINT16, MAXUSHORT, MAXWORD (winnt.h's), USHRT_MAX and _UI16_MAX are &HFFFF, -1; MINSHORT is &H8000, -32768, where C's 0x8000 is the int 32768; SCHAR_MIN is the Byte &H80, 128, the bits of C's -128. SE_SID is a union of a SID and a buffer of SECURITY_MAX_SID_SIZE bytes, 68, which ends in an array but is no variable-length structure: its size is asserted. CHAR_MIN and CHAR_MAX are not compared: the package takes char as unsigned, as a Byte is and its page says (C with /J), where limits.h, without /J, has -128 and 127 (owner, 2026-11-17).", "modFltMgr": "The package builds without FLT_MGR_WIN8: FLT_REGISTRATION of version 0x0202, no section context, where the headers, for the kit's newest Windows, declare version 0x0203.", "modSysInfo": "The skipped names end their enumerations and grow with each SDK. The noSize types end in a SID or a nested variable-length structure. The three ctypes are the WDK names of the package's _EX structures: FILE_RENAME_INFORMATION and FILE_LINK_INFORMATION hold the Flags of the Ex classes in a union with ReplaceIfExists. The fields are the package's names for C fields of other names; its padding field (Pad) has none. FILE_IO_PRIORITY_HINT_INFORMATION is 8 bytes as phnt declares it (DECLSPEC_ALIGN(8)), where wdm.h's is 4, and the kernel takes any length from 4 up for FileIoPriorityHintInformation, query and set, and writes 4 (Windows 10 22H2, 32-bit and 64-bit callers). POLICY_AUDIT_SUBCATEGORY_COUNT is 59 in WDK 10.0.22621, which decides and which the module matches, and 60 from 10.0.26100 on: a note.", - "modImage": "UNWIND_HISTORY_TABLE_SIZE is winnt.h's (and rtlsupportapi.h's), which no kernel header declares. IMAGE_LOAD_CONFIG_DIRECTORY32 and IMAGE_LOAD_CONFIG_DIRECTORY64 end in UmaFunctionPointers, the field WDK 10.0.28000 adds after 10.0.22621's last, GuardMemcpyFunctionPointer: a version the package chose (0.3.0.6), and the loader reads only the Size the image gives, so their sizes are asserted." + "modImage": "UNWIND_HISTORY_TABLE_SIZE is winnt.h's (and rtlsupportapi.h's), which no kernel header declares. IMAGE_LOAD_CONFIG_DIRECTORY32 and IMAGE_LOAD_CONFIG_DIRECTORY64 end in UmaFunctionPointers, the field WDK 10.0.28000 adds after 10.0.22621's last, GuardMemcpyFunctionPointer: a version the package chose (0.3.0.6), and the loader reads only the Size the image gives, so their sizes are asserted. From 0.3.0.8 the members of ImageMachineType above &H7FFF are Integer literals, the bits of the C value as the 16-bit limits of modWDM are (the package's convention), so that they equal IMAGE_FILE_HEADER.Machine, an Integer: IMAGE_FILE_MACHINE_AMD64 is &H8664, -31132." } } diff --git a/test/package-tests/tbKMode/wdk/api.mjs b/test/package-tests/tbKMode/wdk/api.mjs index 4ec39a93..ecb0373d 100644 --- a/test/package-tests/tbKMode/wdk/api.mjs +++ b/test/package-tests/tbKMode/wdk/api.mjs @@ -15,16 +15,26 @@ export function snapshot() { return cached; } -/** The Types and Enums declared inside Module `mod`. */ +/** + * The Modules a module's page holds: Module `mod` and any other Module of its file, `.twin` + * (tbKMode 0.3.0.8 declares ImageMachineType in a Module SuppressedWarnings of modImage.twin, to + * turn a warning off). + */ +function modulesOf(mod) { + const mods = snapshot().types.filter((t) => t.kind === "module" && t.file === `${mod}.twin`); + if (!mods.some((t) => t.name === mod)) throw new Error(`the snapshot has no Module ${mod}`); + return mods; +} + +/** The Types and Enums declared inside Module `mod`, or another Module of its file. */ export function typesOf(mod) { - return snapshot().types.filter((t) => t.in === mod); + const names = new Set(modulesOf(mod).map((t) => t.name)); + return snapshot().types.filter((t) => names.has(t.in)); } -/** The members of Module `mod`: its Declares, procedures, Delegates, Consts and variables. */ +/** The members of Module `mod` and the other Modules of its file: their Declares, procedures, Delegates, Consts and variables. */ export function membersOf(mod) { - const m = snapshot().types.find((t) => t.kind === "module" && t.name === mod); - if (!m) throw new Error(`the snapshot has no Module ${mod}`); - return m.members ?? []; + return modulesOf(mod).flatMap((t) => t.members ?? []); } /** diff --git a/test/package-tests/tbKMode/wdk/learn/modImage.json b/test/package-tests/tbKMode/wdk/learn/modImage.json index b671851d..0679f425 100644 --- a/test/package-tests/tbKMode/wdk/learn/modImage.json +++ b/test/package-tests/tbKMode/wdk/learn/modImage.json @@ -324,6 +324,11 @@ "name": "UNWIND_HISTORY_TABLE_ENTRY", "url": null }, + { + "kind": "Enum", + "name": "ImageMachineType", + "url": null + }, { "kind": "Enum", "name": "FPO_FRAME", @@ -481,11 +486,6 @@ "name": "ImageLoadConfigGuardFlags", "url": null }, - { - "kind": "Enum", - "name": "ImageMachineType", - "url": null - }, { "kind": "Enum", "name": "ImageSectionCharacteristics", diff --git a/test/package-tests/tbKMode/wdk/learn/modWDM.json b/test/package-tests/tbKMode/wdk/learn/modWDM.json index b64f0e03..ab622ebc 100644 --- a/test/package-tests/tbKMode/wdk/learn/modWDM.json +++ b/test/package-tests/tbKMode/wdk/learn/modWDM.json @@ -1148,12 +1148,6 @@ "url": "https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-rtlfreeheap", "syntax": "NTSYSAPI LOGICAL RtlFreeHeap(\n [in] PVOID HeapHandle,\n [in, optional] ULONG Flags,\n _Frees_ptr_opt_ PVOID BaseAddress\n);" }, - { - "kind": "Declare", - "name": "RtlFreeSid", - "url": "https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-rtlfreesid", - "syntax": "NTSYSAPI PVOID RtlFreeSid(\n PSID Sid\n);" - }, { "kind": "Declare", "name": "RtlFreeUnicodeString", @@ -2147,6 +2141,12 @@ "url": "https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_ob_pre_operation_information", "syntax": "typedef struct _OB_PRE_OPERATION_INFORMATION {\n OB_OPERATION Operation;\n union {\n ULONG Flags;\n struct {\n ULONG KernelHandle : 1;\n ULONG Reserved : 31;\n };\n };\n PVOID Object;\n POBJECT_TYPE ObjectType;\n PVOID CallContext;\n POB_PRE_OPERATION_PARAMETERS Parameters;\n} OB_PRE_OPERATION_INFORMATION, *POB_PRE_OPERATION_INFORMATION;" }, + { + "kind": "Type", + "name": "OB_PRE_OPERATION_PARAMETERS", + "url": "https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_ob_pre_operation_parameters", + "syntax": "typedef union _OB_PRE_OPERATION_PARAMETERS {\n OB_PRE_CREATE_HANDLE_INFORMATION CreateHandleInformation;\n OB_PRE_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation;\n} OB_PRE_OPERATION_PARAMETERS, *POB_PRE_OPERATION_PARAMETERS;" + }, { "kind": "Type", "name": "OEM_STRING", diff --git a/test/package-tests/tbKMode/writer/modImage/frame.md b/test/package-tests/tbKMode/writer/modImage/frame.md index 79b9e9a7..f0a1d197 100644 --- a/test/package-tests/tbKMode/writer/modImage/frame.md +++ b/test/package-tests/tbKMode/writer/modImage/frame.md @@ -41,9 +41,10 @@ Every member that `ntimage.h` declares has the value of its constant or enumerat {{table:enums}} - -> [!WARNING] 0.3.0.6 -> The members of **ImageMachineType** above `&H7FFF`, such as **IMAGE_FILE_MACHINE_AMD64** (`&H8664&`) and **IMAGE_FILE_MACHINE_ARM64** (`&HAA64&`), are positive **Long** values, but **IMAGE_FILE_HEADER.Machine** is an **Integer**, which holds them as negative numbers: `hdr.Machine = IMAGE_FILE_MACHINE_AMD64` is **False** for the header of an AMD64 image. A driver compares `hdr.Machine And &HFFFF&` with the constant. + +The members of **ImageMachineType** above `&H7FFF`, such as **IMAGE_FILE_MACHINE_AMD64** and **IMAGE_FILE_MACHINE_ARM64**, hold the bits of the C value as an **Integer** does: **IMAGE_FILE_MACHINE_AMD64** is `&H8664`, -31132, not the **Long** 34404. **IMAGE_FILE_HEADER.Machine** is an **Integer**, so `hdr.Machine = IMAGE_FILE_MACHINE_AMD64` is **True** for the header of an AMD64 image. The enumeration is declared in a module of its own in the package's file `modImage.twin`, **SuppressedWarnings**, which turns off [TB0012](../../../../Features/Compiler-IDE/Compiler-Warnings#tb0012-possible-hex-literal-misuse) for these literals; its members are used without a module name. + + ## Constants diff --git a/test/package-tests/tbKMode/writer/modImage/names.json b/test/package-tests/tbKMode/writer/modImage/names.json index 103b8486..e9651a58 100644 --- a/test/package-tests/tbKMode/writer/modImage/names.json +++ b/test/package-tests/tbKMode/writer/modImage/names.json @@ -98,7 +98,7 @@ "ImageDllCharacteristics": "The `IMAGE_DLLCHARACTERISTICS_` flags of the optional header's **DllCharacteristics**, such as `IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE`, `IMAGE_DLLCHARACTERISTICS_NX_COMPAT` and `IMAGE_DLLCHARACTERISTICS_WDM_DRIVER`, with the reserved `IMAGE_LIBRARY_` flags.", "ImageFileCharacteristics": "The `IMAGE_FILE_` flags of **IMAGE_FILE_HEADER.Characteristics**, such as `IMAGE_FILE_EXECUTABLE_IMAGE`, `IMAGE_FILE_LARGE_ADDRESS_AWARE` and `IMAGE_FILE_DLL`.", "ImageLoadConfigGuardFlags": "The `IMAGE_GUARD_` flags of the load configuration directory's **GuardFlags**: which Control Flow Guard, return flow and related protections the image has, such as `IMAGE_GUARD_CF_INSTRUMENTED`, with the mask and shift of the stride of the guard function table.", - "ImageMachineType": "The `IMAGE_FILE_MACHINE_` values of **IMAGE_FILE_HEADER.Machine**: the processor the file is for, such as `IMAGE_FILE_MACHINE_I386`, `IMAGE_FILE_MACHINE_AMD64` and `IMAGE_FILE_MACHINE_ARM64`. See the warning below.", + "ImageMachineType": "The `IMAGE_FILE_MACHINE_` values of **IMAGE_FILE_HEADER.Machine**: the processor the file is for, such as `IMAGE_FILE_MACHINE_I386`, `IMAGE_FILE_MACHINE_AMD64` and `IMAGE_FILE_MACHINE_ARM64`. See below the table.", "ImageSectionCharacteristics": "The `IMAGE_SCN_` flags of **IMAGE_SECTION_HEADER.Characteristics**: what the section contains, its alignment in an object file (`IMAGE_SCN_ALIGN_`), and how it is mapped, such as `IMAGE_SCN_MEM_EXECUTE` and `IMAGE_SCN_MEM_NOT_PAGED`.", "ImageSubsystemType": "The `IMAGE_SUBSYSTEM_` values of the optional header's **Subsystem**: the subsystem an image runs in, such as `IMAGE_SUBSYSTEM_NATIVE` for a driver and `IMAGE_SUBSYSTEM_WINDOWS_GUI`." }, diff --git a/test/package-tests/tbKMode/writer/modWDM/frame.md b/test/package-tests/tbKMode/writer/modWDM/frame.md index a0b2a378..60f34495 100644 --- a/test/package-tests/tbKMode/writer/modWDM/frame.md +++ b/test/package-tests/tbKMode/writer/modWDM/frame.md @@ -33,37 +33,32 @@ A parameter that C declares optional, and that is a structure passed by referenc {{table:declares}} - -> [!WARNING] 0.3.0.6 -> In a 32-bit driver [**KeAcquireSpinLock**](#KeAcquireSpinLock) is a declaration of `KfAcquireSpinLock` of `hal.dll`, a `__fastcall` routine that takes the lock in a register, but the package declares it without `FastCall` and calls it as a `__stdcall` routine, which pushes the lock on the stack. The routine acquires some other spin lock than the driver's, and the call leaves the stack 4 bytes off. A 64-bit driver is not affected. + +In a 32-bit build the routines that the 32-bit kernel has in `hal.dll`, such as `KfAcquireSpinLock` and `KfLowerIrql`, which [**KeAcquireSpinLock**](#KeAcquireSpinLock) and **KeLowerIrql** call there, are declarations of `hal.dll`. **RtlInitializeBitMapEx**, **RtlClearAllBitsEx**, **RtlClearBitEx**, **RtlSetBitEx**, **RtlTestBitEx**, **RtlFindSetBitsEx** and **RtlFindSetBitsAndClearEx** are declared in a 64-bit build only, since no 32-bit file exports them. + - -> [!NOTE] 0.3.0.6 -> The 64-bit kernel of Windows 10 version 22H2 does not export **RtlFreeSid**, and **ExFreePool2** is exported from Windows 11 and Windows Server 2022 on, as [its page](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-exfreepool2) says. A driver imports only the routines that it calls, so a driver that calls neither is not affected; one that calls **RtlFreeSid**, or **ExFreePool2** on Windows 10, does not load. -> -> A 32-bit driver has more of them. In a 32-bit build **KeLowerIrql** names `KfLowerIrql` of `ntoskrnl.exe`, which only the 32-bit `hal.dll` exports, and no 32-bit file exports **RtlInitializeBitMapEx**, **RtlClearAllBitsEx**, **RtlClearBitEx**, **RtlSetBitEx**, **RtlTestBitEx**, **RtlFindSetBitsEx** and **RtlFindSetBitsAndClearEx**. A 32-bit driver that calls any of them does not load; it calls **KfLowerIrql** in place of **KeLowerIrql**. The 64-bit kernel exports all of them. + +> [!NOTE] 0.3.0.8 +> **ExFreePool2** is exported from Windows 11 and Windows Server 2022 on, as [its page](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-exfreepool2) says: the 64-bit kernel of Windows 10 version 22H2 does not export it. A driver imports only the routines that it calls, so a driver that does not call it is not affected; one that calls it on Windows 10 does not load. ## Types -Each structure that the WDK's kernel-mode headers declare has the size of its C structure, and its fields are at the C fields' offsets, in a 32-bit and in a 64-bit build, apart from those of the warning and the note below. +Each structure that the WDK's kernel-mode headers declare has the size of its C structure, and its fields are at the C fields' offsets, in a 32-bit and in a 64-bit build, apart from those of the note below. {{table:types}} - -> [!WARNING] 0.3.0.6 -> **OB_PRE_OPERATION_INFORMATION.Parameters** is a **Byte** array of the size of the parameters' union where wdm.h has a pointer to the union: 16 bytes where the pointer is 4 in a 32-bit build, and 24 where it is 8 in a 64-bit one. The structure is 36 bytes where C's is 24, and 56 where C's is 40. The array starts at the pointer's offset, so its first 4 or 8 bytes are the pointer, and the rest is past the end of the structure the kernel passes. A driver that reads the parameters reads them at the address in the first 4 or 8 bytes. + +**OB_PRE_OPERATION_INFORMATION.Parameters** is the address of the parameters, as in wdm.h. The C type it points to is a union of **OB_PRE_CREATE_HANDLE_INFORMATION** and **OB_PRE_DUPLICATE_HANDLE_INFORMATION**, which **OB_PRE_OPERATION_PARAMETERS** declares as the larger of the two: a driver reads **DesiredAccess** and **OriginalDesiredAccess** of either from it, and **SourceProcess** and **TargetProcess** when the operation is `OB_OPERATION_HANDLE_DUPLICATE`. + - -> [!NOTE] 0.3.0.6 -> These structures differ from the C structures in size, and one in the start of a field: + +> [!NOTE] 0.3.0.8 +> These structures are smaller than the C structures: > -> - In a 32-bit build **DEVICE_OBJECT.Queue** starts 3 bytes before C's **Queue**, at offset 49 where C's is at 52: its first 3 bytes are the padding after **StackSize**. Its other fields are at their places, and a 64-bit build has C's layout. > - **IO_DRIVER_CREATE_CONTEXT** lacks C's last field, **SiloContext**: it is 16 bytes where C's is 20 in a 32-bit build, and 32 where C's is 40 in a 64-bit one. The package declares the field under `#If NTDDI_VERSION >= NTDDI_WIN10_RS1`, as the WDK does, but defines no `NTDDI_VERSION`, and a project's conditional constants do not reach a package's code, so the field is never there. Its other fields are at their places. > - **KUSER_SHARED_DATA** ends at **Cookie**: it is 824 bytes where the WDK's is 1848, and has none of the WDK's fields after **Cookie**. Its other fields are at their places. -> - In a 64-bit build **NPAGED_LOOKASIDE_LIST** is 144 bytes where C's is 128: its padding array, **align**, follows the **GENERAL_LOOKASIDE**, which already has C's size. A 32-bit build has C's size. -> - **SE_SID** is a buffer of **SECURITY_MAX_SID_SIZE** bytes, 60, where C's is 68 (see the note under [Constants](#constants)), so it cannot hold a SID of **SID_MAX_SUB_AUTHORITIES** subauthorities. ## Aliases @@ -89,10 +84,6 @@ The major and minor function codes of an IRP, the parts of an I/O control code t The limits of the 16-bit types hold the bits of the C value in an **Integer**, as the package's fields of those types are **Integers**: **MAXUINT16**, **MAXUSHORT**, **MAXWORD**, **USHRT_MAX** and **_UI16_MAX** are `&HFFFF`, -1, and **MINSHORT** is `&H8000`, -32768. Each equals a field that holds the bits of a `USHORT` of 65535, or a `SHORT` of -32768, but not the **Long** 65535 or 32768. **SCHAR_MIN** is the **Byte** `&H80`, 128, the bits of C's -128, as the package takes a `char` as a **Byte**. - -> [!NOTE] 0.3.0.6 -> **SECURITY_MAX_SID_SIZE** is 60, where the WDK's is 68: a buffer of that size cannot hold a SID of **SID_MAX_SUB_AUTHORITIES** subauthorities. - ## Variables diff --git a/test/package-tests/tbKMode/writer/modWDM/names.json b/test/package-tests/tbKMode/writer/modWDM/names.json index 17bc25ee..83aa1b31 100644 --- a/test/package-tests/tbKMode/writer/modWDM/names.json +++ b/test/package-tests/tbKMode/writer/modWDM/names.json @@ -95,7 +95,7 @@ "KeGetCurrentIrql": "Returns the current IRQL. In a 32-bit build it is a routine of `hal.dll`.", "KeInitializeEvent": "Initializes a **KEVENT** as a notification or synchronization event, signaled or not signaled.", "KeInitializeSpinLock": "Initializes a spin lock variable, a **LongPtr**. The C routine returns nothing, so the **Long** it returns here has no meaning.", - "KeLowerIrql": "Restores the IRQL of the current processor to *NewIrql*, the value that **KeRaiseIrql** saved or **KfRaiseIrql** or **KeRaiseIrqlToDpcLevel** returned. In a 32-bit build it names `KfLowerIrql` of `ntoskrnl.exe`: see the note below.", + "KeLowerIrql": "Restores the IRQL of the current processor to *NewIrql*, the value that **KeRaiseIrql** saved or **KfRaiseIrql** or **KeRaiseIrqlToDpcLevel** returned. In a 32-bit build it is a declaration of `KfLowerIrql` of `hal.dll`.", "KeQuerySystemTimePrecise": "Writes the current system time into *CurrentTime*, as **KeQuerySystemTime** does but more precisely.", "KeRaiseIrqlToDpcLevel": "Raises the IRQL of the current processor to `DISPATCH_LEVEL` and returns the IRQL from before, which **KeLowerIrql** takes back. In a 32-bit build it is a routine of `hal.dll`.", "KeReleaseSpinLock": "Releases a spin lock and sets the IRQL to *NewIrql*, the IRQL that **KeAcquireSpinLock** returned. In a 32-bit build it is a routine of `hal.dll`.", @@ -161,9 +161,9 @@ "RtlAreBitsClear": "Returns nonzero when the *Length* bits of a bitmap from bit *StartingIndex* are all clear.", "RtlAreBitsSet": "Returns nonzero when the *Length* bits of a bitmap from bit *StartingIndex* are all set.", "RtlClearAllBits": "Clears every bit of a bitmap.", - "RtlClearAllBitsEx": "As **RtlClearAllBits**, for an **RTL_BITMAP_EX**. Not documented by Microsoft.", + "RtlClearAllBitsEx": "As **RtlClearAllBits**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only.", "RtlClearBit": "Clears bit *BitNumber* of a bitmap.", - "RtlClearBitEx": "As **RtlClearBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft.", + "RtlClearBitEx": "As **RtlClearBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only.", "RtlClearBits": "Clears *NumberToClear* bits of a bitmap, from bit *StartingIndex*.", "RtlCompareUnicodeString": "Compares two strings, with or without case, and returns a value less than, equal to or greater than zero.", "RtlCompareUnicodeStrings": "Compares two UTF-16 strings given by their addresses and their lengths in characters, with or without case, and returns a value less than, equal to or greater than zero.", @@ -188,10 +188,9 @@ "RtlFindNextForwardRunClear": "Returns the number of bits in the next run of clear bits of a bitmap from bit *FromIndex*, and its first bit in *StartingRunIndex*.", "RtlFindSetBits": "Returns the first bit of a run of *NumberToFind* set bits in a bitmap, searching from bit *HintIndex*, or `&HFFFFFFFF` when there is none.", "RtlFindSetBitsAndClear": "As **RtlFindSetBits**, and clears the bits it finds.", - "RtlFindSetBitsAndClearEx": "As **RtlFindSetBitsAndClear**, for an **RTL_BITMAP_EX**. Not documented by Microsoft.", - "RtlFindSetBitsEx": "As **RtlFindSetBits**, for an **RTL_BITMAP_EX**. Not documented by Microsoft.", + "RtlFindSetBitsAndClearEx": "As **RtlFindSetBitsAndClear**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only.", + "RtlFindSetBitsEx": "As **RtlFindSetBits**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only.", "RtlFreeHeap": "Frees a block that **RtlAllocateHeap** allocated, and returns nonzero when it succeeds.", - "RtlFreeSid": "Frees a SID that `RtlAllocateAndInitializeSid` allocated. See the note below.", "RtlFreeUnicodeString": "Frees the buffer of a string that a routine allocated, such as **RtlUpcaseUnicodeString** with *AllocateDestinationString* nonzero.", "RtlGetControlSecurityDescriptor": "Returns the control flags and the revision of a security descriptor in *Control* and *Revision*.", "RtlGetDaclSecurityDescriptor": "Returns in *DaclPresent* whether a security descriptor has a discretionary access control list (DACL), and in *Dacl* and *DaclDefaulted* its address and whether it was defaulted.", @@ -201,7 +200,7 @@ "RtlImageDirectoryEntryToData": "Returns the address of a data directory of the image at *BaseAddress*, such as its export directory, and its size in *size*; *Directory* is an **ImageDirectories** value. Not documented by Microsoft.", "RtlImageNtHeader": "Returns the address of the NT headers of the image loaded at *ModuleBase*. Not documented by Microsoft.", "RtlInitializeBitMap": "Initializes the header of a bitmap of *SizeOfBitmap* bits, which then points at the buffer and does not copy it. *BitmapBuffer* is `As Any`: pass the first element of a **Long** array, or an address as `ByVal`.", - "RtlInitializeBitMapEx": "As **RtlInitializeBitMap**, for an **RTL_BITMAP_EX**, whose size and bit numbers are **LongLong**. Not documented by Microsoft.", + "RtlInitializeBitMapEx": "As **RtlInitializeBitMap**, for an **RTL_BITMAP_EX**, whose size and bit numbers are **LongLong**. Not documented by Microsoft. Declared in a 64-bit build only.", "RtlInitializeSid": "Initializes the SID at the address *Sid* with an identifier authority and a number of subauthorities, whose values it does not set.", "RtlInitializeSidEx": "As **RtlInitializeSid**, with the values of the subauthorities passed after *SubAuthorityCount*.", "RtlInitUnicodeString": "Sets a **UNICODE_STRING** to the null-terminated UTF-16 string at the address *SourceString*, which the structure then points at and which is not copied.", @@ -220,7 +219,7 @@ "RtlQueryRegistryValues": "Reads several values of one registry key in a single call, as an array of **RTL_QUERY_REGISTRY_TABLE** describes them. *RelativeTo* is an `RTL_REGISTRY_` constant and *Path* the address of a null-terminated UTF-16 string.", "RtlSetAllBits": "Sets every bit of a bitmap.", "RtlSetBit": "Sets bit *BitNumber* of a bitmap.", - "RtlSetBitEx": "As **RtlSetBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft.", + "RtlSetBitEx": "As **RtlSetBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only.", "RtlSetBits": "Sets *NumberToSet* bits of a bitmap, from bit *StartingIndex*.", "RtlSetControlSecurityDescriptor": "Sets the control flags *ControlBitsOfInterest* of a security descriptor to their values in *ControlBitsToSet*.", "RtlSetDaclSecurityDescriptor": "Sets the discretionary access control list (DACL) of an absolute security descriptor and its flags; *Dacl* is the ACL's address, or 0 for a null DACL.", @@ -228,7 +227,7 @@ "RtlSidHashInitialize": "Fills a **SID_AND_ATTRIBUTES_HASH** for lookups in the array of *SidCount* **SID_AND_ATTRIBUTES** that starts at *SidAttr*. Not documented by Microsoft.", "RtlSidHashLookup": "Returns the address of the **SID_AND_ATTRIBUTES** of the SID at *Sid* in a hash that **RtlSidHashInitialize** filled. Not documented by Microsoft.", "RtlTestBit": "Returns nonzero when bit *BitNumber* of a bitmap is set.", - "RtlTestBitEx": "As **RtlTestBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft.", + "RtlTestBitEx": "As **RtlTestBit**, for an **RTL_BITMAP_EX**. Not documented by Microsoft. Declared in a 64-bit build only.", "RtlUpcaseUnicodeString": "Writes an uppercase copy of *SourceString* into *DestinationString*, allocating its buffer when *AllocateDestinationString* is nonzero, to be freed with **RtlFreeUnicodeString**.", "RtlValidRelativeSecurityDescriptor": "Returns nonzero when a self-relative security descriptor of *SecurityDescriptorLength* bytes is valid and holds the parts that *RequiredInformation* names.", "RtlValidSecurityDescriptor": "Returns nonzero when a security descriptor is valid.", @@ -314,7 +313,7 @@ "ANSI_STRING": "A counted string of 8-bit ANSI characters, laid out as **UNICODE_STRING**: its length and its buffer's size in bytes and the buffer's address.", "CLIENT_ID": "A process ID and a thread ID, as **ZwOpenProcess** takes them and **PS_CREATE_NOTIFY_INFO.CreatingThreadId** holds them.", "CM_EXTENDED_PARAMETER": "One extended parameter of **ZwLoadKey3**. **uType** holds the C bit fields, the 8-bit type (a **CM_EXTENDED_PARAMETER_TYPE** value) and the reserved bits, and **u** holds the C union of the parameter's value.", - "DEVICE_OBJECT": "A device, as **IoCreateDevice** creates it and **IoAttachDeviceToDeviceStack**, **IofCallDriver** and **IoDetachDevice** take it: its driver, the next and the attached device, flags, device extension, device type and stack size. The C union **Queue** is a **Byte** array. See the note below.", + "DEVICE_OBJECT": "A device, as **IoCreateDevice** creates it and **IoAttachDeviceToDeviceStack**, **IofCallDriver** and **IoDetachDevice** take it: its driver, the next and the attached device, flags, device extension, device type and stack size. The C union **Queue** is a **Byte** array.", "DEVICEIOCTL": "The **DeviceIoControl** member of the C union **Parameters** of **IO_STACK_LOCATION**, for `IRP_MJ_DEVICE_CONTROL` and `IRP_MJ_INTERNAL_DEVICE_CONTROL`: the two buffer lengths, the control code and the input buffer of a `METHOD_NEITHER` request. In a 64-bit build **zPtrAlign2** and **zPtrAlign3** are the padding C puts before **InputBufferLength** and **IoControlCode**.", "DISPATCHER_HEADER": "The header that every kernel object a thread can wait on begins with, as **KEVENT.Header** holds it: its signal state and the list of waiting threads. **Lock** stands for the C union of the object's type, size and flag bytes.", "DRIVER_EXTENSION": "The driver extension that **DRIVER_OBJECT.DriverExtension** points to: the driver's **AddDevice** routine and the name of its service key in the registry.", @@ -357,7 +356,7 @@ "LUID": "A locally unique identifier: a 64-bit value that is unique on the system that made it, such as a privilege's.", "LUID_AND_ATTRIBUTES": "A **LUID** and its attributes, such as a privilege and whether it is enabled (**SE_PRIVILEGE_ATTR**).", "MDL": "A memory descriptor list, which describes the physical pages of a buffer, as **IRP.MdlAddress** points to it and **MmGetSystemAddressForMdlSafe** and **MmMapLockedPagesSpecifyCache** take its address.", - "NPAGED_LOOKASIDE_LIST": "A lookaside list of entries in nonpaged pool, whose address **ExInitializeNPagedLookasideList** takes. It holds a **GENERAL_LOOKASIDE**, followed by C's obsolete lock field in a 32-bit build and by a padding array, **align**, in a 64-bit one. See the note below.", + "NPAGED_LOOKASIDE_LIST": "A lookaside list of entries in nonpaged pool, whose address **ExInitializeNPagedLookasideList** takes. It holds a **GENERAL_LOOKASIDE**, followed in a 32-bit build by C's obsolete lock field.", "OB_CALLBACK_REGISTRATION": "What a driver registers with **ObRegisterCallbacks**: the version, the altitude, a context and **OperationRegistration**, which points to an array of **OperationRegistrationCount** **OB_OPERATION_REGISTRATION** items.", "OB_OPERATION_REGISTRATION": "One object type to watch, with the handle operations (**OB_OPERATION**) and the pre-operation and post-operation callbacks. **ObjectType** is the address that **PsProcessType** or **PsThreadType** returns.", "OB_POST_CREATE_HANDLE_INFORMATION": "The access granted to a process or thread handle that has been opened, as a post-operation callback receives it.", @@ -366,7 +365,8 @@ "OB_POST_OPERATION_PARAMETERS": "The parameters of a post-operation callback. Both members of the C union have the one field **GrantedAccess**, so the package gives that field.", "OB_PRE_CREATE_HANDLE_INFORMATION": "The access asked for a process or thread handle that is being opened, which a pre-operation callback can reduce in **DesiredAccess**.", "OB_PRE_DUPLICATE_HANDLE_INFORMATION": "The access asked for a process or thread handle that is being duplicated, which a pre-operation callback can reduce in **DesiredAccess**, with the source and the target process.", - "OB_PRE_OPERATION_INFORMATION": "A process or thread handle operation, as a pre-operation callback receives it: the operation, whether the handle is a kernel handle, the object and its type, and the context to pass to the post-operation callback. **KernelHandle** stands for the C union of the flags and the **KernelHandle** bit. **Parameters** is a **Byte** array the size of the union of **OB_PRE_CREATE_HANDLE_INFORMATION** and **OB_PRE_DUPLICATE_HANDLE_INFORMATION**, where C has a pointer to that union. See the warning below.", + "OB_PRE_OPERATION_INFORMATION": "A process or thread handle operation, as a pre-operation callback receives it: the operation, whether the handle is a kernel handle, the object and its type, and the context to pass to the post-operation callback. **KernelHandle** stands for the C union of the flags and the **KernelHandle** bit. **Parameters** is the address of its **OB_PRE_OPERATION_PARAMETERS**.", + "OB_PRE_OPERATION_PARAMETERS": "The parameters of a process or thread handle operation, at the address in **OB_PRE_OPERATION_INFORMATION.Parameters**: the C union of **OB_PRE_CREATE_HANDLE_INFORMATION** and **OB_PRE_DUPLICATE_HANDLE_INFORMATION**, declared with the fields of the larger, **OB_PRE_DUPLICATE_HANDLE_INFORMATION**.", "OBJECT_ATTRIBUTES": "The name, root directory, attributes (**ObjectAttributeValues**) and security of an object to open or create, as **InitializeObjectAttributes** fills it and **ZwCreateFile**, **ZwOpenKey** and the other **Zw** routines take it.", "OBJECT_HANDLE_INFORMATION": "The attributes of a handle and the access it grants, as **ObReferenceObjectByHandle** and **ObReferenceObjectByHandleWithTag** fill it.", "OEM_STRING": "A counted string in the OEM code page, laid out as **ANSI_STRING**, such as the 8.3 name that **RtlIsNameLegalDOS8Dot3** returns in *OemName*.", @@ -416,7 +416,7 @@ "RTL_OSVERSIONINFOEXW": "As **RTL_OSVERSIONINFOW**, with the service pack version, suite mask and product type. **RtlGetVersion** fills it when **dwOSVersionInfoSize** is its size.", "RTL_OSVERSIONINFOW": "The Windows version, as **RtlGetVersion** fills it: the major and minor version, build number, platform and service pack string. The caller sets **dwOSVersionInfoSize** to its size first.", "RTL_QUERY_REGISTRY_TABLE": "One entry of the table that **RtlQueryRegistryValues** takes: the routine or the variable that receives a value, its name, flags and default. The table ends with an entry whose **QueryRoutine** and **Name** are 0.", - "SE_SID": "A buffer of **SECURITY_MAX_SID_SIZE** bytes for a **SID**, which a driver can declare as a local variable. Of the C union it has the **Buffer** member only. See the note below.", + "SE_SID": "A buffer of **SECURITY_MAX_SID_SIZE** bytes for a **SID**, which a driver can declare as a local variable. Of the C union it has the **Buffer** member only.", "SECTION_OBJECT_POINTERS": "The memory manager's and cache manager's data for a file stream, which the file system allocates and **FILE_OBJECT.SectionObjectPointer** points to.", "SECURITY_DESCRIPTOR": "The security of an object in absolute form: its revision, control flags and pointers to the owner, the group, the SACL and the DACL.", "SECURITY_SUBJECT_CONTEXT": "The security context of the thread that asks for access, as **ACCESS_STATE.SubjectSecurityContext** holds it and **SeLockSubjectContext**, **SeAssignSecurity** and **SeAccessCheck** take it: its client token, impersonation level and primary token.", @@ -765,7 +765,7 @@ "SECURITY_DESCRIPTOR_MIN_LENGTH": "The size in bytes of an absolute **SECURITY_DESCRIPTOR**, 40 in a 64-bit build and 20 in a 32-bit one.", "SECURITY_DESCRIPTOR_REVISION": "The revision of a **SECURITY_DESCRIPTOR**.", "SECURITY_DESCRIPTOR_REVISION1": "The first revision of a **SECURITY_DESCRIPTOR**, the same as **SECURITY_DESCRIPTOR_REVISION**.", - "SECURITY_MAX_SID_SIZE": "The size in bytes of the largest **SID**, the one with **SID_MAX_SUB_AUTHORITIES** subauthorities. See the note below.", + "SECURITY_MAX_SID_SIZE": "The size in bytes of the largest **SID**, the one with **SID_MAX_SUB_AUTHORITIES** subauthorities.", "SEMAPHORE_INCREMENT": "The priority boost of a thread whose wait on a semaphore ends when the semaphore is released.", "SHRT_MAX": "The largest value of a `short`, an **Integer**.", "SHRT_MIN": "The smallest value of a `short`, an **Integer**.", diff --git a/test/package-tests/tbKMode/writer/modWDM/procedures.md b/test/package-tests/tbKMode/writer/modWDM/procedures.md index c0ee18da..fd889da3 100644 --- a/test/package-tests/tbKMode/writer/modWDM/procedures.md +++ b/test/package-tests/tbKMode/writer/modWDM/procedures.md @@ -210,14 +210,10 @@ Syntax: **InterlockedAdd64** *Addend*, *Value* *Value* : *required* A **LongLong**: the value to add. - -Each call initializes a spin lock of its own with [**KeInitializeSpinLock**](#KeInitializeSpinLock), passes it with *Addend* and *Value* to [**ExInterlockedAddLargeInteger**](#ExInterlockedAddLargeInteger), which acquires and releases it, and then calls [**KeReleaseSpinLock**](#KeReleaseSpinLock) with it. The procedure is a **Sub**: it returns nothing, where the WDK's `InterlockedAdd64`, a compiler intrinsic, returns the sum. The package describes it as not usable in a 32-bit driver. + +Each call initializes a spin lock of its own with [**KeInitializeSpinLock**](#KeInitializeSpinLock) and passes it with *Addend* and *Value* to [**ExInterlockedAddLargeInteger**](#ExInterlockedAddLargeInteger), which acquires and releases it; the IRQL is left as it was. The procedure is a **Sub**: it returns nothing, where the WDK's `InterlockedAdd64`, a compiler intrinsic, returns the sum. The package describes it as not usable in a 32-bit driver. - -> [!WARNING] 0.3.0.6 -> **InterlockedAdd64** calls **KeReleaseSpinLock** with a lock that it never acquired and an IRQL of 0. **KeReleaseSpinLock** sets the IRQL to the one it is given, so a call made at `APC_LEVEL` or `DISPATCH_LEVEL` returns at `PASSIVE_LEVEL`, and the driver goes on at an IRQL lower than the one it was at. A driver calls **ExInterlockedAddLargeInteger** itself, with a spin lock that it has initialized with **KeInitializeSpinLock**. - ### InterlockedIncrement {: #InterlockedIncrement } @@ -230,16 +226,12 @@ Syntax (32-bit): **InterlockedIncrement**( *Addend* ) *Addend* : *required* A **Long**, passed by reference: the variable to increment. - -In a 64-bit build **InterlockedIncrement** is a **Sub** of the package: each call initializes a spin lock of its own with [**KeInitializeSpinLock**](#KeInitializeSpinLock), passes it to [**ExInterlockedAddUlong**](#ExInterlockedAddUlong) with *Addend* and 1, which acquires and releases it, and then calls [**KeReleaseSpinLock**](#KeReleaseSpinLock) with it, as [**InterlockedAdd64**](#InterlockedAdd64) does. In a 32-bit build it is a **Declare** of the kernel's `InterlockedIncrement`, a `__fastcall` routine there, which returns the incremented value. The WDK's [**InterlockedIncrement**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-interlockedincrement) is a compiler intrinsic that returns the incremented value. + +In a 64-bit build **InterlockedIncrement** is a **Sub** of the package: each call initializes a spin lock of its own with [**KeInitializeSpinLock**](#KeInitializeSpinLock) and passes it to [**ExInterlockedAddUlong**](#ExInterlockedAddUlong) with *Addend* and 1, which acquires and releases it, as [**InterlockedAdd64**](#InterlockedAdd64) does. In a 32-bit build it is a **Declare** of the kernel's `InterlockedIncrement`, a `__fastcall` routine there, which returns the incremented value. The WDK's [**InterlockedIncrement**](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-interlockedincrement) is a compiler intrinsic that returns the incremented value. - -> [!WARNING] 0.3.0.6 -> In a 64-bit driver **InterlockedIncrement** calls **KeReleaseSpinLock** with a lock that it never acquired and an IRQL of 0, as **InterlockedAdd64** does: a call made at `APC_LEVEL` or `DISPATCH_LEVEL` returns at `PASSIVE_LEVEL`. A driver calls **ExInterlockedAddUlong** itself, with a spin lock that it has initialized with **KeInitializeSpinLock**. - -> [!NOTE] 0.3.0.6 +> [!NOTE] 0.3.0.8 > In a 64-bit build **InterlockedIncrement** is a **Sub**, so `n = InterlockedIncrement(v)` is refused with TB5033. In a 32-bit build it compiles. ### IoAcquireRemoveLock @@ -820,11 +812,9 @@ Syntax: **KeAcquireSpinLock**( *SpinLock* ) *SpinLock* : *required* A **LongPtr**, passed by reference: the spin lock, as [**KeInitializeSpinLock**](#KeInitializeSpinLock) initialized it. -In a 64-bit build the function calls [**KeAcquireSpinLockRaiseToDpc**](#KeAcquireSpinLockRaiseToDpc) and returns what it returns. In a 32-bit build it is a **Declare** of `KfAcquireSpinLock` of `hal.dll`. The WDK's `KeAcquireSpinLock` macro writes the IRQL to a second argument instead of returning it. - -> [!WARNING] 0.3.0.6 -> In a 32-bit driver `KfAcquireSpinLock` is a `__fastcall` routine, which takes the lock in a register, but the package declares it without `FastCall` and calls it as a `__stdcall` routine, which pushes the lock on the stack. The routine acquires some other spin lock than the driver's. A driver declares `KfAcquireSpinLock` itself, `FastCall` and with `Lib "hal.dll"`. +In a 64-bit build the function calls [**KeAcquireSpinLockRaiseToDpc**](#KeAcquireSpinLockRaiseToDpc) and returns what it returns. In a 32-bit build it is a `FastCall` **Declare** of `KfAcquireSpinLock` of `hal.dll`, a `__fastcall` routine: see the warning under [Building a driver](.#building-a-driver). The WDK's `KeAcquireSpinLock` macro writes the IRQL to a second argument instead of returning it. + ### KeQuerySystemTime {: #KeQuerySystemTime } @@ -893,8 +883,4 @@ Syntax: **RtlFailFast** *code* *code* : *required* A **Long**: the reason, such as `FAST_FAIL_CORRUPT_LIST_ENTRY` of [**RTL_FAST_FAIL**](#RTL_FAST_FAIL). -The procedure is `Naked` and `CDecl`. The WDK's `RtlFailFast`, the intrinsic `__fastfail`, loads *code* into ECX and raises `int 29h`. - - -> [!NOTE] 0.3.0.6 -> The procedure's code is `mov ecx, 7` and `int 29h`: it raises the fast fail with the reason 7, `FAST_FAIL_FATAL_APP_EXIT`, whatever *code* is, so the bug check names that reason. [**FatalListEntryError**](#FatalListEntryError) passes `FAST_FAIL_CORRUPT_LIST_ENTRY`, 3. +The procedure is `Naked` and `CDecl`. As the WDK's `RtlFailFast`, the intrinsic `__fastfail`, does, it loads *code* into ECX and raises `int 29h`, so the bug check names *code* as the reason. [**FatalListEntryError**](#FatalListEntryError) passes `FAST_FAIL_CORRUPT_LIST_ENTRY`, 3. diff --git a/test/package-tests/tbKMode/writer/writer.mjs b/test/package-tests/tbKMode/writer/writer.mjs index fa77fd44..d7d4357d 100644 --- a/test/package-tests/tbKMode/writer/writer.mjs +++ b/test/package-tests/tbKMode/writer/writer.mjs @@ -53,10 +53,13 @@ const byName = (a, b) => a.toLowerCase().localeCompare(b.toLowerCase()); /** The public names of a module by section, with the members the tables need. */ function packageNames(api, module) { - const mod = api.types.find((t) => t.kind === "module" && t.name === module); - const members = (mod?.members ?? []).filter((m) => m.vis === "public"); + // The page holds every Module of the module's file: tbKMode 0.3.0.8 declares ImageMachineType in + // a Module SuppressedWarnings of modImage.twin, to turn a warning off. + const mods = api.types.filter((t) => t.kind === "module" && t.file === `${module}.twin`); + const group = new Set(mods.map((t) => t.name)); + const members = mods.flatMap((t) => t.members ?? []).filter((m) => m.vis === "public"); const unique = (list) => [...new Set(list.map((x) => x.name))]; - const typesOf = (kind) => unique(api.types.filter((t) => t.in === module && t.kind === kind && t.vis === "public")); + const typesOf = (kind) => unique(api.types.filter((t) => group.has(t.in) && t.kind === kind && t.vis === "public")); // A name that is a procedure in one build and a Declare in another (modWDM's InterlockedIncrement) // is a procedure. const procedures = unique(members.filter((m) => !m.declare && (m.kind === "sub" || m.kind === "function"))); From bb1741d5028d5121b5ce38b6fef4c14d2588a136 Mon Sep 17 00:00:00 2001 From: Kuba Sunderland-Ober Date: Sun, 22 Nov 2026 17:54:23 +0100 Subject: [PATCH 2/4] tbKMode: graduated from Experimental to Contributed at 0.3.0.8, with its book chapter; the SiloContext note says a copy built with NTDDI_VERSION has the field --- WIP.tbKMode.md | 11 ++++++++--- docs/Community/Experimental.md | 1 - docs/Reference/Contributed.md | 1 + docs/Reference/Contributed/tbKMode/index.md | 4 ++-- docs/Reference/Contributed/tbKMode/modWDM.md | 2 +- docs/_book.yml | 8 +++++++- test/package-tests/tbKMode/writer/modWDM/frame.md | 2 +- 7 files changed, 20 insertions(+), 9 deletions(-) diff --git a/WIP.tbKMode.md b/WIP.tbKMode.md index c855103e..38ce4ada 100644 --- a/WIP.tbKMode.md +++ b/WIP.tbKMode.md @@ -7,8 +7,11 @@ about the package beyond its pages; the rules for every contributed package are ## What the section decided (owner) -- **Experimental**, with no second-agent reproduction (owner waived it): `parent: Experimental - Packages`, its line in `Experimental.md`, its folder in `_book.yml`'s `left_out:`. +- **Contributed from 0.3.0.8** (owner, 2026-11-22): Experimental up to 0.3.0.6, with no + second-agent reproduction (owner waived it). 0.3.0.8 fixed every defect reported on #2, #3 and #4, + so it is `parent: Contributed Packages`, its line in `Contributed.md`, and its chapter in + `_book.yml` after VBComDlg's. Its remaining limits are stated in callouts: SiloContext, + KUSER_SHARED_DATA, ExFreePool2, the names shared with VBA, and twinBASIC's 32-bit FastCall defect. - **No driver is ever loaded, installed, signed or started.** Building one is allowed (the probe does), and so is reading a built one. Samples are compiled only (`check_build`), never run. - **Pages**: the landing page and one per module (modWDM, modFltMgr, modSysInfo, modDisk, modImage, @@ -45,7 +48,9 @@ about the package beyond its pages; the rules for every contributed package are - **IO_DRIVER_CREATE_CONTEXT.SiloContext stays a NOTE** (owner, 2026-11-22): fafalone answered on #4 that it is under `#If NTDDI_VERSION >= NTDDI_WIN10_RS1` as in the SDK, but the package defines no NTDDI_VERSION and a project's constants do not reach a package, so the field is never compiled; - the NOTE says why. + the NOTE says why. fafalone, on #4 after 0.3.0.6: `NTDDI_VERSION` is the project's to set, and + defining it in the package would be wrong once twinBASIC passes settings through; so the NOTE + also says that a copy of the package built with it set has the field. ## How the pages are written diff --git a/docs/Community/Experimental.md b/docs/Community/Experimental.md index a4b1bf6d..66f89d9f 100644 --- a/docs/Community/Experimental.md +++ b/docs/Community/Experimental.md @@ -16,7 +16,6 @@ These packages are published through TWINSERV, as the [Contributed Packages](../ - [**GdiPlus**](../Contributed/GdiPlus/) -- Windows GDI+: lines, shapes, text and images drawn with pens, brushes, fonts, paths and transformations. Version 0.9.45.0 compiles, and has many members that give wrong results, fail or do not return: a colour given as a **Long** has its red and blue swapped and loses its alpha, saving an image with encoder parameters fails, the font collections cannot be created, and several path, metafile and effect members fail. - [**Generics**](../Contributed/Generics/) -- tuples, read-only objects that hold one to seven values of declared types. Version 1.0.0.0 does not compile in twinBASIC BETA 1042: the **WinDevLib** package it embeds declares six delegates with no return type, which this build reports as TB0003, an error under WinDevLib's own settings. - [**NewTabCtl**](../Contributed/NewTabCtl/) -- the **NewTab** control, a container with a row of tabs. Version 10.0.289.0 does not compile in twinBASIC BETA 1042: four properties of the control name property pages that the package does not hold, which this build reports as TB5259. -- [**tbKMode**](../Contributed/tbKMode/) -- declarations for writing a Windows kernel-mode driver: the Windows Driver Model, the Filter Manager, system information classes, disk structures and the PE image format. Version 0.3.0.8 compiles, and fixes the declarations of earlier versions that did not match the Windows Driver Kit; two structures are still smaller than C's. A 32-bit driver cannot call a `__fastcall` routine of the kernel, because of a defect of twinBASIC BETA 1042, and a call of the package's **LCase**, **UCase**, **InStr** or **MsgBox** without its module name calls VBA's function. - [**TBMANLIB**](../Contributed/TBMANLIB/) -- a toolkit of helpers: JSON, an HTTP client, logs, INI and CSV files, timers, strings, bytes, files and dictionaries. Version 1.0.0.29 compiles for 32-bit programs, does not compile in a 64-bit build, and has several members that fail or give wrong results. - [**TBMANLIB_Aes**](../Contributed/TBMANLIB_Aes/) -- AES encryption of text and byte arrays. Version 1.0.0.4 compiles, and its cipher modes are not the ones their names say: the default mode, CBC, runs ECB, and the output does not match the standard test vectors. - [**TBMANLIB_ConsoleComponents**](../Contributed/TBMANLIB_ConsoleComponents/) -- text-interface components for console programs: progress bars, charts, tables and panels. Version 1.0.0.1 compiles, and its components cannot use a console object of the published TBMANLIB_ConsoleCore, since the package carries a copy of that package whose types the compiler treats as different. diff --git a/docs/Reference/Contributed.md b/docs/Reference/Contributed.md index 5d65d91c..b9f2ed26 100644 --- a/docs/Reference/Contributed.md +++ b/docs/Reference/Contributed.md @@ -19,6 +19,7 @@ Each package is versioned apart from twinBASIC, and its section says which versi - [**Fmt**](Fmt/) -- **StringFormat**, a string built from a format string and values, in the style of C#'s **String.Format** - [**OLEGuids**](OLEGuids/) -- OLE and COM interfaces and structures in twinBASIC source, in place of `OLEGuids.tlb` - [**tbFileSysTools**](tbFileSysTools/) -- files, folders, drives and text streams, in place of the Scripting Runtime's **FileSystemObject** +- [**tbKMode**](tbKMode/) -- declarations for writing a Windows kernel-mode driver: the Windows Driver Model, the Filter Manager, system information classes, disk structures and the PE image format - [**TBMANLIB_RES**](TBMANLIB_RES/) -- resources embedded in an executable, as bytes, strings, hex, Base64 or pictures - [**tbProjPacker**](tbProjPacker/) -- a `.twinproj` or `.twinpack` file unpacked into a folder of source files, and packed again - [**tbRegExp**](tbRegExp/) -- regular expressions, in place of VBScript's **RegExp** object diff --git a/docs/Reference/Contributed/tbKMode/index.md b/docs/Reference/Contributed/tbKMode/index.md index f26f1c39..bcdeede2 100644 --- a/docs/Reference/Contributed/tbKMode/index.md +++ b/docs/Reference/Contributed/tbKMode/index.md @@ -1,6 +1,6 @@ --- title: tbKMode Package -parent: Experimental Packages +parent: Contributed Packages has_toc: false indexed_from: 0.3.0.8 permalink: /tB/Packages/Contributed/tbKMode/ @@ -60,7 +60,7 @@ The [Build Output Path](../../../IDE/Project-Settings#build-output-path) ends in - [tbKMode Writer](Writer) -- writes the module pages of this section - [Project Settings](../../../IDE/Project-Settings) -- the settings of a driver project - [Project Types](../../../../Features/Project-Configuration/Project-Types#kernel-mode-drivers) -- kernel-mode drivers in twinBASIC -- [Experimental Packages](../../Experimental/) -- the packages from TWINSERV that are not yet ready for use in a program +- [Contributed Packages](..) -- the other packages from TWINSERV ## Test cases diff --git a/docs/Reference/Contributed/tbKMode/modWDM.md b/docs/Reference/Contributed/tbKMode/modWDM.md index d89eef13..94543c0d 100644 --- a/docs/Reference/Contributed/tbKMode/modWDM.md +++ b/docs/Reference/Contributed/tbKMode/modWDM.md @@ -488,7 +488,7 @@ Each structure that the WDK's kernel-mode headers declare has the size of its C > [!NOTE] 0.3.0.8 > These structures are smaller than the C structures: > -> - **IO_DRIVER_CREATE_CONTEXT** lacks C's last field, **SiloContext**: it is 16 bytes where C's is 20 in a 32-bit build, and 32 where C's is 40 in a 64-bit one. The package declares the field under `#If NTDDI_VERSION >= NTDDI_WIN10_RS1`, as the WDK does, but defines no `NTDDI_VERSION`, and a project's conditional constants do not reach a package's code, so the field is never there. Its other fields are at their places. +> - **IO_DRIVER_CREATE_CONTEXT** lacks C's last field, **SiloContext**: it is 16 bytes where C's is 20 in a 32-bit build, and 32 where C's is 40 in a 64-bit one. The package declares the field under `#If NTDDI_VERSION >= NTDDI_WIN10_RS1`, as the WDK does, and leaves `NTDDI_VERSION` to the project that uses it. A project's conditional constants do not reach a package's code, so a driver that references the published package does not have the field. A copy of the package built with `NTDDI_VERSION` set to `NTDDI_WIN10_RS1` or later has it. Its other fields are at their places. > - **KUSER_SHARED_DATA** ends at **Cookie**: it is 824 bytes where the WDK's is 1848, and has none of the WDK's fields after **Cookie**. Its other fields are at their places. ## Aliases diff --git a/docs/_book.yml b/docs/_book.yml index d50d1988..c019457a 100644 --- a/docs/_book.yml +++ b/docs/_book.yml @@ -628,6 +628,13 @@ parts: landing_is_target: true outline_closed: true + - title: tbKMode Package + subtitle: Declarations for writing a Windows kernel-mode driver + landing_page: /tB/Packages/Contributed/tbKMode/ + page: /tB/Packages/Contributed/tbKMode/ + landing_is_target: true + outline_closed: true + - title: VBFLXGRD18 Package subtitle: The VBFlexGrid control, a grid with editing in cells, in place of MSFLXGRD.OCX landing_page: /tB/Packages/Contributed/VBFLXGRD18/ @@ -706,4 +713,3 @@ left_out: - /tB/Packages/Contributed/TBMANLIB_ListBoxHScroll/ - /tB/Packages/Contributed/TBMANLIB_Xml/ - /tB/Packages/Contributed/WinReg/ - - /tB/Packages/Contributed/tbKMode/ diff --git a/test/package-tests/tbKMode/writer/modWDM/frame.md b/test/package-tests/tbKMode/writer/modWDM/frame.md index 60f34495..efcd4350 100644 --- a/test/package-tests/tbKMode/writer/modWDM/frame.md +++ b/test/package-tests/tbKMode/writer/modWDM/frame.md @@ -57,7 +57,7 @@ Each structure that the WDK's kernel-mode headers declare has the size of its C > [!NOTE] 0.3.0.8 > These structures are smaller than the C structures: > -> - **IO_DRIVER_CREATE_CONTEXT** lacks C's last field, **SiloContext**: it is 16 bytes where C's is 20 in a 32-bit build, and 32 where C's is 40 in a 64-bit one. The package declares the field under `#If NTDDI_VERSION >= NTDDI_WIN10_RS1`, as the WDK does, but defines no `NTDDI_VERSION`, and a project's conditional constants do not reach a package's code, so the field is never there. Its other fields are at their places. +> - **IO_DRIVER_CREATE_CONTEXT** lacks C's last field, **SiloContext**: it is 16 bytes where C's is 20 in a 32-bit build, and 32 where C's is 40 in a 64-bit one. The package declares the field under `#If NTDDI_VERSION >= NTDDI_WIN10_RS1`, as the WDK does, and leaves `NTDDI_VERSION` to the project that uses it. A project's conditional constants do not reach a package's code, so a driver that references the published package does not have the field. A copy of the package built with `NTDDI_VERSION` set to `NTDDI_WIN10_RS1` or later has it. Its other fields are at their places. > - **KUSER_SHARED_DATA** ends at **Cookie**: it is 824 bytes where the WDK's is 1848, and has none of the WDK's fields after **Cookie**. Its other fields are at their places. ## Aliases From 7d77d6e751a84e0dcc646dba909fa6a347d4ab97 Mon Sep 17 00:00:00 2001 From: Kuba Sunderland-Ober Date: Sun, 22 Nov 2026 17:56:54 +0100 Subject: [PATCH 3/4] tbKMode: its book chapter in alphabetical order, after tbFileSysTools --- WIP.tbKMode.md | 2 +- docs/_book.yml | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/WIP.tbKMode.md b/WIP.tbKMode.md index 38ce4ada..a7ebb7e8 100644 --- a/WIP.tbKMode.md +++ b/WIP.tbKMode.md @@ -10,7 +10,7 @@ about the package beyond its pages; the rules for every contributed package are - **Contributed from 0.3.0.8** (owner, 2026-11-22): Experimental up to 0.3.0.6, with no second-agent reproduction (owner waived it). 0.3.0.8 fixed every defect reported on #2, #3 and #4, so it is `parent: Contributed Packages`, its line in `Contributed.md`, and its chapter in - `_book.yml` after VBComDlg's. Its remaining limits are stated in callouts: SiloContext, + `_book.yml` in alphabetical order, after tbFileSysTools's (owner). Its remaining limits are stated in callouts: SiloContext, KUSER_SHARED_DATA, ExFreePool2, the names shared with VBA, and twinBASIC's 32-bit FastCall defect. - **No driver is ever loaded, installed, signed or started.** Building one is allowed (the probe does), and so is reading a built one. Samples are compiled only (`check_build`), never run. diff --git a/docs/_book.yml b/docs/_book.yml index c019457a..49d1dac5 100644 --- a/docs/_book.yml +++ b/docs/_book.yml @@ -565,6 +565,13 @@ parts: landing_is_target: true outline_closed: true + - title: tbKMode Package + subtitle: Declarations for writing a Windows kernel-mode driver + landing_page: /tB/Packages/Contributed/tbKMode/ + page: /tB/Packages/Contributed/tbKMode/ + landing_is_target: true + outline_closed: true + - title: TBMANLIB_RES Package subtitle: Resources embedded in an executable, as bytes, strings, hex, Base64 or pictures landing_page: /tB/Packages/Contributed/TBMANLIB_RES/ @@ -628,13 +635,6 @@ parts: landing_is_target: true outline_closed: true - - title: tbKMode Package - subtitle: Declarations for writing a Windows kernel-mode driver - landing_page: /tB/Packages/Contributed/tbKMode/ - page: /tB/Packages/Contributed/tbKMode/ - landing_is_target: true - outline_closed: true - - title: VBFLXGRD18 Package subtitle: The VBFlexGrid control, a grid with editing in cells, in place of MSFLXGRD.OCX landing_page: /tB/Packages/Contributed/VBFLXGRD18/ From 235c80638df536a56f26b45feb3850e555d2e924 Mon Sep 17 00:00:00 2001 From: Kuba Sunderland-Ober Date: Sun, 22 Nov 2026 17:57:31 +0100 Subject: [PATCH 4/4] Contributed packages: a graduated package's book chapter goes in alphabetical order --- WIP.Contributed.md | 2 +- docs/_book.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WIP.Contributed.md b/WIP.Contributed.md index 75e7980e..3eeaf9a3 100644 --- a/WIP.Contributed.md +++ b/WIP.Contributed.md @@ -9,7 +9,7 @@ what it is, in [WIP.PackageTests.md](WIP.PackageTests.md). ## Rules -- **A package's landing page opens, under its H1, with `**Author:**`** (owner): the publisher TWINSERV lists (`publisher` in `indexer/.packages/manifests/contributed.json`), or the author the package's own sources name when that is someone else (VBA_JSON: Tim Hall, published by WaynePhillipsEA). Next to the author, on the same line, `**Version:**`: the version the section documents, which is its `indexed_from` and changes with it (owner). Then `**On GitHub:**` with a link, when a repository holds the package, or the library the package says it is made from; search GitHub for the package's name and the author's account, and check that the repository holds the package's code (its history too: `TBMANLIB_*` were never in woeoio's `tbman`). A landing page with one or two sections has no `* TOC` list. A class with member pages is a folder, `/index.md` at `/tB/Packages/Contributed///` with its members beside it, so a member links to its class as `(.)`; a class documented on one page is `.md`. Each package that is not Experimental is a chapter of the book's Packages part in `_book.yml`. A section's `indexed_from` is the four-part TWINSERV version, and its snapshot is under `indexer/snapshots/contributed/`. **Every NOTE and WARNING of a section is backed by test cases** in the package's test project, `test/package-tests//` (owner; [its README](test/package-tests/README.md)), and names them in a `` marker on the line above it, which `check_package_tests.mjs` in `test.bat` enforces. **A NOTE or WARNING is only for a real difference or limit** (owner): a statement that describes how the package works stays prose, tied to its cases by a region, the marker on a line of its own above it and `` after it (owner). A difference from the object the package replaces that gives a different result silently (tbRegExp's `\1(a)`, `{,m}`, `$~` against VBScript) is a NOTE, not a WARNING (owner). A case checks what is correct, not what the package does (owner): a defect is a failing case, recorded in the project's `expect.json`, so the project tells the package's author what to fix. **A structure that ends in a dynamic array where C has an inline one** (`Items() As T` for `T Items[1]`) **is WinDevLib's deliberate convention, not a defect** (fafalone, 2026-11-17): the program copies the fixed part from a pointer to the raw block, `ReDim`s the array by the structure's count or size field, then copies the entries into `VarPtr(a(0))`. Never report it to WinDevLib, or call it a defect on a page of a package that follows that convention; a page describes the convention instead. Whether one is a defect depends on the package's own convention: tbKMode's six were defects for tbKMode (fixed in 0.3.0.5 as `(0 To 0)`, its upstream issue #2). Before drafting an issue about one, check which convention the package follows. **A declaration that differs from the newest WDK or SDK but is right for the kit the package was written from is not a defect** (owner, 2026-11-17): a package does not claim to follow the newest kit. Find that kit by what the package matches (tbKMode's modSysInfo: the 10.0.22621 SDK, whose `POLICY_AUDIT_SUBCATEGORY_COUNT` is 59 and which has no `FileFsGuidInformation`); a case then checks that kit's value, no callout reports the difference and no issue is drafted about it, and a page may say in prose which kit the value is from. A section whose project is not written yet is in that gate's `PENDING` set. **A package that does not compile on the newest BETA gets no test project** (owner: ArrayListLib, WinReg, Generics): it stays in `PENDING` until a version of it compiles, and a `compile/` folder alone names the rows that refuse it, so its "does not compile" is checked. One that compiles for one architecture only is tested on that one (owner: TBMANLIB, win32; `arches` in its `expect.json`, test/package-tests/README.md), with a compile case for the other. A case that the IDE's own process would change goes in the package folder's `exe/`, which `package_tests.mjs` runs in a built exe (GdiPlus: the IDE has started GDI+; TBMANLIB: an HTTPS server of its own). `package-tests.bat` runs the cases; a case it reports *fixed* means the callout goes. **The landing page ends, after See Also, with `## Test cases`**: one or two sentences linking to `-tests.twinproj` (owner), which the build publishes beside the section without the package's code in it (owner; one exception, owner: TBMANLIB_ConsoleComponents' project carries verbatim copies of seven of its component files, in `Sources/ComponentSources/`, because the package's own components cannot be given a console object, and its drawing can be checked only on the copies): it references the package as a linked package, which the reader puts in `%APPDATA%\twinBASIC\packages` ([WIP.PackageTests.md](WIP.PackageTests.md)). Its samples compile in the `contributed-` sample template, whose `Settings` names the package's version: **change that version with `indexed_from`** ([WIP.ExamplesBuild.md](WIP.ExamplesBuild.md#template-projects)). **A contributed package is documented and its samples compiled against the newest twinBASIC BETA installed, never an older one** (owner): the version that matters is the package's, and a statement about the compiler (such as "does not compile on BETA 1010") names that newest build. **A contributed package that does not compile on that build, or has defects that a program would meet, is listed under Experimental Packages** (owner); a minor defect that the section documents does not make it Experimental (owner: VBComDlg 1.0.13.0, whose Replace All raised no event, stayed Contributed; owner: nor does a fixed limit that the section states at the top of its landing page; owner: tsJson 1.0.15.0 stays Contributed, its defects confirmed by a second agent and each stated in a WARNING with a way round it; owner: xCalendar 1.0.17.0 is Contributed, its text colours working on BETA 1034, its grid and edge-press defects stated in a WARNING). **A package moves from Contributed to Experimental for its defects only after a separate agent has reproduced each defect independently** and ruled out misuse, a wrong expectation, a twinBASIC defect and the harness (owner). **Before any package moves to Experimental, for its defects or because it does not compile, its section is updated to the newest version on TWINSERV** (owner, 2026-11-09): `node indexer/twin-index.mjs sync --upgrade --package ` gives that version; a newer one is documented first (its pages, `indexed_from`, snapshot, sample template and test project), and the move goes ahead only if the newest version still has the defects or still does not compile. The move itself: `docs/Reference/Experimental.md`, at `/tB/Packages/Experimental/`, after Contributed Packages. Its landing page's `parent:` is `Experimental Packages`, its line is in `Experimental.md` and not in `Contributed.md`, and it has no chapter in the PDF book (owner: the book is for packages ready for use in a program): its entry is in `left_out:` of `docs/_book.yml`, in the list of Experimental packages, and the Experimental Packages page is left out with it. Its folder and URLs stay under `Contributed/`, so a package that is fixed moves back by changing only those three and the book (its entry leaves `left_out:` and its chapter is added after VBComDlg's), and its pages keep their addresses. A link from a book page to a left-out one opens the website. +- **A package's landing page opens, under its H1, with `**Author:**`** (owner): the publisher TWINSERV lists (`publisher` in `indexer/.packages/manifests/contributed.json`), or the author the package's own sources name when that is someone else (VBA_JSON: Tim Hall, published by WaynePhillipsEA). Next to the author, on the same line, `**Version:**`: the version the section documents, which is its `indexed_from` and changes with it (owner). Then `**On GitHub:**` with a link, when a repository holds the package, or the library the package says it is made from; search GitHub for the package's name and the author's account, and check that the repository holds the package's code (its history too: `TBMANLIB_*` were never in woeoio's `tbman`). A landing page with one or two sections has no `* TOC` list. A class with member pages is a folder, `/index.md` at `/tB/Packages/Contributed///` with its members beside it, so a member links to its class as `(.)`; a class documented on one page is `.md`. Each package that is not Experimental is a chapter of the book's Packages part in `_book.yml`. A section's `indexed_from` is the four-part TWINSERV version, and its snapshot is under `indexer/snapshots/contributed/`. **Every NOTE and WARNING of a section is backed by test cases** in the package's test project, `test/package-tests//` (owner; [its README](test/package-tests/README.md)), and names them in a `` marker on the line above it, which `check_package_tests.mjs` in `test.bat` enforces. **A NOTE or WARNING is only for a real difference or limit** (owner): a statement that describes how the package works stays prose, tied to its cases by a region, the marker on a line of its own above it and `` after it (owner). A difference from the object the package replaces that gives a different result silently (tbRegExp's `\1(a)`, `{,m}`, `$~` against VBScript) is a NOTE, not a WARNING (owner). A case checks what is correct, not what the package does (owner): a defect is a failing case, recorded in the project's `expect.json`, so the project tells the package's author what to fix. **A structure that ends in a dynamic array where C has an inline one** (`Items() As T` for `T Items[1]`) **is WinDevLib's deliberate convention, not a defect** (fafalone, 2026-11-17): the program copies the fixed part from a pointer to the raw block, `ReDim`s the array by the structure's count or size field, then copies the entries into `VarPtr(a(0))`. Never report it to WinDevLib, or call it a defect on a page of a package that follows that convention; a page describes the convention instead. Whether one is a defect depends on the package's own convention: tbKMode's six were defects for tbKMode (fixed in 0.3.0.5 as `(0 To 0)`, its upstream issue #2). Before drafting an issue about one, check which convention the package follows. **A declaration that differs from the newest WDK or SDK but is right for the kit the package was written from is not a defect** (owner, 2026-11-17): a package does not claim to follow the newest kit. Find that kit by what the package matches (tbKMode's modSysInfo: the 10.0.22621 SDK, whose `POLICY_AUDIT_SUBCATEGORY_COUNT` is 59 and which has no `FileFsGuidInformation`); a case then checks that kit's value, no callout reports the difference and no issue is drafted about it, and a page may say in prose which kit the value is from. A section whose project is not written yet is in that gate's `PENDING` set. **A package that does not compile on the newest BETA gets no test project** (owner: ArrayListLib, WinReg, Generics): it stays in `PENDING` until a version of it compiles, and a `compile/` folder alone names the rows that refuse it, so its "does not compile" is checked. One that compiles for one architecture only is tested on that one (owner: TBMANLIB, win32; `arches` in its `expect.json`, test/package-tests/README.md), with a compile case for the other. A case that the IDE's own process would change goes in the package folder's `exe/`, which `package_tests.mjs` runs in a built exe (GdiPlus: the IDE has started GDI+; TBMANLIB: an HTTPS server of its own). `package-tests.bat` runs the cases; a case it reports *fixed* means the callout goes. **The landing page ends, after See Also, with `## Test cases`**: one or two sentences linking to `-tests.twinproj` (owner), which the build publishes beside the section without the package's code in it (owner; one exception, owner: TBMANLIB_ConsoleComponents' project carries verbatim copies of seven of its component files, in `Sources/ComponentSources/`, because the package's own components cannot be given a console object, and its drawing can be checked only on the copies): it references the package as a linked package, which the reader puts in `%APPDATA%\twinBASIC\packages` ([WIP.PackageTests.md](WIP.PackageTests.md)). Its samples compile in the `contributed-` sample template, whose `Settings` names the package's version: **change that version with `indexed_from`** ([WIP.ExamplesBuild.md](WIP.ExamplesBuild.md#template-projects)). **A contributed package is documented and its samples compiled against the newest twinBASIC BETA installed, never an older one** (owner): the version that matters is the package's, and a statement about the compiler (such as "does not compile on BETA 1010") names that newest build. **A contributed package that does not compile on that build, or has defects that a program would meet, is listed under Experimental Packages** (owner); a minor defect that the section documents does not make it Experimental (owner: VBComDlg 1.0.13.0, whose Replace All raised no event, stayed Contributed; owner: nor does a fixed limit that the section states at the top of its landing page; owner: tsJson 1.0.15.0 stays Contributed, its defects confirmed by a second agent and each stated in a WARNING with a way round it; owner: xCalendar 1.0.17.0 is Contributed, its text colours working on BETA 1034, its grid and edge-press defects stated in a WARNING). **A package moves from Contributed to Experimental for its defects only after a separate agent has reproduced each defect independently** and ruled out misuse, a wrong expectation, a twinBASIC defect and the harness (owner). **Before any package moves to Experimental, for its defects or because it does not compile, its section is updated to the newest version on TWINSERV** (owner, 2026-11-09): `node indexer/twin-index.mjs sync --upgrade --package ` gives that version; a newer one is documented first (its pages, `indexed_from`, snapshot, sample template and test project), and the move goes ahead only if the newest version still has the defects or still does not compile. The move itself: `docs/Reference/Experimental.md`, at `/tB/Packages/Experimental/`, after Contributed Packages. Its landing page's `parent:` is `Experimental Packages`, its line is in `Experimental.md` and not in `Contributed.md`, and it has no chapter in the PDF book (owner: the book is for packages ready for use in a program): its entry is in `left_out:` of `docs/_book.yml`, in the list of Experimental packages, and the Experimental Packages page is left out with it. Its folder and URLs stay under `Contributed/`, so a package that is fixed moves back by changing only those three and the book (its entry leaves `left_out:` and its chapter is added among the others in alphabetical order, as tbKMode's after tbFileSysTools's, owner), and its pages keep their addresses. A link from a book page to a left-out one opens the website. - `package-tests.bat` --- runs the test projects of the contributed packages named (in any case: `tbregexp`), or of every one with `--all-packages`, which is never the default and leaves out GdiPlus, run only when named (owner; `ALL_PACKAGES_SKIP` in `lib/package-tests.mjs`, which np4 in the launcher repository reads too) (`scripts/package_tests.mjs`): each project under `test/package-tests/` is staged with its package embedded and run with `tbrun --tests` as 32-bit and 64-bit, and each case is judged against `expect.json` as *documented*, *fixed* (the callout goes) or *changed* (a claim of the page is no longer true). `--update` writes `expect.json` from the run; read every entry it writes, since each is a claim that the package is defective. A case that never returns is caught and run alone. It also rewrites the generated `RunAll.twin`. Outside every gate and CI, as `examples.bat` is. The build publishes each project, referencing the package as a linked package and carrying none of its code, as `tB/Packages/Contributed//-tests.twinproj` in the online tree (the `packageTests` task, `builder/package-tests.mjs`, `_config.yml`'s `package_tests`; the publish allowlist exempts those paths, and the offline tree's links go to the website). diff --git a/docs/_book.yml b/docs/_book.yml index 49d1dac5..b5794228 100644 --- a/docs/_book.yml +++ b/docs/_book.yml @@ -690,7 +690,7 @@ left_out: no_descent: true # A package moves here from its chapter when it is listed under - # Experimental Packages, and gets its chapter back (after VBComDlg's) when + # Experimental Packages, and gets its chapter back (in alphabetical order) when # it moves back to Contributed Packages. A section's pages share its folder # URL, so one entry covers a package; a prefix ending in `/` cannot match # another package whose name begins the same (TBMANLIB, TBMANLIB_Aes).