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
@@ -68,14 +68,14 @@ static void check_module_info(const SYS_MODULE_INFO* info) {
|
||||
static int module_list_contains(uintptr_t base) {
|
||||
size_t count = 0;
|
||||
uint32_t status = SysGetModuleList(0, 0, &count);
|
||||
if (status != STATUS_SUCCESS) fail_status("query module count", status);
|
||||
if (status != NTLSTATUS_SUCCESS) fail_status("query module count", status);
|
||||
if (count == 0) return 0;
|
||||
if (count > 32) fail("module count unexpectedly large");
|
||||
|
||||
SYS_MODULE_INFO modules[32];
|
||||
memset(modules, 0, sizeof(modules));
|
||||
status = SysGetModuleList(modules, count, &count);
|
||||
if (status != STATUS_SUCCESS) fail_status("query module list", status);
|
||||
if (status != NTLSTATUS_SUCCESS) fail_status("query module list", status);
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (modules[i].Base == base)
|
||||
@@ -95,7 +95,7 @@ static void check_export_lookup(void) {
|
||||
req.ModuleHandleOut = &handle;
|
||||
|
||||
uint32_t status = SysLoadModule(&req);
|
||||
if (status != STATUS_SUCCESS) fail_status("load syscall.dll", status);
|
||||
if (status != NTLSTATUS_SUCCESS) fail_status("load syscall.dll", status);
|
||||
if (handle == 0) fail("syscall load returned null handle");
|
||||
|
||||
uintptr_t address = 0;
|
||||
@@ -107,11 +107,11 @@ static void check_export_lookup(void) {
|
||||
exportReq.AddressOut = &address;
|
||||
|
||||
status = SysGetModuleExport(&exportReq);
|
||||
if (status != STATUS_SUCCESS) fail_status("lookup SysGetCurrentPid", status);
|
||||
if (status != NTLSTATUS_SUCCESS) fail_status("lookup SysGetCurrentPid", status);
|
||||
if (address == 0) fail("export address is zero");
|
||||
|
||||
status = SysUnloadModule(handle);
|
||||
if (status != STATUS_SUCCESS) fail_status("unload syscall.dll handle", status);
|
||||
if (status != NTLSTATUS_SUCCESS) fail_status("unload syscall.dll handle", status);
|
||||
}
|
||||
|
||||
// Runs the public dynamic module loader smoke test.
|
||||
@@ -131,7 +131,7 @@ int main(void) {
|
||||
req.InfoOut = &info;
|
||||
|
||||
uint32_t status = SysLoadModule(&req);
|
||||
if (status != STATUS_SUCCESS) fail_status("load posix.dll", status);
|
||||
if (status != NTLSTATUS_SUCCESS) fail_status("load posix.dll", status);
|
||||
if (handle == 0) fail("load returned null handle");
|
||||
check_module_info(&info);
|
||||
if (!module_list_contains(info.Base)) fail("loaded module absent from list");
|
||||
@@ -139,16 +139,16 @@ int main(void) {
|
||||
SYS_MODULE_INFO byHandle;
|
||||
memset(&byHandle, 0, sizeof(byHandle));
|
||||
status = SysGetModuleInfo(handle, &byHandle);
|
||||
if (status != STATUS_SUCCESS) fail_status("get module info", status);
|
||||
if (status != NTLSTATUS_SUCCESS) fail_status("get module info", status);
|
||||
check_module_info(&byHandle);
|
||||
if (byHandle.Base != info.Base) fail("module handle base mismatch");
|
||||
|
||||
status = SysUnloadModule(handle);
|
||||
if (status != STATUS_SUCCESS) fail_status("unload module", status);
|
||||
if (status != NTLSTATUS_SUCCESS) fail_status("unload module", status);
|
||||
|
||||
memset(&byHandle, 0, sizeof(byHandle));
|
||||
status = SysGetModuleInfo(handle, &byHandle);
|
||||
if (status != STATUS_INVALID_HANDLE) fail_status("query unloaded handle", status);
|
||||
if (status != NTLSTATUS_INVALID_HANDLE) fail_status("query unloaded handle", status);
|
||||
|
||||
print("module_load_smoke: PASS\n");
|
||||
exit_now(0);
|
||||
|
||||
Reference in new issue
Block a user