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

PHANDLE
required
Pointer to variable that receives the file handle.
ACCESS_MASK
required
Access rights:
  • FILE_READ_DATA (0x0001)
  • FILE_WRITE_DATA (0x0002)
  • FILE_APPEND_DATA (0x0004)
  • GENERIC_READ (0x80000000)
  • GENERIC_WRITE (0x40000000)
POBJECT_ATTRIBUTES
required
Pointer to OBJECT_ATTRIBUTES structure containing the file path:
PIO_STATUS_BLOCK
required
Pointer to IO_STATUS_BLOCK structure that receives I/O status.
PLARGE_INTEGER
Initial allocation size. Use NULL for default.
ULONG
required
File attributes:
  • FILE_ATTRIBUTE_NORMAL (0x80)
  • FILE_ATTRIBUTE_HIDDEN (0x02)
  • FILE_ATTRIBUTE_READONLY (0x01)
ULONG
required
Sharing mode:
  • FILE_SHARE_READ (0x01)
  • FILE_SHARE_WRITE (0x02)
  • FILE_SHARE_DELETE (0x04)
  • 0 for exclusive access
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
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
PVOID
Extended attributes buffer (usually NULL).
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

HANDLE
required
Handle to the file (from NtOpenFile or NtCreateFile).
HANDLE
Optional event handle to signal on completion (use NULL for synchronous).
PVOID
Optional APC routine (use NULL).
PVOID
Optional APC context (use NULL).
PIO_STATUS_BLOCK
required
Receives I/O status. Check iosb.Information for bytes read.
PVOID
required
Buffer that receives the data.
ULONG
required
Number of bytes to read.
PLARGE_INTEGER
File offset to read from. Use NULL to read from current position.
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