mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 15:36:24 +00:00
Fix BSOD in IntPrepareDriver (bug 1321)
svn path=/trunk/; revision=22126
This commit is contained in:
parent
d91dbeb60b
commit
b22255488e
3 changed files with 37 additions and 4 deletions
|
@ -170,6 +170,7 @@ typedef struct
|
||||||
#define DC_UnlockDc(pDC) \
|
#define DC_UnlockDc(pDC) \
|
||||||
GDIOBJ_UnlockObjByPtr (GdiHandleTable, pDC)
|
GDIOBJ_UnlockObjByPtr (GdiHandleTable, pDC)
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL InitDcImpl(VOID);
|
||||||
HDC FASTCALL RetrieveDisplayHDC(VOID);
|
HDC FASTCALL RetrieveDisplayHDC(VOID);
|
||||||
HDC FASTCALL DC_AllocDC(PUNICODE_STRING Driver);
|
HDC FASTCALL DC_AllocDC(PUNICODE_STRING Driver);
|
||||||
VOID FASTCALL DC_InitDC(HDC DCToInit);
|
VOID FASTCALL DC_InitDC(HDC DCToInit);
|
||||||
|
|
|
@ -500,6 +500,13 @@ DriverEntry (
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status = InitDcImpl();
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to initialize Device context implementation!\n");
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize FreeType library */
|
/* Initialize FreeType library */
|
||||||
if (! InitFontSupport())
|
if (! InitFontSupport())
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,17 @@ HalQueryDisplayOwnership(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static GDIDEVICE PrimarySurface;
|
static GDIDEVICE PrimarySurface;
|
||||||
|
static KEVENT VideoDriverNeedsPreparation;
|
||||||
|
static KEVENT VideoDriverPrepared;
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
InitDcImpl(VOID)
|
||||||
|
{
|
||||||
|
KeInitializeEvent(&VideoDriverNeedsPreparation, SynchronizationEvent, TRUE);
|
||||||
|
KeInitializeEvent(&VideoDriverPrepared, NotificationEvent, FALSE);
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME: DCs should probably be thread safe */
|
/* FIXME: DCs should probably be thread safe */
|
||||||
|
|
||||||
|
@ -489,6 +500,17 @@ IntPrepareDriver()
|
||||||
BOOL GotDriver;
|
BOOL GotDriver;
|
||||||
BOOL DoDefault;
|
BOOL DoDefault;
|
||||||
ULONG DisplayNumber;
|
ULONG DisplayNumber;
|
||||||
|
LARGE_INTEGER Zero;
|
||||||
|
BOOLEAN ret = FALSE;
|
||||||
|
|
||||||
|
Zero.QuadPart = 0;
|
||||||
|
if (STATUS_SUCCESS != KeWaitForSingleObject(&VideoDriverNeedsPreparation, Executive, KernelMode, TRUE, &Zero))
|
||||||
|
{
|
||||||
|
/* Concurrent access. Wait for VideoDriverPrepared event */
|
||||||
|
if (STATUS_SUCCESS == KeWaitForSingleObject(&VideoDriverPrepared, Executive, KernelMode, TRUE, NULL))
|
||||||
|
ret = PrimarySurface.PreparedDriver;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
for (DisplayNumber = 0; ; DisplayNumber++)
|
for (DisplayNumber = 0; ; DisplayNumber++)
|
||||||
{
|
{
|
||||||
|
@ -502,7 +524,7 @@ IntPrepareDriver()
|
||||||
if (PrimarySurface.VideoFileObject == NULL)
|
if (PrimarySurface.VideoFileObject == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("FindMPDriver failed\n");
|
DPRINT1("FindMPDriver failed\n");
|
||||||
return FALSE;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve DDI driver names from registry */
|
/* Retrieve DDI driver names from registry */
|
||||||
|
@ -576,7 +598,7 @@ IntPrepareDriver()
|
||||||
{
|
{
|
||||||
ObDereferenceObject(PrimarySurface.VideoFileObject);
|
ObDereferenceObject(PrimarySurface.VideoFileObject);
|
||||||
DPRINT1("BuildDDIFunctions failed\n");
|
DPRINT1("BuildDDIFunctions failed\n");
|
||||||
return FALSE;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a phyical device handle from the driver */
|
/* Allocate a phyical device handle from the driver */
|
||||||
|
@ -659,10 +681,13 @@ IntPrepareDriver()
|
||||||
PrimarySurface.PreparedDriver = TRUE;
|
PrimarySurface.PreparedDriver = TRUE;
|
||||||
PrimarySurface.DisplayNumber = DisplayNumber;
|
PrimarySurface.DisplayNumber = DisplayNumber;
|
||||||
|
|
||||||
return TRUE;
|
ret = TRUE;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
cleanup:
|
||||||
|
KeSetEvent(&VideoDriverPrepared, 1, FALSE);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL FASTCALL
|
static BOOL FASTCALL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue