[CMAKE]
[reactos.git] / subsystems / win32 / win32k / eng / device.c
index a823b44..730b2ff 100644 (file)
 #define NDEBUG
 #include <debug.h>
 
+PGRAPHICS_DEVICE gpPrimaryGraphicsDevice;
+PGRAPHICS_DEVICE gpVgaGraphicsDevice;
+
 static PGRAPHICS_DEVICE gpGraphicsDeviceFirst = NULL;
 static PGRAPHICS_DEVICE gpGraphicsDeviceLast = NULL;
 static HSEMAPHORE ghsemGraphicsDeviceList;
 static ULONG giDevNum = 1;
 
-BOOL
+INIT_FUNCTION
+NTSTATUS
 NTAPI
 InitDeviceImpl()
 {
     ghsemGraphicsDeviceList = EngCreateSemaphore();
     if (!ghsemGraphicsDeviceList)
-        return FALSE;
+        return STATUS_INSUFFICIENT_RESOURCES;
 
-    return TRUE;
+    return STATUS_SUCCESS;
 }
 
 
@@ -48,7 +52,7 @@ EngpRegisterGraphicsDevice(
     PDEVMODEW pdm, pdmEnd;
     PLDEVOBJ pldev;
 
-    DPRINT1("EngpRegisterGraphicsDevice(%S)\n", pustrDeviceName->Buffer);
+    DPRINT("EngpRegisterGraphicsDevice(%wZ)\n", pustrDeviceName);
 
     /* Allocate a GRAPHICS_DEVICE structure */
     pGraphicsDevice = ExAllocatePoolWithTag(PagedPool,
@@ -67,7 +71,7 @@ EngpRegisterGraphicsDevice(
                                       &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;
     }
@@ -122,7 +126,7 @@ EngpRegisterGraphicsDevice(
     {
         DPRINT1("trying driver: %ls\n", pwsz);
         /* Try to load the display driver */
-        pldev = EngLoadDriver(pwsz, LDEV_DEVICE_DISPLAY);
+        pldev = EngLoadImageEx(pwsz, LDEV_DEVICE_DISPLAY);
         if (!pldev)
         {
             DPRINT1("Could not load driver: '%ls'\n", pwsz);
@@ -240,9 +244,9 @@ EngpFindGraphicsDevice(
     if (pustrDevice)
     {
         /* Loop through the list of devices */
-        for (pGraphicsDevice = gpGraphicsDeviceFirst, i = 0;
+        for (pGraphicsDevice = gpGraphicsDeviceFirst;
              pGraphicsDevice;
-             pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice, i++)
+             pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice)
         {
             /* Compare the device name */
             RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName);