Skip to content

Commit 82c02b5

Browse files
[VIDEOPRT] fix incorrect status return
IntVideoPortMapMemory incorrectly returns a successful result if it failed to map video memory. This causes a bugcheck when using Virtualbox with guest additions with more than 128mb of vram assigned. This PR fixes the crash, however the desktop does not render correctly. Using videoprt.sys from Windows XP results in the same behavior after this commit.
1 parent c7d4040 commit 82c02b5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

win32ss/drivers/videoprt/resource.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ IntVideoPortMapMemory(
353353
&TranslatedAddress) == FALSE)
354354
{
355355
if (Status)
356-
*Status = ERROR_NOT_ENOUGH_MEMORY;
356+
*Status = ERROR_INVALID_PARAMETER;
357357

358358
return NULL;
359359
}
@@ -380,9 +380,9 @@ IntVideoPortMapMemory(
380380
&MappedAddress);
381381
if (!NT_SUCCESS(NtStatus))
382382
{
383-
WARN_(VIDEOPRT, "IntVideoPortMapPhysicalMemory() failed! (0x%x)\n", NtStatus);
383+
ERR_(VIDEOPRT, "IntVideoPortMapPhysicalMemory() failed! (0x%x)\n", NtStatus);
384384
if (Status)
385-
*Status = NO_ERROR;
385+
*Status = ERROR_INVALID_PARAMETER;
386386
return NULL;
387387
}
388388
INFO_(VIDEOPRT, "Mapped user address = 0x%08x\n", MappedAddress);
@@ -425,8 +425,9 @@ IntVideoPortMapMemory(
425425
return MappedAddress;
426426
}
427427

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

431432
return NULL;
432433
}

0 commit comments

Comments
 (0)