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