annotate src/win32/7zip/7z/CPP/Common/MyWindows.h @ 6:458a4f18f3cd

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