Mercurial > vba-clojure
comparison src/win32/7zip/7z/CPP/Common/MyWindows.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:8ced16adf2e1 | 1:f9f4f1b99eed |
---|---|
1 // MyWindows.h | |
2 | |
3 #ifndef __MYWINDOWS_H | |
4 #define __MYWINDOWS_H | |
5 | |
6 #ifdef _WIN32 | |
7 | |
8 #include <windows.h> | |
9 | |
10 #define CHAR_PATH_SEPARATOR '\\' | |
11 #define WCHAR_PATH_SEPARATOR L'\\' | |
12 #define STRING_PATH_SEPARATOR "\\" | |
13 #define WSTRING_PATH_SEPARATOR L"\\" | |
14 | |
15 #else | |
16 | |
17 #define CHAR_PATH_SEPARATOR '/' | |
18 #define WCHAR_PATH_SEPARATOR L'/' | |
19 #define STRING_PATH_SEPARATOR "/" | |
20 #define WSTRING_PATH_SEPARATOR L"/" | |
21 | |
22 #include <stddef.h> // for wchar_t | |
23 #include <string.h> | |
24 | |
25 #include "MyGuidDef.h" | |
26 | |
27 typedef char CHAR; | |
28 typedef unsigned char UCHAR; | |
29 | |
30 #undef BYTE | |
31 typedef unsigned char BYTE; | |
32 | |
33 typedef short SHORT; | |
34 typedef unsigned short USHORT; | |
35 | |
36 #undef WORD | |
37 typedef unsigned short WORD; | |
38 typedef short VARIANT_BOOL; | |
39 | |
40 typedef int INT; | |
41 typedef Int32 INT32; | |
42 typedef unsigned int UINT; | |
43 typedef UInt32 UINT32; | |
44 typedef INT32 LONG; // LONG, ULONG and DWORD must be 32-bit | |
45 typedef UINT32 ULONG; | |
46 | |
47 #undef DWORD | |
48 typedef UINT32 DWORD; | |
49 | |
50 typedef Int64 LONGLONG; | |
51 typedef UInt64 ULONGLONG; | |
52 | |
53 typedef struct LARGE_INTEGER { LONGLONG QuadPart; }LARGE_INTEGER; | |
54 typedef struct _ULARGE_INTEGER { ULONGLONG QuadPart;} ULARGE_INTEGER; | |
55 | |
56 typedef const CHAR *LPCSTR; | |
57 typedef CHAR TCHAR; | |
58 typedef const TCHAR *LPCTSTR; | |
59 typedef wchar_t WCHAR; | |
60 typedef WCHAR OLECHAR; | |
61 typedef const WCHAR *LPCWSTR; | |
62 typedef OLECHAR *BSTR; | |
63 typedef const OLECHAR *LPCOLESTR; | |
64 typedef OLECHAR *LPOLESTR; | |
65 | |
66 typedef struct _FILETIME | |
67 { | |
68 DWORD dwLowDateTime; | |
69 DWORD dwHighDateTime; | |
70 }FILETIME; | |
71 | |
72 #define HRESULT LONG | |
73 #define FAILED(Status) ((HRESULT)(Status)<0) | |
74 typedef ULONG PROPID; | |
75 typedef LONG SCODE; | |
76 | |
77 #define S_OK ((HRESULT)0x00000000L) | |
78 #define S_FALSE ((HRESULT)0x00000001L) | |
79 #define E_NOTIMPL ((HRESULT)0x80004001L) | |
80 #define E_NOINTERFACE ((HRESULT)0x80004002L) | |
81 #define E_ABORT ((HRESULT)0x80004004L) | |
82 #define E_FAIL ((HRESULT)0x80004005L) | |
83 #define STG_E_INVALIDFUNCTION ((HRESULT)0x80030001L) | |
84 #define E_OUTOFMEMORY ((HRESULT)0x8007000EL) | |
85 #define E_INVALIDARG ((HRESULT)0x80070057L) | |
86 | |
87 #ifdef _MSC_VER | |
88 #define STDMETHODCALLTYPE __stdcall | |
89 #else | |
90 #define STDMETHODCALLTYPE | |
91 #endif | |
92 | |
93 #define STDMETHOD_(t, f) virtual t STDMETHODCALLTYPE f | |
94 #define STDMETHOD(f) STDMETHOD_(HRESULT, f) | |
95 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE | |
96 #define STDMETHODIMP STDMETHODIMP_(HRESULT) | |
97 | |
98 #define PURE = 0 | |
99 | |
100 #define MIDL_INTERFACE(x) struct | |
101 | |
102 #ifdef __cplusplus | |
103 | |
104 DEFINE_GUID(IID_IUnknown, | |
105 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); | |
106 struct IUnknown | |
107 { | |
108 STDMETHOD(QueryInterface) (REFIID iid, void **outObject) PURE; | |
109 STDMETHOD_(ULONG, AddRef)() PURE; | |
110 STDMETHOD_(ULONG, Release)() PURE; | |
111 #ifndef _WIN32 | |
112 virtual ~IUnknown() {} | |
113 #endif | |
114 }; | |
115 | |
116 typedef IUnknown *LPUNKNOWN; | |
117 | |
118 #endif | |
119 | |
120 #define VARIANT_TRUE ((VARIANT_BOOL)-1) | |
121 #define VARIANT_FALSE ((VARIANT_BOOL)0) | |
122 | |
123 enum VARENUM | |
124 { | |
125 VT_EMPTY = 0, | |
126 VT_NULL = 1, | |
127 VT_I2 = 2, | |
128 VT_I4 = 3, | |
129 VT_R4 = 4, | |
130 VT_R8 = 5, | |
131 VT_CY = 6, | |
132 VT_DATE = 7, | |
133 VT_BSTR = 8, | |
134 VT_DISPATCH = 9, | |
135 VT_ERROR = 10, | |
136 VT_BOOL = 11, | |
137 VT_VARIANT = 12, | |
138 VT_UNKNOWN = 13, | |
139 VT_DECIMAL = 14, | |
140 VT_I1 = 16, | |
141 VT_UI1 = 17, | |
142 VT_UI2 = 18, | |
143 VT_UI4 = 19, | |
144 VT_I8 = 20, | |
145 VT_UI8 = 21, | |
146 VT_INT = 22, | |
147 VT_UINT = 23, | |
148 VT_VOID = 24, | |
149 VT_HRESULT = 25, | |
150 VT_FILETIME = 64 | |
151 }; | |
152 | |
153 typedef unsigned short VARTYPE; | |
154 typedef WORD PROPVAR_PAD1; | |
155 typedef WORD PROPVAR_PAD2; | |
156 typedef WORD PROPVAR_PAD3; | |
157 | |
158 #ifdef __cplusplus | |
159 | |
160 typedef struct tagPROPVARIANT | |
161 { | |
162 VARTYPE vt; | |
163 PROPVAR_PAD1 wReserved1; | |
164 PROPVAR_PAD2 wReserved2; | |
165 PROPVAR_PAD3 wReserved3; | |
166 union | |
167 { | |
168 CHAR cVal; | |
169 UCHAR bVal; | |
170 SHORT iVal; | |
171 USHORT uiVal; | |
172 LONG lVal; | |
173 ULONG ulVal; | |
174 INT intVal; | |
175 UINT uintVal; | |
176 LARGE_INTEGER hVal; | |
177 ULARGE_INTEGER uhVal; | |
178 VARIANT_BOOL boolVal; | |
179 SCODE scode; | |
180 FILETIME filetime; | |
181 BSTR bstrVal; | |
182 }; | |
183 } PROPVARIANT; | |
184 | |
185 typedef PROPVARIANT tagVARIANT; | |
186 typedef tagVARIANT VARIANT; | |
187 typedef VARIANT VARIANTARG; | |
188 | |
189 MY_EXTERN_C HRESULT VariantClear(VARIANTARG *prop); | |
190 MY_EXTERN_C HRESULT VariantCopy(VARIANTARG *dest, VARIANTARG *src); | |
191 | |
192 #endif | |
193 | |
194 MY_EXTERN_C BSTR SysAllocStringByteLen(LPCSTR psz, UINT len); | |
195 MY_EXTERN_C BSTR SysAllocString(const OLECHAR *sz); | |
196 MY_EXTERN_C void SysFreeString(BSTR bstr); | |
197 MY_EXTERN_C UINT SysStringByteLen(BSTR bstr); | |
198 MY_EXTERN_C UINT SysStringLen(BSTR bstr); | |
199 | |
200 MY_EXTERN_C DWORD GetLastError(); | |
201 MY_EXTERN_C LONG CompareFileTime(const FILETIME* ft1, const FILETIME* ft2); | |
202 | |
203 #define CP_ACP 0 | |
204 #define CP_OEMCP 1 | |
205 | |
206 typedef enum tagSTREAM_SEEK | |
207 { | |
208 STREAM_SEEK_SET = 0, | |
209 STREAM_SEEK_CUR = 1, | |
210 STREAM_SEEK_END = 2 | |
211 } STREAM_SEEK; | |
212 | |
213 #endif | |
214 #endif |