Author: tkreuzer
Date: Wed Nov 3 12:20:07 2010
New Revision: 49458
URL:
http://svn.reactos.org/svn/reactos?rev=49458&view=rev
Log:
[WIN32K]
- Make InitVideo return NTSTATUS and properly handle failure
- Silence a DPRINT, improve a DPRINT
Modified:
trunk/reactos/subsystems/win32/win32k/eng/device.c
trunk/reactos/subsystems/win32/win32k/ntuser/display.c
trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c
Modified: trunk/reactos/subsystems/win32/win32k/eng/device.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/device.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/device.c [iso-8859-1] Wed Nov 3 12:20:07
2010
@@ -52,7 +52,7 @@
PDEVMODEW pdm, pdmEnd;
PLDEVOBJ pldev;
- DPRINT1("EngpRegisterGraphicsDevice(%S)\n", pustrDeviceName->Buffer);
+ DPRINT("EngpRegisterGraphicsDevice(%wZ)\n", pustrDeviceName);
/* Allocate a GRAPHICS_DEVICE structure */
pGraphicsDevice = ExAllocatePoolWithTag(PagedPool,
@@ -71,7 +71,7 @@
&pDeviceObject);
if (!NT_SUCCESS(Status))
{
- DPRINT1("Could not open driver, 0x%lx\n", Status);
+ DPRINT1("Could not open driver %wZ, 0x%lx\n", pustrDeviceName,
Status);
ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
return NULL;
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/display.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/display.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/display.c [iso-8859-1] Wed Nov 3
12:20:07 2010
@@ -147,10 +147,9 @@
return pGraphicsDevice;
}
-BOOL
-InitVideo(
- PUNICODE_STRING pustrRegPath,
- FLONG flags)
+NTSTATUS
+NTAPI
+InitVideo()
{
ULONG iDevNum, iVGACompatible = -1, ulMaxObjectNumber = 0;
WCHAR awcDeviceName[20];
@@ -160,8 +159,9 @@
ULONG cbValue;
HKEY hkey;
- DPRINT1("----------------------------- InitVideo()
-------------------------------\n");
-
+ DPRINT("----------------------------- InitVideo()
-------------------------------\n");
+
+ /* Open the key for the boot command line */
Status =
RegOpenKey(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control",
&hkey);
if (NT_SUCCESS(Status))
{
@@ -185,7 +185,7 @@
if (!NT_SUCCESS(Status))
{
DPRINT1("Could not open device registry key!\n");
- ASSERT(FALSE);
+ return Status;
}
/* Read the name of the VGA adapter */
@@ -220,7 +220,9 @@
continue;
}
+ /* Initialize the driver for this device */
pGraphicsDevice = InitDisplayDriver(awcDeviceName, awcBuffer);
+ if (!pGraphicsDevice) continue;
/* Check if this is the VGA adapter */
if (iDevNum == iVGACompatible)
@@ -235,7 +237,15 @@
gpPrimaryGraphicsDevice = pGraphicsDevice;
}
+ /* Close the device map registry key */
ZwClose(hkey);
+
+ /* Check if we had any success */
+ if (!gpPrimaryGraphicsDevice)
+ {
+ DPRINT1("No usable display driver was found.\n");
+ return STATUS_UNSUCCESSFUL;
+ }
if (gbBaseVideo)
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c [iso-8859-1] Wed Nov 3 12:20:07
2010
@@ -82,8 +82,9 @@
return STATUS_SUCCESS;
}
-BOOL
-InitVideo(ULONG);
+NTSTATUS
+NTAPI
+InitVideo();
NTSTATUS
NTAPI
@@ -91,11 +92,16 @@
HANDLE hPowerRequestEvent,
HANDLE hMediaRequestEvent)
{
+ NTSTATUS Status;
+
// Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA)
// Create Object Directory,,, Looks like create workstation.
"\\Windows\\WindowStations"
// Create Event for Diconnect Desktop.
- InitVideo(0);
-// Initialize Video.
+
+ /* Initialize Video. */
+ Status = InitVideo();
+ if (!NT_SUCCESS(Status)) return Status;
+
// {
// DrvInitConsole.
// DrvChangeDisplaySettings.