mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 08:25:48 +00:00
Dc_Attr with DCE:
- Fixed problem with dcattr read and write access in user mode. - Dcattr data only flows from Kernel to User ATM. - Cleaned up code. - Enable GetDCObject for testing. - Tested with Qemu both Linux and XP, and real hardware. svn path=/trunk/; revision=29546
This commit is contained in:
parent
00a4696613
commit
bdd694ff41
4 changed files with 22 additions and 14 deletions
|
@ -320,7 +320,6 @@ HGDIOBJ
|
||||||
STDCALL
|
STDCALL
|
||||||
GetDCObject( HDC hDC, INT iType)
|
GetDCObject( HDC hDC, INT iType)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
if((iType == GDI_OBJECT_TYPE_BRUSH) ||
|
if((iType == GDI_OBJECT_TYPE_BRUSH) ||
|
||||||
(iType == GDI_OBJECT_TYPE_EXTPEN)||
|
(iType == GDI_OBJECT_TYPE_EXTPEN)||
|
||||||
(iType == GDI_OBJECT_TYPE_PEN) ||
|
(iType == GDI_OBJECT_TYPE_PEN) ||
|
||||||
|
@ -348,7 +347,6 @@ GetDCObject( HDC hDC, INT iType)
|
||||||
}
|
}
|
||||||
return hGO;
|
return hGO;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return NtGdiGetDCObject( hDC, iType );
|
return NtGdiGetDCObject( hDC, iType );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,8 +150,8 @@ HDC FASTCALL DC_AllocDC(PUNICODE_STRING Driver);
|
||||||
VOID FASTCALL DC_InitDC(HDC DCToInit);
|
VOID FASTCALL DC_InitDC(HDC DCToInit);
|
||||||
HDC FASTCALL DC_FindOpenDC(PUNICODE_STRING Driver);
|
HDC FASTCALL DC_FindOpenDC(PUNICODE_STRING Driver);
|
||||||
VOID FASTCALL DC_FreeDC(HDC);
|
VOID FASTCALL DC_FreeDC(HDC);
|
||||||
VOID FASTCALL DC_AllocateDcAttr(HDC, PEPROCESS);
|
VOID FASTCALL DC_AllocateDcAttr(HDC);
|
||||||
VOID FASTCALL DC_FreeDcAttr(HDC, PEPROCESS);
|
VOID FASTCALL DC_FreeDcAttr(HDC);
|
||||||
BOOL INTERNAL_CALL DC_Cleanup(PVOID ObjectBody);
|
BOOL INTERNAL_CALL DC_Cleanup(PVOID ObjectBody);
|
||||||
HDC FASTCALL DC_GetNextDC (PDC pDC);
|
HDC FASTCALL DC_GetNextDC (PDC pDC);
|
||||||
VOID FASTCALL DC_SetNextDC (PDC pDC, HDC hNextDC);
|
VOID FASTCALL DC_SetNextDC (PDC pDC, HDC hNextDC);
|
||||||
|
|
|
@ -153,6 +153,8 @@ DceAllocDCE(PWINDOW_OBJECT Window OPTIONAL, DCE_TYPE Type)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
DPRINT("FREE DCATTR!!!! NOT DCE_WINDOW_DC!!!!! hDC-> %x\n", pDce->hDC);
|
||||||
|
DC_FreeDcAttr(pDce->hDC); // Free the dcattr!
|
||||||
DC_SetOwnership(pDce->hDC, NULL); // This hDC is inaccessible!
|
DC_SetOwnership(pDce->hDC, NULL); // This hDC is inaccessible!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,6 +269,10 @@ DceReleaseDC(DCE* dce, BOOL EndPaint)
|
||||||
dce->DCXFlags |= DCX_DCEEMPTY;
|
dce->DCXFlags |= DCX_DCEEMPTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DPRINT("Exit!!!!! DCX_CACHE!!!!!! hDC-> %x \n", dce->hDC);
|
||||||
|
DC_FreeDcAttr(dce->hDC); // Free the dcattr.
|
||||||
|
DC_SetOwnership(dce->hDC, NULL); // Set hDC inaccessible mode.
|
||||||
|
dce->pProcess = NULL; // Reset ownership.
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -543,6 +549,15 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
|
||||||
DceUpdateVisRgn(Dce, Window, Flags);
|
DceUpdateVisRgn(Dce, Window, Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Dce->DCXFlags & DCX_CACHE)
|
||||||
|
{
|
||||||
|
DPRINT("ENTER!!!!!! DCX_CACHE!!!!!! hDC-> %x\n", Dce->hDC);
|
||||||
|
// Need to set ownership so Sync dcattr will work.
|
||||||
|
DC_SetOwnership( Dce->hDC, PsGetCurrentProcess());
|
||||||
|
DC_AllocateDcAttr( Dce->hDC ); // Allocate new dcattr
|
||||||
|
DCU_SynchDcAttrtoUser( Dce->hDC, -1); // Copy data from dc to dcattr
|
||||||
|
Dce->pProcess = PsGetCurrentProcess(); // Set the temp owning process
|
||||||
|
}
|
||||||
return(Dce->hDC);
|
return(Dce->hDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2399,7 +2399,7 @@ DC_AllocDC(PUNICODE_STRING Driver)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DC_AllocateDcAttr(hDC, NULL);
|
DC_AllocateDcAttr(hDC);
|
||||||
|
|
||||||
NewDC = DC_LockDc(hDC);
|
NewDC = DC_LockDc(hDC);
|
||||||
/* FIXME - Handle NewDC == NULL! */
|
/* FIXME - Handle NewDC == NULL! */
|
||||||
|
@ -2482,14 +2482,12 @@ DC_InitDC(HDC DCHandle)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
DC_AllocateDcAttr(HDC hDC, PEPROCESS Owner)
|
DC_AllocateDcAttr(HDC hDC)
|
||||||
{
|
{
|
||||||
//#if 0
|
|
||||||
PVOID NewMem = NULL;
|
PVOID NewMem = NULL;
|
||||||
HANDLE Pid = NtCurrentProcess();
|
HANDLE Pid = NtCurrentProcess();
|
||||||
ULONG MemSize = sizeof(DC_ATTR); //PAGE_SIZE it will allocate that size
|
ULONG MemSize = sizeof(DC_ATTR); //PAGE_SIZE it will allocate that size
|
||||||
|
|
||||||
if(Owner) Pid = PsGetProcessId(Owner);
|
|
||||||
NTSTATUS Status = ZwAllocateVirtualMemory(Pid,
|
NTSTATUS Status = ZwAllocateVirtualMemory(Pid,
|
||||||
&NewMem,
|
&NewMem,
|
||||||
0,
|
0,
|
||||||
|
@ -2519,19 +2517,17 @@ DC_AllocateDcAttr(HDC hDC, PEPROCESS Owner)
|
||||||
pDC->pDc_Attr = NewMem; // Store pointer
|
pDC->pDc_Attr = NewMem; // Store pointer
|
||||||
}
|
}
|
||||||
DC_UnlockDc(pDC);
|
DC_UnlockDc(pDC);
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
DC_FreeDcAttr(HDC DCToFree, PEPROCESS Owner)
|
DC_FreeDcAttr(HDC DCToFree )
|
||||||
{
|
{
|
||||||
HANDLE Pid = NtCurrentProcess();
|
HANDLE Pid = NtCurrentProcess();
|
||||||
PDC pDC = DC_LockDc(DCToFree);
|
PDC pDC = DC_LockDc(DCToFree);
|
||||||
if (pDC->pDc_Attr == &pDC->Dc_Attr) return; // Internal DC object!
|
if (pDC->pDc_Attr == &pDC->Dc_Attr) return; // Internal DC object!
|
||||||
pDC->pDc_Attr = NULL;
|
pDC->pDc_Attr = NULL;
|
||||||
DC_UnlockDc(pDC);
|
DC_UnlockDc(pDC);
|
||||||
if(Owner) Pid = PsGetProcessId(Owner);
|
|
||||||
|
|
||||||
KeEnterCriticalRegion();
|
KeEnterCriticalRegion();
|
||||||
{
|
{
|
||||||
|
@ -2557,9 +2553,8 @@ DC_FreeDcAttr(HDC DCToFree, PEPROCESS Owner)
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
DC_FreeDC(HDC DCToFree)
|
DC_FreeDC(HDC DCToFree)
|
||||||
{
|
{
|
||||||
//#if 0
|
DC_FreeDcAttr(DCToFree);
|
||||||
DC_FreeDcAttr(DCToFree, NULL);
|
|
||||||
//#endif
|
|
||||||
if (!GDIOBJ_FreeObj(GdiHandleTable, DCToFree, GDI_OBJECT_TYPE_DC))
|
if (!GDIOBJ_FreeObj(GdiHandleTable, DCToFree, GDI_OBJECT_TYPE_DC))
|
||||||
{
|
{
|
||||||
DPRINT("DC_FreeDC failed\n");
|
DPRINT("DC_FreeDC failed\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue