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