[HACKS] The hack list is as follows:

- Disable Winlogon notification support
- Ignore the PNP_FATAL bugcheck for devices with multiple video out
- Return an error code instead of bugcheck on floating point bug
- Ignore some asserts
- Intel GPU Driver hacks
- Ignore IOConflict
This commit is contained in:
Justin Miller
2025-03-09 03:53:41 -07:00
parent ebca8279dc
commit 399b5d0da8
10 changed files with 13 additions and 96 deletions

View File

@@ -312,77 +312,7 @@ CallNotificationDll(
NOTIFICATION_TYPE Type, NOTIFICATION_TYPE Type,
PWLX_NOTIFICATION_INFO pInfo) PWLX_NOTIFICATION_INFO pInfo)
{ {
HMODULE hModule; UNREFERENCED_PARAMETER(FuncNames);
CHAR szFuncBuffer[128];
DWORD dwError = ERROR_SUCCESS;
PWLX_NOTIFY_HANDLER pNotifyHandler;
if (NotificationDll->bSfcNotification)
{
switch (Type)
{
case LogonHandler:
strcpy(szFuncBuffer, "SfcWLEventLogon");
break;
case LogoffHandler:
strcpy(szFuncBuffer, "SfcWLEventLogoff");
break;
default:
return;
}
}
else
{
HKEY hDllKey;
DWORD dwSize;
DWORD dwType;
dwError = RegOpenKeyExW(hNotifyKey,
NotificationDll->pszKeyName,
0,
KEY_READ,
&hDllKey);
if (dwError != ERROR_SUCCESS)
{
TRACE("RegOpenKeyExW()\n");
return;
}
dwSize = sizeof(szFuncBuffer);
dwError = RegQueryValueExA(hDllKey,
FuncNames[Type],
NULL,
&dwType,
(PBYTE)szFuncBuffer,
&dwSize);
RegCloseKey(hDllKey);
}
if (dwError != ERROR_SUCCESS)
return;
hModule = LoadLibraryW(NotificationDll->pszDllName);
if (!hModule)
return;
pNotifyHandler = (PWLX_NOTIFY_HANDLER)GetProcAddress(hModule, szFuncBuffer);
_SEH2_TRY
{
if (pNotifyHandler)
pNotifyHandler(pInfo);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
ERR("WL: Exception while running notification %S!%s, Status 0x%08lx\n",
NotificationDll->pszDllName, szFuncBuffer, _SEH2_GetExceptionCode());
}
_SEH2_END;
FreeLibrary(hModule);
} }

View File

@@ -545,7 +545,7 @@ USBSTOR_HandleExecuteSCSI(
PSCSI_REQUEST_BLOCK Request; PSCSI_REQUEST_BLOCK Request;
PPDO_DEVICE_EXTENSION PDODeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; PPDO_DEVICE_EXTENSION PDODeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
// ASSERT(PDODeviceExtension->Common.IsFDO == FALSE); // ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
IoStack = IoGetCurrentIrpStackLocation(Irp); IoStack = IoGetCurrentIrpStackLocation(Irp);
Request = IoStack->Parameters.Scsi.Srb; Request = IoStack->Parameters.Scsi.Srb;

View File

@@ -1224,11 +1224,6 @@ PiInitializeDevNode(
DPRINT1("Current instance parent: '%wZ'\n", &DeviceNode->Parent->InstancePath); DPRINT1("Current instance parent: '%wZ'\n", &DeviceNode->Parent->InstancePath);
DPRINT1("Old instance parent: '%wZ'\n", &OldDeviceNode->Parent->InstancePath); DPRINT1("Old instance parent: '%wZ'\n", &OldDeviceNode->Parent->InstancePath);
KeBugCheckEx(PNP_DETECTED_FATAL_ERROR,
0x01,
(ULONG_PTR)DeviceNode->PhysicalDeviceObject,
(ULONG_PTR)OldDeviceObject,
0);
} }
DeviceNode->InstancePath = InstancePathU; DeviceNode->InstancePath = InstancePathU;

