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