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:
1 parent
899225f551
commit
c0ad63c27f
226 files changed
+6562
-4147
No files matched your search
@@ -1,5 +1,7 @@
|
||||
// I/O manager. This file owns driver objects, device stacks, PnP dispatch, and the disk namespace.
|
||||
|
||||
#include <ntlite/atomic.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <intrin.h>
|
||||
#include <ntlite/ddi/io_driver.h>
|
||||
@@ -87,6 +89,7 @@ __declspec(dllexport) void IoInitializeDriverObject(DRIVER_OBJECT* driver,
|
||||
// Registers driver Object.
|
||||
__declspec(dllexport) KSTATUS IoRegisterDriverObject(DRIVER_OBJECT* driver) {
|
||||
if (!driver) return NTLSTATUS_INVALID_PARAMETER;
|
||||
if (!SysSvIsUtf8Text(driver->Name)) return NTLSTATUS_INVALID_PARAMETER;
|
||||
if (gDriverObjectCount >= MAX_DRIVER_OBJECTS)
|
||||
return NTLSTATUS_NO_MEMORY;
|
||||
|
||||
@@ -193,7 +196,7 @@ __declspec(dllexport) KSTATUS IoCreatePhysicalDevice(DRIVER_OBJECT* busDriver,
|
||||
|
||||
if (idCount && ids) {
|
||||
for (size_t i = 0; i < idCount; i++) {
|
||||
if (!SysSvIsValid(ids[i].Id) || ids[i].Id.Length >= IO_MAX_DEVICE_ID_CHARS) {
|
||||
if (!SysSvIsUtf8Text(ids[i].Id) || ids[i].Id.Length >= IO_MAX_DEVICE_ID_CHARS) {
|
||||
IoDeleteDevice(pdo);
|
||||
return NTLSTATUS_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -255,7 +258,7 @@ __declspec(dllexport) KSTATUS IoRegisterPhysicalDevice(DEVICE_OBJECT* pdo) {
|
||||
|
||||
__declspec(dllexport) KSTATUS IoSetDeviceName(DEVICE_OBJECT* device,
|
||||
SYS_STRING_VIEW name) {
|
||||
if (!device || !SysSvIsValid(name))
|
||||
if (!device || !SysSvIsUtf8Text(name))
|
||||
return NTLSTATUS_INVALID_PARAMETER;
|
||||
if (name.Length >= IO_MAX_DEVICE_NAME_CHARS)
|
||||
return NTLSTATUS_BUFFER_TOO_SMALL;
|
||||
@@ -397,7 +400,7 @@ __declspec(dllexport) KSTATUS IoForwardIrpToLower(DEVICE_OBJECT* device, IRP* ir
|
||||
|
||||
if (currentDevice == device) {
|
||||
cur->DeviceObject = (DEVICE_OBJECT*)0;
|
||||
_InterlockedDecrement(&device->OutstandingIrps);
|
||||
NtlAtomicDecrement32(&device->OutstandingIrps);
|
||||
IoDereferenceDeviceObject(device);
|
||||
}
|
||||
|
||||
@@ -693,13 +696,13 @@ __declspec(dllexport) KSTATUS IoCallDriver(DEVICE_OBJECT* device, IRP* irp) {
|
||||
|
||||
ios->DeviceObject = device;
|
||||
IoReferenceDeviceObject(device);
|
||||
_InterlockedIncrement(&device->OutstandingIrps);
|
||||
NtlAtomicIncrement32(&device->OutstandingIrps);
|
||||
|
||||
KSTATUS st = dispatch(device, irp);
|
||||
if (st != NTLSTATUS_PENDING) {
|
||||
if (ios->DeviceObject == device) {
|
||||
ios->DeviceObject = (DEVICE_OBJECT*)0;
|
||||
_InterlockedDecrement(&device->OutstandingIrps);
|
||||
NtlAtomicDecrement32(&device->OutstandingIrps);
|
||||
IoDereferenceDeviceObject(device);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user