[0.4.16][WIN32SS][NTOSKRNL] GPU Hacks

[WIN32SS] BADF00D HACK
[WIN32SS] Weird issues i noticed with ATI drivers
[NTOSKRNL] Minimal NpxThread change
This commit is contained in:
Justin Miller
2025-12-26 19:09:28 -08:00
committed by Carl J. Bialorucki
parent 0f9efcb643
commit c10cf2c8dd
3 changed files with 42 additions and 0 deletions

View File

@@ -1355,6 +1355,17 @@ KeTerminateThread(IN KPRIORITY Increment)
PKPROCESS Process = Thread->ApcState.Process;
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
#if defined(_M_IX86) && !defined(CONFIG_SMP)
if (KeI386NpxPresent)
{
PKTHREAD NpxKThread = Thread;
(VOID)InterlockedCompareExchangePointer((PVOID*)&KeGetCurrentPrcb()->NpxThread,
NULL,
NpxKThread);
Thread->NpxState = NPX_STATE_NOT_LOADED;
}
#endif
/* Lock the process */
KiAcquireProcessLockRaiseToSynch(Process, &LockHandle);

View File

@@ -228,6 +228,34 @@ CallDibBitBlt(SURFOBJ* OutputObj,
SURFOBJ *psoPattern;
BOOLEAN Result;
/* Validate output surface and its scan buffer */
if (!OutputObj || !OutputObj->pvScan0)
{
DPRINT1("CallDibBitBlt: Invalid OutputObj or pvScan0\n");
return FALSE;
}
/* Validate input surface and its scan buffer if ROP uses source */
if (ROP4_USES_SOURCE(Rop4))
{
if (!InputObj || !InputObj->pvScan0)
{
DPRINT1("CallDibBitBlt: Invalid InputObj or pvScan0 for source-using ROP\n");
return FALSE;
}
/* Validate source point is within source surface bounds */
if (InputPoint->x < 0 || InputPoint->y < 0 ||
InputPoint->x >= (LONG)InputObj->sizlBitmap.cx ||
InputPoint->y >= (LONG)InputObj->sizlBitmap.cy)
{
DPRINT1("CallDibBitBlt: Source point (%d,%d) out of bounds for surface (%d,%d)\n",
InputPoint->x, InputPoint->y,
InputObj->sizlBitmap.cx, InputObj->sizlBitmap.cy);
return FALSE;
}
}
BltInfo.DestSurface = OutputObj;
BltInfo.SourceSurface = InputObj;
BltInfo.PatternSurface = NULL;

View File

@@ -313,6 +313,9 @@ EngCreateBitmap(
PSURFACE psurf;
HBITMAP hbmp;
/* BADF00D HACK:*/
if (lWidth < 0) lWidth=0;
/* Allocate a surface */
psurf = SURFACE_AllocSurface(STYPE_BITMAP,
sizl.cx,