other-licenses/7zstub/src/Common/MyWindows.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial