view src/win32/7zip/7z/CPP/Common/MyWindows.h @ 3:b05d00f19d80

fix some formatting
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:33:11 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 // MyWindows.h
3 #ifndef __MYWINDOWS_H
4 #define __MYWINDOWS_H
6 #ifdef _WIN32
8 #include <windows.h>
10 #define CHAR_PATH_SEPARATOR '\\'
11 #define WCHAR_PATH_SEPARATOR L'\\'
12 #define STRING_PATH_SEPARATOR "\\"
13 #define WSTRING_PATH_SEPARATOR L"\\"
15 #else
17 #define CHAR_PATH_SEPARATOR '/'
18 #define WCHAR_PATH_SEPARATOR L'/'
19 #define STRING_PATH_SEPARATOR "/"
20 #define WSTRING_PATH_SEPARATOR L"/"
22 #include <stddef.h> // for wchar_t
23 #include <string.h>
25 #include "MyGuidDef.h"
27 typedef char CHAR;
28 typedef unsigned char UCHAR;
30 #undef BYTE
31 typedef unsigned char BYTE;
33 typedef short SHORT;
34 typedef unsigned short USHORT;
36 #undef WORD
37 typedef unsigned short WORD;
38 typedef short VARIANT_BOOL;
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;
47 #undef DWORD
48 typedef UINT32 DWORD;
50 typedef Int64 LONGLONG;
51 typedef UInt64 ULONGLONG;
53 typedef struct LARGE_INTEGER { LONGLONG QuadPart; }LARGE_INTEGER;
54 typedef struct _ULARGE_INTEGER { ULONGLONG QuadPart;} ULARGE_INTEGER;
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;
66 typedef struct _FILETIME
67 {
68 DWORD dwLowDateTime;
69 DWORD dwHighDateTime;
70 }FILETIME;
72 #define HRESULT LONG
73 #define FAILED(Status) ((HRESULT)(Status)<0)
74 typedef ULONG PROPID;
75 typedef LONG SCODE;
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)
87 #ifdef _MSC_VER
88 #define STDMETHODCALLTYPE __stdcall
89 #else
90 #define STDMETHODCALLTYPE
91 #endif
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)
98 #define PURE = 0
100 #define MIDL_INTERFACE(x) struct
102 #ifdef __cplusplus
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 };
116 typedef IUnknown *LPUNKNOWN;
118 #endif
120 #define VARIANT_TRUE ((VARIANT_BOOL)-1)
121 #define VARIANT_FALSE ((VARIANT_BOOL)0)
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 };
153 typedef unsigned short VARTYPE;
154 typedef WORD PROPVAR_PAD1;
155 typedef WORD PROPVAR_PAD2;
156 typedef WORD PROPVAR_PAD3;
158 #ifdef __cplusplus
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;
185 typedef PROPVARIANT tagVARIANT;
186 typedef tagVARIANT VARIANT;
187 typedef VARIANT VARIANTARG;
189 MY_EXTERN_C HRESULT VariantClear(VARIANTARG *prop);
190 MY_EXTERN_C HRESULT VariantCopy(VARIANTARG *dest, VARIANTARG *src);
192 #endif
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);
200 MY_EXTERN_C DWORD GetLastError();
201 MY_EXTERN_C LONG CompareFileTime(const FILETIME* ft1, const FILETIME* ft2);
203 #define CP_ACP 0
204 #define CP_OEMCP 1
206 typedef enum tagSTREAM_SEEK
207 {
208 STREAM_SEEK_SET = 0,
209 STREAM_SEEK_CUR = 1,
210 STREAM_SEEK_END = 2
211 } STREAM_SEEK;
213 #endif
214 #endif