clean up and standardize types across the codebase, unify atomic operations, improve UTF-8 handling throughout the system, remove obsolete input and named queue interfaces, redesign process preparation and creation, tighten IPC and service boundaries, improve error handling and reliability, minor documentation cleanup, fix doom surfaces, fix panic in ini parsing.
This commit is contained in:
1 parent
899225f551
commit
c0ad63c27f
226 files changed
+6562
-4147
No files matched your search
@@ -75,6 +75,15 @@ typedef struct SYS_TEB {
|
||||
void* SubsystemData;
|
||||
} SYS_TEB;
|
||||
|
||||
// User bootstrap is consumed by the kernel, loader and personalities.
|
||||
_Static_assert(sizeof(SYS_STARTUP_CAPABILITY) == 8u, "SYS_STARTUP_CAPABILITY ABI size changed");
|
||||
_Static_assert(offsetof(SYS_PEB, ImagePath) == 16u, "SYS_PEB ImagePath offset changed");
|
||||
_Static_assert(offsetof(SYS_PEB, LoaderData) == 64u, "SYS_PEB LoaderData offset changed");
|
||||
_Static_assert(sizeof(SYS_PEB) == 72u, "SYS_PEB ABI size changed");
|
||||
_Static_assert(offsetof(SYS_TEB, Peb) == 0u, "SYS_TEB GS:[0] PEB pointer changed");
|
||||
_Static_assert(offsetof(SYS_TEB, SubsystemData) == 40u, "SYS_TEB personality slot offset changed");
|
||||
_Static_assert(sizeof(SYS_TEB) == 48u, "SYS_TEB ABI size changed");
|
||||
|
||||
#endif // SYS_USER_ENV_TYPES_DEFINED
|
||||
|
||||
// Returns the current thread's process environment block.
|
||||
@@ -104,9 +113,13 @@ static inline SYS_TEB* SysGetTeb(void) {
|
||||
|
||||
// APC and async I/O ABI.
|
||||
typedef struct SYS_IO_STATUS_BLOCK {
|
||||
volatile uint32_t Status;
|
||||
volatile KSTATUS Status;
|
||||
volatile uint64_t Information;
|
||||
} SYS_IO_STATUS_BLOCK;
|
||||
// A completion status is a native KSTATUS even when written asynchronously.
|
||||
_Static_assert(sizeof(SYS_IO_STATUS_BLOCK) == 16u, "SYS_IO_STATUS_BLOCK size changed");
|
||||
_Static_assert(offsetof(SYS_IO_STATUS_BLOCK, Information) == 8u, "SYS_IO_STATUS_BLOCK Information offset changed");
|
||||
|
||||
|
||||
typedef void (*SYS_USER_APC_ROUTINE)(void* normalContext,
|
||||
SYS_IO_STATUS_BLOCK* iosb,
|
||||
@@ -549,20 +562,27 @@ typedef struct SYS_PIPE_SHARED_STATE {
|
||||
uint32_t Version;
|
||||
uint32_t Capacity;
|
||||
uint32_t HeaderBytes;
|
||||
volatile long ReaderOpen;
|
||||
volatile long WriterOpen;
|
||||
volatile int32_t ReaderOpen;
|
||||
volatile int32_t WriterOpen;
|
||||
uint8_t HeaderReserved[SYS_PIPE_SHARED_HEADER_BYTES - 24u];
|
||||
|
||||
volatile uint64_t ReadPosition;
|
||||
volatile uint64_t WritePosition;
|
||||
volatile long ReadLock;
|
||||
volatile long WriteLock;
|
||||
volatile long ReadWaiters;
|
||||
volatile long WriteWaiters;
|
||||
volatile int32_t ReadLock;
|
||||
volatile int32_t WriteLock;
|
||||
volatile int32_t ReadWaiters;
|
||||
volatile int32_t WriteWaiters;
|
||||
uint8_t RingReserved[16];
|
||||
uint8_t Buffer[SYS_PIPE_BUFFER_CAPACITY];
|
||||
} SYS_PIPE_SHARED_STATE;
|
||||
|
||||
_Static_assert(offsetof(SYS_PIPE_SHARED_STATE, ReadPosition) == SYS_PIPE_SHARED_HEADER_BYTES,
|
||||
"SYS_PIPE_SHARED_STATE control page layout changed");
|
||||
_Static_assert(offsetof(SYS_PIPE_SHARED_STATE, Buffer) == SYS_PIPE_SHARED_HEADER_BYTES + 48u,
|
||||
"SYS_PIPE_SHARED_STATE ring layout changed");
|
||||
_Static_assert(sizeof(SYS_PIPE_SHARED_STATE) == SYS_PIPE_SHARED_HEADER_BYTES + 48u + SYS_PIPE_BUFFER_CAPACITY,
|
||||
"SYS_PIPE_SHARED_STATE ABI size changed");
|
||||
|
||||
typedef struct SYS_CREATE_PIPE_REQUEST {
|
||||
uint32_t Size;
|
||||
uint32_t Flags;
|
||||
@@ -581,32 +601,6 @@ typedef struct SYS_PRINT_DEBUG_REQUEST {
|
||||
SYS_STRING_VIEW Text;
|
||||
} SYS_PRINT_DEBUG_REQUEST;
|
||||
|
||||
// Published queue names are owned by the publishing process and QueueHandle.
|
||||
// SysUnpublishQueue withdraws a name explicitly. Closing the publishing handle
|
||||
// or exiting the process withdraws every name published through that handle.
|
||||
typedef struct SYS_PUBLISH_QUEUE_REQUEST {
|
||||
uint32_t Size;
|
||||
SYS_STRING_VIEW Name;
|
||||
SYS_HANDLE QueueHandle;
|
||||
} SYS_PUBLISH_QUEUE_REQUEST;
|
||||
|
||||
typedef struct SYS_UNPUBLISH_QUEUE_REQUEST {
|
||||
uint32_t Size;
|
||||
SYS_STRING_VIEW Name;
|
||||
} SYS_UNPUBLISH_QUEUE_REQUEST;
|
||||
|
||||
typedef struct SYS_OPEN_NAMED_QUEUE_REQUEST {
|
||||
uint32_t Size;
|
||||
SYS_STRING_VIEW Name;
|
||||
SYS_HANDLE* HandleOut;
|
||||
} SYS_OPEN_NAMED_QUEUE_REQUEST;
|
||||
|
||||
typedef struct SYS_NAMED_QUEUE_OWNER_REQUEST {
|
||||
uint32_t Size;
|
||||
SYS_STRING_VIEW Name;
|
||||
SYS_RIGHTS DesiredAccess;
|
||||
SYS_HANDLE* ProcessHandleOut;
|
||||
} SYS_NAMED_QUEUE_OWNER_REQUEST;
|
||||
|
||||
#define SYS_QUEUE_FLAG_NONE 0x00000000u
|
||||
#define SYS_QUEUE_MESSAGE_SIZE 56u
|
||||
@@ -695,12 +689,6 @@ KSTATUS SysProtectProcessVm(SYS_HANDLE processHandle, void* base, size_t pageCou
|
||||
KSTATUS SysStartProcess(const SYS_START_PROCESS_REQUEST* request);
|
||||
KSTATUS SysWaitSingle(SYS_HANDLE handle, uint32_t flags, uint64_t timeoutMilliseconds);
|
||||
KSTATUS SysWaitMany(const SYS_WAIT_MANY_REQUEST* request);
|
||||
// SysOpenInputQueue returns a readable and waitable handle to the default
|
||||
// keyboard input queue. The handle does not create a second event stream;
|
||||
// SysReadInputEvent, SysPeekInputEvent, SysReadKey, and SysReadKeyboardChar
|
||||
// consume the same queue. SysWaitSingle succeeds for this handle when a
|
||||
// keyboard input event can be read.
|
||||
KSTATUS SysOpenInputQueue(uint32_t flags, SYS_HANDLE* handleOut);
|
||||
|
||||
static inline KSTATUS SysWait(SYS_HANDLE handle, uint32_t flags) {
|
||||
return SysWaitSingle(handle, flags, SYS_WAIT_TIMEOUT_INFINITE);
|
||||
@@ -997,10 +985,6 @@ KSTATUS SysClearEvent(SYS_HANDLE handle);
|
||||
KSTATUS SysCreateQueue(SYS_HANDLE* handleOut);
|
||||
KSTATUS SysSendQueue(const SYS_QUEUE_SEND_REQUEST* request);
|
||||
KSTATUS SysRecvQueue(const SYS_QUEUE_RECV_REQUEST* request);
|
||||
KSTATUS SysPublishQueue(const SYS_PUBLISH_QUEUE_REQUEST* request);
|
||||
KSTATUS SysUnpublishQueue(const SYS_UNPUBLISH_QUEUE_REQUEST* request);
|
||||
KSTATUS SysOpenNamedQueue(const SYS_OPEN_NAMED_QUEUE_REQUEST* request);
|
||||
KSTATUS SysOpenNamedQueueOwnerProcess(const SYS_NAMED_QUEUE_OWNER_REQUEST* request);
|
||||
|
||||
KSTATUS SysCreatePort(const SYS_CREATE_PORT_REQUEST* request);
|
||||
KSTATUS SysConnectPort(const SYS_CONNECT_PORT_REQUEST* request);
|
||||
@@ -1058,7 +1042,7 @@ typedef struct SYS_CONSOLE_INFO {
|
||||
|
||||
KSTATUS SysWriteConsole(const SYS_WRITE_CONSOLE_REQUEST* request);
|
||||
KSTATUS SysGetConsoleInfo(SYS_CONSOLE_INFO* infoOut);
|
||||
KSTATUS SysSetConsoleCursor(int x, int y);
|
||||
KSTATUS SysSetConsoleCursor(int32_t x, int32_t y);
|
||||
|
||||
typedef struct SYS_FILL_CONSOLE_CHARACTER_REQUEST {
|
||||
uint32_t Size;
|
||||
@@ -1109,7 +1093,7 @@ KSTATUS SysUnmapSurface(void* base);
|
||||
KSTATUS SysQuerySurface(SYS_HANDLE surfaceHandle, SYS_SURFACE_DESC* descOut);
|
||||
KSTATUS SysCommitSurface(SYS_HANDLE surfaceHandle, const DISPLAY_RECT* rects, uint32_t rectCount, uint64_t* generationOut);
|
||||
KSTATUS SysClearScreen(uint32_t color);
|
||||
KSTATUS SysGetScreenSize(int* widthOut, int* heightOut);
|
||||
KSTATUS SysGetScreenSize(int32_t* widthOut, int32_t* heightOut);
|
||||
KSTATUS SysQueryDisplayInfo(SYS_DISPLAY_INFO* infoOut);
|
||||
|
||||
#define SYS_DISPLAY_MANAGER_CURSOR_FLAG_NONE 0x00000000u
|
||||
@@ -1131,7 +1115,7 @@ KSTATUS SysPresentDisplayManagerSurface(SYS_HANDLE managerHandle, SYS_HANDLE sur
|
||||
const DISPLAY_RECT* rects, uint32_t rectCount);
|
||||
KSTATUS SysWriteDisplayManagerConsole(SYS_HANDLE managerHandle, const SYS_WRITE_CONSOLE_REQUEST* request);
|
||||
KSTATUS SysQueryDisplayManagerConsoleInfo(SYS_HANDLE managerHandle, SYS_CONSOLE_INFO* infoOut);
|
||||
KSTATUS SysSetDisplayManagerConsoleCursor(SYS_HANDLE managerHandle, int x, int y);
|
||||
KSTATUS SysSetDisplayManagerConsoleCursor(SYS_HANDLE managerHandle, int32_t x, int32_t y);
|
||||
KSTATUS SysFillDisplayManagerConsoleCharacter(SYS_HANDLE managerHandle, const SYS_FILL_CONSOLE_CHARACTER_REQUEST* request);
|
||||
KSTATUS SysFillDisplayManagerConsoleAttribute(SYS_HANDLE managerHandle, const SYS_FILL_CONSOLE_ATTRIBUTE_REQUEST* request);
|
||||
KSTATUS SysPutDisplayManagerConsoleCharacter(SYS_HANDLE managerHandle, const SYS_PUT_SCREEN_CHAR_REQUEST* request);
|
||||
@@ -1178,50 +1162,6 @@ typedef struct SYS_INPUT_MANAGER_READ_REQUEST {
|
||||
// Reads the next normalized physical input event through an input-manager capability.
|
||||
KSTATUS SysReadInputManagerEvent(const SYS_INPUT_MANAGER_READ_REQUEST* request);
|
||||
|
||||
#define SYS_INPUT_QUEUE_FLAG_NONE 0x00000000u
|
||||
#define SYS_INPUT_EVENT_FLAG_NONE 0x00000000u
|
||||
#define SYS_GLOBAL_INPUT_STATE_FLAG_NONE 0x00000000u
|
||||
#define SYS_GLOBAL_INPUT_KEY_BYTES 32u
|
||||
|
||||
// Legacy kernel-global input snapshot retained for compatibility. Normal interactive
|
||||
// clients should consume RSSRV logical input through <ntlite/input_service.h>.
|
||||
typedef struct SYS_GLOBAL_INPUT_STATE {
|
||||
uint32_t Size;
|
||||
uint32_t Flags;
|
||||
uint64_t Generation;
|
||||
uint32_t Modifiers;
|
||||
uint8_t KeyDown[SYS_GLOBAL_INPUT_KEY_BYTES];
|
||||
int32_t MouseX;
|
||||
int32_t MouseY;
|
||||
int32_t MouseWheel;
|
||||
uint32_t MouseButtons;
|
||||
} SYS_GLOBAL_INPUT_STATE;
|
||||
|
||||
// A zero QueueHandle means the default keyboard input queue. A
|
||||
// nonzero QueueHandle must be a handle returned by SysOpenInputQueue. A zero
|
||||
// timeout is an immediate try and returns NTLSTATUS_WOULD_BLOCK when the queue is
|
||||
// empty. A finite timeout returns NTLSTATUS_TIMEOUT only when its deadline expires.
|
||||
typedef struct SYS_INPUT_EVENT_REQUEST {
|
||||
uint32_t Size;
|
||||
SYS_HANDLE QueueHandle;
|
||||
uint32_t Flags;
|
||||
uint64_t TimeoutMilliseconds;
|
||||
INPUT_KEY_RECORD* RecordOut;
|
||||
} SYS_INPUT_EVENT_REQUEST;
|
||||
|
||||
KSTATUS SysPollKeyboard(INPUT_KEY* keyOut);
|
||||
KSTATUS SysIsKeyDown(INPUT_KEY key, bool* downOut);
|
||||
KSTATUS SysReadKeyboardChar(char* charOut);
|
||||
KSTATUS SysReadKey(INPUT_KEY* keyOut);
|
||||
uint32_t SysGetKeyModifiers(void);
|
||||
KSTATUS SysQueryGlobalInputState(SYS_GLOBAL_INPUT_STATE* stateOut);
|
||||
KSTATUS SysReadInputEvent(const SYS_INPUT_EVENT_REQUEST* request);
|
||||
KSTATUS SysPeekInputEvent(const SYS_INPUT_EVENT_REQUEST* request);
|
||||
|
||||
KSTATUS SysPeekMouse(INPUT_MOUSE_EVENT* eventOut);
|
||||
KSTATUS SysReadMouse(INPUT_MOUSE_EVENT* eventOut);
|
||||
KSTATUS SysGetMousePos(int* xOut, int* yOut);
|
||||
|
||||
// Native sockets.
|
||||
#define SYS_AF_INET 2u
|
||||
#define SYS_AF_INET6 10u
|
||||
@@ -1438,7 +1378,7 @@ typedef struct SYS_MEMORY_STATUS {
|
||||
// Public stats payloads start with Size and Version. Size is the byte count
|
||||
// returned for that payload, including any trailing records. Version describes
|
||||
// the field layout for fixed fields in the named payload.
|
||||
#define SYS_STATS_VERSION 3u
|
||||
#define SYS_STATS_VERSION 4u
|
||||
|
||||
|
||||
typedef struct SYS_EXCEPTION_STATS {
|
||||
@@ -1748,7 +1688,7 @@ typedef struct SYS_NET_IRP_STATS {
|
||||
typedef struct SYS_SWAP_STATS {
|
||||
uint32_t Size;
|
||||
uint32_t Version;
|
||||
uint64_t Enabled;
|
||||
bool Enabled;
|
||||
uint64_t TotalSlots;
|
||||
uint64_t UsedSlots;
|
||||
uint64_t FreeSlots;
|
||||
|
||||
Reference in new issue
Block a user