Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 1 | /* |
Mike McCormack | e09aecf | 2006-06-13 18:34:27 +0900 | [diff] [blame] | 2 | * Copyright (C) 1998-1999 Francois Gouget |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2.1 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library; if not, write to the Free Software |
Jonathan Ernst | 360a3f9 | 2006-05-18 14:49:52 +0200 | [diff] [blame] | 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 17 | */ |
| 18 | |
Dimitrie O. Paun | 53f9c21 | 2003-08-28 21:43:34 +0000 | [diff] [blame] | 19 | #include <rpc.h> |
| 20 | #include <rpcndr.h> |
François Gouget | d604eb1 | 1998-12-18 16:00:03 +0000 | [diff] [blame] | 21 | |
Alexandre Julliard | dc818a5 | 2002-12-05 22:11:43 +0000 | [diff] [blame] | 22 | #ifndef _OBJBASE_H_ |
Paul Quinn | aaa8306 | 1999-06-05 15:23:20 +0000 | [diff] [blame] | 23 | #define _OBJBASE_H_ |
François Gouget | d604eb1 | 1998-12-18 16:00:03 +0000 | [diff] [blame] | 24 | |
Ove Kaaven | 2a8bd72 | 2002-12-23 01:41:51 +0000 | [diff] [blame] | 25 | /***************************************************************************** |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 26 | * Macros to define a COM interface |
| 27 | */ |
| 28 | /* |
| 29 | * The goal of the following set of definitions is to provide a way to use the same |
| 30 | * header file definitions to provide both a C interface and a C++ object oriented |
| 31 | * interface to COM interfaces. The type of interface is selected automatically |
| 32 | * depending on the language but it is always possible to get the C interface in C++ |
| 33 | * by defining CINTERFACE. |
| 34 | * |
| 35 | * It is based on the following assumptions: |
| 36 | * - all COM interfaces derive from IUnknown, this should not be a problem. |
| 37 | * - the header file only defines the interface, the actual fields are defined |
| 38 | * separately in the C file implementing the interface. |
| 39 | * |
| 40 | * The natural approach to this problem would be to make sure we get a C++ class and |
| 41 | * virtual methods in C++ and a structure with a table of pointer to functions in C. |
| 42 | * Unfortunately the layout of the virtual table is compiler specific, the layout of |
| 43 | * g++ virtual tables is not the same as that of an egcs virtual table which is not the |
| 44 | * same as that generated by Visual C+. There are workarounds to make the virtual tables |
| 45 | * compatible via padding but unfortunately the one which is imposed to the WINE emulator |
| 46 | * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all. |
| 47 | * |
| 48 | * So the solution I finally adopted does not use virtual tables. Instead I use inline |
| 49 | * non virtual methods that dereference the method pointer themselves and perform the call. |
| 50 | * |
| 51 | * Let's take Direct3D as an example: |
| 52 | * |
| 53 | * #define INTERFACE IDirect3D |
Alexandre Julliard | 5d0160e | 2004-10-05 04:38:15 +0000 | [diff] [blame] | 54 | * DECLARE_INTERFACE_(IDirect3D,IUnknown) |
| 55 | * { |
| 56 | * // *** IUnknown methods *** // |
| 57 | * STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, void**) PURE; |
| 58 | * STDMETHOD_(ULONG,AddRef)(THIS) PURE; |
| 59 | * STDMETHOD_(ULONG,Release)(THIS) PURE; |
| 60 | * // *** IDirect3D methods *** // |
| 61 | * STDMETHOD(Initialize)(THIS_ REFIID) PURE; |
| 62 | * STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID) PURE; |
| 63 | * STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT *, IUnknown *) PURE; |
| 64 | * STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL *, IUnknown *) PURE; |
| 65 | * STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT *, IUnknown *) PURE; |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 66 | * STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT) PURE; |
Alexandre Julliard | 5d0160e | 2004-10-05 04:38:15 +0000 | [diff] [blame] | 67 | * }; |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 68 | * #undef INTERFACE |
| 69 | * |
| 70 | * #ifdef COBJMACROS |
| 71 | * // *** IUnknown methods *** // |
| 72 | * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) |
| 73 | * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p) |
| 74 | * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p) |
| 75 | * // *** IDirect3D methods *** // |
| 76 | * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) |
| 77 | * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b) |
| 78 | * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) |
| 79 | * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) |
| 80 | * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) |
| 81 | * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) |
| 82 | * #endif |
| 83 | * |
| 84 | * Comments: |
| 85 | * - The INTERFACE macro is used in the STDMETHOD macros to define the type of the 'this' |
| 86 | * pointer. Defining this macro here saves us the trouble of having to repeat the interface |
| 87 | * name everywhere. Note however that because of the way macros work, a macro like STDMETHOD |
| 88 | * cannot use 'INTERFACE##_VTABLE' because this would give 'INTERFACE_VTABLE' and not |
| 89 | * 'IDirect3D_VTABLE'. |
Alexandre Julliard | 5d0160e | 2004-10-05 04:38:15 +0000 | [diff] [blame] | 90 | * - The DECLARE_INTERFACE declares all the structures necessary for the interface. We have to |
| 91 | * explicitly use the interface name for macro expansion reasons again. It defines the list of |
| 92 | * methods that are inheritable from this interface. It must be written manually (rather than |
| 93 | * using a macro to generate the equivalent code) to avoid macro recursion (which compilers |
| 94 | * don't like). It must start with the methods definition of the parent interface so that |
| 95 | * method inheritance works properly. |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 96 | * - The 'undef INTERFACE' is here to remind you that using INTERFACE in the following macros |
| 97 | * will not work. |
| 98 | * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access |
| 99 | * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate |
| 100 | * the inherited method definitions there. This time I could have used a trick to use only one |
Francois Gouget | fbb3343 | 2005-03-02 13:53:50 +0000 | [diff] [blame] | 101 | * macro whatever the number of parameters but I preferred to have it work the same way as above. |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 102 | * - You probably have noticed that we don't define the fields we need to actually implement this |
| 103 | * interface: reference count, pointer to other resources and miscellaneous fields. That's |
| 104 | * because these interfaces are just that: interfaces. They may be implemented more than once, in |
| 105 | * different contexts and sometimes not even in Wine. Thus it would not make sense to impose |
| 106 | * that the interface contains some specific fields. |
| 107 | * |
| 108 | * |
| 109 | * In C this gives: |
| 110 | * typedef struct IDirect3DVtbl IDirect3DVtbl; |
| 111 | * struct IDirect3D { |
| 112 | * IDirect3DVtbl* lpVtbl; |
| 113 | * }; |
| 114 | * struct IDirect3DVtbl { |
| 115 | * HRESULT (*QueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj); |
Bang Jun-Young | b7d0d05 | 2007-01-20 15:38:19 +0900 | [diff] [blame] | 116 | * ULONG (*AddRef)(IDirect3D* me); |
| 117 | * ULONG (*Release)(IDirect3D* me); |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 118 | * HRESULT (*Initialize)(IDirect3D* me, REFIID a); |
| 119 | * HRESULT (*EnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b); |
| 120 | * HRESULT (*CreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b); |
| 121 | * HRESULT (*CreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b); |
| 122 | * HRESULT (*CreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b); |
| 123 | * HRESULT (*FindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b); |
| 124 | * }; |
| 125 | * |
| 126 | * #ifdef COBJMACROS |
| 127 | * // *** IUnknown methods *** // |
| 128 | * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) |
| 129 | * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p) |
| 130 | * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p) |
| 131 | * // *** IDirect3D methods *** // |
| 132 | * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) |
| 133 | * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b) |
| 134 | * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) |
| 135 | * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) |
| 136 | * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) |
| 137 | * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) |
| 138 | * #endif |
| 139 | * |
| 140 | * Comments: |
| 141 | * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing |
| 142 | * the user needs to know to use the interface. Of course the structure we will define to |
| 143 | * implement this interface will have more fields but the first one will match this pointer. |
Alexandre Julliard | 616940e | 2004-08-12 03:33:30 +0000 | [diff] [blame] | 144 | * - The code generated by DECLARE_INTERFACE defines both the structure representing the interface and |
Alexandre Julliard | 5d0160e | 2004-10-05 04:38:15 +0000 | [diff] [blame] | 145 | * the structure for the jump table. |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 146 | * - Each method is declared as a pointer to function field in the jump table. The implementation |
| 147 | * will fill this jump table with appropriate values, probably using a static variable, and |
| 148 | * initialize the lpVtbl field to point to this variable. |
| 149 | * - The IDirect3D_Xxx macros then just derefence the lpVtbl pointer and use the function pointer |
| 150 | * corresponding to the macro name. This emulates the behavior of a virtual table and should be |
| 151 | * just as fast. |
| 152 | * - This C code should be quite compatible with the Windows headers both for code that uses COM |
| 153 | * interfaces and for code implementing a COM interface. |
| 154 | * |
| 155 | * |
| 156 | * And in C++ (with gcc's g++): |
| 157 | * |
| 158 | * typedef struct IDirect3D: public IUnknown { |
| 159 | * virtual HRESULT Initialize(REFIID a) = 0; |
| 160 | * virtual HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b) = 0; |
| 161 | * virtual HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b) = 0; |
| 162 | * virtual HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b) = 0; |
| 163 | * virtual HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b) = 0; |
| 164 | * virtual HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b) = 0; |
| 165 | * }; |
| 166 | * |
| 167 | * Comments: |
| 168 | * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions. |
| 169 | * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE |
| 170 | * macro is defined in which case we would not be here. |
| 171 | * |
| 172 | * |
| 173 | * Implementing a COM interface. |
| 174 | * |
| 175 | * This continues the above example. This example assumes that the implementation is in C. |
| 176 | * |
Alexandre Julliard | 241a4c3 | 2004-09-09 21:03:58 +0000 | [diff] [blame] | 177 | * typedef struct IDirect3DImpl { |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 178 | * void* lpVtbl; |
| 179 | * // ... |
| 180 | * |
Alexandre Julliard | 241a4c3 | 2004-09-09 21:03:58 +0000 | [diff] [blame] | 181 | * } IDirect3DImpl; |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 182 | * |
Alexandre Julliard | 48c4bb3 | 2004-08-12 23:00:51 +0000 | [diff] [blame] | 183 | * static IDirect3DVtbl d3dvt; |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 184 | * |
| 185 | * // implement the IDirect3D methods here |
| 186 | * |
| 187 | * int IDirect3D_QueryInterface(IDirect3D* me) |
| 188 | * { |
Alexandre Julliard | 241a4c3 | 2004-09-09 21:03:58 +0000 | [diff] [blame] | 189 | * IDirect3DImpl *This = (IDirect3DImpl *)me; |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 190 | * // ... |
| 191 | * } |
| 192 | * |
| 193 | * // ... |
| 194 | * |
Alexandre Julliard | 48c4bb3 | 2004-08-12 23:00:51 +0000 | [diff] [blame] | 195 | * static IDirect3DVtbl d3dvt = { |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 196 | * IDirect3D_QueryInterface, |
| 197 | * IDirect3D_Add, |
| 198 | * IDirect3D_Add2, |
| 199 | * IDirect3D_Initialize, |
| 200 | * IDirect3D_SetWidth |
| 201 | * }; |
| 202 | * |
| 203 | * Comments: |
Alexandre Julliard | 241a4c3 | 2004-09-09 21:03:58 +0000 | [diff] [blame] | 204 | * - We first define what the interface really contains. This is the IDirect3DImpl structure. The |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 205 | * first field must of course be the virtual table pointer. Everything else is free. |
| 206 | * - Then we predeclare our static virtual table variable, we will need its address in some |
| 207 | * methods to initialize the virtual table pointer of the returned interface objects. |
| 208 | * - Then we implement the interface methods. To match what has been declared in the header file |
Francois Gouget | 93416cd | 2005-03-23 13:15:18 +0000 | [diff] [blame] | 209 | * they must take a pointer to an IDirect3D structure and we must cast it to an IDirect3DImpl so |
Alexandre Julliard | 241a4c3 | 2004-09-09 21:03:58 +0000 | [diff] [blame] | 210 | * that we can manipulate the fields. |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 211 | * - Finally we initialize the virtual table. |
| 212 | */ |
| 213 | |
| 214 | #if defined(__cplusplus) && !defined(CINTERFACE) |
| 215 | |
| 216 | /* C++ interface */ |
| 217 | |
| 218 | #define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method |
| 219 | #define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method |
| 220 | #define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method |
| 221 | #define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method |
| 222 | |
| 223 | #define PURE = 0 |
| 224 | #define THIS_ |
| 225 | #define THIS void |
| 226 | |
| 227 | #define interface struct |
Nikolay Sivov | 3406c9d | 2009-01-20 20:02:51 +0300 | [diff] [blame] | 228 | #define DECLARE_INTERFACE(iface) interface DECLSPEC_NOVTABLE iface |
| 229 | #define DECLARE_INTERFACE_(iface,ibase) interface DECLSPEC_NOVTABLE iface : public ibase |
| 230 | #define DECLARE_INTERFACE_IID_(iface, ibase, iid) interface DECLSPEC_UUID(iid) DECLSPEC_NOVTABLE iface : public ibase |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 231 | |
| 232 | #define BEGIN_INTERFACE |
| 233 | #define END_INTERFACE |
| 234 | |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 235 | #else /* __cplusplus && !CINTERFACE */ |
| 236 | |
| 237 | /* C interface */ |
| 238 | |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 239 | #define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE *method) |
| 240 | #define STDMETHOD_(type,method) type (STDMETHODCALLTYPE *method) |
| 241 | #define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method) |
| 242 | #define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method) |
| 243 | |
| 244 | #define PURE |
| 245 | #define THIS_ INTERFACE *This, |
| 246 | #define THIS INTERFACE *This |
| 247 | |
| 248 | #define interface struct |
| 249 | |
Alexandre Julliard | 76ed283 | 2005-07-26 20:10:51 +0000 | [diff] [blame] | 250 | #ifdef __WINESRC__ |
| 251 | #define CONST_VTABLE |
| 252 | #endif |
| 253 | |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 254 | #ifdef CONST_VTABLE |
| 255 | #undef CONST_VTBL |
| 256 | #define CONST_VTBL const |
| 257 | #define DECLARE_INTERFACE(iface) \ |
Alexandre Julliard | b8d3075 | 2005-07-26 18:32:53 +0000 | [diff] [blame] | 258 | typedef interface iface { const struct iface##Vtbl *lpVtbl; } iface; \ |
Dmitry Timoshkov | 4625628 | 2005-05-27 20:17:35 +0000 | [diff] [blame] | 259 | typedef struct iface##Vtbl iface##Vtbl; \ |
| 260 | struct iface##Vtbl |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 261 | #else |
| 262 | #undef CONST_VTBL |
| 263 | #define CONST_VTBL |
| 264 | #define DECLARE_INTERFACE(iface) \ |
Alexandre Julliard | b8d3075 | 2005-07-26 18:32:53 +0000 | [diff] [blame] | 265 | typedef interface iface { struct iface##Vtbl *lpVtbl; } iface; \ |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 266 | typedef struct iface##Vtbl iface##Vtbl; \ |
| 267 | struct iface##Vtbl |
| 268 | #endif |
| 269 | #define DECLARE_INTERFACE_(iface,ibase) DECLARE_INTERFACE(iface) |
Nikolay Sivov | 3406c9d | 2009-01-20 20:02:51 +0300 | [diff] [blame] | 270 | #define DECLARE_INTERFACE_IID_(iface, ibase, iid) DECLARE_INTERFACE_(iface, ibase) |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 271 | |
Alexandre Julliard | 20486e1 | 2004-08-23 18:10:02 +0000 | [diff] [blame] | 272 | #define BEGIN_INTERFACE |
Alexandre Julliard | 5537911 | 2003-04-10 21:13:58 +0000 | [diff] [blame] | 273 | #define END_INTERFACE |
| 274 | |
Alexandre Julliard | aae3cb6 | 2003-04-11 00:31:02 +0000 | [diff] [blame] | 275 | #endif /* __cplusplus && !CINTERFACE */ |
| 276 | |
Vincent Béron | bce123d | 2005-12-02 13:32:09 +0100 | [diff] [blame] | 277 | #ifndef __IRpcStubBuffer_FWD_DEFINED__ |
| 278 | #define __IRpcStubBuffer_FWD_DEFINED__ |
| 279 | typedef interface IRpcStubBuffer IRpcStubBuffer; |
| 280 | #endif |
| 281 | #ifndef __IRpcChannelBuffer_FWD_DEFINED__ |
| 282 | #define __IRpcChannelBuffer_FWD_DEFINED__ |
| 283 | typedef interface IRpcChannelBuffer IRpcChannelBuffer; |
| 284 | #endif |
| 285 | |
Francois Gouget | f2973ca | 2000-09-22 22:17:49 +0000 | [diff] [blame] | 286 | #ifndef RC_INVOKED |
| 287 | /* For compatibility only, at least for now */ |
| 288 | #include <stdlib.h> |
| 289 | #endif |
| 290 | |
Francois Gouget | fc765b9 | 2006-11-08 00:52:15 +0100 | [diff] [blame] | 291 | #include <wtypes.h> |
| 292 | #include <unknwn.h> |
| 293 | #include <objidl.h> |
| 294 | |
| 295 | #include <guiddef.h> |
Peter Hunnisett | 3d7cd87 | 2001-04-12 21:10:54 +0000 | [diff] [blame] | 296 | #ifndef INITGUID |
Dimitrie O. Paun | 53f9c21 | 2003-08-28 21:43:34 +0000 | [diff] [blame] | 297 | #include <cguid.h> |
Peter Hunnisett | 3d7cd87 | 2001-04-12 21:10:54 +0000 | [diff] [blame] | 298 | #endif |
François Gouget | 504973d | 2001-01-02 20:55:40 +0000 | [diff] [blame] | 299 | |
Francois Gouget | 0062892 | 2000-10-19 20:32:18 +0000 | [diff] [blame] | 300 | #ifdef __cplusplus |
| 301 | extern "C" { |
| 302 | #endif |
| 303 | |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 304 | #ifndef NONAMELESSSTRUCT |
| 305 | #define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v)) |
| 306 | #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v)) |
| 307 | #else |
Ge van Geldorp | 399901e | 2004-01-23 01:51:33 +0000 | [diff] [blame] | 308 | #define LISet32(li, v) ((li).u.HighPart = (v) < 0 ? -1 : 0, (li).u.LowPart = (v)) |
| 309 | #define ULISet32(li, v) ((li).u.HighPart = 0, (li).u.LowPart = (v)) |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 310 | #endif |
| 311 | |
| 312 | /***************************************************************************** |
| 313 | * Standard API |
| 314 | */ |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 315 | DWORD WINAPI CoBuildVersion(void); |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 316 | |
| 317 | typedef enum tagCOINIT |
| 318 | { |
| 319 | COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */ |
| 320 | COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */ |
| 321 | COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */ |
| 322 | COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */ |
| 323 | } COINIT; |
| 324 | |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 325 | HRESULT WINAPI CoInitialize(LPVOID lpReserved); |
| 326 | HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit); |
| 327 | void WINAPI CoUninitialize(void); |
| 328 | DWORD WINAPI CoGetCurrentProcess(void); |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 329 | |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 330 | HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree); |
| 331 | void WINAPI CoFreeAllLibraries(void); |
| 332 | void WINAPI CoFreeLibrary(HINSTANCE hLibrary); |
| 333 | void WINAPI CoFreeUnusedLibraries(void); |
Rob Shearman | 5ffe867 | 2007-09-12 10:02:08 +0100 | [diff] [blame] | 334 | void WINAPI CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved); |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 335 | |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 336 | HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv); |
| 337 | HRESULT WINAPI CoCreateInstanceEx(REFCLSID rclsid, |
| 338 | LPUNKNOWN pUnkOuter, |
| 339 | DWORD dwClsContext, |
| 340 | COSERVERINFO* pServerInfo, |
| 341 | ULONG cmq, |
| 342 | MULTI_QI* pResults); |
| 343 | |
| 344 | HRESULT WINAPI CoGetInstanceFromFile(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, DWORD grfMode, OLECHAR* pwszName, DWORD dwCount, MULTI_QI* pResults); |
| 345 | HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, IStorage* pstg, DWORD dwCount, MULTI_QI* pResults); |
| 346 | |
| 347 | HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC* lpMalloc); |
Marcus Meissner | 96412ee | 2008-09-04 13:39:58 +0200 | [diff] [blame] | 348 | LPVOID WINAPI CoTaskMemAlloc(ULONG size) __WINE_ALLOC_SIZE(1); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 349 | void WINAPI CoTaskMemFree(LPVOID ptr); |
| 350 | LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size); |
| 351 | |
| 352 | HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy); |
| 353 | HRESULT WINAPI CoRevokeMallocSpy(void); |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 354 | |
Alexandre Julliard | de61fc5 | 2008-02-26 11:21:54 +0100 | [diff] [blame] | 355 | HRESULT WINAPI CoGetContextToken( ULONG_PTR *token ); |
| 356 | |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 357 | /* class registration flags; passed to CoRegisterClassObject */ |
| 358 | typedef enum tagREGCLS |
| 359 | { |
| 360 | REGCLS_SINGLEUSE = 0, |
| 361 | REGCLS_MULTIPLEUSE = 1, |
| 362 | REGCLS_MULTI_SEPARATE = 2, |
Rob Shearman | 2b55248 | 2007-03-14 15:43:52 +0000 | [diff] [blame] | 363 | REGCLS_SUSPENDED = 4, |
| 364 | REGCLS_SURROGATE = 8 |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 365 | } REGCLS; |
| 366 | |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 367 | HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv); |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 368 | HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister); |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 369 | HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister); |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 370 | HRESULT WINAPI CoGetPSClsid(REFIID riid,CLSID *pclsid); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 371 | HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid); |
Rob Shearman | 2b55248 | 2007-03-14 15:43:52 +0000 | [diff] [blame] | 372 | HRESULT WINAPI CoRegisterSurrogate(LPSURROGATE pSurrogate); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 373 | HRESULT WINAPI CoSuspendClassObjects(void); |
| 374 | HRESULT WINAPI CoResumeClassObjects(void); |
| 375 | ULONG WINAPI CoAddRefServerProcess(void); |
Robert Shearman | 3b0a5d0 | 2004-12-01 15:33:34 +0000 | [diff] [blame] | 376 | ULONG WINAPI CoReleaseServerProcess(void); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 377 | |
| 378 | /* marshalling */ |
| 379 | HRESULT WINAPI CoCreateFreeThreadedMarshaler(LPUNKNOWN punkOuter, LPUNKNOWN* ppunkMarshal); |
| 380 | HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID iid, LPVOID* ppv); |
| 381 | HRESULT WINAPI CoGetMarshalSizeMax(ULONG* pulSize, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags); |
| 382 | HRESULT WINAPI CoGetStandardMarshal(REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL* ppMarshal); |
| 383 | HRESULT WINAPI CoMarshalHresult(LPSTREAM pstm, HRESULT hresult); |
| 384 | HRESULT WINAPI CoMarshalInterface(LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags); |
| 385 | HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM* ppStm); |
| 386 | HRESULT WINAPI CoReleaseMarshalData(LPSTREAM pStm); |
Dave Belanger | 46f0d60 | 2003-08-28 19:42:24 +0000 | [diff] [blame] | 387 | HRESULT WINAPI CoDisconnectObject(LPUNKNOWN lpUnk, DWORD reserved); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 388 | HRESULT WINAPI CoUnmarshalHresult(LPSTREAM pstm, HRESULT* phresult); |
| 389 | HRESULT WINAPI CoUnmarshalInterface(LPSTREAM pStm, REFIID riid, LPVOID* ppv); |
| 390 | HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases); |
| 391 | BOOL WINAPI CoIsHandlerConnected(LPUNKNOWN pUnk); |
| 392 | |
| 393 | /* security */ |
| 394 | HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, SOLE_AUTHENTICATION_SERVICE* asAuthSvc, void* pReserved1, DWORD dwAuthnLevel, DWORD dwImpLevel, void* pReserved2, DWORD dwCapabilities, void* pReserved3); |
| 395 | HRESULT WINAPI CoGetCallContext(REFIID riid, void** ppInterface); |
Andrey Turkin | a06f568 | 2009-01-18 17:17:45 +0300 | [diff] [blame] | 396 | HRESULT WINAPI CoSwitchCallContext(IUnknown *pContext, IUnknown **ppOldContext); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 397 | HRESULT WINAPI CoQueryAuthenticationServices(DWORD* pcAuthSvc, SOLE_AUTHENTICATION_SERVICE** asAuthSvc); |
| 398 | |
Francois Gouget | 928048b | 2008-05-06 15:51:33 +0200 | [diff] [blame] | 399 | HRESULT WINAPI CoQueryProxyBlanket(IUnknown* pProxy, DWORD* pwAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTH_IDENTITY_HANDLE* pAuthInfo, DWORD* pCapabilities); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 400 | HRESULT WINAPI CoSetProxyBlanket(IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel, RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities); |
| 401 | HRESULT WINAPI CoCopyProxy(IUnknown* pProxy, IUnknown** ppCopy); |
| 402 | |
| 403 | HRESULT WINAPI CoImpersonateClient(void); |
Alexandre Julliard | d07c100 | 2004-01-23 22:51:41 +0000 | [diff] [blame] | 404 | HRESULT WINAPI CoQueryClientBlanket(DWORD* pAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTHZ_HANDLE* pPrivs, DWORD* pCapabilities); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 405 | HRESULT WINAPI CoRevertToSelf(void); |
| 406 | |
| 407 | /* misc */ |
| 408 | HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew); |
| 409 | HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew); |
Rob Shearman | b787df4 | 2006-12-29 14:43:28 +0000 | [diff] [blame] | 410 | HRESULT WINAPI CoAllowSetForegroundWindow(IUnknown *pUnk, LPVOID lpvReserved); |
Rob Shearman | 2b55248 | 2007-03-14 15:43:52 +0000 | [diff] [blame] | 411 | HRESULT WINAPI CoGetObjectContext(REFIID riid, LPVOID *ppv); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 412 | |
| 413 | HRESULT WINAPI CoCreateGuid(GUID* pguid); |
| 414 | BOOL WINAPI CoIsOle1Class(REFCLSID rclsid); |
| 415 | |
| 416 | BOOL WINAPI CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime, FILETIME* lpFileTime); |
| 417 | BOOL WINAPI CoFileTimeToDosDateTime(FILETIME* lpFileTime, WORD* lpDosDate, WORD* lpDosTime); |
| 418 | HRESULT WINAPI CoFileTimeNow(FILETIME* lpFileTime); |
Dave Belanger | 46f0d60 | 2003-08-28 19:42:24 +0000 | [diff] [blame] | 419 | HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter,LPMESSAGEFILTER *lplpMessageFilter); |
Rob Shearman | b787df4 | 2006-12-29 14:43:28 +0000 | [diff] [blame] | 420 | HRESULT WINAPI CoRegisterChannelHook(REFGUID ExtensionGuid, IChannelHook *pChannelHook); |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 421 | |
Robert Shearman | 1b5ebab | 2005-03-17 10:26:20 +0000 | [diff] [blame] | 422 | typedef enum tagCOWAIT_FLAGS |
| 423 | { |
| 424 | COWAIT_WAITALL = 0x00000001, |
| 425 | COWAIT_ALERTABLE = 0x00000002 |
| 426 | } COWAIT_FLAGS; |
| 427 | |
Francois Gouget | f5c6a71 | 2007-02-20 15:45:28 +0100 | [diff] [blame] | 428 | HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags,DWORD dwTimeout,ULONG cHandles,LPHANDLE pHandles,LPDWORD lpdwindex); |
Robert Shearman | 1b5ebab | 2005-03-17 10:26:20 +0000 | [diff] [blame] | 429 | |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 430 | /***************************************************************************** |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 431 | * GUID API |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 432 | */ |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 433 | HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*); |
Ge van Geldorp | 100e113 | 2004-01-23 20:57:26 +0000 | [diff] [blame] | 434 | HRESULT WINAPI CLSIDFromString(LPOLESTR, CLSID *); |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 435 | HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid); |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 436 | HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID); |
| 437 | |
| 438 | INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax); |
| 439 | |
| 440 | /***************************************************************************** |
| 441 | * COM Server dll - exports |
| 442 | */ |
Alexandre Julliard | 9936fee | 2006-06-12 16:18:01 +0200 | [diff] [blame] | 443 | HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv) DECLSPEC_HIDDEN; |
| 444 | HRESULT WINAPI DllCanUnloadNow(void) DECLSPEC_HIDDEN; |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 445 | |
Robert Shearman | 714c60f | 2005-05-17 14:33:17 +0000 | [diff] [blame] | 446 | /* shouldn't be here, but is nice for type checking */ |
| 447 | #ifdef __WINESRC__ |
Alexandre Julliard | 9936fee | 2006-06-12 16:18:01 +0200 | [diff] [blame] | 448 | HRESULT WINAPI DllRegisterServer(void) DECLSPEC_HIDDEN; |
| 449 | HRESULT WINAPI DllUnregisterServer(void) DECLSPEC_HIDDEN; |
Robert Shearman | 714c60f | 2005-05-17 14:33:17 +0000 | [diff] [blame] | 450 | #endif |
| 451 | |
| 452 | |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 453 | /***************************************************************************** |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 454 | * Data Object |
| 455 | */ |
| 456 | HRESULT WINAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER* ppDAHolder); |
| 457 | HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID iid, LPVOID* ppv); |
| 458 | |
| 459 | /***************************************************************************** |
Ove Kaaven | 41dfa05 | 2002-12-06 19:49:56 +0000 | [diff] [blame] | 460 | * Moniker API |
| 461 | */ |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 462 | HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID* ppvResult); |
Robert Shearman | 3b0a5d0 | 2004-12-01 15:33:34 +0000 | [diff] [blame] | 463 | HRESULT WINAPI CoGetObject(LPCWSTR pszName, BIND_OPTS *pBindOptions, REFIID riid, void **ppv); |
| 464 | HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk); |
| 465 | HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC* ppbc); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 466 | HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, LPMONIKER* ppmk); |
Robert Shearman | 3b0a5d0 | 2004-12-01 15:33:34 +0000 | [diff] [blame] | 467 | HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER* ppmk); |
| 468 | HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite); |
| 469 | HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk); |
| 470 | HRESULT WINAPI CreateObjrefMoniker(LPUNKNOWN punk, LPMONIKER * ppmk); |
| 471 | HRESULT WINAPI CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER * ppmk); |
Robert Shearman | 3b0a5d0 | 2004-12-01 15:33:34 +0000 | [diff] [blame] | 472 | HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 473 | HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot); |
Robert Shearman | 3b0a5d0 | 2004-12-01 15:33:34 +0000 | [diff] [blame] | 474 | HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szUserName, ULONG * pchEaten, LPMONIKER * ppmk); |
| 475 | HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon); |
| 476 | HRESULT WINAPI MonikerRelativePathTo(LPMONIKER pmkSrc, LPMONIKER pmkDest, LPMONIKER * ppmkRelPath, BOOL dwReserved); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 477 | |
| 478 | /***************************************************************************** |
| 479 | * Storage API |
| 480 | */ |
| 481 | #define STGM_DIRECT 0x00000000 |
| 482 | #define STGM_TRANSACTED 0x00010000 |
| 483 | #define STGM_SIMPLE 0x08000000 |
| 484 | #define STGM_READ 0x00000000 |
| 485 | #define STGM_WRITE 0x00000001 |
| 486 | #define STGM_READWRITE 0x00000002 |
| 487 | #define STGM_SHARE_DENY_NONE 0x00000040 |
| 488 | #define STGM_SHARE_DENY_READ 0x00000030 |
| 489 | #define STGM_SHARE_DENY_WRITE 0x00000020 |
| 490 | #define STGM_SHARE_EXCLUSIVE 0x00000010 |
| 491 | #define STGM_PRIORITY 0x00040000 |
| 492 | #define STGM_DELETEONRELEASE 0x04000000 |
| 493 | #define STGM_CREATE 0x00001000 |
| 494 | #define STGM_CONVERT 0x00020000 |
| 495 | #define STGM_FAILIFTHERE 0x00000000 |
| 496 | #define STGM_NOSCRATCH 0x00100000 |
| 497 | #define STGM_NOSNAPSHOT 0x00200000 |
Mike McCormack | 7674702 | 2005-03-05 10:47:01 +0000 | [diff] [blame] | 498 | #define STGM_DIRECT_SWMR 0x00400000 |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 499 | |
Matthew Mastracci | 8188790 | 2005-05-05 16:44:05 +0000 | [diff] [blame] | 500 | #define STGFMT_STORAGE 0 |
| 501 | #define STGFMT_FILE 3 |
| 502 | #define STGFMT_ANY 4 |
| 503 | #define STGFMT_DOCFILE 5 |
| 504 | |
Francois Gouget | 7a58c6e | 2004-04-30 18:32:20 +0000 | [diff] [blame] | 505 | typedef struct tagSTGOPTIONS |
| 506 | { |
| 507 | USHORT usVersion; |
| 508 | USHORT reserved; |
| 509 | ULONG ulSectorSize; |
| 510 | const WCHAR* pwcsTemplateFile; |
| 511 | } STGOPTIONS; |
| 512 | |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 513 | HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName,DWORD grfMode,DWORD reserved,IStorage **ppstgOpen); |
Francois Gouget | 7a58c6e | 2004-04-30 18:32:20 +0000 | [diff] [blame] | 514 | HRESULT WINAPI StgCreateStorageEx(const WCHAR*,DWORD,DWORD,DWORD,STGOPTIONS*,void*,REFIID,void**); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 515 | HRESULT WINAPI StgIsStorageFile(LPCOLESTR fn); |
| 516 | HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 517 | HRESULT WINAPI StgOpenStorage(const OLECHAR* pwcsName,IStorage* pstgPriority,DWORD grfMode,SNB snbExclude,DWORD reserved,IStorage**ppstgOpen); |
Mike McCormack | f2e475e | 2005-06-09 09:48:51 +0000 | [diff] [blame] | 518 | HRESULT WINAPI StgOpenStorageEx(const WCHAR* pwcwName,DWORD grfMode,DWORD stgfmt,DWORD grfAttrs,STGOPTIONS *pStgOptions, void *reserved, REFIID riid, void **ppObjectOpen); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 519 | |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 520 | HRESULT WINAPI StgCreateDocfileOnILockBytes(ILockBytes *plkbyt,DWORD grfMode, DWORD reserved, IStorage** ppstgOpen); |
| 521 | HRESULT WINAPI StgOpenStorageOnILockBytes(ILockBytes *plkbyt, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen); |
Mike McCormack | f2e475e | 2005-06-09 09:48:51 +0000 | [diff] [blame] | 522 | HRESULT WINAPI StgSetTimes( OLECHAR const *lpszName, FILETIME const *pctime, FILETIME const *patime, FILETIME const *pmtime); |
Ove Kaaven | 99c8526 | 2002-12-18 20:49:16 +0000 | [diff] [blame] | 523 | |
Francois Gouget | 0062892 | 2000-10-19 20:32:18 +0000 | [diff] [blame] | 524 | #ifdef __cplusplus |
| 525 | } |
| 526 | #endif |
| 527 | |
Francois Gouget | fc765b9 | 2006-11-08 00:52:15 +0100 | [diff] [blame] | 528 | #ifndef __WINESRC__ |
| 529 | # include <urlmon.h> |
| 530 | #endif |
Francois Gouget | 83755cc | 2004-09-09 19:23:19 +0000 | [diff] [blame] | 531 | #include <propidl.h> |
Ove Kaaven | 2a8bd72 | 2002-12-23 01:41:51 +0000 | [diff] [blame] | 532 | |
Dimitrie O. Paun | 8b36681 | 2003-01-04 00:52:18 +0000 | [diff] [blame] | 533 | #ifndef __WINESRC__ |
Alexandre Julliard | f00c46f | 2003-04-10 00:19:24 +0000 | [diff] [blame] | 534 | |
Paul Quinn | aaa8306 | 1999-06-05 15:23:20 +0000 | [diff] [blame] | 535 | #define FARSTRUCT |
| 536 | #define HUGEP |
| 537 | |
Paul Quinn | ea1640f | 1999-03-10 18:03:53 +0000 | [diff] [blame] | 538 | #define WINOLEAPI STDAPI |
| 539 | #define WINOLEAPI_(type) STDAPI_(type) |
| 540 | |
Dimitrie O. Paun | 8b36681 | 2003-01-04 00:52:18 +0000 | [diff] [blame] | 541 | #endif /* __WINESRC__ */ |
François Gouget | d604eb1 | 1998-12-18 16:00:03 +0000 | [diff] [blame] | 542 | |
Alexandre Julliard | dc818a5 | 2002-12-05 22:11:43 +0000 | [diff] [blame] | 543 | #endif /* _OBJBASE_H_ */ |