Skip to main content

Overview

SysWhispers4 provides NT-level file I/O functions that bypass user-mode hooks on kernel32.dll file functions like CreateFile, ReadFile, WriteFile, etc.

NtCreateFile

Creates or opens a file.

Parameters

FileHandle
PHANDLE
required
Pointer to variable that receives the file handle.
DesiredAccess
ACCESS_MASK
required
Access rights:
  • FILE_READ_DATA (0x0001)
  • FILE_WRITE_DATA (0x0002)
  • FILE_APPEND_DATA (0x0004)
  • GENERIC_READ (0x80000000)
  • GENERIC_WRITE (0x40000000)
ObjectAttributes
POBJECT_ATTRIBUTES
required
Pointer to OBJECT_ATTRIBUTES structure containing the file path:
IoStatusBlock
PIO_STATUS_BLOCK
required
Pointer to IO_STATUS_BLOCK structure that receives I/O status.
AllocationSize
PLARGE_INTEGER
Initial allocation size. Use NULL for default.
FileAttributes
ULONG
required
File attributes:
  • FILE_ATTRIBUTE_NORMAL (0x80)
  • FILE_ATTRIBUTE_HIDDEN (0x02)
  • FILE_ATTRIBUTE_READONLY (0x01)
ShareAccess
ULONG
required
Sharing mode:
  • FILE_SHARE_READ (0x01)
  • FILE_SHARE_WRITE (0x02)
  • FILE_SHARE_DELETE (0x04)
  • 0 for exclusive access
CreateDisposition
ULONG
required
Action to take:
  • FILE_SUPERSEDE (0) — Replace if exists
  • FILE_OPEN (1) — Open existing (fail if not exists)
  • FILE_CREATE (2) — Create new (fail if exists)
  • FILE_OPEN_IF (3) — Open existing or create
  • FILE_OVERWRITE (4) — Overwrite existing
  • FILE_OVERWRITE_IF (5) — Overwrite or create
CreateOptions
ULONG
required
Options:
  • FILE_SYNCHRONOUS_IO_NONALERT (0x20) — Synchronous I/O
  • FILE_NON_DIRECTORY_FILE (0x40) — Must be a file
  • FILE_DELETE_ON_CLOSE (0x1000) — Delete when closed
EaBuffer
PVOID
Extended attributes buffer (usually NULL).
EaLength
ULONG
Extended attributes length (usually 0).

Example: Create and Write File


NtOpenFile

Opens an existing file (simpler than NtCreateFile).

Example


NtReadFile

Reads data from a file.

Parameters

FileHandle
HANDLE
required
Handle to the file (from NtOpenFile or NtCreateFile).
Event
HANDLE
Optional event handle to signal on completion (use NULL for synchronous).
ApcRoutine
PVOID
Optional APC routine (use NULL).
ApcContext
PVOID
Optional APC context (use NULL).
IoStatusBlock
PIO_STATUS_BLOCK
required
Receives I/O status. Check iosb.Information for bytes read.
Buffer
PVOID
required
Buffer that receives the data.
Length
ULONG
required
Number of bytes to read.
ByteOffset
PLARGE_INTEGER
File offset to read from. Use NULL to read from current position.
Key
PULONG
Optional file key (use NULL).

Example


NtWriteFile

Writes data to a file.

Example


NtDeleteFile

Deletes a file.

Example


NT Path Format

NT functions require NT path format, not Win32 paths.

Conversion Table

Helper: Convert Win32 to NT Path


Complete Example: File Dropper

Drop a file to disk via syscalls:

Advantages Over Win32 File APIs


Next Steps

Token Functions

Token manipulation and privilege escalation

Evasion Helpers

ETW bypass, AMSI bypass, unhooking