ReactOS 0.4.15-dev-7788-g1ad9096
dce.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagDCE
 

Macros

#define DCHC_INVALIDVISRGN   0x0001
 
#define DCHC_DELETEDC   0x0002
 
#define DCHF_INVALIDATEVISRGN   0x0001
 
#define DCHF_VALIDATEVISRGN   0x0002
 
#define DCX_DCEEMPTY   0x00000800
 
#define DCX_DCEBUSY   0x00001000
 
#define DCX_DCEDIRTY   0x00002000
 
#define DCX_LAYEREDWIN   0x00004000
 
#define DCX_DCPOWNED   0x00008000
 
#define DCX_NOCLIPCHILDREN   0x00080000
 
#define DCX_NORECOMPUTE   0x00100000
 
#define DCX_INDESTROY   0x00400000
 

Typedefs

typedef enum DCE_TYPEPDCE_TYPE
 
typedef struct tagDCE DCE
 
typedef struct tagDCEPDCE
 

Enumerations

enum  DCE_TYPE { DCE_CACHE_DC , DCE_CLASS_DC , DCE_WINDOW_DC }
 

Functions

 CODE_SEG ("INIT") NTSTATUS NTAPI InitDCEImpl(VOID)
 
PDCE FASTCALL DceAllocDCE (PWND Window, DCE_TYPE Type)
 
HWND FASTCALL IntWindowFromDC (HDC hDc)
 
void FASTCALL DceFreeDCE (PDCE dce, BOOLEAN Force)
 
void FASTCALL DceEmptyCache (void)
 
VOID FASTCALL DceResetActiveDCEs (PWND Window)
 
void FASTCALL DceFreeClassDCE (PDCE)
 
HWND FASTCALL UserGethWnd (HDC, PWNDOBJ *)
 
void FASTCALL DceFreeWindowDCE (PWND)
 
void FASTCALL DceFreeThreadDCE (PTHREADINFO)
 
VOID FASTCALL DceUpdateVisRgn (DCE *Dce, PWND Window, ULONG Flags)
 
DCE *FASTCALL DceGetDceFromDC (HDC hdc)
 

Macro Definition Documentation

◆ DCHC_DELETEDC

#define DCHC_DELETEDC   0x0002

Definition at line 5 of file dce.h.

◆ DCHC_INVALIDVISRGN

#define DCHC_INVALIDVISRGN   0x0001

Definition at line 4 of file dce.h.

◆ DCHF_INVALIDATEVISRGN

#define DCHF_INVALIDATEVISRGN   0x0001

Definition at line 7 of file dce.h.

◆ DCHF_VALIDATEVISRGN

#define DCHF_VALIDATEVISRGN   0x0002

Definition at line 8 of file dce.h.

◆ DCX_DCEBUSY

#define DCX_DCEBUSY   0x00001000

Definition at line 36 of file dce.h.

◆ DCX_DCEDIRTY

#define DCX_DCEDIRTY   0x00002000

Definition at line 37 of file dce.h.

◆ DCX_DCEEMPTY

#define DCX_DCEEMPTY   0x00000800

Definition at line 35 of file dce.h.

◆ DCX_DCPOWNED

#define DCX_DCPOWNED   0x00008000

Definition at line 39 of file dce.h.

◆ DCX_INDESTROY

#define DCX_INDESTROY   0x00400000

Definition at line 42 of file dce.h.

◆ DCX_LAYEREDWIN

#define DCX_LAYEREDWIN   0x00004000

Definition at line 38 of file dce.h.

◆ DCX_NOCLIPCHILDREN

#define DCX_NOCLIPCHILDREN   0x00080000

Definition at line 40 of file dce.h.

◆ DCX_NORECOMPUTE

#define DCX_NORECOMPUTE   0x00100000

Definition at line 41 of file dce.h.

Typedef Documentation

◆ DCE

typedef struct tagDCE DCE

◆ PDCE

typedef struct tagDCE * PDCE

◆ PDCE_TYPE

