[CMAKE]
[reactos.git] / subsystems / win32 / win32k / include / misc.h
1 #pragma once
2
3 typedef struct INTENG_ENTER_LEAVE_TAG
4 {
5 /* Contents is private to EngEnter/EngLeave */
6 SURFOBJ *DestObj;
7 SURFOBJ *OutputObj;
8 HBITMAP OutputBitmap;
9 CLIPOBJ *TrivialClipObj;
10 RECTL DestRect;
11 BOOL ReadOnly;
12 } INTENG_ENTER_LEAVE, *PINTENG_ENTER_LEAVE;
13
14 extern BOOL APIENTRY IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
15 SURFOBJ *DestObj,
16 RECTL *DestRect,
17 BOOL ReadOnly,
18 POINTL *Translate,
19 SURFOBJ **OutputObj);
20
21 extern BOOL APIENTRY IntEngLeave(PINTENG_ENTER_LEAVE EnterLeave);
22
23 extern HGDIOBJ StockObjects[];
24 extern SHORT gusLanguageID;
25
26 SHORT FASTCALL IntGdiGetLanguageID(VOID);
27 DWORD APIENTRY IntGetQueueStatus(DWORD);
28 VOID FASTCALL IntUserManualGuiCheck(LONG Check);
29 PVOID APIENTRY HackSecureVirtualMemory(IN PVOID,IN SIZE_T,IN ULONG,OUT PVOID *);
30 VOID APIENTRY HackUnsecureVirtualMemory(IN PVOID);
31
32 NTSTATUS
33 NTAPI
34 RegOpenKey(
35 LPCWSTR pwszKeyName,
36 PHKEY phkey);
37
38 NTSTATUS
39 NTAPI
40 RegQueryValue(
41 IN HKEY hkey,
42 IN PCWSTR pwszValueName,
43 IN ULONG ulType,
44 OUT PVOID pvData,
45 IN OUT PULONG pcbValue);
46
47 VOID
48 NTAPI
49 RegWriteSZ(HKEY hkey, PWSTR pwszValue, PWSTR pwszData);
50
51 VOID
52 NTAPI
53 RegWriteDWORD(HKEY hkey, PWSTR pwszValue, DWORD dwData);
54
55 BOOL
56 NTAPI
57 RegReadDWORD(HKEY hkey, PWSTR pwszValue, PDWORD pdwData);
58
59 BOOL
60 NTAPI
61 RegReadUserSetting(
62 IN PCWSTR pwszKeyName,
63 IN PCWSTR pwszValueName,
64 IN ULONG ulType,
65 OUT PVOID pvData,
66 IN ULONG cbDataSize);
67
68 BOOL
69 NTAPI
70 RegWriteUserSetting(
71 IN PCWSTR pwszKeyName,
72 IN PCWSTR pwszValueName,
73 IN ULONG ulType,
74 OUT PVOID pvData,
75 IN ULONG cbDataSize);
76
77 VOID FASTCALL
78 SetLastNtError(
79 NTSTATUS Status);
80
81 typedef struct _GDI_POOL *PGDI_POOL;
82
83 PGDI_POOL
84 NTAPI
85 GdiPoolCreate(
86 ULONG cjAllocSize,
87 ULONG ulTag);
88
89 VOID
90 NTAPI
91 GdiPoolDestroy(PGDI_POOL pPool);
92
93 PVOID
94 NTAPI
95 GdiPoolAllocate(
96 PGDI_POOL pPool);
97
98 VOID
99 NTAPI
100 GdiPoolFree(
101 PGDI_POOL pPool,
102 PVOID pvAlloc);
103
104 FORCEINLINE
105 VOID
106 ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
107 {
108 /* Try acquiring the lock */
109 if (InterlockedBitTestAndSet((PLONG)PushLock, EX_PUSH_LOCK_LOCK_V))
110 {
111 /* Someone changed it, use the slow path */
112 ExfAcquirePushLockExclusive(PushLock);
113 }
114 }
115
116 FORCEINLINE
117 VOID
118 ExReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
119 {
120 EX_PUSH_LOCK OldValue;
121
122 /* Unlock the pushlock */
123 OldValue.Value = InterlockedExchangeAddSizeT((PSIZE_T)PushLock,
124 -(SSIZE_T)EX_PUSH_LOCK_LOCK);
125 /* Check if anyone is waiting on it and it's not already waking */
126 if ((OldValue.Waiting) && !(OldValue.Waking))
127 {
128 /* Wake it up */
129 ExfTryToWakePushLock(PushLock);
130 }
131 }
132
133 FORCEINLINE
134 VOID
135 _ExInitializePushLock(PEX_PUSH_LOCK Lock)
136 {
137 *(PULONG_PTR)Lock = 0;
138 }
139 #define ExInitializePushLock _ExInitializePushLock