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