add ntfs.sys standalone driver target, change default usb vhd layout formatting to ntfs, implement Fat32CreateDir for directory creation support in the fat32 file system driver, add a dedicated HAL serial output endpoint for COM1 writes in hal_serial.c and subscribe serial to HAL text streams, introduce waitable kernel timers with KeTimerCreate, KeTimerSet, and KeTimerCancel alongside spinlock-protected global timer list initialization and scheduler tick tracking, implement SyscallWriteFileAsync system call for asynchronous non-blocking file writes, refactor NetSocketConnect and NetSocketSendTo to use generic SYS_SOCKET_ADDRESS_K structures instead of being hardcoded to IPv4, update gethostbyname and DNS name resolution to support IPv6 parsing via ResolveNameFamily, update tcpserve.exe with -4 and -6 command-line flags to accept and display IPv6 addresses, append size and version headers to all kernel telemetry and statistics structures including SYS_PMM_STATS, SYS_CPU_STATS, and SYS_SCHEDULER_STATS, update winmm timeGetTime to look up high-resolution hardware frequencies via SysGetTickFrequency, integrate 14 native smoke test applications.
This commit is contained in:
1 parent
2c4a68a75f
commit
ed3d065abd
156 files changed
+10509
-2643
No files matched your search
@@ -0,0 +1,114 @@
|
||||
// Input model smoke test.
|
||||
// Verifies that input queue handles and request-based reads target one keyboard queue.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ntlite/syscall.h>
|
||||
|
||||
// Prints one NUL-terminated string to the kernel console.
|
||||
static void print(const char* s) {
|
||||
SYS_WRITE_CONSOLE_REQUEST req = { SysSvFromCstr(s) };
|
||||
SysWriteConsole(&req);
|
||||
}
|
||||
|
||||
// Prints one unsigned integer to the kernel console.
|
||||
static void print_u64(uint64_t v) {
|
||||
char buf[32];
|
||||
int i = 0;
|
||||
if (v == 0) {
|
||||
print("0");
|
||||
return;
|
||||
}
|
||||
while (v && i < (int)sizeof(buf)) {
|
||||
buf[i++] = (char)('0' + (v % 10));
|
||||
v /= 10;
|
||||
}
|
||||
while (i--) {
|
||||
char c = buf[i];
|
||||
SYS_WRITE_CONSOLE_REQUEST req = { SysSvFromParts(&c, 1) };
|
||||
SysWriteConsole(&req);
|
||||
}
|
||||
}
|
||||
|
||||
// Terminates the current test process.
|
||||
static void exit_now(int code) {
|
||||
for (;;) SysExitProcess(code);
|
||||
}
|
||||
|
||||
// Fails the test with one status value.
|
||||
static void fail_status(const char* what, uint32_t status) {
|
||||
print("input_model_smoke: ");
|
||||
print(what);
|
||||
print(" status=");
|
||||
print_u64(status);
|
||||
print("\n");
|
||||
exit_now(1);
|
||||
}
|
||||
|
||||
// Requires one exact status value.
|
||||
static void expect_status(const char* what, uint32_t got, uint32_t expected) {
|
||||
if (got == expected) return;
|
||||
print("input_model_smoke: ");
|
||||
print(what);
|
||||
print(" got=");
|
||||
print_u64(got);
|
||||
print(" expected=");
|
||||
print_u64(expected);
|
||||
print("\n");
|
||||
exit_now(1);
|
||||
}
|
||||
|
||||
// Program entry point.
|
||||
int main(void) {
|
||||
print("input_model_smoke: start\n");
|
||||
|
||||
uint32_t inputQueue = 0;
|
||||
expect_status("open input queue null", SysOpenInputQueue(SYS_INPUT_QUEUE_FLAG_NONE, (uint32_t*)0), STATUS_INVALID_PARAMETER);
|
||||
expect_status("open input queue bad flags", SysOpenInputQueue(1, &inputQueue), STATUS_INVALID_PARAMETER);
|
||||
|
||||
uint32_t status = SysOpenInputQueue(SYS_INPUT_QUEUE_FLAG_NONE, &inputQueue);
|
||||
if (status != STATUS_SUCCESS)
|
||||
fail_status("open input queue", status);
|
||||
|
||||
INPUT_KEY_RECORD record;
|
||||
SYS_INPUT_EVENT_REQUEST req;
|
||||
req.Size = sizeof(req);
|
||||
req.QueueHandle = inputQueue;
|
||||
req.Flags = SYS_INPUT_EVENT_FLAG_NONE;
|
||||
req.TimeoutMilliseconds = 0;
|
||||
req.RecordOut = &record;
|
||||
|
||||
SYS_INPUT_EVENT_REQUEST badReq = req;
|
||||
badReq.Size = 0;
|
||||
expect_status("read input bad size", SysReadInputEvent(&badReq), STATUS_INVALID_PARAMETER);
|
||||
|
||||
badReq = req;
|
||||
badReq.RecordOut = (INPUT_KEY_RECORD*)0;
|
||||
expect_status("peek input null out", SysPeekInputEvent(&badReq), STATUS_INVALID_PARAMETER);
|
||||
|
||||
badReq = req;
|
||||
badReq.QueueHandle = 0xdeadbeefu;
|
||||
expect_status("read input bad handle", SysReadInputEvent(&badReq), STATUS_INVALID_HANDLE);
|
||||
|
||||
status = SysPeekInputEvent(&req);
|
||||
if (status != STATUS_SUCCESS && status != STATUS_WOULD_BLOCK)
|
||||
fail_status("peek input immediate", status);
|
||||
|
||||
uint32_t waitStatus = SysWaitSingle(inputQueue, SYS_WAIT_FLAG_NONE, 0);
|
||||
if (status == STATUS_SUCCESS) {
|
||||
if (waitStatus != STATUS_SUCCESS)
|
||||
fail_status("wait input after readable peek", waitStatus);
|
||||
} else if (waitStatus != STATUS_TIMEOUT) {
|
||||
fail_status("wait empty input immediate", waitStatus);
|
||||
}
|
||||
|
||||
req.TimeoutMilliseconds = 1;
|
||||
status = SysReadInputEvent(&req);
|
||||
if (status != STATUS_SUCCESS && status != STATUS_TIMEOUT)
|
||||
fail_status("read input finite timeout", status);
|
||||
|
||||
SysCloseHandle(inputQueue);
|
||||
|
||||
print("input_model_smoke: PASS\n");
|
||||
exit_now(0);
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user