diff 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
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/7zip/7z/CPP/Common/MyWindows.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,214 @@
     1.4 +// MyWindows.h
     1.5 +
     1.6 +#ifndef __MYWINDOWS_H
     1.7 +#define __MYWINDOWS_H
     1.8 +
     1.9 +#ifdef _WIN32
    1.10 +
    1.11 +#include <windows.h>
    1.12 +
    1.13 +#define CHAR_PATH_SEPARATOR '\\'
    1.14 +#define WCHAR_PATH_SEPARATOR L'\\'
    1.15 +#define STRING_PATH_SEPARATOR "\\"
    1.16 +#define WSTRING_PATH_SEPARATOR L"\\"
    1.17 +
    1.18 +#else
    1.19 +
    1.20 +#define CHAR_PATH_SEPARATOR '/'
    1.21 +#define WCHAR_PATH_SEPARATOR L'/'
    1.22 +#define STRING_PATH_SEPARATOR "/"
    1.23 +#define WSTRING_PATH_SEPARATOR L"/"
    1.24 +
    1.25 +#include <stddef.h> // for wchar_t
    1.26 +#include <string.h>
    1.27 +
    1.28 +#include "MyGuidDef.h"
    1.29 +
    1.30 +typedef char CHAR;
    1.31 +typedef unsigned char UCHAR;
    1.32 +
    1.33 +#undef BYTE
    1.34 +typedef unsigned char BYTE;
    1.35 +
    1.36 +typedef short SHORT;
    1.37 +typedef unsigned short USHORT;
    1.38 +
    1.39 +#undef WORD
    1.40 +typedef unsigned short WORD;
    1.41 +typedef short VARIANT_BOOL;
    1.42 +
    1.43 +typedef int INT;
    1.44 +typedef Int32 INT32;
    1.45 +typedef unsigned int UINT;
    1.46 +typedef UInt32 UINT32;
    1.47 +typedef INT32 LONG;   // LONG, ULONG and DWORD must be 32-bit
    1.48 +typedef UINT32 ULONG;
    1.49 +
    1.50 +#undef DWORD
    1.51 +typedef UINT32 DWORD;
    1.52 +
    1.53 +typedef Int64 LONGLONG;
    1.54 +typedef UInt64 ULONGLONG;
    1.55 +
    1.56 +typedef struct LARGE_INTEGER { LONGLONG QuadPart; }LARGE_INTEGER;
    1.57 +typedef struct _ULARGE_INTEGER { ULONGLONG QuadPart;} ULARGE_INTEGER;
    1.58 +
    1.59 +typedef const CHAR *LPCSTR;
    1.60 +typedef CHAR TCHAR;
    1.61 +typedef const TCHAR *LPCTSTR;
    1.62 +typedef wchar_t WCHAR;
    1.63 +typedef WCHAR OLECHAR;
    1.64 +typedef const WCHAR *LPCWSTR;
    1.65 +typedef OLECHAR *BSTR;
    1.66 +typedef const OLECHAR *LPCOLESTR;
    1.67 +typedef OLECHAR *LPOLESTR;
    1.68 +
    1.69 +typedef struct _FILETIME
    1.70 +{
    1.71 +  DWORD dwLowDateTime;
    1.72 +  DWORD dwHighDateTime;
    1.73 +}FILETIME;
    1.74 +
    1.75 +#define HRESULT LONG
    1.76 +#define FAILED(Status) ((HRESULT)(Status)<0)
    1.77 +typedef ULONG PROPID;
    1.78 +typedef LONG SCODE;
    1.79 +
    1.80 +#define S_OK    ((HRESULT)0x00000000L)
    1.81 +#define S_FALSE ((HRESULT)0x00000001L)
    1.82 +#define E_NOTIMPL ((HRESULT)0x80004001L)
    1.83 +#define E_NOINTERFACE ((HRESULT)0x80004002L)
    1.84 +#define E_ABORT ((HRESULT)0x80004004L)
    1.85 +#define E_FAIL ((HRESULT)0x80004005L)
    1.86 +#define STG_E_INVALIDFUNCTION ((HRESULT)0x80030001L)
    1.87 +#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
    1.88 +#define E_INVALIDARG ((HRESULT)0x80070057L)
    1.89 +
    1.90 +#ifdef _MSC_VER
    1.91 +#define STDMETHODCALLTYPE __stdcall
    1.92 +#else
    1.93 +#define STDMETHODCALLTYPE
    1.94 +#endif
    1.95 +
    1.96 +#define STDMETHOD_(t, f) virtual t STDMETHODCALLTYPE f
    1.97 +#define STDMETHOD(f) STDMETHOD_(HRESULT, f)
    1.98 +#define STDMETHODIMP_(type) type STDMETHODCALLTYPE
    1.99 +#define STDMETHODIMP STDMETHODIMP_(HRESULT)
   1.100 +
   1.101 +#define PURE = 0
   1.102 +
   1.103 +#define MIDL_INTERFACE(x) struct
   1.104 +
   1.105 +#ifdef __cplusplus
   1.106 +
   1.107 +DEFINE_GUID(IID_IUnknown,
   1.108 +0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
   1.109 +struct IUnknown
   1.110 +{
   1.111 +  STDMETHOD(QueryInterface) (REFIID iid, void **outObject) PURE;
   1.112 +  STDMETHOD_(ULONG, AddRef)() PURE;
   1.113 +  STDMETHOD_(ULONG, Release)() PURE;
   1.114 +  #ifndef _WIN32
   1.115 +  virtual ~IUnknown() {}
   1.116 +  #endif
   1.117 +};
   1.118 +
   1.119 +typedef IUnknown *LPUNKNOWN;
   1.120 +
   1.121 +#endif
   1.122 +
   1.123 +#define VARIANT_TRUE ((VARIANT_BOOL)-1)
   1.124 +#define VARIANT_FALSE ((VARIANT_BOOL)0)
   1.125 +
   1.126 +enum VARENUM
   1.127 +{
   1.128 +  VT_EMPTY = 0,
   1.129 +  VT_NULL = 1,
   1.130 +  VT_I2 = 2,
   1.131 +  VT_I4 = 3,
   1.132 +  VT_R4 = 4,
   1.133 +  VT_R8 = 5,
   1.134 +  VT_CY = 6,
   1.135 +  VT_DATE = 7,
   1.136 +  VT_BSTR = 8,
   1.137 +  VT_DISPATCH = 9,
   1.138 +  VT_ERROR = 10,
   1.139 +  VT_BOOL = 11,
   1.140 +  VT_VARIANT = 12,
   1.141 +  VT_UNKNOWN = 13,
   1.142 +  VT_DECIMAL = 14,
   1.143 +  VT_I1 = 16,
   1.144 +  VT_UI1 = 17,
   1.145 +  VT_UI2 = 18,
   1.146 +  VT_UI4 = 19,
   1.147 +  VT_I8 = 20,
   1.148 +  VT_UI8 = 21,
   1.149 +  VT_INT = 22,
   1.150 +  VT_UINT = 23,
   1.151 +  VT_VOID = 24,
   1.152 +  VT_HRESULT = 25,
   1.153 +  VT_FILETIME = 64
   1.154 +};
   1.155 +
   1.156 +typedef unsigned short VARTYPE;
   1.157 +typedef WORD PROPVAR_PAD1;
   1.158 +typedef WORD PROPVAR_PAD2;
   1.159 +typedef WORD PROPVAR_PAD3;
   1.160 +
   1.161 +#ifdef __cplusplus
   1.162 +
   1.163 +typedef struct tagPROPVARIANT
   1.164 +{
   1.165 +  VARTYPE vt;
   1.166 +  PROPVAR_PAD1 wReserved1;
   1.167 +  PROPVAR_PAD2 wReserved2;
   1.168 +  PROPVAR_PAD3 wReserved3;
   1.169 +  union
   1.170 +  {
   1.171 +    CHAR cVal;
   1.172 +    UCHAR bVal;
   1.173 +    SHORT iVal;
   1.174 +    USHORT uiVal;
   1.175 +    LONG lVal;
   1.176 +    ULONG ulVal;
   1.177 +    INT intVal;
   1.178 +    UINT uintVal;
   1.179 +    LARGE_INTEGER hVal;
   1.180 +    ULARGE_INTEGER uhVal;
   1.181 +    VARIANT_BOOL boolVal;
   1.182 +    SCODE scode;
   1.183 +    FILETIME filetime;
   1.184 +    BSTR bstrVal;
   1.185 +  };
   1.186 +} PROPVARIANT;
   1.187 +
   1.188 +typedef PROPVARIANT tagVARIANT;
   1.189 +typedef tagVARIANT VARIANT;
   1.190 +typedef VARIANT VARIANTARG;
   1.191 +
   1.192 +MY_EXTERN_C HRESULT VariantClear(VARIANTARG *prop);
   1.193 +MY_EXTERN_C HRESULT VariantCopy(VARIANTARG *dest, VARIANTARG *src);
   1.194 +
   1.195 +#endif
   1.196 +
   1.197 +MY_EXTERN_C BSTR SysAllocStringByteLen(LPCSTR psz, UINT len);
   1.198 +MY_EXTERN_C BSTR SysAllocString(const OLECHAR *sz);
   1.199 +MY_EXTERN_C void SysFreeString(BSTR bstr);
   1.200 +MY_EXTERN_C UINT SysStringByteLen(BSTR bstr);
   1.201 +MY_EXTERN_C UINT SysStringLen(BSTR bstr);
   1.202 +
   1.203 +MY_EXTERN_C DWORD GetLastError();
   1.204 +MY_EXTERN_C LONG CompareFileTime(const FILETIME* ft1, const FILETIME* ft2);
   1.205 +
   1.206 +#define CP_ACP    0
   1.207 +#define CP_OEMCP  1
   1.208 +
   1.209 +typedef enum tagSTREAM_SEEK
   1.210 +{
   1.211 +  STREAM_SEEK_SET = 0,
   1.212 +  STREAM_SEEK_CUR = 1,
   1.213 +  STREAM_SEEK_END = 2
   1.214 +} STREAM_SEEK;
   1.215 +
   1.216 +#endif
   1.217 +#endif