Skip to content

fix: correct ZwCreateFile disposition, NTSTATUS errors, recursion, an…#10

Merged
TorinKS merged 1 commit intomainfrom
change/fix-mixed-bugs
Mar 22, 2026
Merged

fix: correct ZwCreateFile disposition, NTSTATUS errors, recursion, an…#10
TorinKS merged 1 commit intomainfrom
change/fix-mixed-bugs

Conversation

@TorinKS
Copy link
Copy Markdown
Owner

@TorinKS TorinKS commented Mar 22, 2026

…d debug buffer

ZwCreateFile (File.c): return correct IoStatusBlock->Information based on actual disposition (FILE_CREATED, FILE_OPENED, FILE_SUPERSEDED, etc.) using GetLastError() after CreateFileW. Add missing error translations for STATUS_OBJECT_NAME_COLLISION, STATUS_SHARING_VIOLATION, STATUS_OBJECT_PATH_NOT_FOUND.

ZwDeleteKey/ZwDeleteKeyEx (Registry.c): convert LSTATUS to proper NTSTATUS codes via RegistryErrorToNtstatus helper instead of returning raw Win32 error values.

ExAcquireResourceExclusiveLite/SharedLite (Resource.c): replace unbounded recursion with for(;;) loop to prevent stack overflow under sustained contention.

DebugPrintInternal (Debug.h): always null-terminate stack buffer even when _vsnprintf_s fills it completely, preventing printf from reading past the buffer.

NtStatus.h: add STATUS_OBJECT_NAME_COLLISION, STATUS_SHARING_VIOLATION.

Tests updated to match corrected kernel semantics.

…d debug buffer

ZwCreateFile (File.c): return correct IoStatusBlock->Information based on
actual disposition (FILE_CREATED, FILE_OPENED, FILE_SUPERSEDED, etc.)
using GetLastError() after CreateFileW. Add missing error translations
for STATUS_OBJECT_NAME_COLLISION, STATUS_SHARING_VIOLATION,
STATUS_OBJECT_PATH_NOT_FOUND.

ZwDeleteKey/ZwDeleteKeyEx (Registry.c): convert LSTATUS to proper
NTSTATUS codes via RegistryErrorToNtstatus helper instead of returning
raw Win32 error values.

ExAcquireResourceExclusiveLite/SharedLite (Resource.c): replace
unbounded recursion with for(;;) loop to prevent stack overflow under
sustained contention.

DebugPrintInternal (Debug.h): always null-terminate stack buffer even
when _vsnprintf_s fills it completely, preventing printf from reading
past the buffer.

NtStatus.h: add STATUS_OBJECT_NAME_COLLISION, STATUS_SHARING_VIOLATION.

Tests updated to match corrected kernel semantics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@TorinKS TorinKS merged commit 9ea7e61 into main Mar 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant