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,122 @@
|
||||
// Native input API smoke test.
|
||||
// Verifies status-returning keyboard and mouse polling contracts without requiring live input.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.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_api_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_api_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_api_smoke: start\n");
|
||||
|
||||
expect_status("poll keyboard null", SysPollKeyboard((INPUT_KEY*)0), STATUS_INVALID_PARAMETER);
|
||||
expect_status("is key down null", SysIsKeyDown(INPUT_KEY_A, (bool*)0), STATUS_INVALID_PARAMETER);
|
||||
expect_status("read key null", SysReadKey((INPUT_KEY*)0), STATUS_INVALID_PARAMETER);
|
||||
expect_status("read char null", SysReadKeyboardChar((char*)0), STATUS_INVALID_PARAMETER);
|
||||
|
||||
bool down = true;
|
||||
uint32_t status = SysIsKeyDown(INPUT_KEY_A, &down);
|
||||
if (status != STATUS_SUCCESS)
|
||||
fail_status("is key down", status);
|
||||
|
||||
INPUT_KEY key = INPUT_KEY_A;
|
||||
status = SysPollKeyboard(&key);
|
||||
if (status != STATUS_SUCCESS && status != STATUS_WOULD_BLOCK)
|
||||
fail_status("poll keyboard", status);
|
||||
if (status == STATUS_WOULD_BLOCK && key != INPUT_KEY_NONE)
|
||||
fail_status("poll keyboard would-block key", key);
|
||||
|
||||
INPUT_KEY_RECORD input;
|
||||
SYS_INPUT_EVENT_REQUEST inputReq;
|
||||
inputReq.Size = sizeof(inputReq);
|
||||
inputReq.QueueHandle = 0;
|
||||
inputReq.Flags = SYS_INPUT_EVENT_FLAG_NONE;
|
||||
inputReq.TimeoutMilliseconds = 0;
|
||||
inputReq.RecordOut = &input;
|
||||
|
||||
expect_status("peek input null", SysPeekInputEvent((const SYS_INPUT_EVENT_REQUEST*)0), STATUS_INVALID_PARAMETER);
|
||||
status = SysPeekInputEvent(&inputReq);
|
||||
if (status != STATUS_SUCCESS && status != STATUS_WOULD_BLOCK)
|
||||
fail_status("peek input", status);
|
||||
|
||||
INPUT_MOUSE_EVENT mouse;
|
||||
expect_status("peek mouse null", SysPeekMouse((INPUT_MOUSE_EVENT*)0), STATUS_INVALID_PARAMETER);
|
||||
expect_status("read mouse null", SysReadMouse((INPUT_MOUSE_EVENT*)0), STATUS_INVALID_PARAMETER);
|
||||
|
||||
status = SysPeekMouse(&mouse);
|
||||
if (status != STATUS_SUCCESS && status != STATUS_WOULD_BLOCK)
|
||||
fail_status("peek mouse", status);
|
||||
|
||||
uint32_t readStatus = SysReadMouse(&mouse);
|
||||
if (status == STATUS_SUCCESS) {
|
||||
if (readStatus != STATUS_SUCCESS)
|
||||
fail_status("read mouse after peek", readStatus);
|
||||
} else if (readStatus != STATUS_WOULD_BLOCK) {
|
||||
fail_status("read mouse would-block", readStatus);
|
||||
}
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
expect_status("get mouse pos null x", SysGetMousePos((int*)0, &y), STATUS_INVALID_PARAMETER);
|
||||
expect_status("get mouse pos null y", SysGetMousePos(&x, (int*)0), STATUS_INVALID_PARAMETER);
|
||||
status = SysGetMousePos(&x, &y);
|
||||
if (status != STATUS_SUCCESS)
|
||||
fail_status("get mouse pos", status);
|
||||
|
||||
print("input_api_smoke: PASS\n");
|
||||
exit_now(0);
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user