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