mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 02:26:03 +00:00
[WIN32K] Add some validity checks in PDEVOBJ_vReference() and use it instead of explicitly manipulating ppdev->cPdevRefs.
This commit is contained in:
parent
acf689a973
commit
148e137b42
4 changed files with 21 additions and 10 deletions
|
@ -630,7 +630,7 @@ EngpGetPDEV(
|
||||||
if (ppdev)
|
if (ppdev)
|
||||||
{
|
{
|
||||||
/* Yes, reference the PDEV */
|
/* Yes, reference the PDEV */
|
||||||
InterlockedIncrement(&ppdev->cPdevRefs);
|
PDEVOBJ_vReference(ppdev);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,6 +162,24 @@ NTAPI
|
||||||
EngpGetPDEV(
|
EngpGetPDEV(
|
||||||
_In_opt_ PUNICODE_STRING pustrDevice);
|
_In_opt_ PUNICODE_STRING pustrDevice);
|
||||||
|
|
||||||
|
FORCEINLINE
|
||||||
|
VOID
|
||||||
|
PDEVOBJ_vReference(
|
||||||
|
_In_ PPDEVOBJ ppdev)
|
||||||
|
{
|
||||||
|
ASSERT(ppdev);
|
||||||
|
|
||||||
|
/* Fail if the PDEV is being destroyed */
|
||||||
|
if (ppdev->cPdevRefs == 0)
|
||||||
|
{
|
||||||
|
ASSERT(FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ASSERT(ppdev->cPdevRefs > 0);
|
||||||
|
|
||||||
|
InterlockedIncrement(&ppdev->cPdevRefs);
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
PDEVOBJ_vRelease(
|
PDEVOBJ_vRelease(
|
||||||
|
@ -201,11 +219,4 @@ PDEVOBJ_pdmMatchDevMode(
|
||||||
PPDEVOBJ ppdev,
|
PPDEVOBJ ppdev,
|
||||||
PDEVMODEW pdm);
|
PDEVMODEW pdm);
|
||||||
|
|
||||||
FORCEINLINE
|
|
||||||
VOID
|
|
||||||
PDEVOBJ_vReference(PPDEVOBJ ppdev)
|
|
||||||
{
|
|
||||||
InterlockedIncrement(&ppdev->cPdevRefs);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !__WIN32K_PDEVOBJ_H */
|
#endif /* !__WIN32K_PDEVOBJ_H */
|
||||||
|
|
|
@ -836,7 +836,7 @@ GreCreateCompatibleDC(HDC hdc, BOOL bAltDc)
|
||||||
|
|
||||||
/* Get the pdev from the DC */
|
/* Get the pdev from the DC */
|
||||||
ppdev = pdc->ppdev;
|
ppdev = pdc->ppdev;
|
||||||
InterlockedIncrement(&ppdev->cPdevRefs);
|
PDEVOBJ_vReference(ppdev);
|
||||||
|
|
||||||
/* Unlock the source DC */
|
/* Unlock the source DC */
|
||||||
DC_UnlockDc(pdc);
|
DC_UnlockDc(pdc);
|
||||||
|
|
|
@ -282,7 +282,7 @@ NtGdiSaveDC(
|
||||||
}
|
}
|
||||||
hdcSave = pdcSave->BaseObject.hHmgr;
|
hdcSave = pdcSave->BaseObject.hHmgr;
|
||||||
|
|
||||||
InterlockedIncrement(&pdc->ppdev->cPdevRefs);
|
PDEVOBJ_vReference(pdc->ppdev);
|
||||||
DC_vInitDc(pdcSave, DCTYPE_MEMORY, pdc->ppdev);
|
DC_vInitDc(pdcSave, DCTYPE_MEMORY, pdc->ppdev);
|
||||||
|
|
||||||
/* Handle references here correctly */
|
/* Handle references here correctly */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue