implement user mode catchable exceptions, refactor system status codes to use NTLSTATUS_ prefix, update build scripts to use shared literal macros for linker arguments, update named queue lifetime cleanup to include KeNamedQueueUnpublishHandle.
This commit is contained in:
1 parent
1f5477cf66
commit
b7fcfce6f7
140 files changed
+7649
-3943
No files matched your search
@@ -3,6 +3,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <ntlite/exception.h>
|
||||
#include <ntlite/syscall.h>
|
||||
|
||||
// Implements the itoa operation.
|
||||
@@ -54,8 +55,13 @@ static void debug_print(const char* s) {
|
||||
(void)SysPrintDebug(&req);
|
||||
}
|
||||
|
||||
// Initializes init process state and supervises the configured child process.
|
||||
void _start(void)
|
||||
{
|
||||
uint32_t runtimeStatus = NtlInitializeExceptionRuntime();
|
||||
if (runtimeStatus != NTLSTATUS_SUCCESS)
|
||||
SysExitProcess((int32_t)runtimeStatus);
|
||||
|
||||
SYS_STRING_VIEW args = SysGetPeb()->CommandLine;
|
||||
uint32_t h = 0;
|
||||
uint32_t s = 0;
|
||||
@@ -64,7 +70,7 @@ void _start(void)
|
||||
debug_print("[init] starting\n");
|
||||
SYS_CREATE_PROCESS_REQUEST cp = { args, SysSvFromParts(0, 0), &h };
|
||||
s = SysCreateProcess(&cp);
|
||||
if (s != STATUS_SUCCESS) {
|
||||
if (s != NTLSTATUS_SUCCESS) {
|
||||
debug_print("[init] FATAL: failed to start!\n");
|
||||
char buffer[12];
|
||||
itoa(s, buffer);
|
||||
@@ -75,11 +81,11 @@ void _start(void)
|
||||
|
||||
debug_print("[init] waiting\n");
|
||||
s = SysWait(h, SYS_WAIT_FLAG_NONE);
|
||||
if (s != STATUS_SUCCESS)
|
||||
if (s != NTLSTATUS_SUCCESS)
|
||||
debug_print("[init] WARNING: SysWait returned error\n");
|
||||
|
||||
int32_t exitCode = 0;
|
||||
if (SysGetProcessExitCode(h, &exitCode) != STATUS_SUCCESS) {
|
||||
if (SysGetProcessExitCode(h, &exitCode) != NTLSTATUS_SUCCESS) {
|
||||
debug_print("[init] WARNING: failed to read exit code\n");
|
||||
exitCode = 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user