#define NDEBUG
#include <debug.h>
-static PPDEVOBJ gppdevList = NULL;
PPDEVOBJ gppdevPrimary = NULL;
+
+static PPDEVOBJ gppdevList = NULL;
static HSEMAPHORE ghsemPDEV;
-BOOL
+INIT_FUNCTION
+NTSTATUS
NTAPI
InitPDEVImpl()
{
ghsemPDEV = EngCreateSemaphore();
- return TRUE;
+ if (!ghsemPDEV) return STATUS_INSUFFICIENT_RESOURCES;
+ return STATUS_SUCCESS;
}
{
PFN_DrvEnablePDEV pfnEnablePDEV;
- DPRINT1("PDEVOBJ_bEnablePDEV()\n");
+ DPRINT("PDEVOBJ_bEnablePDEV()\n");
/* Get the DrvEnablePDEV function */
pfnEnablePDEV = ppdev->pldev->pfn.EnablePDEV;
ppdev->gdiinfo.ulLogPixelsY = 96;
/* Setup Palette */
- GDIOBJ_SetOwnership(ppdev->devinfo.hpalDefault, NULL);
ppdev->ppalSurf = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
- DPRINT1("PDEVOBJ_bEnablePDEV - dhpdev = %p\n", ppdev->dhpdev);
+ DPRINT("PDEVOBJ_bEnablePDEV - dhpdev = %p\n", ppdev->dhpdev);
return TRUE;
}
if (ppdev->pSurface)
{
/* Increment reference count */
- GDIOBJ_IncrementShareCount(&ppdev->pSurface->BaseObject);
+ GDIOBJ_vReferenceObjectByPointer(&ppdev->pSurface->BaseObject);
}
else
{
return NULL;
}
-
static
PPDEVOBJ
EngpCreatePDEV(
PPDEVOBJ ppdev;
/* Try to find the GRAPHICS_DEVICE */
- pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0, 0);
- if (!pGraphicsDevice)
+ if (pustrDeviceName)
{
- DPRINT1("No GRAPHICS_DEVICE found for %ls!\n",
- pustrDeviceName ? pustrDeviceName->Buffer : 0);
- return NULL;
+ pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0, 0);
+ if (!pGraphicsDevice)
+ {
+ DPRINT1("No GRAPHICS_DEVICE found for %ls!\n",
+ pustrDeviceName ? pustrDeviceName->Buffer : 0);
+ return NULL;
+ }
+ }
+ else
+ {
+ pGraphicsDevice = gpPrimaryGraphicsDevice;
}
/* Allocate a new PDEVOBJ */
{
/* ... use the device's default one */
pdm = pGraphicsDevice->pDevModeList[pGraphicsDevice->iDefaultMode].pdm;
- DPRINT1("Using iDefaultMode = %ld\n", pGraphicsDevice->iDefaultMode);
+ DPRINT("Using iDefaultMode = %ld\n", pGraphicsDevice->iDefaultMode);
}
/* Try to get a diplay driver */
- ppdev->pldev = EngLoadDriver(pdm->dmDeviceName, LDEV_DEVICE_DISPLAY);
+ ppdev->pldev = EngLoadImageEx(pdm->dmDeviceName, LDEV_DEVICE_DISPLAY);
if (!ppdev->pldev)
{
DPRINT1("Could not load display driver '%ls'\n",
pdc = DC_LockDc(hdc);
if (!pdc)
{
- SetLastWin32Error(ERROR_INVALID_HANDLE);
+ EngSetLastError(ERROR_INVALID_HANDLE);
return 0;
}
pdc = DC_LockDc(hDC);
if (!pdc)
{
- SetLastWin32Error(ERROR_INVALID_HANDLE);
+ EngSetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}