- Make InitVideo return NTSTATUS and properly handle failure
- Silence a DPRINT, improve a DPRINT

svn path=/trunk/; revision=49458
This commit is contained in:
Timo Kreuzer 2010-11-03 12:20:07 +00:00
parent 5876e615b5
commit 9bcd5e12e8
3 changed files with 28 additions and 12 deletions

View file

@ -52,7 +52,7 @@ EngpRegisterGraphicsDevice(
PDEVMODEW pdm, pdmEnd; PDEVMODEW pdm, pdmEnd;
PLDEVOBJ pldev; PLDEVOBJ pldev;
DPRINT1("EngpRegisterGraphicsDevice(%S)\n", pustrDeviceName->Buffer); DPRINT("EngpRegisterGraphicsDevice(%wZ)\n", pustrDeviceName);
/* Allocate a GRAPHICS_DEVICE structure */ /* Allocate a GRAPHICS_DEVICE structure */
pGraphicsDevice = ExAllocatePoolWithTag(PagedPool, pGraphicsDevice = ExAllocatePoolWithTag(PagedPool,
@ -71,7 +71,7 @@ EngpRegisterGraphicsDevice(
&pDeviceObject); &pDeviceObject);
if (!NT_SUCCESS(Status)) 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); ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
return NULL; return NULL;
} }

View file

@ -147,10 +147,9 @@ InitDisplayDriver(
return pGraphicsDevice; return pGraphicsDevice;
} }
BOOL NTSTATUS
InitVideo( NTAPI
PUNICODE_STRING pustrRegPath, InitVideo()
FLONG flags)
{ {
ULONG iDevNum, iVGACompatible = -1, ulMaxObjectNumber = 0; ULONG iDevNum, iVGACompatible = -1, ulMaxObjectNumber = 0;
WCHAR awcDeviceName[20]; WCHAR awcDeviceName[20];
@ -160,8 +159,9 @@ InitVideo(
ULONG cbValue; ULONG cbValue;
HKEY hkey; 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); Status = RegOpenKey(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control", &hkey);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
@ -185,7 +185,7 @@ InitVideo(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("Could not open device registry key!\n"); DPRINT1("Could not open device registry key!\n");
ASSERT(FALSE); return Status;
} }
/* Read the name of the VGA adapter */ /* Read the name of the VGA adapter */
@ -220,7 +220,9 @@ InitVideo(
continue; continue;
} }
/* Initialize the driver for this device */
pGraphicsDevice = InitDisplayDriver(awcDeviceName, awcBuffer); pGraphicsDevice = InitDisplayDriver(awcDeviceName, awcBuffer);
if (!pGraphicsDevice) continue;
/* Check if this is the VGA adapter */ /* Check if this is the VGA adapter */
if (iDevNum == iVGACompatible) if (iDevNum == iVGACompatible)
@ -235,8 +237,16 @@ InitVideo(
gpPrimaryGraphicsDevice = pGraphicsDevice; gpPrimaryGraphicsDevice = pGraphicsDevice;
} }
/* Close the device map registry key */
ZwClose(hkey); ZwClose(hkey);
/* Check if we had any success */
if (!gpPrimaryGraphicsDevice)
{
DPRINT1("No usable display driver was found.\n");
return STATUS_UNSUCCESSFUL;
}
if (gbBaseVideo) if (gbBaseVideo)
{ {
if (gpVgaGraphicsDevice) if (gpVgaGraphicsDevice)

View file

@ -82,8 +82,9 @@ InitUserImpl(VOID)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
BOOL NTSTATUS
InitVideo(ULONG); NTAPI
InitVideo();
NTSTATUS NTSTATUS
NTAPI NTAPI
@ -91,11 +92,16 @@ UserInitialize(
HANDLE hPowerRequestEvent, HANDLE hPowerRequestEvent,
HANDLE hMediaRequestEvent) HANDLE hMediaRequestEvent)
{ {
NTSTATUS Status;
// Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA) // Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA)
// Create Object Directory,,, Looks like create workstation. "\\Windows\\WindowStations" // Create Object Directory,,, Looks like create workstation. "\\Windows\\WindowStations"
// Create Event for Diconnect Desktop. // Create Event for Diconnect Desktop.
InitVideo(0);
// Initialize Video. /* Initialize Video. */
Status = InitVideo();
if (!NT_SUCCESS(Status)) return Status;
// { // {
// DrvInitConsole. // DrvInitConsole.
// DrvChangeDisplaySettings. // DrvChangeDisplaySettings.