rewrite comments into one, unified style
This commit is contained in:
1 parent
6260de0085
commit
467a58c9c6
163 files changed
+3560
-2556
No files matched your search
@@ -1,5 +1,7 @@
|
||||
// Public NTLite syscall ABI declarations shared between kernel, drivers, and user mode.
|
||||
|
||||
#pragma once
|
||||
// Syscall.h
|
||||
// Syscall.h.
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@@ -22,12 +24,10 @@
|
||||
#define SYS_STATUS_CANCELLED 0x33u
|
||||
#define SYS_STATUS_NOT_FOUND 0x22u
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// User process/thread environment
|
||||
// ---------------------------------------------------------------------------
|
||||
// GS base points at SYS_TEB. GS:[0] is the process PEB pointer.
|
||||
#define SYS_PEB_MAGIC 0x30424550u /* "PEB0" */
|
||||
#define SYS_TEB_MAGIC 0x30424554u /* "TEB0" */
|
||||
#define SYS_PEB_MAGIC 0x30424550u // "PEB0"
|
||||
#define SYS_TEB_MAGIC 0x30424554u // "TEB0"
|
||||
#define SYS_ENV_VERSION 1u
|
||||
#define SYS_CWD_MAX 520u
|
||||
|
||||
@@ -60,17 +60,17 @@ typedef struct SYS_TEB {
|
||||
|
||||
#endif // SYS_USER_ENV_TYPES_DEFINED
|
||||
|
||||
// Returns peb.
|
||||
static inline SYS_PEB* SysGetPeb(void) {
|
||||
return (SYS_PEB*)(uintptr_t)__readgsqword(0);
|
||||
}
|
||||
|
||||
// Returns teb.
|
||||
static inline SYS_TEB* SysGetTeb(void) {
|
||||
return (SYS_TEB*)(uintptr_t)__readgsqword(offsetof(SYS_TEB, Self));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// APC and async I/O ABI
|
||||
// ---------------------------------------------------------------------------
|
||||
// APC and async I/O ABI.
|
||||
typedef struct SYS_IO_STATUS_BLOCK {
|
||||
volatile uint32_t Status;
|
||||
volatile uint64_t Information;
|
||||
@@ -109,9 +109,7 @@ typedef struct SYS_USER_APC_FRAME {
|
||||
|
||||
void SysUserApcDispatcher(void);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Trap-frame query ABI
|
||||
// ---------------------------------------------------------------------------
|
||||
// Trap-frame query ABI.
|
||||
typedef struct SYS_TRAP_FRAME_INFO {
|
||||
uint32_t Size;
|
||||
uint32_t Kind;
|
||||
@@ -133,9 +131,7 @@ typedef struct SYS_TRAP_FRAME_INFO {
|
||||
uint64_t R11;
|
||||
} SYS_TRAP_FRAME_INFO;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// String-view based syscall request structures
|
||||
// ---------------------------------------------------------------------------
|
||||
// String-view based syscall request structures.
|
||||
typedef struct SYS_CREATE_PROCESS_REQUEST {
|
||||
SYS_STRING_VIEW Path;
|
||||
SYS_STRING_VIEW CommandLine;
|
||||
@@ -185,9 +181,7 @@ typedef struct SYS_NAMED_QUEUE_OWNER_REQUEST {
|
||||
uint32_t* PidOut;
|
||||
} SYS_NAMED_QUEUE_OWNER_REQUEST;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Process & thread lifecycle (0-14)
|
||||
// ---------------------------------------------------------------------------
|
||||
// Process & thread lifecycle (0-14).
|
||||
void SysExitProcess(int exitCode);
|
||||
void SysExitThread(int exitCode);
|
||||
uint32_t SysCreateProcess(const SYS_CREATE_PROCESS_REQUEST* request);
|
||||
@@ -246,9 +240,7 @@ uint32_t SysSleep(uint64_t ms);
|
||||
uint32_t SysSetUserApcDispatcher(void* dispatcher);
|
||||
uint32_t SysApcReturn(const SYS_USER_APC_FRAME* frame);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Virtual memory and handles
|
||||
// ---------------------------------------------------------------------------
|
||||
// Virtual memory and handles.
|
||||
typedef enum SYS_PROTECT_VMION {
|
||||
SYS_VM_NOACCESS = 0,
|
||||
SYS_VM_READ = 1,
|
||||
@@ -276,9 +268,7 @@ uint32_t SysProtectVm(void* base, size_t pageCount, uint32_t protect, uint32_t*
|
||||
uint32_t SysQueryVm(void* address, SYS_VM_REGION_INFO* out);
|
||||
uint32_t SysCloseHandle(uint32_t handle);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Synchronization primitives (19-31)
|
||||
// ---------------------------------------------------------------------------
|
||||
// Synchronization primitives (19-31).
|
||||
uint32_t SysCreateMutex(uint32_t* handleOut);
|
||||
uint32_t SysAcquireMutex(uint32_t handle);
|
||||
uint32_t SysTryAcquireMutex(uint32_t handle);
|
||||
@@ -294,9 +284,7 @@ uint32_t SysSignalEvent(uint32_t handle);
|
||||
uint32_t SysClearEvent(uint32_t handle);
|
||||
uint32_t SysWaitEvent(uint32_t handle, uint32_t alertable);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Queues and named queues (32-38)
|
||||
// ---------------------------------------------------------------------------
|
||||
// Queues and named queues (32-38).
|
||||
uint32_t SysCreateQueue(uint32_t* handleOut);
|
||||
uint32_t SysSendQueue(uint32_t handle, const void* msg, bool blocking);
|
||||
uint32_t SysRecvQueue(uint32_t handle, void* msg, bool blocking);
|
||||
@@ -305,9 +293,7 @@ uint32_t SysOpenNamedQueue(const SYS_OPEN_NAMED_QUEUE_REQUEST* request);
|
||||
uint32_t SysDuplicateQueue(uint32_t handle, uint32_t targetPid, uint32_t* handleOut);
|
||||
uint32_t SysGetNamedQueueOwnerPid(const SYS_NAMED_QUEUE_OWNER_REQUEST* request);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Files, directories, and current directory (39-56)
|
||||
// ---------------------------------------------------------------------------
|
||||
// Files, directories, and current directory (39-56).
|
||||
uint32_t SysOpenFile(const SYS_PATH_HANDLE_REQUEST* request);
|
||||
uint32_t SysCreateFile(const SYS_PATH_HANDLE_REQUEST* request);
|
||||
uint32_t SysReadFile(uint32_t handle, void* buf, size_t size, size_t* bytesRead);
|
||||
@@ -329,9 +315,7 @@ uint32_t SysRemoveDir(const SYS_PATH_REQUEST* request);
|
||||
uint32_t SysSetCwd(const SYS_PATH_REQUEST* request);
|
||||
uint32_t SysGetCwd(const SYS_GET_CWD_REQUEST* request);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Console and graphics.
|
||||
// ---------------------------------------------------------------------------
|
||||
typedef struct SYS_CONSOLE_INFO {
|
||||
uint32_t Columns;
|
||||
uint32_t Rows;
|
||||
@@ -351,9 +335,7 @@ uint32_t SysClearScreen(uint32_t color);
|
||||
uint32_t SysGetScreenSize(int* widthOut, int* heightOut);
|
||||
uint32_t SysQueryDisplayInfo(SYS_DISPLAY_INFO* infoOut);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Input.
|
||||
// ---------------------------------------------------------------------------
|
||||
uint64_t SysPollKeyboard(void);
|
||||
uint64_t SysIsKeyDown(INPUT_KEY key);
|
||||
char SysReadKeyboardChar(void);
|
||||
@@ -365,9 +347,7 @@ uint64_t SysReadMouse(int* dx, int* dy, uint8_t* buttons);
|
||||
void SysGetMousePos(int* x, int* y);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Native sockets
|
||||
// ---------------------------------------------------------------------------
|
||||
// Native sockets.
|
||||
#define SYS_AF_INET 2u
|
||||
#define SYS_SOCK_STREAM 1u
|
||||
#define SYS_SOCK_DGRAM 2u
|
||||
@@ -511,9 +491,7 @@ typedef struct SYS_CPU_STATS {
|
||||
#define SYS_CPU_FLAG_BSP 0x00000010u
|
||||
#define SYS_CPU_FLAG_PRIMARY 0x00000020u
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Time and diagnostics
|
||||
// ---------------------------------------------------------------------------
|
||||
// Time and diagnostics.
|
||||
uint64_t SysGetTick(void);
|
||||
uint32_t SysPrintDebug(const SYS_PRINT_DEBUG_REQUEST* request);
|
||||
uint32_t SysQueryTrapFrame(SYS_TRAP_FRAME_INFO* info);
|
||||
|
||||
Reference in new issue
Block a user