Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

284 lines
6.0 KiB

  1. #ifndef _BLDR_KERNEL_DEFS
  2. #define _BLDR_KERNEL_DEFS
  3. #pragma warning(disable:4005)
  4. #define SEC_FAR
  5. #define FAR
  6. #define CONST const
  7. #define __stdcall
  8. #define __far
  9. #define __pascal
  10. #define __loadds
  11. #define IN
  12. #define OUT
  13. #define NULL (0)
  14. #define OPTIONAL
  15. typedef int BOOL;
  16. typedef char CHAR;
  17. typedef unsigned char UCHAR;
  18. typedef short SHORT;
  19. typedef unsigned short USHORT;
  20. typedef long LONG;
  21. typedef unsigned long ULONG;
  22. typedef unsigned long DWORD;
  23. typedef unsigned short WCHAR;
  24. typedef void *PVOID;
  25. typedef void VOID;
  26. typedef PVOID PSID;
  27. typedef LONG HRESULT;
  28. typedef UCHAR BOOLEAN;
  29. typedef BOOLEAN *PBOOLEAN;
  30. #if 1
  31. typedef struct _LUID {
  32. ULONG LowPart;
  33. LONG HighPart;
  34. } LUID, *PLUID;
  35. #else
  36. typedef long LUID, *PLUID;
  37. #endif
  38. typedef WCHAR *PWCHAR;
  39. typedef WCHAR *LPWCH, *PWCH;
  40. typedef CONST WCHAR *LPCWCH, *PCWCH;
  41. typedef WCHAR *NWPSTR;
  42. typedef WCHAR *LPWSTR, *PWSTR;
  43. typedef CONST WCHAR *LPCWSTR, *PCWSTR;
  44. typedef CHAR *PCHAR;
  45. typedef CHAR *LPCH, *PCH;
  46. typedef CONST CHAR *LPCCH, *PCCH;
  47. typedef CHAR *NPSTR;
  48. typedef CHAR *LPSTR, *PSTR;
  49. typedef CONST CHAR *LPCSTR, *PCSTR;
  50. typedef UCHAR *PUCHAR;
  51. typedef USHORT *PUSHORT;
  52. typedef ULONG *PULONG;
  53. typedef struct _STRING {
  54. USHORT Length;
  55. USHORT MaximumLength;
  56. #ifdef MIDL_PASS
  57. [size_is(MaximumLength), length_is(Length) ]
  58. #endif // MIDL_PASS
  59. PCHAR Buffer;
  60. } STRING;
  61. typedef STRING *PSTRING;
  62. typedef STRING ANSI_STRING;
  63. typedef PSTRING PANSI_STRING;
  64. typedef struct _STRING32 {
  65. USHORT Length;
  66. USHORT MaximumLength;
  67. ULONG Buffer;
  68. } STRING32, *PSTRING32;
  69. #ifndef _FILETIME_
  70. #define _FILETIME_
  71. typedef struct _FILETIME {
  72. DWORD dwLowDateTime;
  73. DWORD dwHighDateTime;
  74. } FILETIME, *PFILETIME;
  75. #endif // _FILETIME_
  76. typedef LONG NTSTATUS;
  77. typedef unsigned __int64 ULONG64, *PULONG64;
  78. #define _fstrcmp strcmp
  79. #define _fstrcpy strcpy
  80. #define _fstrlen strlen
  81. #define _fstrncmp strncmp
  82. #define _fmemcpy memcpy
  83. #define _fmemset memset
  84. #define _fmemcmp memcmp
  85. //
  86. // Definitions needed by arc.h.
  87. //
  88. typedef struct _DEVICE_FLAGS {
  89. ULONG Failed : 1;
  90. ULONG ReadOnly : 1;
  91. ULONG Removable : 1;
  92. ULONG ConsoleIn : 1;
  93. ULONG ConsoleOut : 1;
  94. ULONG Input : 1;
  95. ULONG Output : 1;
  96. } DEVICE_FLAGS, *PDEVICE_FLAGS;
  97. typedef struct _TIME_FIELDS {
  98. short Year; // range [1601...]
  99. short Month; // range [1..12]
  100. short Day; // range [1..31]
  101. short Hour; // range [0..23]
  102. short Minute; // range [0..59]
  103. short Second; // range [0..59]
  104. short Milliseconds;// range [0..999]
  105. short Weekday; // range [0..6] == [Sunday..Saturday]
  106. } TIME_FIELDS;
  107. typedef TIME_FIELDS *PTIME_FIELDS;
  108. //
  109. // __int64 is only supported by 2.0 and later midl.
  110. // __midl is set by the 2.0 midl and not by 1.0 midl.
  111. //
  112. #define _ULONGLONG_
  113. #if (!defined (_MAC) && (!defined(MIDL_PASS) || defined(__midl)) && (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)))
  114. typedef __int64 LONGLONG;
  115. typedef unsigned __int64 ULONGLONG;
  116. #define MAXLONGLONG (0x7fffffffffffffff)
  117. #else
  118. #if defined(_MAC) && defined(_MAC_INT_64)
  119. typedef __int64 LONGLONG;
  120. typedef unsigned __int64 ULONGLONG;
  121. #define MAXLONGLONG (0x7fffffffffffffff)
  122. #else
  123. typedef double LONGLONG;
  124. typedef double ULONGLONG;
  125. #endif //_MAC and int64
  126. #endif
  127. typedef LONGLONG *PLONGLONG;
  128. typedef ULONGLONG *PULONGLONG;
  129. // Update Sequence Number
  130. typedef LONGLONG USN;
  131. #if defined(MIDL_PASS)
  132. typedef struct _LARGE_INTEGER {
  133. #else // MIDL_PASS
  134. typedef union _LARGE_INTEGER {
  135. struct {
  136. ULONG LowPart;
  137. LONG HighPart;
  138. };
  139. struct {
  140. ULONG LowPart;
  141. LONG HighPart;
  142. } u;
  143. #endif //MIDL_PASS
  144. LONGLONG QuadPart;
  145. } LARGE_INTEGER;
  146. typedef LARGE_INTEGER *PLARGE_INTEGER;
  147. #if defined(MIDL_PASS)
  148. typedef struct _ULARGE_INTEGER {
  149. #else // MIDL_PASS
  150. typedef union _ULARGE_INTEGER {
  151. struct {
  152. ULONG LowPart;
  153. ULONG HighPart;
  154. };
  155. struct {
  156. ULONG LowPart;
  157. ULONG HighPart;
  158. } u;
  159. #endif //MIDL_PASS
  160. ULONGLONG QuadPart;
  161. } ULARGE_INTEGER;
  162. typedef ULARGE_INTEGER *PULARGE_INTEGER;
  163. typedef struct _LIST_ENTRY {
  164. struct _LIST_ENTRY * volatile Flink;
  165. struct _LIST_ENTRY * volatile Blink;
  166. } LIST_ENTRY, *PLIST_ENTRY;
  167. #if defined(_AXP64_)
  168. #define KSEG0_BASE 0xffffffff80000000 // from halpaxp64.h
  169. #elif defined(_ALPHA_)
  170. #define KSEG0_BASE 0x80000000 // from halpalpha.h
  171. #endif
  172. #define POINTER_32
  173. #define FIRMWARE_PTR POINTER_32
  174. //
  175. // 16 byte aligned type for 128 bit floats
  176. //
  177. // *** TBD **** when compiler support is available:
  178. // typedef __float80 FLOAT128;
  179. // For we define a 128 bit structure and use force_align pragma to
  180. // align to 128 bits.
  181. //
  182. typedef struct _FLOAT128 {
  183. LONGLONG LowPart;
  184. LONGLONG HighPart;
  185. } FLOAT128;
  186. typedef FLOAT128 *PFLOAT128;
  187. #if defined(_M_IA64)
  188. #pragma force_align _FLOAT128 16
  189. #endif // _M_IA64
  190. #if defined(_WIN64)
  191. typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
  192. #else
  193. typedef unsigned long ULONG_PTR, *PULONG_PTR;
  194. #endif
  195. typedef unsigned char BYTE, *PBYTE;
  196. typedef ULONG_PTR KSPIN_LOCK;
  197. typedef KSPIN_LOCK *PKSPIN_LOCK;
  198. //
  199. // Interrupt Request Level (IRQL)
  200. //
  201. typedef UCHAR KIRQL;
  202. typedef KIRQL *PKIRQL;
  203. #define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
  204. //
  205. // C_ASSERT() can be used to perform many compile-time assertions:
  206. // type sizes, field offsets, etc.
  207. //
  208. // An assertion failure results in error C2118: negative subscript.
  209. //
  210. #define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
  211. #define ALIGN_WCHAR sizeof(WCHAR)
  212. // BOOL
  213. // COUNT_IS_ALIGNED(
  214. // IN DWORD Count,
  215. // IN DWORD Pow2 // undefined if this isn't a power of 2.
  216. // );
  217. //
  218. #define COUNT_IS_ALIGNED(Count,Pow2) \
  219. ( ( ( (Count) & (((Pow2)-1)) ) == 0) ? TRUE : FALSE )
  220. #include <arc.h>
  221. #endif