View File

@@ -1509,15 +1509,8 @@ KeRestoreFloatingPointState(
*/ */
if (FsContext->CurrentThread != KeGetCurrentThread()) if (FsContext->CurrentThread != KeGetCurrentThread())
{ {
/* //HACK: return invalid param instead of bugcheck for AMD GPUs
* This isn't the thread that saved the return STATUS_INVALID_PARAMETER;
* FPU state context, crash the system!
*/
KeBugCheckEx(INVALID_FLOATING_POINT_STATE,
0x2,
(ULONG_PTR)FsContext->CurrentThread,
(ULONG_PTR)KeGetCurrentThread(),
0);
} }
/* Are we under the same NPX interrupt level? */ /* Are we under the same NPX interrupt level? */

View File

@@ -350,7 +350,8 @@ MiUnmapLockedPagesInUserSpace(
if (MiDecrementPageTableReferences(BaseAddress) == 0) if (MiDecrementPageTableReferences(BaseAddress) == 0)
{ {
ASSERT(MiIsPteOnPdeBoundary(PointerPte + 1) || (NumberOfPages == 1)); // HACK: Disabled for AMD GPU OpenGL application exit!
// ASSERT(MiIsPteOnPdeBoundary(PointerPte + 1) || (NumberOfPages == 1));
MiDeletePde(PointerPde, Process); MiDeletePde(PointerPde, Process);
} }

View File

@@ -248,6 +248,9 @@ MiReserveSystemPtes(IN ULONG NumberOfPtes,
{ {
PMMPTE PointerPte; PMMPTE PointerPte;
if (NumberOfPtes > 32768)
return NULL;
// //
// Use the extended function // Use the extended function
// //

View File

@@ -773,8 +773,8 @@ RtlLeaveCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
*/ */
if (Thread != CriticalSection->OwningThread) if (Thread != CriticalSection->OwningThread)
{ {
DPRINT1("Releasing critical section not owned!\n"); DPRINT1("Releasing critical section not owned!\n");
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
} }
#endif #endif

View File

@@ -995,7 +995,7 @@ VideoPortVerifyAccessRanges(
ExFreePoolWithTag(ResourceList, TAG_VIDEO_PORT); ExFreePoolWithTag(ResourceList, TAG_VIDEO_PORT);
if (!NT_SUCCESS(Status) || ConflictDetected) if (!NT_SUCCESS(Status) || ConflictDetected)
return ERROR_INVALID_PARAMETER; return NO_ERROR;
else else
return NO_ERROR; return NO_ERROR;
} }

View File

@@ -1469,6 +1469,7 @@ VideoPortCreateSecondaryDisplay(
IN OUT PVOID *SecondaryDeviceExtension, IN OUT PVOID *SecondaryDeviceExtension,
IN ULONG Flag) IN ULONG Flag)
{ {
return ERROR_DEV_NOT_EXIST;
PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT DeviceObject;
PVIDEO_PORT_DEVICE_EXTENSION FirstDeviceExtension, DeviceExtension; PVIDEO_PORT_DEVICE_EXTENSION FirstDeviceExtension, DeviceExtension;
NTSTATUS Status; NTSTATUS Status;

View File

@@ -502,12 +502,6 @@ UserEnumDisplaySettings(
return STATUS_INVALID_PARAMETER_1; return STATUS_INVALID_PARAMETER_1;
} }
/* let's politely ask the driver for an updated mode list,
just in case there's something new in there (vbox) */
PDEVOBJ_vRefreshModeList(ppdev);
PDEVOBJ_vRelease(ppdev);
iFoundMode = 0; iFoundMode = 0;
for (i = 0; i < pGraphicsDevice->cDevModes; i++) for (i = 0; i < pGraphicsDevice->cDevModes; i++)
{ {