clean up and standardize types across the codebase, unify atomic operations, improve UTF-8 handling throughout the system, remove obsolete input and named queue interfaces, redesign process preparation and creation, tighten IPC and service boundaries, improve error handling and reliability, minor documentation cleanup, fix doom surfaces, fix panic in ini parsing.

This commit is contained in:
maksw committed 2026-10-12 18:17:43 +02:00
1 parent 899225f551
commit c0ad63c27f
226 files changed
+6562 -4147

No files matched your search

+17 -15
View File
@@ -1,5 +1,6 @@
// RSSRV logical input. The kernel reports normalized physical events; RSSRV owns interpretation, pointer state, and routing.
#include <stdbool.h>
#include "rssrv_internal.h"
#include <ntlite/port.h>
#include <stdlib.h>
@@ -35,6 +36,7 @@ static const RSSRV_KEY_CHAR_PAIR gInputCharMap[] = {
{ INPUT_KEY_COMMA, ',', '<' }, { INPUT_KEY_PERIOD, '.', '>' },
{ INPUT_KEY_SLASH, '/', '?' },
{ INPUT_KEY_SPACE, ' ', ' ' }, { INPUT_KEY_TAB, '\t', '\t' },
{ INPUT_KEY_ESCAPE, '\x1B', '\x1B' },
{ INPUT_KEY_ENTER, '\n', '\n' }, { INPUT_KEY_BACKSPACE, '\b', '\b' },
{ INPUT_KEY_KP_DIVIDE, '/', '/' }, { INPUT_KEY_KP_MULTIPLY, '*', '*' },
{ INPUT_KEY_KP_MINUS, '-', '-' }, { INPUT_KEY_KP_PLUS, '+', '+' },
@@ -57,7 +59,7 @@ static void RssrvInputUnlock(RSSRV_INPUT_STATE* input) {
}
// Tests one logical key bit while the input mutex is held.
static int RssrvInputKeyDownLocked(const RSSRV_INPUT_STATE* input, INPUT_KEY key) {
static bool RssrvInputKeyDownLocked(const RSSRV_INPUT_STATE* input, INPUT_KEY key) {
return key < NTL_INPUT_KEY_BYTES * 8u &&
(input->KeyDown[key >> 3] & (uint8_t)(1u << (key & 7u))) != 0;
}
@@ -70,7 +72,7 @@ static void RssrvInputSetKeyDownLocked(RSSRV_INPUT_STATE* input, INPUT_KEY key,
}
// Returns whether duplicate physical make events should generate repeated logical key records.
static int RssrvInputKeyIsRepeatable(INPUT_KEY key) {
static bool RssrvInputKeyIsRepeatable(INPUT_KEY key) {
switch (key) {
case INPUT_KEY_NONE:
case INPUT_KEY_LEFT_SHIFT:
@@ -83,9 +85,9 @@ static int RssrvInputKeyIsRepeatable(INPUT_KEY key) {
case INPUT_KEY_RIGHT_GUI:
case INPUT_KEY_CAPS_LOCK:
case INPUT_KEY_NUM_LOCK:
return 0;
return false;
default:
return 1;
return true;
}
}
@@ -247,15 +249,15 @@ static void RssrvInputRepeatThread(uintptr_t argument) {
// Applies one normalized relative mouse event and lets Session 0 own cursor and target routing policy.
static void RssrvInputApplyMouse(RSSRV_INPUT_STATE* input, const INPUT_MOUSE_EVENT* event) {
if (!input || !event) return;
int x = 0;
int y = 0;
int changed = 0;
int32_t x = 0;
int32_t y = 0;
bool changed = false;
if (!KSUCCESS(RssrvInputLock(input))) return;
int nx = input->MouseX + event->dx;
int ny = input->MouseY + event->dy;
int width = input->MouseWidth > 0 ? input->MouseWidth : 1;
int height = input->MouseHeight > 0 ? input->MouseHeight : 1;
int32_t nx = input->MouseX + event->dx;
int32_t ny = input->MouseY + event->dy;
int32_t width = input->MouseWidth > 0 ? input->MouseWidth : 1;
int32_t height = input->MouseHeight > 0 ? input->MouseHeight : 1;
if (nx < 0) nx = 0;
if (ny < 0) ny = 0;
if (nx >= width) nx = width - 1;
@@ -313,7 +315,7 @@ static void RssrvInputRawThread(uintptr_t argument) {
// Reads or peeks one logical keyboard record, blocking on the queue event when requested.
KSTATUS RssrvInputReadKeyRecord(RSSRV_INPUT_STATE* input,
int peek,
bool peek,
uint64_t timeoutMilliseconds,
INPUT_KEY_RECORD* recordOut) {
if (!input || !recordOut) return NTLSTATUS_INVALID_PARAMETER;
@@ -351,7 +353,7 @@ KSTATUS RssrvInputFlushKeys(RSSRV_INPUT_STATE* input, uint32_t* discardedOut) {
// Reads or peeks one logical mouse record, blocking on the queue event when requested.
static KSTATUS RssrvInputGetMouse(RSSRV_INPUT_STATE* input,
int peek,
bool peek,
uint64_t timeoutMilliseconds,
INPUT_MOUSE_EVENT* eventOut) {
if (!input || !eventOut) return NTLSTATUS_INVALID_PARAMETER;
@@ -470,12 +472,12 @@ static void RssrvInputSessionThread(uintptr_t argument) {
memset(&state, 0, sizeof(state));
switch (request.Operation) {
case NTL_INPUT_OP_READ_KEY:
status = RssrvInputReadKeyRecord(input, 0, request.TimeoutMilliseconds, &key);
status = RssrvInputReadKeyRecord(input, false, request.TimeoutMilliseconds, &key);
(void)RssrvInputReply(endpoint, info.MessageId, request.Operation, status,
KSUCCESS(status) ? &key : 0, 0, 0);
break;
case NTL_INPUT_OP_PEEK_KEY:
status = RssrvInputReadKeyRecord(input, 1, request.TimeoutMilliseconds, &key);
status = RssrvInputReadKeyRecord(input, true, request.TimeoutMilliseconds, &key);
(void)RssrvInputReply(endpoint, info.MessageId, request.Operation, status,
KSUCCESS(status) ? &key : 0, 0, 0);
break;