typedef enum DCE_TYPE * PDCE_TYPE

Enumeration Type Documentation

◆ DCE_TYPE

Enumerator
DCE_CACHE_DC 
DCE_CLASS_DC 
DCE_WINDOW_DC 

Definition at line 10 of file dce.h.

11{
12 DCE_CACHE_DC, /* This is a cached DC (allocated by USER) */
13 DCE_CLASS_DC, /* This is a class DC (style CS_CLASSDC) */
14 DCE_WINDOW_DC /* This is a window DC (style CS_OWNDC) */
enum DCE_TYPE * PDCE_TYPE
DCE_TYPE
Definition: dce.h:11
@ DCE_CLASS_DC
Definition: dce.h:13
@ DCE_WINDOW_DC
Definition: dce.h:14
@ DCE_CACHE_DC
Definition: dce.h:12

Function Documentation

◆ CODE_SEG()

CODE_SEG ( "INIT"  )

Definition at line 1810 of file Interface.c.

1817{
1818 UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\FileSystem\\Filters\\"DRIVER_NAME);
1819 PDEVICE_OBJECT RawDeviceObject;
1821 PFILE_OBJECT RawFileObject;
1823 UNICODE_STRING SymLink;
1824
1826
1829
1830 /* Save the registry key for this driver */
1834 RegistryPath->MaximumLength,
1838
1839 /* Do some initialization */
1841
1842 /* Create the main filter manager device object */
1844 0,
1845 &DeviceName,
1848 FALSE,
1849 &DeviceObject);
1850 if (!NT_SUCCESS(Status))
1851 {
1852 DPRINT1("fltmgr IoCreateDevice failed. Status = %X\n", Status);
1853 goto Cleanup;
1854 }
1855
1856 /* Store a global reference so we can access from callbacks */
1858
1859 /* Generate the symbolic link name */
1860 RtlInitUnicodeString(&SymLink, L"\\??\\"DRIVER_NAME);
1862 if (!NT_SUCCESS(Status)) goto Cleanup;
1863
1864 /* Create the callbacks for the dispatch table, FastIo and FS callbacks */
1866 if (!NT_SUCCESS(Status)) goto Cleanup;
1867
1868 /* Initialize the comms objects */
1870 if (!NT_SUCCESS(Status)) goto Cleanup;
1871
1872 /* Register for notifications when a new file system is loaded. This also enumerates any existing file systems */
1874 FLT_ASSERT(Status != STATUS_DEVICE_ALREADY_ATTACHED); // Windows checks for this, I'm not sure how it can happen. Needs investigation??
1875 if (!NT_SUCCESS(Status)) goto Cleanup;
1876
1879
1880 /* IoRegisterFsRegistrationChange isn't notified about the raw file systems, so we attach to them manually */
1881 RtlInitUnicodeString(&ObjectName, L"\\Device\\RawDisk");
1884 &RawFileObject,
1885 &RawDeviceObject);
1886 if (NT_SUCCESS(Status))
1887 {
1888 FltpFsNotification(RawDeviceObject, TRUE);
1889 ObDereferenceObject(RawFileObject);
1890 }
1891
1892 RtlInitUnicodeString(&ObjectName, L"\\Device\\RawCdRom");
1895 &RawFileObject,
1896 &RawDeviceObject);
1897 if (NT_SUCCESS(Status))
1898 {
1899 FltpFsNotification(RawDeviceObject, TRUE);
1900 ObDereferenceObject(RawFileObject);
1901 }
1902
1903 /* We're done, clear the initializing flag */
1906
1907Cleanup:
1908
1909 if (!NT_SUCCESS(Status))
1910 {
1912 {
1913 DriverObject->FastIoDispatch = NULL;
1915 }
1916
1917 IoDeleteSymbolicLink(&SymLink);
1918
1919 if (DeviceObject)
1921
1924 }
1925
1926 return Status;
1927}
LIST_ENTRY FilterList
Definition: Filter.c:24
DRIVER_FS_NOTIFICATION FltpFsNotification
Definition: Interface.c:1699
ERESOURCE FilterListLock
Definition: Filter.c:25
static NTSTATUS SetupDispatchAndCallbacksTables(_In_ PDRIVER_OBJECT DriverObject)
Definition: Interface.c:1739
DRIVER_DATA DriverData
Definition: Interface.c:35
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR Cleanup[]
Definition: register.c:80
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define ClearFlag(_F, _SF)
Definition: ext2fs.h:191
#define DRIVER_NAME
Definition: ext2fs.h:136
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49
#define FM_TAG_REGISTRY_DATA
Definition: fltmgr.h:18
#define FM_TAG_DISPATCH_TABLE
Definition: fltmgr.h:17
NTSTATUS FltpSetupCommunicationObjects(_In_ PDRIVER_OBJECT DriverObject)
Definition: Messaging.c:377
Status
Definition: gdiplustypes.h:25
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1435
NTSTATUS NTAPI IoRegisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject, IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine)
Definition: volume.c:1089
#define STATUS_DEVICE_ALREADY_ATTACHED
Definition: ntstatus.h:292
#define L(x)
Definition: ntvdm.h:50
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:114
#define STATUS_SUCCESS
Definition: shellext.h:65
PDRIVER_OBJECT DriverObject
Definition: fltmgr.h:31
UNICODE_STRING ServiceKey
Definition: fltmgr.h:33
PFAST_IO_DISPATCH FastIoDispatch
Definition: fltmgr.h:37
FAST_MUTEX FilterAttachLock
Definition: fltmgr.h:39
PDEVICE_OBJECT DeviceObject
Definition: fltmgr.h:32
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint16_t * PWCHAR
Definition: typedefs.h:56
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:64
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
* PFILE_OBJECT
Definition: iotypes.h:1998
#define ObDereferenceObject
Definition: obfuncs.h:203

