Merge pull request #581 from ArvidNorr/errorcode
[platform/upstream/freerdp.git] / include / winpr / wtypes.h
1 /**
2  * WinPR: Windows Portable Runtime
3  * Windows Data Types
4  *
5  * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #ifndef WINPR_WTYPES_H
21 #define WINPR_WTYPES_H
22
23 /* MSDN: Windows Data Types - http://msdn.microsoft.com/en-us/library/aa383751/ */
24 /* [MS-DTYP]: Windows Data Types - http://msdn.microsoft.com/en-us/library/cc230273/ */
25
26 #include <wchar.h>
27 #include <winpr/windows.h>
28
29 #ifndef _WIN32
30
31 #define __int8  char
32 #define __int16 short
33 #define __int32 int
34 #define __int64 long long
35
36 #if __x86_64__
37 #define __int3264 __int64
38 #else
39 #define __int3264 __int32
40 #endif
41
42 typedef int BOOL, *PBOOL, *LPBOOL;
43 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
44 typedef BYTE BOOLEAN, *PBOOLEAN;
45 typedef wchar_t WCHAR, *PWCHAR;
46 typedef WCHAR* BSTR;
47 typedef char CHAR, *PCHAR;
48 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
49 typedef unsigned int DWORD32;
50 typedef unsigned __int64 DWORD64;
51 typedef unsigned __int64 ULONGLONG;
52 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
53 typedef float FLOAT;
54 typedef unsigned char UCHAR, *PUCHAR;
55 typedef short SHORT;
56
57 typedef void* HANDLE;
58 typedef DWORD HCALL;
59 typedef int INT, *LPINT;
60 typedef signed char INT8;
61 typedef signed short INT16;
62 typedef signed int INT32;
63 typedef signed __int64 INT64;
64 typedef const wchar_t* LMCSTR;
65 typedef WCHAR* LMSTR;
66 typedef long LONG, *PLONG, *LPLONG;
67 typedef signed __int64 LONGLONG;
68 typedef LONG HRESULT;
69
70 typedef __int3264 LONG_PTR;
71 typedef unsigned __int3264 ULONG_PTR;
72
73 typedef signed int LONG32;
74 typedef signed __int64 LONG64;
75 typedef const char* LPCSTR;
76
77 typedef const wchar_t* LPCWSTR;
78 typedef char* PSTR, *LPSTR;
79
80 typedef wchar_t* LPWSTR, *PWSTR;
81 typedef long NTSTATUS;
82
83 typedef unsigned __int64 QWORD;
84 typedef UCHAR* STRING;
85
86 typedef unsigned int UINT;
87 typedef unsigned char UINT8;
88 typedef unsigned short UINT16;
89 typedef unsigned int UINT32;
90 typedef unsigned __int64 UINT64;
91 typedef unsigned long ULONG, *PULONG;
92
93 typedef ULONG_PTR DWORD_PTR;
94 typedef ULONG_PTR SIZE_T;
95 typedef unsigned int ULONG32;
96 typedef unsigned __int64 ULONG64;
97 typedef wchar_t UNICODE;
98 typedef unsigned short USHORT;
99 typedef void VOID, *PVOID, *LPVOID;
100 typedef const void *LPCVOID;
101 typedef unsigned short WORD, *PWORD, *LPWORD;
102
103 #if __x86_64__
104 typedef __int64 INT_PTR;
105 typedef unsigned __int64 UINT_PTR;
106 #else
107 typedef int INT_PTR;
108 typedef unsigned int UINT_PTR;
109 #endif
110
111 typedef struct _GUID
112 {
113         unsigned long Data1;
114         unsigned short Data2;
115         unsigned short Data3;
116         BYTE Data4[8];
117 } GUID, UUID, *PGUID;
118
119 #ifdef UNICODE
120 #define _T(x)   L ## x
121 #else
122 #define _T(x)   x
123 #endif
124
125 #ifdef UNICODE
126 typedef LPWSTR LPTSTR;
127 typedef LPCWSTR LPCTSTR;
128 #else
129 typedef LPSTR LPTSTR;
130 typedef LPCSTR LPCTSTR;
131 #endif
132
133 typedef struct _FILETIME
134 {
135         DWORD dwLowDateTime;
136         DWORD dwHighDateTime;
137 } FILETIME, *PFILETIME, *LPFILETIME;
138
139 typedef struct _RPC_SID_IDENTIFIER_AUTHORITY
140 {
141         BYTE Value[6];
142 } RPC_SID_IDENTIFIER_AUTHORITY;
143
144 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
145
146 typedef struct _RPC_SID
147 {
148         unsigned char Revision;
149         unsigned char SubAuthorityCount;
150         RPC_SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
151         unsigned long SubAuthority[];
152 } RPC_SID, *PRPC_SID, *PSID;
153
154 typedef struct _ACL
155 {
156         unsigned char AclRevision;
157         unsigned char Sbz1;
158         unsigned short AclSize;
159         unsigned short AceCount;
160         unsigned short Sbz2;
161 } ACL, *PACL;
162
163 typedef struct _SECURITY_DESCRIPTOR
164 {
165         UCHAR Revision;
166         UCHAR Sbz1;
167         USHORT Control;
168         PSID Owner;
169         PSID Group;
170         PACL Sacl;
171         PACL Dacl;
172 } SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
173
174 #endif
175
176 typedef BYTE byte;
177 typedef double DOUBLE;
178
179 typedef void* PCONTEXT_HANDLE;
180 typedef PCONTEXT_HANDLE* PPCONTEXT_HANDLE;
181
182 typedef unsigned long error_status_t;
183
184 #endif /* WINPR_WTYPES_H */