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
@@ -79,13 +79,13 @@ static uint32_t create_temp(uint32_t* fileOut, const char** pathOut) {
|
||||
SYS_FILE_FLAG_NONE,
|
||||
&h);
|
||||
uint32_t s = SysOpenFile(&req);
|
||||
if (s == STATUS_SUCCESS) {
|
||||
if (s == NTLSTATUS_SUCCESS) {
|
||||
*fileOut = h;
|
||||
if (pathOut) *pathOut = paths[i];
|
||||
return STATUS_SUCCESS;
|
||||
return NTLSTATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
return STATUS_NOT_FOUND;
|
||||
return NTLSTATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
static uint32_t open_path(const char* path, uint32_t* fileOut) {
|
||||
@@ -96,21 +96,21 @@ static uint32_t open_path(const char* path, uint32_t* fileOut) {
|
||||
SYS_FILE_FLAG_NONE,
|
||||
&h);
|
||||
uint32_t s = SysOpenFile(&req);
|
||||
if (s == STATUS_SUCCESS)
|
||||
if (s == NTLSTATUS_SUCCESS)
|
||||
*fileOut = h;
|
||||
return s;
|
||||
}
|
||||
|
||||
static void checked_seek(uint32_t file, uint64_t offset, const char* what) {
|
||||
uint32_t s = SysSeekFile(file, offset);
|
||||
if (s != STATUS_SUCCESS) fail_status(what, s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status(what, s);
|
||||
}
|
||||
|
||||
static void checked_write(uint32_t file, const void* buffer, size_t size, const char* what) {
|
||||
size_t done = 0;
|
||||
SYS_FILE_IO_REQUEST req = SysMakeFileIoRequest(file, buffer, size, &done);
|
||||
uint32_t s = SysWriteFile(&req);
|
||||
if (s != STATUS_SUCCESS) fail_status(what, s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status(what, s);
|
||||
if (done != size) fail("short write");
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ static void checked_read(uint32_t file, void* buffer, size_t size, size_t* gotOu
|
||||
memset(buffer, 0xCC, size);
|
||||
SYS_FILE_IO_REQUEST req = SysMakeFileIoRequest(file, buffer, size, &got);
|
||||
uint32_t s = SysReadFile(&req);
|
||||
if (s != STATUS_SUCCESS) fail_status(what, s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status(what, s);
|
||||
if (gotOut) *gotOut = got;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ int main(void) {
|
||||
uint32_t file = 0;
|
||||
const char* path = 0;
|
||||
uint32_t s = create_temp(&file, &path);
|
||||
if (s != STATUS_SUCCESS) fail_status("create temp", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("create temp", s);
|
||||
|
||||
print("shared_mmap: creating temporary file ");
|
||||
print(path ? path : "<unknown>");
|
||||
@@ -145,16 +145,16 @@ int main(void) {
|
||||
|
||||
checked_write(file, gInitial, TEST_SIZE, "initial write");
|
||||
s = SysFlushFile(file);
|
||||
if (s != STATUS_SUCCESS) fail_status("initial flush", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("initial flush", s);
|
||||
|
||||
uint32_t mapping = 0;
|
||||
s = SysCreateFileMapping(file, SYS_VM_READWRITE, SYS_MAP_FLAG_NONE, TEST_SIZE, &mapping);
|
||||
if (s != STATUS_SUCCESS) fail_status("create mapping", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("create mapping", s);
|
||||
|
||||
uint8_t* view = 0;
|
||||
s = SysMapFile(mapping, 0, TEST_SIZE, SYS_MAP_ACCESS_READ | SYS_MAP_ACCESS_WRITE,
|
||||
SYS_MAP_FLAG_NONE, (void**)&view);
|
||||
if (s != STATUS_SUCCESS) fail_status("map shared write", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("map shared write", s);
|
||||
|
||||
for (size_t i = 128; i < 128 + 3000; ++i) {
|
||||
view[i] = (uint8_t)(0xA0u + (uint8_t)i);
|
||||
@@ -167,12 +167,12 @@ int main(void) {
|
||||
|
||||
SYS_FILE_CACHE_STATS beforeFlush;
|
||||
SYS_FILE_CACHE_STATS afterFlush;
|
||||
if (query_cache(&beforeFlush) != STATUS_SUCCESS) fail("pre-flush stats failed");
|
||||
if (query_cache(&beforeFlush) != NTLSTATUS_SUCCESS) fail("pre-flush stats failed");
|
||||
|
||||
s = SysFlushFile(file);
|
||||
if (s != STATUS_SUCCESS) fail_status("flush mapped writes", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("flush mapped writes", s);
|
||||
|
||||
if (query_cache(&afterFlush) != STATUS_SUCCESS) fail("post-flush stats failed");
|
||||
if (query_cache(&afterFlush) != NTLSTATUS_SUCCESS) fail("post-flush stats failed");
|
||||
if (afterFlush.MappedDirtyPages <= beforeFlush.MappedDirtyPages)
|
||||
fail("mapped dirty pages were not harvested");
|
||||
if (afterFlush.WritebackBytes <= beforeFlush.WritebackBytes)
|
||||
@@ -191,18 +191,18 @@ int main(void) {
|
||||
|
||||
s = SysFreeVm(view);
|
||||
view = 0;
|
||||
if (s != STATUS_SUCCESS) fail_status("unmap", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("unmap", s);
|
||||
|
||||
s = SysCloseHandle(mapping);
|
||||
mapping = 0;
|
||||
if (s != STATUS_SUCCESS) fail_status("close mapping", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("close mapping", s);
|
||||
|
||||
s = SysCloseHandle(file);
|
||||
file = 0;
|
||||
if (s != STATUS_SUCCESS) fail_status("close file", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("close file", s);
|
||||
|
||||
s = open_path(path, &file);
|
||||
if (s != STATUS_SUCCESS) fail_status("reopen", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("reopen", s);
|
||||
|
||||
checked_read(file, gReadback, TEST_SIZE, &got, "read after close");
|
||||
if (got != TEST_SIZE) fail("read after close size mismatch");
|
||||
@@ -210,7 +210,7 @@ int main(void) {
|
||||
|
||||
s = SysCloseHandle(file);
|
||||
file = 0;
|
||||
if (s != STATUS_SUCCESS) fail_status("close reopened", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("close reopened", s);
|
||||
delete_path(path);
|
||||
|
||||
print("shared_mmap: mapped-dirty-pages+=");
|
||||
|
||||
Reference in new issue
Block a user