◆ DceAllocDCE()

PDCE FASTCALL DceAllocDCE ( PWND  Window,
DCE_TYPE  Type 
)

Definition at line 86 of file windc.c.

87{
88 PDCE pDce;
89
91 if(!pDce)
92 return NULL;
93
94 pDce->hDC = DceCreateDisplayDC();
95 if (!pDce->hDC)
96 {
98 return NULL;
99 }
100 DCECount++;
101 TRACE("Alloc DCE's! %d\n",DCECount);
103 pDce->pwndOrg = Window;
104 pDce->pwndClip = Window;
105 pDce->hrgnClip = NULL;
106 pDce->hrgnClipPublic = NULL;
107 pDce->hrgnSavedVis = NULL;
108 pDce->ppiOwner = NULL;
109
110 InsertTailList(&LEDce, &pDce->List);
111
113
114 if (Type == DCE_WINDOW_DC || Type == DCE_CLASS_DC) // Window DCE have ownership.
115 {
116 pDce->ptiOwner = GetW32ThreadInfo();
117 }
118 else
119 {
120 TRACE("FREE DCATTR!!!! NOT DCE_WINDOW_DC!!!!! hDC-> %p\n", pDce->hDC);
122 pDce->ptiOwner = NULL;
123 }
124
125 if (Type == DCE_CACHE_DC)
126 {
128 }
129 else
130 {
131 pDce->DCXFlags = DCX_DCEBUSY;
132 if (Window)
133 {
134 if (Type == DCE_WINDOW_DC)
135 {
136 if (Window->style & WS_CLIPCHILDREN) pDce->DCXFlags |= DCX_CLIPCHILDREN;
137 if (Window->style & WS_CLIPSIBLINGS) pDce->DCXFlags |= DCX_CLIPSIBLINGS;
138 }
139 }
140 }
141 return(pDce);
142}
Type
Definition: Type.h:7
BOOL NTAPI GreSetDCOwner(HDC hdc, ULONG ulOwner)
Definition: dclife.c:455
VOID FASTCALL DCU_SetDcUndeletable(HDC)
Definition: dcutil.c:322
#define DCX_DCEEMPTY
Definition: dce.h:35
#define DCX_DCEBUSY
Definition: dce.h:36
#define InsertTailList(ListHead, Entry)
#define PagedPool
Definition: env_spec_w32.h:308
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:805
#define GDI_OBJ_HMGR_NONE
Definition: ntgdihdl.h:118
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define TRACE(s)
Definition: solgame.cpp:4
Definition: window.c:28
Definition: dce.h:18
HRGN hrgnClip
Definition: dce.h:25
LIST_ENTRY List
Definition: dce.h:19
DWORD DCXFlags
Definition: dce.h:28
HRGN hrgnClipPublic
Definition: dce.h:26
PWND pwndClip
Definition: dce.h:23
HDC hDC
Definition: dce.h:20
PWND pwndOrg
Definition: dce.h:22
HRGN hrgnSavedVis
Definition: dce.h:27
PPROCESSINFO ppiOwner
Definition: dce.h:30
PTHREADINFO ptiOwner
Definition: dce.h:29
HWND hwndCurrent
Definition: dce.h:21
#define USERTAG_DCE
Definition: tags.h:221
static INT DCECount
Definition: windc.c:18
static LIST_ENTRY LEDce
Definition: windc.c:17
HDC FASTCALL DceCreateDisplayDC(VOID)
Definition: windc.c:40
#define DCX_CACHE
Definition: winuser.h:2114
#define DCX_CLIPCHILDREN
Definition: winuser.h:2117
#define DCX_CLIPSIBLINGS
Definition: winuser.h:2116

