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:
maksw committed 2026-06-26 15:18:48 +02:00
1 parent 2c4a68a75f
commit ed3d065abd
156 files changed
+10509 -2643

No files matched your search

@@ -0,0 +1,103 @@
// Protected-process smoke test.
// Verifies that kernel-owned processes remain queryable but cannot be terminated.
#include <stddef.h>
#include <stdint.h>
#include <ntlite/syscall.h>
#define MAX_PROCESSES 16u
// Prints one NUL-terminated string to the console.
static void print(const char* text) {
SYS_WRITE_CONSOLE_REQUEST request = { SysSvFromCstr(text) };
(void)SysWriteConsole(&request);
}
// Prints one unsigned integer to the console.
static void print_u32(uint32_t value) {
char buffer[16];
size_t length = 0;
if (value == 0) {
print("0");
return;
}
while (value && length < sizeof(buffer)) {
buffer[length++] = (char)('0' + (value % 10u));
value /= 10u;
}
while (length) {
char digit = buffer[--length];
SYS_WRITE_CONSOLE_REQUEST request = { SysSvFromParts(&digit, 1) };
(void)SysWriteConsole(&request);
}
}
// Terminates the current test process.
static void exit_now(int32_t code) {
for (;;) (void)SysExitProcess(code);
}
// Fails the test with one status value.
static void fail_status(const char* operation, uint32_t status) {
print("process_protection_smoke: ");
print(operation);
print(" status=");
print_u32(status);
print("\n");
exit_now(1);
}
// Verifies one protected process remains alive after a kill attempt.
static void verify_protected_process(const SYS_PROCESS_INFO* process) {
uint32_t handle = 0;
uint32_t status = SysOpenProcess(process->ProcessId, &handle);
if (status != STATUS_SUCCESS)
fail_status("open protected process", status);
status = SysKillProcess(handle, (int32_t)STATUS_PROCESS_KILLED);
if (status != STATUS_ACCESS_DENIED) {
SysCloseHandle(handle);
fail_status("kill protected process", status);
}
status = SysWaitSingle(handle, SYS_WAIT_FLAG_NONE, 0);
SysCloseHandle(handle);
if (status != STATUS_TIMEOUT)
fail_status("protected process remained signaled", status);
}
// Runs the protected-process contract checks.
void main(void) {
print("process_protection_smoke: start\n");
SYS_PROCESS_INFO processes[MAX_PROCESSES];
size_t count = 0;
uint32_t status = SysGetProcessList(processes, MAX_PROCESSES, &count);
if (status != STATUS_SUCCESS)
fail_status("query process list", status);
int sawIdle = 0;
int sawSystem = 0;
size_t limit = count < MAX_PROCESSES ? count : MAX_PROCESSES;
for (size_t i = 0; i < limit; i++) {
const SYS_PROCESS_INFO* process = &processes[i];
if (!(process->Flags & (SYS_PROCESS_FLAG_IDLE | SYS_PROCESS_FLAG_SYSTEM)))
continue;
if (!(process->Flags & SYS_PROCESS_FLAG_TERMINATION_PROTECTED))
fail_status("missing protected flag", process->ProcessId);
verify_protected_process(process);
if (process->Flags & SYS_PROCESS_FLAG_IDLE) sawIdle = 1;
if (process->Flags & SYS_PROCESS_FLAG_SYSTEM) sawSystem = 1;
}
if (!sawIdle || !sawSystem)
fail_status("missing kernel process", (uint32_t)((sawIdle ? 1u : 0u) | (sawSystem ? 2u : 0u)));
print("process_protection_smoke: PASS\n");
exit_now(0);
}