FreeRDP
wtypes.h
1 
22 #ifndef WINPR_WTYPES_H
23 #define WINPR_WTYPES_H
24 
25 #include <assert.h>
26 
27 #include <winpr/config.h>
28 #include <winpr/platform.h>
29 
30 /* MSDN: Windows Data Types - http://msdn.microsoft.com/en-us/library/aa383751/ */
31 /* [MS-DTYP]: Windows Data Types - http://msdn.microsoft.com/en-us/library/cc230273/ */
32 
33 #include <wchar.h>
34 #include <winpr/windows.h>
35 
36 #include <winpr/spec.h>
37 
38 #include <stdbool.h>
39 #include <stdint.h>
40 #include <inttypes.h>
41 
42 #include <limits.h>
43 
44 #if defined(_WIN32) || defined(__MINGW32__)
45 #include <wtypes.h>
46 
47 /* Handle missing ssize_t on Windows */
48 #if defined(WINPR_HAVE_SSIZE_T)
49 typedef ssize_t SSIZE_T;
50 #elif !defined(WINPR_HAVE_WIN_SSIZE_T)
51 typedef intptr_t SSIZE_T;
52 #endif
53 
54 #endif
55 
56 #if defined(__OBJC__) && defined(__APPLE__)
57 #include <objc/objc.h>
58 #endif
59 
60 #ifndef CONST
61 #define CONST const
62 #endif
63 
64 #ifndef VOID
65 #define VOID void
66 #endif
67 
68 WINPR_PRAGMA_DIAG_PUSH WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
69  WINPR_PRAGMA_DIAG_IGNORED_RESERVED_IDENTIFIER
70 
71 #if !defined(_WIN32) && !defined(__MINGW32__)
72 
73 #define CALLBACK
74 
75 #define WINAPI
76 #define CDECL
77 
78 #ifndef FAR
79 #define FAR
80 #endif
81 
82 #ifndef NEAR
83 #define NEAR
84 #endif
85 
86  typedef void *PVOID,
87  *LPVOID, *PVOID64, *LPVOID64;
88 
89 #ifndef XMD_H /* X11/Xmd.h typedef collision with BOOL */
90 #ifndef __OBJC__ /* objc.h typedef collision with BOOL */
91 #ifndef __APPLE__
92 typedef int32_t BOOL;
93 
94 #else /* __APPLE__ */
95 #include <TargetConditionals.h>
96 
97 /* ensure compatibility with objc libraries */
98 #if (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0) && defined(__LP64__)) || \
99  (defined(TARGET_OS_WATCH) && (TARGET_OS_WATCH != 0))
100 typedef bool BOOL;
101 #else
102 typedef signed char BOOL;
103 #endif
104 #endif /* __APPLE__ */
105 #endif /* __OBJC__ */
106 #endif /* XMD_H */
107 
108 typedef BOOL *PBOOL, *LPBOOL;
109 
110 #ifndef FALSE
111 #define FALSE false
112 #endif
113 
114 #ifndef TRUE
115 #define TRUE true
116 #endif
117 
118 #ifndef XMD_H /* X11/Xmd.h typedef collision with BYTE */
119 typedef uint8_t BYTE;
120 
121 #endif /* XMD_H */
122 typedef BYTE byte, *PBYTE, *LPBYTE;
123 typedef BYTE BOOLEAN, PBOOLEAN;
124 
125 #if CHAR_BIT == 8
126 typedef char CHAR;
127 typedef unsigned char UCHAR;
128 #else
129 typedef int8_t CHAR;
130 
131 typedef uint8_t UCHAR;
132 
133 #endif
134 typedef CHAR CCHAR, *PCHAR, *LPCH, *PCH, *PSTR, *LPSTR;
135 typedef const CHAR *LPCCH, *PCCH, *LPCSTR, *PCSTR;
136 typedef UCHAR* PUCHAR;
137 
138 typedef uint16_t WCHAR;
139 
140 typedef WCHAR UNICODE, *PWCHAR, *LPWCH, *PWCH, *BSTR, *LMSTR, *LPWSTR, *PWSTR;
141 typedef const WCHAR *LPCWCH, *PCWCH, *LMCSTR, *LPCWSTR, *PCWSTR;
142 
143 typedef int16_t SHORT, *PSHORT;
144 
145 typedef int32_t INT, *PINT, *LPINT;
146 
147 typedef int32_t LONG, *PLONG, *LPLONG;
148 
149 typedef int64_t LONGLONG, *PLONGLONG;
150 
151 typedef uint32_t UINT, *PUINT, *LPUINT;
152 
153 typedef uint16_t USHORT, *PUSHORT;
154 
155 typedef uint32_t ULONG, *PULONG;
156 
157 typedef uint64_t ULONGLONG, *PULONGLONG;
158 
159 #ifndef XMD_H /* X11/Xmd.h typedef collisions */
160 typedef int8_t INT8;
161 
162 typedef int16_t INT16;
163 
164 typedef int32_t INT32;
165 
166 typedef int64_t INT64;
167 
168 #endif
169 typedef INT8* PINT8;
170 typedef INT16* PINT16;
171 typedef INT32* PINT32;
172 typedef INT64* PINT64;
173 
174 typedef int32_t LONG32, *PLONG32;
175 
176 #ifndef LONG64 /* X11/Xmd.h uses/defines LONG64 */
177 typedef int64_t LONG64, *PLONG64;
178 
179 #endif
180 
181 typedef uint8_t UINT8, *PUINT8;
182 
183 typedef uint16_t UINT16, *PUINT16;
184 
185 typedef uint32_t UINT32, *PUINT32;
186 
187 typedef uint64_t UINT64, *PUINT64;
188 
189 typedef uint64_t ULONG64, *PULONG64;
190 
191 typedef uint16_t WORD, *PWORD, *LPWORD;
192 
193 typedef uint32_t DWORD, DWORD32, *PDWORD, *LPDWORD, *PDWORD32;
194 
195 typedef uint64_t DWORD64, DWORDLONG, QWORD, *PDWORD64, *PDWORDLONG, *PQWORD;
196 
197 typedef intptr_t INT_PTR, *PINT_PTR;
198 
199 typedef uintptr_t UINT_PTR, *PUINT_PTR;
200 
201 typedef intptr_t LONG_PTR, *PLONG_PTR;
202 
203 typedef uintptr_t ULONG_PTR, *PULONG_PTR;
204 
205 typedef uintptr_t DWORD_PTR, *PDWORD_PTR;
206 
207 typedef ULONG_PTR SIZE_T, *PSIZE_T;
208 #if defined(WINPR_HAVE_SSIZE_T)
209 #include <sys/types.h>
210 typedef ssize_t SSIZE_T;
211 #elif !defined(WINPR_HAVE_WIN_SSIZE_T)
212 typedef LONG_PTR SSIZE_T;
213 #endif
214 
215 typedef float FLOAT;
216 
217 typedef double DOUBLE;
218 
219 typedef void* HANDLE;
220 typedef HANDLE *PHANDLE, *LPHANDLE;
221 typedef HANDLE HINSTANCE;
222 typedef HANDLE HMODULE;
223 typedef HANDLE HWND;
224 typedef HANDLE HBITMAP;
225 typedef HANDLE HICON;
226 typedef HANDLE HCURSOR;
227 typedef HANDLE HBRUSH;
228 typedef HANDLE HMENU;
229 
230 typedef DWORD HCALL;
231 
232 typedef ULONG error_status_t;
233 typedef LONG HRESULT;
234 typedef LONG SCODE;
235 typedef SCODE* PSCODE;
236 
237 typedef struct s_POINTL /* ptl */
238 {
239  LONG x;
240  LONG y;
241 } POINTL, *PPOINTL;
242 
243 typedef struct tagSIZE
244 {
245  LONG cx;
246  LONG cy;
247 } SIZE, *PSIZE, *LPSIZE;
248 
249 typedef SIZE SIZEL;
250 
251 typedef struct s_GUID
252 {
253  UINT32 Data1;
254  UINT16 Data2;
255  UINT16 Data3;
256  BYTE Data4[8];
257 } GUID, UUID, *PGUID, *LPGUID, *LPCGUID;
258 typedef GUID CLSID;
259 
260 typedef struct s_LUID
261 {
262  DWORD LowPart;
263  LONG HighPart;
264 } LUID, *PLUID;
265 
266 typedef GUID IID;
267 typedef IID* REFIID;
268 
269 #ifdef UNICODE
270 #define _T(x) u##x // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
271 
272 #else
273 #define _T(x) x // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
274 
275 #endif
276 
277 #ifdef UNICODE
278 typedef LPWSTR PTSTR;
279 typedef LPWSTR LPTCH;
280 typedef LPWSTR LPTSTR;
281 typedef LPCWSTR LPCTSTR;
282 #else
283 typedef LPSTR PTSTR;
284 typedef LPSTR LPTCH;
285 typedef LPSTR LPTSTR;
286 typedef LPCSTR LPCTSTR;
287 #endif
288 
289 typedef union u_ULARGE_INTEGER
290 {
291  struct
292  {
293  DWORD LowPart;
294  DWORD HighPart;
295  } DUMMYSTRUCTNAME;
296 
297  struct
298  {
299  DWORD LowPart;
300  DWORD HighPart;
301  } u;
302 
303  ULONGLONG QuadPart;
304 } ULARGE_INTEGER, *PULARGE_INTEGER;
305 
306 typedef union u_LARGE_INTEGER
307 {
308  struct
309  {
310  DWORD LowPart;
311  LONG HighPart;
312  } DUMMYSTRUCTNAME;
313 
314  struct
315  {
316  DWORD LowPart;
317  LONG HighPart;
318  } u;
319 
320  LONGLONG QuadPart;
321 } LARGE_INTEGER, *PLARGE_INTEGER;
322 
323 typedef struct s_FILETIME
324 {
325  DWORD dwLowDateTime;
326  DWORD dwHighDateTime;
327 } FILETIME, *PFILETIME, *LPFILETIME;
328 
329 typedef struct s_SYSTEMTIME
330 {
331  WORD wYear;
332  WORD wMonth;
333  WORD wDayOfWeek;
334  WORD wDay;
335  WORD wHour;
336  WORD wMinute;
337  WORD wSecond;
338  WORD wMilliseconds;
339 } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
340 
341 typedef struct s_RPC_SID_IDENTIFIER_AUTHORITY
342 {
343  BYTE Value[6];
345 
346 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
347 
348 typedef struct s_RPC_SID
349 {
350  UCHAR Revision;
351  UCHAR SubAuthorityCount;
352  RPC_SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
353  ULONG SubAuthority[1];
354 } RPC_SID, *PRPC_SID, *PSID;
355 
356 typedef struct s_ACL
357 {
358  UCHAR AclRevision;
359  UCHAR Sbz1;
360  USHORT AclSize;
361  USHORT AceCount;
362  USHORT Sbz2;
363 } ACL, *PACL;
364 
365 typedef struct s_SECURITY_DESCRIPTOR
366 {
367  UCHAR Revision;
368  UCHAR Sbz1;
369  USHORT Control;
370  PSID Owner;
371  PSID Group;
372  PACL Sacl;
373  PACL Dacl;
374 } SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
375 
376 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
377 
378 typedef struct s_SECURITY_ATTRIBUTES
379 {
380  DWORD nLength;
381  LPVOID lpSecurityDescriptor;
382  BOOL bInheritHandle;
383 } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
384 
385 typedef struct s_PROCESS_INFORMATION
386 {
387  HANDLE hProcess;
388  HANDLE hThread;
389  DWORD dwProcessId;
390  DWORD dwThreadId;
391 } PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION;
392 
393 typedef DWORD (*PTHREAD_START_ROUTINE)(LPVOID lpThreadParameter);
394 typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
395 
396 typedef void* FARPROC;
397 
398 typedef struct tagDEC
399 {
400  USHORT wReserved;
401  union
402  {
403  struct
404  {
405  BYTE scale;
406  BYTE sign;
407  } DUMMYSTRUCTNAME;
408  USHORT signscale;
409  } DUMMYUNIONNAME;
410  ULONG Hi32;
411  union
412  {
413  struct
414  {
415  ULONG Lo32;
416  ULONG Mid32;
417  } DUMMYSTRUCTNAME2;
418  ULONGLONG Lo64;
419  } DUMMYUNIONNAME2;
420 } DECIMAL;
421 
422 typedef DECIMAL* LPDECIMAL;
423 
424 #define DECIMAL_NEG ((BYTE)0x80)
425 #define DECIMAL_SETZERO(dec) \
426  { \
427  (dec).Lo64 = 0; \
428  (dec).Hi32 = 0; \
429  (dec).signscale = 0; \
430  }
431 
432 typedef DWORD LCID;
433 typedef PDWORD PLCID;
434 typedef WORD LANGID;
435 
436 #endif /* _WIN32 not defined */
437 
438 typedef void* PCONTEXT_HANDLE;
439 typedef PCONTEXT_HANDLE* PPCONTEXT_HANDLE;
440 
441 #ifndef _NTDEF
442 typedef LONG NTSTATUS;
443 typedef NTSTATUS* PNTSTATUS;
444 #endif
445 
446 #ifndef _LPCVOID_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
447 
448 #define _LPCVOID_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
449 
450 typedef const VOID* LPCVOID;
451 #endif
452 
453 #ifndef _LPCBYTE_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
454 
455 #define _LPCBYTE_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
456 
457 typedef const BYTE* LPCBYTE;
458 #endif
459 
460 #ifndef SSIZE_MAX
461 #if defined(_POSIX_SSIZE_MAX)
462 #define SSIZE_MAX _POSIX_SSIZE_MAX
463 #elif defined(_WIN64)
464 #define SSIZE_MAX _I64_MAX
465 #elif defined(_WIN32)
466 #define SSIZE_MAX LONG_MAX
467 #else
468 #define SSIZE_MAX INTPTR_MAX
469 #endif
470 #endif
471 
472 #define PRIdz "zd"
473 #define PRIiz "zi"
474 #define PRIuz "zu"
475 #define PRIoz "zo"
476 #define PRIxz "zx"
477 #define PRIXz "zX"
478 
479 #include <winpr/user.h>
480 
481 #ifndef _WIN32
482 #include <stdio.h>
483 
484 // NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
485 static inline int _fseeki64(FILE* fp, INT64 offset, int origin)
486 {
487  return fseeko(fp, offset, origin);
488 }
489 
490 // NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
491 static inline INT64 _ftelli64(FILE* fp)
492 {
493  return ftello(fp);
494 }
495 #endif
496 
497 WINPR_PRAGMA_DIAG_POP
498 
499 #endif /* WINPR_WTYPES_H */
Definition: wtypes.h:357
Definition: wtypes.h:261
Definition: wtypes.h:238
Definition: wtypes.h:244
Definition: wtypes.h:252