Referenced by IntCreateWindow(), and UserGetDCEx().

◆ DceEmptyCache()

void FASTCALL DceEmptyCache ( void  )

Definition at line 801 of file windc.c.

802{
803 PDCE pDCE;
804 PLIST_ENTRY ListEntry;
805
806 ListEntry = LEDce.Flink;
807 while (ListEntry != &LEDce)
808 {
809 pDCE = CONTAINING_RECORD(ListEntry, DCE, List);
810 ListEntry = ListEntry->Flink;
811 DceFreeDCE(pDCE, TRUE);
812 }
813}
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
void FASTCALL DceFreeDCE(PDCE pdce, BOOLEAN Force)
Definition: windc.c:633

◆ DceFreeClassDCE()

void FASTCALL DceFreeClassDCE ( PDCE  pdceClass)

Definition at line 762 of file windc.c.

763{
764 PDCE pDCE;
765 PLIST_ENTRY ListEntry;
766
767 ListEntry = LEDce.Flink;
768 while (ListEntry != &LEDce)
769 {
770 pDCE = CONTAINING_RECORD(ListEntry, DCE, List);
771 ListEntry = ListEntry->Flink;
772 if (pDCE == pdceClass)
773 {
774 DceFreeDCE(pDCE, TRUE); // Might have gone cheap!
775 }
776 }
777}

Referenced by IntDestroyClass().

◆ DceFreeDCE()

void FASTCALL DceFreeDCE ( PDCE  dce,
BOOLEAN  Force 
)

Definition at line 633 of file windc.c.

