xref: /reactos/win32ss/gdi/ntgdi/misc.h (revision de5c4720)
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 USHORT gusLanguageID;
25 
26 BOOL InitializeGreCSRSS(VOID);
27 USHORT FASTCALL UserGetLanguageID(VOID);
28 
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, PCWSTR pwszValue, PWSTR pwszData);
50 
51 VOID
52 NTAPI
53 RegWriteDWORD(HKEY hkey, PCWSTR pwszValue, DWORD dwData);
54 
55 BOOL
56 NTAPI
57 RegReadDWORD(HKEY hkey, PCWSTR pwszValue, PDWORD pdwData);
58 
59 DWORD
60 NTAPI
61 RegGetSectionDWORD(LPCWSTR pszSection, PCWSTR pszValue, DWORD dwDefault);
62 
63 VOID
64 FASTCALL
65 SetLastNtError(_In_ NTSTATUS Status);
66 
67 typedef struct _GDI_POOL *PGDI_POOL;
68 
69 PGDI_POOL
70 NTAPI
71 GdiPoolCreate(
72     ULONG cjAllocSize,
73     ULONG ulTag);
74 
75 VOID
76 NTAPI
77 GdiPoolDestroy(PGDI_POOL pPool);
78 
79 PVOID
80 NTAPI
81 GdiPoolAllocate(
82     PGDI_POOL pPool);
83 
84 VOID
85 NTAPI
86 GdiPoolFree(
87     PGDI_POOL pPool,
88     PVOID pvAlloc);
89 
90 FORCEINLINE
91 VOID
92 ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
93 {
94     /* Try acquiring the lock */
95     if (InterlockedBitTestAndSet((PLONG)PushLock, EX_PUSH_LOCK_LOCK_V))
96     {
97         /* Someone changed it, use the slow path */
98         ExfAcquirePushLockExclusive(PushLock);
99     }
100 }
101 
102 FORCEINLINE
103 BOOLEAN
104 ExTryAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
105 {
106     /* Try acquiring the lock */
107     return !InterlockedBitTestAndSet((PLONG)PushLock, EX_PUSH_LOCK_LOCK_V);
108 }
109 
110 FORCEINLINE
111 VOID
112 ExReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
113 {
114     EX_PUSH_LOCK OldValue;
115 
116     /* Unlock the pushlock */
117     OldValue.Value = InterlockedExchangeAddSizeT((PSIZE_T)PushLock,
118                                                  -(SSIZE_T)EX_PUSH_LOCK_LOCK);
119     /* Check if anyone is waiting on it and it's not already waking */
120     if ((OldValue.Waiting) && !(OldValue.Waking))
121     {
122         /* Wake it up */
123         ExfTryToWakePushLock(PushLock);
124     }
125 }
126 
127 FORCEINLINE
128 VOID
129 _ExInitializePushLock(PEX_PUSH_LOCK Lock)
130 {
131     *(PULONG_PTR)Lock = 0;
132 }
133 #define ExInitializePushLock _ExInitializePushLock
134 
135 NTSTATUS FASTCALL
136 IntSafeCopyUnicodeString(PUNICODE_STRING Dest,
137                          PUNICODE_STRING Source);
138 
139 NTSTATUS FASTCALL
140 IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest,
141                                       PUNICODE_STRING Source);
142 
143 HBITMAP NTAPI UserLoadImage(PCWSTR);
144 
145 BOOL NTAPI W32kDosPathNameToNtPathName(PCWSTR, PUNICODE_STRING);
146 
147