bbbe74d63b39d5230129f85ef425a10c3e61ed72
[reactos.git] / reactos / include / ndk / umtypes.h
1 /*++ NDK Version: 0095
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 umtypes.h
8
9 Abstract:
10
11 Type definitions for the basic native types.
12
13 Author:
14
15 Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
16
17 --*/
18
19 #if !defined(_NTDEF_) && !defined(_NTDEF_H)
20 #define _NTDEF_
21 #define _NTDEF_H
22 #undef WIN32_NO_STATUS
23 #define NTOS_MODE_USER
24
25 //
26 // Dependencies
27 //
28 #include <winioctl.h>
29 #include <ntnls.h>
30 #include <ntstatus.h>
31
32 //
33 // Compiler Definitions
34 //
35 #ifndef _MANAGED
36 #if defined(_M_IX86)
37 #define FASTCALL _fastcall
38 #else
39 #define FASTCALL
40 #endif
41 #else
42 #define FASTCALL NTAPI
43 #endif
44
45 #if !defined(_M_CEE_PURE)
46 #define NTAPI_INLINE NTAPI
47 #else
48 #define NTAPI_INLINE
49 #endif
50
51 #if !defined(_NTSYSTEM_)
52 #define NTSYSAPI DECLSPEC_IMPORT
53 #define NTSYSCALLAPI DECLSPEC_IMPORT
54 #else
55 #define NTSYSAPI
56 #if defined(_NTDLLBUILD_)
57 #define NTSYSCALLAPI
58 #else
59 #define NTSYSCALLAPI DECLSPEC_ADDRSAFE
60 #endif
61 #endif
62
63 //
64 // Native API Return Value Macros
65 //
66 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
67 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
68 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
69 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
70
71 //
72 // Limits
73 //
74 #define MINCHAR 0x80
75 #define MAXCHAR 0x7f
76 #define MINSHORT 0x8000
77 #define MAXSHORT 0x7fff
78 #define MINLONG 0x80000000
79 #define MAXLONG 0x7fffffff
80 #define MAXUCHAR 0xff
81 #define MAXUSHORT 0xffff
82 #define MAXULONG 0xffffffff
83
84 //
85 // Basic Types that aren't defined in User-Mode Headers
86 //
87 typedef CONST int CINT;
88 typedef CONST char *PCSZ;
89 typedef ULONG CLONG;
90 typedef short CSHORT;
91 typedef CSHORT *PCSHORT;
92 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
93 typedef LONG KPRIORITY;
94 typedef LONG NTSTATUS, *PNTSTATUS;
95
96 //
97 // Basic NT Types
98 //
99 #if !defined(_NTSECAPI_H) && !defined(_SUBAUTH_H)
100
101 typedef struct _UNICODE_STRING
102 {
103 USHORT Length;
104 USHORT MaximumLength;
105 PWSTR Buffer;
106 } UNICODE_STRING, *PUNICODE_STRING;
107 typedef const UNICODE_STRING* PCUNICODE_STRING;
108
109 typedef struct _STRING
110 {
111 USHORT Length;
112 USHORT MaximumLength;
113 PCHAR Buffer;
114 } STRING, *PSTRING;
115
116 typedef struct _OBJECT_ATTRIBUTES
117 {
118 ULONG Length;
119 HANDLE RootDirectory;
120 PUNICODE_STRING ObjectName;
121 ULONG Attributes;
122 PVOID SecurityDescriptor;
123 PVOID SecurityQualityOfService;
124 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
125 #endif
126
127 typedef STRING ANSI_STRING;
128 typedef PSTRING PANSI_STRING;
129 typedef STRING OEM_STRING;
130 typedef PSTRING POEM_STRING;
131 typedef CONST STRING* PCOEM_STRING;
132 typedef STRING CANSI_STRING;
133 typedef PSTRING PCANSI_STRING;
134
135 #endif