implement user mode catchable exceptions, refactor system status codes to use NTLSTATUS_ prefix, update build scripts to use shared literal macros for linker arguments, update named queue lifetime cleanup to include KeNamedQueueUnpublishHandle.

This commit is contained in:
maksw committed 2026-06-27 20:38:43 +02:00
1 parent 1f5477cf66
commit b7fcfce6f7
140 files changed
+7649 -3943

No files matched your search

+91 -91
View File
@@ -138,10 +138,10 @@ static KSTATUS KiDisplayAcquireProviderMutex(bool* acquired) {
*acquired = false;
if (!gDisplayProviderMutex || !KiDisplayProviderCallbacksRequirePassive())
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
if (!KeCanWait())
return STATUS_INVALID_IRQL;
return NTLSTATUS_INVALID_IRQL;
if (KeGetDebugFlags() & KE_DEBUG_DISPLAY_ASSERTS)
KeAssertIrql(PASSIVE_LEVEL);
@@ -163,9 +163,9 @@ static KSTATUS KiDisplayFallbackPrintChar(char c, uint32_t fg, uint32_t bg) {
const HAL_API* hal = gDisplayHal;
if (hal && hal->Screen.PrintChar) {
hal->Screen.PrintChar(c, fg, bg);
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
return STATUS_INVALID_IRQL;
return NTLSTATUS_INVALID_IRQL;
}
static void KiDisplayQueueCursorWork(void) {
@@ -259,7 +259,7 @@ static void KiDisplayCursorWorker(void* context) {
bool positionCommitted = false;
int newCommittedX = committedX;
int newCommittedY = committedY;
KSTATUS status = STATUS_SUCCESS;
KSTATUS status = NTLSTATUS_SUCCESS;
bool hasCursorOps = device && ops && ops->ShowCursor &&
(caps & (DISPLAY_CAP_SOFTWARE_CURSOR | DISPLAY_CAP_HARDWARE_CURSOR));
bool softwareCursor = hasCursorOps && (caps & DISPLAY_CAP_SOFTWARE_CURSOR) != 0;
@@ -446,7 +446,7 @@ static void KiDisplayRecordCopyLocked(const DISPLAY_MODE* mode, int dstX, int ds
static KSTATUS KiDisplayFlushDirtyWithSnapshot(DISPLAY_DEVICE* device, const DISPLAY_DEVICE_OPS* ops) {
if (!device || !ops || !ops->Present)
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
DISPLAY_RECT localRects[DISPLAY_MAX_DIRTY_RECTS];
DISPLAY_RECT fullRect;
@@ -457,7 +457,7 @@ static KSTATUS KiDisplayFlushDirtyWithSnapshot(DISPLAY_DEVICE* device, const DIS
uintptr_t flags = KeAcquireSpinlock(&gDisplayLock);
if (device != gPrimaryDisplay || (!gDirtyAll && gDirtyRectCount == 0)) {
KeReleaseSpinlock(&gDisplayLock, flags);
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
dirtyAll = gDirtyAll;
@@ -473,7 +473,7 @@ static KSTATUS KiDisplayFlushDirtyWithSnapshot(DISPLAY_DEVICE* device, const DIS
if (dirtyAll) {
DISPLAY_MODE mode;
if (!ops->GetMode)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
KSTATUS ms = ops->GetMode(device, &mode);
if (!KSUCCESS(ms))
return ms;
@@ -578,9 +578,9 @@ static KSTATUS KiDisplayGetProviderSnapshot(DISPLAY_DEVICE** outDevice,
uint32_t caps = 0;
if (!KiDisplaySnapshotPrimary(&device, &ops, &caps, 0) || !device || !ops)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
if (!ops->GetMode)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
KSTATUS s = ops->GetMode(device, outMode);
if (!KSUCCESS(s))
@@ -589,7 +589,7 @@ static KSTATUS KiDisplayGetProviderSnapshot(DISPLAY_DEVICE** outDevice,
if (outDevice) *outDevice = device;
if (outOps) *outOps = ops;
if (outCaps) *outCaps = caps;
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
static void KiDisplayBuildGlyphPixels(char c, uint32_t fg, uint32_t bg, uint32_t* outPixels) {
@@ -610,7 +610,7 @@ static KSTATUS KiDisplayBlitGlyphSnapshot(DISPLAY_DEVICE* device,
uint32_t fg,
uint32_t bg) {
if (!device || !ops || !ops->Blit || !mode)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
uint32_t glyphPixels[FONT_W * FONT_H];
KiDisplayBuildGlyphPixels(c, fg, bg, glyphPixels);
@@ -633,9 +633,9 @@ static KSTATUS KiDisplayDrawBlitSnapshot(DISPLAY_DEVICE* device,
int h,
const uint32_t* pixels) {
if (!pixels || w <= 0 || h <= 0)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
if (!device || !ops || !ops->Blit || !mode)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
KSTATUS s = ops->Blit(device, x, y, w, h, pixels);
if (KSUCCESS(s)) {
@@ -656,9 +656,9 @@ static KSTATUS KiDisplayFillRectSnapshot(DISPLAY_DEVICE* device,
int h,
uint32_t color) {
if (w <= 0 || h <= 0)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
if (!device || !ops || !ops->FillRect || !mode)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
KSTATUS s = ops->FillRect(device, x, y, w, h, color);
if (KSUCCESS(s)) {
@@ -680,9 +680,9 @@ static KSTATUS KiDisplayCopyRectSnapshot(DISPLAY_DEVICE* device,
int w,
int h) {
if (w <= 0 || h <= 0)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
if (!device || !ops || !ops->CopyRect || !mode)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
KSTATUS s = ops->CopyRect(device, dstX, dstY, srcX, srcY, w, h);
if (KSUCCESS(s)) {
@@ -698,7 +698,7 @@ static KSTATUS KiDisplayFinishProviderDraw(DISPLAY_DEVICE* device,
const DISPLAY_DEVICE_OPS* ops,
uint32_t caps,
KSTATUS drawStatus) {
KSTATUS presentStatus = STATUS_SUCCESS;
KSTATUS presentStatus = NTLSTATUS_SUCCESS;
if (KSUCCESS(drawStatus))
presentStatus = KiDisplayFlushDirtyWithSnapshot(device, ops);
KiDisplayRestoreCursorAfterDrawSnapshot(device, ops, caps);
@@ -743,9 +743,9 @@ static void KiDisplayAddDirty(int x, int y, int w, int h) {
// Implements the display Flush Dirty operation.
static KSTATUS KiDisplayFlushDirty(void) {
if (!KiDisplayHasDevice() || !gPrimaryDisplay->Ops->Present)
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
if (!gDirtyAll && gDirtyRectCount == 0)
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
DISPLAY_RECT full;
const DISPLAY_RECT* rects = gDirtyRects;
@@ -803,7 +803,7 @@ static void KiDisplayBeginDraw(void) {
// Implements the display End Draw operation.
static KSTATUS KiDisplayEndDraw(void) {
KSTATUS s = STATUS_SUCCESS;
KSTATUS s = NTLSTATUS_SUCCESS;
if (gDrawDepth > 0)
gDrawDepth--;
@@ -817,9 +817,9 @@ static KSTATUS KiDisplayEndDraw(void) {
// Implements the display Draw Blit No Cursor operation.
static KSTATUS KiDisplayDrawBlitNoCursor(int x, int y, int w, int h, const uint32_t* pixels) {
if (!pixels || w <= 0 || h <= 0)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
if (!KiDisplayHasDevice() || !gPrimaryDisplay->Ops->Blit)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
KSTATUS s = gPrimaryDisplay->Ops->Blit(gPrimaryDisplay, x, y, w, h, pixels);
if (KSUCCESS(s)) {
@@ -833,9 +833,9 @@ static KSTATUS KiDisplayDrawBlitNoCursor(int x, int y, int w, int h, const uint3
// Implements the display Fill Rect No Cursor operation.
static KSTATUS KiDisplayFillRectNoCursor(int x, int y, int w, int h, uint32_t color) {
if (w <= 0 || h <= 0)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
if (!KiDisplayHasDevice() || !gPrimaryDisplay->Ops->FillRect)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
KSTATUS s = gPrimaryDisplay->Ops->FillRect(gPrimaryDisplay, x, y, w, h, color);
if (KSUCCESS(s)) {
@@ -849,9 +849,9 @@ static KSTATUS KiDisplayFillRectNoCursor(int x, int y, int w, int h, uint32_t co
// Implements the display Copy Rect No Cursor operation.
static KSTATUS KiDisplayCopyRectNoCursor(int dstX, int dstY, int srcX, int srcY, int w, int h) {
if (w <= 0 || h <= 0)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
if (!KiDisplayHasDevice() || !gPrimaryDisplay->Ops->CopyRect)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
KSTATUS s = gPrimaryDisplay->Ops->CopyRect(gPrimaryDisplay, dstX, dstY, srcX, srcY, w, h);
if (KSUCCESS(s)) {
@@ -1180,13 +1180,13 @@ void KeDisplayInitialize(const HAL_API* hal) {
DISPLAY_API KSTATUS KeDisplayRegisterDevice(DISPLAY_DEVICE* device) {
if (!device || !device->Name || !device->Ops || !device->Ops->GetMode)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
KSTATUS result = STATUS_SUCCESS;
KSTATUS result = NTLSTATUS_SUCCESS;
uintptr_t flags = KeAcquireSpinlock(&gDisplayLock);
for (DISPLAY_DEVICE* it = gDisplayList; it; it = it->Next) {
if (it == device) {
result = STATUS_ALREADY_EXISTS;
result = NTLSTATUS_ALREADY_EXISTS;
break;
}
}
@@ -1205,10 +1205,10 @@ DISPLAY_API KSTATUS KeDisplayRegisterDevice(DISPLAY_DEVICE* device) {
// Implements the display Seed New Primary operation.
static KSTATUS KiDisplaySeedNewPrimary(DISPLAY_DEVICE* oldDevice, DISPLAY_DEVICE* newDevice) {
if (!oldDevice || !newDevice || oldDevice == newDevice)
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
if (!oldDevice->Ops || !oldDevice->Ops->ReadRect ||
!newDevice->Ops || !newDevice->Ops->GetMode || !newDevice->Ops->Blit)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
DISPLAY_MODE oldMode;
DISPLAY_MODE newMode;
@@ -1221,11 +1221,11 @@ static KSTATUS KiDisplaySeedNewPrimary(DISPLAY_DEVICE* oldDevice, DISPLAY_DEVICE
if (oldMode.Format != DisplayPixelFormatX8R8G8B8 ||
newMode.Format != DisplayPixelFormatX8R8G8B8 ||
oldMode.Width != newMode.Width || oldMode.Height != newMode.Height)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
uint32_t* row = (uint32_t*)MmAllocatePool((size_t)newMode.Width * sizeof(uint32_t));
if (!row)
return STATUS_NO_MEMORY;
return NTLSTATUS_NO_MEMORY;
for (uint32_t y = 0; y < newMode.Height; y++) {
s = oldDevice->Ops->ReadRect(oldDevice, 0, (int)y, (int)newMode.Width, 1, row, newMode.Width);
@@ -1251,7 +1251,7 @@ static bool KiDisplayOutputSuspended(void) {
DISPLAY_API KSTATUS KeDisplaySetPrimary(DISPLAY_DEVICE* device) {
if (!device || !device->Ops || !device->Ops->GetMode)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
const char* name = device->Name ? device->Name : "?";
@@ -1265,7 +1265,7 @@ DISPLAY_API KSTATUS KeDisplaySetPrimary(DISPLAY_DEVICE* device) {
}
if (!found) {
KeReleaseSpinlock(&gDisplayLock, flags);
return STATUS_NOT_FOUND;
return NTLSTATUS_NOT_FOUND;
}
DISPLAY_DEVICE* oldDevice = gPrimaryDisplay;
@@ -1342,7 +1342,7 @@ DISPLAY_API KSTATUS KeDisplaySetPrimary(DISPLAY_DEVICE* device) {
DISPLAY_API KSTATUS KeDisplayGetMode(DISPLAY_MODE* outMode) {
if (!outMode)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
bool providerHeld = false;
KSTATUS s = KiDisplayAcquireProviderMutex(&providerHeld);
@@ -1355,7 +1355,7 @@ DISPLAY_API KSTATUS KeDisplayGetMode(DISPLAY_MODE* outMode) {
KeReleaseSpinlock(&gDisplayLock, flags);
s = (!device || !ops || !ops->GetMode)
? STATUS_INVALID_PARAMETER
? NTLSTATUS_INVALID_PARAMETER
: ops->GetMode(device, outMode);
KiDisplayReleaseProviderMutex(providerHeld);
@@ -1369,7 +1369,7 @@ DISPLAY_API KSTATUS KeDisplayGetSize(int* outWidth, int* outHeight) {
return s;
if (outWidth) *outWidth = (int)mode.Width;
if (outHeight) *outHeight = (int)mode.Height;
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
DISPLAY_API KSTATUS KeDisplaySync(void) {
@@ -1385,7 +1385,7 @@ DISPLAY_API KSTATUS KeDisplaySync(void) {
if (!device || !ops || !ops->Sync) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
s = ops->Sync(device);
@@ -1401,7 +1401,7 @@ DISPLAY_API KSTATUS KeDisplaySync(void) {
DISPLAY_API KSTATUS KeDisplayQueryInfo(KE_DISPLAY_INFO* outInfo) {
if (!outInfo)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
bool providerHeld = false;
KSTATUS s = KiDisplayAcquireProviderMutex(&providerHeld);
@@ -1435,7 +1435,7 @@ DISPLAY_API KSTATUS KeDisplayQueryInfo(KE_DISPLAY_INFO* outInfo) {
if (!device || !ops) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_FOUND;
return NTLSTATUS_NOT_FOUND;
}
if (ops->GetMode) {
@@ -1451,7 +1451,7 @@ DISPLAY_API KSTATUS KeDisplayQueryInfo(KE_DISPLAY_INFO* outInfo) {
*outInfo = info;
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
DISPLAY_API KSTATUS KeDisplayBlit(int x, int y, int w, int h, const uint32_t* pixels) {
@@ -1477,7 +1477,7 @@ DISPLAY_API KSTATUS KeDisplayBlit(int x, int y, int w, int h, const uint32_t* pi
DISPLAY_API KSTATUS KeDisplayBlitRows(int x, int y, int w, int h, KE_DISPLAY_ROW_SOURCE source, void* context, uint32_t* scratch) {
if (!source || !scratch || w <= 0 || h <= 0)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
bool providerHeld = false;
KSTATUS s = KiDisplayAcquireProviderMutex(&providerHeld);
@@ -1580,7 +1580,7 @@ DISPLAY_API KSTATUS KeDisplayCopyRect(int dstX, int dstY, int srcX, int srcY, in
DISPLAY_API KSTATUS KeDisplayScroll(int lines) {
if (lines <= 0)
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
bool providerHeld = false;
KSTATUS s = KiDisplayAcquireProviderMutex(&providerHeld);
@@ -1646,7 +1646,7 @@ static KSTATUS KiDisplayPrintCharInternal(char c, uint32_t fg, uint32_t bg) {
if (KiDisplayOutputSuspended()) {
if (!KeCanWait())
return KiDisplayFallbackPrintChar(c, fg, bg);
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
// Once the scheduler/work-queue era begins, display provider callbacks are
@@ -1677,7 +1677,7 @@ static KSTATUS KiDisplayPrintCharInternal(char c, uint32_t fg, uint32_t bg) {
int rows = 0;
if (!KiDisplayConsoleGridFromMode(&mode, &cols, &rows)) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_DEVICE_ERROR;
return NTLSTATUS_DEVICE_ERROR;
}
(void)KiDisplayHideCursorForDrawSnapshot(device, ops, caps);
@@ -1726,7 +1726,7 @@ static KSTATUS KiDisplayPrintCharInternal(char c, uint32_t fg, uint32_t bg) {
KeReleaseSpinlock(&gDisplayLock, flags);
}
} else {
s = STATUS_SUCCESS;
s = NTLSTATUS_SUCCESS;
}
if (KSUCCESS(s) && needScroll) {
@@ -1760,7 +1760,7 @@ DISPLAY_API KSTATUS KeDisplayPrintChar(char c, uint32_t fg, uint32_t bg) {
DISPLAY_API KSTATUS KeDisplayGetConsoleInfo(KE_CONSOLE_INFO* outInfo) {
if (!outInfo)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
bool providerHeld = false;
KSTATUS s = KiDisplayAcquireProviderMutex(&providerHeld);
@@ -1775,14 +1775,14 @@ DISPLAY_API KSTATUS KeDisplayGetConsoleInfo(KE_CONSOLE_INFO* outInfo) {
s = KiDisplayGetProviderSnapshot(&device, &ops, &caps, &mode);
if (!KSUCCESS(s)) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
int cols = 0;
int rows = 0;
if (!KiDisplayConsoleGridFromMode(&mode, &cols, &rows)) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
uintptr_t flags = KeAcquireSpinlock(&gDisplayLock);
@@ -1794,7 +1794,7 @@ DISPLAY_API KSTATUS KeDisplayGetConsoleInfo(KE_CONSOLE_INFO* outInfo) {
KeReleaseSpinlock(&gDisplayLock, flags);
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
DISPLAY_API KSTATUS KeDisplaySetConsoleCursor(int col, int row) {
@@ -1811,18 +1811,18 @@ DISPLAY_API KSTATUS KeDisplaySetConsoleCursor(int col, int row) {
s = KiDisplayGetProviderSnapshot(&device, &ops, &caps, &mode);
if (!KSUCCESS(s)) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
int cols = 0;
int rows = 0;
if (!KiDisplayConsoleGridFromMode(&mode, &cols, &rows)) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
if (col < 0 || row < 0 || col >= cols || row >= rows) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
}
uintptr_t flags = KeAcquireSpinlock(&gDisplayLock);
@@ -1831,7 +1831,7 @@ DISPLAY_API KSTATUS KeDisplaySetConsoleCursor(int col, int row) {
KeReleaseSpinlock(&gDisplayLock, flags);
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
DISPLAY_API KSTATUS KeDisplayFillConsoleChars(char c, int col, int row, size_t length, size_t* writtenOut) {
@@ -1849,18 +1849,18 @@ DISPLAY_API KSTATUS KeDisplayFillConsoleChars(char c, int col, int row, size_t l
s = KiDisplayGetProviderSnapshot(&device, &ops, &caps, &mode);
if (!KSUCCESS(s)) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
int cols = 0;
int rows = 0;
if (!KiDisplayConsoleGridFromMode(&mode, &cols, &rows)) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
if (col < 0 || row < 0 || col >= cols || row >= rows) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
}
(void)KiDisplayHideCursorForDrawSnapshot(device, ops, caps);
@@ -1918,18 +1918,18 @@ DISPLAY_API KSTATUS KeDisplayFillConsoleAttrs(uint16_t attr, int col, int row, s
s = KiDisplayGetProviderSnapshot(&device, &ops, &caps, &mode);
if (!KSUCCESS(s)) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
int cols = 0;
int rows = 0;
if (!KiDisplayConsoleGridFromMode(&mode, &cols, &rows)) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
if (col < 0 || row < 0 || col >= cols || row >= rows) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
}
(void)KiDisplayHideCursorForDrawSnapshot(device, ops, caps);
@@ -1989,7 +1989,7 @@ DISPLAY_API KSTATUS KeDisplayPresent(const DISPLAY_RECT* rects, size_t rectCount
}
if (!ops->Present) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
(void)KiDisplayHideCursorForDrawSnapshot(device, ops, caps);
@@ -2024,7 +2024,7 @@ DISPLAY_API KSTATUS KeDisplaySetCursorImage(int width, int height, int hotX, int
if (!device || !ops || !ops->SetCursorImage) {
KiDisplayReleaseProviderMutex(providerHeld);
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
s = ops->SetCursorImage(device, width, height, hotX, hotY, argbPixels);
@@ -2049,7 +2049,7 @@ DISPLAY_API KSTATUS KeDisplaySetCursorPosition(int x, int y) {
if (shouldQueue)
KiDisplayQueueCursorWork();
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
DISPLAY_API KSTATUS KeDisplayShowCursor(bool show) {
@@ -2071,7 +2071,7 @@ DISPLAY_API KSTATUS KeDisplayShowCursor(bool show) {
if (shouldQueue)
KiDisplayQueueCursorWork();
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
// Implements the boot Fb Context operation.
@@ -2083,20 +2083,20 @@ static BOOTFB_CONTEXT* BootFbContext(DISPLAY_DEVICE* device) {
static KSTATUS BootFbGetMode(DISPLAY_DEVICE* device, DISPLAY_MODE* outMode) {
BOOTFB_CONTEXT* fb = BootFbContext(device);
if (!fb || !fb->Framebuffer || !outMode)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
outMode->Width = fb->Width;
outMode->Height = fb->Height;
outMode->Stride = fb->Stride;
outMode->Format = DisplayPixelFormatX8R8G8B8;
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
// Implements the boot Fb Blit operation.
static KSTATUS BootFbBlit(DISPLAY_DEVICE* device, int x, int y, int w, int h, const uint32_t* pixels) {
BOOTFB_CONTEXT* fb = BootFbContext(device);
if (!fb || !fb->Framebuffer || !pixels || w <= 0 || h <= 0)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
uint32_t* dstBase = fb->Backbuffer ? fb->Backbuffer : fb->Framebuffer;
@@ -2105,7 +2105,7 @@ static KSTATUS BootFbBlit(DISPLAY_DEVICE* device, int x, int y, int w, int h, co
int endX = x + w > (int)fb->Width ? (int)fb->Width : x + w;
int endY = y + h > (int)fb->Height ? (int)fb->Height : y + h;
if (startX >= endX || startY >= endY)
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
int srcOffsetX = startX - x;
int srcOffsetY = startY - y;
@@ -2119,14 +2119,14 @@ static KSTATUS BootFbBlit(DISPLAY_DEVICE* device, int x, int y, int w, int h, co
const uint32_t* src = pixels + ((size_t)(srcOffsetY + row) * (size_t)w) + srcOffsetX;
memcpy(dst, src, bytesPerRow);
}
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
// Implements the boot Fb Fill Rect operation.
static KSTATUS BootFbFillRect(DISPLAY_DEVICE* device, int x, int y, int w, int h, uint32_t color) {
BOOTFB_CONTEXT* fb = BootFbContext(device);
if (!fb || !fb->Framebuffer || w <= 0 || h <= 0)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
uint32_t* dstBase = fb->Backbuffer ? fb->Backbuffer : fb->Framebuffer;
@@ -2135,7 +2135,7 @@ static KSTATUS BootFbFillRect(DISPLAY_DEVICE* device, int x, int y, int w, int h
int endX = x + w > (int)fb->Width ? (int)fb->Width : x + w;
int endY = y + h > (int)fb->Height ? (int)fb->Height : y + h;
if (startX >= endX || startY >= endY)
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
fb->Stats.FillRectCount++;
fb->Stats.BytesCopied += (uint64_t)(endX - startX) * (uint64_t)(endY - startY) * sizeof(uint32_t);
@@ -2145,14 +2145,14 @@ static KSTATUS BootFbFillRect(DISPLAY_DEVICE* device, int x, int y, int w, int h
for (int xx = startX; xx < endX; xx++)
*dst++ = color;
}
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
// Implements the boot Fb Copy Rect operation.
static KSTATUS BootFbCopyRect(DISPLAY_DEVICE* device, int dstX, int dstY, int srcX, int srcY, int w, int h) {
BOOTFB_CONTEXT* fb = BootFbContext(device);
if (!fb || !fb->Framebuffer || w <= 0 || h <= 0)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
uint32_t* base = fb->Backbuffer ? fb->Backbuffer : fb->Framebuffer;
@@ -2165,7 +2165,7 @@ static KSTATUS BootFbCopyRect(DISPLAY_DEVICE* device, int dstX, int dstY, int sr
if (srcY + h > (int)fb->Height) h = (int)fb->Height - srcY;
if (dstY + h > (int)fb->Height) h = (int)fb->Height - dstY;
if (w <= 0 || h <= 0)
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
fb->Stats.CopyRectCount++;
fb->Stats.BytesCopied += (uint64_t)(uint32_t)w * (uint64_t)(uint32_t)h * sizeof(uint32_t);
@@ -2184,20 +2184,20 @@ static KSTATUS BootFbCopyRect(DISPLAY_DEVICE* device, int dstX, int dstY, int sr
memmove(dst, src, rowBytes);
}
}
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
// Implements the boot Fb Read Rect operation.
static KSTATUS BootFbReadRect(DISPLAY_DEVICE* device, int x, int y, int w, int h, uint32_t* outPixels, uint32_t outStride) {
BOOTFB_CONTEXT* fb = BootFbContext(device);
if (!fb || !fb->Framebuffer || !outPixels || outStride == 0 || w <= 0 || h <= 0)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
uint32_t* srcBase = fb->Backbuffer ? fb->Backbuffer : fb->Framebuffer;
DISPLAY_MODE mode = { fb->Width, fb->Height, fb->Stride, DisplayPixelFormatX8R8G8B8 };
DISPLAY_RECT r = { x, y, w, h };
if (!KiDisplayClipRect(&mode, &r))
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
fb->Stats.ReadRectCount++;
fb->Stats.BytesCopied += (uint64_t)(uint32_t)r.W * (uint64_t)(uint32_t)r.H * sizeof(uint32_t);
@@ -2209,16 +2209,16 @@ static KSTATUS BootFbReadRect(DISPLAY_DEVICE* device, int x, int y, int w, int h
uint32_t* dst = outPixels + ((size_t)(dstOffsetY + row) * outStride) + dstOffsetX;
memcpy(dst, src, (size_t)r.W * sizeof(uint32_t));
}
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
// Implements the boot Fb Present operation.
static KSTATUS BootFbPresent(DISPLAY_DEVICE* device, const DISPLAY_RECT* rects, size_t rectCount) {
BOOTFB_CONTEXT* fb = BootFbContext(device);
if (!fb || !fb->Framebuffer)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
if (!fb->Backbuffer || !rects || rectCount == 0)
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
DISPLAY_MODE mode;
KSTATUS s = BootFbGetMode(device, &mode);
@@ -2240,14 +2240,14 @@ static KSTATUS BootFbPresent(DISPLAY_DEVICE* device, const DISPLAY_RECT* rects,
memcpy(dst, src, bytesPerRow);
}
}
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
// Implements the boot Fb Sync operation.
static KSTATUS BootFbSync(DISPLAY_DEVICE* device) {
BOOTFB_CONTEXT* fb = BootFbContext(device);
if (fb) fb->Stats.SyncCount++;
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
// Implements the boot Fb Set Cursor Image operation.
@@ -2258,7 +2258,7 @@ static KSTATUS BootFbSetCursorImage(DISPLAY_DEVICE* device, int width, int heigh
(void)hotX;
(void)hotY;
(void)argbPixels;
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
}
// Implements the boot Fb Set Cursor Position operation.
@@ -2267,7 +2267,7 @@ static KSTATUS BootFbSetCursorPosition(DISPLAY_DEVICE* device, int x, int y) {
if (fb) fb->Stats.CursorMoveCount++;
(void)x;
(void)y;
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
// Implements the display Blend Pixel operation.
@@ -2338,7 +2338,7 @@ static void BootFbDrawCursor(BOOTFB_CONTEXT* fb, int x, int y) {
static KSTATUS BootFbShowCursor(DISPLAY_DEVICE* device, bool show) {
BOOTFB_CONTEXT* fb = BootFbContext(device);
if (!fb || !fb->Framebuffer || !fb->Backbuffer)
return STATUS_NOT_SUPPORTED;
return NTLSTATUS_NOT_SUPPORTED;
if (show) {
fb->Stats.CursorShowCount++;
@@ -2347,14 +2347,14 @@ static KSTATUS BootFbShowCursor(DISPLAY_DEVICE* device, bool show) {
fb->Stats.CursorHideCount++;
BootFbRestoreCursor(fb);
}
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}
// Implements the boot Fb Query Stats operation.
static KSTATUS BootFbQueryStats(DISPLAY_DEVICE* device, DISPLAY_STATS* outStats) {
BOOTFB_CONTEXT* fb = BootFbContext(device);
if (!fb || !outStats)
return STATUS_INVALID_PARAMETER;
return NTLSTATUS_INVALID_PARAMETER;
*outStats = fb->Stats;
return STATUS_SUCCESS;
return NTLSTATUS_SUCCESS;
}