pal_mstypes.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. //
  2. // Copyright (c) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
  4. //
  5. /*++
  6. --*/
  7. ////////////////////////////////////////////////////////////////////////
  8. // Extensions to the usual posix header files
  9. ////////////////////////////////////////////////////////////////////////
  10. #ifndef __PAL_MSTYPES_H__
  11. #define __PAL_MSTYPES_H__
  12. #define __MSTYPES_DEFINED
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #define BIGENDIAN 0
  17. ////////////////////////////////////////////////////////////////////////
  18. // calling convention stuff
  19. ////////////////////////////////////////////////////////////////////////
  20. #ifdef __cplusplus
  21. #define EXTERN_C extern "C"
  22. #else
  23. #define EXTERN_C
  24. #endif // __cplusplus
  25. // Note: Win32-hosted GCC predefines __stdcall and __cdecl, but Unix-
  26. // hosted GCC does not.
  27. #ifdef __i386__
  28. #define __stdcall
  29. #define _stdcall
  30. #define __cdecl
  31. #define _cdecl
  32. #define CDECL
  33. #ifndef PAL_STDCPP_COMPAT
  34. #undef __fastcall
  35. #define __fastcall __stdcall
  36. #undef _fastcall
  37. #define _fastcall __fastcall
  38. #endif // PAL_STDCPP_COMPAT
  39. #else // !defined(__i386__)
  40. #define __stdcall
  41. #define _stdcall
  42. #define __cdecl
  43. #define _cdecl
  44. #define CDECL
  45. // On ARM __fastcall is ignored and causes a compile error
  46. #if !defined(PAL_STDCPP_COMPAT) || defined(__arm__)
  47. # undef __fastcall
  48. # undef _fastcall
  49. # define __fastcall
  50. # define _fastcall
  51. #endif // !defined(PAL_STDCPP_COMPAT) || defined(__arm__)
  52. #endif // !defined(__i386__)
  53. #define CALLBACK __stdcall
  54. #if !defined(_declspec)
  55. #define _declspec(e) __declspec(e)
  56. #endif
  57. #if defined(_VAC_) && defined(__cplusplus)
  58. #define __inline inline
  59. #endif
  60. #define PALIMPORT
  61. #define PAL_NORETURN __attribute__((noreturn))
  62. #define PALAPI __stdcall
  63. #define PALAPIV __cdecl
  64. ////////////////////////////////////////////////////////////////////////
  65. // Type attribute stuff
  66. ////////////////////////////////////////////////////////////////////////
  67. #define CONST const
  68. #define IN
  69. #define OUT
  70. #define OPTIONAL
  71. #define FAR
  72. #ifdef UNICODE
  73. #define __TEXT(x) L##x
  74. #else
  75. #define __TEXT(x) x
  76. #endif
  77. #define TEXT(x) __TEXT(x)
  78. ////////////////////////////////////////////////////////////////////////
  79. // Some special values
  80. ////////////////////////////////////////////////////////////////////////
  81. #ifndef TRUE
  82. #define TRUE 1
  83. #endif
  84. #ifndef FALSE
  85. #define FALSE 0
  86. #endif
  87. ////////////////////////////////////////////////////////////////////////
  88. // Misc. type helpers
  89. ////////////////////////////////////////////////////////////////////////
  90. // GCC's way of declaring large integer constants
  91. // If you define these in one step, without the _HELPER macros, you
  92. // get extra whitespace when composing these with other concatenating macros.
  93. #define I64_HELPER(x) x ## LL
  94. #define I64(x) I64_HELPER(x)
  95. #define UI64_HELPER(x) x ## ULL
  96. #define UI64(x) UI64_HELPER(x)
  97. ////////////////////////////////////////////////////////////////////////
  98. // Misc. types
  99. ////////////////////////////////////////////////////////////////////////
  100. // A bunch of source files (e.g. most of the ndp tree) include pal.h
  101. // but are written to be LLP64, not LP64. (LP64 => long = 64 bits
  102. // LLP64 => longs = 32 bits, long long = 64 bits)
  103. //
  104. // To handle this difference, we #define long to be int (and thus 32 bits) when
  105. // compiling those files. (See the bottom of this file or search for
  106. // #define long to see where we do this.)
  107. //
  108. // But this fix is more complicated than it seems, because we also use the
  109. // preprocessor to #define __int64 to long for LP64 architectures (__int64
  110. // isn't a builtin in gcc). We don't want __int64 to be an int (by cascading
  111. // macro rules). So we play this little trick below where we add
  112. // __cppmungestrip before "long", which is what we're really #defining __int64
  113. // to. The preprocessor sees __cppmungestriplong as something different than
  114. // long, so it doesn't replace it with int. The during the cppmunge phase, we
  115. // remove the __cppmungestrip part, leaving long for the compiler to see.
  116. //
  117. // Note that we can't just use a typedef to define __int64 as long before
  118. // #defining long because typedefed types can't be signedness-agnostic (i.e.
  119. // they must be either signed or unsigned) and we want to be able to use
  120. // __int64 as though it were intrinsic
  121. #ifdef BIT64
  122. #define __int64 long
  123. #else // BIT64
  124. #define __int64 long long
  125. #endif // BIT64
  126. #define __int32 int
  127. #define __int16 short int
  128. #define __int8 char // assumes char is signed
  129. #ifndef _LIBSAFECRT_SGX_CONFIG
  130. #ifndef PAL_STDCPP_COMPAT
  131. // Defined in gnu's types.h. For non PAL_IMPLEMENTATION system
  132. // includes are not included, so we need to define them.
  133. // Types below are already defined by stdint.h on __APPLE__.
  134. #if !defined(PAL_IMPLEMENTATION) && !defined(__APPLE__)
  135. typedef __int64 int64_t;
  136. typedef unsigned __int64 uint64_t;
  137. typedef __int32 int32_t;
  138. typedef unsigned __int32 uint32_t;
  139. typedef __int16 int16_t;
  140. typedef unsigned __int16 uint16_t;
  141. typedef __int8 int8_t;
  142. #define __int8_t_defined
  143. typedef unsigned __int8 uint8_t;
  144. #endif // PAL_IMPLEMENTATION
  145. #if _WIN64
  146. typedef long double LONG_DOUBLE;
  147. #endif
  148. #endif // !PAL_STDCPP_COMPAT
  149. #endif
  150. typedef void VOID;
  151. #ifndef PLATFORM_UNIX
  152. typedef long LONG;
  153. typedef unsigned long ULONG;
  154. #else
  155. typedef int LONG; // NOTE: diff from windows.h, for LP64 compat
  156. typedef unsigned int ULONG; // NOTE: diff from windows.h, for LP64 compat
  157. #endif
  158. typedef __int64 LONGLONG;
  159. typedef unsigned __int64 ULONGLONG;
  160. typedef ULONGLONG DWORD64;
  161. typedef DWORD64 *PDWORD64;
  162. typedef LONGLONG *PLONG64;
  163. typedef ULONGLONG *PULONG64;
  164. typedef ULONGLONG *PULONGLONG;
  165. typedef ULONG *PULONG;
  166. typedef short SHORT;
  167. typedef SHORT *PSHORT;
  168. typedef unsigned short USHORT;
  169. typedef USHORT *PUSHORT;
  170. typedef unsigned char UCHAR;
  171. typedef UCHAR *PUCHAR;
  172. typedef char *PSZ;
  173. typedef ULONGLONG DWORDLONG;
  174. #ifndef PLATFORM_UNIX
  175. typedef unsigned long DWORD;
  176. #else
  177. typedef unsigned int DWORD; // NOTE: diff from windows.h, for LP64 compat
  178. #endif
  179. typedef unsigned int DWORD32, *PDWORD32;
  180. typedef int BOOL;
  181. typedef unsigned char BYTE;
  182. typedef unsigned short WORD;
  183. typedef float FLOAT;
  184. typedef double DOUBLE;
  185. typedef BOOL *PBOOL;
  186. typedef BOOL *LPBOOL;
  187. typedef BYTE *PBYTE;
  188. typedef BYTE *LPBYTE;
  189. typedef const BYTE *LPCBYTE;
  190. typedef int *PINT;
  191. typedef int *LPINT;
  192. typedef WORD *PWORD;
  193. typedef WORD *LPWORD;
  194. typedef LONG *LPLONG;
  195. typedef LPLONG PLONG;
  196. typedef DWORD *PDWORD;
  197. typedef DWORD *LPDWORD;
  198. typedef void *PVOID;
  199. typedef void *LPVOID;
  200. typedef CONST void *LPCVOID;
  201. typedef int INT;
  202. typedef unsigned int UINT;
  203. typedef unsigned int *PUINT;
  204. typedef BYTE BOOLEAN;
  205. typedef BOOLEAN *PBOOLEAN;
  206. typedef unsigned __int8 UINT8;
  207. typedef signed __int8 INT8;
  208. typedef unsigned __int16 UINT16;
  209. typedef signed __int16 INT16;
  210. typedef unsigned __int32 UINT32, *PUINT32;
  211. typedef signed __int32 INT32, *PINT32;
  212. typedef unsigned __int64 UINT64, *PUINT64;
  213. typedef signed __int64 INT64, *PINT64;
  214. typedef unsigned __int32 ULONG32, *PULONG32;
  215. typedef signed __int32 LONG32, *PLONG32;
  216. typedef unsigned __int64 ULONG64;
  217. typedef signed __int64 LONG64;
  218. #define _W64
  219. #ifdef BIT64
  220. #define _atoi64 (__int64)atoll
  221. typedef __int64 INT_PTR, *PINT_PTR;
  222. typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
  223. typedef __int64 LONG_PTR, *PLONG_PTR;
  224. typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
  225. typedef unsigned __int64 DWORD_PTR, *PDWORD_PTR;
  226. /* maximum signed 64 bit value */
  227. #define LONG_PTR_MAX I64(9223372036854775807)
  228. /* maximum unsigned 64 bit value */
  229. #define ULONG_PTR_MAX UI64(0xffffffffffffffff)
  230. #ifndef SIZE_MAX
  231. #define SIZE_MAX _UI64_MAX
  232. #endif
  233. #define __int3264 __int64
  234. #if !defined(BIT64)
  235. __inline
  236. unsigned long
  237. HandleToULong(
  238. const void *h
  239. )
  240. {
  241. return((unsigned long) (ULONG_PTR) h );
  242. }
  243. __inline
  244. long
  245. HandleToLong(
  246. const void *h
  247. )
  248. {
  249. return((long) (LONG_PTR) h );
  250. }
  251. __inline
  252. void *
  253. ULongToHandle(
  254. const unsigned long h
  255. )
  256. {
  257. return((void *) (UINT_PTR) h );
  258. }
  259. __inline
  260. void *
  261. LongToHandle(
  262. const long h
  263. )
  264. {
  265. return((void *) (INT_PTR) h );
  266. }
  267. __inline
  268. unsigned long
  269. PtrToUlong(
  270. const void *p
  271. )
  272. {
  273. return((unsigned long) (ULONG_PTR) p );
  274. }
  275. __inline
  276. unsigned int
  277. PtrToUint(
  278. const void *p
  279. )
  280. {
  281. return((unsigned int) (UINT_PTR) p );
  282. }
  283. __inline
  284. unsigned short
  285. PtrToUshort(
  286. const void *p
  287. )
  288. {
  289. return((unsigned short) (unsigned long) (ULONG_PTR) p );
  290. }
  291. __inline
  292. long
  293. PtrToLong(
  294. const void *p
  295. )
  296. {
  297. return((long) (LONG_PTR) p );
  298. }
  299. __inline
  300. int
  301. PtrToInt(
  302. const void *p
  303. )
  304. {
  305. return((int) (INT_PTR) p );
  306. }
  307. __inline
  308. short
  309. PtrToShort(
  310. const void *p
  311. )
  312. {
  313. return((short) (long) (LONG_PTR) p );
  314. }
  315. __inline
  316. void *
  317. IntToPtr(
  318. const int i
  319. )
  320. // Caution: IntToPtr() sign-extends the int value.
  321. {
  322. return( (void *)(INT_PTR)i );
  323. }
  324. __inline
  325. void *
  326. UIntToPtr(
  327. const unsigned int ui
  328. )
  329. // Caution: UIntToPtr() zero-extends the unsigned int value.
  330. {
  331. return( (void *)(UINT_PTR)ui );
  332. }
  333. __inline
  334. void *
  335. LongToPtr(
  336. const long l
  337. )
  338. // Caution: LongToPtr() sign-extends the long value.
  339. {
  340. return( (void *)(LONG_PTR)l );
  341. }
  342. __inline
  343. void *
  344. ULongToPtr(
  345. const unsigned long ul
  346. )
  347. // Caution: ULongToPtr() zero-extends the unsigned long value.
  348. {
  349. return( (void *)(ULONG_PTR)ul );
  350. }
  351. __inline
  352. void *
  353. ShortToPtr(
  354. const short s
  355. )
  356. // Caution: ShortToPtr() sign-extends the short value.
  357. {
  358. return( (void *)(INT_PTR)s );
  359. }
  360. __inline
  361. void *
  362. UShortToPtr(
  363. const unsigned short us
  364. )
  365. // Caution: UShortToPtr() zero-extends the unsigned short value.
  366. {
  367. return( (void *)(UINT_PTR)us );
  368. }
  369. #else // !defined(BIT64)
  370. #define HandleToULong( h ) ((ULONG)(ULONG_PTR)(h) )
  371. #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) )
  372. #define ULongToHandle( ul ) ((HANDLE)(ULONG_PTR) (ul) )
  373. #define LongToHandle( h ) ((HANDLE)(LONG_PTR) (h) )
  374. #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) )
  375. #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) )
  376. #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) )
  377. #define PtrToInt( p ) ((INT)(INT_PTR) (p) )
  378. #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) )
  379. #define PtrToShort( p ) ((short)(LONG_PTR)(p) )
  380. #define IntToPtr( i ) ((VOID *)(INT_PTR)((int)(i)))
  381. #define UIntToPtr( ui ) ((VOID *)(UINT_PTR)((unsigned int)(ui)))
  382. #define LongToPtr( l ) ((VOID *)(LONG_PTR)((long)(l)))
  383. #define ULongToPtr( ul ) ((VOID *)(ULONG_PTR)((unsigned long)(ul)))
  384. #define ShortToPtr( s ) ((VOID *)(INT_PTR)((short)(s)))
  385. #define UShortToPtr( us ) ((VOID *)(UINT_PTR)((unsigned short)(s)))
  386. #endif // !defined(BIT64)
  387. #else
  388. typedef _W64 __int32 INT_PTR;
  389. typedef _W64 unsigned __int32 UINT_PTR;
  390. typedef _W64 __int32 LONG_PTR;
  391. typedef _W64 unsigned __int32 ULONG_PTR, *PULONG_PTR;
  392. typedef _W64 unsigned __int32 DWORD_PTR, *PDWORD_PTR;
  393. /* maximum signed 32 bit value */
  394. #define LONG_PTR_MAX 2147483647L
  395. /* maximum unsigned 32 bit value */
  396. #define ULONG_PTR_MAX 0xffffffffUL
  397. #define SIZE_MAX UINT_MAX
  398. #define __int3264 __int32
  399. #define HandleToULong( h ) ((ULONG)(ULONG_PTR)(h) )
  400. #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) )
  401. #define ULongToHandle( ul ) ((HANDLE)(ULONG_PTR) (ul) )
  402. #define LongToHandle( h ) ((HANDLE)(LONG_PTR) (h) )
  403. #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) )
  404. #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) )
  405. #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) )
  406. #define PtrToInt( p ) ((INT)(INT_PTR) (p) )
  407. #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) )
  408. #define PtrToShort( p ) ((short)(LONG_PTR)(p) )
  409. #define IntToPtr( i ) ((VOID *)(INT_PTR)((int)i))
  410. #define UIntToPtr( ui ) ((VOID *)(UINT_PTR)((unsigned int)ui))
  411. #define LongToPtr( l ) ((VOID *)(LONG_PTR)((long)l))
  412. #define ULongToPtr( ul ) ((VOID *)(ULONG_PTR)((unsigned long)ul))
  413. #define ShortToPtr( s ) ((VOID *)(INT_PTR)((short)s))
  414. #define UShortToPtr( us ) ((VOID *)(UINT_PTR)((unsigned short)s))
  415. #endif
  416. #define HandleToUlong(h) HandleToULong(h)
  417. #define UlongToHandle(ul) ULongToHandle(ul)
  418. #define UlongToPtr(ul) ULongToPtr(ul)
  419. #define UintToPtr(ui) UIntToPtr(ui)
  420. typedef ULONG_PTR SIZE_T, *PSIZE_T;
  421. typedef LONG_PTR SSIZE_T, *PSSIZE_T;
  422. #ifndef SIZE_T_MAX
  423. #define SIZE_T_MAX ULONG_PTR_MAX
  424. #endif // SIZE_T_MAX
  425. #ifndef SSIZE_T_MAX
  426. #define SSIZE_T_MAX LONG_PTR_MAX
  427. #endif
  428. #ifndef SSIZE_T_MIN
  429. #define SSIZE_T_MIN I64(-9223372036854775808)
  430. #endif
  431. #ifndef _LIBSAFECRT_SGX_CONFIG
  432. #ifndef PAL_STDCPP_COMPAT
  433. #if defined(__APPLE__) || defined(__LINUX__)
  434. #ifdef BIT64
  435. typedef unsigned long size_t;
  436. typedef long ptrdiff_t;
  437. #else // !BIT64
  438. typedef unsigned int size_t;
  439. typedef int ptrdiff_t;
  440. #endif // !BIT64
  441. #else
  442. typedef ULONG_PTR size_t;
  443. typedef LONG_PTR ptrdiff_t;
  444. #endif
  445. #endif // !PAL_STDCPP_COMPAT
  446. #define _SIZE_T_DEFINED
  447. typedef LONG_PTR LPARAM;
  448. #define _PTRDIFF_T_DEFINED
  449. #ifdef _MINGW_
  450. // We need to define _PTRDIFF_T to make sure ptrdiff_t doesn't get defined
  451. // again by system headers - but only for MinGW.
  452. #define _PTRDIFF_T
  453. #endif
  454. #endif
  455. #ifndef _LIBSAFECRT_SGX_CONFIG
  456. #if !defined(__cplusplus)
  457. #include <wchar.h>
  458. typedef wchar_t char16_t;
  459. #endif // __cplusplus
  460. typedef char16_t char16;
  461. typedef char16_t WCHAR;
  462. #ifdef PAL_STDCPP_COMPAT
  463. #ifdef __APPLE__
  464. static_assert(sizeof(unsigned long) == sizeof(void*), "This platform is not supported");
  465. #else
  466. #ifdef BIT64
  467. typedef unsigned long int uintptr_t;
  468. #else // !BIT64
  469. typedef unsigned int uintptr_t;
  470. #endif // !BIT64
  471. #endif
  472. #else // !PAL_STDCPP_COMPAT
  473. #if defined(__LINUX__)
  474. #ifdef BIT64
  475. typedef long int intptr_t;
  476. typedef unsigned long int uintptr_t;
  477. #else // !BIT64
  478. typedef int intptr_t;
  479. typedef unsigned int uintptr_t;
  480. #endif // !BIT64
  481. #else
  482. typedef INT_PTR intptr_t;
  483. typedef UINT_PTR uintptr_t;
  484. #endif
  485. #endif // PAL_STDCPP_COMPAT
  486. #define _INTPTR_T_DEFINED
  487. #define _UINTPTR_T_DEFINED
  488. #else
  489. #include "mbusafecrt.h"
  490. #if !defined(__cplusplus)
  491. typedef wchar_t char16_t;
  492. #endif // __cplusplus
  493. #endif
  494. typedef DWORD LCID;
  495. typedef PDWORD PLCID;
  496. typedef WORD LANGID;
  497. typedef DWORD LCTYPE;
  498. typedef WCHAR *PWCHAR;
  499. typedef WCHAR *LPWCH, *PWCH;
  500. typedef CONST WCHAR *LPCWCH, *PCWCH;
  501. typedef WCHAR *NWPSTR;
  502. typedef WCHAR *LPWSTR, *PWSTR;
  503. typedef CONST WCHAR *LPCWSTR, *PCWSTR;
  504. typedef char CHAR;
  505. typedef CHAR *PCHAR;
  506. typedef CHAR *LPCH, *PCH;
  507. typedef CONST CHAR *LPCCH, *PCCH;
  508. typedef CHAR *NPSTR;
  509. typedef CHAR *LPSTR, *PSTR;
  510. typedef CONST CHAR *LPCSTR, *PCSTR;
  511. #ifdef UNICODE
  512. typedef WCHAR TCHAR;
  513. typedef WCHAR _TCHAR;
  514. #else
  515. typedef CHAR TCHAR;
  516. typedef CHAR _TCHAR;
  517. #endif
  518. typedef TCHAR *PTCHAR;
  519. typedef TCHAR *LPTSTR, *PTSTR;
  520. typedef CONST TCHAR *LPCTSTR;
  521. #define MAKEWORD(a, b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8))
  522. #define MAKELONG(a, b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16))
  523. #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff))
  524. #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
  525. #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff))
  526. #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
  527. typedef VOID *HANDLE;
  528. typedef HANDLE HWND;
  529. typedef struct __PAL_RemoteHandle__ { HANDLE h; } *RHANDLE;
  530. typedef HANDLE *PHANDLE;
  531. typedef HANDLE *LPHANDLE;
  532. #define INVALID_HANDLE_VALUE ((VOID *)(-1))
  533. #define INVALID_FILE_SIZE ((DWORD)0xFFFFFFFF)
  534. #define INVALID_FILE_ATTRIBUTES ((DWORD) -1)
  535. typedef HANDLE HMODULE;
  536. typedef HANDLE HINSTANCE;
  537. typedef HANDLE HGLOBAL;
  538. typedef HANDLE HLOCAL;
  539. typedef HANDLE HRSRC;
  540. typedef LONG HRESULT;
  541. typedef LONG NTSTATUS;
  542. typedef union _LARGE_INTEGER {
  543. struct {
  544. #if BIGENDIAN
  545. LONG HighPart;
  546. DWORD LowPart;
  547. #else
  548. DWORD LowPart;
  549. LONG HighPart;
  550. #endif
  551. };
  552. struct {
  553. #if BIGENDIAN
  554. LONG HighPart;
  555. DWORD LowPart;
  556. #else
  557. DWORD LowPart;
  558. LONG HighPart;
  559. #endif
  560. } u;
  561. LONGLONG QuadPart;
  562. } LARGE_INTEGER, *PLARGE_INTEGER;
  563. #ifndef GUID_DEFINED
  564. typedef struct _GUID {
  565. ULONG Data1; // NOTE: diff from Win32, for LP64
  566. USHORT Data2;
  567. USHORT Data3;
  568. UCHAR Data4[ 8 ];
  569. } GUID;
  570. typedef const GUID *LPCGUID;
  571. #define GUID_DEFINED
  572. #endif // !GUID_DEFINED
  573. typedef struct _FILETIME {
  574. DWORD dwLowDateTime;
  575. DWORD dwHighDateTime;
  576. } FILETIME, *PFILETIME, *LPFILETIME;
  577. /* Code Page Default Values */
  578. #define CP_ACP 0 /* default to ANSI code page */
  579. #define CP_OEMCP 1 /* default to OEM code page */
  580. #define CP_MACCP 2 /* default to MAC code page */
  581. #define CP_THREAD_ACP 3 /* current thread's ANSI code page */
  582. #define CP_WINUNICODE 1200
  583. #define CP_UNICODE 1200 /* Unicode */
  584. #define CP_UNICODESWAP 1201 /* Unicode Big-Endian */
  585. #define CP_UTF7 65000 /* UTF-7 translation */
  586. #define CP_UTF8 65001 /* UTF-8 translation */
  587. typedef PVOID PSID;
  588. #ifdef __cplusplus
  589. }
  590. #endif
  591. #endif // __PAL_MSTYPES_H__