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,19 +79,19 @@ static uint32_t create_temp(uint32_t* fileOut, const char** pathOut) {
|
||||
uint32_t h = 0;
|
||||
delete_path(paths[i]);
|
||||
SYS_OPEN_FILE_REQUEST req = SysMakeOpenFileRequest(SysSvFromCstr(paths[i]),
|
||||
SYS_FILE_ACCESS_WRITE | SYS_FILE_ACCESS_QUERY,
|
||||
SYS_FILE_ACCESS_READ | SYS_FILE_ACCESS_WRITE | SYS_FILE_ACCESS_QUERY,
|
||||
SYS_FILE_CREATE_NEW,
|
||||
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) {
|
||||
@@ -102,7 +102,7 @@ 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;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ static void checked_write(uint32_t file, const void* buffer, size_t size, const
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -127,13 +127,13 @@ 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;
|
||||
}
|
||||
|
||||
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 expect_writeback_progress(const SYS_FILE_CACHE_STATS* before,
|
||||
@@ -158,7 +158,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("dirty_writeback: using ");
|
||||
print(path ? path : "<unknown>");
|
||||
@@ -170,11 +170,11 @@ int main(void) {
|
||||
SYS_FILE_CACHE_STATS beforeClose;
|
||||
SYS_FILE_CACHE_STATS afterClose;
|
||||
|
||||
if (query_cache(&before) != STATUS_SUCCESS) fail("initial stats query failed");
|
||||
if (query_cache(&before) != NTLSTATUS_SUCCESS) fail("initial stats query failed");
|
||||
|
||||
checked_write(file, gPatternA, sizeof(gPatternA), "write pattern A");
|
||||
|
||||
if (query_cache(&afterWrite) != STATUS_SUCCESS) fail("post-write stats query failed");
|
||||
if (query_cache(&afterWrite) != NTLSTATUS_SUCCESS) fail("post-write stats query failed");
|
||||
if (afterWrite.DirtyMarks <= before.DirtyMarks) fail("write did not mark dirty cache pages");
|
||||
if (afterWrite.DirtyPages <= before.DirtyPages) fail("write did not leave dirty pages resident");
|
||||
|
||||
@@ -185,9 +185,9 @@ int main(void) {
|
||||
if (memcmp(gReadback, gPatternA, sizeof(gPatternA)) != 0) fail("cached read before flush mismatch");
|
||||
|
||||
s = SysFlushFile(file);
|
||||
if (s != STATUS_SUCCESS) fail_status("explicit flush", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("explicit flush", s);
|
||||
|
||||
if (query_cache(&afterFlush) != STATUS_SUCCESS) fail("post-flush stats query failed");
|
||||
if (query_cache(&afterFlush) != NTLSTATUS_SUCCESS) fail("post-flush stats query failed");
|
||||
if (afterFlush.FlushFileCalls <= afterWrite.FlushFileCalls) fail("flush call counter did not increase");
|
||||
expect_writeback_progress(&afterWrite, &afterFlush, "explicit flush");
|
||||
|
||||
@@ -196,19 +196,19 @@ int main(void) {
|
||||
checked_seek(file, REWRITE_SIZE, "seek close-tail");
|
||||
checked_write(file, gPatternA + REWRITE_SIZE, CLOSE_SIZE - REWRITE_SIZE, "write close tail");
|
||||
|
||||
if (query_cache(&beforeClose) != STATUS_SUCCESS) fail("pre-close stats query failed");
|
||||
if (query_cache(&beforeClose) != NTLSTATUS_SUCCESS) fail("pre-close stats query failed");
|
||||
if (beforeClose.DirtyMarks <= afterFlush.DirtyMarks) fail("rewrite did not mark dirty pages");
|
||||
|
||||
s = SysCloseHandle(file);
|
||||
file = 0;
|
||||
if (s != STATUS_SUCCESS) fail_status("close", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("close", s);
|
||||
|
||||
if (query_cache(&afterClose) != STATUS_SUCCESS) fail("post-close stats query failed");
|
||||
if (query_cache(&afterClose) != NTLSTATUS_SUCCESS) fail("post-close stats query failed");
|
||||
if (afterClose.FlushFileCalls <= beforeClose.FlushFileCalls) fail("close did not flush file");
|
||||
expect_writeback_progress(&beforeClose, &afterClose, "close flush");
|
||||
|
||||
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, CLOSE_SIZE, &got, "read after reopen");
|
||||
if (got != CLOSE_SIZE) fail("read after reopen size mismatch");
|
||||
@@ -218,7 +218,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("dirty_writeback: dirty-marks+=");
|
||||
|
||||
Reference in new issue
Block a user