634{
635 BOOL Hit = FALSE;
636
637 ASSERT(pdce != NULL);
638 if (NULL == pdce) return;
639
640 pdce->DCXFlags |= DCX_INDESTROY;
641
642 if (Force &&
644 {
645 TRACE("Change ownership for DCE! -> %p\n" , pdce);
646 // NOTE: Windows sets W32PF_OWNDCCLEANUP and moves on.
647 if (GreIsHandleValid(pdce->hDC))
648 {
650 }
651 else
652 {
653 ERR("Attempted to change ownership of an DCEhDC %p currently being destroyed!!!\n",
654 pdce->hDC);
655 Hit = TRUE;
656 }
657 }
658 else
659 {
660 if (GreGetObjectOwner(pdce->hDC) == GDI_OBJ_HMGR_PUBLIC)
662 }
663
664 if (!Hit) IntGdiDeleteDC(pdce->hDC, TRUE);
665
666 if (pdce->hrgnClip && !(pdce->DCXFlags & DCX_KEEPCLIPRGN))
667 {
668 GreDeleteObject(pdce->hrgnClip);
669 pdce->hrgnClip = NULL;
670 }
671
672 RemoveEntryList(&pdce->List);
673
675
676 DCECount--;
677 TRACE("Freed DCE's! %d \n", DCECount);
678}
#define ERR(fmt,...)
Definition: debug.h:110
_Inout_ PVCB _In_ BOOLEAN Force
Definition: cdprocs.h:1417
BOOL FASTCALL IntGdiDeleteDC(HDC, BOOL)
Definition: dclife.c:892
#define DCX_INDESTROY
Definition: dce.h:42
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ASSERT(a)
Definition: mode.c:44
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
#define GDI_OBJ_HMGR_PUBLIC
Definition: ntgdihdl.h:116
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:68
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
ULONG NTAPI GreGetObjectOwner(HGDIOBJ hobj)
Definition: gdiobj.c:1192
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1146

Referenced by DceEmptyCache(), DceFreeClassDCE(), DceFreeThreadDCE(), DceFreeWindowDCE(), and DceReleaseDC().

◆ DceFreeThreadDCE()

void FASTCALL DceFreeThreadDCE ( PTHREADINFO  pti)

Definition at line 780 of file windc.c.

781{
782 PDCE pDCE;
783 PLIST_ENTRY ListEntry;
784
785 ListEntry = LEDce.Flink;
786 while (ListEntry != &LEDce)
787 {
788 pDCE = CONTAINING_RECORD(ListEntry, DCE, List);
789 ListEntry = ListEntry->Flink;
790 if (pDCE->ptiOwner == pti)
791 {
792 if (pDCE->DCXFlags & DCX_CACHE)
793 {
794 DceFreeDCE(pDCE, TRUE);
795 }
796 }
797 }
798}

Referenced by ExitThreadCallback().

◆ DceFreeWindowDCE()

void FASTCALL DceFreeWindowDCE ( PWND  Window)

Definition at line 686 of file windc.c.

687{
688 PDCE pDCE;
689 PLIST_ENTRY ListEntry;
690
691 if (DCECount <= 0)
692 {
693 ERR("FreeWindowDCE No Entry! %d\n",DCECount);
694 return;
695 }
696
697 ListEntry = LEDce.Flink;
698 while (ListEntry != &LEDce)
699 {
700 pDCE = CONTAINING_RECORD(ListEntry, DCE, List);
701 ListEntry = ListEntry->Flink;
702 if ( pDCE->hwndCurrent == UserHMGetHandle(Window) &&
703 !(pDCE->DCXFlags & DCX_DCEEMPTY) )
704 {
705 if (!(pDCE->DCXFlags & DCX_CACHE)) /* Owned or Class DCE */
706 {
707 if (Window->pcls->style & CS_CLASSDC) /* Test Class first */
708 {
709 if (pDCE->DCXFlags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN)) /* Class DCE */
710 DceDeleteClipRgn(pDCE);
711 // Update and reset Vis Rgn and clear the dirty bit.
712 // Should release VisRgn than reset it to default.
713 DceUpdateVisRgn(pDCE, Window, pDCE->DCXFlags);
715 pDCE->hwndCurrent = 0;
716 pDCE->pwndOrg = pDCE->pwndClip = NULL;
717
718 TRACE("POWNED DCE going Cheap!! DCX_CACHE!! hDC-> %p \n",
719 pDCE->hDC);
720 if (!GreSetDCOwner( pDCE->hDC, GDI_OBJ_HMGR_NONE))
721 {
722 ERR("Fail Owner Switch hDC-> %p \n", pDCE->hDC);
723 break;
724 }
725 /* Do not change owner so thread can clean up! */
726 }
727 else if (Window->pcls->style & CS_OWNDC) /* Owned DCE */
728 {
729 DceFreeDCE(pDCE, FALSE);
730 continue;
731 }
732 else
733 {
734 ERR("Not POWNED or CLASSDC hwndCurrent -> %p \n",
735 pDCE->hwndCurrent);
736 // ASSERT(FALSE); /* bug 5320 */
737 }
738 }
739 else
740 {
741 if (pDCE->DCXFlags & DCX_DCEBUSY) /* Shared cache DCE */
742 {
743 /* FIXME: AFAICS we are doing the right thing here so
744 * this should be a TRACE. But this is best left as an ERR
745 * because the 'application error' is likely to come from
746 * another part of Wine (i.e. it's our fault after all).
747 * We should change this to TRACE when ReactOS is more stable
748 * (for 1.0?).
749 */
750 ERR("[%p] GetDC() without ReleaseDC()!\n", UserHMGetHandle(Window));
751 DceReleaseDC(pDCE, FALSE);
752 }
753 pDCE->DCXFlags |= DCX_DCEEMPTY;
754 pDCE->hwndCurrent = 0;
755 pDCE->pwndOrg = pDCE->pwndClip = NULL;
756 }
757 }
758 }
759}
static VOID FASTCALL DceDeleteClipRgn(DCE *Dce)
Definition: windc.c:170
VOID FASTCALL DceUpdateVisRgn(DCE *Dce, PWND Window, ULONG Flags)
Definition: windc.c:192
static INT FASTCALL DceReleaseDC(DCE *dce, BOOL EndPaint)
Definition: windc.c:279
#define DCX_INTERSECTRGN
Definition: winuser.h:2122
#define CS_OWNDC
Definition: winuser.h:655
#define CS_CLASSDC
Definition: winuser.h:650
#define DCX_EXCLUDERGN
Definition: winuser.h:2121

