duct taped posix.dll (just like microsoft), new cursor, more info in the fault handlers, processes now have a parse-it-yourself cmdline, add SYS_WAIT_THREAD and SYS_GET_PROCESS_PID, writing still doesn't work

This commit is contained in:
maksw committed 2026-05-05 15:24:58 +02:00
1 parent a37f5b1581
commit b5c831f593
26 files changed
+1107 -56

No files matched your search

+13 -1
View File
@@ -238,6 +238,18 @@ static PROCESS* LaunchUserProcess(const char* filePath) {
}
DbgPrint("Created process (PID %u) with command line: %s\n", proc->ProcessId, filePath);
strncpy(proc->Cmdline, filePath, sizeof(proc->Cmdline) - 1);
// proc->Cmdline is kernel pool (ffffc000...) - not readable at CPL=3.
// Copy into user memory before handing the pointer to the initial thread.
size_t cmdlineLen = strlen(proc->Cmdline) + 1;
char* userCmdline = (char*)MmAllocateUserMemory(cmdlineLen);
if (!userCmdline) {
DbgPrint("LaunchUserProcess: Failed to allocate user cmdline buffer.\n");
return (PROCESS*)0;
}
memcpy(userCmdline, proc->Cmdline, cmdlineLen);
// Parse the raw PE file and map it into executable memory
uintptr_t imageBase = 0;
s = LdrLoadImage(mem, size, &imageBase, true);
@@ -248,7 +260,7 @@ static PROCESS* LaunchUserProcess(const char* filePath) {
DbgPrint("LaunchUserProcess: PE Image mapped! Base 0x%llx, Entry 0x%llX\n", imageBase, entryPoint);
// Create the main thread, pointing it to the PE Entry Point
s = KeCreateThread(proc, (uintptr_t)entryPoint, 0, PriorityNormal, &thread);
s = KeCreateThread(proc, (uintptr_t)entryPoint, (uintptr_t)userCmdline, PriorityNormal, &thread);
if (!KSUCCESS(s)) {
DbgPrint("LaunchUserProcess: Failed to create thread. Status: %d\n", s);
}