Skip to content

Commit 44931d7

Browse files
[VIDEOPRT] Fix incorrect return status (reactos#8433)
IntVideoPortMapMemory incorrectly returned a successful result if it failed to map video memory. This caused a bugcheck when using VirtualBox with Guest Additions with more than 128MB of VRAM assigned to VM. - Return ERROR_NOT_ENOUGH_MEMORY instead of NO_ERROR when mapping memory fails. - Also add debug logging to help troubleshoot when MmMapIoSpace fails. https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/video/nf-video-videoportmapmemory#return-value This fixes the crash, however the desktop does not render correctly. Using videoprt.sys from Windows XP still results in the same behavior. CORE-12130
1 parent 106dbed commit 44931d7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

win32ss/drivers/videoprt/resource.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@ IntVideoPortReleaseResources(
219219

220220
if (!NT_SUCCESS(Status))
221221
{
222-
DPRINT1("VideoPortReleaseResources IoReportResource failed with 0x%08lx ; ConflictDetected: %s\n",
223-
Status, ConflictDetected ? "TRUE" : "FALSE");
222+
ERR_(VIDEOPRT,
223+
"VideoPortReleaseResources IoReportResource failed with 0x%08lx ; ConflictDetected: %s\n",
224+
Status, ConflictDetected ? "TRUE" : "FALSE");
224225
}
225226
/* Ignore the returned status however... */
226227
}
@@ -353,7 +354,7 @@ IntVideoPortMapMemory(
353354
&TranslatedAddress) == FALSE)
354355
{
355356
if (Status)
356-
*Status = ERROR_NOT_ENOUGH_MEMORY;
357+
*Status = ERROR_INVALID_PARAMETER;
357358

358359
return NULL;
359360
}
@@ -380,9 +381,9 @@ IntVideoPortMapMemory(
380381
&MappedAddress);
381382
if (!NT_SUCCESS(NtStatus))
382383
{
383-
WARN_(VIDEOPRT, "IntVideoPortMapPhysicalMemory() failed! (0x%x)\n", NtStatus);
384+
ERR_(VIDEOPRT, "IntVideoPortMapPhysicalMemory() failed! (0x%x)\n", NtStatus);
384385
if (Status)
385-
*Status = NO_ERROR;
386+
*Status = ERROR_INVALID_PARAMETER;
386387
return NULL;
387388
}
388389
INFO_(VIDEOPRT, "Mapped user address = 0x%08x\n", MappedAddress);
@@ -425,8 +426,11 @@ IntVideoPortMapMemory(
425426
return MappedAddress;
426427
}
427428

429+
ERR_(VIDEOPRT,
430+
"Couldn't map video memory. IoAddress: 0x%lx, NumberOfUchars: 0x%lx, InIoSpace: 0x%x\n",
431+
IoAddress.u.LowPart, NumberOfUchars, InIoSpace);
428432
if (Status)
429-
*Status = NO_ERROR;
433+
*Status = ERROR_INVALID_PARAMETER;
430434

431435
return NULL;
432436
}

0 commit comments

Comments
 (0)