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
@@ -88,14 +88,14 @@ static uint32_t create_temp_file(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;
|
||||
*pathOut = paths[i];
|
||||
return STATUS_SUCCESS;
|
||||
return NTLSTATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return STATUS_NOT_FOUND;
|
||||
return NTLSTATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
// Creates a temporary directory on the first writable path that works.
|
||||
@@ -111,13 +111,13 @@ static uint32_t create_temp_dir(const char** pathOut) {
|
||||
remove_dir_path(paths[i]);
|
||||
SYS_PATH_REQUEST req = { SysSvFromCstr(paths[i]) };
|
||||
uint32_t s = SysCreateDir(&req);
|
||||
if (s == STATUS_SUCCESS) {
|
||||
if (s == NTLSTATUS_SUCCESS) {
|
||||
*pathOut = paths[i];
|
||||
return STATUS_SUCCESS;
|
||||
return NTLSTATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return STATUS_NOT_FOUND;
|
||||
return NTLSTATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
// Fills the write pattern used by the test file.
|
||||
@@ -131,11 +131,11 @@ static void write_test_file(uint32_t file) {
|
||||
size_t done = 0;
|
||||
SYS_FILE_IO_REQUEST writeReq = SysMakeFileIoRequest(file, gPattern, sizeof(gPattern), &done);
|
||||
uint32_t s = SysWriteFile(&writeReq);
|
||||
if (s != STATUS_SUCCESS) fail_status("write test file", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("write test file", s);
|
||||
if (done != sizeof(gPattern)) fail("short write");
|
||||
|
||||
s = SysFlushFile(file);
|
||||
if (s != STATUS_SUCCESS) fail_status("flush test file", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("flush test file", s);
|
||||
}
|
||||
|
||||
// Checks one regular-file metadata result.
|
||||
@@ -176,19 +176,19 @@ static void test_file_stat(uint32_t file, const char* path) {
|
||||
SYS_FILE_STAT byHandle;
|
||||
memset(&byHandle, 0xA5, sizeof(byHandle));
|
||||
uint32_t s = SysGetFileStat(file, &byHandle);
|
||||
if (s != STATUS_SUCCESS) fail_status("get file stat", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("get file stat", s);
|
||||
check_regular_stat(&byHandle, sizeof(gPattern), "handle stat");
|
||||
|
||||
uint64_t size = 0;
|
||||
s = SysGetFileSize(file, &size);
|
||||
if (s != STATUS_SUCCESS) fail_status("get file size", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("get file size", s);
|
||||
if (size != byHandle.FileSize) fail("file size and file stat disagree");
|
||||
|
||||
SYS_FILE_STAT byPath;
|
||||
memset(&byPath, 0x5A, sizeof(byPath));
|
||||
SYS_STAT_FILE_REQUEST statReq = { SysSvFromCstr(path), &byPath };
|
||||
s = SysStatFile(&statReq);
|
||||
if (s != STATUS_SUCCESS) fail_status("path stat", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("path stat", s);
|
||||
check_regular_stat(&byPath, sizeof(gPattern), "path stat");
|
||||
|
||||
if (byHandle.VolumeId != 0 && byPath.VolumeId != 0 && byHandle.VolumeId != byPath.VolumeId)
|
||||
@@ -203,7 +203,7 @@ static void test_directory_stat(const char* path) {
|
||||
memset(&stat, 0xCC, sizeof(stat));
|
||||
SYS_STAT_FILE_REQUEST statReq = { SysSvFromCstr(path), &stat };
|
||||
uint32_t s = SysStatFile(&statReq);
|
||||
if (s != STATUS_SUCCESS) fail_status("directory stat", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("directory stat", s);
|
||||
check_directory_stat(&stat);
|
||||
}
|
||||
|
||||
@@ -212,14 +212,14 @@ static void test_failure_paths(void) {
|
||||
SYS_FILE_STAT stat;
|
||||
SYS_STAT_FILE_REQUEST missingReq = { SysSvFromCstr("file_stat_smoke_missing.nope"), &stat };
|
||||
uint32_t s = SysStatFile(&missingReq);
|
||||
if (s != STATUS_NOT_FOUND) fail_status("missing path status", s);
|
||||
if (s != NTLSTATUS_NOT_FOUND) fail_status("missing path status", s);
|
||||
|
||||
s = SysGetFileStat(0xFFFFFFFFu, &stat);
|
||||
if (s != STATUS_INVALID_HANDLE) fail_status("invalid handle status", s);
|
||||
if (s != NTLSTATUS_INVALID_HANDLE) fail_status("invalid handle status", s);
|
||||
|
||||
SYS_STAT_FILE_REQUEST badReq = { SysSvFromCstr("file_stat_smoke_missing.nope"), 0 };
|
||||
s = SysStatFile(&badReq);
|
||||
if (s != STATUS_INVALID_PARAMETER) fail_status("null stat output status", s);
|
||||
if (s != NTLSTATUS_INVALID_PARAMETER) fail_status("null stat output status", s);
|
||||
}
|
||||
|
||||
// Runs the native file metadata smoke test.
|
||||
@@ -231,7 +231,7 @@ int main(void) {
|
||||
uint32_t file = 0;
|
||||
const char* filePath = 0;
|
||||
uint32_t s = create_temp_file(&file, &filePath);
|
||||
if (s != STATUS_SUCCESS) fail_status("create temp file", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("create temp file", s);
|
||||
|
||||
write_test_file(file);
|
||||
test_file_stat(file, filePath);
|
||||
@@ -240,13 +240,13 @@ int main(void) {
|
||||
|
||||
const char* dirPath = 0;
|
||||
s = create_temp_dir(&dirPath);
|
||||
if (s != STATUS_SUCCESS) fail_status("create temp dir", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("create temp dir", s);
|
||||
test_directory_stat(dirPath);
|
||||
remove_dir_path(dirPath);
|
||||
|
||||
SYS_PATH_REQUEST dirReq = { SysSvFromCstr(dirPath) };
|
||||
s = SysCreateDir(&dirReq);
|
||||
if (s != STATUS_SUCCESS) fail_status("recreate temp dir", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("recreate temp dir", s);
|
||||
test_directory_stat(dirPath);
|
||||
remove_dir_path(dirPath);
|
||||
|
||||
|
||||
Reference in new issue
Block a user