Referenced by co_UserFreeWindow().

◆ DceGetDceFromDC()

DCE *FASTCALL DceGetDceFromDC ( HDC  hdc)

Definition at line 53 of file windc.c.

54{
55 PLIST_ENTRY ListEntry;
56 DCE* dce;
57
58 ListEntry = LEDce.Flink;
59 while (ListEntry != &LEDce)
60 {
61 dce = CONTAINING_RECORD(ListEntry, DCE, List);
62 ListEntry = ListEntry->Flink;
63 if (dce->hDC == hdc)
64 return dce;
65 }
66
67 return NULL;
68}
HDC hdc
Definition: main.c:9

◆ DceResetActiveDCEs()

VOID FASTCALL DceResetActiveDCEs ( PWND  Window)

Definition at line 816 of file windc.c.

817{
818 DCE *pDCE;
819 PDC dc;
820 PWND CurrentWindow;
821 INT DeltaX;
822 INT DeltaY;
823 PLIST_ENTRY ListEntry;
824
825 if (NULL == Window)
826 {
827 return;
828 }
829
830 ListEntry = LEDce.Flink;
831 while (ListEntry != &LEDce)
832 {
833 pDCE = CONTAINING_RECORD(ListEntry, DCE, List);
834 ListEntry = ListEntry->Flink;
835 if (0 == (pDCE->DCXFlags & (DCX_DCEEMPTY|DCX_INDESTROY)))
836 {
837 if (UserHMGetHandle(Window) == pDCE->hwndCurrent)
838 {
839 CurrentWindow = Window;
840 }
841 else
842 {
843 if (!pDCE->hwndCurrent)
844 CurrentWindow = NULL;
845 else
846 CurrentWindow = UserGetWindowObject(pDCE->hwndCurrent);
847 if (NULL == CurrentWindow)
848 {
849 continue;
850 }
851 }
852
853 if (!GreIsHandleValid(pDCE->hDC) ||
854 (dc = DC_LockDc(pDCE->hDC)) == NULL)
855 {
856 continue;
857 }
858 if (Window == CurrentWindow || IntIsChildWindow(Window, CurrentWindow))
859 {
860 if (pDCE->DCXFlags & DCX_WINDOW)
861 {
862 DeltaX = CurrentWindow->rcWindow.left - dc->ptlDCOrig.x;
863 DeltaY = CurrentWindow->rcWindow.top - dc->ptlDCOrig.y;
864 dc->ptlDCOrig.x = CurrentWindow->rcWindow.left;
865 dc->ptlDCOrig.y = CurrentWindow->rcWindow.top;
866 }
867 else
868 {
869 DeltaX = CurrentWindow->rcClient.left - dc->ptlDCOrig.x;
870 DeltaY = CurrentWindow->rcClient.top - dc->ptlDCOrig.y;
871 dc->ptlDCOrig.x = CurrentWindow->rcClient.left;
872 dc->ptlDCOrig.y = CurrentWindow->rcClient.top;
873 }
874
875 if (NULL != dc->dclevel.prgnClip)
876 {
877 REGION_bOffsetRgn(dc->dclevel.prgnClip, DeltaX, DeltaY);
878 dc->fs |= DC_DIRTY_RAO;
879 }
880 if (NULL != pDCE->hrgnClip)
881 {
882 NtGdiOffsetRgn(pDCE->hrgnClip, DeltaX, DeltaY);
883 }
884 }
886
887 DceUpdateVisRgn(pDCE, CurrentWindow, pDCE->DCXFlags);
889 }
890 }
891}
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
@ DC_DIRTY_RAO
Definition: dc.h:23
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
WORD APIENTRY IntGdiSetHookFlags(HDC hDC, WORD Flags)
Definition: dcutil.c:422
#define DCHF_VALIDATEVISRGN
Definition: gdi_driver.h:268
static const WCHAR dc[]
__kernel_entry W32KAPI INT APIENTRY NtGdiOffsetRgn(_In_ HRGN hrgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:3961
Definition: polytest.cpp:41
Definition: ntuser.h:694
RECT rcClient
Definition: ntuser.h:717
RECT rcWindow
Definition: ntuser.h:716
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:122
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2707
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:927
#define DCX_WINDOW
Definition: winuser.h:2113

Referenced by co_IntSetParent(), co_IntSetWindowLongPtr(), co_WinPosSetWindowPos(), and IntSetStyle().

◆ DceUpdateVisRgn()

VOID FASTCALL DceUpdateVisRgn ( DCE Dce,
PWND  Window,
ULONG  Flags 
)

Definition at line 192 of file windc.c.

193{
194 PREGION RgnVisible = NULL;
195 ULONG DcxFlags;
197
198 if (Flags & DCX_PARENTCLIP)
199 {
200 PWND Parent;
201
202 Parent = Window->spwndParent;
203 if (!Parent)
204 {
205 RgnVisible = NULL;
206 goto noparent;
207 }
208
209 if (Parent->style & WS_CLIPSIBLINGS)
210 {
211 DcxFlags = DCX_CLIPSIBLINGS |
213 }
214 else
215 {
217 }
218 RgnVisible = DceGetVisRgn(Parent, DcxFlags, UserHMGetHandle(Window), Flags);
219 }
220 else if (Window == NULL)
221 {
223 if (NULL != DesktopWindow)
224 {
225 RgnVisible = IntSysCreateRectpRgnIndirect(&DesktopWindow->rcWindow);
226 }
227 else
228 {
229 RgnVisible = NULL;
230 }
231 }
232 else
233 {
234 RgnVisible = DceGetVisRgn(Window, Flags, 0, 0);
235 }
236
237noparent:
239 {
240 PREGION RgnClip = NULL;
241
242 if (Dce->hrgnClip != NULL)
243 RgnClip = REGION_LockRgn(Dce->hrgnClip);
244
245 if (RgnClip)
246 {
247 IntGdiCombineRgn(RgnVisible, RgnVisible, RgnClip, RGN_AND);
248 REGION_UnlockRgn(RgnClip);
249 }
250 else
251 {
252 if (RgnVisible != NULL)
253 {
254 REGION_Delete(RgnVisible);
255 }
256 RgnVisible = IntSysCreateRectpRgn(0, 0, 0, 0);
257 }
258 }
259 else if ((Flags & DCX_EXCLUDERGN) && Dce->hrgnClip != NULL)
260 {
261 PREGION RgnClip = REGION_LockRgn(Dce->hrgnClip);
262 IntGdiCombineRgn(RgnVisible, RgnVisible, RgnClip, RGN_DIFF);
263 REGION_UnlockRgn(RgnClip);
264 }
265
266 Dce->DCXFlags &= ~DCX_DCEDIRTY;
267 GdiSelectVisRgn(Dce->hDC, RgnVisible);
268 /* Tell GDI driver */
269 if (Window)
271
272 if (RgnVisible != NULL)
273 {
274 REGION_Delete(RgnVisible);
275 }
276}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
VOID FASTCALL GdiSelectVisRgn(HDC hdc, PREGION prgn)
Definition: cliprgn.c:57
VOID FASTCALL IntEngWindowChanged(_In_ struct _WND *Window, _In_ FLONG flChanged)
#define IntSysCreateRectpRgnIndirect(prc)
Definition: region.h:93
Implementation of the Explorer desktop window.
Definition: desktop.h:52
Definition: region.h:8
uint32_t ULONG
Definition: typedefs.h:59
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2449
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2358
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2373
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2407
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2487
HWND FASTCALL IntGetDesktopWindow(VOID)
Definition: desktop.c:1374
static PREGION FASTCALL DceGetVisRgn(PWND Window, ULONG Flags, HWND hWndChild, ULONG CFlags)
Definition: windc.c:72
#define WOC_RGN_CLIENT
Definition: winddi.h:1265
#define RGN_DIFF
Definition: wingdi.h:358
#define RGN_AND
Definition: wingdi.h:356
#define DCX_PARENTCLIP
Definition: winuser.h:2115
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by DceFreeWindowDCE(), DceReleaseDC(), DceResetActiveDCEs(), and UserGetDCEx().

◆ IntWindowFromDC()

HWND FASTCALL IntWindowFromDC ( HDC  hDc)

Definition at line 894 of file windc.c.

895{
896 DCE *Dce;
897 PLIST_ENTRY ListEntry;
898 HWND Ret = NULL;
899
900 ListEntry = LEDce.Flink;
901 while (ListEntry != &LEDce)
902 {
903 Dce = CONTAINING_RECORD(ListEntry, DCE, List);
904 ListEntry = ListEntry->Flink;
905 if (Dce->hDC == hDc)
906 {
907 if (Dce->DCXFlags & DCX_INDESTROY)
908 Ret = NULL;
909 else
910 Ret = Dce->hwndCurrent;
911 break;
912 }
913 }
914 return Ret;
915}

Referenced by NtGdiUpdateColors(), NtUserCallOneParam(), UserGethWnd(), and UserRealizePalette().

◆ UserGethWnd()

HWND FASTCALL UserGethWnd ( HDC  hdc,
PWNDOBJ pwndo 
)

Definition at line 953 of file windc.c.

954{
955 EWNDOBJ* Clip;
956 PWND Wnd;
957 HWND hWnd;
958
960
961 if (hWnd && (Wnd = UserGetWindowObject(hWnd)))
962 {
963 Clip = (EWNDOBJ*)UserGetProp(Wnd, AtomWndObj, TRUE);
964
965 if ( Clip && Clip->Hwnd == hWnd )
966 {
967 if (pwndo) *pwndo = (PWNDOBJ)Clip;
968 }
969 }
970 return hWnd;
971}
HWND hWnd
Definition: settings.c:17
ATOM AtomWndObj
Definition: ntuser.c:20
HWND Hwnd
Definition: engobjects.h:101
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
HWND FASTCALL IntWindowFromDC(HDC hDc)
Definition: windc.c:894
struct _WNDOBJ * PWNDOBJ

Referenced by NtGdiSetPixelFormat(), and NtGdiSwapBuffers().