add ntfs.sys standalone driver target, change default usb vhd layout formatting to ntfs, implement Fat32CreateDir for directory creation support in the fat32 file system driver, add a dedicated HAL serial output endpoint for COM1 writes in hal_serial.c and subscribe serial to HAL text streams, introduce waitable kernel timers with KeTimerCreate, KeTimerSet, and KeTimerCancel alongside spinlock-protected global timer list initialization and scheduler tick tracking, implement SyscallWriteFileAsync system call for asynchronous non-blocking file writes, refactor NetSocketConnect and NetSocketSendTo to use generic SYS_SOCKET_ADDRESS_K structures instead of being hardcoded to IPv4, update gethostbyname and DNS name resolution to support IPv6 parsing via ResolveNameFamily, update tcpserve.exe with -4 and -6 command-line flags to accept and display IPv6 addresses, append size and version headers to all kernel telemetry and statistics structures including SYS_PMM_STATS, SYS_CPU_STATS, and SYS_SCHEDULER_STATS, update winmm timeGetTime to look up high-resolution hardware frequencies via SysGetTickFrequency, integrate 14 native smoke test applications.
This commit is contained in:
1 parent
2c4a68a75f
commit
ed3d065abd
156 files changed
+10509
-2643
No files matched your search
+62
-57
@@ -1,70 +1,75 @@
|
||||
// Public NTLite status ABI declarations shared between kernel, drivers, and user mode.
|
||||
|
||||
#pragma once
|
||||
// ke_status.h - kernel status codes
|
||||
// All fallible kernel functions return KSTATUS.
|
||||
// Success is always zero; failures are positive named constants.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// All fallible kernel functions return KSTATUS. Bit 31 is the error bit, bits
|
||||
// 30..24 identify the facility, and bits 23..0 contain the facility-local code.
|
||||
typedef uint32_t KSTATUS;
|
||||
|
||||
// --- General & Control (0x0000) ---.
|
||||
#define STATUS_SUCCESS ((KSTATUS)0x0000)
|
||||
#define STATUS_FAILURE ((KSTATUS)0x0001)
|
||||
#define STATUS_NOT_SUPPORTED ((KSTATUS)0x0002)
|
||||
#define STATUS_TIMEOUT ((KSTATUS)0x0003)
|
||||
#define STATUS_PENDING ((KSTATUS)0x0004)
|
||||
#define STATUS_ALERTED ((KSTATUS)0x0005)
|
||||
#define STATUS_KERNEL_APC ((KSTATUS)0x0006)
|
||||
#define STATUS_USER_APC ((KSTATUS)0x0007)
|
||||
#define KSTATUS_ERROR_BIT 0x80000000u
|
||||
#define KSTATUS_FACILITY_SHIFT 24u
|
||||
#define KSTATUS_FACILITY_MASK 0x7Fu
|
||||
#define KSTATUS_CODE_MASK 0x00FFFFFFu
|
||||
|
||||
// --- Validation & Parameters (0x0010) ---.
|
||||
#define STATUS_INVALID_PARAMETER ((KSTATUS)0x0010)
|
||||
#define STATUS_INVALID_HANDLE ((KSTATUS)0x0011)
|
||||
#define STATUS_BUFFER_TOO_SMALL ((KSTATUS)0x0012)
|
||||
#define STATUS_CHECKSUM_MISMATCH ((KSTATUS)0x0013)
|
||||
#define KSTATUS_MAKE_SUCCESS(facility, code) \
|
||||
((KSTATUS)((((uint32_t)(facility) & KSTATUS_FACILITY_MASK) << KSTATUS_FACILITY_SHIFT) | \
|
||||
((uint32_t)(code) & KSTATUS_CODE_MASK)))
|
||||
#define KSTATUS_MAKE_ERROR(facility, code) \
|
||||
((KSTATUS)(KSTATUS_ERROR_BIT | \
|
||||
(((uint32_t)(facility) & KSTATUS_FACILITY_MASK) << KSTATUS_FACILITY_SHIFT) | \
|
||||
((uint32_t)(code) & KSTATUS_CODE_MASK)))
|
||||
#define KSTATUS_IS_ERROR(status) ((((KSTATUS)(status)) & KSTATUS_ERROR_BIT) != 0u)
|
||||
#define KSTATUS_FACILITY(status) ((((KSTATUS)(status)) >> KSTATUS_FACILITY_SHIFT) & KSTATUS_FACILITY_MASK)
|
||||
#define KSTATUS_CODE(status) (((KSTATUS)(status)) & KSTATUS_CODE_MASK)
|
||||
|
||||
// --- Resource & Access (0x0020) ---.
|
||||
#define STATUS_NO_MEMORY ((KSTATUS)0x0020)
|
||||
#define STATUS_ACCESS_DENIED ((KSTATUS)0x0021)
|
||||
#define STATUS_NOT_FOUND ((KSTATUS)0x0022)
|
||||
#define STATUS_ALREADY_EXISTS ((KSTATUS)0x0023)
|
||||
#define STATUS_OBJECT_NAME_COLLISION ((KSTATUS)0x0024)
|
||||
#define STATUS_FACILITY_WAIT 0x00u
|
||||
#define STATUS_FACILITY_SYSTEM 0x01u
|
||||
#define STATUS_FACILITY_PROCESS 0x61u
|
||||
|
||||
// --- State & Lifecycle (0x0030) ---.
|
||||
#define STATUS_OBJECT_DEAD ((KSTATUS)0x0030)
|
||||
#define STATUS_QUEUE_FULL ((KSTATUS)0x0031)
|
||||
#define STATUS_QUEUE_EMPTY ((KSTATUS)0x0032)
|
||||
#define STATUS_CANCELLED ((KSTATUS)0x0033)
|
||||
// Wait-completion statuses are non-error statuses. STATUS_SUCCESS is exactly
|
||||
// zero so old zero-initialisation and direct syscall success checks stay valid.
|
||||
#define STATUS_SUCCESS ((KSTATUS)0x00000000u)
|
||||
#define STATUS_TIMEOUT KSTATUS_MAKE_SUCCESS(STATUS_FACILITY_WAIT, 0x000001u)
|
||||
#define STATUS_PENDING KSTATUS_MAKE_SUCCESS(STATUS_FACILITY_WAIT, 0x000002u)
|
||||
#define STATUS_ALERTED KSTATUS_MAKE_SUCCESS(STATUS_FACILITY_WAIT, 0x000003u)
|
||||
#define STATUS_KERNEL_APC KSTATUS_MAKE_SUCCESS(STATUS_FACILITY_WAIT, 0x000004u)
|
||||
#define STATUS_USER_APC KSTATUS_MAKE_SUCCESS(STATUS_FACILITY_WAIT, 0x000005u)
|
||||
|
||||
// --- Hardware & External (0x0040) ---.
|
||||
#define STATUS_DEVICE_ERROR ((KSTATUS)0x0040)
|
||||
// System-facility failures.
|
||||
// STATUS_WOULD_BLOCK is the canonical result for immediate nonblocking operations that cannot make progress.
|
||||
// STATUS_TIMEOUT is reserved for finite waits whose deadline expires.
|
||||
#define STATUS_FAILURE KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000001u)
|
||||
#define STATUS_NOT_SUPPORTED KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000002u)
|
||||
#define STATUS_INVALID_PARAMETER KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000003u)
|
||||
#define STATUS_INVALID_HANDLE KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000004u)
|
||||
#define STATUS_BUFFER_TOO_SMALL KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000005u)
|
||||
#define STATUS_CHECKSUM_MISMATCH KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000006u)
|
||||
#define STATUS_NO_MEMORY KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000007u)
|
||||
#define STATUS_ACCESS_DENIED KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000008u)
|
||||
#define STATUS_NOT_FOUND KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000009u)
|
||||
#define STATUS_ALREADY_EXISTS KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x00000Au)
|
||||
#define STATUS_OBJECT_NAME_COLLISION KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x00000Bu)
|
||||
#define STATUS_OBJECT_DEAD KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x00000Cu)
|
||||
#define STATUS_QUEUE_FULL KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x00000Du)
|
||||
#define STATUS_QUEUE_EMPTY KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x00000Eu)
|
||||
#define STATUS_CANCELLED KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x00000Fu)
|
||||
#define STATUS_DEVICE_ERROR KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000010u)
|
||||
#define STATUS_NO_MORE_FILES KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000011u)
|
||||
#define STATUS_INVALID_IRQL KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000012u)
|
||||
#define STATUS_WOULD_BLOCK KSTATUS_MAKE_ERROR(STATUS_FACILITY_SYSTEM, 0x000013u)
|
||||
|
||||
#define STATUS_NO_MORE_FILES ((KSTATUS)0x0050)
|
||||
// Process termination and fault statuses use the process facility.
|
||||
#define STATUS_PROCESS_BASE KSTATUS_MAKE_ERROR(STATUS_FACILITY_PROCESS, 0x000000u)
|
||||
#define STATUS_PROCESS_KILLED KSTATUS_MAKE_ERROR(STATUS_FACILITY_PROCESS, 0x000000u)
|
||||
#define STATUS_PROCESS_PAGE_FAULT KSTATUS_MAKE_ERROR(STATUS_FACILITY_PROCESS, 0x000010u)
|
||||
#define STATUS_PROCESS_GENERAL_PROTECTION KSTATUS_MAKE_ERROR(STATUS_FACILITY_PROCESS, 0x000011u)
|
||||
#define STATUS_PROCESS_ILLEGAL_OPCODE KSTATUS_MAKE_ERROR(STATUS_FACILITY_PROCESS, 0x000012u)
|
||||
#define STATUS_PROCESS_DIVIDE_BY_ZERO KSTATUS_MAKE_ERROR(STATUS_FACILITY_PROCESS, 0x000013u)
|
||||
#define STATUS_PROCESS_BREAKPOINT KSTATUS_MAKE_ERROR(STATUS_FACILITY_PROCESS, 0x000014u)
|
||||
#define STATUS_PROCESS_ALIGNMENT_FAULT KSTATUS_MAKE_ERROR(STATUS_FACILITY_PROCESS, 0x000015u)
|
||||
#define STATUS_PROCESS_UNKNOWN_FAULT KSTATUS_MAKE_ERROR(STATUS_FACILITY_PROCESS, 0x00001Fu)
|
||||
|
||||
// --- Execution level (0x0060) ---.
|
||||
#define STATUS_INVALID_IRQL ((KSTATUS)0x0060)
|
||||
|
||||
// --- Process termination reasons ---.
|
||||
// Low values are reserved for ordinary KSTATUS returns. Abnormal process
|
||||
// termination uses a high-bit private range so exit statuses cannot collide
|
||||
// with normal kernel/API result codes.
|
||||
//
|
||||
// Layout:
|
||||
// 31 : set => abnormal/private status
|
||||
// 30..24 : subsystem group
|
||||
// 23..0 : group-local reason
|
||||
//
|
||||
// Group 0x61 is process termination/fault status.
|
||||
#define STATUS_PRIVATE_BASE ((KSTATUS)0x80000000u)
|
||||
#define STATUS_PROCESS_BASE ((KSTATUS)0xE1000000u)
|
||||
#define STATUS_PROCESS_KILLED ((KSTATUS)(STATUS_PROCESS_BASE | 0x0000u))
|
||||
#define STATUS_PROCESS_PAGE_FAULT ((KSTATUS)(STATUS_PROCESS_BASE | 0x0010u))
|
||||
#define STATUS_PROCESS_GENERAL_PROTECTION ((KSTATUS)(STATUS_PROCESS_BASE | 0x0011u))
|
||||
#define STATUS_PROCESS_ILLEGAL_OPCODE ((KSTATUS)(STATUS_PROCESS_BASE | 0x0012u))
|
||||
#define STATUS_PROCESS_DIVIDE_BY_ZERO ((KSTATUS)(STATUS_PROCESS_BASE | 0x0013u))
|
||||
#define STATUS_PROCESS_BREAKPOINT ((KSTATUS)(STATUS_PROCESS_BASE | 0x0014u))
|
||||
#define STATUS_PROCESS_ALIGNMENT_FAULT ((KSTATUS)(STATUS_PROCESS_BASE | 0x0015u))
|
||||
#define STATUS_PROCESS_UNKNOWN_FAULT ((KSTATUS)(STATUS_PROCESS_BASE | 0x001Fu))
|
||||
|
||||
#define KSUCCESS(s) ((s) == STATUS_SUCCESS)
|
||||
#define KSUCCESS(status) (((KSTATUS)(status)) == STATUS_SUCCESS)
|
||||
#define KFAILED(status) KSTATUS_IS_ERROR(status)
|
||||
Reference in new issue
Block a user