diff --git a/reactos/Makefile b/reactos/Makefile index 643b3939d01..cf3c6dcdd3f 100644 --- a/reactos/Makefile +++ b/reactos/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.194 2003/12/27 19:03:09 gvg Exp $ +# $Id: Makefile,v 1.195 2003/12/28 10:40:55 navaraf Exp $ # # Global makefile # @@ -44,7 +44,10 @@ DLLS_KBD = kbdus kbdgr kbdfr kbduk DLLS = libwine advapi32 cards crtdll fmifs freetype gdi32 kernel32 packet lzexpand \ msafd msvcrt ntdll psapi richedit rpcrt4 secur32 syssetup twain user32 version \ winspool ws2help ws2_32 wsock32 wshirda iphlpapi msgina mswsock msimg32 d3d8thk \ - winmm ole32 comctl32 $(DLLS_KBD) + winmm comctl32 $(DLLS_KBD) + +# Uncomment this after the update W32API headers will be released. +# DLLS += ole32 shlwapi SUBSYS = smss win32k csrss ntvdm diff --git a/reactos/include/ole32/basetyps.h b/reactos/include/ole32/basetyps.h deleted file mode 100644 index b98ded1c027..00000000000 --- a/reactos/include/ole32/basetyps.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: include\ole32\basetyps.h - * PURPOSE: Base type and interface macros - * PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be] - * UPDATE HISTORY: - * Created 05/01/2001 - */ -/******************************************************************** - - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - -********************************************************************/ -#ifndef _BASETYPS -#define _BASETYPS - -#include - - -#endif - diff --git a/reactos/include/ole32/obj_base.h b/reactos/include/ole32/obj_base.h deleted file mode 100644 index a453a7b701c..00000000000 --- a/reactos/include/ole32/obj_base.h +++ /dev/null @@ -1,680 +0,0 @@ -/* - * This file defines the macros and types necessary to define COM interfaces, - * and the three most basic COM interfaces: IUnknown, IMalloc and IClassFactory. - */ - -#ifndef __WINE_WINE_OBJ_BASE_H -#define __WINE_WINE_OBJ_BASE_H - -/***************************************************************************** - * define ICOM_MSVTABLE_COMPAT - * to implement the microsoft com vtable compatibility workaround for g++. - * - * NOTE: Turning this option on will produce a winelib that is incompatible - * with the binary emulator. - * - * If the compiler supports the com_interface attribute, leave this off, and - * define the ICOM_USE_COM_INTERFACE_ATTRIBUTE macro below. This may also - * require the addition of the -vtable-thunks option for g++. - * - * If you aren't interested in Winelib C++ compatibility at all, leave both - * options off. - * - * The preferable method for using ICOM_USE_COM_INTERFACE_ATTRIBUTE macro - * would be to define it only for your Winelib application. This allows you - * to have both binary and Winelib compatibility for C and C++ at the same - * time :) - */ -/* #define ICOM_MSVTABLE_COMPAT 1 */ -/* #define ICOM_USE_COM_INTERFACE_ATTRIBUTE 1 */ - -/***************************************************************************** - * Defines the basic types - */ -#include "wtypes.h" -#include "guiddef.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifndef NONAMELESSSTRUCT -#define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v)) -#define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v)) -#else -#define LISet32(li, v) ((li).s.HighPart = (v) < 0 ? -1 : 0, (li).s.LowPart = (v)) -#define ULISet32(li, v) ((li).s.HighPart = 0, (li).s.LowPart = (v)) -#endif - -/***************************************************************************** - * GUID API - */ -HRESULT WINAPI StringFromCLSID16(REFCLSID id, LPOLESTR16*); -HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*); - -HRESULT WINAPI CLSIDFromString16(LPCOLESTR16, CLSID *); -HRESULT WINAPI CLSIDFromString(LPCOLESTR, CLSID *); - -HRESULT WINAPI CLSIDFromProgID16(LPCOLESTR16 progid, LPCLSID riid); -HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid); - -HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID); - - -INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax); - - -/***************************************************************************** - * Macros to define a COM interface - */ -/* - * The goal of the following set of definitions is to provide a way to use the same - * header file definitions to provide both a C interface and a C++ object oriented - * interface to COM interfaces. The type of interface is selected automatically - * depending on the language but it is always possible to get the C interface in C++ - * by defining CINTERFACE. - * - * It is based on the following assumptions: - * - all COM interfaces derive from IUnknown, this should not be a problem. - * - the header file only defines the interface, the actual fields are defined - * separately in the C file implementing the interface. - * - * The natural approach to this problem would be to make sure we get a C++ class and - * virtual methods in C++ and a structure with a table of pointer to functions in C. - * Unfortunately the layout of the virtual table is compiler specific, the layout of - * g++ virtual tables is not the same as that of an egcs virtual table which is not the - * same as that generated by Visual C+. There are workarounds to make the virtual tables - * compatible via padding but unfortunately the one which is imposed to the WINE emulator - * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all. - * - * So the solution I finally adopted does not use virtual tables. Instead I use inline - * non virtual methods that dereference the method pointer themselves and perform the call. - * - * Let's take Direct3D as an example: - * - * #define ICOM_INTERFACE IDirect3D - * #define IDirect3D_METHODS \ - * ICOM_METHOD1(HRESULT,Initialize, REFIID,) \ - * ICOM_METHOD2(HRESULT,EnumDevices, LPD3DENUMDEVICESCALLBACK,, LPVOID,) \ - * ICOM_METHOD2(HRESULT,CreateLight, LPDIRECT3DLIGHT*,, IUnknown*,) \ - * ICOM_METHOD2(HRESULT,CreateMaterial,LPDIRECT3DMATERIAL*,, IUnknown*,) \ - * ICOM_METHOD2(HRESULT,CreateViewport,LPDIRECT3DVIEWPORT*,, IUnknown*,) \ - * ICOM_METHOD2(HRESULT,FindDevice, LPD3DFINDDEVICESEARCH,, LPD3DFINDDEVICERESULT,) - * #define IDirect3D_IMETHODS \ - * IUnknown_IMETHODS \ - * IDirect3D_METHODS - * ICOM_DEFINE(IDirect3D,IUnknown) - * #undef ICOM_INTERFACE - * - * #ifdef ICOM_CINTERFACE - * *** IUnknown methods *** - * #define IDirect3D_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) - * #define IDirect3D_AddRef(p) ICOM_CALL (AddRef,p) - * #define IDirect3D_Release(p) ICOM_CALL (Release,p) - * *** IDirect3D methods *** - * #define IDirect3D_Initialize(p,a) ICOM_CALL1(Initialize,p,a) - * #define IDirect3D_EnumDevices(p,a,b) ICOM_CALL2(EnumDevice,p,a,b) - * #define IDirect3D_CreateLight(p,a,b) ICOM_CALL2(CreateLight,p,a,b) - * #define IDirect3D_CreateMaterial(p,a,b) ICOM_CALL2(CreateMaterial,p,a,b) - * #define IDirect3D_CreateViewport(p,a,b) ICOM_CALL2(CreateViewport,p,a,b) - * #define IDirect3D_FindDevice(p,a,b) ICOM_CALL2(FindDevice,p,a,b) - * #endif - * - * Comments: - * - The ICOM_INTERFACE macro is used in the ICOM_METHOD macros to define the type of the 'this' - * pointer. Defining this macro here saves us the trouble of having to repeat the interface - * name everywhere. Note however that because of the way macros work, a macro like ICOM_METHOD1 - * cannot use 'ICOM_INTERFACE##_VTABLE' because this would give 'ICOM_INTERFACE_VTABLE' and not - * 'IDirect3D_VTABLE'. - * - ICOM_METHODS defines the methods specific to this interface. It is then aggregated with the - * inherited methods to form ICOM_IMETHODS. - * - ICOM_IMETHODS defines the list of methods that are inheritable from this interface. It must - * be written manually (rather than using a macro to generate the equivalent code) to avoid - * macro recursion (which compilers don't like). - * - The ICOM_DEFINE finally declares all the structures necessary for the interface. We have to - * explicitly use the interface name for macro expansion reasons again. - * Inherited methods are inherited in C by using the IDirect3D_METHODS macro and the parent's - * Xxx_IMETHODS macro. In C++ we need only use the IDirect3D_METHODS since method inheritance - * is taken care of by the language. - * - In C++ the ICOM_METHOD macros generate a function prototype and a call to a function pointer - * method. This means using once 't1 p1, t2 p2, ...' and once 'p1, p2' without the types. The - * only way I found to handle this is to have one ICOM_METHOD macro per number of parameters and - * to have it take only the type information (with const if necessary) as parameters. - * The 'undef ICOM_INTERFACE' is here to remind you that using ICOM_INTERFACE in the following - * macros will not work. This time it's because the ICOM_CALL macro expansion is done only once - * the 'IDirect3D_Xxx' macro is expanded. And by that time ICOM_INTERFACE will be long gone - * anyway. - * - You may have noticed the double commas after each parameter type. This allows you to put the - * name of that parameter which I think is good for documentation. It is not required and since - * I did not know what to put there for this example (I could only find doc about IDirect3D2), - * I left them blank. - * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access - * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate - * the inherited method definitions there. This time I could have used a trick to use only one - * macro whatever the number of parameters but I prefered to have it work the same way as above. - * - You probably have noticed that we don't define the fields we need to actually implement this - * interface: reference count, pointer to other resources and miscellaneous fields. That's - * because these interfaces are just that: interfaces. They may be implemented more than once, in - * different contexts and sometimes not even in Wine. Thus it would not make sense to impose - * that the interface contains some specific fields. - * - * - * In C this gives: - * typedef struct IDirect3DVtbl IDirect3DVtbl; - * struct IDirect3D { - * IDirect3DVtbl* lpVtbl; - * }; - * struct IDirect3DVtbl { - * HRESULT (*QueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj); - * ULONG (*QueryInterface)(IDirect3D* me); - * ULONG (*QueryInterface)(IDirect3D* me); - * HRESULT (*Initialize)(IDirect3D* me, REFIID a); - * HRESULT (*EnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b); - * HRESULT (*CreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b); - * HRESULT (*CreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b); - * HRESULT (*CreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b); - * HRESULT (*FindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b); - * }; - * - * #ifdef ICOM_CINTERFACE - * *** IUnknown methods *** - * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) - * #define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p) - * #define IDirect3D_Release(p) (p)->lpVtbl->Release(p) - * *** IDirect3D methods *** - * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) - * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevice(p,a,b) - * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) - * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) - * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) - * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) - * #endif - * - * Comments: - * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing - * the user needs to know to use the interface. Of course the structure we will define to - * implement this interface will have more fields but the first one will match this pointer. - * - The code generated by ICOM_DEFINE defines both the structure representing the interface and - * the structure for the jump table. ICOM_DEFINE uses the parent's Xxx_IMETHODS macro to - * automatically repeat the prototypes of all the inherited methods and then uses IDirect3D_METHODS - * to define the IDirect3D methods. - * - Each method is declared as a pointer to function field in the jump table. The implementation - * will fill this jump table with appropriate values, probably using a static variable, and - * initialize the lpVtbl field to point to this variable. - * - The IDirect3D_Xxx macros then just derefence the lpVtbl pointer and use the function pointer - * corresponding to the macro name. This emulates the behavior of a virtual table and should be - * just as fast. - * - This C code should be quite compatible with the Windows headers both for code that uses COM - * interfaces and for code implementing a COM interface. - * - * - * And in C++ (with gcc's g++): - * - * typedef struct IDirect3D: public IUnknown { - * private: HRESULT (*Initialize)(IDirect3D* me, REFIID a); - * public: inline HRESULT Initialize(REFIID a) { return ((IDirect3D*)t.lpVtbl)->Initialize(this,a); }; - * private: HRESULT (*EnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b); - * public: inline HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b) - * { return ((IDirect3D*)t.lpVtbl)->EnumDevices(this,a,b); }; - * private: HRESULT (*freateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b); - * public: inline HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b) - * { return ((IDirect3D*)t.lpVtbl)->CreateLight(this,a,b); }; - * private: HRESULT (*CreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b); - * public: inline HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b) - * { return ((IDirect3D*)t.lpVtbl)->CreateMaterial(this,a,b); }; - * private: HRESULT (*CreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b); - * public: inline HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b) - * { return ((IDirect3D*)t.lpVtbl)->CreateViewport(this,a,b); }; - * private: HRESULT (*FindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b); - * public: inline HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b) - * { return ((IDirect3D*)t.lpVtbl)->FindDevice(this,a,b); }; - * }; - * - * Comments: - * - In C++ IDirect3D does double duty as both the virtual/jump table and as the interface - * definition. The reason for this is to avoid having to duplicate the mehod definitions: once - * to have the function pointers in the jump table and once to have the methods in the interface - * class. Here one macro can generate both. This means though that the first pointer, t.lpVtbl - * defined in IUnknown, must be interpreted as the jump table pointer if we interpret the - * structure as the the interface class, and as the function pointer to the QueryInterface - * method, t.QueryInterface, if we interpret the structure as the jump table. Fortunately this - * gymnastic is entirely taken care of in the header of IUnknown. - * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions. - * - Since IDirect3D does double duty, each ICOM_METHOD macro defines both a function pointer and - * a non-vritual inline method which dereferences it and calls it. This way this method behaves - * just like a virtual method but does not create a true C++ virtual table which would break the - * structure layout. If you look at the implementation of these methods you'll notice that they - * would not work for void functions. We have to return something and fortunately this seems to - * be what all the COM methods do (otherwise we would need another set of macros). - * - Note how the ICOM_METHOD generates both function prototypes mixing types and formal parameter - * names and the method invocation using only the formal parameter name. This is the reason why - * we need different macros to handle different numbers of parameters. - * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE - * macro is defined in which case we would not be here. - * - This C++ code works well for code that just uses COM interfaces. But it will not work with - * C++ code implement a COM interface. That's because such code assumes the interface methods - * are declared as virtual C++ methods which is not the case here. - * - * - * Implementing a COM interface. - * - * This continues the above example. This example assumes that the implementation is in C. - * - * typedef struct _IDirect3D { - * void* lpVtbl; - * ... - * - * } _IDirect3D; - * - * static ICOM_VTABLE(IDirect3D) d3dvt; - * - * ***implement the IDirect3D methods here**** - * - * int IDirect3D_QueryInterface(IDirect3D* me) - * { - * ICOM_THIS(IDirect3D,me); - * ... - * } - * - * ... - * - * static ICOM_VTABLE(IDirect3D) d3dvt = { - * ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - * IDirect3D_QueryInterface, - * IDirect3D_Add, - * IDirect3D_Add2, - * IDirect3D_Initialize, - * IDirect3D_SetWidth - * }; - * - * Comments: - * - We first define what the interface really contains. This is th e_IDirect3D structure. The - * first field must of course be the virtual table pointer. Everything else is free. - * - Then we predeclare our static virtual table variable, we will need its address in some - * methods to initialize the virtual table pointer of the returned interface objects. - * - Then we implement the interface methods. To match what has been declared in the header file - * they must take a pointer to a IDirect3D structure and we must cast it to an _IDirect3D so that - * we can manipulate the fields. This is performed by the ICOM_THIS macro. - * - Finally we initialize the virtual table. - */ - - - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define ICOM_CINTERFACE 1 -#endif - -#ifndef ICOM_CINTERFACE -/* C++ interface */ - -#define ICOM_METHOD(ret,xfn) \ - public: virtual ret CALLBACK (xfn)(void) = 0; -#define ICOM_METHOD1(ret,xfn,ta,na) \ - public: virtual ret CALLBACK (xfn)(ta a) = 0; -#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \ - public: virtual ret CALLBACK (xfn)(ta a,tb b) = 0; -#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \ - public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c) = 0; -#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \ - public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d) = 0; -#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ - public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e) = 0; -#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ - public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0; -#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ - public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0; -#define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ - public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0; -#define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ - public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i) = 0; -#define ICOM_METHOD10(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ - public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j) = 0; -#define ICOM_METHOD11(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ - public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k) = 0; - - -#define ICOM_VMETHOD(xfn) \ - public: virtual void CALLBACK (xfn)(void) = 0; -#define ICOM_VMETHOD1(xfn,ta,na) \ - public: virtual void CALLBACK (xfn)(ta a) = 0; -#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \ - public: virtual void CALLBACK (xfn)(ta a,tb b) = 0; -#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \ - public: virtual void CALLBACK (xfn)(ta a,tb b,tc c) = 0; -#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \ - public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d) = 0; -#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ - public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e) = 0; -#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ - public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0; -#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ - public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0; -#define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ - public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0; -#define ICOM_VMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ - public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i) = 0; -#define ICOM_VMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ - public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i, tj j) = 0; -#define ICOM_VMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ - public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i, tj j, tk k) = 0; - - -#ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE - -#define ICOM_DEFINE(iface,ibase) \ - typedef struct iface: public ibase { \ - iface##_METHODS \ - } __attribute__ ((com_interface)); - -#else - -#define ICOM_DEFINE(iface,ibase) \ - typedef struct iface: public ibase { \ - iface##_METHODS \ - }; - -#endif /* ICOM_USE_COM_INTERFACE_ATTRIBUTE */ - -#define ICOM_VTBL(iface) (iface) - -#else -/* C interface */ - -#define ICOM_METHOD(ret,xfn) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me); -#define ICOM_METHOD1(ret,xfn,ta,na) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a); -#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b); -#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); -#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); -#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); -#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); -#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); -#define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); -#define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); -#define ICOM_METHOD10(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); -#define ICOM_METHOD11(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ - ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); - -#define ICOM_VMETHOD(xfn) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me); -#define ICOM_VMETHOD1(xfn,ta,na) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a); -#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b); -#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); -#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); -#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); -#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); -#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); -#define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,nh) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); -#define ICOM_VMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ni) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); -#define ICOM_VMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,nj) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); -#define ICOM_VMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,nk) \ - void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); - - -#define ICOM_VTABLE(iface) iface##Vtbl -#define ICOM_VFIELD(iface) ICOM_VTABLE(iface)* lpVtbl -#define ICOM_VTBL(iface) (iface)->lpVtbl - -#ifdef ICOM_MSVTABLE_COMPAT -#define ICOM_DEFINE(iface,ibase) \ - typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \ - struct iface { \ - const ICOM_VFIELD(iface); \ - }; \ - struct ICOM_VTABLE(iface) { \ - long dummyRTTI1; \ - long dummyRTTI2; \ - ibase##_IMETHODS \ - iface##_METHODS \ - }; -#define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 0,0, - -#else -#define ICOM_DEFINE(iface,ibase) \ - typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \ - struct iface { \ - const ICOM_VFIELD(iface); \ - }; \ - struct ICOM_VTABLE(iface) { \ - ibase##_IMETHODS \ - iface##_METHODS \ - }; -#define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE -#endif /* ICOM_MSVTABLE_COMPAT */ - - -#define ICOM_THIS(impl,iface) impl* const This=(impl*)iface -#define ICOM_CTHIS(impl,iface) const impl* const This=(const impl*)iface - -#endif /*ICOM_CINTERFACE */ - -#define ICOM_CALL(xfn, p) ICOM_VTBL(p)->xfn(p) -#define ICOM_CALL1(xfn, p,a) ICOM_VTBL(p)->xfn(p,a) -#define ICOM_CALL2(xfn, p,a,b) ICOM_VTBL(p)->xfn(p,a,b) -#define ICOM_CALL3(xfn, p,a,b,c) ICOM_VTBL(p)->xfn(p,a,b,c) -#define ICOM_CALL4(xfn, p,a,b,c,d) ICOM_VTBL(p)->xfn(p,a,b,c,d) -#define ICOM_CALL5(xfn, p,a,b,c,d,e) ICOM_VTBL(p)->xfn(p,a,b,c,d,e) -#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f) -#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g) -#define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h) -#define ICOM_CALL9(xfn, p,a,b,c,d,e,f,g,h,i) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h,i) -#define ICOM_CALL10(xfn, p,a,b,c,d,e,f,g,h,i,j) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h,i,j) -#define ICOM_CALL11(xfn, p,a,b,c,d,e,f,g,h,i,j,k) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h,i,j,k) - - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IClassFactory, 0x00000001L, 0, 0); -typedef struct IClassFactory IClassFactory, *LPCLASSFACTORY; - -DEFINE_OLEGUID(IID_IMalloc, 0x00000002L, 0, 0); -typedef struct IMalloc IMalloc,*LPMALLOC; - -DEFINE_OLEGUID(IID_IUnknown, 0x00000000L, 0, 0); -typedef struct IUnknown IUnknown, *LPUNKNOWN; - - -/***************************************************************************** - * IUnknown interface - */ -#define ICOM_INTERFACE IUnknown -#define IUnknown_IMETHODS \ - ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj) \ - ICOM_METHOD (ULONG,AddRef) \ - ICOM_METHOD (ULONG,Release) -#ifdef ICOM_CINTERFACE -typedef struct ICOM_VTABLE(IUnknown) ICOM_VTABLE(IUnknown); -struct IUnknown { - ICOM_VFIELD(IUnknown); -#if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE) -} __attribute__ ((com_interface)); -#else -}; -#endif /* ICOM_US_COM_INTERFACE_ATTRIBUTE */ - -struct ICOM_VTABLE(IUnknown) { -#ifdef ICOM_MSVTABLE_COMPAT - long dummyRTTI1; - long dummyRTTI2; -#endif /* ICOM_MSVTABLE_COMPAT */ - -#else /* ICOM_CINTERFACE */ -struct IUnknown { - -#endif /* ICOM_CINTERFACE */ - - ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj) - ICOM_METHOD (ULONG,AddRef) - ICOM_METHOD (ULONG,Release) -#if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE) -} __attribute__ ((com_interface)); -#else -}; -#endif /* ICOM_US_COM_INTERFACE_ATTRIBUTE */ - -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IUnknown_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IUnknown_AddRef(p) ICOM_CALL (AddRef,p) -#define IUnknown_Release(p) ICOM_CALL (Release,p) - -/***************************************************************************** - * IClassFactory interface - */ -#define ICOM_INTERFACE IClassFactory -#define IClassFactory_METHODS \ - ICOM_METHOD3(HRESULT,CreateInstance, LPUNKNOWN,pUnkOuter, REFIID,riid, LPVOID*,ppvObject) \ - ICOM_METHOD1(HRESULT,LockServer, BOOL,fLock) -#define IClassFactory_IMETHODS \ - IUnknown_IMETHODS \ - IClassFactory_METHODS -ICOM_DEFINE(IClassFactory,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IClassFactory_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IClassFactory_AddRef(p) ICOM_CALL (AddRef,p) -#define IClassFactory_Release(p) ICOM_CALL (Release,p) -/*** IClassFactory methods ***/ -#define IClassFactory_CreateInstance(p,a,b,c) ICOM_CALL3(CreateInstance,p,a,b,c) -#define IClassFactory_LockServer(p,a) ICOM_CALL1(LockServer,p,a) - - -/***************************************************************************** - * IMalloc interface - */ -#define ICOM_INTERFACE IMalloc -#define IMalloc_METHODS \ - ICOM_METHOD1 (LPVOID,Alloc, DWORD,cb) \ - ICOM_METHOD2 (LPVOID,Realloc, LPVOID,pv, DWORD,cb) \ - ICOM_VMETHOD1( Free, LPVOID,pv) \ - ICOM_METHOD1(DWORD, GetSize, LPVOID,pv) \ - ICOM_METHOD1(INT, DidAlloc, LPVOID,pv) \ - ICOM_METHOD (VOID, HeapMinimize) -#define IMalloc_IMETHODS \ - IUnknown_IMETHODS \ - IMalloc_METHODS -ICOM_DEFINE(IMalloc,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IMalloc_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IMalloc_AddRef(p) ICOM_CALL (AddRef,p) -#define IMalloc_Release(p) ICOM_CALL (Release,p) -/*** IMalloc methods ***/ -#define IMalloc_Alloc(p,a) ICOM_CALL1(Alloc,p,a) -#define IMalloc_Realloc(p,a,b) ICOM_CALL2(Realloc,p,a,b) -#define IMalloc_Free(p,a) ICOM_CALL1(Free,p,a) -#define IMalloc_GetSize(p,a) ICOM_CALL1(GetSize,p,a) -#define IMalloc_DidAlloc(p,a) ICOM_CALL1(DidAlloc,p,a) -#define IMalloc_HeapMinimize(p) ICOM_CALL (HeapMinimize,p) - -/* values passed to CoGetMalloc */ -#define MEMCTX_TASK 1 /* private task memory */ -#define MEMCTX_SHARED 2 /* shared memory */ -#ifdef _MAC -#define MEMCTX_MACSYSTEM 3 /* system heap on mac */ -#endif -/* mainly for internal use... */ -#define MEMCTX_UNKNOWN -1 -#define MEMCTX_SAME -2 - -HRESULT WINAPI CoGetMalloc(DWORD dwMemContext,LPMALLOC* lpMalloc); - -LPVOID WINAPI CoTaskMemAlloc(ULONG size); - -void WINAPI CoTaskMemFree(LPVOID ptr); - -/* FIXME: unimplemented */ -LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size); - - -/***************************************************************************** - * Additional API - */ - -typedef enum tagCOINIT -{ - COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */ - COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */ - COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */ - COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */ -} COINIT; - -HRESULT WINAPI CoCreateGuid(GUID* pguid); - -HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree); - -VOID WINAPI CoFreeAllLibraries(VOID); - -VOID WINAPI CoFreeLibrary(HINSTANCE hLibrary); - -VOID WINAPI CoFreeUnusedLibraries(VOID); - -HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv); - -HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv); - -HRESULT WINAPI CoInitialize(LPVOID lpReserved); -HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit); - -VOID WINAPI CoUninitialize(VOID); - -/* FIXME: not implemented */ -BOOL WINAPI CoIsOle1Class(REFCLSID rclsid); - -HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases); - -/* class registration flags; passed to CoRegisterClassObject */ -typedef enum tagREGCLS -{ - REGCLS_SINGLEUSE = 0, - REGCLS_MULTIPLEUSE = 1, - REGCLS_MULTI_SEPARATE = 2, - REGCLS_SUSPENDED = 4 -} REGCLS; - -HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister); - -HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister); - -BOOL WINAPI IsValidInterface( - LPUNKNOWN punk); - -HRESULT WINAPI GetClassFile(LPOLESTR filePathName,CLSID *pclsid); - - -/***************************************************************************** - * COM Server dll - exports - */ -HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv); -HRESULT WINAPI DllCanUnloadNow(VOID); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* __WINE_WINE_OBJ_BASE_H */ diff --git a/reactos/include/ole32/obj_cache.h b/reactos/include/ole32/obj_cache.h deleted file mode 100644 index cca4e1822c2..00000000000 --- a/reactos/include/ole32/obj_cache.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to structured data storage. - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_CACHE_H -#define __WINE_WINE_OBJ_CACHE_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Declare the structures - */ - - -/***************************************************************************** - * Predeclare the interfaces - */ - -DEFINE_OLEGUID(IID_IOleCache, 0x0000011eL, 0, 0); -typedef struct IOleCache IOleCache, *LPOLECACHE; - -DEFINE_OLEGUID(IID_IOleCache2, 0x00000128L, 0, 0); -typedef struct IOleCache2 IOleCache2, *LPOLECACHE2; - -DEFINE_OLEGUID(IID_IOleCacheControl, 0x00000129L, 0, 0); -typedef struct IOleCacheControl IOleCacheControl, *LPOLECACHECONTROL; - -/***************************************************************************** - * IOleCache interface - */ -#define ICOM_INTERFACE IOleCache -#define IOleCache_METHODS \ - ICOM_METHOD3(HRESULT,Cache, FORMATETC*,pformatetc, DWORD,advf, DWORD*, pdwConnection) \ - ICOM_METHOD1(HRESULT,Uncache, DWORD,dwConnection) \ - ICOM_METHOD1(HRESULT,EnumCache, IEnumSTATDATA**,ppenumSTATDATA) \ - ICOM_METHOD1(HRESULT,InitCache, IDataObject*,pDataObject) \ - ICOM_METHOD3(HRESULT,SetData, FORMATETC*,pformatetc, STGMEDIUM*,pmedium, BOOL,fRelease) -#define IOleCache_IMETHODS \ - IUnknown_IMETHODS \ - IOleCache_METHODS -ICOM_DEFINE(IOleCache,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleCache_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleCache_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleCache_Release(p) ICOM_CALL (Release,p) -/*** IOleCache methods ***/ -#define IOleCache_Cache(p,a,b,c) ICOM_CALL3(Cache,p,a,b,c) -#define IOleCache_Uncache(p,a) ICOM_CALL1(Uncache,p,a) -#define IOleCache_EnumCache(p,a) ICOM_CALL1(EnumCache,p,a) -#define IOleCache_InitCache(p,a) ICOM_CALL1(InitCache,p,a) -#define IOleCache_SetData(p,a,b,c) ICOM_CALL3(SetData,p,a,b,c) - - -/***************************************************************************** - * IOleCache2 interface - */ -#define ICOM_INTERFACE IOleCache2 -#define IOleCache2_METHODS \ - ICOM_METHOD3(HRESULT,UpdateCache, LPDATAOBJECT,pDataObject, DWORD,grfUpdf, LPVOID,pReserved) \ - ICOM_METHOD1(HRESULT,DiscardCache, DWORD,dwDiscardOptions) -#define IOleCache2_IMETHODS \ - IOleCache_IMETHODS \ - IOleCache2_METHODS -ICOM_DEFINE(IOleCache2,IOleCache) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleCache2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleCache2_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleCache2_Release(p) ICOM_CALL (Release,p) -/*** IOleCache methods ***/ -#define IOleCache2_Cache(p,a,b,c) ICOM_CALL3(Cache,p,a,b,c) -#define IOleCache2_Uncache(p,a) ICOM_CALL1(Uncache,p,a) -#define IOleCache2_EnumCache(p,a) ICOM_CALL1(EnumCache,p,a) -#define IOleCache2_InitCache(p,a) ICOM_CALL1(InitCache,p,a) -#define IOleCache2_SetData(p,a,b,c) ICOM_CALL3(SetData,p,a,b,c) -/*** IOleCache2 methods ***/ -#define IOleCache2_UpdateCache(p,a,b,c) ICOM_CALL3(UpdateCache,p,a,b,c) -#define IOleCache2_DiscardCache(p,a) ICOM_CALL1(DiscardCache,p,a) - - -/***************************************************************************** - * IOleCacheControl interface - */ -#define ICOM_INTERFACE IOleCacheControl -#define IOleCacheControl_METHODS \ - ICOM_METHOD1(HRESULT,OnRun, LPDATAOBJECT,pDataObject) \ - ICOM_METHOD (HRESULT,OnStop) -#define IOleCacheControl_IMETHODS \ - IUnknown_IMETHODS \ - IOleCacheControl_METHODS -ICOM_DEFINE(IOleCacheControl,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleCacheControl_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleCacheControl_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleCacheControl_Release(p) ICOM_CALL (Release,p) -/*** IOleCacheControl methods ***/ -#define IOleCacheControl_OnRun(p,a) ICOM_CALL1(UpdateCache,p,a) -#define IOleCacheControl_OnStop(p) ICOM_CALL (OnStop,p) - - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_CONTROL_H */ - - diff --git a/reactos/include/ole32/obj_channel.h b/reactos/include/ole32/obj_channel.h deleted file mode 100644 index 843f53eeec5..00000000000 --- a/reactos/include/ole32/obj_channel.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Defines undocumented Microsoft COM interfaces and APIs seemingly related to some 'channel' notion. - */ - -#ifndef __WINE_WINE_OBJ_CHANNEL_H -#define __WINE_WINE_OBJ_CHANNEL_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_GUID (IID_IChannelHook, 0x1008c4a0L, 0x7613, 0x11cf, 0x9a, 0xf1, 0x00, 0x20, 0xaf, 0x6e, 0x72, 0xf4); -typedef struct IChannelHook IChannelHook,*LPCHANNELHOOK; - -DEFINE_GUID (IID_IPSFactoryBuffer, 0xd5f569d0L, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a); -typedef struct IPSFactoryBuffer IPSFactoryBuffer,*LPPSFACTORYBUFFER; - -DEFINE_GUID (IID_IRpcChannelBuffer, 0xd5f56b60L, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a); -typedef struct IRpcChannelBuffer IRpcChannelBuffer,*LPRPCCHANNELBUFFER; - -DEFINE_GUID (IID_IRpcProxyBuffer, 0xd5f56a34L, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a); -typedef struct IRpcProxyBuffer IRpcProxyBuffer,*LPRPCPROXYBUFFER; - -DEFINE_GUID (IID_IRpcStubBuffer, 0xd5f56afcL, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a); -typedef struct IRpcStubBuffer IRpcStubBuffer,*LPRPCSTUBBUFFER; - - -/***************************************************************************** - * IChannelHook interface - */ -#define ICOM_INTERFACE IChannelHook -#define IChannelHook_METHODS \ - ICOM_VMETHOD3(ClientGetSize, REFGUID,uExtent, REFIID,riid, ULONG*,pDataSize) \ - ICOM_VMETHOD4(ClientFillBuffer, REFGUID,uExtent, REFIID,riid, ULONG*,pDataSize, void*,pDataBuffer) \ - ICOM_VMETHOD6(ClientNotify, REFGUID,uExtent, REFIID,riid, ULONG,cbDataSize, void*,pDataBuffer, DWORD,lDataRep, HRESULT,hrFault) \ - ICOM_VMETHOD5(ServerNotify, REFGUID,uExtent, REFIID,riid, ULONG,cbDataSize, void*,pDataBuffer, DWORD,lDataRep) \ - ICOM_VMETHOD4(ServerGetSize, REFGUID,uExtent, REFIID,riid, HRESULT,hrFault, ULONG*,pDataSize) \ - ICOM_VMETHOD5(ServerFillBuffer, REFGUID,uExtent, REFIID,riid, ULONG*,pDataSize, void*,pDataBuffer, HRESULT,hrFault) -#define IChannelHook_IMETHODS \ - IUnknown_IMETHODS \ - IChannelHook_METHODS -ICOM_DEFINE(IChannelHook,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IChannelHook_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IChannelHook_AddRef(p) ICOM_CALL (AddRef,p) -#define IChannelHook_Release(p) ICOM_CALL (Release,p) -/*** IChannelHook methods ***/ -#define IChannelHook_ClientGetSize(p,a,b,c) ICOM_CALL(ClientGetSize,p,a,b,c) -#define IChannelHook_ClientFillBuffer(p,a,b,c,d) ICOM_CALL(ClientFillBuffer,p,a,b,c,d) -#define IChannelHook_ClientNotify(p,a,b,c,d,e,f) ICOM_CALL(ClientNotify,p,a,b,c,d,e,f) -#define IChannelHook_ServerNotify(p,a,b,c,d,e) ICOM_CALL(ServerNotify,p,a,b,c,d,e) -#define IChannelHook_ServerGetSize(p,a,b,c,d) ICOM_CALL(ServerGetSize,p,a,b,c,d) -#define IChannelHook_ServerFillBuffer(p,a,b,c,d,e) ICOM_CALL(ServerFillBuffer,p,a,b,c,d,e) - - -/***************************************************************************** - * IPSFactoryBuffer interface - */ -#define ICOM_INTERFACE IPSFactoryBuffer -#define IPSFactoryBuffer_METHODS \ - ICOM_METHOD4(HRESULT,CreateProxy, IUnknown*,pUnkOuter, REFIID,riid, IRpcProxyBuffer**,ppProxy, void**,ppv) \ - ICOM_METHOD3(HRESULT,CreateStub, REFIID,riid, IUnknown*,pUnkServer, IRpcStubBuffer**,ppStub) -#define IPSFactoryBuffer_IMETHODS \ - IUnknown_IMETHODS \ - IPSFactoryBuffer_METHODS -ICOM_DEFINE(IPSFactoryBuffer,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPSFactoryBuffer_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPSFactoryBuffer_AddRef(p) ICOM_CALL (AddRef,p) -#define IPSFactoryBuffer_Release(p) ICOM_CALL (Release,p) -/*** IPSFactoryBuffer methods ***/ -#define IPSFactoryBuffer_CreateProxy(p,a,b,c,d) ICOM_CALL4(CreateProxy,p,a,b,c,d) -#define IPSFactoryBuffer_CreateStub(p,a,b,c) ICOM_CALL3(CreateStub,p,a,b,c) - - -/***************************************************************************** - * IRpcChannelBuffer interface - */ -typedef unsigned long RPCOLEDATAREP; - -typedef struct tagRPCOLEMESSAGE -{ - void* reserved1; - RPCOLEDATAREP dataRepresentation; - void* Buffer; - ULONG cbBuffer; - ULONG iMethod; - void* reserved2[5]; - ULONG rpcFlags; -} RPCOLEMESSAGE, *PRPCOLEMESSAGE; - -#define ICOM_INTERFACE IRpcChannelBuffer -#define IRpcChannelBuffer_METHODS \ - ICOM_METHOD2(HRESULT,GetBuffer, RPCOLEMESSAGE*,pMessage, REFIID,riid) \ - ICOM_METHOD2(HRESULT,SendReceive, RPCOLEMESSAGE*,pMessage, ULONG*,pStatus) \ - ICOM_METHOD1(HRESULT,FreeBuffer, RPCOLEMESSAGE*,pMessage) \ - ICOM_METHOD2(HRESULT,GetDestCtx, DWORD*,pdwDestContext, void**,ppvDestContext) \ - ICOM_METHOD (HRESULT,IsConnected) -#define IRpcChannelBuffer_IMETHODS \ - IUnknown_IMETHODS \ - IRpcChannelBuffer_METHODS -ICOM_DEFINE(IRpcChannelBuffer,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IRpcChannelBuffer_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IRpcChannelBuffer_AddRef(p) ICOM_CALL (AddRef,p) -#define IRpcChannelBuffer_Release(p) ICOM_CALL (Release,p) -/*** IRpcChannelBuffer methods ***/ -#define IRpcChannelBuffer_GetBuffer(p,a,b) ICOM_CALL2(GetBuffer,p,a,b) -#define IRpcChannelBuffer_SendReceive(p,a,b) ICOM_CALL2(SendReceive,p,a,b) -#define IRpcChannelBuffer_FreeBuffer(p,a) ICOM_CALL1(FreeBuffer,p,a) -#define IRpcChannelBuffer_GetDestCtx(p,a,b) ICOM_CALL2(GetDestCtx,p,a,b) -#define IRpcChannelBuffer_IsConnected(p) ICOM_CALL (IsConnected,p) - - -/***************************************************************************** - * IRpcProxyBuffer interface - */ -#define ICOM_INTERFACE IRpcProxyBuffer -#define IRpcProxyBuffer_METHODS \ - ICOM_METHOD1(HRESULT,Connect, IRpcChannelBuffer*,pRpcChannelBuffer) \ - ICOM_VMETHOD( Disconnect) -#define IRpcProxyBuffer_IMETHODS \ - IUnknown_IMETHODS \ - IRpcProxyBuffer_METHODS -ICOM_DEFINE(IRpcProxyBuffer,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IRpcProxyBuffer_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IRpcProxyBuffer_AddRef(p) ICOM_CALL (AddRef,p) -#define IRpcProxyBuffer_Release(p) ICOM_CALL (Release,p) -/*** IRpcProxyBuffer methods ***/ -#define IRpcProxyBuffer_Connect(p,a) ICOM_CALL2(Connect,p,a) -#define IRpcProxyBuffer_Disconnect(p) ICOM_CALL (Disconnect,p) - - -/***************************************************************************** - * IRpcStubBuffer interface - */ -#define ICOM_INTERFACE IRpcStubBuffer -#define IRpcStubBuffer_METHODS \ - ICOM_METHOD1 (HRESULT, Connect, IUnknown*,pUnkServer) \ - ICOM_VMETHOD ( Disconnect) \ - ICOM_METHOD2 (HRESULT, Invoke, RPCOLEMESSAGE*,_prpcmsg, IRpcChannelBuffer*,_pRpcChannelBuffer) \ - ICOM_METHOD1 (LPRPCCHANNELBUFFER,IsIIDSupported, REFIID,riid) \ - ICOM_METHOD (ULONG, CountRefs) \ - ICOM_METHOD1 (HRESULT, DebugServerQueryInterface, void**,ppv) \ - ICOM_VMETHOD1( DebugServerRelease, void*,pv) -#define IRpcStubBuffer_IMETHODS \ - IUnknown_IMETHODS \ - IRpcStubBuffer_METHODS -ICOM_DEFINE(IRpcStubBuffer,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IRpcStubBuffer_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IRpcStubBuffer_AddRef(p) ICOM_CALL (AddRef,p) -#define IRpcStubBuffer_Release(p) ICOM_CALL (Release,p) -/*** IRpcStubBuffer methods ***/ -#define IRpcStubBuffer_Connect(p,a) ICOM_CALL1(Connect,p,a) -#define IRpcStubBuffer_Disconnect(p) ICOM_CALL (Disconnect,p) -#define IRpcStubBuffer_Invoke(p,a,b) ICOM_CALL2(Invoke,p,a,b) -#define IRpcStubBuffer_IsIIDSupported(p,a) ICOM_CALL1(IsIIDSupported,p,a) -#define IRpcStubBuffer_CountRefs(p) ICOM_CALL (CountRefs,p) -#define IRpcStubBuffer_DebugServerQueryInterface(p,a) ICOM_CALL1(DebugServerQueryInterface,p,a) -#define IRpcStubBuffer_DebugServerRelease(p,a) ICOM_CALL1(DebugServerRelease,p,a) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_CHANNEL_H */ diff --git a/reactos/include/ole32/obj_clientserver.h b/reactos/include/ole32/obj_clientserver.h deleted file mode 100644 index 8c01cbd5cb3..00000000000 --- a/reactos/include/ole32/obj_clientserver.h +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to client/server aspects. - */ - -#ifndef __WINE_WINE_OBJ_CLIENTSERVER_H -#define __WINE_WINE_OBJ_CLIENTSERVER_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IClientSecurity, 0x0000013dL, 0, 0); -typedef struct IClientSecurity IClientSecurity,*LPCLIENTSECURITY; - -DEFINE_OLEGUID(IID_IExternalConnection, 0x00000019L, 0, 0); -typedef struct IExternalConnection IExternalConnection,*LPEXTERNALCONNECTION; - -DEFINE_OLEGUID(IID_IMessageFilter, 0x00000016L, 0, 0); -typedef struct IMessageFilter IMessageFilter,*LPMESSAGEFILTER; - -DEFINE_OLEGUID(IID_IServerSecurity, 0x0000013eL, 0, 0); -typedef struct IServerSecurity IServerSecurity,*LPSERVERSECURITY; - - -/***************************************************************************** - * IClientSecurity interface - */ -typedef struct tagSOLE_AUTHENTICATION_SERVICE -{ - DWORD dwAuthnSvc; - DWORD dwAuthzSvc; - OLECHAR* pPrincipalName; - HRESULT hr; -} SOLE_AUTHENTICATION_SERVICE, *PSOLE_AUTHENTICATION_SERVICE; - -typedef enum tagEOLE_AUTHENTICATION_CAPABILITIES -{ - EOAC_NONE = 0x0, - EOAC_MUTUAL_AUTH = 0x1, - EOAC_SECURE_REFS = 0x2, - EOAC_ACCESS_CONTROL = 0x4 -} EOLE_AUTHENTICATION_CAPABILITIES; - -#define ICOM_INTERFACE IClientSecurity -#define IClientSecurity_METHODS \ - ICOM_METHOD8(HRESULT,QueryBlanket, IUnknown*,pProxy, DWORD*,pAuthnSvc, DWORD*,pAuthzSvc, OLECHAR**,pServerPrincName, DWORD*,pAuthnLevel, DWORD*,pImpLevel, void**,pAuthInfo, DWORD*,pCapabilites) \ - ICOM_METHOD8(HRESULT,SetBlanket, IUnknown*,pProxy, DWORD,pAuthnSvc, DWORD,pAuthzSvc, OLECHAR*,pServerPrincName, DWORD,pAuthnLevel, DWORD,pImpLevel, void*,pAuthInfo, DWORD,pCapabilites) \ - ICOM_METHOD2(HRESULT,CopyProxy, IUnknown*,pProxy, IUnknown**,ppCopy) -#define IClientSecurity_IMETHODS \ - IUnknown_IMETHODS \ - IClientSecurity_METHODS -ICOM_DEFINE(IClientSecurity,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IClientSecurity_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IClientSecurity_AddRef(p) ICOM_CALL (AddRef,p) -#define IClientSecurity_Release(p) ICOM_CALL (Release,p) -/*** IClientSecurity methods ***/ -#define IClientSecurity_QueryBlanket(p,a,b,c,d,e,f,g,h) ICOM_CALL8(QueryBlanket,p,a,b,c,d,e,f,g,h) -#define IClientSecurity_SetBlanket(p,a,b,c,d,e,f,g,h) ICOM_CALL8(SetBlanket,p,a,b,c,d,e,f,g,h) -#define IClientSecurity_CopyProxy(p,a,b) ICOM_CALL2(CopyProxy,p,a,b) - - -/***************************************************************************** - * IExternalConnection interface - */ -typedef enum tagEXTCONN -{ - EXTCONN_STRONG = 0x1, - EXTCONN_WEAK = 0x2, - EXTCONN_CALLABLE = 0x4 -} EXTCONN; - -#define ICOM_INTERFACE IExternalConnection -#define IExternalConnection_METHODS \ - ICOM_METHOD2(DWORD,AddConnection, DWORD,extconn, DWORD,reserved) \ - ICOM_METHOD3(DWORD,ReleaseConnection, DWORD,extconn, DWORD,reserved, BOOL,fLastReleaseCloses) -#define IExternalConnection_IMETHODS \ - IUnknown_IMETHODS \ - IExternalConnection_METHODS -ICOM_DEFINE(IExternalConnection,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IExternalConnection_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IExternalConnection_AddRef(p) ICOM_CALL (AddRef,p) -#define IExternalConnection_Release(p) ICOM_CALL (Release,p) -/*** IExternalConnection methods ***/ -#define IExternalConnection_AddConnection(p,a,b) ICOM_CALL8(AddConnection,p,a,b) -#define IExternalConnection_ReleaseConnection(p,a,b,c) ICOM_CALL8(ReleaseConnection,p,a,b,c) - - -HRESULT WINAPI CoDisconnectObject(LPUNKNOWN lpUnk, DWORD reserved); - - -/***************************************************************************** - * IMessageFilter interface - */ -typedef enum tagCALLTYPE -{ - CALLTYPE_TOPLEVEL = 1, - CALLTYPE_NESTED = 2, - CALLTYPE_ASYNC = 3, - CALLTYPE_TOPLEVEL_CALLPENDING = 4, - CALLTYPE_ASYNC_CALLPENDING = 5 -} CALLTYPE; - -typedef enum tagSERVERCALL -{ - SERVERCALL_ISHANDLED = 0, - SERVERCALL_REJECTED = 1, - SERVERCALL_RETRYLATER = 2 -} SERVERCALL; - -typedef enum tagPENDINGTYPE -{ - PENDINGTYPE_TOPLEVEL = 1, - PENDINGTYPE_NESTED = 2 -} PENDINGTYPE; - -typedef enum tagPENDINGMSG -{ - PENDINGMSG_CANCELCALL = 0, - PENDINGMSG_WAITNOPROCESS = 1, - PENDINGMSG_WAITDEFPROCESS = 2 -} PENDINGMSG; - -typedef struct tagINTERFACEINFO -{ - IUnknown* pUnk; - IID iid; - WORD wMethod; -} INTERFACEINFO,*LPINTERFACEINFO; - -#if 0 -#define ICOM_INTERFACE IMessageFilter -#define IMessageFilter_METHODS \ - ICOM_METHOD4(DWORD,HandleInComingCall, DWORD,dwCallType, HTASK,htaskCaller, DWORD,dwTickCount, LPINTERFACEINFO,lpInterfaceInfo) \ - ICOM_METHOD3(DWORD,RetryRejectedCall, HTASK,htaskCallee, DWORD,dwTickCount, DWORD,dwRejectType) \ - ICOM_METHOD3(DWORD,MessagePending, HTASK,htaskCallee, DWORD,dwTickCount, DWORD,dwRejectType) -#define IMessageFilter_IMETHODS \ - IUnknown_IMETHODS \ - IMessageFilter_METHODS -ICOM_DEFINE(IMessageFilter,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IMessageFilter_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IMessageFilter_AddRef(p) ICOM_CALL (AddRef,p) -#define IMessageFilter_Release(p) ICOM_CALL (Release,p) -/*** IMessageFilter methods ***/ -#define IMessageFilter_HandleInComingCall(p,a,b,c,d) ICOM_CALL4(HandleInComingCall,p,a,b,c,d) -#define IMessageFilter_RetryRejectedCall(p,a,b,c) ICOM_CALL3(RetryRejectedCall,p,a,b,c) -#define IMessageFilter_MessagePending(p,a,b,c) ICOM_CALL3(MessagePending,p,a,b,c) - - -HRESULT WINAPI CoRegisterMessageFilter16(LPMESSAGEFILTER lpMessageFilter,LPMESSAGEFILTER *lplpMessageFilter); -HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter,LPMESSAGEFILTER *lplpMessageFilter); -#endif - -/***************************************************************************** - * IServerSecurity interface - */ -#define ICOM_INTERFACE IServerSecurity -#define IServerSecurity_METHODS \ - ICOM_METHOD7(HRESULT,QueryBlanket, DWORD*,pAuthnSvc, DWORD*,pAuthzSvc, OLECHAR**,pServerPrincName, DWORD*,pAuthnLevel, DWORD*,pImpLevel, void**,pPrivs, DWORD*,pCapabilities) \ - ICOM_METHOD (HRESULT,ImpersonateClient) \ - ICOM_METHOD (HRESULT,RevertToSelf) \ - ICOM_METHOD (BOOL, IsImpersonating) -#define IServerSecurity_IMETHODS \ - IUnknown_IMETHODS \ - IServerSecurity_METHODS -ICOM_DEFINE(IServerSecurity,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IServerSecurity_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IServerSecurity_AddRef(p) ICOM_CALL (AddRef,p) -#define IServerSecurity_Release(p) ICOM_CALL (Release,p) -/*** IServerSecurity methods ***/ -#define IServerSecurity_QueryBlanket(p,a,b,c,d,e,f,g) ICOM_CALL7(QueryBlanket,p,a,b,c,d,e,f,g) -#define IServerSecurity_ImpersonateClient(p) ICOM_CALL (ImpersonateClient,p) -#define IServerSecurity_RevertToSelf(p) ICOM_CALL (RevertToSelf,p) -#define IServerSecurity_IsImpersonating(p) ICOM_CALL (IsImpersonating,p) - - -/***************************************************************************** - * Additional client API - */ -#if 0 -/* FIXME: not implemented */ -HRESULT WINAPI CoCopyProxy(IUnknown* pProxy, IUnknown** ppCopy); - -/* FIXME: not implemented */ -HRESULT WINAPI CoQueryProxyBlanket(IUnknown* pProxy, DWORD* pwAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTH_IDENTITY_HANDLE* pAuthInfo, DWORD* pCapabilites); - -/* FIXME: not implemented */ -HRESULT WINAPI CoSetProxyBlanket(IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel, RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities); -#endif - -/***************************************************************************** - * Additional server API - */ - -#if 0 -/* FIXME: not implemented */ -ULONG WINAPI CoAddRefServerProcess(void); - -/* FIXME: not implemented */ -HRESULT WINAPI CoImpersonateClient(void); - -/* FIXME: not implemented */ -HRESULT WINAPI CoQueryClientBlanket(DWORD* pAuthnSvc, DWORD* pAuthzSvc, OLECHAR16** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTHZ_HANDLE* pPrivs, DWORD* pCapabilities); - -/* FIXME: not implemented */ -HRESULT WINAPI CoReleaseServerProcess(void); - -/* FIXME: not implemented */ -HRESULT WINAPI CoRevertToSelf(void); - -/* FIXME: not implemented */ -HRESULT WINAPI CoSuspendClassObjects(void); -#endif - -/***************************************************************************** - * Additional API - */ - -/* FIXME: not implemented */ -HRESULT WINAPI CoGetCallContext(REFIID riid, void** ppInterface); - -/* FIXME: not implemented */ -HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID* pClsid); - -/* FIXME: not implemented */ -HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, SOLE_AUTHENTICATION_SERVICE* asAuthSvc, void* pReserved1, DWORD dwAuthnLevel, DWORD dwImpLevel, void* pReserved2, DWORD dwCapabilities, void* pReserved3); - -/* FIXME: not implemented */ -BOOL WINAPI CoIsHandlerConnected(LPUNKNOWN pUnk); - -/* FIXME: not implemented */ -HRESULT WINAPI CoQueryAuthenticationServices(DWORD* pcAuthSvc, SOLE_AUTHENTICATION_SERVICE** asAuthSvc); - -/* FIXME: not implemented */ -HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid); - -/* FIXME: not implemented */ -HRESULT WINAPI CoResumeClassObjects(void); - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_CLIENTSERVER_H */ diff --git a/reactos/include/ole32/obj_commdlgbrowser.h b/reactos/include/ole32/obj_commdlgbrowser.h deleted file mode 100644 index ac3cec110b8..00000000000 --- a/reactos/include/ole32/obj_commdlgbrowser.h +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************ - * ICommDlgBrowser - */ - -#ifndef __WINE_WINE_OBJ_COMMDLGBROWSER_H -#define __WINE_WINE_OBJ_COMMDLGBROWSER_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -typedef struct ICommDlgBrowser ICommDlgBrowser, *LPCOMMDLGBROWSER; - -/* for OnStateChange*/ -#define CDBOSC_SETFOCUS 0x00000000 -#define CDBOSC_KILLFOCUS 0x00000001 -#define CDBOSC_SELCHANGE 0x00000002 -#define CDBOSC_RENAME 0x00000003 - - -#define ICOM_INTERFACE ICommDlgBrowser -#define ICommDlgBrowser_METHODS \ - ICOM_METHOD1(HRESULT, OnDefaultCommand, IShellView*, IShellView) \ - ICOM_METHOD2(HRESULT, OnStateChange, IShellView*, IShellView, ULONG, uChange) \ - ICOM_METHOD2(HRESULT, IncludeObject, IShellView*, IShellView, LPCITEMIDLIST, pidl) -#define ICommDlgBrowser_IMETHODS \ - IUnknown_IMETHODS \ - ICommDlgBrowser_METHODS -ICOM_DEFINE(ICommDlgBrowser,IUnknown) -#undef ICOM_INTERFACE - -#define ICommDlgBrowser_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ICommDlgBrowser_AddRef(p) ICOM_CALL(AddRef,p) -#define ICommDlgBrowser_Release(p) ICOM_CALL(Release,p) -#define ICommDlgBrowser_OnDefaultCommand(p,a) ICOM_CALL1(OnDefaultCommand,p,a) -#define ICommDlgBrowser_OnStateChange(p,a,b) ICOM_CALL2(OnStateChange,p,a,b) -#define ICommDlgBrowser_IncludeObject(p,a,b) ICOM_CALL2(IncludeObject,p,a,b) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_COMMDLGBROWSER_H */ diff --git a/reactos/include/ole32/obj_connection.h b/reactos/include/ole32/obj_connection.h deleted file mode 100644 index 0dd92eb60ae..00000000000 --- a/reactos/include/ole32/obj_connection.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to structured data storage. - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_CONNECTION_H -#define __WINE_WINE_OBJ_CONNECTION_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Declare the structures - */ - -typedef struct tagCONNECTDATA -{ - IUnknown *pUnk; - DWORD dwCookie; -} CONNECTDATA, *LPCONNECTDATA; - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_GUID(IID_IConnectionPoint, 0xb196b286, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IConnectionPoint IConnectionPoint, *LPCONNECTIONPOINT; - -DEFINE_GUID(IID_IConnectionPointContainer, 0xb196b284, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IConnectionPointContainer IConnectionPointContainer, *LPCONNECTIONPOINTCONTAINER; - -DEFINE_GUID(IID_IEnumConnections, 0xb196b287, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IEnumConnections IEnumConnections, *LPENUMCONNECTIONS; - -DEFINE_GUID(IID_IEnumConnectionPoints, 0xb196b285, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IEnumConnectionPoints IEnumConnectionPoints, *LPENUMCONNECTIONPOINTS; - -/***************************************************************************** - * IConnectionPoint interface - */ -#define ICOM_INTERFACE IConnectionPoint -#define IConnectionPoint_METHODS \ - ICOM_METHOD1(HRESULT,GetConnectionInterface, IID*,pIID) \ - ICOM_METHOD1(HRESULT,GetConnectionPointContainer, IConnectionPointContainer**,ppCPC) \ - ICOM_METHOD2(HRESULT,Advise, IUnknown*,pUnkSink, DWORD*,pdwCookie) \ - ICOM_METHOD1(HRESULT,Unadvise, DWORD,dwCookie) \ - ICOM_METHOD1(HRESULT,EnumConnections, IEnumConnections**,ppEnum) -#define IConnectionPoint_IMETHODS \ - IUnknown_IMETHODS \ - IConnectionPoint_METHODS -ICOM_DEFINE(IConnectionPoint,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IConnectionPoint_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IConnectionPoint_AddRef(p) ICOM_CALL (AddRef,p) -#define IConnectionPoint_Release(p) ICOM_CALL (Release,p) -/*** IConnectionPointContainer methods ***/ -#define IConnectionPoint_GetConnectionInterface(p,a) ICOM_CALL1(GetConnectionInterface,p,a) -#define IConnectionPoint_GetConnectionPointContainer(p,a) ICOM_CALL1(GetConnectionPointContainer,p,a) -#define IConnectionPoint_Advise(p,a,b) ICOM_CALL2(Advise,p,a,b) -#define IConnectionPoint_Unadvise(p,a) ICOM_CALL1(Unadvise,p,a) -#define IConnectionPoint_EnumConnections(p,a) ICOM_CALL1(EnumConnections,p,a) - - -/***************************************************************************** - * IConnectionPointContainer interface - */ -#define ICOM_INTERFACE IConnectionPointContainer -#define IConnectionPointContainer_METHODS \ - ICOM_METHOD1(HRESULT,EnumConnectionPoints, IEnumConnectionPoints**,ppEnum) \ - ICOM_METHOD2(HRESULT,FindConnectionPoint, REFIID,riid, IConnectionPoint**,ppCP) -#define IConnectionPointContainer_IMETHODS \ - IUnknown_IMETHODS \ - IConnectionPointContainer_METHODS -ICOM_DEFINE(IConnectionPointContainer,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IConnectionPointContainer_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IConnectionPointContainer_AddRef(p) ICOM_CALL (AddRef,p) -#define IConnectionPointContainer_Release(p) ICOM_CALL (Release,p) -/*** IConnectionPointContainer methods ***/ -#define IConnectionPointContainer_EnumConnectionPoints(p,a) ICOM_CALL1(EnumConnectionPoints,p,a) -#define IConnectionPointContainer_FindConnectionPoint(p,a,b) ICOM_CALL2(FindConnectionPoint,p,a,b) - - -/***************************************************************************** - * IEnumConnections interface - */ -#define ICOM_INTERFACE IEnumConnections -#define IEnumConnections_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,cConnections, LPCONNECTDATA,rgcd, ULONG*,pcFectched) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,cConnections) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumConnections**,ppEnum) -#define IEnumConnections_IMETHODS \ - IUnknown_IMETHODS \ - IEnumConnections_METHODS -ICOM_DEFINE(IEnumConnections,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumConnections_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumConnections_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumConnections_Release(p) ICOM_CALL (Release,p) -/*** IConnectionPointContainer methods ***/ -#define IEnumConnections_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumConnections_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumConnections_Reset(p) ICOM_CALL (Reset,p) -#define IEnumConnections_Clone(p,a) ICOM_CALL1(Clone,p,a) - -/***************************************************************************** - * IEnumConnectionPoints interface - */ -#define ICOM_INTERFACE IEnumConnectionPoints -#define IEnumConnectionPoints_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,cConnections, LPCONNECTIONPOINT*,ppCP, ULONG*,pcFectched) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,cConnections) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumConnections**,ppEnum) -#define IEnumConnectionPoints_IMETHODS \ - IUnknown_IMETHODS \ - IEnumConnectionPoints_METHODS -ICOM_DEFINE(IEnumConnectionPoints,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumConnectionPoints_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumConnectionPoints_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumConnectionPoints_Release(p) ICOM_CALL (Release,p) -/*** IConnectionPointContainer methods ***/ -#define IEnumConnectionPoints_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumConnectionPoints_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumConnectionPoints_Reset(p) ICOM_CALL (Reset,p) -#define IEnumConnectionPoints_Clone(p,a) ICOM_CALL1(Clone,p,a) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_CONTROL_H */ - - diff --git a/reactos/include/ole32/obj_contextmenu.h b/reactos/include/ole32/obj_contextmenu.h deleted file mode 100644 index 30e8538a32e..00000000000 --- a/reactos/include/ole32/obj_contextmenu.h +++ /dev/null @@ -1,125 +0,0 @@ -/************************************************************ - * IContextMenu - * - * Undocumented: - * word95 gets a IContextMenu Interface and calls HandleMenuMsg() - * whitch should only a member of IContextMenu2. - */ - -#ifndef __WINE_WINE_OBJ_CONTEXTMENU_H -#define __WINE_WINE_OBJ_CONTEXTMENU_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -typedef struct IContextMenu IContextMenu, *LPCONTEXTMENU; - -/* QueryContextMenu uFlags */ -#define CMF_NORMAL 0x00000000 -#define CMF_DEFAULTONLY 0x00000001 -#define CMF_VERBSONLY 0x00000002 -#define CMF_EXPLORE 0x00000004 -#define CMF_NOVERBS 0x00000008 -#define CMF_CANRENAME 0x00000010 -#define CMF_NODEFAULT 0x00000020 -#define CMF_INCLUDESTATIC 0x00000040 -#define CMF_RESERVED 0xffff0000 /* View specific */ - -/* GetCommandString uFlags */ -#define GCS_VERBA 0x00000000 /* canonical verb */ -#define GCS_HELPTEXTA 0x00000001 /* help text (for status bar) */ -#define GCS_VALIDATEA 0x00000002 /* validate command exists */ -#define GCS_VERBW 0x00000004 /* canonical verb (unicode) */ -#define GCS_HELPTEXTW 0x00000005 /* help text (unicode version) */ -#define GCS_VALIDATEW 0x00000006 /* validate command exists (unicode) */ -#define GCS_UNICODE 0x00000004 /* for bit testing - Unicode string */ - -#define GCS_VERB GCS_VERBA -#define GCS_HELPTEXT GCS_HELPTEXTA -#define GCS_VALIDATE GCS_VALIDATEA - -#define CMDSTR_NEWFOLDERA "NewFolder" -#define CMDSTR_VIEWLISTA "ViewList" -#define CMDSTR_VIEWDETAILSA "ViewDetails" -static const WCHAR CMDSTR_NEWFOLDERW[] = {'N','e','w','F','o','l','d','e','r',0}; -static const WCHAR CMDSTR_VIEWLISTW [] = {'V','i','e','w','L','i','s','t',0}; -static const WCHAR CMDSTR_VIEWDETAILSW[] = {'V','i','e','w','D','e','t','a','i','l','s',0}; - -#define CMDSTR_NEWFOLDER CMDSTR_NEWFOLDERA -#define CMDSTR_VIEWLIST CMDSTR_VIEWLISTA -#define CMDSTR_VIEWDETAILS CMDSTR_VIEWDETAILSA - -#define CMIC_MASK_HOTKEY SEE_MASK_HOTKEY -#define CMIC_MASK_ICON SEE_MASK_ICON -#define CMIC_MASK_FLAG_NO_UI SEE_MASK_FLAG_NO_UI -#define CMIC_MASK_UNICODE SEE_MASK_UNICODE -#define CMIC_MASK_NO_CONSOLE SEE_MASK_NO_CONSOLE -#define CMIC_MASK_HASLINKNAME SEE_MASK_HASLINKNAME -#define CMIC_MASK_FLAG_SEP_VDM SEE_MASK_FLAG_SEPVDM -#define CMIC_MASK_HASTITLE SEE_MASK_HASTITLE -#define CMIC_MASK_ASYNCOK SEE_MASK_ASYNCOK - -#define CMIC_MASK_PTINVOKE 0x20000000 - -/*NOTE: When SEE_MASK_HMONITOR is set, hIcon is treated as hMonitor */ -typedef struct tagCMINVOKECOMMANDINFO -{ DWORD cbSize; /* sizeof(CMINVOKECOMMANDINFO) */ - DWORD fMask; /* any combination of CMIC_MASK_* */ - HWND hwnd; /* might be NULL (indicating no owner window) */ - LPCSTR lpVerb; /* either a string or MAKEINTRESOURCE(idOffset) */ - LPCSTR lpParameters; /* might be NULL (indicating no parameter) */ - LPCSTR lpDirectory; /* might be NULL (indicating no specific directory) */ - INT nShow; /* one of SW_ values for ShowWindow() API */ - - DWORD dwHotKey; - HANDLE hIcon; -} CMINVOKECOMMANDINFO, *LPCMINVOKECOMMANDINFO; - -typedef struct tagCMInvokeCommandInfoEx -{ DWORD cbSize; /* must be sizeof(CMINVOKECOMMANDINFOEX) */ - DWORD fMask; /* any combination of CMIC_MASK_* */ - HWND hwnd; /* might be NULL (indicating no owner window) */ - LPCSTR lpVerb; /* either a string or MAKEINTRESOURCE(idOffset) */ - LPCSTR lpParameters; /* might be NULL (indicating no parameter) */ - LPCSTR lpDirectory; /* might be NULL (indicating no specific directory) */ - INT nShow; /* one of SW_ values for ShowWindow() API */ - - DWORD dwHotKey; - - HANDLE hIcon; - LPCSTR lpTitle; /* For CreateProcess-StartupInfo.lpTitle */ - LPCWSTR lpVerbW; /* Unicode verb (for those who can use it) */ - LPCWSTR lpParametersW; /* Unicode parameters (for those who can use it) */ - LPCWSTR lpDirectoryW; /* Unicode directory (for those who can use it) */ - LPCWSTR lpTitleW; /* Unicode title (for those who can use it) */ - POINT ptInvoke; /* Point where it's invoked */ - -} CMINVOKECOMMANDINFOEX, *LPCMINVOKECOMMANDINFOEX; - -#define ICOM_INTERFACE IContextMenu -#define IContextMenu_METHODS \ - ICOM_METHOD5(HRESULT, QueryContextMenu, HMENU, hmenu, UINT, indexMenu, UINT, idCmdFirst, UINT, idCmdLast, UINT, uFlags) \ - ICOM_METHOD1(HRESULT, InvokeCommand, LPCMINVOKECOMMANDINFO, lpici) \ - ICOM_METHOD5(HRESULT, GetCommandString, UINT, idCmd, UINT, uType, UINT*, pwReserved, LPSTR, pszName, UINT, cchMax) \ - ICOM_METHOD3(HRESULT, HandleMenuMsg, UINT, uMsg, WPARAM, wParam, LPARAM, lParam) \ - void * guard; /*possibly another nasty entry from ContextMenu3 ?*/ -#define IContextMenu_IMETHODS \ - IUnknown_IMETHODS \ - IContextMenu_METHODS -ICOM_DEFINE(IContextMenu,IUnknown) -#undef ICOM_INTERFACE - -#define IContextMenu_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IContextMenu_AddRef(p) ICOM_CALL(AddRef,p) -#define IContextMenu_Release(p) ICOM_CALL(Release,p) -#define IContextMenu_QueryContextMenu(p,a,b,c,d,e) ICOM_CALL5(QueryContextMenu,p,a,b,c,d,e) -#define IContextMenu_InvokeCommand(p,a) ICOM_CALL1(InvokeCommand,p,a) -#define IContextMenu_GetCommandString(p,a,b,c,d,e) ICOM_CALL5(GetCommandString,p,a,b,c,d,e) -#define IContextMenu_HandleMenuMsg(p,a,b,c) ICOM_CALL3(HandleMenuMsg,p,a,b,c) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_CONTEXTMENU_H */ diff --git a/reactos/include/ole32/obj_control.h b/reactos/include/ole32/obj_control.h deleted file mode 100644 index e08d307b757..00000000000 --- a/reactos/include/ole32/obj_control.h +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to structured data storage. - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_CONTROL_H -#define __WINE_WINE_OBJ_CONTROL_H - -struct tagMSG; - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Declare the structures - */ -typedef enum tagGUIDKIND -{ - GUIDKIND_DEFAULT_SOURCE_DISP_IID = 1 -} GUIDKIND; - -typedef enum tagREADYSTATE -{ - READYSTATE_UNINITIALIZED = 0, - READYSTATE_LOADING = 1, - READYSTATE_LOADED = 2, - READYSTATE_INTERACTIVE = 3, - READYSTATE_COMPLETE = 4 -} READYSTATE; - -typedef struct tagExtentInfo -{ - ULONG cb; - DWORD dwExtentMode; - SIZEL sizelProposed; -} DVEXTENTINFO; - -typedef struct tagVARIANT_BLOB -{ - DWORD clSize; - DWORD rpcReserved; - ULONGLONG ahData[1]; -} wireVARIANT_BLOB; - -typedef struct tagUserVARIANT -{ - wireVARIANT_BLOB pVarBlob; -} UserVARIANT; - -typedef struct tagLICINFO -{ - LONG cbLicInfo; - BOOL fRuntimeKeyAvail; - BOOL fLicVerified; -} LICINFO, *LPLICINFO; - -typedef struct tagCONTROLINFO -{ - ULONG cb; - HACCEL hAccel; - USHORT cAccel; - DWORD dwFlags; -} CONTROLINFO, *LPCONTROLINFO; - -typedef enum tagCTRLINFO -{ - CTRLINFO_EATS_RETURN = 1, - CTRLINFO_EATS_ESCAPE = 2 -} CTRLINFO; - -typedef struct tagPOINTF -{ - FLOAT x; - FLOAT y; -} POINTF, *LPPOINTF; - -typedef enum tagXFORMCOORDS -{ - XFORMCOORDS_POSITION = 0x1, - XFORMCOORDS_SIZE = 0x2, - XFORMCOORDS_HIMETRICTOCONTAINER = 0x4, - XFORMCOORDS_CONTAINERTOHIMETRIC = 0x8 -} XFORMCOORDS; - -typedef enum tagACTIVATEFLAGS -{ - ACTIVATE_WINDOWLESS = 1 -} ACTIVATE_FLAGS; - -typedef enum tagOLEDCFLAGS -{ - OLEDC_NODRAW = 0x1, - OLEDC_PAINTBKGND = 0x2, - OLEDC_OFFSCREEN = 0x4 -} OLEDCFLAGS; - -typedef enum tagDVASPECT2 -{ - DVASPECT_OPAQUE = 16, - DVASPECT_TRANSPARENT = 32 -} DVASPECT2; - -typedef enum tagHITRESULT -{ - HITRESULT_OUTSIDE = 0, - HITRESULT_TRANSPARENT = 1, - HITRESULT_CLOSE = 2, - HITRESULT_HIT = 3 -} HITRESULT; - -typedef enum tagAspectInfoFlag -{ - DVASPECTINFOFLAG_CANOPTIMIZE = 1 -} DVASPECTINFOFLAG; - -typedef struct tagAspectInfo -{ - ULONG cb; - DWORD dwFlags; -} DVASPECTINFO; - -typedef enum tagVIEWSTATUS -{ - VIEWSTATUS_OPAQUE = 1, - VIEWSTATUS_SOLIDBKGND = 2, - VIEWSTATUS_DVASPECTOPAQUE = 4, - VIEWSTATUS_DVASPECTTRANSPARENT = 8 -} VIEWSTATUS; - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_GUID(IID_IOleControl, 0xb196b288, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IOleControl IOleControl, *LPOLECONTROL; - -DEFINE_GUID(IID_IOleControlSite, 0xb196b289, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IOleControlSite IOleControlSite, *LPOLECONTROLSITE; - -DEFINE_GUID(IID_IOleInPlaceSiteEx, 0x9c2cad80L, 0x3424, 0x11cf, 0xb6, 0x70, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8); -typedef struct IOleInPlaceSiteEx IOleInPlaceSiteEx, *LPOLEINPLACESITEEX; - -DEFINE_OLEGUID(IID_IOleInPlaceSiteWindowless, 0x00000000L, 0, 0); /* FIXME - NEED GUID */ -typedef struct IOleInPlaceSiteWindowless IOleInPlaceSiteWindowless, *LPOLEINPLACESITEWINDOWLESS; - -DEFINE_OLEGUID(IID_IOleInPlaceObjectWindowless, 0x00000000L, 0, 0); /* FIXME - NEED GUID */ -typedef struct IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless, *LPOLEINPLACEOBJECTWINDOWLESS; - -DEFINE_GUID(IID_IClassFactory2, 0xb196b28f, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IClassFactory2 IClassFactory2, *LPCLASSFACTORY2; - -DEFINE_GUID(IID_IViewObjectEx, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); /* FIXME need GUID */ -typedef struct IViewObjectEx IViewObjectEx, *LPVIEWOBJECTEX; - -DEFINE_GUID(IID_IProvideClassInfo, 0xb196b283, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IProvideClassInfo IProvideClassInfo, *LPPROVIDECLASSINFO; - -DEFINE_GUID(IID_IProvideClassInfo2, 0xa6bc3ac0, 0xdbaa, 0x11ce, 0x9d, 0xe3, 0x00, 0xaa, 0x00, 0x4b, 0xb8, 0x51); -typedef struct IProvideClassInfo2 IProvideClassInfo2, *LPPROVIDECLASSINFO2; - -/***************************************************************************** - * IOleControl interface - */ -#define ICOM_INTERFACE IOleControl -#define IOleControl_METHODS \ - ICOM_METHOD1(HRESULT,GetControlInfo, CONTROLINFO*,pCI) \ - ICOM_METHOD1(HRESULT,OnMnemonic, struct tagMSG*,pMsg) \ - ICOM_METHOD1(HRESULT,OnAmbientPropertyChange, DISPID,dispID) \ - ICOM_METHOD1(HRESULT,FreezeEvents, BOOL,bFreeze) -#define IOleControl_IMETHODS \ - IUnknown_IMETHODS \ - IOleControl_METHODS -ICOM_DEFINE(IOleControl,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleControl_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleControl_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleControl_Release(p) ICOM_CALL (Release,p) -/*** IOleControl methods ***/ -#define IOleControl_GetControlInfo(p,a) ICOM_CALL1(GetControlInfo,p,a) -#define IOleControl_OnMnemonic(p,a) ICOM_CALL1(OnMnemonic,p,a) -#define IOleControl_OnAmbientPropertyChange(p,a) ICOM_CALL1(OnAmbientPropertyChange,p,a) -#define IOleControl_FreezeEvents(p,a) ICOM_CALL1(FreezeEvents,p,a) - - -/***************************************************************************** - * IOleControlSite interface - */ -#define ICOM_INTERFACE IOleControlSite -#define IOleControlSite_METHODS \ - ICOM_METHOD (HRESULT,OnControlInfoChanged) \ - ICOM_METHOD1(HRESULT,LockInPlaceActive, BOOL,fLock) \ - ICOM_METHOD1(HRESULT,GetExtendedControl, IDispatch**,ppDisp) \ - ICOM_METHOD3(HRESULT,TransformCoords, POINTL*,pPtlHimetric, POINTF*,pPtfContainer, DWORD,dwFlags) \ - ICOM_METHOD2(HRESULT,TranslateAccelerator, struct tagMSG*,pMsg, DWORD,grfModifiers) \ - ICOM_METHOD1(HRESULT,OnFocus, BOOL,fGotFocus) \ - ICOM_METHOD (HRESULT,ShowPropertyFrame) -#define IOleControlSite_IMETHODS \ - IUnknown_IMETHODS \ - IOleControlSite_METHODS -ICOM_DEFINE(IOleControlSite,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleControlSite_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleControlSite_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleControlSite_Release(p) ICOM_CALL (Release,p) -/*** IOleControlSite methods ***/ -#define IOleControlSite_OnControlInfoChanged(p) ICOM_CALL1(OnControlInfoChanged,p) -#define IOleControlSite_LockInPlaceActive(p,a) ICOM_CALL1(LockInPlaceActive,p,a) -#define IOleControlSite_GetExtendedControl(p,a) ICOM_CALL1(GetExtendedControl,p,a) -#define IOleControlSite_TransformCoords(p,a,b,c) ICOM_CALL1(TransformCoords,p,a,b,c) -#define IOleControlSite_TranslateAccelerator(p,a,b) ICOM_CALL1(TranslateAccelerator,p,a,b) -#define IOleControlSite_OnFocus(p,a) ICOM_CALL1(OnFocus,p,a) -#define IOleControlSite_ShowPropertyFrame(p) ICOM_CALL1(ShowPropertyFrame,p) - - -/***************************************************************************** - * IOleInPlaceSiteEx interface - */ -#define ICOM_INTERFACE IOleInPlaceSiteEx -#define IOleInPlaceSiteEx_METHODS \ - ICOM_METHOD2(HRESULT,OnInPlaceActivateEx, BOOL*,pfNoRedraw, DWORD,dwFlags) \ - ICOM_METHOD1(HRESULT,OnInPlaceDeactivateEx, BOOL,fNoRedraw) \ - ICOM_METHOD (HRESULT,RequestUIActivate) -#define IOleInPlaceSiteEx_IMETHODS \ - IOleInPlaceSite_IMETHODS \ - IOleInPlaceSiteEx_METHODS -ICOM_DEFINE(IOleInPlaceSiteEx,IOleInPlaceSite) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleInPlaceSiteEx_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleInPlaceSiteEx_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleInPlaceSiteEx_Release(p) ICOM_CALL (Release,p) -/*** IOleWindow methods ***/ -#define IOleInPlaceSiteEx_GetWindow(p,a) ICOM_CALL1(GetWindow,p,a) -#define IOleInPlaceSiteEx_ContextSensitiveHelp(p,a) ICOM_CALL1(ContextSensitiveHelp,p,a) -/*** IOleInPlaceSite methods ***/ -#define IOleInPlaceSiteEx_CanInPlaceActivate(p) ICOM_CALL (CanInPlaceActivate,p) -#define IOleInPlaceSiteEx_OnInPlaceActivate(p) ICOM_CALL (OnInPlaceActivate,p) -#define IOleInPlaceSiteEx_OnUIActivate(p) ICOM_CALL (OnUIActivate,p) -#define IOleInPlaceSiteEx_GetWindowContext(p,a,b,c,d,e) ICOM_CALL5(GetWindowContext,p,a,b,c,d,e) -#define IOleInPlaceSiteEx_Scroll(p,a) ICOM_CALL1(Scroll,p,a) -#define IOleInPlaceSiteEx_OnUIDeactivate(p,a) ICOM_CALL1(OnUIDeactivate,p,a) -#define IOleInPlaceSiteEx_OnInPlaceDeactivate(p) ICOM_CALL (OnInPlaceDeactivate,p) -#define IOleInPlaceSiteEx_DiscardUndoState(p) ICOM_CALL (DiscardUndoState,p) -#define IOleInPlaceSiteEx_DeactivateAndUndo(p) ICOM_CALL (DeactivateAndUndo,p) -#define IOleInPlaceSiteEx_OnPosRectChange(p,a) ICOM_CALL1(OnPosRectChange,p,a) -/*** IOleInPlaceSiteEx methods ***/ -#define IOleInPlaceSiteEx_OnInPlaceActivateEx(p,a,b) ICOM_CALL2(OnInPlaceActivateEx,p,a,b) -#define IOleInPlaceSiteEx_OnInPlaceDeactivateEx(p,a) ICOM_CALL1(OnInPlaceDeactivateEx,p,a) -#define IOleInPlaceSiteEx_RequestUIActivate(p) ICOM_CALL (RequestUIActivate,p) - - -/***************************************************************************** - * IOleInPlaceSiteWindowless interface - */ -#define ICOM_INTERFACE IOleInPlaceSiteWindowless -#define IOleInPlaceSiteWindowless_METHODS \ - ICOM_METHOD (HRESULT,CanWindowlessActivate) \ - ICOM_METHOD (HRESULT,GetCapture) \ - ICOM_METHOD1(HRESULT,SetCapture, BOOL,fCapture) \ - ICOM_METHOD (HRESULT,GetFocus) \ - ICOM_METHOD1(HRESULT,SetFocus, BOOL,fFocus) \ - ICOM_METHOD3(HRESULT,GetDC, LPCRECT,pRect, DWORD,grfFlags, HDC*,phDC) \ - ICOM_METHOD1(HRESULT,ReleaseDC, HDC,hDC) \ - ICOM_METHOD2(HRESULT,InvalidateRect, LPCRECT,pRect, BOOL,fErase) \ - ICOM_METHOD2(HRESULT,InvalidateRgn, HRGN,hRgn, BOOL,fErase) \ - ICOM_METHOD4(HRESULT,ScrollRect, INT,dx, INT,dy, LPCRECT,pRectScroll, LPCRECT,pRectClip) \ - ICOM_METHOD1(HRESULT,AdjustRect, LPRECT,prc) \ - ICOM_METHOD4(HRESULT,OnDefWindowMessage, UINT,msg, WPARAM,wParam, LPARAM,lParam, LRESULT*,plResult) -#define IOleInPlaceSiteWindowless_IMETHODS \ - IOleInPlaceSite_IMETHODS \ - IOleInPlaceSiteWindowless_METHODS -ICOM_DEFINE(IOleInPlaceSiteWindowless,IOleInPlaceSite) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleInPlaceSiteWindowless_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleInPlaceSiteWindowless_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleInPlaceSiteWindowless_Release(p) ICOM_CALL (Release,p) -/*** IOleWindow methods ***/ -#define IOleInPlaceSiteWindowless_GetWindow(p,a) ICOM_CALL1(GetWindow,p,a) -#define IOleInPlaceSiteWindowless_ContextSensitiveHelp(p,a) ICOM_CALL1(ContextSensitiveHelp,p,a) -/*** IOleInPlaceSitemethods ***/ -#define IOleInPlaceSiteWindowless_CanInPlaceActivate(p) ICOM_CALL (CanInPlaceActivate,p) -#define IOleInPlaceSiteWindowless_OnInPlaceActivate(p) ICOM_CALL (OnInPlaceActivate,p) -#define IOleInPlaceSiteWindowless_OnUIActivate(p) ICOM_CALL (OnUIActivate,p) -#define IOleInPlaceSiteWindowless_GetWindowContext(p,a,b,c,d,e) ICOM_CALL5(GetWindowContext,p,a,b,c,d,e) -#define IOleInPlaceSiteWindowless_Scroll(p,a) ICOM_CALL1(Scroll,p,a) -#define IOleInPlaceSiteWindowless_OnUIDeactivate(p,a) ICOM_CALL1(OnUIDeactivate,p,a) -#define IOleInPlaceSiteWindowless_OnInPlaceDeactivate(p) ICOM_CALL (OnInPlaceDeactivate,p) -#define IOleInPlaceSiteWindowless_DiscardUndoState(p) ICOM_CALL (DiscardUndoState,p) -#define IOleInPlaceSiteWindowless_DeactivateAndUndo(p) ICOM_CALL (DeactivateAndUndo,p) -#define IOleInPlaceSiteWindowless_OnPosRectChange(p,a) ICOM_CALL1(OnPosRectChange,p,a) -/*** IOleInPlaceSitemethods ***/ -#define IOleInPlaceSiteWindowless_CanWindowlessActivate(p) ICOM_CALL (CanInPlaceActivate,p) -#define IOleInPlaceSiteWindowless_GetCapture(p) ICOM_CALL (OnInPlaceActivate,p) -#define IOleInPlaceSiteWindowless_SetCapture(p,a) ICOM_CALL1(OnUIActivate,p,a) -#define IOleInPlaceSiteWindowless_GetFocus(p) ICOM_CALL (GetWindowContext,p) -#define IOleInPlaceSiteWindowless_SetFocus(p,a) ICOM_CALL1(Scroll,p,a) -#define IOleInPlaceSiteWindowless_GetDC(p,a,b,c) ICOM_CALL3(OnUIDeactivate,p,a,b,c) -#define IOleInPlaceSiteWindowless_ReleaseDC(p,a) ICOM_CALL1(OnInPlaceDeactivate,p,a) -#define IOleInPlaceSiteWindowless_InvalidateRect(p,a,b) ICOM_CALL2(DiscardUndoState,p,a,b) -#define IOleInPlaceSiteWindowless_InvalidateRgn(p,a,b) ICOM_CALL2(DeactivateAndUndo,p,a,b) -#define IOleInPlaceSiteWindowless_ScrollRect(p,a,b,c,d) ICOM_CALL4(OnPosRectChange,p,a,b,c,d) -#define IOleInPlaceSiteWindowless_AdjustRect(p,a) ICOM_CALL1(OnPosRectChange,p,a) -#define IOleInPlaceSiteWindowless_OnDefWindowMessage(p,a,b,c,d) ICOM_CALL4(OnPosRectChange,p,a,b,c,d) - - -/***************************************************************************** - * IOleInPlaceObjectWindowless interface - */ -#define ICOM_INTERFACE IOleInPlaceObjectWindowless -#define IOleInPlaceObjectWindowless_METHODS \ - ICOM_METHOD4(HRESULT,OnWindowMessage, UINT,msg, WPARAM,wParam, LPARAM,lParam, LRESULT*,plResult) \ - ICOM_METHOD1(HRESULT,GetDropTarget, IDropTarget**,ppDropTarget) -#define IOleInPlaceObjectWindowless_IMETHODS \ - IOleInPlaceObject_IMETHODS \ - IOleInPlaceObjectWindowless_METHODS -ICOM_DEFINE(IOleInPlaceObjectWindowless,IOleInPlaceObject) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleInPlaceObjectWindowless_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleInPlaceObjectWindowless_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleInPlaceObjectWindowless_Release(p) ICOM_CALL (Release,p) -/*** IOleWindow methods ***/ -#define IOleInPlaceObjectWindowless_GetWindow(p,a) ICOM_CALL1(GetWindow,p,a) -#define IOleInPlaceObjectWindowless_ContextSensitiveHelp(p,a) ICOM_CALL1(ContextSensitiveHelp,p,a) -/*** IOleInPlaceObject methods ***/ -#define IOleInPlaceObjectWindowless_InPlaceDeactivate(p) ICOM_CALL (InPlaceDeactivate,p) -#define IOleInPlaceObjectWindowless_UIDeactivate(p) ICOM_CALL (UIDeactivate,p) -#define IOleInPlaceObjectWindowless_SetObjectRects(p,a,b) ICOM_CALL2(SetObjectRects,p,a,b) -#define IOleInPlaceObjectWindowless_ReactivateAndUndo(p) ICOM_CALL (ReactivateAndUndo,p) -/*** IOleInPlaceObjectWindowless methods ***/ -#define IOleInPlaceObjectWindowless_OnWindowMessage(p,a,b,c,d) ICOM_CALL4(OnWindowMessage,p,a,b,c,d) -#define IOleInPlaceObjectWindowless_GetDropTarget(p,a) ICOM_CALL1(GetDropTarget,p,a) - - -/***************************************************************************** - * IClassFactory2 interface - */ -#define ICOM_INTERFACE IClassFactory2 -#define IClassFactory2_METHODS \ - ICOM_METHOD1(HRESULT,GetLicInfo, LICINFO*,pLicInfo) \ - ICOM_METHOD2(HRESULT,RequestLicKey, DWORD,dwReserved, BSTR*,pBstrKey) \ - ICOM_METHOD5(HRESULT,CreateInstanceLic, IUnknown*,pUnkOuter, IUnknown*,pUnkReserved, REFIID,riid, BSTR,bstrKey, PVOID*,ppvObj) -#define IClassFactory2_IMETHODS \ - IClassFactory_IMETHODS \ - IClassFactory2_METHODS -ICOM_DEFINE(IClassFactory2,IClassFactory) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IClassFactory2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IClassFactory2_AddRef(p) ICOM_CALL (AddRef,p) -#define IClassFactory2_Release(p) ICOM_CALL (Release,p) -/*** IClassFactory methods ***/ -#define IClassFactory2_CreateInstance(p,a,b,c) ICOM_CALL3(CreateInstance,p,a,b,c) -#define IClassFactory2_LockServer(p,a) ICOM_CALL1(LockServer,p,a) -/*** IClassFactory2 methods ***/ -#define IClassFactory2_GetLicInfo(p,a) ICOM_CALL1(GetLicInfo,p,a) -#define IClassFactory2_RequestLicKey(p,a,b) ICOM_CALL2(RequestLicKey,p,a,b) -#define IClassFactory2_CreateInstanceLic(p,a,b,c,d,e) ICOM_CALL5(CreateInstanceLic,p,a,b,c,d,e) - - -/***************************************************************************** - * IViewObject interface - */ -#define ICOM_INTERFACE IViewObjectEx -#define IViewObjectEx_METHODS \ - ICOM_METHOD2(HRESULT,GetRect, DWORD,dwAspect, LPRECTL,pRect) \ - ICOM_METHOD1(HRESULT,GetViewStatus, DWORD*,pdwStatus) \ - ICOM_METHOD5(HRESULT,QueryHitPoint, DWORD,dwAspect, LPCRECT,pRectBounds, POINT,ptlLoc, LONG,lCloseHint, DWORD*,pHitResult) \ - ICOM_METHOD5(HRESULT,QueryHitRect, DWORD,dwAspect, LPCRECT,pRectBounds, LPCRECT,pRectLoc, LONG,lCloseHint, DWORD*,pHitResult) \ - ICOM_METHOD6(HRESULT,GetNaturalExtent, DWORD,dwAspect, LONG,lindex, DVTARGETDEVICE*,ptd, HDC,hicTargetDev, DVEXTENTINFO*,pExtentInfo, LPSIZEL,pSizel) -#define IViewObjectEx_IMETHODS \ - IViewObject2_IMETHODS \ - IViewObjectEx_METHODS -ICOM_DEFINE(IViewObjectEx,IViewObject2) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IViewObjectEx_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IViewObjectEx_AddRef(p) ICOM_CALL (AddRef,p) -#define IViewObjectEx_Release(p) ICOM_CALL (Release,p) -/*** IViewObject methods ***/ -#define IViewObjectEx_Draw(p,a,b,c,d,e,f,g,h,i,j) ICOM_CALL10(Draw,p,a,b,c,d,e,f,g,h,i,j) -#define IViewObjectEx_GetColorSet(p,a,b,c,d,e,f) ICOM_CALL6(GetColorSet,p,a,b,c,d,e,f) -#define IViewObjectEx_Freeze(p,a,b,c,d) ICOM_CALL4(Freeze,p,a,b,c,d) -#define IViewObjectEx_Unfreeze(p,a) ICOM_CALL1(Unfreeze,p,a) -#define IViewObjectEx_SetAdvise(p,a,b,c) ICOM_CALL3(SetAdvise,p,a,b,c) -#define IViewObjectEx_GetAdvise(p,a,b,c) ICOM_CALL3(GetAdvise,p,a,b,c) -/*** IViewObject2 methods ***/ -#define IViewObjectEx_GetExtent(p,a,b,c,d) ICOM_CALL4(GetExtent,p,a,b,c,d) -/*** IViewObjectEx methods ***/ -#define IViewObjectEx_GetRect(p,a,b) ICOM_CALL2(GetRect,p,a,b) -#define IViewObjectEx_GetViewStatus(p,a) ICOM_CALL1(GetViewStatus,p,a) -#define IViewObjectEx_QueryHitPoint(p,a,b,c,d,e) ICOM_CALL5(QueryHitPoint,p,a,b,c,d,e) -#define IViewObjectEx_QueryHitRect(p,a,b,c,d,e) ICOM_CALL5(QueryHitRect,p,a,b,c,d,e) -#define IViewObjectEx_GetNaturalExtent(p,a,b,c,d,e,f) ICOM_CALL6(GetNaturalExtent,p,a,b,c,d,e,f) - - -/***************************************************************************** - * IProvideClassInfo interface - */ -#ifdef __WINE__ -#undef GetClassInfo -#endif - -#define ICOM_INTERFACE IProvideClassInfo -#define IProvideClassInfo_METHODS \ - ICOM_METHOD1(HRESULT,GetClassInfo, ITypeInfo**,ppTI) -#define IProvideClassInfo_IMETHODS \ - IUnknown_IMETHODS \ - IProvideClassInfo_METHODS -ICOM_DEFINE(IProvideClassInfo,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IProvideClassInfo_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IProvideClassInfo_AddRef(p) ICOM_CALL (AddRef,p) -#define IProvideClassInfo_Release(p) ICOM_CALL (Release,p) -/*** IProvideClassInfo methods ***/ -#define IProvideClassInfo_GetClassInfo(p,a) ICOM_CALL1(GetClassInfo,p,a) - - - -/***************************************************************************** - * IProvideClassInfo2 interface - */ -#define ICOM_INTERFACE IProvideClassInfo2 -#define IProvideClassInfo2_METHODS \ - ICOM_METHOD2(HRESULT,GetGUID, DWORD,dwGuidKind, GUID*,pGUID) -#define IProvideClassInfo2_IMETHODS \ - IProvideClassInfo_IMETHODS \ - IProvideClassInfo2_METHODS -ICOM_DEFINE(IProvideClassInfo2,IProvideClassInfo) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IProvideClassInfo2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IProvideClassInfo2_AddRef(p) ICOM_CALL (AddRef,p) -#define IProvideClassInfo2_Release(p) ICOM_CALL (Release,p) -/*** IProvideClassInfo methods ***/ -#define IProvideClassInfo2_GetClassInfo(p,a) ICOM_CALL1(GetClassInfo,p,a) -/*** IProvideClassInfo2 methods ***/ -#define IProvideClassInfo2_GetGUID(p,a,b) ICOM_CALL2(GetGUID,p,a,b) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_CONTROL_H */ diff --git a/reactos/include/ole32/obj_dataobject.h b/reactos/include/ole32/obj_dataobject.h deleted file mode 100644 index 25fca2d28db..00000000000 --- a/reactos/include/ole32/obj_dataobject.h +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to IDataObject. - * - */ - -#ifndef __WINE_WINE_OBJ_DATAOBJECT_H -#define __WINE_WINE_OBJ_DATAOBJECT_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the structures - */ -typedef enum tagDATADIR -{ - DATADIR_GET = 1, - DATADIR_SET = 2 -} DATADIR; - -typedef struct DVTARGETDEVICE16 DVTARGETDEVICE16, *LPDVTARGETDEVICE16; -typedef struct DVTARGETDEVICE DVTARGETDEVICE, *LPDVTARGETDEVICE; - -typedef struct FORMATETC16 FORMATETC16, *LPFORMATETC16; -typedef struct FORMATETC FORMATETC, *LPFORMATETC; - -typedef struct STGMEDIUM STGMEDIUM, *LPSTGMEDIUM; - - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IAdviseSink, 0x0000010fL, 0, 0); -typedef struct IAdviseSink IAdviseSink,*LPADVISESINK; - -DEFINE_OLEGUID(IID_IAdviseSink2, 0x00000125L, 0, 0); -typedef struct IAdviseSink2 IAdviseSink2,*LPADVISESINK2; - -DEFINE_OLEGUID(IID_IDataAdviseHolder, 0x00000110L, 0, 0); -typedef struct IDataAdviseHolder IDataAdviseHolder,*LPDATAADVISEHOLDER; - -DEFINE_OLEGUID(IID_IDataObject, 0x0000010EL, 0, 0); -typedef struct IDataObject IDataObject,*LPDATAOBJECT; - -DEFINE_OLEGUID(IID_IEnumFORMATETC, 0x00000103L, 0, 0); -typedef struct IEnumFORMATETC IEnumFORMATETC,*LPENUMFORMATETC; - -DEFINE_OLEGUID(IID_IEnumSTATDATA, 0x00000105L, 0, 0); -typedef struct IEnumSTATDATA IEnumSTATDATA,*LPENUMSTATDATA; - - -/***************************************************************************** - * DVTARGETDEVICE structure - */ -struct DVTARGETDEVICE -{ - DWORD tdSize; - WORD tdDriverNameOffset; - WORD tdDeviceNameOffset; - WORD tdPortNameOffset; - WORD tdExtDevmodeOffset; - BYTE tdData[1]; -}; - - -/***************************************************************************** - * FORMATETC structure - */ -/* wished data format */ -struct FORMATETC -{ - CLIPFORMAT cfFormat; - DVTARGETDEVICE* ptd; - DWORD dwAspect; - LONG lindex; - DWORD tymed; -}; - - -/***************************************************************************** - * STGMEDIUM structure - */ -typedef enum tagTYMED -{ - TYMED_HGLOBAL = 1, - TYMED_FILE = 2, - TYMED_ISTREAM = 4, - TYMED_ISTORAGE = 8, - TYMED_GDI = 16, - TYMED_MFPICT = 32, - TYMED_ENHMF = 64, - TYMED_NULL = 0 -} TYMED; - -typedef struct tagRemSTGMEDIUM -{ - DWORD tymed; - DWORD dwHandleType; - unsigned long pData; - unsigned long pUnkForRelease; - unsigned long cbData; - BYTE data[1]; -} RemSTGMEDIUM; - -/* dataobject as answer to a request */ -struct STGMEDIUM -{ - DWORD tymed; - union { - HBITMAP hBitmap; - HMETAFILEPICT hMetaFilePict; - HENHMETAFILE hEnhMetaFile; - HGLOBAL hGlobal; - LPOLESTR lpszFileName; - IStream *pstm; - IStorage *pstg; - } u; - IUnknown *pUnkForRelease; -}; - -typedef enum tagADVF -{ - ADVF_NODATA = 1, - ADVF_PRIMEFIRST = 2, - ADVF_ONLYONCE = 4, - ADVF_DATAONSTOP = 64, - ADVFCACHE_NOHANDLER = 8, - ADVFCACHE_FORCEBUILTIN = 16, - ADVFCACHE_ONSAVE = 32 -} ADVF; - -typedef struct tagSTATDATA -{ - FORMATETC formatetc; - DWORD advf; - IAdviseSink *pAdvSink; - DWORD dwConnection; -} STATDATA, *LPSTATDATA; - -/***************************************************************************** - * IAdviseSink interface - */ -#define ICOM_INTERFACE IAdviseSink -#define IAdviseSink_METHODS \ - ICOM_VMETHOD2(OnDataChange, FORMATETC*,pFormatetc, STGMEDIUM*,pStgmed) \ - ICOM_VMETHOD2(OnViewChange, DWORD,dwAspect, LONG,lindex) \ - ICOM_VMETHOD1(OnRename, IMoniker*,pmk) \ - ICOM_VMETHOD (OnSave) \ - ICOM_VMETHOD (OnClose) -#define IAdviseSink_IMETHODS \ - IUnknown_IMETHODS \ - IAdviseSink_METHODS -ICOM_DEFINE(IAdviseSink,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IAdviseSink_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IAdviseSink_AddRef(p) ICOM_CALL (AddRef,p) -#define IAdviseSink_Release(p) ICOM_CALL (Release,p) -/*** IAdviseSink methods ***/ -#define IAdviseSink_OnDataChange(p,a,b) ICOM_CALL2(OnDataChange,p,a,b) -#define IAdviseSink_OnViewChange(p,a,b) ICOM_CALL2(OnViewChange,p,a,b) -#define IAdviseSink_OnRename(p,a) ICOM_CALL1(OnRename,p,a) -#define IAdviseSink_OnSave(p) ICOM_CALL (OnSave,p) -#define IAdviseSink_OnClose(p) ICOM_CALL (OnClose,p) - - -/***************************************************************************** - * IAdviseSink2 interface - */ -#define ICOM_INTERFACE IAdviseSink2 -#define IAdviseSink2_METHODS \ - ICOM_VMETHOD1(OnLinkSrcChange, IMoniker*,pmk) -#define IAdviseSink2_IMETHODS \ - IAdviseSink_IMETHODS \ - IAdviseSink2_METHODS -ICOM_DEFINE(IAdviseSink2,IAdviseSink) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IAdviseSink2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IAdviseSink2_AddRef(p) ICOM_CALL (AddRef,p) -#define IAdviseSink2_Release(p) ICOM_CALL (Release,p) -/*** IAdviseSink methods ***/ -#define IAdviseSink2_OnDataChange(p,a,b) ICOM_CALL2(IAdviseSink,OnDataChange,p,a,b) -#define IAdviseSink2_OnViewChange(p,a,b) ICOM_CALL2(IAdviseSink,OnViewChange,p,a,b) -#define IAdviseSink2_OnRename(p,a) ICOM_CALL1(IAdviseSink,OnRename,p,a) -#define IAdviseSink2_OnSave(p) ICOM_CALL (IAdviseSink,OnSave,p) -#define IAdviseSink2_OnClose(p) ICOM_CALL (IAdviseSink,OnClose,p) -/*** IAdviseSink2 methods ***/ -#define IAdviseSink2_OnLinkSrcChange(p,a) ICOM_CALL(OnLinkSrcChange,p,a) - - -/***************************************************************************** - * IDataAdviseHolder interface - */ -#define ICOM_INTERFACE IDataAdviseHolder -#define IDataAdviseHolder_METHODS \ - ICOM_METHOD5(HRESULT,Advise, IDataObject*,pDataObject, FORMATETC*,pFetc, DWORD,advf, IAdviseSink*,pAdvise, DWORD*,pdwConnection) \ - ICOM_METHOD1(HRESULT,Unadvise, DWORD,dwConnection) \ - ICOM_METHOD1(HRESULT,EnumAdvise, IEnumSTATDATA**,ppenumAdvise) \ - ICOM_METHOD3(HRESULT,SendOnDataChange, IDataObject*,pDataObject, DWORD,dwReserved, DWORD,advf) -#define IDataAdviseHolder_IMETHODS \ - IUnknown_IMETHODS \ - IDataAdviseHolder_METHODS -ICOM_DEFINE(IDataAdviseHolder,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IDataAdviseHolder_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IDataAdviseHolder_AddRef(p) ICOM_CALL (AddRef,p) -#define IDataAdviseHolder_Release(p) ICOM_CALL (Release,p) -/*** IDataAdviseHolder methods ***/ -#define IDataAdviseHolder_Advise(p,a,b,c,d,e) ICOM_CALL5(Advise,p,a,b,c,d,e) -#define IDataAdviseHolder_Unadvise(p,a) ICOM_CALL1(Unadvise,p,a) -#define IDataAdviseHolder_EnumAdvise(p,a) ICOM_CALL1(EnumAdvise,p,a) -#define IDataAdviseHolder_SendOnDataChange(p,a,b,c) ICOM_CALL3(SendOnDataChange,p,a,b,c) - -/* FIXME: not implemented */ -HRESULT WINAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER* ppDAHolder); - - -/***************************************************************************** - * IDataObject interface - */ -#define ICOM_INTERFACE IDataObject -#define IDataObject_METHODS \ - ICOM_METHOD2(HRESULT,GetData, LPFORMATETC,pformatetcIn, STGMEDIUM*,pmedium) \ - ICOM_METHOD2(HRESULT,GetDataHere, LPFORMATETC,pformatetc, STGMEDIUM*,pmedium) \ - ICOM_METHOD1(HRESULT,QueryGetData, LPFORMATETC,pformatetc) \ - ICOM_METHOD2(HRESULT,GetCanonicalFormatEtc, LPFORMATETC,pformatectIn, LPFORMATETC,pformatetcOut) \ - ICOM_METHOD3(HRESULT,SetData, LPFORMATETC,pformatetc, STGMEDIUM*,pmedium, BOOL,fRelease) \ - ICOM_METHOD2(HRESULT,EnumFormatEtc, DWORD,dwDirection, IEnumFORMATETC**,ppenumFormatEtc) \ - ICOM_METHOD4(HRESULT,DAdvise, FORMATETC*,pformatetc, DWORD,advf, IAdviseSink*,pAdvSink, DWORD*,pdwConnection) \ - ICOM_METHOD1(HRESULT,DUnadvise, DWORD,dwConnection) \ - ICOM_METHOD1(HRESULT,EnumDAdvise, IEnumSTATDATA**,ppenumAdvise) -#define IDataObject_IMETHODS \ - IUnknown_IMETHODS \ - IDataObject_METHODS -ICOM_DEFINE(IDataObject,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IDataObject_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IDataObject_AddRef(p) ICOM_CALL (AddRef,p) -#define IDataObject_Release(p) ICOM_CALL (Release,p) -/*** IDataObject methods ***/ -#define IDataObject_GetData(p,a,b) ICOM_CALL2(GetData,p,a,b) -#define IDataObject_GetDataHere(p,a,b) ICOM_CALL2(GetDataHere,p,a,b) -#define IDataObject_QueryGetData(p,a) ICOM_CALL1(QueryGetData,p,a) -#define IDataObject_GetCanonicalFormatEtc(p,a,b) ICOM_CALL2(GetCanonicalFormatEtc,p,a,b) -#define IDataObject_SetData(p,a,b,c) ICOM_CALL3(SetData,p,a,b,c) -#define IDataObject_EnumFormatEtc(p,a,b) ICOM_CALL2(EnumFormatEtc,p,a,b) -#define IDataObject_DAdvise(p,a,b,c,d) ICOM_CALL4(DAdvise,p,a,b,c,d) -#define IDataObject_DUnadvise(p,a) ICOM_CALL1(DUnadvise,p,a) -#define IDataObject_EnumDAdvise(p,a) ICOM_CALL1(EnumDAdvise,p,a) - - -/***************************************************************************** - * IEnumFORMATETC interface - */ -#define ICOM_INTERFACE IEnumFORMATETC -#define IEnumFORMATETC_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,celt, FORMATETC*,rgelt, ULONG*,pceltFethed) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumFORMATETC**,ppenum) -#define IEnumFORMATETC_IMETHODS \ - IUnknown_IMETHODS \ - IEnumFORMATETC_METHODS -ICOM_DEFINE(IEnumFORMATETC,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumFORMATETC_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumFORMATETC_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumFORMATETC_Release(p) ICOM_CALL (Release,p) -/*** IEnumFORMATETC methods ***/ -#define IEnumFORMATETC_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumFORMATETC_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumFORMATETC_Reset(p) ICOM_CALL (Reset,p) -#define IEnumFORMATETC_Clone(p,a) ICOM_CALL1(Clone,p,a) - - -/***************************************************************************** - * IEnumSTATDATA interface - */ -#define ICOM_INTERFACE IEnumSTATDATA -#define IEnumSTATDATA_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,celt, STATDATA*,rgelt, ULONG*,pceltFethed) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumSTATDATA**,ppenum) -#define IEnumSTATDATA_IMETHODS \ - IUnknown_IMETHODS \ - IEnumSTATDATA_METHODS -ICOM_DEFINE(IEnumSTATDATA,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumSTATDATA_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumSTATDATA_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumSTATDATA_Release(p) ICOM_CALL (Release,p) -/*** IEnumSTATDATA methods ***/ -#define IEnumSTATDATA_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumSTATDATA_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumSTATDATA_Reset(p) ICOM_CALL (Reset,p) -#define IEnumSTATDATA_Clone(p,a) ICOM_CALL1(Clone,p,a) - - -/***************************************************************************** - * Additional API - */ - -/* FIXME: not implemented */ -HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID iid, LPVOID* ppv); - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_DATAOBJECT_H */ diff --git a/reactos/include/ole32/obj_dockingwindowframe.h b/reactos/include/ole32/obj_dockingwindowframe.h deleted file mode 100644 index da94b8d4057..00000000000 --- a/reactos/include/ole32/obj_dockingwindowframe.h +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************ - * IDockingWindowFrame - */ - -#ifndef __WINE_WINE_OBJ_DOCKINGWINDOWFRAME_H -#define __WINE_WINE_OBJ_DOCKINGWINDOWFRAME_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -typedef struct IDockingWindowFrame IDockingWindowFrame, *LPDOCKINGWINDOWFRAME; -DEFINE_GUID (IID_IDockingWindowFrame, 0x47D2657AL, 0x7B27, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8); - -#define DWFRF_NORMAL 0x0000 /* femove toolbar flags*/ -#define DWFRF_DELETECONFIGDATA 0x0001 -#define DWFAF_HIDDEN 0x0001 /* add tolbar*/ - -#define ICOM_INTERFACE IDockingWindowFrame -#define IDockingWindowFrame_METHODS \ - ICOM_METHOD3(HRESULT, AddToolbar, IUnknown*, punkSrc, LPCWSTR, pwszItem, DWORD, dwAddFlags) \ - ICOM_METHOD2(HRESULT, RemoveToolbar, IUnknown*, punkSrc, DWORD, dwRemoveFlags) \ - ICOM_METHOD3(HRESULT, FindToolbar, LPCWSTR, pwszItem, REFIID, riid, LPVOID*, ppvObj) -#define IDockingWindowFrame_IMETHODS \ - IOleWindow_IMETHODS \ - IDockingWindowFrame_METHODS -ICOM_DEFINE(IDockingWindowFrame,IOleWindow) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IDockingWindowFrame_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IDockingWindowFrame_AddRef(p) ICOM_CALL(AddRef,p) -#define IDockingWindowFrame_Release(p) ICOM_CALL(Release,p) -/*** IDockingWindowFrame methods ***/ -#define IDockingWindowFrame_GetWindow(p,a) ICOM_CALL1(GetWindow,p,a) -#define IDockingWindowFrame_ContextSensitiveHelp(p,a) ICOM_CALL1(ContextSensitiveHelp,p,a) -#define IDockingWindowFrame_AddToolbar(p,a,b,c) ICOM_CALL3(AddToolbar,p,a,b,c) -#define IDockingWindowFrame_RemoveToolbar(p,a,b) ICOM_CALL2(RemoveToolbar,p,a,b) -#define IDockingWindowFrame_FindToolbar(p,a,b,c) ICOM_CALL3(FindToolbar,p,a,b,c) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_DOCKINGWINDOWFRAME_H */ diff --git a/reactos/include/ole32/obj_dragdrop.h b/reactos/include/ole32/obj_dragdrop.h deleted file mode 100644 index c8a7cb08fe4..00000000000 --- a/reactos/include/ole32/obj_dragdrop.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to OLE Drag and Drop. - */ - -#ifndef __WINE_WINE_OBJ_DRAGDROP_H -#define __WINE_WINE_OBJ_DRAGDROP_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IDropSource, 0x00000121L, 0, 0); -typedef struct IDropSource IDropSource,*LPDROPSOURCE; - -DEFINE_OLEGUID(IID_IDropTarget, 0x00000122L, 0, 0); -typedef struct IDropTarget IDropTarget,*LPDROPTARGET; - -/***************************************************************************** - * DROPEFFECT enumeration - */ -#define MK_ALT (0x20) -#define DROPEFFECT_NONE 0 -#define DROPEFFECT_COPY 1 -#define DROPEFFECT_MOVE 2 -#define DROPEFFECT_LINK 4 -#define DROPEFFECT_SCROLL 0x80000000 -#define DD_DEFSCROLLINSET 11 -#define DD_DEFSCROLLDELAY 50 -#define DD_DEFSCROLLINTERVAL 50 -#define DD_DEFDRAGDELAY 50 -#define DD_DEFDRAGMINDIST 2 - -/***************************************************************************** - * IDropSource interface - */ -#define ICOM_INTERFACE IDropSource -#define IDropSource_METHODS \ - ICOM_METHOD2(HRESULT, QueryContinueDrag, BOOL, fEscapePressed, DWORD, grfKeyState) \ - ICOM_METHOD1(HRESULT, GiveFeedback, DWORD, dwEffect) -#define IDropSource_IMETHODS \ - IUnknown_IMETHODS \ - IDropSource_METHODS -ICOM_DEFINE(IDropSource,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IDropSource_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IDropSource_AddRef(p) ICOM_CALL (AddRef,p) -#define IDropSource_Release(p) ICOM_CALL (Release,p) -/*** IDropSource methods ***/ -#define IDropSource_QueryContinueDrag(p,a,b) ICOM_CALL2(QueryContinueDrag,p,a,b) -#define IDropSource_GiveFeedback(p,a) ICOM_CALL1(GiveFeedback,p,a) - -/***************************************************************************** - * IDropTarget interface - */ -#define ICOM_INTERFACE IDropTarget -#define IDropTarget_METHODS \ - ICOM_METHOD4(HRESULT, DragEnter, IDataObject*, pDataObject, DWORD, grfKeyState, POINTL, pt, DWORD*, pdwEffect) \ - ICOM_METHOD3(HRESULT, DragOver, DWORD, grfKeyState, POINTL, pt, DWORD*, pdwEffect) \ - ICOM_METHOD(HRESULT, DragLeave) \ - ICOM_METHOD4(HRESULT, Drop, IDataObject*, pDataObject, DWORD, grfKeyState, POINTL, pt, DWORD*, pdwEffect) -#define IDropTarget_IMETHODS \ - IUnknown_IMETHODS \ - IDropTarget_METHODS -ICOM_DEFINE(IDropTarget,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IDropTarget_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IDropTarget_AddRef(p) ICOM_CALL (AddRef,p) -#define IDropTarget_Release(p) ICOM_CALL (Release,p) -/*** IDropTarget methods ***/ -#define IDropTarget_DragEnter(p,a,b,c,d) ICOM_CALL4(DragEnter,p,a,b,c,d) -#define IDropTarget_DragOver(p,a,b,c) ICOM_CALL3(DragOver,p,a,b,c) -#define IDropTarget_DragLeave(p) ICOM_CALL(DragLeave,p) -#define IDropTarget_Drop(p,a,b,c,d) ICOM_CALL4(Drop,p,a,b,c,d) - -#if _WIN32_IE >= 0x0500 - -#pragma pack(push,8) - -typedef struct -{ - SIZE sizeDragImage; - POINT ptOffset; - HBITMAP hbmpDragImage; - COLORREF crColorKey; -} SHDRAGIMAGE, *LPSHDRAGIMAGE; - -#pragma pack(pop) - -#undef INTERFACE -#define INTERFACE IDragSourceHelper - -DECLARE_INTERFACE_(IDragSourceHelper, IUnknown) -{ - STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE; - STDMETHOD_(ULONG, AddRef) (THIS) PURE; - STDMETHOD_(ULONG, Release) (THIS) PURE; - STDMETHOD (InitializeFromBitmap)(THIS_ LPSHDRAGIMAGE pshdi, IDataObject* pDataObject) PURE; - STDMETHOD (InitializeFromWindow)(THIS_ HWND hwnd, POINT* ppt, IDataObject* pDataObject) PURE; -}; - -DEFINE_GUID(CLSID_DragDropHelper, 0x4657278AL, 0x411B, 0x11D2, 0x83, 0x9A, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0); -DEFINE_GUID(IID_IDropTargetHelper, 0x4657278BL, 0x411B, 0x11D2, 0x83, 0x9A, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0); -DEFINE_GUID(IID_IDragSourceHelper, 0xDE5BF786L, 0x477A, 0x11D2, 0x83, 0x9D, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0); - -#endif /* _WIN32_IE >= 0x0500 */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_DRAGDROP_H */ - - - - - diff --git a/reactos/include/ole32/obj_enumidlist.h b/reactos/include/ole32/obj_enumidlist.h deleted file mode 100644 index d27da2c3859..00000000000 --- a/reactos/include/ole32/obj_enumidlist.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to EnumIDList - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_ENUMIDLIST_H -#define __WINE_WINE_OBJ_ENUMIDLIST_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -typedef struct IEnumIDList IEnumIDList, *LPENUMIDLIST; - -#define ICOM_INTERFACE IEnumIDList -#define IEnumIDList_METHODS \ - ICOM_METHOD3(HRESULT, Next, ULONG, celt, LPITEMIDLIST*, rgelt, ULONG*, pceltFetched) \ - ICOM_METHOD1(HRESULT, Skip, ULONG, celt) \ - ICOM_METHOD (HRESULT, Reset) \ - ICOM_METHOD1(HRESULT, Clone, IEnumIDList**, ppenum) -#define IEnumIDList_IMETHODS \ - IUnknown_IMETHODS \ - IEnumIDList_METHODS -ICOM_DEFINE(IEnumIDList,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumIDList_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumIDList_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumIDList_Release(p) ICOM_CALL (Release,p) -/*** IEnumIDList methods ***/ -#define IEnumIDList_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumIDList_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumIDList_Reset(p) ICOM_CALL(Reset,p) -#define IEnumIDList_Clone(p,a) ICOM_CALL1(Clone,p,a) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_ENUMIDLIST_H */ diff --git a/reactos/include/ole32/obj_errorinfo.h b/reactos/include/ole32/obj_errorinfo.h deleted file mode 100644 index 2e3e816cd7f..00000000000 --- a/reactos/include/ole32/obj_errorinfo.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to ErrorInfo - */ - -#ifndef __WINE_WINE_OBJ_ERRORINFO_H -#define __WINE_WINE_OBJ_ERRORINFO_H - -DEFINE_GUID(IID_IErrorInfo,0x1CF2B120,0x547D,0x101B,0x8E,0x65,0x08,0x00,0x2B,0x2B,0xD1,0x19); -typedef struct IErrorInfo IErrorInfo,*LPERRORINFO; - -DEFINE_GUID(IID_ICreateErrorInfo,0x22F03340,0x547D,0x101B,0x8E,0x65,0x08,0x00,0x2B,0x2B,0xD1,0x19); -typedef struct ICreateErrorInfo ICreateErrorInfo,*LPCREATEERRORINFO; - -DEFINE_GUID(IID_ISupportErrorInfo,0xDF0B3D60,0x547D,0x101B,0x8E,0x65,0x08,0x00,0x2B,0x2B,0xD1,0x19); -typedef struct ISupportErrorInfo ISupportErrorInfo,*LPSUPPORTERRORINFO; - -/***************************************************************************** - * IErrorInfo - */ -#define ICOM_INTERFACE IErrorInfo -#define IErrorInfo_METHODS \ - ICOM_METHOD1(HRESULT, GetGUID, GUID * , pGUID) \ - ICOM_METHOD1(HRESULT, GetSource, BSTR* ,pBstrSource) \ - ICOM_METHOD1(HRESULT, GetDescription, BSTR*, pBstrDescription) \ - ICOM_METHOD1(HRESULT, GetHelpFile, BSTR*, pBstrHelpFile) \ - ICOM_METHOD1(HRESULT, GetHelpContext, DWORD*, pdwHelpContext) - -#define IErrorInfo_IMETHODS \ - IUnknown_IMETHODS \ - IErrorInfo_METHODS -ICOM_DEFINE(IErrorInfo, IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IErrorInfo_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IErrorInfo_AddRef(p) ICOM_CALL (AddRef,p) -#define IErrorInfo_Release(p) ICOM_CALL (Release,p) -/*** IErrorInfo methods ***/ -#define IErrorInfo_GetGUID(p,a) ICOM_CALL1 (GetGUID,p,a) -#define IErrorInfo_GetSource(p,a) ICOM_CALL1 (GetSource,p,a) -#define IErrorInfo_GetDescription(p,a) ICOM_CALL1 (GetDescription,p,a) -#define IErrorInfo_GetHelpFile(p,a) ICOM_CALL1 (GetHelpFile,p,a) -#define IErrorInfo_GetHelpContext(p,a) ICOM_CALL1 (GetHelpContext,p,a) - -/***************************************************************************** - * ICreateErrorInfo - */ -#define ICOM_INTERFACE ICreateErrorInfo -#define ICreateErrorInfo_METHODS \ - ICOM_METHOD1(HRESULT, SetGUID, REFGUID, rguid) \ - ICOM_METHOD1(HRESULT, SetSource, LPOLESTR, szSource) \ - ICOM_METHOD1(HRESULT, SetDescription, LPOLESTR, szDescription) \ - ICOM_METHOD1(HRESULT, SetHelpFile, LPOLESTR, szHelpFile) \ - ICOM_METHOD1(HRESULT, SetHelpContext, DWORD, dwHelpContext) - -#define ICreateErrorInfo_IMETHODS \ - IUnknown_IMETHODS \ - ICreateErrorInfo_METHODS -ICOM_DEFINE(ICreateErrorInfo, IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ICreateErrorInfo_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ICreateErrorInfo_AddRef(p) ICOM_CALL (AddRef,p) -#define ICreateErrorInfo_Release(p) ICOM_CALL (Release,p) -/*** ICreateErrorInfo methods ***/ -#define ICreateErrorInfo_SetGUID(p,a) ICOM_CALL1 (SetGUID,p,a) -#define ICreateErrorInfo_SetSource(p,a) ICOM_CALL1 (SetSource,p,a) -#define ICreateErrorInfo_SetDescription(p,a) ICOM_CALL1 (SetDescription,p,a) -#define ICreateErrorInfo_SetHelpFile(p,a) ICOM_CALL1 (SetHelpFile,p,a) -#define ICreateErrorInfo_SetHelpContext(p,a) ICOM_CALL1 (SetHelpContext,p,a) - -/***************************************************************************** - * ISupportErrorInfo - */ -#define ICOM_INTERFACE ISupportErrorInfo -#define ISupportErrorInfo_METHODS \ - ICOM_METHOD1(HRESULT, InterfaceSupportsErrorInfo, REFIID, riid ) - -#define ISupportErrorInfo_IMETHODS \ - IUnknown_IMETHODS \ - ISupportErrorInfo_METHODS -ICOM_DEFINE(ISupportErrorInfo, IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ISupportErrorInfo_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ISupportErrorInfo_AddRef(p) ICOM_CALL (AddRef,p) -#define ISupportErrorInfo_Release(p) ICOM_CALL (Release,p) -/*** ISupportErrorInfo methods ***/ -#define ISupportErrorInfo_InterfaceSupportsErrorInfo(p,a) ICOM_CALL1 (InterfaceSupportsErrorInfo,p,a) - - -#endif /* __WINE_WINE_OBJ_ERRORINFO_H */ diff --git a/reactos/include/ole32/obj_extracticon.h b/reactos/include/ole32/obj_extracticon.h deleted file mode 100644 index f8e96a95f1b..00000000000 --- a/reactos/include/ole32/obj_extracticon.h +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************ - * IExtractIconA - */ - -#ifndef __WINE_WINE_OBJ_EXTRACTICON_H -#define __WINE_WINE_OBJ_EXTRACTICON_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -#define IID_IExtractIcon WINELIB_NAME_AW(IID_IExtractIcon) - -typedef struct IExtractIconA IExtractIconA,*LPEXTRACTICONA; -#define LPEXTRACTICON WINELIB_NAME_AW(LPEXTRACTICON) - -/* GetIconLocation() input flags*/ -#define GIL_OPENICON 0x0001 /* allows containers to specify an "open" look */ -#define GIL_FORSHELL 0x0002 /* icon is to be displayed in a ShellFolder */ -#define GIL_ASYNC 0x0020 /* this is an async extract, return E_ASYNC */ - -/* GetIconLocation() return flags */ -#define GIL_SIMULATEDOC 0x0001 /* simulate this document icon for this */ -#define GIL_PERINSTANCE 0x0002 /* icons from this class are per instance (each file has its own) */ -#define GIL_PERCLASS 0x0004 /* icons from this class per class (shared for all files of this type) */ -#define GIL_NOTFILENAME 0x0008 /* location is not a filename, must call ::ExtractIcon */ -#define GIL_DONTCACHE 0x0010 /* this icon should not be cached */ - - -#define ICOM_INTERFACE IExtractIconA -#define IExtractIconA_METHODS \ - ICOM_METHOD5(HRESULT, GetIconLocation, UINT, uFlags, LPSTR, szIconFile, UINT, cchMax, INT*, piIndex, UINT *, pwFlags) \ - ICOM_METHOD5(HRESULT, Extract, LPCSTR, pszFile, UINT, nIconIndex, HICON*, phiconLarge, HICON*, phiconSmall, UINT, nIconSize) -#define IExtractIconA_IMETHODS \ - IUnknown_IMETHODS \ - IExtractIconA_METHODS -ICOM_DEFINE(IExtractIconA,IUnknown) -#undef ICOM_INTERFACE - -#define IExtractIconA_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IExtractIconA_AddRef(p) ICOM_CALL(AddRef,p) -#define IExtractIconA_Release(p) ICOM_CALL(Release,p) -#define IExtractIconA_GetIconLocation(p,a,b,c,d,e) ICOM_CALL5(GetIconLocation,p,a,b,c,d,e) -#define IExtractIconA_Extract(p,a,b,c,d,e) ICOM_CALL5(Extract,p,a,b,c,d,e) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_EXTRACTICON_H */ - diff --git a/reactos/include/ole32/obj_inplace.h b/reactos/include/ole32/obj_inplace.h deleted file mode 100644 index 344238b0fef..00000000000 --- a/reactos/include/ole32/obj_inplace.h +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to structured data storage. - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_INPLACE_H -#define __WINE_WINE_OBJ_INPLACE_H - -struct tagMSG; - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the structures - */ -typedef struct tagOleMenuGroupWidths -{ - LONG width[ 6 ]; -} OLEMENUGROUPWIDTHS, *LPOLEMENUGROUPWIDTHS; - - -typedef struct tagOleInPlaceFrameInfo -{ - UINT cb; - BOOL fMDIApp; - HWND hwndFrame; - HACCEL haccel; - UINT cAccelEntries; -} OLEINPLACEFRAMEINFO, *LPOLEINPLACEFRAMEINFO; - -typedef enum tagOLEGETMONIKER -{ - OLEGETMONIKER_ONLYIFTHERE = 1, - OLEGETMONIKER_FORCEASSIGN = 2, - OLEGETMONIKER_UNASSIGN = 3, - OLEGETMONIKER_TEMPFORUSER = 4 -} OLEGETMONIKER; - -typedef enum tagOLERENDER -{ - OLERENDER_NONE = 0, - OLERENDER_DRAW = 1, - OLERENDER_FORMAT = 2, - OLERENDER_ASIS = 3 -} OLERENDER; - -typedef enum tagUSERCLASSTYPE -{ - USERCLASSTYPE_FULL = 1, - USERCLASSTYPE_SHORT = 2, - USERCLASSTYPE_APPNAME = 3 -} USERCLASSTYPE; - -typedef enum tagOLECLOSE -{ - OLECLOSE_SAVEIFDIRTY = 1, - OLECLOSE_NOSAVE = 2, - OLECLOSE_PROMPTSAVE = 3 -} OLECLOSE; - -typedef enum tagOLEUPDATE -{ - OLEUPDATE_ALWAYS = 1, - OLEUPDATE_ONCALL = 3 -} OLEUPDATE, *LPOLEUPDATE; - -typedef struct tagOLEVERB -{ - LONG lVerb; - LPOLESTR lpszVerbName; - DWORD fuFlags; - DWORD grfAttribs; -} OLEVERB, *LPOLEVERB; - -typedef enum tagOLELINKBIND -{ - OLELINKBIND_EVENIFCLASSDIFF = 1 -} OLELINKBIND; - -typedef enum tagOLEWHICHMK -{ - OLEWHICHMK_CONTAINER = 1, - OLEWHICHMK_OBJREL = 2, - OLEWHICHMK_OBJFULL = 3 -} OLEWHICHMK; - -typedef enum tagBINDSPEED -{ - BINDSPEED_INDEFINITE = 1, - BINDSPEED_MODERATE = 2, - BINDSPEED_IMMEDIATE = 3 -} BINDSPEED; - -typedef enum tagOLECONTF -{ - OLECONTF_EMBEDDINGS = 1, - OLECONTF_LINKS = 2, - OLECONTF_OTHERS = 4, - OLECONTF_OLNYUSER = 8, - OLECONTF_ONLYIFRUNNING = 16 -} OLECONTF; - -typedef HGLOBAL HOLEMENU; -typedef LPRECT LPBORDERWIDTHS; -typedef LPCRECT LPCBORDERWIDTHS; - - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IOleWindow, 0x00000114L, 0, 0); -typedef struct IOleWindow IOleWindow, *LPOLEWINDOW; - -DEFINE_OLEGUID(IID_IOleInPlaceObject, 0x00000113L, 0, 0); -typedef struct IOleInPlaceObject IOleInPlaceObject, *LPOLEINPLACEOBJECT; - -DEFINE_OLEGUID(IID_IOleInPlaceActiveObject, 0x00000117L, 0, 0); -typedef struct IOleInPlaceActiveObject IOleInPlaceActiveObject, *LPOLEINPLACEACTIVEOBJECT; - -DEFINE_OLEGUID(IID_IOleInPlaceUIWindow, 0x00000115L, 0, 0); -typedef struct IOleInPlaceUIWindow IOleInPlaceUIWindow, *LPOLEINPLACEUIWINDOW; - -DEFINE_OLEGUID(IID_IOleInPlaceFrame, 0x00000116L, 0, 0); -typedef struct IOleInPlaceFrame IOleInPlaceFrame, *LPOLEINPLACEFRAME; - -DEFINE_OLEGUID(IID_IOleInPlaceSite, 0x00000119L, 0, 0); -typedef struct IOleInPlaceSite IOleInPlaceSite, *LPOLEINPLACESITE; - -DEFINE_OLEGUID(IID_IOleClientSite, 0x00000118L, 0, 0); -typedef struct IOleClientSite IOleClientSite, *LPOLECLIENTSITE; - -DEFINE_OLEGUID(IID_IOleContainer, 0x0000011bL, 0, 0); -typedef struct IOleContainer IOleContainer, *LPOLECONTAINER; - -DEFINE_OLEGUID(IID_IParseDisplayName, 0x0000011aL, 0, 0); -typedef struct IParseDisplayName IParseDisplayName, *LPPARSEDISPLAYNAME; - -DEFINE_OLEGUID(IID_IOleItemContainer, 0x0000011cL, 0, 0); -typedef struct IOleItemContainer IOleItemContainer, *LPOLEITEMCONTAINER; - -DEFINE_OLEGUID(IID_IOleLink, 0x0000011dL, 0, 0); -typedef struct IOleLink IOleLink, *LPOLELINK; - -/***************************************************************************** - * IOleWindow interface - */ -#define ICOM_INTERFACE IOleWindow -#define IOleWindow_METHODS \ - ICOM_METHOD1(HRESULT,GetWindow, HWND*,phwnd) \ - ICOM_METHOD1(HRESULT,ContextSensitiveHelp, BOOL,fEnterMode) -#define IOleWindow_IMETHODS \ - IUnknown_IMETHODS \ - IOleWindow_METHODS -ICOM_DEFINE(IOleWindow,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleWindow_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleWindow_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleWindow_Release(p) ICOM_CALL (Release,p) -/*** IOleWindow methods ***/ -#define IOleWindow_GetWindow(p,a) ICOM_CALL1(GetWindow,p,a) -#define IOleWindow_ContextSensitiveHelp(p,a) ICOM_CALL1(ContextSensitiveHelp,p,a) - - -/***************************************************************************** - * IOleInPlaceObject interface - */ -#define ICOM_INTERFACE IOleInPlaceObject -#define IOleInPlaceObject_METHODS \ - ICOM_METHOD (HRESULT,InPlaceDeactivate) \ - ICOM_METHOD (HRESULT,UIDeactivate) \ - ICOM_METHOD2(HRESULT,SetObjectRects, LPCRECT,lprcPosRect, LPCRECT,lprcClipRect) \ - ICOM_METHOD (HRESULT,ReactivateAndUndo) -#define IOleInPlaceObject_IMETHODS \ - IOleWindow_IMETHODS \ - IOleInPlaceObject_METHODS -ICOM_DEFINE(IOleInPlaceObject,IOleWindow) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleInPlaceObject_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleInPlaceObject_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleInPlaceObject_Release(p) ICOM_CALL (Release,p) -/*** IOleWindow methods ***/ -#define IOleInPlaceObject_GetWindow(p,a) ICOM_CALL1(GetWindow,p,a) -#define IOleInPlaceObject_ContextSensitiveHelp(p,a) ICOM_CALL1(ContextSensitiveHelp,p,a) -/*** IOleInPlaceObject methods ***/ -#define IOleInPlaceObject_InPlaceDeactivate(p) ICOM_CALL (InPlaceDeactivate,p) -#define IOleInPlaceObject_UIDeactivate(p) ICOM_CALL (UIDeactivate,p) -#define IOleInPlaceObject_SetObjectRects(p,a,b) ICOM_CALL2(SetObjectRects,p,a,b) -#define IOleInPlaceObject_ReactivateAndUndo(p) ICOM_CALL (ReactivateAndUndo,p) - -/***************************************************************************** - * IOleInPlaceActiveObject interface - */ -#define ICOM_INTERFACE IOleInPlaceActiveObject -#define IOleInPlaceActiveObject_METHODS \ - ICOM_METHOD1(HRESULT,TranslateAccelerator, struct tagMSG*,lpmsg) \ - ICOM_METHOD1(HRESULT,OnFrameWindowActivate, BOOL,fActivate) \ - ICOM_METHOD1(HRESULT,OnDocWindowActivate, BOOL,fActivate) \ - ICOM_METHOD3(HRESULT,ResizeBorder, LPCRECT,prcBorder, IOleInPlaceUIWindow*,pUIWindow, BOOL,fWindowFrame) \ - ICOM_METHOD1(HRESULT,EnableModeless, BOOL,fEnable) -#define IOleInPlaceActiveObject_IMETHODS \ - IOleWindow_IMETHODS \ - IOleInPlaceActiveObject_METHODS -ICOM_DEFINE(IOleInPlaceActiveObject,IOleWindow) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleInPlaceActiveObject_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleInPlaceActiveObject_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleInPlaceActiveObject_Release(p) ICOM_CALL (Release,p) -/*** IOleWindow methods ***/ -#define IOleInPlaceActiveObject_GetWindow(p,a) ICOM_CALL1(GetWindow,p,a) -#define IOleInPlaceActiveObject_ContextSensitiveHelp(p,a) ICOM_CALL1(ContextSensitiveHelp,p,a) -/*** IOleInPlaceActiveObject methods ***/ -#define IOleInPlaceActiveObject_TranslateAccelerator(p,a) ICOM_CALL1(TranslateAccelerator,p,a) -#define IOleInPlaceActiveObject_OnFrameWindowActivate(p,a) ICOM_CALL1(OnFrameWindowActivate,p,a) -#define IOleInPlaceActiveObject_OnDocWindowActivate(p,a) ICOM_CALL1(OnDocWindowActivate,p,a) -#define IOleInPlaceActiveObject_ResizeBorder(p,a,b,c) ICOM_CALL3(ResizeBorder,p,a,b,c) -#define IOleInPlaceActiveObject_EnableModeless(p,a) ICOM_CALL1(EnableModeless,p,a) - -/***************************************************************************** - * IOleInPlaceUIWindow interface - */ -#define ICOM_INTERFACE IOleInPlaceUIWindow -#define IOleInPlaceUIWindow_METHODS \ - ICOM_METHOD1(HRESULT,GetBorder, LPRECT,lprectBorder) \ - ICOM_METHOD1(HRESULT,RequestBorderSpace, LPCBORDERWIDTHS,pborderwidths) \ - ICOM_METHOD1(HRESULT,SetBorderSpace, LPCBORDERWIDTHS,pborderwidths) \ - ICOM_METHOD2(HRESULT,SetActiveObject, IOleInPlaceActiveObject*,pActiveObject, LPCOLESTR,pszObjName) -#define IOleInPlaceUIWindow_IMETHODS \ - IOleWindow_IMETHODS \ - IOleInPlaceUIWindow_METHODS -ICOM_DEFINE(IOleInPlaceUIWindow,IOleWindow) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleInPlaceUIWindow_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleInPlaceUIWindow_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleInPlaceUIWindow_Release(p) ICOM_CALL (Release,p) -/*** IOleWindow methods ***/ -#define IOleInPlaceUIWindow_GetWindow(p,a) ICOM_CALL1(GetWindow,p,a) -#define IOleInPlaceUIWindow_ContextSensitiveHelp(p,a) ICOM_CALL1(ContextSensitiveHelp,p,a) -/*** IOleInPlaceUIWindow methods ***/ -#define IOleInPlaceUIWindow_GetBorder(p,a) ICOM_CALL1(GetBorder,p,a) -#define IOleInPlaceUIWindow_RequestBorderSpace(p,a) ICOM_CALL1(RequestBorderSpace,p,a) -#define IOleInPlaceUIWindow_SetBorderSpace(p,a) ICOM_CALL1(SetBorderSpace,p,a) -#define IOleInPlaceUIWindow_SetActiveObject(p,a,b) ICOM_CALL2(SetActiveObject,p,a,b) - - -/***************************************************************************** - * IOleInPlaceFrame interface - */ -#define ICOM_INTERFACE IOleInPlaceFrame -#define IOleInPlaceFrame_METHODS \ - ICOM_METHOD2 (HRESULT,InsertMenus, HMENU,hemnuShared, LPOLEMENUGROUPWIDTHS,lpMenuWidths) \ - ICOM_METHOD3 (HRESULT,SetMenu, HMENU,hemnuShared, HOLEMENU,holemenu, HWND,hwndActiveObject) \ - ICOM_METHOD1 (HRESULT,RemoveMenus, HMENU,hemnuShared) \ - ICOM_METHOD1 (HRESULT,SetStatusText, LPCOLESTR,pszStatusText) \ - ICOM_METHOD1 (HRESULT,EnableModeless, BOOL,fEnable) \ - ICOM_METHOD2 (HRESULT,TranslateAccelerator, struct tagMSG*,lpmsg, WORD,wID) -#define IOleInPlaceFrame_IMETHODS \ - IOleInPlaceUIWindow_IMETHODS \ - IOleInPlaceFrame_METHODS -ICOM_DEFINE(IOleInPlaceFrame,IOleInPlaceUIWindow) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleInPlaceFrame_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleInPlaceFrame_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleInPlaceFrame_Release(p) ICOM_CALL (Release,p) -/*** IOleWindow methods ***/ -#define IOleInPlaceFrame_GetWindow ICOM_CALL1(GetWindow,p,a) -#define IOleInPlaceFrame_ContextSensitiveHelp ICOM_CALL1(ContextSensitiveHelp,p,a) -/*** IOleInPlaceUIWindow methods ***/ -#define IOleInPlaceFrame_GetBorder ICOM_CALL1(GetBorder,p,a) -#define IOleInPlaceFrame_RequestBorderSpace ICOM_CALL1(RequestBorderSpace,p,a) -#define IOleInPlaceFrame_SetBorderSpace ICOM_CALL1(SetBorderSpace,p,a) -#define IOleInPlaceFrame_SetActiveObject ICOM_CALL2(SetActiveObject,p,a,b) -/*** IOleInPlaceFrame methods ***/ -#define IOleInPlaceFrame_InsertMenus ICOM_CALL2(InsertMenus,p,a,b) -#define IOleInPlaceFrame_SetMenu ICOM_CALL3(SetMenu,p,a,b,c) -#define IOleInPlaceFrame_RemoveMenus ICOM_CALL1(RemoveMenus,p,a) -#define IOleInPlaceFrame_SetStatusText ICOM_CALL1(SetStatusText,p,a) -#define IOleInPlaceFrame_EnableModeless ICOM_CALL1(EnableModeless,p,a) -#define IOleInPlaceFrame_TranslateAccelerator ICOM_CALL2(TranslateAccelerator,p,a,b) - - -/***************************************************************************** - * IOleInPlaceSite interface - */ -#define ICOM_INTERFACE IOleInPlaceSite -#define IOleInPlaceSite_METHODS \ - ICOM_METHOD (HRESULT,CanInPlaceActivate) \ - ICOM_METHOD (HRESULT,OnInPlaceActivate) \ - ICOM_METHOD (HRESULT,OnUIActivate) \ - ICOM_METHOD5(HRESULT,GetWindowContext, IOleInPlaceFrame**,ppFrame, IOleInPlaceUIWindow**,ppDoc, LPRECT,lprcPosRect, LPRECT,lprcClipRect, LPOLEINPLACEFRAMEINFO,lpFrameInfo) \ - ICOM_METHOD1(HRESULT,Scroll, SIZE,scrollExtant) \ - ICOM_METHOD1(HRESULT,OnUIDeactivate, BOOL,fUndoable) \ - ICOM_METHOD (HRESULT,OnInPlaceDeactivate) \ - ICOM_METHOD (HRESULT,DiscardUndoState) \ - ICOM_METHOD (HRESULT,DeactivateAndUndo) \ - ICOM_METHOD1(HRESULT,OnPosRectChange, LPCRECT,lprcPosRect) -#define IOleInPlaceSite_IMETHODS \ - IOleWindow_IMETHODS \ - IOleInPlaceSite_METHODS -ICOM_DEFINE(IOleInPlaceSite,IOleWindow) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleInPlaceSite_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleInPlaceSite_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleInPlaceSite_Release(p) ICOM_CALL (Release,p) -/*** IOleWindow methods ***/ -#define IOleInPlaceSite_GetWindow(p,a) ICOM_CALL1(GetWindow,p,a) -#define IOleInPlaceSite_ContextSensitiveHelp(p,a) ICOM_CALL1(ContextSensitiveHelp,p,a) -/*** IOleInPlaceSite methods ***/ -#define IOleInPlaceSite_CanInPlaceActivate(p) ICOM_CALL (CanInPlaceActivate,p) -#define IOleInPlaceSite_OnInPlaceActivate(p) ICOM_CALL (OnInPlaceActivate,p) -#define IOleInPlaceSite_OnUIActivate(p) ICOM_CALL (OnUIActivate,p) -#define IOleInPlaceSite_GetWindowContext(p,a,b,c,d,e) ICOM_CALL5(GetWindowContext,p,a,b,c,d,e) -#define IOleInPlaceSite_Scroll(p,a) ICOM_CALL1(Scroll,p,a) -#define IOleInPlaceSite_OnUIDeactivate(p,a) ICOM_CALL1(OnUIDeactivate,p,a) -#define IOleInPlaceSite_OnInPlaceDeactivate(p) ICOM_CALL (OnInPlaceDeactivate,p) -#define IOleInPlaceSite_DiscardUndoState(p) ICOM_CALL (DiscardUndoState,p) -#define IOleInPlaceSite_DeactivateAndUndo(p) ICOM_CALL (DeactivateAndUndo,p) -#define IOleInPlaceSite_OnPosRectChange(p,a) ICOM_CALL1(OnPosRectChange,p,a) - - -/***************************************************************************** - * IOleClientSite interface - */ -#define ICOM_INTERFACE IOleClientSite -#define IOleClientSite_METHODS \ - ICOM_METHOD (HRESULT,SaveObject) \ - ICOM_METHOD3(HRESULT,GetMoniker, DWORD,dwAssign, DWORD,dwWhichMoniker, IMoniker**,ppmk) \ - ICOM_METHOD1(HRESULT,GetContainer, IOleContainer**,ppContainer) \ - ICOM_METHOD (HRESULT,ShowObject) \ - ICOM_METHOD1(HRESULT,OnShowWindow, BOOL,fShow) \ - ICOM_METHOD (HRESULT,RequestNewObjectLayout) -#define IOleClientSite_IMETHODS \ - IUnknown_IMETHODS \ - IOleClientSite_METHODS -ICOM_DEFINE(IOleClientSite,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleClientSite_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleClientSite_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleClientSite_Release(p) ICOM_CALL (Release,p) -/*** IOleClientSite methods ***/ -#define IOleClientSite_SaveObject(p) ICOM_CALL (SaveObject,p) -#define IOleClientSite_GetMoniker(p,a,b,c) ICOM_CALL3(GetMoniker,p,a,b,c) -#define IOleClientSite_GetContainer(p,a) ICOM_CALL1(GetContainer,p,a) -#define IOleClientSite_ShowObject(p) ICOM_CALL (ShowObject,p) -#define IOleClientSite_OnShowWindow(p,a) ICOM_CALL1(OnShowWindow,p,a) -#define IOleClientSite_RequestNewObjectLayout(p) ICOM_CALL (RequestNewObjectLayout(p) - - -/***************************************************************************** - * IParseDisplayName interface - */ -#define ICOM_INTERFACE IParseDisplayName -#define IParseDisplayName_METHODS \ - ICOM_METHOD4(HRESULT,ParseDisplayName, IBindCtx*,pbc, LPOLESTR,pszDisplayName, ULONG*,pchEaten, IMoniker**,ppmkOut) -#define IParseDisplayName_IMETHODS \ - IUnknown_IMETHODS \ - IParseDisplayName_METHODS -ICOM_DEFINE(IParseDisplayName,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IParseDisplayName_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IParseDisplayName_AddRef(p) ICOM_CALL (AddRef,p) -#define IParseDisplayName_Release(p) ICOM_CALL (Release,p) -/*** IParseDisplayName methods ***/ -#define IParseDisplayName_ParseDisplayName(p,a,b,c,d) ICOM_CALL4(ParseDisplayName,p,a,b,c,d) - - -/***************************************************************************** - * IOleContainer interface - */ -#define ICOM_INTERFACE IOleContainer -#define IOleContainer_METHODS \ - ICOM_METHOD2(HRESULT,EnumObjects, DWORD,grfFlags, IEnumUnknown**,ppenum) \ - ICOM_METHOD1(HRESULT,LockContainer, BOOL,fLock) -#define IOleContainer_IMETHODS \ - IParseDisplayName_IMETHODS \ - IOleContainer_METHODS -ICOM_DEFINE(IOleContainer,IParseDisplayName) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleContainer_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleContainer_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleContainer_Release(p) ICOM_CALL (Release,p) -/*** IParseDisplayName methods ***/ -#define IOleContainer_ParseDisplayName(p,a,b,c,d) ICOM_CALL4(ParseDisplayName,p,a,b,c,d) -/*** IOleClientSite methods ***/ -#define IOleContainer_EnumObjects(p,a,b) ICOM_CALL (EnumObjects,p,a,b) -#define IOleContainer_LockContainer(p,a) ICOM_CALL3(LockContainer,p,a) - - -/***************************************************************************** - * IOleItemContainer interface - */ -#ifdef __WINE__ -#undef GetObject -#endif - -#define ICOM_INTERFACE IOleItemContainer -#define IOleItemContainer_METHODS \ - ICOM_METHOD5(HRESULT,GetObject, LPOLESTR,pszItem, DWORD,dwSpeedNeeded, IBindCtx*,pbc, REFIID,riid, void**,ppvObject) \ - ICOM_METHOD4(HRESULT,GetObjectStorage, LPOLESTR,pszItem, IBindCtx*,pbc, REFIID,riid, void**,ppvStorage) \ - ICOM_METHOD1(HRESULT,IsRunning, LPOLESTR,pszItem) -#define IOleItemContainer_IMETHODS \ - IOleContainer_IMETHODS \ - IOleItemContainer_METHODS -ICOM_DEFINE(IOleItemContainer,IOleContainer) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleItemContainer_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleItemContainer_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleItemContainer_Release(p) ICOM_CALL (Release,p) -/*** IParseDisplayName methods ***/ -#define IOleItemContainer_GetObject(p,a,b,c,d,e) ICOM_CALL5(GetObject,p,a,b,c,d,e) -#define IOleItemContainer_GetObjectStorage(p,a,b,c,d) ICOM_CALL4(GetObjectStorage,p,a,b,c,d) -#define IOleItemContainer_IsRunning(p,a) ICOM_CALL1(IsRunning,p,a) - - -/***************************************************************************** - * IOleItemContainer interface - */ -#define ICOM_INTERFACE IOleLink -#define IOleLink_METHODS \ - ICOM_METHOD1(HRESULT,SetUpdateOptions, DWORD,dwUpdateOpt) \ - ICOM_METHOD1(HRESULT,GetUpdateOptions, DWORD*,pdwUpdateOpt) \ - ICOM_METHOD2(HRESULT,SetSourceMoniker, IMoniker*,pmk, REFCLSID,rclsid) \ - ICOM_METHOD1(HRESULT,GetSourceMoniker, IMoniker**,ppmk) \ - ICOM_METHOD1(HRESULT,SetSourceDisplayName, LPCOLESTR,pszStatusText) \ - ICOM_METHOD1(HRESULT,GetSourceDisplayName, LPOLESTR*,ppszDisplayName) \ - ICOM_METHOD2(HRESULT,BindToSource, DWORD,bindflags, IBindCtx*,pbc) \ - ICOM_METHOD (HRESULT,BindIfRunning) \ - ICOM_METHOD1(HRESULT,GetBoundSource, IUnknown**,ppunk) \ - ICOM_METHOD (HRESULT,UnBindSource) \ - ICOM_METHOD1(HRESULT,Update, IBindCtx*,pbc) -#define IOleLink_IMETHODS \ - IUnknown_IMETHODS \ - IOleLink_METHODS -ICOM_DEFINE(IOleLink,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleLink_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleLink_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleLink_Release(p) ICOM_CALL (Release,p) -/*** IOleLink methods ***/ -#define IOleLink_SetUpdateOptions(p,a) ICOM_CALL1(SetUpdateOptions,p,a) -#define IOleLink_GetUpdateOptions(p,a) ICOM_CALL1(GetUpdateOptions,p,a) -#define IOleLink_SetSourceMoniker(p,a,b) ICOM_CALL2(SetSourceMoniker,p,a,b) -#define IOleLink_GetSourceMoniker(p,a) ICOM_CALL1(GetSourceMoniker,p,a) -#define IOleLink_SetSourceDisplayName(p,a) ICOM_CALL1(SetSourceDisplayName,p,a) -#define IOleLink_GetSourceDisplayName(p,a) ICOM_CALL1(GetSourceDisplayName,p,a) -#define IOleLink_BindToSource(p,a,b) ICOM_CALL2(BindToSource,p,a,b) -#define IOleLink_BindIfRunning(p) ICOM_CALL (BindIfRunning,p) -#define IOleLink_GetBoundSource(p,a) ICOM_CALL1(GetBoundSource,p,a) -#define IOleLink_UnBindSource(p) ICOM_CALL (UnBindSource,p) -#define IOleLink_Update(p,a) ICOM_CALL1(Update,p,a) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_INPLACE_H */ - - diff --git a/reactos/include/ole32/obj_marshal.h b/reactos/include/ole32/obj_marshal.h deleted file mode 100644 index e3656180d89..00000000000 --- a/reactos/include/ole32/obj_marshal.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Defines the COM interfaces and APIs that allow an interface to - * specify a custom marshaling for its objects. - */ - -#ifndef __WINE_WINE_OBJ_MARSHAL_H -#define __WINE_WINE_OBJ_MARSHAL_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IMarshal, 0x00000003L, 0, 0); -typedef struct IMarshal IMarshal,*LPMARSHAL; - -DEFINE_OLEGUID(IID_IStdMarshalInfo, 0x00000018L, 0, 0); -typedef struct IStdMarshalInfo IStdMarshalInfo,*LPSTDMARSHALINFO; - - -/***************************************************************************** - * IMarshal interface - */ -#define ICOM_INTERFACE IMarshal -#define IMarshal_METHODS \ - ICOM_METHOD6(HRESULT,GetUnmarshalClass, REFIID,riid, void*,pv, DWORD,dwDestContext, void*,pvDestContext, DWORD,mshlflags, CLSID*,pCid) \ - ICOM_METHOD6(HRESULT,GetMarshalSizeMax, REFIID,riid, void*,pv, DWORD,dwDestContext, void*,pvDestContext, DWORD,mshlflags, DWORD*,pSize) \ - ICOM_METHOD6(HRESULT,MarshalInterface, IStream*,pStm, REFIID,riid, void*,pv, DWORD,dwDestContext, void*,pvDestContext, DWORD,mshlflags) \ - ICOM_METHOD3(HRESULT,UnmarshalInterface, IStream*,pStm, REFIID,riid, void**,ppv) \ - ICOM_METHOD1(HRESULT,ReleaseMarshalData, IStream*,pStm) \ - ICOM_METHOD1(HRESULT,DisconnectObject, DWORD,dwReserved) -#define IMarshal_IMETHODS \ - IUnknown_IMETHODS \ - IMarshal_METHODS -ICOM_DEFINE(IMarshal,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IMarshal_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IMarshal_AddRef(p) ICOM_CALL (AddRef,p) -#define IMarshal_Release(p) ICOM_CALL (Release,p) -/*** IMarshal methods ***/ -#define IMarshal_GetUnmarshalClass(p,a,b,c,d,e,f) ICOM_CALL6(GetUnmarshalClass,p,a,b,c,d,e,f) -#define IMarshal_GetMarshalSizeMax(p,a,b,c,d,e,f) ICOM_CALL6(GetMarshalSizeMax,p,a,b,c,d,e,f) -#define IMarshal_MarshalInterface(p,a,b,c,d,e,f) ICOM_CALL6(MarshalInterface,p,a,b,c,d,e,f) -#define IMarshal_UnmarshalInterface(p,a,b,c) ICOM_CALL3(UnmarshalInterface,p,a,b,c) -#define IMarshal_ReleaseMarshalData(p,a) ICOM_CALL1(ReleaseMarshalData,p,a) -#define IMarshal_DisconnectObject(p,a) ICOM_CALL1(DisconnectObject,p,a) - - -/***************************************************************************** - * IStdMarshalInfo interface - */ -#define ICOM_INTERFACE IStdMarshalInfo -#define IStdMarshalInfo_METHODS \ - ICOM_METHOD3(HRESULT,GetClassForHandler, DWORD,dwDestContext, void*,pvDestContext, CLSID*,pClsid) -#define IStdMarshalInfo_IMETHODS \ - IUnknown_IMETHODS \ - IStdMarshalInfo_METHODS -ICOM_DEFINE(IStdMarshalInfo,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IStdMarshalInfo_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IStdMarshalInfo_AddRef(p) ICOM_CALL (AddRef,p) -#define IStdMarshalInfo_Release(p) ICOM_CALL (Release,p) -/*** IStdMarshalInfo methods ***/ -#define IStdMarshalInfo_GetClassForHandler(p,a,b,c) ICOM_CALL3(GetClassForHandler,p,a,b,c) - - -/***************************************************************************** - * Additional marshalling API - */ - -/* FIXME: not implemented */ -HRESULT WINAPI CoCreateFreeThreadedMarshaler(LPUNKNOWN punkOuter, LPUNKNOWN* ppunkMarshal); - -/* FIXME: not implemented */ -HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID iid, LPVOID* ppv); - -/* FIXME: not implemented */ -HRESULT WINAPI CoGetMarshalSizeMax(ULONG* pulSize, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags); - -/* FIXME: not implemented */ -HRESULT WINAPI CoGetStandardMarshal(REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL* ppMarshal); - -/* FIXME: not implemented */ -HRESULT WINAPI CoMarshalHresult(LPSTREAM pstm, HRESULT hresult); - -/* FIXME: not implemented */ -HRESULT WINAPI CoMarshalInterface(LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags); - -/* FIXME: not implemented */ -HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM* ppStm); - -/* FIXME: not implemented */ -HRESULT WINAPI CoReleaseMarshalData(LPSTREAM pStm); - -/* FIXME: not implemented */ -HRESULT WINAPI CoUnmarshalHresult(LPSTREAM pstm, HRESULT* phresult); - -/* FIXME: not implemented */ -HRESULT WINAPI CoUnmarshalInterface(LPSTREAM pStm, REFIID riid, LPVOID* ppv); - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_MARSHAL_H */ diff --git a/reactos/include/ole32/obj_misc.h b/reactos/include/ole32/obj_misc.h deleted file mode 100644 index 0a312c152fa..00000000000 --- a/reactos/include/ole32/obj_misc.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Defines miscellaneous COM interfaces and APIs defined in objidl.h. - * These did not really fit into the other categories, whould have - * required their own specific category or are too rarely used to be - * put in 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_MISC_H -#define __WINE_WINE_OBJ_MISC_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IEnumString, 0x00000101L, 0, 0); -typedef struct IEnumString IEnumString,*LPENUMSTRING; - -DEFINE_OLEGUID(IID_IEnumUnknown, 0x00000100L, 0, 0); -typedef struct IEnumUnknown IEnumUnknown,*LPENUMUNKNOWN; - -DEFINE_OLEGUID(IID_IMallocSpy, 0x0000001dL, 0, 0); -typedef struct IMallocSpy IMallocSpy,*LPMALLOCSPY; - -DEFINE_OLEGUID(IID_IMultiQI, 0x00000020L, 0, 0); -typedef struct IMultiQI IMultiQI,*LPMULTIQI; - - -/***************************************************************************** - * IEnumString interface - */ -#define ICOM_INTERFACE IEnumString -#define IEnumString_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,celt, LPOLESTR*,rgelt, ULONG*,pceltFethed) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT, Clone, IEnumString**, ppenum) -#define IEnumString_IMETHODS \ - IUnknown_IMETHODS \ - IEnumString_METHODS -ICOM_DEFINE(IEnumString,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumString_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumString_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumString_Release(p) ICOM_CALL (Release,p) -/*** IEnumString methods ***/ -#define IEnumString_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumString_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumString_Reset(p) ICOM_CALL (Reset,p) -#define IEnumString_Clone(p,a) ICOM_CALL1(Clone,p,a) - - - -/***************************************************************************** - * IEnumUnknown interface - */ -#define ICOM_INTERFACE IEnumUnknown -#define IEnumUnknown_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,celt, IUnknown**,rgelt, ULONG*,pceltFethed) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumUnknown**,ppenum) -#define IEnumUnknown_IMETHODS \ - IUnknown_IMETHODS \ - IEnumUnknown_METHODS -ICOM_DEFINE(IEnumUnknown,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumUnknown_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumUnknown_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumUnknown_Release(p) ICOM_CALL (Release,p) -/*** IEnumUnknown methods ***/ -#define IEnumUnknown_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumUnknown_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumUnknown_Reset(p) ICOM_CALL (Reset,p) -#define IEnumUnknown_Clone(p,a) ICOM_CALL1(Clone,p,a) - - -/***************************************************************************** - * IMallocSpy interface - */ -#define ICOM_INTERFACE IMallocSpy -#define IMallocSpy_METHODS \ - ICOM_METHOD1 (ULONG,PreAlloc, ULONG,cbRequest) \ - ICOM_VMETHOD1( PostAlloc, void*,pActual) \ - ICOM_METHOD2 (PVOID,PreFree, void*,pRequest, BOOL,fSpyed) \ - ICOM_VMETHOD1( PostFree, BOOL,fSpyed) \ - ICOM_METHOD4 (ULONG,PreRealloc, void*,pRequest, ULONG,cbRequest, void**,ppNewRequest, BOOL,fSpyed) \ - ICOM_METHOD2 (PVOID,PostRealloc, void*,pActual, BOOL,fSpyed) \ - ICOM_METHOD2 (PVOID,PreGetSize, void*,pRequest, BOOL,fSpyed) \ - ICOM_METHOD2 (ULONG,PostGetSize, ULONG,cbActual, BOOL,fSpyed) \ - ICOM_METHOD2 (PVOID,PreDidAlloc, void*,pRequest, BOOL,fSpyed) \ - ICOM_METHOD3 (int, PostDidAlloc, void*,pRequest, BOOL,fSpyed, int,fActual) \ - ICOM_METHOD (int, PreHeapMinimize) \ - ICOM_METHOD (int, PostHeapMinimize) -#define IMallocSpy_IMETHODS \ - IUnknown_IMETHODS \ - IMallocSpy_METHODS -ICOM_DEFINE(IMallocSpy,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IMallocSpy_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IMallocSpy_AddRef(p) ICOM_CALL (AddRef,p) -#define IMallocSpy_Release(p) ICOM_CALL (Release,p) -/*** IMallocSpy methods ***/ -#define IMallocSpy_PreAlloc(p,a) ICOM_CALL1(PreAlloc,p,a) -#define IMallocSpy_PostAlloc(p,a) ICOM_CALL1(PostAlloc,p,a) -#define IMallocSpy_PreFree(p,a,b) ICOM_CALL2(PreFree,p,a,b) -#define IMallocSpy_PostFree(p,a) ICOM_CALL1(PostFree,p,a) -#define IMallocSpy_PreRealloc(p,a,b,c,d) ICOM_CALL4(PreRealloc,p,a,b,c,d) -#define IMallocSpy_PostRealloc(p,a,b) ICOM_CALL2(PostRealloc,p,a,b) -#define IMallocSpy_PreGetSize(p,a,b) ICOM_CALL2(PreGetSize,p,a,b) -#define IMallocSpy_PostGetSize(p,a,b) ICOM_CALL2(PostGetSize,p,a,b) -#define IMallocSpy_PreDidAlloc(p,a,b) ICOM_CALL2(PreDidAlloc,p,a,b) -#define IMallocSpy_PostDidAlloc(p,a,b,c) ICOM_CALL3(PostDidAlloc,p,a,b,c) -#define IMallocSpy_PreHeapMinimize(p) ICOM_CALL (PreHeapMinimize,p) -#define IMallocSpy_PostHeapMinimize(p) ICOM_CALL (PostHeapMinimize,p) - -/* FIXME: not implemented */ -HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy); - -/* FIXME: not implemented */ -HRESULT WINAPI CoRevokeMallocSpy(void); - -HRESULT WINAPI CoFileTimeNow(FILETIME* lpFileTime); - - -/***************************************************************************** - * IMultiQI interface - */ -typedef struct tagMULTI_QI -{ - const IID* pIID; - IUnknown* pItf; - HRESULT hr; -} MULTI_QI; - -#define ICOM_INTERFACE IMultiQI -#define IMultiQI_METHODS \ - ICOM_METHOD2(HRESULT,QueryMultipleInterfaces, ULONG,cMQIs, MULTI_QI*,pMQIs) -#define IMultiQI_IMETHODS \ - IUnknown_IMETHODS \ - IMultiQI_METHODS -ICOM_DEFINE(IMultiQI,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IMultiQI_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IMultiQI_AddRef(p) ICOM_CALL (AddRef,p) -#define IMultiQI_Release(p) ICOM_CALL (Release,p) -/*** IMultiQI methods ***/ -#define IMultiQI_QueryMultipleInterfaces(p,a,b) ICOM_CALL2(QueryMultipleInterfaces,p,a,b) - - -/***************************************************************************** - * Additional API - */ - -DWORD WINAPI CoBuildVersion(void); - -DWORD WINAPI CoGetCurrentProcess(void); - -/* FIXME: unimplemented */ -HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew); - -/* FIXME: unimplemented */ -HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew); - -HRESULT WINAPI CoCreateInstance( - REFCLSID rclsid, - LPUNKNOWN pUnkOuter, - DWORD dwClsContext, - REFIID iid, - LPVOID *ppv); - -HRESULT WINAPI CoCreateInstanceEx(REFCLSID rclsid, - LPUNKNOWN pUnkOuter, - DWORD dwClsContext, - COSERVERINFO* pServerInfo, - ULONG cmq, - MULTI_QI* pResults); -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_MISC_H */ diff --git a/reactos/include/ole32/obj_moniker.h b/reactos/include/ole32/obj_moniker.h deleted file mode 100644 index a08a7e99271..00000000000 --- a/reactos/include/ole32/obj_moniker.h +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to the moniker functionality. - */ -#ifndef __WINE_WINE_OBJ_MONIKER_H -#define __WINE_WINE_OBJ_MONIKER_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IBindCtx,0xe,0,0); -typedef struct IBindCtx IBindCtx,*LPBINDCTX; -typedef LPBINDCTX LPBC; - -DEFINE_OLEGUID(IID_IClassActivator, 0x00000140L, 0, 0); -typedef struct IClassActivator IClassActivator,*LPCLASSACTIVATOR; - -DEFINE_OLEGUID(IID_IEnumMoniker, 0x00000102L, 0, 0); -typedef struct IEnumMoniker IEnumMoniker,*LPENUMMONIKER; - -DEFINE_OLEGUID(IID_IMoniker, 0x0000000fL, 0, 0); -typedef struct IMoniker IMoniker,*LPMONIKER; - -DEFINE_GUID (IID_IROTData, 0xf29f6bc0L, 0x5021, 0x11ce, 0xaa, 0x15, 0x00, 0x00, 0x69, 0x01, 0x29, 0x3f); -typedef struct IROTData IROTData,*LPROTDATA; - -DEFINE_OLEGUID(IID_IRunnableObject, 0x00000126L, 0, 0); -typedef struct IRunnableObject IRunnableObject,*LPRUNNABLEOBJECT; - -DEFINE_OLEGUID(IID_IRunningObjectTable, 0x00000010L, 0, 0); -typedef struct IRunningObjectTable IRunningObjectTable,*LPRUNNINGOBJECTTABLE; - -DEFINE_GUID( CLSID_FileMoniker,0x00000303,0,0,0xc0,0,0,0,0,0,0,0x46); - -DEFINE_GUID( CLSID_ItemMoniker,0x00000304,0,0,0xc0,0,0,0,0,0,0,0x46); - -DEFINE_GUID( CLSID_AntiMoniker,0x00000305,0,0,0xc0,0,0,0,0,0,0,0x46); - -DEFINE_GUID( CLSID_CompositeMoniker,0x00000309,0,0,0xc0,0,0,0,0,0,0,0x46); - -/********************************************************************************* - * BIND_OPTS and BIND_OPTS2 structures definition - * These structures contain parameters used during a moniker-binding operation. - *********************************************************************************/ -typedef struct tagBIND_OPTS -{ - DWORD cbStruct; - DWORD grfFlags; - DWORD grfMode; - DWORD dwTickCountDeadline; -} BIND_OPTS, * LPBIND_OPTS; - -typedef struct tagBIND_OPTS2 -{ - DWORD cbStruct; - DWORD grfFlags; - DWORD grfMode; - DWORD dwTickCountDeadline; - DWORD dwTrackFlags; - DWORD dwClassContext; - LCID locale; - COSERVERINFO* pServerInfo; -} BIND_OPTS2, * LPBIND_OPTS2; - -/***************************************************************************** - * IBindCtx interface - */ -#define ICOM_INTERFACE IBindCtx -#define IBindCtx_METHODS \ - ICOM_METHOD1 (HRESULT, RegisterObjectBound, IUnknown*,punk) \ - ICOM_METHOD1 (HRESULT, RevokeObjectBound, IUnknown*,punk) \ - ICOM_METHOD (HRESULT, ReleaseBoundObjects) \ - ICOM_METHOD1 (HRESULT, SetBindOptions, LPBIND_OPTS2,pbindopts) \ - ICOM_METHOD1 (HRESULT, GetBindOptions, LPBIND_OPTS2,pbindopts) \ - ICOM_METHOD1 (HRESULT, GetRunningObjectTable,IRunningObjectTable**,pprot) \ - ICOM_METHOD2 (HRESULT, RegisterObjectParam, LPOLESTR,pszkey, IUnknown*,punk) \ - ICOM_METHOD2 (HRESULT, GetObjectParam, LPOLESTR,pszkey, IUnknown**,punk) \ - ICOM_METHOD1 (HRESULT, EnumObjectParam, IEnumString**,ppenum) \ - ICOM_METHOD1 (HRESULT, RevokeObjectParam, LPOLESTR,pszkey) -#define IBindCtx_IMETHODS \ - IUnknown_IMETHODS \ - IBindCtx_METHODS -ICOM_DEFINE(IBindCtx,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IBindCtx_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IBindCtxr_AddRef(p) ICOM_CALL (AddRef,p) -#define IBindCtx_Release(p) ICOM_CALL (Release,p) -/* IBindCtx methods*/ -#define IBindCtx_RegisterObjectBound(p,a) ICOM_CALL1(RegisterObjectBound,p,a) -#define IBindCtx_RevokeObjectBound(p,a) ICOM_CALL1(RevokeObjectBound,p,a) -#define IBindCtx_ReleaseBoundObjects(p) ICOM_CALL (ReleaseBoundObjects,p) -#define IBindCtx_SetBindOptions(p,a) ICOM_CALL1(SetBindOptions,p,a) -#define IBindCtx_GetBindOptions(p,a) ICOM_CALL1(GetBindOptions,p,a) -#define IBindCtx_GetRunningObjectTable(p,a) ICOM_CALL1(GetRunningObjectTable,p,a) -#define IBindCtx_RegisterObjectParam(p,a,b) ICOM_CALL2(RegisterObjectParam,p,a,b) -#define IBindCtx_GetObjectParam(p,a,b) ICOM_CALL2(GetObjectParam,p,a,b) -#define IBindCtx_EnumObjectParam(p,a) ICOM_CALL1(EnumObjectParam,p,a) -#define IBindCtx_RevokeObjectParam(p,a) ICOM_CALL1(RevokeObjectParam,p,a) - -HRESULT WINAPI CreateBindCtx16(DWORD reserved, LPBC* ppbc); -HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC* ppbc); - -/***************************************************************************** - * IClassActivator interface - */ -#define ICOM_INTERFACE IClassActivator -#define IClassActivator_METHODS \ - ICOM_METHOD5(HRESULT,GetClassObject, REFCLSID,rclsid, DWORD,dwClassContext, LCID,locale, REFIID,riid, void**,ppv) -#define IClassActivator_IMETHODS \ - IUnknown_IMETHODS \ - IClassActivator_METHODS -ICOM_DEFINE(IClassActivator,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IClassActivator_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IClassActivator_AddRef(p) ICOM_CALL (AddRef,p) -#define IClassActivator_Release(p) ICOM_CALL (Release,p) -/*** IClassActivator methods ***/ -#define IClassActivator_GetClassObject(p,a,b,c,d,e) ICOM_CALL5(GetClassObject,p,a,b,c,d,e) - - -/***************************************************************************** - * IEnumMoniker interface - */ -#define ICOM_INTERFACE IEnumMoniker -#define IEnumMoniker_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,celt, IMoniker**,rgelt, ULONG*,pceltFethed) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumMoniker**,ppenum) -#define IEnumMoniker_IMETHODS \ - IUnknown_IMETHODS \ - IEnumMoniker_METHODS -ICOM_DEFINE(IEnumMoniker,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumMoniker_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumMoniker_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumMoniker_Release(p) ICOM_CALL (Release,p) -/*** IEnumMoniker methods ***/ -#define IEnumMoniker_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumMoniker_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumMoniker_Reset(p) ICOM_CALL (Reset,p) -#define IEnumMoniker_Clone(p,a) ICOM_CALL1(Clone,p,a) - -/***************************************************************************** - * IMoniker interface - */ - -typedef enum tagMKSYS -{ - MKSYS_NONE = 0, - MKSYS_GENERICCOMPOSITE = 1, - MKSYS_FILEMONIKER = 2, - MKSYS_ANTIMONIKER = 3, - MKSYS_ITEMMONIKER = 4, - MKSYS_POINTERMONIKER = 5, - MKSYS_CLASSMONIKER = 7 -} MKSYS; - -typedef enum tagMKREDUCE -{ - MKRREDUCE_ONE = 3 << 16, - MKRREDUCE_TOUSER = 2 << 16, - MKRREDUCE_THROUGHUSER = 1 << 16, - MKRREDUCE_ALL = 0 -} MKRREDUCE; - -#define ICOM_INTERFACE IMoniker -#define IMoniker_METHODS \ - ICOM_METHOD4(HRESULT,BindToObject, IBindCtx*,pbc, IMoniker*,pmkToLeft, REFIID,riidResult, void**,ppvResult) \ - ICOM_METHOD4(HRESULT,BindToStorage, IBindCtx*,pbc, IMoniker*,pmkToLeft, REFIID,riid, void**,ppvObj) \ - ICOM_METHOD4(HRESULT,Reduce, IBindCtx*,pbc, DWORD,dwReduceHowFar, IMoniker**,ppmkToLeft, IMoniker**,ppmkReduced) \ - ICOM_METHOD3(HRESULT,ComposeWith, IMoniker*,pmkRight, BOOL,fOnlyIfNotGeneric, IMoniker**,ppmkComposite) \ - ICOM_METHOD2(HRESULT,Enum, BOOL,fForward, IEnumMoniker**,ppenumMoniker) \ - ICOM_METHOD1(HRESULT,IsEqual, IMoniker*,pmkOtherMoniker) \ - ICOM_METHOD1(HRESULT,Hash, DWORD*,pdwHash) \ - ICOM_METHOD3(HRESULT,IsRunning, IBindCtx*,pbc, IMoniker*,pmkToLeft, IMoniker*,pmkNewlyRunning) \ - ICOM_METHOD3(HRESULT,GetTimeOfLastChange, IBindCtx*,pbc, IMoniker*,pmkToLeft, FILETIME*,pFileTime) \ - ICOM_METHOD1(HRESULT,Inverse, IMoniker**,ppmk) \ - ICOM_METHOD2(HRESULT,CommonPrefixWith, IMoniker*,pmkOtherMoniker, IMoniker**,ppmkPrefix) \ - ICOM_METHOD2(HRESULT,RelativePathTo, IMoniker*,pmkOther, IMoniker**,ppmkRelPath) \ - ICOM_METHOD3(HRESULT,GetDisplayName, IBindCtx*,pbc, IMoniker*,pmkToLeft, LPOLESTR*,ppszDisplayName) \ - ICOM_METHOD5(HRESULT,ParseDisplayName, IBindCtx*,pbc, IMoniker*,pmkToLeft, LPOLESTR,pszDisplayName, ULONG*,pchEaten, IMoniker**,ppmkOut) \ - ICOM_METHOD1(HRESULT,IsSystemMoniker, DWORD*,pdwMksys) -#define IMoniker_IMETHODS \ - IPersistStream_IMETHODS \ - IMoniker_METHODS -ICOM_DEFINE(IMoniker,IPersistStream) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IMoniker_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IMoniker_AddRef(p) ICOM_CALL (AddRef,p) -#define IMoniker_Release(p) ICOM_CALL (Release,p) - -/*** IPersist methods ***/ -#define IMoniker_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a) -/*** IPersistStream methods ***/ -#define IMoniker_IsDirty(p) ICOM_CALL (IsDirty,p) -#define IMoniker_Load(p,a) ICOM_CALL1(Load,p,a) -#define IMoniker_Save(p,a,b) ICOM_CALL2(Save,p,a,b) -#define IMoniker_GetSizeMax(p,a) ICOM_CALL1(GetSizeMax,p,a) -/*** IMoniker methods ***/ -#define IMoniker_BindToObject(p,a,b,c,d) ICOM_CALL4(BindToObject,p,a,b,c,d) -#define IMoniker_BindToStorage(p,a,b,c,d) ICOM_CALL4(BindToStorage,p,a,b,c,d) -#define IMoniker_Reduce(p,a,b,c,d) ICOM_CALL4(Reduce,p,a,b,c,d) -#define IMoniker_ComposeWith(p,a,b,c) ICOM_CALL3(ComposeWith,p,a,b,c) -#define IMoniker_Enum(p,a,b) ICOM_CALL2(Enum,p,a,b) -#define IMoniker_IsEqual(p,a) ICOM_CALL1(IsEqual,p,a) -#define IMoniker_Hash(p,a) ICOM_CALL1(Hash,p,a) -#define IMoniker_IsRunning(p,a,b,c) ICOM_CALL3(IsRunning,p,a,b,c) -#define IMoniker_GetTimeOfLastChange(p,a,b,c) ICOM_CALL3(GetTimeOfLastChange,p,a,b,c) -#define IMoniker_Inverse(p,a) ICOM_CALL1(Inverse,p,a) -#define IMoniker_CommonPrefixWith(p,a,b) ICOM_CALL2(CommonPrefixWith,p,a,b) -#define IMoniker_RelativePathTo(p,a,b) ICOM_CALL2(RelativePathTo,p,a,b) -#define IMoniker_GetDisplayName(p,a,b,c) ICOM_CALL3(GetDisplayName,p,a,b,c) -#define IMoniker_ParseDisplayName(p,a,b,c,d,e) ICOM_CALL5(ParseDisplayName,p,a,b,c,d,e) -#define IMoniker_IsSystemMoniker(p,a) ICOM_CALL1(IsSystemMoniker,p,a) - -HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName, LPMONIKER* ppmk); -HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER* ppmk); - -HRESULT WINAPI CreateItemMoniker16(LPCOLESTR16 lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk); -HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk); - -HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk); - -HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite); - -/* FIXME: not implemented */ -HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID* ppvResult); - -/* FIXME: not implemented */ -HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, LPMONIKER* ppmk); - -/* FIXME: not implemented */ -HRESULT WINAPI CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER* ppmk); - -/* FIXME: not implemented */ -HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon); -/***************************************************************************** - * IROTData interface - */ -#define ICOM_INTERFACE IROTData -#define IROTData_METHODS \ - ICOM_METHOD3(HRESULT,GetComparisonData, BYTE*,pbData, ULONG,cbMax, ULONG*,pcbData) -#define IROTData_IMETHODS \ - IUnknown_IMETHODS \ - IROTData_METHODS -ICOM_DEFINE(IROTData,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IROTData_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IROTData_AddRef(p) ICOM_CALL (AddRef,p) -#define IROTData_Release(p) ICOM_CALL (Release,p) -/*** IROTData methods ***/ -#define IROTData_GetComparisonData(p,a,b,c) ICOM_CALL3(GetComparisonData,p,a,b,c) - -#define ICOM_THIS_From_IROTData(class, name) class* This = (class*)(((char*)name)-sizeof(void*)) - -/***************************************************************************** - * IRunnableObject interface - */ -#define ICOM_INTERFACE IRunnableObject -#define IRunnableObject_METHODS \ - ICOM_METHOD1(HRESULT,GetRunningClass, LPCLSID,lpClsid) \ - ICOM_METHOD1(HRESULT,Run, IBindCtx*,pbc) \ - ICOM_METHOD (BOOL,IsRunning) \ - ICOM_METHOD2(HRESULT,LockRunning, BOOL,fLock, BOOL,fLastUnlockCloses) \ - ICOM_METHOD1(HRESULT,SetContainedObject, BOOL,fContained) -#define IRunnableObject_IMETHODS \ - IUnknown_IMETHODS \ - IRunnableObject_METHODS -ICOM_DEFINE(IRunnableObject,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IRunnableObject_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IRunnableObject_AddRef(p) ICOM_CALL (AddRef,p) -#define IRunnableObject_Release(p) ICOM_CALL (Release,p) -/*** IRunnableObject methods ***/ -#define IRunnableObject_GetRunningClass(p,a) ICOM_CALL1(GetRunningClass,p,a) -#define IRunnableObject_Run(p,a) ICOM_CALL1(Run,p,a) -#define IRunnableObject_IsRunning(p) ICOM_CALL (IsRunning,p) -#define IRunnableObject_LockRunning(p,a,b) ICOM_CALL2(LockRunning,p,a,b) -#define IRunnableObject_SetContainedObject(p,a) ICOM_CALL1(SetContainedObject,p,a) - - -/***************************************************************************** - * IRunningObjectTable interface - */ -#ifdef __WINE__ -#undef GetObject -#endif - -#define ICOM_INTERFACE IRunningObjectTable -#define IRunningObjectTable_METHODS \ - ICOM_METHOD4(HRESULT,Register, DWORD,grfFlags, IUnknown*,punkObject, IMoniker*,pmkObjectName, DWORD*,pdwRegister) \ - ICOM_METHOD1(HRESULT,Revoke, DWORD,dwRegister) \ - ICOM_METHOD1(HRESULT,IsRunning, IMoniker*,pmkObjectName) \ - ICOM_METHOD2(HRESULT,GetObject, IMoniker*,pmkObjectName, IUnknown**,ppunkObject) \ - ICOM_METHOD2(HRESULT,NoteChangeTime, DWORD,dwRegister, FILETIME*,pfiletime) \ - ICOM_METHOD2(HRESULT,GetTimeOfLastChange, IMoniker*,pmkObjectName, FILETIME*,pfiletime) \ - ICOM_METHOD1(HRESULT,EnumRunning, IEnumMoniker**,ppenumMoniker) -#define IRunningObjectTable_IMETHODS \ - IUnknown_IMETHODS \ - IRunningObjectTable_METHODS -ICOM_DEFINE(IRunningObjectTable,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IRunningObjectTable_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IRunningObjectTable_AddRef(p) ICOM_CALL (AddRef,p) -#define IRunningObjectTable_Release(p) ICOM_CALL (Release,p) -/*** IRunningObjectTable methods ***/ -#define IRunningObjectTable_Register(p,a,b,c,d) ICOM_CALL4(Register,p,a,b,c,d) -#define IRunningObjectTable_Revoke(p,a) ICOM_CALL1(Revoke,p,a) -#define IRunningObjectTable_IsRunning(p,a) ICOM_CALL1(IsRunning,p,a) -#define IRunningObjectTable_GetObject(p,a,b) ICOM_CALL2(GetObject,p,a,b) -#define IRunningObjectTable_NoteChangeTime(p,a,b) ICOM_CALL2(NoteChangeTime,p,a,b) -#define IRunningObjectTable_GetTimeOfLastChange(p,a,b) ICOM_CALL2(GetTimeOfLastChange,p,a,b) -#define IRunningObjectTable_EnumRunning(p,a) ICOM_CALL1(EnumRunning,p,a) - -HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot); -HRESULT WINAPI GetRunningObjectTable16(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot); - -/***************************************************************************** - * Additional API - */ - -/* FIXME: not implemented */ -HRESULT WINAPI CoGetInstanceFromFile(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, DWORD grfMode, OLECHAR* pwszName, DWORD dwCount, MULTI_QI* pResults); - -/* FIXME: not implemented */ -HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, IStorage* pstg, DWORD dwCount, MULTI_QI* pResults); - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_MONIKER_H */ diff --git a/reactos/include/ole32/obj_oleaut.h b/reactos/include/ole32/obj_oleaut.h deleted file mode 100644 index 04c5c0cd205..00000000000 --- a/reactos/include/ole32/obj_oleaut.h +++ /dev/null @@ -1,824 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to OLE automation support. - */ - -#ifndef __WINE_WINE_OBJ_OLEAUT_H -#define __WINE_WINE_OBJ_OLEAUT_H - - -DEFINE_OLEGUID(IID_StdOle, 0x00020430,0,0); - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IDispatch, 0x00020400,0,0); -typedef struct IDispatch IDispatch,*LPDISPATCH; - -DEFINE_OLEGUID(IID_ITypeInfo, 0x00020401,0,0); -typedef struct ITypeInfo ITypeInfo,*LPTYPEINFO; - -DEFINE_OLEGUID(IID_ITypeLib, 0x00020402,0,0); -typedef struct ITypeLib ITypeLib,*LPTYPELIB; - -DEFINE_OLEGUID(IID_ITypeComp, 0x00020403,0,0); -typedef struct ITypeComp ITypeComp,*LPTYPECOMP; - -DEFINE_OLEGUID(IID_IEnumVARIANT, 0x00020404,0,0); -typedef struct IEnumVARIANT IEnumVARIANT,*LPENUMVARIANT; - -DEFINE_OLEGUID(IID_ICreateTypeInfo, 0x00020405,0,0); -typedef struct ICreateTypeInfo ICreateTypeInfo,*LPCREATETYPEINFO; - -DEFINE_OLEGUID(IID_ICreateTypeLib, 0x00020406,0,0); -typedef struct ICreateTypeLib ICreateTypeLib,*LPCREATETYPELIB; - -DEFINE_OLEGUID(IID_ICreateTypeInfo2,0x0002040E,0,0); -typedef struct ICreateTypeInfo2 ICreateTypeInfo2,*LPCREATETYPEINFO2; - -DEFINE_OLEGUID(IID_ICreateTypeLib2, 0x0002040F,0,0); -typedef struct ICreateTypeLib2 ICreateTypeLib2,*LPCREATETYPELIB2; - -DEFINE_OLEGUID(IID_ITypeChangeEvents,0x00020410,0,0); -typedef struct ITypeChangeEvents ITypeChangeEvents,*LPTYPECHANGEEVENTS; - -DEFINE_OLEGUID(IID_ITypeLib2, 0x00020411,0,0); -typedef struct ITypeLib2 ITypeLib2,*LPTYPELIB2; - -DEFINE_OLEGUID(IID_ITypeInfo2, 0x00020412,0,0); -typedef struct ITypeInfo2 ITypeInfo2,*LPTYPEINFO2; - -/***************************************************************************** - * Automation data types - */ - -/***************************************************************** - * SafeArray defines and structs - */ - -#define FADF_AUTO ( 0x1 ) -#define FADF_STATIC ( 0x2 ) -#define FADF_EMBEDDED ( 0x4 ) -#define FADF_FIXEDSIZE ( 0x10 ) -#define FADF_RECORD ( 0x20 ) -#define FADF_HAVEIID ( 0x40 ) -#define FADF_HAVEVARTYPE ( 0x80 ) -#define FADF_BSTR ( 0x100 ) -#define FADF_UNKNOWN ( 0x200 ) -#define FADF_DISPATCH ( 0x400 ) -#define FADF_VARIANT ( 0x800 ) -#define FADF_RESERVED ( 0xf008 ) - -/* Undocumented flags */ -#define FADF_CREATEVECTOR ( 0x2000 ) /* set when the safe array is created using SafeArrayCreateVector */ - - -typedef struct tagSAFEARRAYBOUND -{ - ULONG cElements; /* Number of elements in dimension */ - LONG lLbound; /* Lower bound of dimension */ -} SAFEARRAYBOUND; - -typedef struct tagSAFEARRAY -{ - USHORT cDims; /* Count of array dimension */ - USHORT fFeatures; /* Flags describing the array */ - ULONG cbElements; /* Size of each element */ - ULONG cLocks; /* Number of lock on array */ - PVOID pvData; /* Pointer to data valid when cLocks > 0 */ - SAFEARRAYBOUND rgsabound[ 1 ]; /* One bound for each dimension */ -} SAFEARRAY, *LPSAFEARRAY; - -typedef enum tagCALLCONV { - CC_CDECL = 1, - CC_MSCPASCAL = CC_CDECL + 1, - CC_PASCAL = CC_MSCPASCAL, - CC_MACPASCAL = CC_PASCAL + 1, - CC_STDCALL = CC_MACPASCAL + 1, - CC_RESERVED = CC_STDCALL + 1, - CC_SYSCALL = CC_RESERVED + 1, - CC_MPWCDECL = CC_SYSCALL + 1, - CC_MPWPASCAL = CC_MPWCDECL + 1, - CC_MAX = CC_MPWPASCAL + 1 -} CALLCONV; - -typedef CY CURRENCY; - -/* - * Declarations of the VARIANT structure and the VARIANT APIs. - */ -/* S_OK : Success. - * DISP_E_BADVARTYPE : The variant type vt in not a valid type of variant. - * DISP_E_OVERFLOW : The data pointed to by pvarSrc does not fit in the destination type. - * DISP_E_TYPEMISMATCH : The variant type vt is not a valid type of variant. - * E_INVALIDARG : One argument is invalid. - * * E_OUTOFMEMORY : Memory could not be allocated for the conversion. - * DISP_E_ARRAYISLOCKED : The variant contains an array that is locked. - */ - -typedef struct tagVARIANT VARIANT, *LPVARIANT; -typedef struct tagVARIANT VARIANTARG, *LPVARIANTARG; - -struct tagVARIANT { - VARTYPE vt; - WORD wReserved1; - WORD wReserved2; - WORD wReserved3; - union /* DUMMYUNIONNAME */ - { - /* By value. */ - CHAR cVal; - USHORT uiVal; - ULONG ulVal; - INT intVal; - UINT uintVal; - BYTE bVal; - short iVal; - long lVal; - float fltVal; - double dblVal; - VARIANT_BOOL boolVal; - SCODE scode; - DATE date; - BSTR bstrVal; - CY cyVal; - /* FIXME: This is not supposed to be at this level - * See bug #181 in bugzilla - * DECIMAL decVal; - */ - IUnknown* punkVal; - IDispatch* pdispVal; - SAFEARRAY* parray; - - /* By reference */ - CHAR* pcVal; - USHORT* puiVal; - ULONG* pulVal; - INT* pintVal; - UINT* puintVal; - BYTE* pbVal; - short* piVal; - long* plVal; - float* pfltVal; - double* pdblVal; - VARIANT_BOOL* pboolVal; - SCODE* pscode; - DATE* pdate; - BSTR* pbstrVal; - VARIANT* pvarVal; - PVOID byref; - CY* pcyVal; - DECIMAL* pdecVal; - IUnknown** ppunkVal; - IDispatch** ppdispVal; - SAFEARRAY** pparray; - } DUMMYUNIONNAME; -}; - - -typedef LONG DISPID; -typedef DWORD HREFTYPE; -typedef DISPID MEMBERID; - -#define DISPATCH_METHOD 0x1 -#define DISPATCH_PROPERTYGET 0x2 -#define DISPATCH_PROPERTYPUT 0x4 -#define DISPATCH_PROPERTYPUTREF 0x8 - -#define DISPID_UNKNOWN ( -1 ) -#define DISPID_VALUE ( 0 ) -#define DISPID_PROPERTYPUT ( -3 ) -#define DISPID_NEWENUM ( -4 ) -#define DISPID_EVALUATE ( -5 ) -#define DISPID_CONSTRUCTOR ( -6 ) -#define DISPID_DESTRUCTOR ( -7 ) -#define DISPID_COLLECT ( -8 ) - -#define MEMBERID_NIL DISPID_UNKNOWN - -#define IMPLTYPEFLAG_FDEFAULT (0x1) -#define IMPLTYPEFLAG_FSOURCE (0x2) -#define IMPLTYPEFLAG_FRESTRICTED (0x4) -#define IMPLTYPEFLAG_FDEFAULTVTABLE (0x8) - -typedef struct tagDISPPARAMS -{ - VARIANTARG* rgvarg; - DISPID* rgdispidNamedArgs; - UINT cArgs; - UINT cNamedArgs; -} DISPPARAMS; - -typedef struct tagEXCEPINFO -{ - WORD wCode; - WORD wReserved; - BSTR bstrSource; - BSTR bstrDescription; - BSTR bstrHelpFile; - DWORD dwHelpContext; - PVOID pvReserved; - HRESULT __stdcall (*pfnDeferredFillIn)(struct tagEXCEPINFO *); - SCODE scode; -} EXCEPINFO, * LPEXCEPINFO; - -typedef struct tagIDLDESC -{ - ULONG dwReserved; - USHORT wIDLFlags; -} IDLDESC; - -typedef struct tagPARAMDESCEX -{ - ULONG cBytes; - VARIANTARG varDefaultValue; -} PARAMDESCEX, *LPPARAMDESCEX; - -typedef struct tagPARAMDESC -{ - LPPARAMDESCEX pparamdescex; - USHORT wParamFlags; -} PARAMDESC; - -#define PARAMFLAG_NONE (0x00) -#define PARAMFLAG_FIN (0x01) -#define PARAMFLAG_FOUT (0x02) -#define PARAMFLAG_FLCID (0x04) -#define PARAMFLAG_FRETVAL (0x08) -#define PARAMFLAG_FOPT (0x10) -#define PARAMFLAG_FHASDEFAULT (0x20) - - -typedef struct tagTYPEDESC -{ - union { - struct tagTYPEDESC *lptdesc; - struct tagARRAYDESC *lpadesc; - HREFTYPE hreftype; - } DUMMYUNIONNAME; - VARTYPE vt; -} TYPEDESC; - -typedef struct tagELEMDESC -{ - TYPEDESC tdesc; - union { - IDLDESC idldesc; - PARAMDESC paramdesc; - } DUMMYUNIONNAME; -} ELEMDESC, *LPELEMDESC; - -typedef enum tagTYPEKIND -{ - TKIND_ENUM = 0, - TKIND_RECORD = 1, - TKIND_MODULE = 2, - TKIND_INTERFACE = 3, - TKIND_DISPATCH = 4, - TKIND_COCLASS = 5, - TKIND_ALIAS = 6, - TKIND_UNION = 7, - TKIND_MAX = 8 -} TYPEKIND; - -typedef struct tagTYPEATTR -{ - GUID guid; - LCID lcid; - DWORD dwReserved; - MEMBERID memidConstructor; - MEMBERID memidDestructor; - LPOLESTR lpstrSchema; - ULONG cbSizeInstance; - TYPEKIND typekind; - WORD cFuncs; - WORD cVars; - WORD cImplTypes; - WORD cbSizeVft; - WORD cbAlignment; - WORD wTypeFlags; - WORD wMajorVerNum; - WORD wMinorVerNum; - TYPEDESC tdescAlias; - IDLDESC idldescType; -} TYPEATTR, *LPTYPEATTR; - -#define TYPEFLAG_NONE (0x00) -#define TYPEFLAG_FAPPOBJECT (0x01) -#define TYPEFLAG_FCANCREATE (0x02) -#define TYPEFLAG_FLICENSED (0x04) -#define TYPEFLAG_FPREDECLID (0x08) -#define TYPEFLAG_FHIDDEN (0x0f) -#define TYPEFLAG_FCONTROL (0x20) -#define TYPEFLAG_FDUAL (0x40) -#define TYPEFLAG_FNONEXTENSIBLE (0x80) -#define TYPEFLAG_FOLEAUTOMATION (0x100) -#define TYPEFLAG_FRESTRICTED (0x200) -#define TYPEFLAG_FAGGREGATABLE (0x400) -#define TYPEFLAG_FREPLACEABLE (0x800) -#define TYPEFLAG_FDISPATCHABLE (0x1000) -#define TYPEFLAG_FREVERSEBIND (0x2000) -#define TYPEFLAG_FPROXY (0x4000) -#define TYPEFLAG_DEFAULTFILTER (0x8000) -#define TYPEFLAG_COCLASSATTRIBUTES (0x63f) -#define TYPEFLAG_INTERFACEATTRIBUTES (0x7bd0) -#define TYPEFLAG_DISPATCHATTRIBUTES (0x5a90) -#define TYPEFLAG_ALIASATTRIBUTES (0x210) -#define TYPEFLAG_MODULEATTRIBUTES (0x210) -#define TYPEFLAG_ENUMATTRIBUTES (0x210) -#define TYPEFLAG_RECORDATTRIBUTES (0x210) -#define TYPEFLAG_UNIONATTRIBUTES (0x210) - -typedef struct tagARRAYDESC -{ - TYPEDESC tdescElem; - USHORT cDims; - SAFEARRAYBOUND rgbounds[1]; -} ARRAYDESC; - -typedef enum tagFUNCKIND -{ - FUNC_VIRTUAL = 0, - FUNC_PUREVIRTUAL = 1, - FUNC_NONVIRTUAL = 2, - FUNC_STATIC = 3, - FUNC_DISPATCH = 4 -} FUNCKIND; - -typedef enum tagINVOKEKIND -{ - INVOKE_FUNC = 1, - INVOKE_PROPERTYGET = 2, - INVOKE_PROPERTYPUT = 3, - INVOKE_PROPERTYPUTREF = 4 -} INVOKEKIND; - -typedef struct tagFUNCDESC -{ - MEMBERID memid; - SCODE *lprgscode; - ELEMDESC *lprgelemdescParam; - FUNCKIND funckind; - INVOKEKIND invkind; - CALLCONV callconv; - SHORT cParams; - SHORT cParamsOpt; - SHORT oVft; - SHORT cScodes; - ELEMDESC elemdescFunc; - WORD wFuncFlags; -} FUNCDESC, *LPFUNCDESC; - -typedef enum tagVARKIND -{ - VAR_PERINSTANCE = 0, - VAR_STATIC = 1, - VAR_CONST = 2, - VAR_DISPATCH = 3 -} VARKIND; - -typedef struct tagVARDESC -{ - MEMBERID memid; - LPOLESTR lpstrSchema; - union { - ULONG oInst; - VARIANT *lpvarValue; - } DUMMYUNIONNAME; - ELEMDESC elemdescVar; - WORD wVarFlags; - VARKIND varkind; -} VARDESC, *LPVARDESC; - -typedef enum tagSYSKIND -{ - SYS_WIN16 = 0, - SYS_WIN32 = 1, - SYS_MAC = 2 -} SYSKIND; - -typedef enum tagLIBFLAGS -{ - LIBFLAG_FRESTRICTED = 0x1, - LIBFLAG_FCONTROL = 0x2, - LIBFLAG_FHIDDEN = 0x4, - LIBFLAG_FHASDISKIMAGE = 0x8 -} LIBFLAGS; - -typedef struct tagTLIBATTR -{ - GUID guid; - LCID lcid; - SYSKIND syskind; - WORD wMajorVerNum; - WORD wMinorVerNum; - WORD wLibFlags; -} TLIBATTR, *LPTLIBATTR; - -typedef enum tagDESCKIND -{ - DESCKIND_NONE = 0, - DESCKIND_FUNCDESC = 1, - DESCKIND_VARDESC = 2, - DESCKIND_TYPECOMP = 3, - DESCKIND_IMPLICITAPPOBJ = 4, - DESCKIND_MAX = 6 -} DESCKIND; - -typedef union tagBINDPTR -{ - FUNCDESC *lpfuncdesc; - VARDESC *lpvardesc; - ITypeComp *lptcomp; -} BINDPTR, *LPBINDPTR; - -typedef enum tagVARFLAGS -{ - VARFLAG_FREADONLY = 0x1, - VARFLAG_FSOURCE = 0x2, - VARFLAG_FBINDABLE = 0x4, - VARFLAG_FREQUESTEDIT = 0x8, - VARFLAG_FDISPLAYBIND = 0x10, - VARFLAG_FDEFAULTBIND = 0x20, - VARFLAG_FHIDDEN = 0x40, - VARFLAG_FRESTRICTED = 0x80, - VARFLAG_FDEFAULTCOLLELEM = 0x100, - VARFLAG_FUIDEFAULT = 0x200, - VARFLAG_FNONBROWSABLE = 0x400, - VARFLAG_FREPLACEABLE = 0x800, - VARFLAG_FIMMEDIATEBIND = 0x1000 -} VARFLAGS; - - -/* - * Data types for Variants. - */ - -enum VARENUM { - VT_EMPTY = 0, - VT_NULL = 1, - VT_I2 = 2, - VT_I4 = 3, - VT_R4 = 4, - VT_R8 = 5, - VT_CY = 6, - VT_DATE = 7, - VT_BSTR = 8, - VT_DISPATCH = 9, - VT_ERROR = 10, - VT_BOOL = 11, - VT_VARIANT = 12, - VT_UNKNOWN = 13, - VT_DECIMAL = 14, - VT_I1 = 16, - VT_UI1 = 17, - VT_UI2 = 18, - VT_UI4 = 19, - VT_I8 = 20, - VT_UI8 = 21, - VT_INT = 22, - VT_UINT = 23, - VT_VOID = 24, - VT_HRESULT = 25, - VT_PTR = 26, - VT_SAFEARRAY = 27, - VT_CARRAY = 28, - VT_USERDEFINED = 29, - VT_LPSTR = 30, - VT_LPWSTR = 31, - VT_RECORD = 36, - VT_FILETIME = 64, - VT_BLOB = 65, - VT_STREAM = 66, - VT_STORAGE = 67, - VT_STREAMED_OBJECT = 68, - VT_STORED_OBJECT = 69, - VT_BLOB_OBJECT = 70, - VT_CF = 71, - VT_CLSID = 72, - VT_VECTOR = 0x1000, - VT_ARRAY = 0x2000, - VT_BYREF = 0x4000, - VT_RESERVED = 0x8000, - VT_ILLEGAL = 0xffff, - VT_ILLEGALMASKED = 0xfff, - VT_TYPEMASK = 0xfff -}; - -/* the largest valide type - */ -#define VT_MAXVALIDTYPE VT_CLSID - - -/* - * Declarations of the VARIANT structure and the VARIANT APIs. - */ - -/* S_OK : Success. - * DISP_E_BADVARTYPE : The variant type vt in not a valid type of variant. - * DISP_E_OVERFLOW : The data pointed to by pvarSrc does not fit in the destination type. - * DISP_E_TYPEMISMATCH : The variant type vt is not a valid type of variant. - * E_INVALIDARG : One argument is invalid. - * E_OUTOFMEMORY : Memory could not be allocated for the conversion. - * DISP_E_ARRAYISLOCKED : The variant contains an array that is locked. - */ - - -typedef struct tagCUSTDATAITEM { - GUID guid; - VARIANTARG varValue; -} CUSTDATAITEM, *LPCUSTDATAITEM; - -typedef struct tagCUSTDATA { - INT cCustData; - LPCUSTDATAITEM prgCustData; /* count cCustdata */ -} CUSTDATA, *LPCUSTDATA; - - - -/***************************************************************************** - * IDispatch interface - */ -#define ICOM_INTERFACE IDispatch -#define IDispatch_METHODS \ - ICOM_METHOD1(HRESULT, GetTypeInfoCount, UINT*, pctinfo) \ - ICOM_METHOD3(HRESULT, GetTypeInfo, UINT, iTInfo, LCID, lcid, ITypeInfo**, ppTInfo) \ - ICOM_METHOD5(HRESULT, GetIDsOfNames, REFIID, riid, LPOLESTR*, rgszNames, UINT, cNames, LCID, lcid, DISPID*, rgDispId) \ - ICOM_METHOD8(HRESULT, Invoke, DISPID, dispIdMember, REFIID, riid, LCID, lcid, WORD, wFlags, DISPPARAMS*, pDispParams, VARIANT*, pVarResult, EXCEPINFO*, pExepInfo, UINT*, puArgErr) -#define IDispatch_IMETHODS \ - IUnknown_IMETHODS \ - IDispatch_METHODS -ICOM_DEFINE(IDispatch,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IDispatch_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IDispatch_AddRef(p) ICOM_CALL (AddRef,p) -#define IDispatch_Release(p) ICOM_CALL (Release,p) -/*** IDispatch methods ***/ -#define IDispatch_GetTypeInfoCount(p,a) ICOM_CALL1 (GetTypeInfoCount,p,a) -#define IDispatch_GetTypeInfo(p,a,b,c) ICOM_CALL3 (GetTypeInfo,p,a,b,c) -#define IDispatch_GetIDsOfNames(p,a,b,c,d,e) ICOM_CALL5 (GetIDsOfNames,p,a,b,c,d,e) -#define IDispatch_Invoke(p,a,b,c,d,e,f,g,h) ICOM_CALL8 (Invoke,p,a,b,c,d,e,f,g,h) - - -/***************************************************************************** - * ITypeInfo interface - */ -#define ICOM_INTERFACE ITypeInfo -#define ITypeInfo_METHODS \ - ICOM_METHOD1(HRESULT,GetTypeAttr, TYPEATTR**,ppTypeAttr) \ - ICOM_METHOD1(HRESULT,GetTypeComp, ITypeComp**,ppTComp) \ - ICOM_METHOD2(HRESULT,GetFuncDesc, UINT,index, FUNCDESC**,ppFuncDesc) \ - ICOM_METHOD2(HRESULT,GetVarDesc, UINT,index, VARDESC**,ppVarDesc) \ - ICOM_METHOD4(HRESULT,GetNames, MEMBERID,memid, BSTR*,rgBstrNames, UINT,cMaxNames, UINT*,pcNames) \ - ICOM_METHOD2(HRESULT,GetRefTypeOfImplType, UINT,index, HREFTYPE*, pRefType) \ - ICOM_METHOD2(HRESULT,GetImplTypeFlags, UINT,index, INT*,pImplTypeFlags)\ - ICOM_METHOD3(HRESULT,GetIDsOfNames, LPOLESTR*,rgszNames, UINT,cNames, MEMBERID*,pMemId) \ - ICOM_METHOD7(HRESULT,Invoke, PVOID,pvInstance, MEMBERID,memid, WORD,wFlags, DISPPARAMS*,pDispParams, VARIANT*,pVarResult, EXCEPINFO*,pExcepInfo, UINT*,puArgErr) \ - ICOM_METHOD5(HRESULT,GetDocumentation, MEMBERID,memid, BSTR*,pBstrName, BSTR*,pBstrDocString, DWORD*,pdwHelpContext, BSTR*,pBstrHelpFile) \ - ICOM_METHOD5(HRESULT,GetDllEntry, MEMBERID,memid, INVOKEKIND,invKind, BSTR*,pBstrDllName, BSTR*,pBstrName, WORD*,pwOrdinal) \ - ICOM_METHOD2(HRESULT,GetRefTypeInfo, HREFTYPE,hRefType, ITypeInfo**,ppTInfo) \ - ICOM_METHOD3(HRESULT,AddressOfMember, MEMBERID,memid, INVOKEKIND,invKind, PVOID*,ppv) \ - ICOM_METHOD3(HRESULT,CreateInstance, IUnknown*,pUnkOuter, REFIID,riid, PVOID*,ppvObj) \ - ICOM_METHOD2(HRESULT,GetMops, MEMBERID,memid, BSTR*,pBstrMops) \ - ICOM_METHOD2(HRESULT,GetContainingTypeLib, ITypeLib**,ppTLib, UINT*,pIndex) \ - ICOM_METHOD1(HRESULT,ReleaseTypeAttr, TYPEATTR*,pTypeAttr) \ - ICOM_METHOD1(HRESULT,ReleaseFuncDesc, FUNCDESC*,pFuncDesc) \ - ICOM_METHOD1(HRESULT,ReleaseVarDesc, VARDESC*,pVarDesc) - -#define ITypeInfo_IMETHODS \ - IUnknown_IMETHODS \ - ITypeInfo_METHODS -ICOM_DEFINE(ITypeInfo,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ITypeInfo_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ITypeInfo_AddRef(p) ICOM_CALL (AddRef,p) -#define ITypeInfo_Release(p) ICOM_CALL (Release,p) -/*** ITypeInfo methods ***/ -#define ITypeInfo_GetTypeAttr(p,a) ICOM_CALL1(GetTypeAttr,p,a) -#define ITypeInfo_GetTypeComp(p,a) ICOM_CALL1(GetTypeComp,p,a) -#define ITypeInfo_GetFuncDesc(p,a,b) ICOM_CALL2(GetFuncDesc,p,a,b) -#define ITypeInfo_GetVarDesc(p,a,b) ICOM_CALL2(GetVarDesc,p,a,b) -#define ITypeInfo_GetNames(p,a,b,c,d) ICOM_CALL4(GetNames,p,a,b,c,d) -#define ITypeInfo_GetRefTypeOfImplType(p,a,b) ICOM_CALL2(GetRefTypeOfImplType,p,a,b) -#define ITypeInfo_GetImplTypeFlags(p,a,b) ICOM_CALL2(GetImplTypeFlags,p,a,b) -#define ITypeInfo_GetIDsOfNames(p,a,b,c) ICOM_CALL3(GetIDsOfNames,p,a,b,c) -#define ITypeInfo_Invoke(p,a,b,c,d,e,f,g) ICOM_CALL7(Invoke,p,a,b,c,d,e,f,g) -#define ITypeInfo_GetDocumentation(p,a,b,c,d,e) ICOM_CALL5(GetDocumentation,p,a,b,c,d,e) -#define ITypeInfo_GetDllEntry(p,a,b,c,d,e) ICOM_CALL5(GetDllEntry,p,a,b,c,d,e) -#define ITypeInfo_GetRefTypeInfo(p,a,b) ICOM_CALL2(GetRefTypeInfo,p,a,b) -#define ITypeInfo_AddressOfMember(p,a,b,c) ICOM_CALL3(AddressOfMember,p,a,b,c) -#define ITypeInfo_CreateInstance(p,a,b,c) ICOM_CALL3(CreateInstance,p,a,b,c) -#define ITypeInfo_GetMops(p,a,b) ICOM_CALL2(GetMops,p,a,b) -#define ITypeInfo_GetContainingTypeLib(p,a,b) ICOM_CALL2(GetContainingTypeLib,p,a,b) -#define ITypeInfo_ReleaseTypeAttr(p,a) ICOM_CALL1(ReleaseTypeAttr,p,a) -#define ITypeInfo_ReleaseFuncDesc(p,a) ICOM_CALL1(ReleaseFuncDesc,p,a) -#define ITypeInfo_ReleaseVarDesc(p,a) ICOM_CALL1(ReleaseVarDesc,p,a) - - -/***************************************************************************** - * ITypeInfo2 interface - */ -#define ICOM_INTERFACE ITypeInfo2 -#define ITypeInfo2_METHODS \ - ICOM_METHOD1(HRESULT, GetTypeKind, TYPEKIND*, pTypeKind) \ - ICOM_METHOD1(HRESULT, GetTypeFlags, UINT*, pTypeFlags) \ - ICOM_METHOD3(HRESULT, GetFuncIndexOfMemId, MEMBERID, memid, INVOKEKIND,\ - invKind, UINT*, pFuncIndex) \ - ICOM_METHOD2(HRESULT, GetVarIndexOfMemId, MEMBERID, memid, UINT*, \ - pVarIndex) \ - ICOM_METHOD2(HRESULT, GetCustData, REFGUID, guid, VARIANT*, pVarVal) \ - ICOM_METHOD3(HRESULT, GetFuncCustData, UINT, index, REFGUID, guid,\ - VARIANT*, pVarVal) \ - ICOM_METHOD4(HRESULT, GetParamCustData, UINT, indexFunc, UINT,\ - indexParam, REFGUID, guid, VARIANT*, pVarVal) \ - ICOM_METHOD3(HRESULT, GetVarCustData, UINT, index, REFGUID, guid,\ - VARIANT*, pVarVal) \ - ICOM_METHOD3(HRESULT, GetImplTypeCustData, UINT, index, REFGUID, guid,\ - VARIANT*, pVarVal) \ - ICOM_METHOD5(HRESULT, GetDocumentation2, MEMBERID, memid, LCID, lcid,\ - BSTR*, pbstrHelpString, DWORD*, pdwHelpStringContext,\ - BSTR*, pbstrHelpStringDll) \ - ICOM_METHOD1(HRESULT, GetAllCustData, CUSTDATA*, pCustData) \ - ICOM_METHOD2(HRESULT, GetAllFuncCustData, UINT, index, CUSTDATA*,\ - pCustData)\ - ICOM_METHOD3(HRESULT, GetAllParamCustData, UINT, indexFunc, UINT,\ - indexParam, CUSTDATA*, pCustData) \ - ICOM_METHOD2(HRESULT, GetAllVarCustData, UINT, index, CUSTDATA*,\ - pCustData) \ - ICOM_METHOD2(HRESULT, GetAllImplTypeCustData, UINT, index, CUSTDATA*,\ - pCustData) - -#define ITypeInfo2_IMETHODS \ - IUnknown_IMETHODS \ - ITypeInfo_METHODS \ - ITypeInfo2_METHODS -ICOM_DEFINE(ITypeInfo2,ITypeInfo) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ITypeInfo2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ITypeInfo2_AddRef(p) ICOM_CALL (AddRef,p) -#define ITypeInfo2_Release(p) ICOM_CALL (Release,p) -/*** ITypeInfo methods ***/ -#define ITypeInfo2_GetTypeAttr(p,a) ICOM_CALL1(GetTypeAttr,p,a) -#define ITypeInfo2_GetTypeComp(p,a) ICOM_CALL1(GetTypeComp,p,a) -#define ITypeInfo2_GetFuncDesc(p,a,b) ICOM_CALL2(GetFuncDesc,p,a,b) -#define ITypeInfo2_GetVarDesc(p,a,b) ICOM_CALL2(GetVarDesc,p,a,b) -#define ITypeInfo2_GetNames(p,a,b,c,d) ICOM_CALL4(GetNames,p,a,b,c,d) -#define ITypeInfo2_GetRefTypeOfImplType(p,a,b) ICOM_CALL2(GetRefTypeOfImplType,p,a,b) -#define ITypeInfo2_GetImplTypeFlags(p,a,b) ICOM_CALL2(GetImplTypeFlags,p,a,b) -#define ITypeInfo2_GetIDsOfNames(p,a,b,c) ICOM_CALL3(GetIDsOfNames,p,a,b,c) -#define ITypeInfo2_Invoke(p,a,b,c,d,e,f,g) ICOM_CALL7(Invoke,p,a,b,c,d,e,f,g) -#define ITypeInfo2_GetDocumentation(p,a,b,c,d,e) ICOM_CALL5(GetDocumentation,p,a,b,c,d,e) -#define ITypeInfo2_GetDllEntry(p,a,b,c,d,e) ICOM_CALL5(GetDllEntry,p,a,b,c,d,e) -#define ITypeInfo2_GetRefTypeInfo(p,a,b) ICOM_CALL2(GetRefTypeInfo,p,a,b) -#define ITypeInfo2_AddressOfMember(p,a,b,c) ICOM_CALL3(AddressOfMember,p,a,b,c) -#define ITypeInfo2_CreateInstance(p,a,b,c) ICOM_CALL3(CreateInstance,p,a,b,c) -#define ITypeInfo2_GetMops(p,a,b) ICOM_CALL2(GetMops,p,a,b) -#define ITypeInfo2_GetContainingTypeLib(p,a,b) ICOM_CALL2(GetContainingTypeLib,p,a,b) -#define ITypeInfo2_ReleaseTypeAttr(p,a) ICOM_CALL1(ReleaseTypeAttr,p,a) -#define ITypeInfo2_ReleaseFuncDesc(p,a) ICOM_CALL1(ReleaseFuncDesc,p,a) -#define ITypeInfo2_ReleaseVarDesc(p,a) ICOM_CALL1(ReleaseVarDesc,p,a) -/*** ITypeInfo2 methods ***/ -#define ITypeInfo2_GetTypeKind(p,a) ICOM_CALL1(GetTypeKind,p,a) -#define ITypeInfo2_GetTypeFlags(p,a) ICOM_CALL1(GetTypeFlags,p,a) -#define ITypeInfo2_GetFuncIndexOfMemId(p,a,b,c) ICOM_CALL3(GetFuncIndexOfMemId,p,a,b,c) -#define ITypeInfo2_GetVarIndexOfMemId(p,a,b) ICOM_CALL2(GetVarIndexOfMemId,p,a,b) -#define ITypeInfo2_GetCustData(p,a,b) ICOM_CALL2(GetCustData,p,a,b) -#define ITypeInfo2_GetFuncCustData(p,a,b,c) ICOM_CALL3(GetFuncCustData,p,a,b,c) -#define ITypeInfo2_GetParamCustData(p,a,b,c,d) ICOM_CALL4(GetParamCustData,p,a,b,c,d) -#define ITypeInfo2_GetVarCustData(p,a,b,c) ICOM_CALL3(GetVarCustData,p,a,b,c) -#define ITypeInfo2_GetImplTypeCustData(p,a,b,c) ICOM_CALL3(GetImplTypeCustData,p,a,b,c) -#define ITypeInfo2_GetDocumentation2(p,a,b,c,d,e) ICOM_CALL5(GetDocumentation2,p,a,b,c,d,e) -#define ITypeInfo2_GetAllCustData(p,a) ICOM_CALL1(GetAllCustData,p,a) -#define ITypeInfo2_GetAllFuncCustData(p,a,b) ICOM_CALL2(GetAllFuncCustData,p,a,b) -#define ITypeInfo2_GetAllParamCustData(p,a,b,c) ICOM_CALL3(GetAllParamCustData,p,a,b,c) -#define ITypeInfo2_GetAllVarCustData(p,a,b) ICOM_CALL2(GetAllVarCustData,p,a,b) -#define ITypeInfo2_GetAllImplTypeCustData(p,a,b) ICOM_CALL2(GetAllImplTypeCustData,p,a,b) - -/***************************************************************************** - * ITypeLib interface - */ -#define ICOM_INTERFACE ITypeLib -#define ITypeLib_METHODS \ - ICOM_METHOD (UINT,GetTypeInfoCount) \ - ICOM_METHOD2(HRESULT,GetTypeInfo, UINT,index, ITypeInfo**,ppTInfo) \ - ICOM_METHOD2(HRESULT,GetTypeInfoType, UINT,index, TYPEKIND*,pTKind) \ - ICOM_METHOD2(HRESULT,GetTypeInfoOfGuid, REFGUID,guid, ITypeInfo**,ppTinfo) \ - ICOM_METHOD1(HRESULT,GetLibAttr, TLIBATTR**,ppTLibAttr) \ - ICOM_METHOD1(HRESULT,GetTypeComp, ITypeComp**,ppTComp) \ - ICOM_METHOD5(HRESULT,GetDocumentation, INT,index, BSTR*,pBstrName, BSTR*,pBstrDocString, DWORD*,pdwHelpContext, BSTR*,pBstrHelpFile) \ - ICOM_METHOD3(HRESULT,IsName, LPOLESTR,szNameBuf, ULONG,lHashVal, BOOL*,bfName) \ - ICOM_METHOD5(HRESULT,FindName, LPOLESTR,szNameBuf, ULONG,lHashVal, ITypeInfo**,ppTInfo, MEMBERID*,rgMemId, USHORT*,pcFound) \ - ICOM_METHOD1(VOID,ReleaseTLibAttr, TLIBATTR*,pTLibAttr) -#define ITypeLib_IMETHODS \ - IUnknown_IMETHODS \ - ITypeLib_METHODS -ICOM_DEFINE(ITypeLib,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ITypeLib_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ITypeLib_AddRef(p) ICOM_CALL (AddRef,p) -#define ITypeLib_Release(p) ICOM_CALL (Release,p) -/*** ITypeLib methods ***/ -#define ITypeLib_GetTypeInfoCount(p) ICOM_CALL (GetTypeInfoCount,p) -#define ITypeLib_GetTypeInfo(p,a,b) ICOM_CALL2(GetTypeInfo,p,a,b) -#define ITypeLib_GetTypeInfoType(p,a,b) ICOM_CALL2(GetTypeInfoType,p,a,b) -#define ITypeLib_GetTypeInfoOfGuid(p,a,b) ICOM_CALL2(GetTypeInfoOfGuid,p,a,b) -#define ITypeLib_GetLibAttr(p,a) ICOM_CALL1(GetLibAttr,p,a) -#define ITypeLib_GetTypeComp(p,a) ICOM_CALL1(GetTypeComp,p,a) -#define ITypeLib_GetDocumentation(p,a,b,c,d,e) ICOM_CALL5(GetDocumentation,p,a,b,c,d,e) -#define ITypeLib_IsName(p,a,b,c) ICOM_CALL3(IsName,p,a,b,c) -#define ITypeLib_FindName(p,a,b,c,d,e) ICOM_CALL5(FindName,p,a,b,c,d,e) -#define ITypeLib_ReleaseTLibAttr(p,a) ICOM_CALL1(ReleaseTLibAttr,p,a) - - -/***************************************************************************** - * ITypeLib2 interface - */ -#define ICOM_INTERFACE ITypeLib2 -#define ITypeLib2_METHODS \ - ICOM_METHOD2(HRESULT, GetCustData, REFGUID, guid, VARIANT*, pVarVal) \ - ICOM_METHOD2(HRESULT, GetLibStatistics, ULONG *, pcUniqueNames, ULONG*,pcchUniqueNames) \ - ICOM_METHOD5(HRESULT, GetDocumentation2, INT, index, LCID, lcid,BSTR*, pbstrHelpString, DWORD*, pdwHelpStringContext, BSTR*, strHelpStringDll) \ - ICOM_METHOD1(HRESULT, GetAllCustData, CUSTDATA *, pCustData) -#define ITypeLib2_IMETHODS \ - IUnknown_IMETHODS \ - ITypeLib_IMETHODS \ - ITypeLib2_METHODS -ICOM_DEFINE(ITypeLib2,ITypeLib) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ITypeLib2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ITypeLib2_AddRef(p) ICOM_CALL (AddRef,p) -#define ITypeLib2_Release(p) ICOM_CALL (Release,p) -/*** ITypeLib methods ***/ -#define ITypeLib2_GetTypeInfoCount(p) ICOM_CALL (GetTypeInfoCount,p) -#define ITypeLib2_GetTypeInfo(p,a,b) ICOM_CALL2(GetTypeInfo,p,a,b) -#define ITypeLib2_GetTypeInfoType(p,a,b) ICOM_CALL2(GetTypeInfoType,p,a,b) -#define ITypeLib2_GetTypeInfoOfGuid(p,a,b) ICOM_CALL2(GetTypeInfoOfGuid,p,a,b) -#define ITypeLib2_GetLibAttr(p,a) ICOM_CALL1(GetLibAttr,p,a) -#define ITypeLib2_GetTypeComp(p,a) ICOM_CALL1(GetTypeComp,p,a) -#define ITypeLib2_GetDocumentation(p,a,b,c,d,e) ICOM_CALL5(GetDocumentation,p,a,b,c,d,e) -#define ITypeLib2_IsName(p,a,b,c) ICOM_CALL3(IsName,p,a,b,c) -#define ITypeLib2_FindName(p,a,b,c,d,e) ICOM_CALL5(FindName,p,a,b,c,d,e) -#define ITypeLib2_ReleaseTLibAttr(p,a) ICOM_CALL1(ReleaseTLibAttr,p,a) -/*** ITypeLib2 methods ***/ -#define ITypeLib2_GetCustData(p,a,b) ICOM_CALL2(GetCustData,p,a,b) -#define ITypeLib2_GetLibStatistics(p,a,b) ICOM_CALL2(GetLibStatistics,p,a,b) -#define ITypeLib2_GetDocumentation2(p,a,b,c,d,e,f) ICOM_CALL5(GetDocumentation2,p,a,b,c,d,e) -#define ITypeLib2_GetAllCustData(p,a) ICOM_CALL1(GetAllCustData,p,a) - -/***************************************************************************** - * ITypeComp interface - */ -#define ICOM_INTERFACE ITypeComp -#define ITypeComp_METHODS \ - ICOM_METHOD6(HRESULT,Bind, LPOLESTR,szName, ULONG,lHashVal, WORD,wFlags, ITypeInfo**,ppTInfo, DESCKIND*,pDescKind, BINDPTR*,pBindPtr) \ - ICOM_METHOD4(HRESULT,BindType, LPOLESTR,szName, ULONG,lHashVal, ITypeInfo**,ppTInfo, ITypeComp**,ppTComp) -#define ITypeComp_IMETHODS \ - IUnknown_IMETHODS \ - ITypeComp_METHODS -ICOM_DEFINE(ITypeComp,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ITypeComp_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ITypeComp_AddRef(p) ICOM_CALL (AddRef,p) -#define ITypeComp_Release(p) ICOM_CALL (Release,p) -/*** ITypeComp methods ***/ -#define ITypeComp_Bind(p,a,b,c,d,e,f) ICOM_CALL6(Bind,p,a,b,c,d,e,f) -#define ITypeComp_BindType(p,a,b,c,d) ICOM_CALL4(BindType,p,a,b,c,d) - -/***************************************************************************** - * IEnumVARIANT interface - */ -#define ICOM_INTERFACE IEnumVARIANT -#define IEnumVARIANT_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,celt, VARIANT*,rgVar, ULONG*,pCeltFetched) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumVARIANT**,ppEnum) -#define IEnumVARIANT_IMETHODS \ - IUnknown_IMETHODS \ - IEnumVARIANT_METHODS -ICOM_DEFINE(IEnumVARIANT,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumVARIANT_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumVARIANT_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumVARIANT_Release(p) ICOM_CALL (Release,p) -/*** IEnumVARIANT methods ***/ -#define IEnumVARIANT_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumVARIANT_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumVARIANT_Reset(p) ICOM_CALL (Reset,p) -#define IEnumVARIANT_Clone(p,a) ICOM_CALL1(Clone,p,a) - -#endif /* __WINE_WINE_OBJ_OLEAUT_H */ - diff --git a/reactos/include/ole32/obj_olefont.h b/reactos/include/ole32/obj_olefont.h deleted file mode 100644 index c0edcf448a9..00000000000 --- a/reactos/include/ole32/obj_olefont.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to OLE font support. - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_OLEFONT_H -#define __WINE_WINE_OBJ_OLEFONT_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_GUID(IID_IFont, 0xBEF6E002, 0xA874, 0x101A, 0x8B, 0xBA, 0x00, 0xAA, 0x00, 0x30, 0x0C, 0xAB); -typedef struct IFont IFont,*LPFONT; - -DEFINE_GUID(IID_IFontDisp, 0xBEF6E003, 0xA874, 0x101A, 0x8B, 0xBA, 0x00, 0xAA, 0x00, 0x30, 0x0C, 0xAB); -typedef struct IFontDisp IFontDisp,*LPFONTDISP; - -typedef TEXTMETRICW TEXTMETRICOLE; - -/***************************************************************************** - * IFont interface - */ -#define ICOM_INTERFACE IFont -#define IFont_METHODS \ - ICOM_METHOD1(HRESULT, get_Name, BSTR*, pname) \ - ICOM_METHOD1(HRESULT, put_Name, BSTR, name) \ - ICOM_METHOD1(HRESULT, get_Size, CY*, psize) \ - ICOM_METHOD1(HRESULT, put_Size, CY, size) \ - ICOM_METHOD1(HRESULT, get_Bold, BOOL*, pbold) \ - ICOM_METHOD1(HRESULT, put_Bold, BOOL, bold) \ - ICOM_METHOD1(HRESULT, get_Italic, BOOL*, pitalic) \ - ICOM_METHOD1(HRESULT, put_Italic, BOOL, italic) \ - ICOM_METHOD1(HRESULT, get_Underline, BOOL*, punderline) \ - ICOM_METHOD1(HRESULT, put_Underline, BOOL, underline) \ - ICOM_METHOD1(HRESULT, get_Strikethrough, BOOL*, pstrikethrough) \ - ICOM_METHOD1(HRESULT, put_Strikethrough, BOOL, strikethrough) \ - ICOM_METHOD1(HRESULT, get_Weight, short*, pweight) \ - ICOM_METHOD1(HRESULT, put_Weight, short, weight) \ - ICOM_METHOD1(HRESULT, get_Charset, short*, pcharset) \ - ICOM_METHOD1(HRESULT, put_Charset, short, charset) \ - ICOM_METHOD1(HRESULT, get_hFont, HFONT*, phfont) \ - ICOM_METHOD1(HRESULT, Clone, IFont**, ppfont) \ - ICOM_METHOD1(HRESULT, IsEqual, IFont*, pFontOther) \ - ICOM_METHOD2(HRESULT, SetRatio, long, cyLogical, long, cyHimetric) \ - ICOM_METHOD1(HRESULT, QueryTextMetrics, TEXTMETRICOLE*, ptm) \ - ICOM_METHOD1(HRESULT, AddRefHfont, HFONT, hfont) \ - ICOM_METHOD1(HRESULT, ReleaseHfont, HFONT, hfont) \ - ICOM_METHOD1(HRESULT, SetHdc, HDC, hdc) -#define IFont_IMETHODS \ - IUnknown_IMEHTODS \ - IFont_METHODS -ICOM_DEFINE(IFont,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IFont_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IFont_AddRef(p) ICOM_CALL (AddRef,p) -#define IFont_Release(p) ICOM_CALL (Release,p) -/*** IFont methods ***/ -#define IFont_getName(p,a) ICOM_CALL1(get_Name,p,a) -#define IFont_putName(p,a) ICOM_CALL1(put_Name,p,a) -#define IFont_get_Size(p,a) ICOM_CALL1(get_Size,p,a) -#define IFont_put_Size(p,a) ICOM_CALL1(put_Size,p,a) -#define IFont_get_Bold(p,a) ICOM_CALL1(get_Bold,a) -#define IFont_put_Bold(p,a) ICOM_CALL1(put_Bold,a) -#define IFont_get_Italic(p,a) ICOM_CALL1(get_Italic,a) -#define IFont_put_Italic(p,a) ICOM_CALL1(put_Italic,a) -#define IFont_get_Underline(p,a) ICOM_CALL1(get_Underline,a) -#define IFont_put_Underline(p,a) ICOM_CALL1(put_Underline,a) -#define IFont_get_Strikethrough(p,a) ICOM_CALL1(get_Strikethrough,a) -#define IFont_put_Strikethrough(p,a) ICOM_CALL1(put_Strikethrough,a) -#define IFont_get_Weight(p,a) ICOM_CALL1(get_Weight,a) -#define IFont_put_Weight(p,a) ICOM_CALL1(put_Weight,a) -#define IFont_get_Charset(p,a) ICOM_CALL1(get_Charset,a) -#define IFont_put_Charset(p,a) ICOM_CALL1(put_Charset,a) -#define IFont_get_hFont(p,a) ICOM_CALL1(get_hFont,a) -#define IFont_put_hFont(p,a) ICOM_CALL1(put_hFont,a) -#define IFont_Clone(p,a) ICOM_CALL1(Clone,a) -#define IFont_IsEqual(p,a) ICOM_CALL1(IsEqual,a) -#define IFont_SetRatio(p,a,b) ICOM_CALL2(SetRatio,a,b) -#define IFont_QueryTextMetrics(p,a) ICOM_CALL1(QueryTextMetrics,a) -#define IFont_AddRefHfont(p,a) ICOM_CALL1(AddRefHfont,a) -#define IFont_ReleaseHfont(p,a) ICOM_CALL1(ReleaseHfont,a) -#define IFont_SetHdc(p,a) ICOM_CALL1(SetHdc,a) - -/***************************************************************************** - * IFont interface - */ -#define ICOM_INTERFACE IFontDisp -#define IFontDisp_METHODS -#define IFontDisp_IMETHODS \ - IUnknown_IMETHODS \ - IFontDisp_METHODS -ICOM_DEFINE(IFontDisp,IDispatch) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IFontDisp_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IFontDisp_AddRef(p) ICOM_CALL (AddRef,p) -#define IFontDisp_Release(p) ICOM_CALL (Release,p) -/*** IDispatch methods ***/ -#define IFontDisp_GetTypeInfoCount(p,a) ICOM_CALL1 (GetTypeInfoCount,p,a) -#define IFontDisp_GetTypeInfo(p,a,b,c) ICOM_CALL3 (GetTypeInfo,p,b,c) -#define IFontDisp_GetIDsOfNames(p,a,b,c,d,e) ICOM_CALL5 (GetIDsOfNames,p,a,b,c,d,e) -#define IFontDisp_Invoke(p,a,b,c,d,e,f,g,h) ICOM_CALL8 (Invoke,p,a,b,c,d,e,f,g,h) -/*** IFontDisp methods ***/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_OLEFONT_H */ - - diff --git a/reactos/include/ole32/obj_oleobj.h b/reactos/include/ole32/obj_oleobj.h deleted file mode 100644 index fa6df7e86db..00000000000 --- a/reactos/include/ole32/obj_oleobj.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Defines IOleObject COM and other oleidl.h interfaces - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_OLEOBJ_H -#define __WINE_WINE_OBJ_OLEOBJ_H - -struct tagMSG; -struct tagLOGPALETTE; - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Declare the structures - */ -typedef struct tagOBJECTDESCRIPTOR -{ - ULONG cbSize; - CLSID clsid; - DWORD dwDrawAspect; - SIZEL sizel; - POINTL pointl; - DWORD dwStatus; - DWORD dwFullUserTypeName; - DWORD dwSrcOfCopy; -} OBJECTDESCRIPTOR, *LPOBJECTDESCRIPTOR; - -typedef enum tagOLEMISC -{ - OLEMISC_RECOMPOSEONRESIZE = 0x1, - OLEMISC_ONLYICONIC = 0x2, - OLEMISC_INSERTNOTREPLACE = 0x4, - OLEMISC_STATIC = 0x8, - OLEMISC_CANTLINKINSIDE = 0x10, - OLEMISC_CANLINKBYOLE1 = 0x20, - OLEMISC_ISLINKOBJECT = 0x40, - OLEMISC_INSIDEOUT = 0x80, - OLEMISC_ACTIVATEWHENVISIBLE = 0x100, - OLEMISC_RENDERINGISDEVICEINDEPENDENT = 0x200, - OLEMISC_INVISIBLEATRUNTIME = 0x400, - OLEMISC_ALWAYSRUN = 0x800, - OLEMISC_ACTSLIKEBUTTON = 0x1000, - OLEMISC_ACTSLIKELABEL = 0x2000, - OLEMISC_NOUIACTIVATE = 0x4000, - OLEMISC_ALIGNABLE = 0x8000, - OLEMISC_SIMPLEFRAME = 0x10000, - OLEMISC_SETCLIENTSITEFIRST = 0x20000, - OLEMISC_IMEMODE = 0x40000, - OLEMISC_IGNOREACTIVATEWHENVISIBLE = 0x80000, - OLEMISC_WANTSTOMENUMERGE = 0x100000, - OLEMISC_SUPPORTSMULTILEVELUNDO = 0x200000 -} OLEMISC; - -typedef enum tagOLEVERBATTRIB -{ - OLEVERBATTRIB_NEVERDIRTIES = 1, - OLEVERBATTRIB_ONCONTAINERMENU = 2 -} OLEVERBATTRIB; - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IOleObject, 0x00000112L, 0, 0); -typedef struct IOleObject IOleObject, *LPOLEOBJECT; - -DEFINE_OLEGUID(IID_IOleAdviseHolder, 0x00000111L, 0, 0); -typedef struct IOleAdviseHolder IOleAdviseHolder, *LPOLEADVISEHOLDER; - -DEFINE_OLEGUID(IID_IEnumOLEVERB, 0x00000104L, 0, 0); -typedef struct IEnumOLEVERB IEnumOLEVERB, *LPENUMOLEVERB; - -/***************************************************************************** - * IOleObject interface - */ -#define ICOM_INTERFACE IOleObject -#define IOleObject_METHODS \ - ICOM_METHOD1(HRESULT,SetClientSite, IOleClientSite*,pClientSite) \ - ICOM_METHOD1(HRESULT,GetClientSite, IOleClientSite**,ppClientSite) \ - ICOM_METHOD2(HRESULT,SetHostNames, LPCOLESTR,szContainerApp, LPCOLESTR,szContainerObj) \ - ICOM_METHOD1(HRESULT,Close, DWORD,dwSaveOption) \ - ICOM_METHOD2(HRESULT,SetMoniker, DWORD,dwWhichMoniker, IMoniker*,pmk) \ - ICOM_METHOD3(HRESULT,GetMoniker, DWORD,dwAssign, DWORD,dwWhichMoniker, IMoniker**,ppmk) \ - ICOM_METHOD3(HRESULT,InitFromData, IDataObject*,pDataObject, BOOL,fCreation, DWORD,dwReserved) \ - ICOM_METHOD2(HRESULT,GetClipboardData, DWORD,dwReserved, IDataObject**,ppDataObject) \ - ICOM_METHOD6(HRESULT,DoVerb, LONG,iVerb, struct tagMSG*,lpmsg, IOleClientSite*,pActiveSite, LONG,lindex, HWND,hwndParent, LPCRECT,lprcPosRect) \ - ICOM_METHOD1(HRESULT,EnumVerbs, IEnumOLEVERB**,ppEnumOleVerb) \ - ICOM_METHOD (HRESULT,Update) \ - ICOM_METHOD (HRESULT,IsUpToDate) \ - ICOM_METHOD1(HRESULT,GetUserClassID, CLSID*,pClsid) \ - ICOM_METHOD2(HRESULT,GetUserType, DWORD,dwFormOfType, LPOLESTR*,pszUserType) \ - ICOM_METHOD2(HRESULT,SetExtent, DWORD,dwDrawAspect, SIZEL*,psizel) \ - ICOM_METHOD2(HRESULT,GetExtent, DWORD,dwDrawAspect, SIZEL*,psizel) \ - ICOM_METHOD2(HRESULT,Advise, IAdviseSink*,pAdvSink, DWORD*,pdwConnection) \ - ICOM_METHOD1(HRESULT,Unadvise, DWORD,dwConnection) \ - ICOM_METHOD1(HRESULT,EnumAdvise, IEnumSTATDATA**,ppenumAdvise) \ - ICOM_METHOD2(HRESULT,GetMiscStatus, DWORD,dwAspect, DWORD*,pdwStatus) \ - ICOM_METHOD1(HRESULT,SetColorScheme, struct tagLOGPALETTE*,pLogpal) -#define IOleObject_IMETHODS \ - IUnknown_IMETHODS \ - IOleObject_METHODS -ICOM_DEFINE(IOleObject,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleObject_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleObject_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleObject_Release(p) ICOM_CALL (Release,p) -/*** IOleObject methods ***/ -#define IOleObject_SetClientSite(p,a) ICOM_CALL1(SetClientSite,p,a) -#define IOleObject_GetClientSite(p,a,b) ICOM_CALL1(GetClientSite,p,a) -#define IOleObject_SetHostNames(p,a,b) ICOM_CALL2(SetHostNames,p,a,b) -#define IOleObject_Close(p,a,b) ICOM_CALL1(Close,p,a) -#define IOleObject_SetMoniker(p,a,b) ICOM_CALL2(SetMoniker,p,a,b) -#define IOleObject_GetMoniker(p,a,b) ICOM_CALL3(GetMoniker,p,a,b,c) -#define IOleObject_InitFromData(p,a,b) ICOM_CALL3(InitFromData,p,a,b,c) -#define IOleObject_GetClipboardData(p,a,b) ICOM_CALL2(GetClipboardData,p,a,b) -#define IOleObject_DoVerb(p,a,b) ICOM_CALL6(DoVerb,p,a,b,c,d,e,f) -#define IOleObject_EnumVerbs(p,a,b) ICOM_CALL1(EnumVerbs,p,a) -#define IOleObject_Update(p,a,b) ICOM_CALL (Update,p) -#define IOleObject_IsUpToDate(p,a,b) ICOM_CALL (IsUpToDate,p) -#define IOleObject_GetUserClassID(p,a,b) ICOM_CALL1(GetUserClassID,p,a) -#define IOleObject_GetUserType(p,a,b) ICOM_CALL2(GetUserType,p,a,b) -#define IOleObject_SetExtent(p,a,b) ICOM_CALL2(SetExtent,p,a,b) -#define IOleObject_GetExtent(p,a,b) ICOM_CALL2(GetExtent,p,a,b) -#define IOleObject_Advise(p,a,b) ICOM_CALL2(Advise,p,a,b) -#define IOleObject_Unadvise(p,a,b) ICOM_CALL1(Unadvise,p,a) -#define IOleObject_EnumAdvise(p,a,b) ICOM_CALL1(EnumAdvise,p,a) -#define IOleObject_GetMiscStatus(p,a,b) ICOM_CALL2(GetMiscStatus,p,a,b) -#define IOleObject_SetColorScheme(p,a,b) ICOM_CALL1(SetColorScheme,p,a) - - -/***************************************************************************** - * IOleAdviseHolder interface - */ -#define ICOM_INTERFACE IOleAdviseHolder -#define IOleAdviseHolder_METHODS \ - ICOM_METHOD2(HRESULT,Advise, IAdviseSink*,pAdvise, DWORD*,pdwConnection) \ - ICOM_METHOD1(HRESULT,Unadvise, DWORD,dwConnection) \ - ICOM_METHOD1(HRESULT,EnumAdvise, IEnumSTATDATA**,ppenumAdvise) \ - ICOM_METHOD1(HRESULT,SendOnRename, IMoniker*,pmk) \ - ICOM_METHOD (HRESULT,SendOnSave) \ - ICOM_METHOD (HRESULT,SendOnClose) -#define IOleAdviseHolder_IMETHODS \ - IUnknown_IMETHODS \ - IOleAdviseHolder_METHODS -ICOM_DEFINE(IOleAdviseHolder,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleAdviseHolder_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleAdviseHolder_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleAdviseHolder_Release(p) ICOM_CALL (Release,p) -/*** IOleAdviseHolder methods ***/ -#define IOleAdviseHolder_Advise(p,a,b) ICOM_CALL2(Advise,p,a,b) -#define IOleAdviseHolder_Unadvise(p,a) ICOM_CALL1(Unadvise,p,a) -#define IOleAdviseHolder_EnumAdvise(p,a) ICOM_CALL1(EnumAdvise,p,a) -#define IOleAdviseHolder_SendOnRename(p,a) ICOM_CALL1(SendOnRename,p,a) -#define IOleAdviseHolder_SendOnSave(p) ICOM_CALL (SendOnSave,p) -#define IOleAdviseHolder_SendOnClose(p) ICOM_CALL (SendOnClose,p) - - -/***************************************************************************** - * IEnumOLEVERB interface - */ -#define ICOM_INTERFACE IEnumOLEVERB -#define IEnumOLEVERB_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,celt, LPOLEVERB,rgelt, ULONG*,pceltFetched) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumOLEVERB**,ppenum) -#define IEnumOLEVERB_IMETHODS \ - IUnknown_IMETHODS \ - IEnumOLEVERB_METHODS -ICOM_DEFINE(IEnumOLEVERB,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumOLEVERB_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b) -#define IEnumOLEVERB_AddRef(p) ICOM_ICALL (IUnknown,AddRef,p) -#define IEnumOLEVERB_Release(p) ICOM_ICALL (IUnknown,Release,p) -/*** IEnumOLEVERB methods ***/ -#define IEnumOLEVERB_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumOLEVERB_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumOLEVERB_Reset(p,a) ICOM_CALL (Reset,p) -#define IEnumOLEVERB_Clone(p,a) ICOM_CALL1(Clone,p,a) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_OLEOBJ_H */ - diff --git a/reactos/include/ole32/obj_oleundo.h b/reactos/include/ole32/obj_oleundo.h deleted file mode 100644 index b52fbe2ef60..00000000000 --- a/reactos/include/ole32/obj_oleundo.h +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Defines the COM interfaces and APIs from ocidl.h which pertain to Undo/Redo - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_OLEUNDO_H -#define __WINE_WINE_OBJ_OLEUNDO_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_GUID(IID_IQuickActivate, 0xcf51ed10, 0x62fe, 0x11cf, 0xbf, 0x86, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0x36); -typedef struct IQuickActivate IQuickActivate,*LPQUICKACTIVATE; - -DEFINE_GUID(IID_IPointerInactive, 0x55980ba0, 0x35aa, 0x11cf, 0xb6, 0x71, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8); -typedef struct IPointerInactive IPointerInactive,*LPPOINTERINACTIVE; - -DEFINE_GUID(IID_IAdviseSinkEx, 0x3af24290, 0x0c96, 0x11ce, 0xa0, 0xcf, 0x00, 0xaa, 0x00, 0x60, 0x0a, 0xb8); -typedef struct IAdviseSinkEx IAdviseSinkEx,*LPADVISESINKEX; - -DEFINE_GUID(IID_IOleUndoManager, 0xd001f200, 0xef97, 0x11ce, 0x9b, 0xc9, 0x00, 0xaa, 0x00, 0x60, 0x8e, 0x01); -typedef struct IOleUndoManager IOleUndoManager,*LPOLEUNDOMANAGER; - -DEFINE_GUID(IID_IOleUndoUnit, 0x894ad3b0, 0xef97, 0x11ce, 0x9b, 0xc9, 0x00, 0xaa, 0x00, 0x60, 0x8e, 0x01); -typedef struct IOleUndoUnit IOleUndoUnit,*LPOLEUNDOUNIT; - -DEFINE_GUID(IID_IOleParentUndoUnit, 0xa1faf330, 0xef97, 0x11ce, 0x9b, 0xc9, 0x00, 0xaa, 0x00, 0x60, 0x8e, 0x01); -typedef struct IOleParentUndoUnit IOleParentUndoUnit,*LPOLEPARENTUNDOUNIT; - -DEFINE_GUID(IID_IEnumOleUndoUnits, 0xb3e7c340, 0xef97, 0x11ce, 0x9b, 0xc9, 0x00, 0xaa, 0x00, 0x60, 0x8e, 0x01); -typedef struct IEnumOleUndoUnits IEnumOleUndoUnits,*LPENUMOLEUNDOUNITS; - -/***************************************************************************** - * Declare the structures - */ -typedef enum tagQACONTAINERFLAGS -{ - QACONTAINER_SHOWHATCHING = 0x1, - QACONTAINER_SHOWGRABHANDLES = 0x2, - QACONTAINER_USERMODE = 0x4, - QACONTAINER_DISPLAYASDEFAULT = 0x8, - QACONTAINER_UIDEAD = 0x10, - QACONTAINER_AUTOCLIP = 0x20, - QACONTAINER_MESSAGEREFLECT = 0x40, - QACONTAINER_SUPPORTSMNEMONICS = 0x80 -} QACONTAINERFLAGS; - -typedef DWORD OLE_COLOR; - -typedef struct tagQACONTROL -{ - ULONG cbSize; - DWORD dwMiscStatus; - DWORD dwViewStatus; - DWORD dwEventCookie; - DWORD dwPropNotifyCookie; - DWORD dwPointerActivationPolicy; -} QACONTROL; - -typedef struct tagQACONTAINER -{ - ULONG cbSize; - IOleClientSite *pClientSite; - IAdviseSinkEx *pAdviseSink; - IPropertyNotifySink *pPropertyNotifySink; - IUnknown *pUnkEventSink; - DWORD dwAmbientFlags; - OLE_COLOR colorFore; - OLE_COLOR colorBack; - IFont *pFont; - IOleUndoManager *pUndoMgr; - DWORD dwAppearance; - LONG lcid; - HPALETTE hpal; - struct IBindHost *pBindHost; -} QACONTAINER; - -/***************************************************************************** - * IQuickActivate interface - */ -#define ICOM_INTERFACE IQuickActivate -#define IQuickActivate_METHODS \ - ICOM_METHOD2(HRESULT,QuickActivate, QACONTAINER*,pQaContainer, QACONTROL*,pQaControl) \ - ICOM_METHOD1(HRESULT,SetContentExtent, LPSIZEL,pSizel) \ - ICOM_METHOD1(HRESULT,GetContentExtent, LPSIZEL,pSizel) -#define IQuickActivate_IMETHODS \ - IUnknown_IMETHODS \ - IQuickActivate_METHODS -ICOM_DEFINE(IQuickActivate,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IQuickActivate_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IQuickActivate_AddRef(p) ICOM_CALL (AddRef,p) -#define IQuickActivate_Release(p) ICOM_CALL (Release,p) -/*** IQuickActivate methods ***/ -#define IQuickActivate_QuickActivate(p,a,b) ICOM_CALL2(QuickActivate,p,a,b) -#define IQuickActivate_SetContentExtent(p,a) ICOM_CALL1(SetContentExtent,p,a) -#define IQuickActivate_GetContentExtent(p,a) ICOM_CALL1(GetContentExtent,p,a) - - -/***************************************************************************** - * IPointerInactive interface - */ -#define ICOM_INTERFACE IPointerInactive -#define IPointerInactive_METHODS \ - ICOM_METHOD1(HRESULT,GetActivationPolicy, DWORD*,pdwPolicy) \ - ICOM_METHOD4(HRESULT,OnInactiveMouseMove, LPCRECT,pRectBounds, LONG,x, LONG,y, DWORD,grfKeyState) \ - ICOM_METHOD5(HRESULT,OnInactiveSetCursor, LPCRECT,pRectBounds, LONG,x, LONG,y, DWORD,dwMouseMsg, BOOL,fSetAlways) -#define IPointerInactive_IMETHODS \ - IUnknown_IMETHODS \ - IPointerInactive_METHODS -ICOM_DEFINE(IPointerInactive,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPointerInactive_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPointerInactive_AddRef(p) ICOM_CALL (AddRef,p) -#define IPointerInactive_Release(p) ICOM_CALL (Release,p) -/*** IPointerInactive methods ***/ -#define IPointerInactive_GetActivationPolicy(p,a) ICOM_CALL1(GetActivationPolicy,p,a) -#define IPointerInactive_OnInactiveMoveMouse(p,a,b,c,d) ICOM_CALL4(OnInactiveMoveMouse,p,a,b,c,d) -#define IPointerInactive_OnInactiveSetCursor(p,a,b,c,d,e) ICOM_CALL5(OnInactiveSetCursor,p,a,b,d,e) - - -/***************************************************************************** - * IAdviseSinkEx interface - */ -#define ICOM_INTERFACE IAdviseSinkEx -#define IAdviseSinkEx_METHODS \ - ICOM_METHOD1(HRESULT,OnViewStatusChange, DWORD,dwViewStatus) -#define IAdviseSinkEx_IMETHODS \ - IAdviseSink_IMETHODS \ - IAdviseSinkEx_METHODS -ICOM_DEFINE(IAdviseSinkEx,IAdviseSink) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IAdviseSinkEx_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IAdviseSinkEx_AddRef(p) ICOM_CALL (AddRef,p) -#define IAdviseSinkEx_Release(p) ICOM_CALL (Release,p) -/*** IAdviseSink methods ***/ -#define IAdviseSinkEx_OnDataChange(p,a,b) ICOM_CALL2(OnDataChange,p,a,b) -#define IAdviseSinkEx_OnViewChange(p,a,b) ICOM_CALL2(OnViewChange,p,a,b) -#define IAdviseSinkEx_OnRename(p,a) ICOM_CALL1(OnRename,p,a) -#define IAdviseSinkEx_OnSave(p) ICOM_CALL (OnSave,p) -#define IAdviseSinkEx_OnClose(p) ICOM_CALL (OnClose,p) -/*** IAdviseSinkEx methods ***/ -#define IAdviseSinkEx_OnViewStatusChange(p,a) ICOM_CALL1(OnViewStatusChange,p,a) - - -/***************************************************************************** - * IOleUndoManager interface - */ -#define ICOM_INTERFACE IOleUndoManager -#define IOleUndoManager_METHODS \ - ICOM_METHOD1(HRESULT,Open, IOleParentUndoUnit*,pPUU) \ - ICOM_METHOD2(HRESULT,Close, IOleParentUndoUnit*,pPUU, BOOL,fCommit) \ - ICOM_METHOD1(HRESULT,Add, IOleUndoUnit*,pUU) \ - ICOM_METHOD1(HRESULT,GetOpenParentState, DWORD*,pdwState) \ - ICOM_METHOD1(HRESULT,DiscardFrom, IOleUndoUnit*,pUU) \ - ICOM_METHOD1(HRESULT,UndoTo, IOleUndoUnit*,pUU) \ - ICOM_METHOD1(HRESULT,RedoTo, IOleUndoUnit*,pUU) \ - ICOM_METHOD1(HRESULT,EnumUndoable, IEnumOleUndoUnits**,ppEnum) \ - ICOM_METHOD1(HRESULT,EnumRedoable, IEnumOleUndoUnits**,ppEnum) \ - ICOM_METHOD1(HRESULT,GetLastUndoDescription, BSTR*,pBstr) \ - ICOM_METHOD1(HRESULT,GetLastRedoDescription, BSTR*,pBstr) \ - ICOM_METHOD1(HRESULT,Enable, BOOL,fEnable) -#define IOleUndoManager_IMETHODS \ - IUnknown_IMETHODS \ - IOleUndoManager_METHODS -ICOM_DEFINE(IOleUndoManager,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleUndoManager_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleUndoManager_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleUndoManager_Release(p) ICOM_CALL (Release,p) -/*** IOleUndoManager methods ***/ -#define IOleUndoManager_Open(p,a) ICOM_CALL1(Open,p,a) -#define IOleUndoManager_Close(p,a,b) ICOM_CALL2(Close,p,a,b) -#define IOleUndoManager_Add(p,a) ICOM_CALL1(Add,p,a) -#define IOleUndoManager_GetOpenParentState(p,a) ICOM_CALL1(GetOpenParentState,p,a) -#define IOleUndoManager_DiscardFrom(p,a) ICOM_CALL1(DiscardFrom,p,a) -#define IOleUndoManager_UndoTo(p,a) ICOM_CALL1(UndoTo,p,a) -#define IOleUndoManager_RedoTo(p,a) ICOM_CALL1(RedoTo,p,a) -#define IOleUndoManager_EnumUndoable(p,a) ICOM_CALL1(EnumUndoable,p,a) -#define IOleUndoManager_EnumRedoable(p,a) ICOM_CALL1(EnumRedoable,p,a) -#define IOleUndoManager_GetLastUndoDescription(p,a) ICOM_CALL1(GetLastUndoDescription,p,a) -#define IOleUndoManager_GetLastRedoDescription(p,a) ICOM_CALL1(GetLastRedoDescription,p,a) -#define IOleUndoManager_Enable(p,a) ICOM_CALL1(Enable,p,a) - - -/***************************************************************************** - * IOleUndoUnit interface - */ -#define ICOM_INTERFACE IOleUndoUnit -#define IOleUndoUnit_METHODS \ - ICOM_METHOD1(HRESULT,Do, IOleUndoManager*,pUndoManager) \ - ICOM_METHOD1(HRESULT,GetDescription, BSTR*,pBstr) \ - ICOM_METHOD2(HRESULT,GetUnitType, CLSID*,pClsid, LONG*,plID) \ - ICOM_METHOD (HRESULT,OnNextAdd) -#define IOleUndoUnit_IMETHODS \ - IUnknown_IMETHODS \ - IOleUndoUnit_METHODS -ICOM_DEFINE(IOleUndoUnit,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleUndoUnit_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleUndoUnit_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleUndoUnit_Release(p) ICOM_CALL (Release,p) -/*** IOleUndoUnit methods ***/ -#define IOleUndoUnit_Do(p,a) ICOM_CALL1(Do,p,a) -#define IOleUndoUnit_GetDescription(p,a) ICOM_CALL1(GetDescription,p,a) -#define IOleUndoUnit_GetUnitType(p,a,b) ICOM_CALL2(GetUnitType,p,a,b) -#define IOleUndoUnit_OnNextAdd(p) ICOM_CALL (OnNextAdd,p) - - - -/***************************************************************************** - * IOleUndoUnit interface - */ -#define ICOM_INTERFACE IOleParentUndoUnit -#define IOleParentUndoUnit_METHODS \ - ICOM_METHOD1(HRESULT,Open, IOleParentUndoUnit*,pPUU) \ - ICOM_METHOD2(HRESULT,Close, IOleParentUndoUnit*,pPUU, BOOL,fCommit) \ - ICOM_METHOD1(HRESULT,Add, IOleUndoUnit*,pUU) \ - ICOM_METHOD1(HRESULT,FindUnit, IOleUndoUnit*,pUU) \ - ICOM_METHOD1(HRESULT,GetParentState, DWORD*,pdwState) -#define IOleParentUndoUnit_IMETHODS \ - IOleUndoUnit_IMETHODS \ - IOleParentUndoUnit_METHODS -ICOM_DEFINE(IOleParentUndoUnit,IOleUndoUnit) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IOleParentUndoUnit_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IOleParentUndoUnit_AddRef(p) ICOM_CALL (AddRef,p) -#define IOleParentUndoUnit_Release(p) ICOM_CALL (Release,p) -/*** IOleUndoUnit methods ***/ -#define IOleParentUndoUnit_Do(p,a) ICOM_CALL1(Do,p,a) -#define IOleParentUndoUnit_GetDescription(p,a) ICOM_CALL1(GetDescription,p,a) -#define IOleParentUndoUnit_GetUnitType(p,a,b) ICOM_CALL2(GetUnitType,p,a,b) -#define IOleParentUndoUnit_OnNextAdd(p) ICOM_CALL (OnNextAdd,p) -/*** IOleParentUndoUnit methods ***/ -#define IOleParentUndoUnit_Open(p,a) ICOM_CALL1(Open,p,a) -#define IOleParentUndoUnit_Close(p,a,b) ICOM_CALL2(Close,p,a,b) -#define IOleParentUndoUnit_Add(p,a) ICOM_CALL1(Add,p,a) -#define IOleParentUndoUnit_FindUnit(p,a) ICOM_CALL1(FindUnit,p,a) -#define IOleParentUndoUnit_GetParentState(p,a,b) ICOM_CALL1(GetParentState,p,a) - - -/***************************************************************************** - * IEnumOleUndoUnits interface - */ -#define ICOM_INTERFACE IEnumOleUndoUnits -#define IEnumOleUndoUnits_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,cElt, IOleUndoUnit**,rgElt, ULONG*,pcEltFetched) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,cElt) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumOleUndoUnits**,ppEnum) -#define IEnumOleUndoUnits_IMETHODS \ - IUnknown_IMETHODS \ - IEnumOleUndoUnits_METHODS -ICOM_DEFINE(IEnumOleUndoUnits,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumOleUndoUnits_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumOleUndoUnits_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumOleUndoUnits_Release(p) ICOM_CALL (Release,p) -/*** IEnumOleUndoUnits methods ***/ -#define IEnumOleUndoUnits_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumOleUndoUnits_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumOleUndoUnits_Reset(p,a) ICOM_CALL (Reset,p,a) -#define IEnumOleUndoUnits_Clone(p,a) ICOM_CALL1(Clone,p,a) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_OLEUNDO_H */ - diff --git a/reactos/include/ole32/obj_oleview.h b/reactos/include/ole32/obj_oleview.h deleted file mode 100644 index b79deec46e9..00000000000 --- a/reactos/include/ole32/obj_oleview.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to ViewObject - * - */ - -#ifndef __WINE_WINE_OBJ_OLEVIEW_H -#define __WINE_WINE_OBJ_OLEVIEW_H - -struct tagLOGPALETTE; - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Declare the structures - */ - - -/***************************************************************************** - * Predeclare the interfaces - */ - -DEFINE_OLEGUID(IID_IViewObject, 0x0000010dL, 0, 0); -typedef struct IViewObject IViewObject, *LPVIEWOBJECT; - -DEFINE_OLEGUID(IID_IViewObject2, 0x00000127L, 0, 0); -typedef struct IViewObject2 IViewObject2, *LPVIEWOBJECT2; - -/***************************************************************************** - * IViewObject interface - */ -typedef BOOL CALLBACK (*IVO_ContCallback)(DWORD); - -#define ICOM_INTERFACE IViewObject -#define IViewObject_METHODS \ - ICOM_METHOD10(HRESULT,Draw, DWORD,dwDrawAspect, LONG,lindex, void*,pvAspect, DVTARGETDEVICE*,ptd, HDC,hdcTargetDev, HDC,hdcDraw, LPCRECTL,lprcBounds, LPCRECTL,lprcWBounds, IVO_ContCallback, pfnContinue, DWORD,dwContinue) \ - ICOM_METHOD6(HRESULT,GetColorSet, DWORD,dwDrawAspect, LONG,lindex, void*,pvAspect, DVTARGETDEVICE*,ptd, HDC,hicTargetDevice, struct tagLOGPALETTE**,ppColorSet) \ - ICOM_METHOD4(HRESULT,Freeze, DWORD,dwDrawAspect, LONG,lindex, void*,pvAspect, DWORD*,pdwFreeze) \ - ICOM_METHOD1(HRESULT,Unfreeze, DWORD,dwFreeze) \ - ICOM_METHOD3(HRESULT,SetAdvise, DWORD,aspects, DWORD,advf, IAdviseSink*,pAdvSink) \ - ICOM_METHOD3(HRESULT,GetAdvise, DWORD*,pAspects, DWORD*,pAdvf, IAdviseSink**,ppAdvSink) -#define IViewObject_IMETHODS \ - IUnknown_IMETHODS \ - IViewObject_METHODS -ICOM_DEFINE(IViewObject,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IViewObject_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IViewObject_AddRef(p) ICOM_CALL (AddRef,p) -#define IViewObject_Release(p) ICOM_CALL (Release,p) -/*** IViewObject methods ***/ -#define IViewObject_Draw(p,a,b,c,d,e,f,g,h,i,j) ICOM_CALL10(Draw,p,a,b,c,d,e,f,g,h,i,j) -#define IViewObject_GetColorSet(p,a,b,c,d,e,f) ICOM_CALL6(GetColorSet,p,a,b,c,d,e,f) -#define IViewObject_Freeze(p,a,b,c,d) ICOM_CALL4(Freeze,p,a,b,c,d) -#define IViewObject_Unfreeze(p,a) ICOM_CALL1(Unfreeze,p,a) -#define IViewObject_SetAdvise(p,a,b,c) ICOM_CALL3(SetAdvise,p,a,b,c) -#define IViewObject_GetAdvise(p,a,b,c) ICOM_CALL3(GetAdvise,p,a,b,c) - - - -/***************************************************************************** - * IViewObject2 interface - */ -#define ICOM_INTERFACE IViewObject2 -#define IViewObject2_METHODS \ - ICOM_METHOD4(HRESULT,GetExtent, DWORD,dwDrawAspect, LONG,lindex, DVTARGETDEVICE*,ptd, LPSIZEL,lpsizel) -#define IViewObject2_IMETHODS \ - IViewObject_IMETHODS \ - IViewObject2_METHODS -ICOM_DEFINE(IViewObject2,IViewObject) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IViewObject2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IViewObject2_AddRef(p) ICOM_CALL (AddRef,p) -#define IViewObject2_Release(p) ICOM_CALL (Release,p) -/*** IViewObject methods ***/ -#define IViewObject2_Draw(p,a,b,c,d,e,f,g,h,i,j) ICOM_CALL10(Draw,p,a,b,c,d,e,f,g,h,i,j) -#define IViewObject2_GetColorSet(p,a,b,c,d,e,f) ICOM_CALL6(GetColorSet,p,a,b,c,d,e,f) -#define IViewObject2_Freeze(p,a,b,c,d) ICOM_CALL4(Freeze,p,a,b,c,d) -#define IViewObject2_Unfreeze(p,a) ICOM_CALL1(Unfreeze,p,a) -#define IViewObject2_SetAdvise(p,a,b,c) ICOM_CALL3(SetAdvise,p,a,b,c) -#define IViewObject2_GetAdvise(p,a,b,c) ICOM_CALL3(GetAdvise,p,a,b,c) -/*** IViewObject2 methods ***/ -#define IViewObject2_GetExtent(p,a,b,c,d) ICOM_CALL4(GetExtent,p,a,b,c,d) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_OLEVIEW_H */ - diff --git a/reactos/include/ole32/obj_picture.h b/reactos/include/ole32/obj_picture.h deleted file mode 100644 index 2e2d55c4a3e..00000000000 --- a/reactos/include/ole32/obj_picture.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to OLE picture support. - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_PICTURE_H -#define __WINE_WINE_OBJ_PICTURE_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the structures - */ -typedef UINT OLE_HANDLE; -typedef LONG OLE_XPOS_HIMETRIC; -typedef LONG OLE_YPOS_HIMETRIC; -typedef LONG OLE_XSIZE_HIMETRIC; -typedef LONG OLE_YSIZE_HIMETRIC; - - - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_GUID(IID_IPicture, 0x7bf80980, 0xbf32, 0x101a, 0x8b, 0xbb, 0x00, 0xAA, 0x00, 0x30, 0x0C, 0xAB); -typedef struct IPicture IPicture, *LPPICTURE; - -DEFINE_GUID(IID_IPictureDisp, 0x7bf80981, 0xbf32, 0x101a, 0x8b, 0xbb, 0x00, 0xAA, 0x00, 0x30, 0x0C, 0xAB); -typedef struct IPictureDisp IPictureDisp, *LPPICTUREDISP; - -/***************************************************************************** - * IPicture interface - */ -#define ICOM_INTERFACE IPicture -#define IPicture_METHODS \ - ICOM_METHOD1(HRESULT,get_Handle, OLE_HANDLE*,pHandle) \ - ICOM_METHOD1(HRESULT,get_hPal, OLE_HANDLE*,phPal) \ - ICOM_METHOD1(HRESULT,get_Type, SHORT*,pType) \ - ICOM_METHOD1(HRESULT,get_Width, OLE_XSIZE_HIMETRIC*,pWidth) \ - ICOM_METHOD1(HRESULT,get_Height, OLE_YSIZE_HIMETRIC*,pHeight) \ - ICOM_METHOD10(HRESULT,Render, HDC,hdc, LONG,x, LONG,y, LONG,cx, LONG,cy, OLE_XPOS_HIMETRIC,xSrc, OLE_YPOS_HIMETRIC,ySrc, OLE_XSIZE_HIMETRIC,cxSrc, OLE_YSIZE_HIMETRIC,cySrc, LPCRECT,pRcWBounds) \ - ICOM_METHOD1(HRESULT,set_hPal, OLE_HANDLE,hPal) \ - ICOM_METHOD1(HRESULT,get_CurDC, HDC*,phDC) \ - ICOM_METHOD3(HRESULT,SelectPicture, HDC,hDCIn, HDC*,phDCOut, OLE_HANDLE*,phBmpOut) \ - ICOM_METHOD1(HRESULT,get_KeepOriginalFormat, BOOL*,pKeep) \ - ICOM_METHOD1(HRESULT,put_KeepOriginalFormat, BOOL,Keep) \ - ICOM_METHOD (HRESULT,PictureChanged) \ - ICOM_METHOD3(HRESULT,SaveAsFile, LPSTREAM,pStream, BOOL,fSaveMemCopy, LONG*,pCbSize) \ - ICOM_METHOD1(HRESULT,get_Attributes, DWORD*,pDwAttr) -#define IPicture_IMETHODS \ - IUnknown_IMETHODS \ - IPicture_METHODS -ICOM_DEFINE(IPicture,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPicture_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPicture_AddRef(p) ICOM_CALL (AddRef,p) -#define IPicture_Release(p) ICOM_CALL (Release,p) -/*** IPicture methods ***/ -#define IPicture_get_Handle(p,a) ICOM_CALL1(get_Handle,p,a) -#define IPicture_get_hPal(p,a) ICOM_CALL1(get_hPal,p,a) -#define IPicture_get_Type(p,a) ICOM_CALL1(get_Type,p,a) -#define IPicture_get_Width(p,a) ICOM_CALL1(get_Width,p,a) -#define IPicture_get_Height(p,a) ICOM_CALL1(get_Height,p,a) -#define IPicture_Render(p,a,b,c,d,e,f,g,h,i,j) ICOM_CALL10(Render,p,a,b,c,d,e,f,g,h,i,j) -#define IPicture_set_hPal(p,a) ICOM_CALL1(set_hPal,p,a) -#define IPicture_get_CurDC(p,a) ICOM_CALL1(get_CurDC,p,a) -#define IPicture_SelectPicture(p,a,b,c) ICOM_CALL3(SelectPicture,p,a,b,c) -#define IPicture_get_KeepOriginalFormat(p,a) ICOM_CALL1(get_KeepOriginalFormat,p,a) -#define IPicture_put_KeepOriginalFormat(p,a) ICOM_CALL1(put_KeepOriginalFormat,p,a) -#define IPicture_PictureChanged(p) ICOM_CALL (PictureChanged,p) -#define IPicture_SaveAsFile(p,a,b,c) ICOM_CALL3(SaveAsFile,p,a,b,c) -#define IPicture_get_Attributes(p,a) ICOM_CALL1(get_Attributes,p,a) - - -/***************************************************************************** - * IPictureDisp interface - */ -#define ICOM_INTERFACE IPictureDisp -#define IPictureDisp_METHODS -#define IPictureDisp_IMETHODS \ - IDispatch_IMETHODS \ - IPictureDisp_METHODS -ICOM_DEFINE(IPictureDisp,IDispatch) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPictureDisp_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPictureDisp_AddRef(p) ICOM_CALL (AddRef,p) -#define IPictureDisp_Release(p) ICOM_CALL (Release,p) -/*** IDispatch methods ***/ -#define IPictureDisp_GetTypeInfoCount(p,a) ICOM_CALL1 (GetTypeInfoCount,p,a) -#define IPictureDisp_GetTypeInfo(p,a,b,c) ICOM_CALL3 (GetTypeInfo,p,b,c) -#define IPictureDisp_GetIDsOfNames(p,a,b,c,d,e) ICOM_CALL5 (GetIDsOfNames,p,a,b,c,d,e) -#define IPictureDisp_Invoke(p,a,b,c,d,e,f,g,h) ICOM_CALL8 (Invoke,p,a,b,c,d,e,f,g,h) -/*** IPictureDisp methods ***/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_PICTURE_H */ - - diff --git a/reactos/include/ole32/obj_property.h b/reactos/include/ole32/obj_property.h deleted file mode 100644 index 8ab92ab98d2..00000000000 --- a/reactos/include/ole32/obj_property.h +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Defines the COM interfaces and APIs from ocidl.h related to property - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_PROPERTY_H -#define __WINE_WINE_OBJ_PROPERTY_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Declare the structures - */ -typedef struct tagPROPPAGEINFO -{ - ULONG cb; - LPOLESTR pszTitle; - SIZE size; - LPOLESTR pszDocString; - LPOLESTR pszHelpFile; - DWORD dwHelpContext; -} PROPPAGEINFO, *LPPROPPAGEINFO; - -typedef enum tagPROPPAGESTATUS -{ - PROPPAGESTATUS_DIRTY = 0x1, - PROPPAGESTATUS_VALIDATE = 0x2, - PROPPAGESTATUS_CLEAN = 0x4 -} PROPPAGESTATUS; - -typedef struct tagCAUUID -{ - ULONG cElems; - GUID* pElems; -} CAUUID, *LPCAUUID; - -typedef struct tagCALPOLESTR -{ - ULONG cElems; - LPOLESTR *pElems; -} CALPOLESTR, *LPCALPOLESTR; - -typedef struct tagCADWORD -{ - ULONG cElems; - DWORD *pElems; -} CADWORD, *LPCADWORD; - - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_GUID(IID_IPropertyPage, 0xb196b28dL, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IPropertyPage IPropertyPage, *LPPROPERTYPAGE; - -DEFINE_GUID(IID_IPropertyPage2, 0x01e44665L, 0x24ac, 0x101b, 0x84, 0xed, 0x08, 0x00, 0x2b, 0x2e, 0xc7, 0x13); -typedef struct IPropertyPage2 IPropertyPage2, *LPPROPERTYPAGE2; - -DEFINE_GUID(IID_IPropertyPageSite, 0xb196b28cL, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IPropertyPageSite IPropertyPageSite, *LPPROPERTYPAGESITE; - -DEFINE_GUID(IID_IPropertyNotifySink, 0x9bfbbc02L, 0xeff1, 0x101a, 0x84, 0xed, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IPropertyNotifySink IPropertyNotifySink, *LPPROPERTYNOTIFYSINK; - -DEFINE_GUID(IID_ISimpleFrameSite, 0x742b0e01L, 0x14e6, 0x101b, 0x91, 0x4e, 0x00, 0xaa, 0x00, 0x30, 0x0c, 0xab); -typedef struct ISimpleFrameSite ISimpleFrameSite, *LPSIMPLEFRAMESITE; - -DEFINE_GUID(IID_IPersistStreamInit, 0x7fd52380L, 0x4e07, 0x101b, 0xae, 0x2d, 0x08, 0x00, 0x2b, 0x2e, 0xc7, 0x13); -typedef struct IPersistStreamInit IPersistStreamInit,*LPPERSISTSTREAMINIT; - -DEFINE_GUID(IID_IPersistMemory, 0xbd1ae5e0L, 0xa6ae, 0x11ce, 0xbd, 0x37, 0x50, 0x42, 0x00, 0xc1, 0x00, 0x00); -typedef struct IPersistMemory IPersistMemory,*LPPERSISTMEMORY; - -DEFINE_GUID(IID_IPersistPropertyBag, 0x37d84f60, 0x42cb, 0x11ce, 0x81, 0x35, 0x00, 0xaa, 0x00, 0x4b, 0xb8, 0x51); -typedef struct IPersistPropertyBag IPersistPropertyBag,*LPPERSISTPROPERTYBAG; - -DEFINE_GUID(IID_IErrorLog, 0x3127ca40L, 0x446e, 0x11ce, 0x81, 0x35, 0x00, 0xaa, 0x00, 0x4b, 0xb8, 0x51); -typedef struct IErrorLog IErrorLog,*LPERRORLOG; - -DEFINE_GUID(IID_IPropertyBag, 0x55272a00L, 0x42cb, 0x11ce, 0x81, 0x35, 0x00, 0xaa, 0x00, 0x4b, 0xb8, 0x51); -typedef struct IPropertyBag IPropertyBag,*LPPROPERTYBAG; - -DEFINE_GUID(IID_ISpecifyPropertyPages, 0xb196b28b, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct ISpecifyPropertyPages ISpecifyPropertyPages,*LPSPECIFYPROPERTYPAGES; - -DEFINE_GUID(IID_IPerPropertyBrowsing, 0xb196b28b, 0xbab4, 0x101a, 0xb6, 0x9c, 0x00, 0xaa, 0x00, 0x34, 0x1d, 0x07); -typedef struct IPerPropertyBrowsing IPerPropertyBrowsing,*LPPERPROPERTYBROWSING; - - -/***************************************************************************** - * IPropertPage interface - */ -#define ICOM_INTERFACE IPropertyPage -#define IPropertyPage_METHODS \ - ICOM_METHOD1(HRESULT,SetPageSite, IPropertyPageSite*,pPageSite) \ - ICOM_METHOD3(HRESULT,Activate, HWND,hWndParent, LPCRECT,pRect, BOOL,bModal) \ - ICOM_METHOD (HRESULT,Deactivate) \ - ICOM_METHOD1(HRESULT,GetPageInfo, PROPPAGEINFO*,pPageInfo) \ - ICOM_METHOD2(HRESULT,SetObjects, ULONG,cObjects, IUnknown**,ppUnk) \ - ICOM_METHOD1(HRESULT,Show, UINT,nCmdShow) \ - ICOM_METHOD1(HRESULT,Move, LPCRECT,pRect) \ - ICOM_METHOD (HRESULT,IsPageDirty) \ - ICOM_METHOD (HRESULT,Apply) \ - ICOM_METHOD1(HRESULT,Help, LPCOLESTR,pszHelpDir) \ - ICOM_METHOD1(HRESULT,TranslateAccelerator, MSG*,pMsg) -#define IPropertyPage_IMETHODS \ - IUnknown_IMETHODS \ - IPropertyPage_METHODS -ICOM_DEFINE(IPropertyPage,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPropertyPage_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPropertyPage_AddRef(p) ICOM_CALL (AddRef,p) -#define IPropertyPage_Release(p) ICOM_CALL (Release,p) -/*** IPropertyPage methods ***/ -#define IPropertyPage_SetPageSite(p,a) ICOM_CALL1(SetPageSite,p,a) -#define IPropertyPage_Activate(p,a,b,c) ICOM_CALL3(Activate,p,a,b,c) -#define IPropertyPage_Deactivate(p) ICOM_CALL (Deactivate,p) -#define IPropertyPage_GetPageInfo(p,a) ICOM_CALL1(GetPageInfo,p,a) -#define IPropertyPage_SetObjects(p,a,b) ICOM_CALL2(SetObjects,p,a,b) -#define IPropertyPage_Show(p,a) ICOM_CALL1(Show,p,a) -#define IPropertyPage_Move(p,a) ICOM_CALL1(Move,p,a) -#define IPropertyPage_IsPageDirty(p) ICOM_CALL (IsPageDirty,p) -#define IPropertyPage_Apply(p) ICOM_CALL (Apply,p) -#define IPropertyPage_Help(p,a) ICOM_CALL1(Help,p,a) -#define IPropertyPage_TranslateAccelerator(p,a) ICOM_CALL1(TranslateAccelerator,p,a) - - -/***************************************************************************** - * IPropertPage2 interface - */ -#define ICOM_INTERFACE IPropertyPage2 -#define IPropertyPage2_METHODS \ - ICOM_METHOD1(HRESULT,EditProperty, DISPID,dispID) -#define IPropertyPage2_IMETHODS \ - IPropertyPage_IMETHODS \ - IPropertyPage2_METHODS -ICOM_DEFINE(IPropertyPage2,IPropertyPage) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPropertyPage2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPropertyPage2_AddRef(p) ICOM_CALL (AddRef,p) -#define IPropertyPage2_Release(p) ICOM_CALL (Release,p) -/*** IPropertyPage methods ***/ -#define IPropertyPage2_SetPageSite(p,a) ICOM_CALL1(SetPageSite,p,a) -#define IPropertyPage2_Activate(p,a,b,c) ICOM_CALL3(Activate,p,a,b,c) -#define IPropertyPage2_Deactivate(p) ICOM_CALL (Deactivate,p) -#define IPropertyPage2_GetPageInfo(p,a) ICOM_CALL1(GetPageInfo,p,a) -#define IPropertyPage2_SetObjects(p,a,b) ICOM_CALL2(SetObjects,p,a,b) -#define IPropertyPage2_Show(p,a) ICOM_CALL1(Show,p,a) -#define IPropertyPage2_Move(p,a) ICOM_CALL1(Move,p,a) -#define IPropertyPage2_IsPageDirty(p) ICOM_CALL (IsPageDirty,p) -#define IPropertyPage2_Apply(p) ICOM_CALL (Apply,p) -#define IPropertyPage2_Help(p,a) ICOM_CALL1(Help,p,a) -#define IPropertyPage2_TranslateAccelerator(p,a) ICOM_CALL1(TranslateAccelerator,p,a) -/*** IPropertyPage2 methods ***/ -#define IPropertyPage2_EditProperty(p,a) ICOM_CALL1(EditProperty,p,a) - - -/***************************************************************************** - * IPropertPageSite interface - */ -#define ICOM_INTERFACE IPropertyPageSite -#define IPropertyPageSite_METHODS \ - ICOM_METHOD1(HRESULT,OnStatusChange, DWORD,dwFlags) \ - ICOM_METHOD1(HRESULT,GetLocaleID, LCID*,pLocaleID) \ - ICOM_METHOD1(HRESULT,GetPageContainer, IUnknown**,ppUnk) \ - ICOM_METHOD1(HRESULT,TranslateAccelerator, MSG*,pMsg) -#define IPropertyPageSite_IMETHODS \ - IUnknown_IMETHODS \ - IPropertyPageSite_METHODS -ICOM_DEFINE(IPropertyPageSite,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPropertyPageSite_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPropertyPageSite_AddRef(p) ICOM_CALL (AddRef,p) -#define IPropertyPageSite_Release(p) ICOM_CALL (Release,p) -/*** IPropertyPageSite methods ***/ -#define IPropertyPageSite_OnStatusChange(p,a) ICOM_CALL1(OnStatusChange,p,a) -#define IPropertyPageSite_GetLocaleID(p,a) ICOM_CALL1(GetLocaleID,p,a) -#define IPropertyPageSite_GetPageContainer(p,a) ICOM_CALL1(GetPageContainer,p,a) -#define IPropertyPageSite_TranslateAccelerator(p,a) ICOM_CALL1(TranslateAccelerator,p,a) - - -/***************************************************************************** - * IPropertyNotifySink interface - */ -#define ICOM_INTERFACE IPropertyNotifySink -#define IPropertyNotifySink_METHODS \ - ICOM_METHOD1(HRESULT,OnChanged, DISPID,dispID) \ - ICOM_METHOD1(HRESULT,OnRequestEdit, DISPID,dispID) -#define IPropertyNotifySink_IMETHODS \ - IUnknown_IMETHODS \ - IPropertyNotifySink_METHODS -ICOM_DEFINE(IPropertyNotifySink,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPropertyNotifySink_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPropertyNotifySink_AddRef(p) ICOM_CALL (AddRef,p) -#define IPropertyNotifySink_Release(p) ICOM_CALL (Release,p) -/*** IPropertyNotifySink methods ***/ -#define IPropertyNotifySink_OnChanged(p,a) ICOM_CALL1(OnChanged,p,a) -#define IPropertyNotifySink_OnRequestEdit(p,a) ICOM_CALL1(OnRequestEdit,p,a) - - -/***************************************************************************** - * IPropertyNotifySink interface - */ -#define ICOM_INTERFACE ISimpleFrameSite -#define ISimpleFrameSite_METHODS \ - ICOM_METHOD6(HRESULT,PreMessageFilter, HWND,hWnd, UINT,msg, WPARAM,wp, LPARAM,lp, LRESULT*,plResult, DWORD*,pwdCookie) \ - ICOM_METHOD6(HRESULT,PostMessageFilter, HWND,hWnd, UINT,msg, WPARAM,wp, LPARAM,lp, LRESULT*,plResult, DWORD,pwdCookie) -#define ISimpleFrameSite_IMETHODS \ - IUnknown_IMETHODS \ - ISimpleFrameSite_METHODS -ICOM_DEFINE(ISimpleFrameSite,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ISimpleFrameSite_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ISimpleFrameSite_AddRef(p) ICOM_CALL (AddRef,p) -#define ISimpleFrameSite_Release(p) ICOM_CALL (Release,p) -/*** IPropertyNotifySink methods ***/ -#define ISimpleFrameSite_PreMessageFilter(p,a,b,c,d,e,f) ICOM_CALL1(PreMessageFilter,p,a,b,c,d,e,f) -#define ISimpleFrameSite_PostMessageFilter(p,a,b,c,d,e,f) ICOM_CALL1(PostMessageFilter,p,a,b,c,d,e,f) - - -/***************************************************************************** - * IPersistStreamInit interface - */ -#define ICOM_INTERFACE IPersistStreamInit -#define IPersistStreamInit_METHODS \ - ICOM_METHOD (HRESULT,IsDirty) \ - ICOM_METHOD1(HRESULT,Load, LPSTREAM,pStm) \ - ICOM_METHOD2(HRESULT,Save, LPSTREAM,pStm, BOOL,fClearDirty) \ - ICOM_METHOD1(HRESULT,GetSizeMax, ULARGE_INTEGER*,pcbSize) \ - ICOM_METHOD (HRESULT,InitNew) -#define IPersistStreamInit_IMETHODS \ - IPersist_IMETHODS \ - IPersistStreamInit_METHODS -ICOM_DEFINE(IPersistStreamInit,IPersist) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPersistStreamInit_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPersistStreamInit_AddRef(p) ICOM_CALL (AddRef,p) -#define IPersistStreamInit_Release(p) ICOM_CALL (Release,p) -/*** IPersist methods ***/ -#define IPersistStreamInit_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a) -/*** IPersistStreamInit methods ***/ -#define IPersistStreamInit_IsDirty(p) ICOM_CALL (IsDirty,p) -#define IPersistStreamInit_Load(p,a) ICOM_CALL1(Load,p,a) -#define IPersistStreamInit_Save(p,a,b) ICOM_CALL2(Save,p,a,b) -#define IPersistStreamInit_GetSizeMax(p,a) ICOM_CALL1(GetSizeMax,p,a) -#define IPersistStreamInit_InitNew(p) ICOM_CALL (InitNew,p) - - -/***************************************************************************** - * IPersistMemory interface - */ -#define ICOM_INTERFACE IPersistMemory -#define IPersistMemory_METHODS \ - ICOM_METHOD (HRESULT,IsDirty) \ - ICOM_METHOD2(HRESULT,Load, LPVOID,pMem, ULONG,cbSize) \ - ICOM_METHOD3(HRESULT,Save, LPVOID,pMem, BOOL,fClearDirty, ULONG,cbSize) \ - ICOM_METHOD1(HRESULT,GetSizeMax, ULONG*,pCbSize) \ - ICOM_METHOD (HRESULT,InitNew) -#define IPersistMemory_IMETHODS \ - IPersist_IMETHODS \ - IPersistMemory_METHODS -ICOM_DEFINE(IPersistMemory,IPersist) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPersistMemory_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPersistMemory_AddRef(p) ICOM_CALL (AddRef,p) -#define IPersistMemory_Release(p) ICOM_CALL (Release,p) -/*** IPersist methods ***/ -#define IPersistMemory_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a) -/*** IPersistMemory methods ***/ -#define IPersistMemory_IsDirty(p) ICOM_CALL (IsDirty,p) -#define IPersistMemory_Load(p,a,b) ICOM_CALL2(Load,p,a,b) -#define IPersistMemory_Save(p,a,b,c) ICOM_CALL3(Save,p,a,b,c) -#define IPersistMemory_GetSizeMax(p,a) ICOM_CALL1(GetSizeMax,p,a) -#define IPersistMemory_InitNew(p) ICOM_CALL (InitNew,p) - - -/***************************************************************************** - * IPersistPropertyBag interface - */ -#define ICOM_INTERFACE IPersistPropertyBag -#define IPersistPropertyBag_METHODS \ - ICOM_METHOD (HRESULT,InitNew) \ - ICOM_METHOD2(HRESULT,Load, IPropertyBag*,pPropBag, IErrorLog*,pErrorLog) \ - ICOM_METHOD3(HRESULT,Save, IPropertyBag*,pPropBag, BOOL,fClearDirty, BOOL,fSaveAllProperties) -#define IPersistPropertyBag_IMETHODS \ - IPersist_IMETHODS \ - IPersistPropertyBag_METHODS -ICOM_DEFINE(IPersistPropertyBag,IPersist) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPersistPropertyBag_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPersistPropertyBag_AddRef(p) ICOM_CALL (AddRef,p) -#define IPersistPropertyBag_Release(p) ICOM_CALL (Release,p) -/*** IPersist methods ***/ -#define IPersistPropertyBag_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a) -/*** IPersistPropertyBag methods ***/ -#define IPersistPropertyBag_InitNew(p) ICOM_CALL (InitNew,p) -#define IPersistPropertyBag_Load(p,a,b) ICOM_CALL2(Load,p,a,b) -#define IPersistPropertyBag_Save(p,a,b,c) ICOM_CALL3(Save,p,a,b,c) - - -/***************************************************************************** - * IErrorLog interface - */ -#define ICOM_INTERFACE IErrorLog -#define IErrorLog_METHODS \ - ICOM_METHOD2(HRESULT,AddError, LPCOLESTR,pszPropName, EXCEPINFO*,pExcepInfo) -#define IErrorLog_IMETHODS \ - IUnknown_IMETHODS \ - IErrorLog_METHODS -ICOM_DEFINE(IErrorLog,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IErrorLog_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IErrorLog_AddRef(p) ICOM_CALL (AddRef,p) -#define IErrorLog_Release(p) ICOM_CALL (Release,p) -/*** IErrorLog methods ***/ -#define IErrorLog_AddError(p,a,b) ICOM_CALL2(GetClassID,p,a,b) - - -/***************************************************************************** - * IPropertyBag interface - */ -#define ICOM_INTERFACE IPropertyBag -#define IPropertyBag_METHODS \ - ICOM_METHOD3(HRESULT,Read, LPCOLESTR,pszPropName, VARIANT*,pVar, IErrorLog*,pErrorLog) \ - ICOM_METHOD2(HRESULT,Write, LPCOLESTR,pszPropName, VARIANT*,pVar) -#define IPropertyBag_IMETHODS \ - IUnknown_IMETHODS \ - IPropertyBag_METHODS -ICOM_DEFINE(IPropertyBag,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPropertyBag_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPropertyBag_AddRef(p) ICOM_CALL (AddRef,p) -#define IPropertyBag_Release(p) ICOM_CALL (Release,p) -/*** IPropertyBag methods ***/ -#define IPropertyBag_Read(p,a,b,c) ICOM_CALL3(Read,p,a,b,c) -#define IPropertyBag_Write(p,a,b) ICOM_CALL2(Write,p,a,b) - - -/***************************************************************************** - * ISpecifyPropertyPages interface - */ -#define ICOM_INTERFACE ISpecifyPropertyPages -#define ISpecifyPropertyPages_METHODS \ - ICOM_METHOD1(HRESULT,GetPages, CAUUID*,pPages) -#define ISpecifyPropertyPages_IMETHODS \ - IUnknown_IMETHODS \ - ISpecifyPropertyPages_METHODS -ICOM_DEFINE(ISpecifyPropertyPages,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ISpecifyPropertyPages_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ISpecifyPropertyPages_AddRef(p) ICOM_CALL (AddRef,p) -#define ISpecifyPropertyPages_Release(p) ICOM_CALL (Release,p) -/*** ISpecifyPropertyPages methods ***/ -#define ISpecifyPropertyPages_GetPages(p,a) ICOM_CALL3(GetPages,p,a) - - -/***************************************************************************** - * IPerPropertyBrowsing interface - */ -#define ICOM_INTERFACE IPerPropertyBrowsing -#define IPerPropertyBrowsing_METHODS \ - ICOM_METHOD2(HRESULT,GetDisplayString, DISPID,dispID, BSTR*,pBstr) \ - ICOM_METHOD2(HRESULT,MapPropertyToPage, DISPID,dispID, CLSID*,pClsid) \ - ICOM_METHOD3(HRESULT,GetPredefinedStrings, DISPID,dispID, CALPOLESTR*,pCaStringsOut, CADWORD*,pCaCookiesOut) \ - ICOM_METHOD3(HRESULT,GetPredefinedValue, DISPID,dispID, DWORD,dwCookie, VARIANT*,pVarOut) -#define IPerPropertyBrowsing_IMETHODS \ - IUnknown_IMETHODS \ - IPerPropertyBrowsing_METHODS -ICOM_DEFINE(IPerPropertyBrowsing,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPerPropertyBrowsing_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPerPropertyBrowsing_AddRef(p) ICOM_CALL (AddRef,p) -#define IPerPropertyBrowsing_Release(p) ICOM_CALL (Release,p) -/*** IPerPropertyBrowsing methods ***/ -#define IPerPropertyBrowsing_GetDisplayString(p,a,b) ICOM_CALL2(GetDisplayString,p,a,b) -#define IPerPropertyBrowsing_MapPropertyToPage(p,a,b) ICOM_CALL2(MapPropertyToPage,p,a,b) -#define IPerPropertyBrowsing_GetPredefinedStrings(p,a,b,c) ICOM_CALL3(GetPredefinedStrings,p,a,b,c) -#define IPerPropertyBrowsing_GetPredefinedValue(p,a,b,c) ICOM_CALL3(GetPredefinedValue,p,a,b,c) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_PROPERTY_H */ - diff --git a/reactos/include/ole32/obj_propertystorage.h b/reactos/include/ole32/obj_propertystorage.h deleted file mode 100644 index 5236ff9ae3c..00000000000 --- a/reactos/include/ole32/obj_propertystorage.h +++ /dev/null @@ -1,438 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to saving properties to file. - */ - -#ifndef __WINE_WINE_OBJ_PROPERTYSTORAGE_H -#define __WINE_WINE_OBJ_PROPERTYSTORAGE_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IEnumSTATPROPSETSTG, 0x0000013bL, 0, 0); -typedef struct IEnumSTATPROPSETSTG IEnumSTATPROPSETSTG,*LPENUMSTATPROPSETSTG; - -DEFINE_OLEGUID(IID_IEnumSTATPROPSTG, 0x00000139L, 0, 0); -typedef struct IEnumSTATPROPSTG IEnumSTATPROPSTG,*LPENUMSTATPROPSTG; - -DEFINE_OLEGUID(IID_IPropertySetStorage, 0x0000013aL, 0, 0); -typedef struct IPropertySetStorage IPropertySetStorage,*LPPROPERTYSETSTORAGE; - -DEFINE_OLEGUID(IID_IPropertyStorage, 0x00000138L, 0, 0); -typedef struct IPropertyStorage IPropertyStorage,*LPPROPERTYSTORAGE; - - -/***************************************************************************** - * Predeclare the structures - */ - -typedef struct tagSTATPROPSETSTG STATPROPSETSTG; -typedef struct tagSTATPROPSTG STATPROPSTG; - -extern const FMTID FMTID_SummaryInformation; -extern const FMTID FMTID_DocSummaryInformation; -extern const FMTID FMTID_UserDefinedProperties; - -/***************************************************************************** - * PROPSPEC structure - */ - -/* Reserved global Property IDs */ -#define PID_DICTIONARY ( 0 ) - -#define PID_CODEPAGE ( 0x1 ) - -#define PID_FIRST_USABLE ( 0x2 ) - -#define PID_FIRST_NAME_DEFAULT ( 0xfff ) - -#define PID_LOCALE ( 0x80000000 ) - -#define PID_MODIFY_TIME ( 0x80000001 ) - -#define PID_SECURITY ( 0x80000002 ) - -#define PID_ILLEGAL ( 0xffffffff ) - -/* Property IDs for the SummaryInformation Property Set */ - -#define PIDSI_TITLE 0x00000002L /* VT_LPSTR */ -#define PIDSI_SUBJECT 0x00000003L /* VT_LPSTR */ -#define PIDSI_AUTHOR 0x00000004L /* VT_LPSTR */ -#define PIDSI_KEYWORDS 0x00000005L /* VT_LPSTR */ -#define PIDSI_COMMENTS 0x00000006L /* VT_LPSTR */ -#define PIDSI_TEMPLATE 0x00000007L /* VT_LPSTR */ -#define PIDSI_LASTAUTHOR 0x00000008L /* VT_LPSTR */ -#define PIDSI_REVNUMBER 0x00000009L /* VT_LPSTR */ -#define PIDSI_EDITTIME 0x0000000aL /* VT_FILETIME (UTC) */ -#define PIDSI_LASTPRINTED 0x0000000bL /* VT_FILETIME (UTC) */ -#define PIDSI_CREATE_DTM 0x0000000cL /* VT_FILETIME (UTC) */ -#define PIDSI_LASTSAVE_DTM 0x0000000dL /* VT_FILETIME (UTC) */ -#define PIDSI_PAGECOUNT 0x0000000eL /* VT_I4 */ -#define PIDSI_WORDCOUNT 0x0000000fL /* VT_I4 */ -#define PIDSI_CHARCOUNT 0x00000010L /* VT_I4 */ -#define PIDSI_THUMBNAIL 0x00000011L /* VT_CF */ -#define PIDSI_APPNAME 0x00000012L /* VT_LPSTR */ -#define PIDSI_DOC_SECURITY 0x00000013L /* VT_I4 */ -#define PRSPEC_INVALID ( 0xffffffff ) - - -#define PRSPEC_LPWSTR ( 0 ) -#define PRSPEC_PROPID ( 1 ) - -typedef struct tagPROPSPEC -{ - ULONG ulKind; - union - { - PROPID propid; - LPOLESTR lpwstr; - } u; -} PROPSPEC; - - -/***************************************************************************** - * STATPROPSETSTG structure - */ -/* Macros for parsing the OS Version of the Property Set Header */ -#define PROPSETHDR_OSVER_KIND(dwOSVer) HIWORD( (dwOSVer) ) -#define PROPSETHDR_OSVER_MAJOR(dwOSVer) LOBYTE(LOWORD( (dwOSVer) )) -#define PROPSETHDR_OSVER_MINOR(dwOSVer) HIBYTE(LOWORD( (dwOSVer) )) -#define PROPSETHDR_OSVERSION_UNKNOWN 0xFFFFFFFF - -struct tagSTATPROPSETSTG -{ - FMTID fmtid; - CLSID clsid; - DWORD grfFlags; - FILETIME mtime; - FILETIME ctime; - FILETIME atime; - DWORD dwOSVersion; -}; - - -/***************************************************************************** - * STATPROPSTG structure - */ -struct tagSTATPROPSTG -{ - LPOLESTR lpwstrName; - PROPID propid; - VARTYPE vt; -}; - - -/***************************************************************************** - * IEnumSTATPROPSETSTG interface - */ -#define ICOM_INTERFACE IEnumSTATPROPSETSTG -#define IEnumSTATPROPSETSTG_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,celt, STATPROPSETSTG*,rgelt, ULONG*,pceltFethed) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumSTATPROPSETSTG**,ppenum) -#define IEnumSTATPROPSETSTG_IMETHODS \ - IUnknown_IMETHODS \ - IEnumSTATPROPSETSTG_METHODS -ICOM_DEFINE(IEnumSTATPROPSETSTG,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumSTATPROPSETSTG_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumSTATPROPSETSTG_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumSTATPROPSETSTG_Release(p) ICOM_CALL (Release,p) -/*** IEnumSTATPROPSETSTG methods ***/ -#define IEnumSTATPROPSETSTG_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumSTATPROPSETSTG_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumSTATPROPSETSTG_Reset(p) ICOM_CALL (Reset,p) -#define IEnumSTATPROPSETSTG_Clone(p,a) ICOM_CALL1(Clone,p,a) - - -/***************************************************************************** - * IEnumSTATPROPSTG interface - */ -#define ICOM_INTERFACE IEnumSTATPROPSTG -#define IEnumSTATPROPSTG_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,celt, STATPROPSTG*,rgelt, ULONG*,pceltFethed) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumSTATPROPSTG**,ppenum) -#define IEnumSTATPROPSTG_IMETHODS \ - IUnknown_IMETHODS \ - IEnumSTATPROPSTG_METHODS -ICOM_DEFINE(IEnumSTATPROPSTG,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumSTATPROPSTG_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumSTATPROPSTG_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumSTATPROPSTG_Release(p) ICOM_CALL (Release,p) -/*** IEnumSTATPROPSTG methods ***/ -#define IEnumSTATPROPSTG_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumSTATPROPSTG_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumSTATPROPSTG_Reset(p) ICOM_CALL (Reset,p) -#define IEnumSTATPROPSTG_Clone(p,a) ICOM_CALL1(Clone,p,a) - - -/***************************************************************************** - * IPropertySetStorage interface - */ -#define ICOM_INTERFACE IPropertySetStorage -#define IPropertySetStorage_METHODS \ - ICOM_METHOD5(HRESULT,Create, REFFMTID,rfmtid, const CLSID*,pclsid, DWORD,grfFlags, DWORD,grfMode, IPropertyStorage**,ppprstg) \ - ICOM_METHOD3(HRESULT,Open, REFFMTID,rfmtid, DWORD,grfMode, IPropertyStorage**,ppprstg) \ - ICOM_METHOD1(HRESULT,Delete, REFFMTID,rfmtid) \ - ICOM_METHOD1(HRESULT,Enum, IEnumSTATPROPSETSTG**,ppenum) -#define IPropertySetStorage_IMETHODS \ - IUnknown_IMETHODS \ - IPropertySetStorage_METHODS -ICOM_DEFINE(IPropertySetStorage,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPropertySetStorage_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPropertySetStorage_AddRef(p) ICOM_CALL (AddRef,p) -#define IPropertySetStorage_Release(p) ICOM_CALL (Release,p) -/*** IPropertySetStorage methods ***/ -#define IPropertySetStorage_Create(p,a,b,c,d,e) ICOM_CALL5(Create,p,a,b,c,d,e) -#define IPropertySetStorage_Open(p,a,b,c) ICOM_CALL3(Open,p,a,b,c) -#define IPropertySetStorage_Delete(p,a) ICOM_CALL1(Delete,p,a) -#define IPropertySetStorage_Enum(p,a) ICOM_CALL1(Enum,p,a) - - -/***************************************************************************** - * IPropertyStorage interface - */ -typedef struct tagPROPVARIANT PROPVARIANT,*LPPROPVARIANT; - -/* Flags for IPropertySetStorage::Create */ -#define PROPSETFLAG_DEFAULT ( 0 ) -#define PROPSETFLAG_NONSIMPLE ( 1 ) -#define PROPSETFLAG_ANSI ( 2 ) - -typedef struct tagCAUB -{ - ULONG cElems; - unsigned char *pElems; -} CAUB; - -typedef struct tagCAI -{ - ULONG cElems; - short *pElems; -} CAI; - -typedef struct tagCAUI -{ - ULONG cElems; - USHORT *pElems; -} CAUI; - -typedef struct tagCAL -{ - ULONG cElems; - long *pElems; -} CAL; - -typedef struct tagCAUL -{ - ULONG cElems; - ULONG *pElems; -} CAUL; - -typedef struct tagCAFLT -{ - ULONG cElems; - float *pElems; -} CAFLT; - -typedef struct tagCADBL -{ - ULONG cElems; - double *pElems; -} CADBL; - -typedef struct tagCACY -{ - ULONG cElems; - CY *pElems; -} CACY; - -typedef struct tagCADATE -{ - ULONG cElems; - DATE *pElems; -} CADATE; - -typedef struct tagCABSTR -{ - ULONG cElems; - BSTR *pElems; -} CABSTR; - -typedef struct tagCABOOL -{ - ULONG cElems; - VARIANT_BOOL *pElems; -} CABOOL; - -typedef struct tagCASCODE -{ - ULONG cElems; - SCODE *pElems; -} CASCODE; - -typedef struct tagCAPROPVARIANT -{ - ULONG cElems; - PROPVARIANT *pElems; -} CAPROPVARIANT; - -typedef struct tagCAH -{ - ULONG cElems; - LARGE_INTEGER *pElems; -} CAH; - -typedef struct tagCAUH -{ - ULONG cElems; - ULARGE_INTEGER *pElems; -} CAUH; - -typedef struct tagCALPSTR -{ - ULONG cElems; - LPSTR *pElems; -} CALPSTR; - -typedef struct tagCALPWSTR -{ - ULONG cElems; - LPWSTR *pElems; -} CALPWSTR; - -typedef struct tagCAFILETIME -{ - ULONG cElems; - FILETIME *pElems; -} CAFILETIME; - -typedef struct tagCACLIPDATA -{ - ULONG cElems; - CLIPDATA *pElems; -} CACLIPDATA; - -typedef struct tagCACLSID -{ - ULONG cElems; - CLSID *pElems; -} CACLSID; - -struct tagPROPVARIANT -{ - VARTYPE vt; - WORD wReserved1; - WORD wReserved2; - WORD wReserved3; - union - { - /* Empty union arm */ - UCHAR bVal; - short iVal; - USHORT uiVal; - VARIANT_BOOL boolVal; -#ifndef __cplusplus - /* FIXME: bool is reserved in C++, how can we deal with that ? */ - _VARIANT_BOOL bool; -#endif - long lVal; - ULONG ulVal; - float fltVal; - SCODE scode; - LARGE_INTEGER hVal; - ULARGE_INTEGER uhVal; - double dblVal; - CY cyVal; - DATE date; - FILETIME filetime; - CLSID *puuid; - BLOB blob; - CLIPDATA *pclipdata; - IStream *pStream; - IStorage *pStorage; - BSTR bstrVal; - LPSTR pszVal; - LPWSTR pwszVal; - CAUB caub; - CAI cai; - CAUI caui; - CABOOL cabool; - CAL cal; - CAUL caul; - CAFLT caflt; - CASCODE cascode; - CAH cah; - CAUH cauh; - CADBL cadbl; - CACY cacy; - CADATE cadate; - CAFILETIME cafiletime; - CACLSID cauuid; - CACLIPDATA caclipdata; - CABSTR cabstr; - CALPSTR calpstr; - CALPWSTR calpwstr; - CAPROPVARIANT capropvar; - } u; -}; - - -#define ICOM_INTERFACE IPropertyStorage -#define IPropertyStorage_METHODS \ - ICOM_METHOD3(HRESULT,ReadMultiple, ULONG,cpspec, const PROPSPEC*,rgpspec, PROPVARIANT*,rgpropvar) \ - ICOM_METHOD4(HRESULT,WriteMultiple, ULONG,cpspec, const PROPSPEC*,rgpspec, const PROPVARIANT*,rgpropvar, PROPID,propidNameFirst) \ - ICOM_METHOD2(HRESULT,DeleteMultiple, ULONG,cpspec, const PROPSPEC*,rgpspec) \ - ICOM_METHOD2(HRESULT,ReadPropertyNames, const PROPID*,rgpropid, LPOLESTR*,rglpwstrName) \ - ICOM_METHOD3(HRESULT,WritePropertyNames, ULONG,cpropid, const PROPID*,rgpropid, LPOLESTR*,rglpwstrName) \ - ICOM_METHOD2(HRESULT,DeletePropertyNames, ULONG,cpropid, const PROPID*,rgpropid) \ - ICOM_METHOD1(HRESULT,Commit, DWORD,grfCommitFlags) \ - ICOM_METHOD (HRESULT,Revert) \ - ICOM_METHOD1(HRESULT,Enum, IEnumSTATPROPSTG**,ppenum) \ - ICOM_METHOD3(HRESULT,SetTimes, const FILETIME*,pctime, const FILETIME*,patime, const FILETIME*,pmtime) \ - ICOM_METHOD1(HRESULT,SetClass, REFCLSID,clsid) \ - ICOM_METHOD1(HRESULT,Stat, STATPROPSETSTG*,pstatpsstg) -#define IPropertyStorage_IMETHODS \ - IUnknown_IMETHODS \ - IPropertyStorage_METHODS -ICOM_DEFINE(IPropertyStorage,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPropertyStorage_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPropertyStorage_AddRef(p) ICOM_CALL (AddRef,p) -#define IPropertyStorage_Release(p) ICOM_CALL (Release,p) -/*** IPropertyStorage methods ***/ -#define IPropertyStorage_ReadMultiple(p,a,b,c) ICOM_CALL3(ReadMultiple,p,a,b,c) -#define IPropertyStorage_WriteMultiple(p,a,b,c,d) ICOM_CALL4(WriteMultiple,p,a,b,c,d) -#define IPropertyStorage_DeleteMultiple(p,a,b) ICOM_CALL2(DeleteMultiple,p,a,b) -#define IPropertyStorage_ReadPropertyNames(p,a,b) ICOM_CALL2(ReadPropertyNames,p,a,b) -#define IPropertyStorage_WritePropertyNames(p,a,b,c) ICOM_CALL3(WritePropertyNames,p,a,b,c) -#define IPropertyStorage_DeletePropertyNames(p,a,b) ICOM_CALL2(DeletePropertyNames,p,a,b) -#define IPropertyStorage_Commit(p,a) ICOM_CALL1(Commit,p,a) -#define IPropertyStorage_Revert(p) ICOM_CALL (Revert,p) -#define IPropertyStorage_Enum(p,a) ICOM_CALL1(Enum,p,a) -#define IPropertyStorage_SetTimes(p,a,b,c) ICOM_CALL3(SetTimes,p,a,b,c) -#define IPropertyStorage_SetClass(p,a) ICOM_CALL1(SetClass,p,a) -#define IPropertyStorage_Stat(p,a) ICOM_CALL1(Stat,p,a) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_PROPERTYSTORAGE_H */ diff --git a/reactos/include/ole32/obj_queryassociations.h b/reactos/include/ole32/obj_queryassociations.h deleted file mode 100644 index 257d9f231e5..00000000000 --- a/reactos/include/ole32/obj_queryassociations.h +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************ - * IQueryAssociations - */ - -#ifndef __WINE_WINE_OBJ_QUERYASSOCIATIONS_H -#define __WINE_WINE_OBJ_QUERYASSOCIATIONS_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -DEFINE_GUID(IID_IQueryAssociations, 0xc46ca590, 0x3c3f, 0x11d2, 0xbe, 0xe6, 0x00, 0x00, 0xf8, 0x05, 0xca, 0x57); - -typedef struct IQueryAssociations IQueryAssociations,*LPQUERYASSOCIATIONS; - -#define ASSOCF_INIT_BYEXENAME 0x00000002 -#define ASSOCF_OPEN_BYEXENAME 0x00000002 -#define ASSOCF_INIT_DEFAULTTOSTAR 0x00000004 -#define ASSOCF_INIT_DEFAULTTOFOLDER 0x00000008 -#define ASSOCF_NOUSERSETTINGS 0x00000010 -#define ASSOCF_NOTRUNCATE 0x00000020 -#define ASSOCF_VERIFY 0x00000040 -#define ASSOCF_REMAPRUNDLL 0x00000080 -#define ASSOCF_NOFIXUPS 0x00000100 -#define ASSOCF_IGNOREBASECLASS 0x00000200 - -typedef DWORD ASSOCF; - -typedef enum -{ - ASSOCSTR_COMMAND = 1, - ASSOCSTR_EXECUTABLE, - ASSOCSTR_FRIENDLYDOCNAME, - ASSOCSTR_FRIENDLYAPPNAME, - ASSOCSTR_NOOPEN, - ASSOCSTR_SHELLNEWVALUE, - ASSOCSTR_DDECOMMAND, - ASSOCSTR_DDEIFEXEC, - ASSOCSTR_DDEAPPLICATION, - ASSOCSTR_DDETOPIC, - ASSOCSTR_MAX -} ASSOCSTR; - -typedef enum -{ - ASSOCKEY_SHELLEXECCLASS = 1, - ASSOCKEY_APP, - ASSOCKEY_CLASS, - ASSOCKEY_BASECLASS, - ASSOCKEY_MAX -} ASSOCKEY; - -typedef enum -{ - ASSOCDATA_MSIDESCRIPTOR = 1, - ASSOCDATA_NOACTIVATEHANDLER, - ASSOCDATA_QUERYCLASSSTORE, - ASSOCDATA_HASPERUSERASSOC, - ASSOCDATA_MAX -} ASSOCDATA; - -typedef enum -{ - ASSOCENUM_NONE -} ASSOCENUM; - -#define ICOM_INTERFACE IQueryAssociations -#define IQueryAssociations_METHODS \ - ICOM_METHOD4 (HRESULT, Init, ASSOCF, flags, LPCWSTR, pszAssoc, HKEY, hkProgid, HWND, hwnd) \ - ICOM_METHOD5 (HRESULT, GetString, ASSOCF, flags, ASSOCSTR, str, LPCWSTR, pszExtra, LPWSTR, pszOut, DWORD*, pcchOut) \ - ICOM_METHOD4 (HRESULT, GetKey, ASSOCF, flags, ASSOCKEY, key, LPCWSTR, pszExtra, HKEY*, phkeyOut) \ - ICOM_METHOD5 (HRESULT, GetData, ASSOCF, flags, ASSOCDATA, data, LPCWSTR, pszExtra, LPVOID, pvOut, DWORD*, pcbOut) \ - ICOM_METHOD5 (HRESULT, GetEnum, ASSOCF, flags, ASSOCENUM, assocenum, LPCWSTR, pszExtra, REFIID, riid, LPVOID*, ppvOut) -#define IQueryAssociations_IMETHODS \ - IUnknown_IMETHODS \ - IQueryAssociations_METHODS -ICOM_DEFINE(IQueryAssociations,IUnknown) -#undef ICOM_INTERFACE - -#define IQueryAssociations_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IQueryAssociations_AddRef(p) ICOM_CALL(AddRef,p) -#define IQueryAssociations_Release(p) ICOM_CALL(Release,p) -#define IQueryAssociations_Init(p,a,b,c,d) ICOM_CALL4(Init,p,a,b,c,d) -#define IQueryAssociations_GetString(p,a,b,c,d,e) ICOM_CALL5(GetString,p,a,b,c,d,e) -#define IQueryAssociations_GetKey(p,a,b,c,d) ICOM_CALL4(GetKey,p,a,b,c,d) -#define IQueryAssociations_GetData(p,a,b,c,d,e) ICOM_CALL5(GetData,p,a,b,c,d,e) -#define IQueryAssociations_GetEnum(p,a,b,c,d,e) ICOM_CALL5(GetEnum,p,a,b,c,d,e) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_QUERYASSOCIATIONS_H */ - diff --git a/reactos/include/ole32/obj_serviceprovider.h b/reactos/include/ole32/obj_serviceprovider.h deleted file mode 100644 index 0aef481fbe0..00000000000 --- a/reactos/include/ole32/obj_serviceprovider.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to IServiceProvider - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_SERVICEPROVIDER_H -#define __WINE_WINE_OBJ_SERVICEPROVIDER_H - -#include "wine/obj_base.h" -#include "winbase.h" - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_GUID(IID_IServiceProvider, 0x6d5140c1, 0x7436, 0x11ce, 0x80, 0x34, 0x00, 0xaa, 0x00, 0x60, 0x09, 0xfa); -typedef struct IServiceProvider IServiceProvider, *LPSERVICEPROVIDER; - - -/***************************************************************************** - * IServiceProvider interface - */ -#define ICOM_INTERFACE IServiceProvider -#define IServiceProvider_METHODS \ - ICOM_METHOD3( HRESULT, QueryService, REFGUID, guidService, REFIID, riid, void**, ppv) -#define IServiceProvider_IMETHODS \ - IUnknown_IMETHODS \ - IServiceProvider_METHODS -ICOM_DEFINE(IServiceProvider,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IServiceProvider_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IServiceProvider_AddRef(p) ICOM_CALL (AddRef,p) -#define IServiceProvider_Release(p) ICOM_CALL (Release,p) -/*** IServiceProvider methods ***/ -#define IServiceProvider_QueryService(p,a,b,c) ICOM_CALL3(QueryService,p,a,b,c) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_SERVICEPROVIDER_H */ diff --git a/reactos/include/ole32/obj_shellbrowser.h b/reactos/include/ole32/obj_shellbrowser.h deleted file mode 100644 index d3f902f618b..00000000000 --- a/reactos/include/ole32/obj_shellbrowser.h +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************ - * IShellBrowser - */ - -#ifndef __WINE_WINE_OBJ_SHELLBROWSER_H -#define __WINE_WINE_OBJ_SHELLBROWSER_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/* it's ok commented out, see obj_shellview.h - typedef struct IShellBrowser IShellBrowser, *LPSHELLBROWSER; -*/ - -#define SID_SShellBrowser IID_IShellBrowser - -DEFINE_GUID(SID_STopLevelBrowser, 0x4C96BE40L, 0x915C, 0x11CF, 0x99, 0xD3, 0x00, 0xAA, 0x00, 0x4A, 0xE8, 0x37); - -/* targets for GetWindow/SendControlMsg */ -#define FCW_STATUS 0x0001 -#define FCW_TOOLBAR 0x0002 -#define FCW_TREE 0x0003 -#define FCW_INTERNETBAR 0x0006 -#define FCW_PROGRESS 0x0008 - -/* wFlags for BrowseObject*/ -#define SBSP_DEFBROWSER 0x0000 -#define SBSP_SAMEBROWSER 0x0001 -#define SBSP_NEWBROWSER 0x0002 - -#define SBSP_DEFMODE 0x0000 -#define SBSP_OPENMODE 0x0010 -#define SBSP_EXPLOREMODE 0x0020 - -#define SBSP_ABSOLUTE 0x0000 -#define SBSP_RELATIVE 0x1000 -#define SBSP_PARENT 0x2000 -#define SBSP_NAVIGATEBACK 0x4000 -#define SBSP_NAVIGATEFORWARD 0x8000 - -#define SBSP_ALLOW_AUTONAVIGATE 0x10000 - -#define SBSP_INITIATEDBYHLINKFRAME 0x80000000 -#define SBSP_REDIRECT 0x40000000 -#define SBSP_WRITENOHISTORY 0x08000000 - -/* uFlage for SetToolbarItems */ -#define FCT_MERGE 0x0001 -#define FCT_CONFIGABLE 0x0002 -#define FCT_ADDTOEND 0x0004 - -#define ICOM_INTERFACE IShellBrowser -#define IShellBrowser_METHODS \ - ICOM_METHOD2(HRESULT, InsertMenusSB, HMENU, hmenuShared, LPOLEMENUGROUPWIDTHS, lpMenuWidths) \ - ICOM_METHOD3(HRESULT, SetMenuSB, HMENU, hmenuShared, HOLEMENU, holemenuReserved, HWND, hwndActiveObject) \ - ICOM_METHOD1(HRESULT, RemoveMenusSB, HMENU, hmenuShared) \ - ICOM_METHOD1(HRESULT, SetStatusTextSB, LPCOLESTR, lpszStatusText) \ - ICOM_METHOD1(HRESULT, EnableModelessSB, BOOL, fEnable) \ - ICOM_METHOD2(HRESULT, TranslateAcceleratorSB, LPMSG, lpmsg, WORD, wID) \ - ICOM_METHOD2(HRESULT, BrowseObject, LPCITEMIDLIST, pidl, UINT, wFlags) \ - ICOM_METHOD2(HRESULT, GetViewStateStream, DWORD, grfMode, LPSTREAM*, ppStrm) \ - ICOM_METHOD2(HRESULT, GetControlWindow, UINT, id, HWND*, lphwnd) \ - ICOM_METHOD5(HRESULT, SendControlMsg, UINT, id, UINT, uMsg, WPARAM, wParam, LPARAM, lParam, LRESULT*, pret) \ - ICOM_METHOD1(HRESULT, QueryActiveShellView, IShellView**, IShellView) \ - ICOM_METHOD1(HRESULT, OnViewWindowActive, IShellView*, IShellView) \ - ICOM_METHOD3(HRESULT, SetToolbarItems, LPTBBUTTON, lpButtons, UINT, nButtons, UINT, uFlags) -#define IShellBrowser_IMETHODS \ - IOleWindow_IMETHODS \ - IShellBrowser_METHODS -ICOM_DEFINE(IShellBrowser,IOleWindow) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IShellBrowser_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IShellBrowser_AddRef(p) ICOM_CALL(AddRef,p) -#define IShellBrowser_Release(p) ICOM_CALL(Release,p) -/*** IShellBrowser methods ***/ -#define IShellBrowser_GetWindow(p,a) ICOM_CALL1(GetWindow,p,a) -#define IShellBrowser_ContextSensitiveHelp(p,a) ICOM_CALL1(ContextSensitiveHelp,p,a) -#define IShellBrowser_InsertMenusSB(p,a,b) ICOM_CALL2(InsertMenusSB,p,a,b) -#define IShellBrowser_SetMenuSB(p,a,b,c) ICOM_CALL3(SetMenuSB,p,a,b,c) -#define IShellBrowser_RemoveMenusSB(p,a) ICOM_CALL1(RemoveMenusSB,p,a) -#define IShellBrowser_SetStatusTextSB(p,a) ICOM_CALL1(SetStatusTextSB,p,a) -#define IShellBrowser_EnableModelessSB(p,a) ICOM_CALL1(EnableModelessSB,p,a) -#define IShellBrowser_TranslateAcceleratorSB(p,a,b) ICOM_CALL2(TranslateAcceleratorSB,p,a,b) -#define IShellBrowser_BrowseObject(p,a,b) ICOM_CALL2(BrowseObject,p,a,b) -#define IShellBrowser_GetViewStateStream(p,a,b) ICOM_CALL2(GetViewStateStream,p,a,b) -#define IShellBrowser_GetControlWindow(p,a,b) ICOM_CALL2(GetControlWindow,p,a,b) -#define IShellBrowser_SendControlMsg(p,a,b,c,d,e) ICOM_CALL5(SendControlMsg,p,a,b,c,d,e) -#define IShellBrowser_QueryActiveShellView(p,a) ICOM_CALL1(QueryActiveShellView,p,a) -#define IShellBrowser_OnViewWindowActive(p,a) ICOM_CALL1(OnViewWindowActive,p,a) -#define IShellBrowser_SetToolbarItems(p,a,b,c) ICOM_CALL3(SetToolbarItems,p,a,b,c) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_SHELLBROWSER_H */ diff --git a/reactos/include/ole32/obj_shellextinit.h b/reactos/include/ole32/obj_shellextinit.h deleted file mode 100644 index 3bac3a1cd3d..00000000000 --- a/reactos/include/ole32/obj_shellextinit.h +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************ - * IShellExtInit - */ - -#ifndef __WINE_WINE_OBJ_SHELLEXTINIT_H -#define __WINE_WINE_OBJ_SHELLEXTINIT_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -typedef struct IShellExtInit IShellExtInit, *LPSHELLEXTINIT; - -#define ICOM_INTERFACE IShellExtInit -#define IShellExtInit_METHODS \ - ICOM_METHOD3(HRESULT, Initialize, LPCITEMIDLIST, pidlFolder, LPDATAOBJECT, lpdobj, HKEY, hkeyProgID) -#define IShellExtInit_IMETHODS \ - IUnknown_IMETHODS \ - IShellExtInit_METHODS -ICOM_DEFINE(IShellExtInit,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IShellExtInit_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IShellExtInit_AddRef(p) ICOM_CALL(AddRef,p) -#define IShellExtInit_Release(p) ICOM_CALL(Release,p) -/*** IShellExtInit methods ***/ -#define IShellExtInit_Initialize(p,a,b,c) ICOM_CALL3(Initialize,p,a,b,c) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_SHELLEXTINIT_H */ diff --git a/reactos/include/ole32/obj_shellfolder.h b/reactos/include/ole32/obj_shellfolder.h deleted file mode 100644 index 088b4de05ce..00000000000 --- a/reactos/include/ole32/obj_shellfolder.h +++ /dev/null @@ -1,365 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to IShellFolder - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_SHELLFOLDER_H -#define __WINE_WINE_OBJ_SHELLFOLDER_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/**************************************************************************** -* STRRET -*/ -#define STRRET_WSTR 0x0000 -#define STRRET_ASTR 0x0003 - -#define STRRET_OFFSETA 0x0001 -#define STRRET_OFFSETW 0x0004 -#define STRRET_OFFSET WINELIB_NAME_AW(STRRET_OFFSET) - -#define STRRET_CSTRA 0x0002 -#define STRRET_CSTRW 0x0005 -#define STRRET_CSTR WINELIB_NAME_AW(STRRET_CSTR) - -typedef struct _STRRET -{ UINT uType; /* STRRET_xxx */ - union - { LPWSTR pOleStr; /* OLESTR that will be freed */ - LPSTR pStr; - UINT uOffset; /* OffsetINT32o SHITEMID (ANSI) */ - char cStr[MAX_PATH]; /* Buffer to fill in */ - WCHAR cStrW[MAX_PATH]; - } DUMMYUNIONNAME; -} STRRET,*LPSTRRET; - -/***************************************************************************** - * Predeclare the interfaces - */ -typedef struct IShellFolder IShellFolder, *LPSHELLFOLDER; - -typedef struct IPersistFolder IPersistFolder, *LPPERSISTFOLDER; - -DEFINE_GUID(IID_IPersistFolder2, 0x1ac3d9f0L, 0x175C, 0x11D1, 0x95, 0xBE, 0x00, 0x60, 0x97, 0x97, 0xEA, 0x4F); -typedef struct IPersistFolder2 IPersistFolder2, *LPPERSISTFOLDER2; - -DEFINE_GUID(IID_IShellFolder2, 0xB82C5AA8, 0xA41B, 0x11D2, 0xBE, 0x32, 0x0, 0xc0, 0x4F, 0xB9, 0x36, 0x61); -typedef struct IShellFolder2 IShellFolder2, *LPSHELLFOLDER2; - -DEFINE_GUID(IID_IEnumExtraSearch, 0xE700BE1, 0x9DB6, 0x11D1, 0xA1, 0xCE, 0x0, 0xc0, 0x4F, 0xD7, 0x5D, 0x13); -typedef struct IEnumExtraSearch IEnumExtraSearch, *LPENUMEXTRASEARCH; - -/***************************************************************************** - * IEnumExtraSearch interface - */ - -typedef struct -{ - GUID guidSearch; - WCHAR wszFriendlyName[80]; - WCHAR wszMenuText[80]; - WCHAR wszHelpText[MAX_PATH]; - WCHAR wszUrl[2084]; - WCHAR wszIcon[MAX_PATH+10]; - WCHAR wszGreyIcon[MAX_PATH+10]; - WCHAR wszClrIcon[MAX_PATH+10]; -} EXTRASEARCH,* LPEXTRASEARCH; - -#define ICOM_INTERFACE IEnumExtraSearch -#define IEnumExtraSearch_METHODS \ - ICOM_METHOD3(HRESULT, Next, ULONG, celt, LPEXTRASEARCH*, rgelt, ULONG*, pceltFetched) \ - ICOM_METHOD1(HRESULT, Skip, ULONG, celt) \ - ICOM_METHOD (HRESULT, Reset) \ - ICOM_METHOD1(HRESULT, Clone, IEnumExtraSearch**, ppenum) -#define IEnumExtraSearch_IMETHODS \ - IUnknown_IMETHODS \ - IEnumExtraSearch_METHODS -ICOM_DEFINE(IEnumExtraSearch,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumIDList_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumIDList_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumIDList_Release(p) ICOM_CALL (Release,p) -/*** IEnumIDList methods ***/ -#define IEnumIDList_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumIDList_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumIDList_Reset(p) ICOM_CALL(Reset,p) -#define IEnumIDList_Clone(p,a) ICOM_CALL1(Clone,p,a) - -/***************************************************************************** - * IShellFolder::GetDisplayNameOf/SetNameOf uFlags - */ -typedef enum -{ SHGDN_NORMAL = 0, /* default (display purpose) */ - SHGDN_INFOLDER = 1, /* displayed under a folder (relative)*/ - SHGDN_FORPARSING = 0x8000 /* for ParseDisplayName or path */ -} SHGNO; - -typedef DWORD SHGDNF; - -/***************************************************************************** - * IShellFolder::EnumObjects - */ -typedef enum tagSHCONTF -{ SHCONTF_FOLDERS = 32, /* for shell browser */ - SHCONTF_NONFOLDERS = 64, /* for default view */ - SHCONTF_INCLUDEHIDDEN = 128 /* for hidden/system objects */ - SHCONTF_INIT_ON_FIRST_NEXT = 256, /* allow EnumObject() to return before validating enum */ - SHCONTF_NETPRINTERSRCH = 512, /* hint that client is looking for printers */ - SHCONTF_SHAREABLE = 1024, /* hint that client is looking sharable resources (remote shares) */ - SHCONTF_STORAGE = 2048 /* include all items with accessible storage and their ancestors */ -} SHCONTF; - -/***************************************************************************** - * IShellFolder::GetAttributesOf flags - */ -#define SFGAO_CANCOPY DROPEFFECT_COPY /* Objects can be copied */ -#define SFGAO_CANMOVE DROPEFFECT_MOVE /* Objects can be moved */ -#define SFGAO_CANLINK DROPEFFECT_LINK /* Objects can be linked */ -#define SFGAO_CANRENAME 0x00000010L /* Objects can be renamed */ -#define SFGAO_CANDELETE 0x00000020L /* Objects can be deleted */ -#define SFGAO_HASPROPSHEET 0x00000040L /* Objects have property sheets */ -#define SFGAO_DROPTARGET 0x00000100L /* Objects are drop target */ -#define SFGAO_CAPABILITYMASK 0x00000177L -#define SFGAO_LINK 0x00010000L /* Shortcut (link) */ -#define SFGAO_SHARE 0x00020000L /* shared */ -#define SFGAO_READONLY 0x00040000L /* read-only */ -#define SFGAO_GHOSTED 0x00080000L /* ghosted icon */ -#define SFGAO_HIDDEN 0x00080000L /* hidden object */ -#define SFGAO_DISPLAYATTRMASK 0x000F0000L -#define SFGAO_FILESYSANCESTOR 0x10000000L /* It contains file system folder */ -#define SFGAO_FOLDER 0x20000000L /* It's a folder. */ -#define SFGAO_FILESYSTEM 0x40000000L /* is a file system thing (file/folder/root) */ -#define SFGAO_HASSUBFOLDER 0x80000000L /* Expandable in the map pane */ -#define SFGAO_CONTENTSMASK 0x80000000L -#define SFGAO_VALIDATE 0x01000000L /* invalidate cached information */ -#define SFGAO_REMOVABLE 0x02000000L /* is this removeable media? */ -#define SFGAO_BROWSABLE 0x08000000L /* is in-place browsable */ -#define SFGAO_NONENUMERATED 0x00100000L /* is a non-enumerated object */ -#define SFGAO_NEWCONTENT 0x00200000L /* should show bold in explorer tree */ -#define SFGAO_COMPRESSED 0x04000000L /* Object is compressed (use alt color) */ - -typedef ULONG SFGAOF; - -/************************************************************************ - * - * FOLDERSETTINGS -*/ - -typedef LPBYTE LPVIEWSETTINGS; - -/* NB Bitfields. */ -/* FWF_DESKTOP implies FWF_TRANSPARENT/NOCLIENTEDGE/NOSCROLL */ -typedef enum -{ FWF_AUTOARRANGE = 0x0001, - FWF_ABBREVIATEDNAMES = 0x0002, - FWF_SNAPTOGRID = 0x0004, - FWF_OWNERDATA = 0x0008, - FWF_BESTFITWINDOW = 0x0010, - FWF_DESKTOP = 0x0020, - FWF_SINGLESEL = 0x0040, - FWF_NOSUBFOLDERS = 0x0080, - FWF_TRANSPARENT = 0x0100, - FWF_NOCLIENTEDGE = 0x0200, - FWF_NOSCROLL = 0x0400, - FWF_ALIGNLEFT = 0x0800, - FWF_SINGLECLICKACTIVATE=0x8000 /* TEMPORARY -- NO UI FOR THIS */ -} FOLDERFLAGS; - -typedef enum -{ FVM_ICON = 1, - FVM_SMALLICON = 2, - FVM_LIST = 3, - FVM_DETAILS = 4 -} FOLDERVIEWMODE; - -typedef struct -{ UINT ViewMode; /* View mode (FOLDERVIEWMODE values) */ - UINT fFlags; /* View options (FOLDERFLAGS bits) */ -} FOLDERSETTINGS, *LPFOLDERSETTINGS; - -typedef const FOLDERSETTINGS * LPCFOLDERSETTINGS; - -/************************************************************************ - * Desktopfolder - */ - -extern IShellFolder * pdesktopfolder; - -DWORD WINAPI SHGetDesktopFolder(IShellFolder * *); - -/***************************************************************************** - * IShellFolder interface - */ -#define ICOM_INTERFACE IShellFolder -#define IShellFolder_METHODS \ - ICOM_METHOD6( HRESULT, ParseDisplayName, HWND, hwndOwner,LPBC, pbcReserved, LPOLESTR, lpszDisplayName, ULONG *, pchEaten, LPITEMIDLIST *, ppidl, ULONG *, pdwAttributes) \ - ICOM_METHOD3( HRESULT, EnumObjects, HWND, hwndOwner, DWORD, grfFlags, LPENUMIDLIST *, ppenumIDList)\ - ICOM_METHOD4( HRESULT, BindToObject, LPCITEMIDLIST, pidl, LPBC, pbcReserved, REFIID, riid, LPVOID *, ppvOut)\ - ICOM_METHOD4( HRESULT, BindToStorage, LPCITEMIDLIST, pidl, LPBC, pbcReserved, REFIID, riid, LPVOID *, ppvObj)\ - ICOM_METHOD3( HRESULT, CompareIDs, LPARAM, lParam, LPCITEMIDLIST, pidl1, LPCITEMIDLIST, pidl2)\ - ICOM_METHOD3( HRESULT, CreateViewObject, HWND, hwndOwner, REFIID, riid, LPVOID *, ppvOut)\ - ICOM_METHOD3( HRESULT, GetAttributesOf, UINT, cidl, LPCITEMIDLIST *, apidl, ULONG *, rgfInOut)\ - ICOM_METHOD6( HRESULT, GetUIObjectOf, HWND, hwndOwner, UINT, cidl, LPCITEMIDLIST *, apidl, REFIID, riid, UINT *, prgfInOut, LPVOID *, ppvOut)\ - ICOM_METHOD3( HRESULT, GetDisplayNameOf, LPCITEMIDLIST, pidl, DWORD, uFlags, LPSTRRET, lpName)\ - ICOM_METHOD5( HRESULT, SetNameOf, HWND, hwndOwner, LPCITEMIDLIST, pidl,LPCOLESTR, lpszName, DWORD, uFlags,LPITEMIDLIST *, ppidlOut) -#define IShellFolder_IMETHODS \ - IUnknown_IMETHODS \ - IShellFolder_METHODS -ICOM_DEFINE(IShellFolder,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IShellFolder_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IShellFolder_AddRef(p) ICOM_CALL (AddRef,p) -#define IShellFolder_Release(p) ICOM_CALL (Release,p) -/*** IShellFolder methods ***/ -#define IShellFolder_ParseDisplayName(p,a,b,c,d,e,f) ICOM_CALL6(ParseDisplayName,p,a,b,c,d,e,f) -#define IShellFolder_EnumObjects(p,a,b,c) ICOM_CALL3(EnumObjects,p,a,b,c) -#define IShellFolder_BindToObject(p,a,b,c,d) ICOM_CALL4(BindToObject,p,a,b,c,d) -#define IShellFolder_BindToStorage(p,a,b,c,d) ICOM_CALL4(BindToStorage,p,a,b,c,d) -#define IShellFolder_CompareIDs(p,a,b,c) ICOM_CALL3(CompareIDs,p,a,b,c) -#define IShellFolder_CreateViewObject(p,a,b,c) ICOM_CALL3(CreateViewObject,p,a,b,c) -#define IShellFolder_GetAttributesOf(p,a,b,c) ICOM_CALL3(GetAttributesOf,p,a,b,c) -#define IShellFolder_GetUIObjectOf(p,a,b,c,d,e,f) ICOM_CALL6(GetUIObjectOf,p,a,b,c,d,e,f) -#define IShellFolder_GetDisplayNameOf(p,a,b,c) ICOM_CALL3(GetDisplayNameOf,p,a,b,c) -#define IShellFolder_SetNameOf(p,a,b,c,d,e) ICOM_CALL5(SetNameOf,p,a,b,c,d,e) - -/***************************************************************************** - * IShellFolder2 interface - */ -/* IShellFolder2 */ - -/* GetDefaultColumnState */ -typedef enum -{ - SHCOLSTATE_TYPE_STR = 0x00000001, - SHCOLSTATE_TYPE_INT = 0x00000002, - SHCOLSTATE_TYPE_DATE = 0x00000003, - SHCOLSTATE_TYPEMASK = 0x0000000F, - SHCOLSTATE_ONBYDEFAULT = 0x00000010, - SHCOLSTATE_SLOW = 0x00000020, - SHCOLSTATE_EXTENDED = 0x00000040, - SHCOLSTATE_SECONDARYUI = 0x00000080, - SHCOLSTATE_HIDDEN = 0x00000100, -} SHCOLSTATE; - -typedef struct -{ - GUID fmtid; - DWORD pid; -} SHCOLUMNID, *LPSHCOLUMNID; -typedef const SHCOLUMNID* LPCSHCOLUMNID; - -/* GetDetailsEx */ -#define PID_FINDDATA 0 -#define PID_NETRESOURCE 1 -#define PID_DESCRIPTIONID 2 - -typedef struct -{ - int fmt; - int cxChar; - STRRET str; -} SHELLDETAILS, *LPSHELLDETAILS; - -#define ICOM_INTERFACE IShellFolder2 -#define IShellFolder2_METHODS \ - ICOM_METHOD1( HRESULT, GetDefaultSearchGUID, LPGUID, lpguid)\ - ICOM_METHOD1( HRESULT, EnumSearches, LPENUMEXTRASEARCH *, ppEnum) \ - ICOM_METHOD3( HRESULT, GetDefaultColumn, DWORD, dwReserved, ULONG *, pSort, ULONG *, pDisplay)\ - ICOM_METHOD2( HRESULT, GetDefaultColumnState, UINT, iColumn, DWORD *, pcsFlags)\ - ICOM_METHOD3( HRESULT, GetDetailsEx, LPCITEMIDLIST, pidl, const SHCOLUMNID *, pscid, VARIANT *, pv)\ - ICOM_METHOD3( HRESULT, GetDetailsOf, LPCITEMIDLIST, pidl, UINT, iColumn, LPSHELLDETAILS, pDetails)\ - ICOM_METHOD2( HRESULT, MapNameToSCID, LPCWSTR, pwszName, SHCOLUMNID *, pscid) -#define IShellFolder2_IMETHODS \ - IShellFolder_METHODS \ - IShellFolder2_METHODS -ICOM_DEFINE(IShellFolder2, IShellFolder) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IShellFolder2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IShellFolder2_AddRef(p) ICOM_CALL (AddRef,p) -#define IShellFolder2_Release(p) ICOM_CALL (Release,p) -/*** IShellFolder methods ***/ -#define IShellFolder2_ParseDisplayName(p,a,b,c,d,e,f) ICOM_CALL6(ParseDisplayName,p,a,b,c,d,e,f) -#define IShellFolder2_EnumObjects(p,a,b,c) ICOM_CALL3(EnumObjects,p,a,b,c) -#define IShellFolder2_BindToObject(p,a,b,c,d) ICOM_CALL4(BindToObject,p,a,b,c,d) -#define IShellFolder2_BindToStorage(p,a,b,c,d) ICOM_CALL4(BindToStorage,p,a,b,c,d) -#define IShellFolder2_CompareIDs(p,a,b,c) ICOM_CALL3(CompareIDs,p,a,b,c) -#define IShellFolder2_CreateViewObject(p,a,b,c) ICOM_CALL3(CreateViewObject,p,a,b,c) -#define IShellFolder2_GetAttributesOf(p,a,b,c) ICOM_CALL3(GetAttributesOf,p,a,b,c) -#define IShellFolder2_GetUIObjectOf(p,a,b,c,d,e,f) ICOM_CALL6(GetUIObjectOf,p,a,b,c,d,e,f) -#define IShellFolder2_GetDisplayNameOf(p,a,b,c) ICOM_CALL3(GetDisplayNameOf,p,a,b,c) -#define IShellFolder2_SetNameOf(p,a,b,c,d,e) ICOM_CALL5(SetNameOf,p,a,b,c,d,e) -/*** IShellFolder2 methods ***/ -#define IShellFolder2_GetDefaultSearchGUID(p,a) ICOM_CALL1(GetDefaultSearchGUID,p,a) -#define IShellFolder2_EnumSearches(p,a) ICOM_CALL1(EnumSearches,p,a) -#define IShellFolder2_GetDefaultColumn(p,a,b,c) ICOM_CALL3(GetDefaultColumn,p,a,b,c) -#define IShellFolder2_GetDefaultColumnState(p,a,b) ICOM_CALL2(GetDefaultColumnState,p,a,b) -#define IShellFolder2_GetDetailsEx(p,a,b,c) ICOM_CALL3(GetDetailsEx,p,a,b,c) -#define IShellFolder2_GetDetailsOf(p,a,b,c) ICOM_CALL3(GetDetailsOf,p,a,b,c) -#define IShellFolder2_MapNameToSCID(p,a,b) ICOM_CALL2(MapNameToSCID,p,a,b) - -/***************************************************************************** - * IPersistFolder interface - */ - -/* ClassID's */ -DEFINE_GUID (CLSID_SFMyComp,0x20D04FE0,0x3AEA,0x1069,0xA2,0xD8,0x08,0x00,0x2B,0x30,0x30,0x9D); -DEFINE_GUID (CLSID_SFINet, 0x871C5380,0x42A0,0x1069,0xA2,0xEA,0x08,0x00,0x2B,0x30,0x30,0x9D); -DEFINE_GUID (CLSID_SFFile, 0xF3364BA0,0x65B9,0x11CE,0xA9,0xBA,0x00,0xAA,0x00,0x4A,0xE8,0x37); - -#define ICOM_INTERFACE IPersistFolder -#define IPersistFolder_METHODS \ - ICOM_METHOD1( HRESULT, Initialize, LPCITEMIDLIST, pidl) -#define IPersistFolder_IMETHODS \ - IPersist_IMETHODS \ - IPersistFolder_METHODS -ICOM_DEFINE(IPersistFolder, IPersist) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPersistFolder_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPersistFolder_AddRef(p) ICOM_CALL (AddRef,p) -#define IPersistFolder_Release(p) ICOM_CALL (Release,p) -/*** IPersist methods ***/ -#define IPersistFolder_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a) -/*** IPersistFolder methods ***/ -#define IPersistFolder_Initialize(p,a) ICOM_CALL1(Initialize,p,a) - -/***************************************************************************** - * IPersistFolder2 interface - */ - -#define ICOM_INTERFACE IPersistFolder2 -#define IPersistFolder2_METHODS \ - ICOM_METHOD1( HRESULT, GetCurFolder, LPITEMIDLIST*, pidl) -#define IPersistFolder2_IMETHODS \ - IPersist_IMETHODS \ - IPersistFolder_METHODS \ - IPersistFolder2_METHODS -ICOM_DEFINE(IPersistFolder2, IPersistFolder) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPersistFolder2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPersistFolder2_AddRef(p) ICOM_CALL (AddRef,p) -#define IPersistFolder2_Release(p) ICOM_CALL (Release,p) -/*** IPersist methods ***/ -#define IPersistFolder2_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a) -/*** IPersistFolder methods ***/ -#define IPersistFolder2_Initialize(p,a) ICOM_CALL1(Initialize,p,a) -/*** IPersistFolder2 methods ***/ -#define IPersistFolder2_GetCurFolder(p,a) ICOM_CALL1(GetCurFolder,p,a) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_SHELLFOLDER_H */ diff --git a/reactos/include/ole32/obj_shelllink.h b/reactos/include/ole32/obj_shelllink.h deleted file mode 100644 index 79bf29f3344..00000000000 --- a/reactos/include/ole32/obj_shelllink.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to IShellLink. - * - * Depends on 'obj_base.h'. - */ - -#ifndef __WINE_WINE_OBJ_SHELLLINK_H -#define __WINE_WINE_OBJ_SHELLLINK_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the interfaces - */ -typedef struct IShellLinkA IShellLinkA,*LPSHELLLINK; -typedef struct IShellLinkW IShellLinkW,*LPSHELLLINKW; - -/***************************************************************************** - * - */ -typedef enum -{ SLR_NO_UI = 0x0001, - SLR_ANY_MATCH = 0x0002, - SLR_UPDATE = 0x0004 -} SLR_FLAGS; - -/***************************************************************************** - * GetPath fFlags - */ -typedef enum -{ SLGP_SHORTPATH = 0x0001, - SLGP_UNCPRIORITY = 0x0002 -} SLGP_FLAGS; -/***************************************************************************** - * IShellLink interface - */ -#define ICOM_INTERFACE IShellLinkA -#define IShellLinkA_METHODS \ - ICOM_METHOD4( HRESULT, GetPath, LPSTR, pszFile, INT, cchMaxPath, WIN32_FIND_DATAA *, pfd, DWORD, fFlags) \ - ICOM_METHOD1( HRESULT, GetIDList, LPITEMIDLIST *, ppidl) \ - ICOM_METHOD1( HRESULT, SetIDList, LPCITEMIDLIST, pidl) \ - ICOM_METHOD2( HRESULT, GetDescription, LPSTR, pszName, INT, cchMaxName) \ - ICOM_METHOD1( HRESULT, SetDescription, LPCSTR, pszName) \ - ICOM_METHOD2( HRESULT, GetWorkingDirectory, LPSTR, pszDir,INT, cchMaxPath) \ - ICOM_METHOD1( HRESULT, SetWorkingDirectory, LPCSTR, pszDir) \ - ICOM_METHOD2( HRESULT, GetArguments, LPSTR, pszArgs, INT, cchMaxPath) \ - ICOM_METHOD1( HRESULT, SetArguments, LPCSTR, pszArgs) \ - ICOM_METHOD1( HRESULT, GetHotkey, WORD*, pwHotkey) \ - ICOM_METHOD1( HRESULT, SetHotkey, WORD, wHotkey) \ - ICOM_METHOD1( HRESULT, GetShowCmd, INT*, piShowCmd) \ - ICOM_METHOD1( HRESULT, SetShowCmd, INT, iShowCmd) \ - ICOM_METHOD3( HRESULT, GetIconLocation, LPSTR, pszIconPath, INT, cchIconPath,INT *, piIcon) \ - ICOM_METHOD2( HRESULT, SetIconLocation, LPCSTR, pszIconPath,INT, iIcon) \ - ICOM_METHOD2( HRESULT, SetRelativePath, LPCSTR, pszPathRel, DWORD, dwReserved) \ - ICOM_METHOD2( HRESULT, Resolve, HWND, hwnd, DWORD, fFlags) \ - ICOM_METHOD1( HRESULT, SetPath, LPCSTR, pszFile) -#define IShellLinkA_IMETHODS \ - IUnknown_IMETHODS \ - IShellLinkA_METHODS -ICOM_DEFINE(IShellLinkA,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IShellLinkA_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IShellLinkA_AddRef(p) ICOM_CALL (AddRef,p) -#define IShellLinkA_Release(p) ICOM_CALL (Release,p) -/*** IShellLink methods ***/ -#define IShellLinkA_GetPath(p,a,b,c,d) ICOM_CALL4(GetPath,p,a,b,c,d) -#define IShellLinkA_GetIDList(p,a) ICOM_CALL1(GetIDList,p,a) -#define IShellLinkA_SetIDList(p,a) ICOM_CALL1(SetIDList,p,a) -#define IShellLinkA_GetDescription(p,a,b) ICOM_CALL2(GetDescription,p,a,b) -#define IShellLinkA_SetDescription(p,a) ICOM_CALL1(SetDescription,p,a) -#define IShellLinkA_GetWorkingDirectory(p,a,b) ICOM_CALL2(GetWorkingDirectory,p,a,b) -#define IShellLinkA_SetWorkingDirectory(p,a) ICOM_CALL1(SetWorkingDirectory,p,a) -#define IShellLinkA_GetArguments(p,a,b) ICOM_CALL2(GetArguments,p,a,b) -#define IShellLinkA_SetArguments(p,a) ICOM_CALL1(SetArguments,p,a) -#define IShellLinkA_GetHotkey(p,a) ICOM_CALL1(GetHotkey,p,a) -#define IShellLinkA_SetHotkey(p,a) ICOM_CALL1(SetHotkey,p,a) -#define IShellLinkA_GetShowCmd(p,a) ICOM_CALL1(GetShowCmd,p,a) -#define IShellLinkA_SetShowCmd(p,a) ICOM_CALL1(SetShowCmd,p,a) -#define IShellLinkA_GetIconLocation(p,a,b,c) ICOM_CALL3(GetIconLocation,p,a,b,c) -#define IShellLinkA_SetIconLocation(p,a,b) ICOM_CALL2(SetIconLocation,p,a,b) -#define IShellLinkA_SetRelativePath(p,a,b) ICOM_CALL2(SetRelativePath,p,a,b) -#define IShellLinkA_Resolve(p,a,b) ICOM_CALL2(Resolve,p,a,b) -#define IShellLinkA_SetPath(p,a) ICOM_CALL1(SetPath,p,a) - -/***************************************************************************** - * IShellLinkW interface - */ -#define ICOM_INTERFACE IShellLinkW -#define IShellLinkW_METHODS \ - ICOM_METHOD4( HRESULT, GetPath, LPWSTR, pszFile, INT, cchMaxPath, WIN32_FIND_DATAA *, pfd, DWORD, fFlags) \ - ICOM_METHOD1( HRESULT, GetIDList, LPITEMIDLIST *, ppidl) \ - ICOM_METHOD1( HRESULT, SetIDList, LPCITEMIDLIST, pidl) \ - ICOM_METHOD2( HRESULT, GetDescription, LPWSTR, pszName, INT, cchMaxName) \ - ICOM_METHOD1( HRESULT, SetDescription, LPCWSTR, pszName) \ - ICOM_METHOD2( HRESULT, GetWorkingDirectory, LPWSTR, pszDir,INT, cchMaxPath) \ - ICOM_METHOD1( HRESULT, SetWorkingDirectory, LPCWSTR, pszDir) \ - ICOM_METHOD2( HRESULT, GetArguments, LPWSTR, pszArgs, INT, cchMaxPath) \ - ICOM_METHOD1( HRESULT, SetArguments, LPCWSTR, pszArgs) \ - ICOM_METHOD1( HRESULT, GetHotkey, WORD*, pwHotkey) \ - ICOM_METHOD1( HRESULT, SetHotkey, WORD, wHotkey) \ - ICOM_METHOD1( HRESULT, GetShowCmd, INT*, piShowCmd) \ - ICOM_METHOD1( HRESULT, SetShowCmd, INT, iShowCmd) \ - ICOM_METHOD3( HRESULT, GetIconLocation, LPWSTR, pszIconPath, INT, cchIconPath,INT *, piIcon) \ - ICOM_METHOD2( HRESULT, SetIconLocation, LPCWSTR, pszIconPath,INT, iIcon) \ - ICOM_METHOD2( HRESULT, SetRelativePath, LPCWSTR, pszPathRel, DWORD, dwReserved) \ - ICOM_METHOD2( HRESULT, Resolve, HWND, hwnd, DWORD, fFlags) \ - ICOM_METHOD1( HRESULT, SetPath, LPCWSTR, pszFile) -#define IShellLinkW_IMETHODS \ - IUnknown_IMETHODS \ - IShellLinkW_METHODS -ICOM_DEFINE(IShellLinkW,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IShellLinkW_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IShellLinkW_AddRef(p) ICOM_CALL (AddRef,p) -#define IShellLinkW_Release(p) ICOM_CALL (Release,p) -/*** IShellLinkW methods ***/ -#define IShellLinkW_GetPath(p,a,b,c,d) ICOM_CALL4(GetPath,p,a,b,c,d) -#define IShellLinkW_GetIDList(p,a) ICOM_CALL1(GetIDList,p,a) -#define IShellLinkW_SetIDList(p,a) ICOM_CALL1(SetIDList,p,a) -#define IShellLinkW_GetDescription(p,a,b) ICOM_CALL2(GetDescription,p,a,b) -#define IShellLinkW_SetDescription(p,a) ICOM_CALL1(SetDescription,p,a) -#define IShellLinkW_GetWorkingDirectory(p,a,b) ICOM_CALL2(GetWorkingDirectory,p,a,b) -#define IShellLinkW_SetWorkingDirectory(p,a) ICOM_CALL1(SetWorkingDirectory,p,a) -#define IShellLinkW_GetArguments(p,a,b) ICOM_CALL2(GetArguments,p,a,b) -#define IShellLinkW_SetArguments(p,a) ICOM_CALL1(SetArguments,p,a) -#define IShellLinkW_GetHotkey(p,a) ICOM_CALL1(GetHotkey,p,a) -#define IShellLinkW_SetHotkey(p,a) ICOM_CALL1(SetHotkey,p,a) -#define IShellLinkW_GetShowCmd(p,a) ICOM_CALL1(GetShowCmd,p,a) -#define IShellLinkW_SetShowCmd(p,a) ICOM_CALL1(SetShowCmd,p,a) -#define IShellLinkW_GetIconLocation(p,a,b,c) ICOM_CALL3(GetIconLocation,p,a,b,c) -#define IShellLinkW_SetIconLocation(p,a,b) ICOM_CALL2(SetIconLocation,p,a,b) -#define IShellLinkW_SetRelativePath(p,a,b) ICOM_CALL2(SetRelativePath,p,a,b) -#define IShellLinkW_Resolve(p,a,b) ICOM_CALL2(Resolve,p,a,b) -#define IShellLinkW_SetPath(p,a) ICOM_CALL1(SetPath,p,a) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_SHELLLINK_H */ diff --git a/reactos/include/ole32/obj_shellview.h b/reactos/include/ole32/obj_shellview.h deleted file mode 100644 index 5786bcc7882..00000000000 --- a/reactos/include/ole32/obj_shellview.h +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************ - * IShellView - */ - -#ifndef __WINE_WINE_OBJ_SHELLVIEW_H -#define __WINE_WINE_OBJ_SHELLVIEW_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/**************************************************************************** - * IShellBrowser is here defined because of a cyclic dependance between - * IShellBrowser and IShellView - */ -typedef struct IShellBrowser IShellBrowser, *LPSHELLBROWSER; - -typedef struct IShellView IShellView, *LPSHELLVIEW; - -/* shellview select item flags*/ -#define SVSI_DESELECT 0x0000 -#define SVSI_SELECT 0x0001 -#define SVSI_EDIT 0x0003 /* includes select */ -#define SVSI_DESELECTOTHERS 0x0004 -#define SVSI_ENSUREVISIBLE 0x0008 -#define SVSI_FOCUSED 0x0010 - -/* shellview get item object flags */ -#define SVGIO_BACKGROUND 0x00000000 -#define SVGIO_SELECTION 0x00000001 -#define SVGIO_ALLVIEW 0x00000002 - -/* The explorer dispatches WM_COMMAND messages based on the range of - command/menuitem IDs. All the IDs of menuitems that the view (right - pane) inserts must be in FCIDM_SHVIEWFIRST/LAST (otherwise, the explorer - won't dispatch them). The view should not deal with any menuitems - in FCIDM_BROWSERFIRST/LAST (otherwise, it won't work with the future - version of the shell). - - FCIDM_SHVIEWFIRST/LAST for the right pane (IShellView) - FCIDM_BROWSERFIRST/LAST for the explorer frame (IShellBrowser) - FCIDM_GLOBAL/LAST for the explorer's submenu IDs -*/ -#define FCIDM_SHVIEWFIRST 0x0000 -/* undocumented */ -#define FCIDM_SHVIEW_ARRANGE 0x7001 -#define FCIDM_SHVIEW_DELETE 0x7011 -#define FCIDM_SHVIEW_PROPERTIES 0x7013 -#define FCIDM_SHVIEW_CUT 0x7018 -#define FCIDM_SHVIEW_COPY 0x7019 -#define FCIDM_SHVIEW_INSERT 0x701A -#define FCIDM_SHVIEW_UNDO 0x701B -#define FCIDM_SHVIEW_INSERTLINK 0x701C -#define FCIDM_SHVIEW_SELECTALL 0x7021 -#define FCIDM_SHVIEW_INVERTSELECTION 0x7022 - -#define FCIDM_SHVIEW_BIGICON 0x7029 -#define FCIDM_SHVIEW_SMALLICON 0x702A -#define FCIDM_SHVIEW_LISTVIEW 0x702B -#define FCIDM_SHVIEW_REPORTVIEW 0x702C -/* 0x7030-0x703f are used by the shellbrowser */ -#define FCIDM_SHVIEW_AUTOARRANGE 0x7031 -#define FCIDM_SHVIEW_SNAPTOGRID 0x7032 - -#define FCIDM_SHVIEW_HELP 0x7041 -#define FCIDM_SHVIEW_RENAME 0x7050 -#define FCIDM_SHVIEW_CREATELINK 0x7051 -#define FCIDM_SHVIEW_NEWLINK 0x7052 -#define FCIDM_SHVIEW_NEWFOLDER 0x7053 - -#define FCIDM_SHVIEW_REFRESH 0x7100 /* fixme */ -#define FCIDM_SHVIEW_EXPLORE 0x7101 /* fixme */ -#define FCIDM_SHVIEW_OPEN 0x7102 /* fixme */ - -#define FCIDM_SHVIEWLAST 0x7fff -#define FCIDM_BROWSERFIRST 0xA000 -/* undocumented toolbar items from stddlg's*/ -#define FCIDM_TB_UPFOLDER 0xA001 -#define FCIDM_TB_NEWFOLDER 0xA002 -#define FCIDM_TB_SMALLICON 0xA003 -#define FCIDM_TB_REPORTVIEW 0xA004 -#define FCIDM_TB_DESKTOP 0xA005 /* fixme */ - -#define FCIDM_BROWSERLAST 0xbf00 -#define FCIDM_GLOBALFIRST 0x8000 -#define FCIDM_GLOBALLAST 0x9fff - -/* -* Global submenu IDs and separator IDs -*/ -#define FCIDM_MENU_FILE (FCIDM_GLOBALFIRST+0x0000) -#define FCIDM_MENU_EDIT (FCIDM_GLOBALFIRST+0x0040) -#define FCIDM_MENU_VIEW (FCIDM_GLOBALFIRST+0x0080) -#define FCIDM_MENU_VIEW_SEP_OPTIONS (FCIDM_GLOBALFIRST+0x0081) -#define FCIDM_MENU_TOOLS (FCIDM_GLOBALFIRST+0x00c0) -#define FCIDM_MENU_TOOLS_SEP_GOTO (FCIDM_GLOBALFIRST+0x00c1) -#define FCIDM_MENU_HELP (FCIDM_GLOBALFIRST+0x0100) -#define FCIDM_MENU_FIND (FCIDM_GLOBALFIRST+0x0140) -#define FCIDM_MENU_EXPLORE (FCIDM_GLOBALFIRST+0x0150) -#define FCIDM_MENU_FAVORITES (FCIDM_GLOBALFIRST+0x0170) - -/* control IDs known to the view */ -#define FCIDM_TOOLBAR (FCIDM_BROWSERFIRST + 0) -#define FCIDM_STATUS (FCIDM_BROWSERFIRST + 1) - -/* uState values for IShellView::UIActivate */ -typedef enum -{ SVUIA_DEACTIVATE = 0, - SVUIA_ACTIVATE_NOFOCUS = 1, - SVUIA_ACTIVATE_FOCUS = 2, - SVUIA_INPLACEACTIVATE = 3 /* new flag for IShellView2 */ -} SVUIA_STATUS; - -#define ICOM_INTERFACE IShellView -#define IShellView_METHODS \ - ICOM_METHOD1(HRESULT, TranslateAccelerator, LPMSG, lpmsg) \ - ICOM_METHOD1(HRESULT, EnableModeless, BOOL, fEnable) \ - ICOM_METHOD1(HRESULT, UIActivate, UINT, uState) \ - ICOM_METHOD(HRESULT, Refresh) \ - ICOM_METHOD5(HRESULT, CreateViewWindow, IShellView*, lpPrevView, LPCFOLDERSETTINGS, lpfs, IShellBrowser*, psb, RECT*, prcView, HWND*, phWnd) \ - ICOM_METHOD(HRESULT, DestroyViewWindow) \ - ICOM_METHOD1(HRESULT, GetCurrentInfo, LPFOLDERSETTINGS, lpfs) \ - ICOM_METHOD3(HRESULT, AddPropertySheetPages, DWORD, dwReserved, LPFNADDPROPSHEETPAGE, lpfn, LPARAM, lparam) \ - ICOM_METHOD (HRESULT, SaveViewState) \ - ICOM_METHOD2(HRESULT, SelectItem, LPCITEMIDLIST, pidlItem, UINT, uFlags) \ - ICOM_METHOD3(HRESULT, GetItemObject, UINT, uItem, REFIID, riid, LPVOID*, ppv) \ - ICOM_METHOD1(HRESULT, EditItem, LPCITEMIDLIST, pidlItem) -#define IShellView_IMETHODS \ - IOleWindow_IMETHODS \ - IShellView_METHODS -ICOM_DEFINE(IShellView,IOleWindow) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IShellView_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IShellView_AddRef(p) ICOM_CALL(AddRef,p) -#define IShellView_Release(p) ICOM_CALL(Release,p) -/*** IShellView methods ***/ -#define IShellView_GetWindow(p,a) ICOM_CALL1(GetWindow,p,a) -#define IShellView_ContextSensitiveHelp(p,a) ICOM_CALL1(ContextSensitiveHelp,p,a) -#define IShellView_TranslateAccelerator(p,a) ICOM_CALL1(TranslateAccelerator,p,a) -#define IShellView_EnableModeless(p,a) ICOM_CALL1(EnableModeless,p,a) -#define IShellView_UIActivate(p,a) ICOM_CALL1(UIActivate,p,a) -#define IShellView_Refresh(p) ICOM_CALL(Refresh,p) -#define IShellView_CreateViewWindow(p,a,b,c,d,e) ICOM_CALL5(CreateViewWindow,p,a,b,c,d,e) -#define IShellView_DestroyViewWindow(p) ICOM_CALL(DestroyViewWindow,p) -#define IShellView_GetCurrentInfo(p,a) ICOM_CALL1(GetCurrentInfo,p,a) -#define IShellView_AddPropertySheetPages(p,a,b,c) ICOM_CALL3(AddPropertySheetPages,p,a,b,c) -#define IShellView_SaveViewState(p) ICOM_CALL(SaveViewState,p) -#define IShellView_SelectItem(p,a,b) ICOM_CALL2(SelectItem,p,a,b) -#define IShellView_GetItemObject(p,a,b,c) ICOM_CALL3(GetItemObject,p,a,b,c) -/* WINE specific */ -#define IShellView_EditItem(p,a) ICOM_CALL1(EditItem,p,a) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_SHELLVIEW_H */ diff --git a/reactos/include/ole32/obj_storage.h b/reactos/include/ole32/obj_storage.h deleted file mode 100644 index 2449d79a895..00000000000 --- a/reactos/include/ole32/obj_storage.h +++ /dev/null @@ -1,650 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to structured data storage. - */ - -#ifndef __WINE_WINE_OBJ_STORAGE_H -#define __WINE_WINE_OBJ_STORAGE_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/***************************************************************************** - * Predeclare the structures - */ -typedef enum tagLOCKTYPE -{ - LOCK_WRITE = 1, - LOCK_EXCLUSIVE = 2, - LOCK_ONLYONCE = 4 -} LOCKTYPE; - -typedef struct tagStorageLayout -{ - DWORD LayoutType; - OLECHAR16* pwcsElementName; - LARGE_INTEGER cOffset; - LARGE_INTEGER cBytes; -} StorageLayout; - -typedef struct tagSTATSTG { - LPOLESTR pwcsName; - DWORD type; - ULARGE_INTEGER cbSize; - FILETIME mtime; - FILETIME ctime; - FILETIME atime; - DWORD grfMode; - DWORD grfLocksSupported; - CLSID clsid; - DWORD grfStateBits; - DWORD reserved; -} STATSTG; - -typedef struct tagSTATSTG16 { - LPOLESTR16 pwcsName; - DWORD type; - ULARGE_INTEGER cbSize; - FILETIME mtime; - FILETIME ctime; - FILETIME atime; - DWORD grfMode; - DWORD grfLocksSupported; - CLSID clsid; - DWORD grfStateBits; - DWORD reserved; -} STATSTG16; - -typedef LPOLESTR16 *SNB16; -typedef LPOLESTR *SNB; - - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_OLEGUID(IID_IEnumSTATSTG, 0x0000000dL, 0, 0); -typedef struct IEnumSTATSTG IEnumSTATSTG,*LPENUMSTATSTG; - -DEFINE_GUID (IID_IFillLockBytes, 0x99caf010L, 0x415e, 0x11cf, 0x88, 0x14, 0x00, 0xaa, 0x00, 0xb5, 0x69, 0xf5); -typedef struct IFillLockBytes IFillLockBytes,*LPFILLLOCKBYTES; - -DEFINE_GUID (IID_ILayoutStorage, 0x0e6d4d90L, 0x6738, 0x11cf, 0x96, 0x08, 0x00, 0xaa, 0x00, 0x68, 0x0d, 0xb4); -typedef struct ILayoutStorage ILayoutStorage,*LPLAYOUTSTORAGE; - -DEFINE_OLEGUID(IID_ILockBytes, 0x0000000aL, 0, 0); -typedef struct ILockBytes ILockBytes,*LPLOCKBYTES; - -DEFINE_OLEGUID(IID_IPersist, 0x0000010cL, 0, 0); -typedef struct IPersist IPersist,*LPPERSIST; - -DEFINE_OLEGUID(IID_IPersistFile, 0x0000010bL, 0, 0); -typedef struct IPersistFile IPersistFile,*LPPERSISTFILE; - -DEFINE_OLEGUID(IID_IPersistStorage, 0x0000010aL, 0, 0); -typedef struct IPersistStorage IPersistStorage,*LPPERSISTSTORAGE; - -DEFINE_OLEGUID(IID_IPersistStream, 0x00000109L, 0, 0); -typedef struct IPersistStream IPersistStream,*LPPERSISTSTREAM; - -DEFINE_GUID (IID_IProgressNotify, 0xa9d758a0L, 0x4617, 0x11cf, 0x95, 0xfc, 0x00, 0xaa, 0x00, 0x68, 0x0d, 0xb4); -typedef struct IProgressNotify IProgressNotify,*LPPROGRESSNOTIFY; - -DEFINE_OLEGUID(IID_IRootStorage, 0x00000012L, 0, 0); -typedef struct IRootStorage IRootStorage,*LPROOTSTORAGE; - -DEFINE_GUID (IID_ISequentialStream, 0x0c733a30L, 0x2a1c, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d); -typedef struct ISequentialStream ISequentialStream,*LPSEQUENTIALSTREAM; - -DEFINE_OLEGUID(IID_IStorage, 0x0000000bL, 0, 0); -typedef struct IStorage16 IStorage16,*LPSTORAGE16; -typedef struct IStorage IStorage,*LPSTORAGE; - -DEFINE_OLEGUID(IID_IStream, 0x0000000cL, 0, 0); -typedef struct IStream16 IStream16,*LPSTREAM16; -typedef struct IStream IStream,*LPSTREAM; - - -/***************************************************************************** - * STGM enumeration - * - * See IStorage and IStream - */ -#define STGM_DIRECT 0x00000000 -#define STGM_TRANSACTED 0x00010000 -#define STGM_SIMPLE 0x08000000 -#define STGM_READ 0x00000000 -#define STGM_WRITE 0x00000001 -#define STGM_READWRITE 0x00000002 -#define STGM_SHARE_DENY_NONE 0x00000040 -#define STGM_SHARE_DENY_READ 0x00000030 -#define STGM_SHARE_DENY_WRITE 0x00000020 -#define STGM_SHARE_EXCLUSIVE 0x00000010 -#define STGM_PRIORITY 0x00040000 -#define STGM_DELETEONRELEASE 0x04000000 -#define STGM_CREATE 0x00001000 -#define STGM_CONVERT 0x00020000 -#define STGM_FAILIFTHERE 0x00000000 -#define STGM_NOSCRATCH 0x00100000 -#define STGM_NOSNAPSHOT 0x00200000 - -/***************************************************************************** - * STGTY enumeration - * - * See IStorage - */ -#define STGTY_STORAGE 1 -#define STGTY_STREAM 2 -#define STGTY_LOCKBYTES 3 -#define STGTY_PROPERTY 4 - -/***************************************************************************** - * STATFLAG enumeration - * - * See IStorage and IStream - */ -#define STATFLAG_DEFAULT 0 -#define STATFLAG_NONAME 1 - -/***************************************************************************** - * STREAM_SEEK enumeration - * - * See IStream - */ -#define STREAM_SEEK_SET 0 -#define STREAM_SEEK_CUR 1 -#define STREAM_SEEK_END 2 - -/***************************************************************************** - * IEnumSTATSTG interface - */ -#define ICOM_INTERFACE IEnumSTATSTG -#define IEnumSTATSTG_METHODS \ - ICOM_METHOD3(HRESULT,Next, ULONG,celt, STATSTG*,rgelt, ULONG*,pceltFethed) \ - ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone, IEnumSTATSTG**,ppenum) -#define IEnumSTATSTG_IMETHODS \ - IUnknown_IMETHODS \ - IEnumSTATSTG_METHODS -ICOM_DEFINE(IEnumSTATSTG,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IEnumSTATSTG_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IEnumSTATSTG_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumSTATSTG_Release(p) ICOM_CALL (Release,p) -/*** IEnumSTATSTG methods ***/ -#define IEnumSTATSTG_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) -#define IEnumSTATSTG_Skip(p,a) ICOM_CALL1(Skip,p,a) -#define IEnumSTATSTG_Reset(p) ICOM_CALL(Reset,p) -#define IEnumSTATSTG_Clone(p,a) ICOM_CALL1(Clone,p,a) - - -/***************************************************************************** - * IFillLockBytes interface - */ -#define ICOM_INTERFACE IFillLockBytes -#define IFillLockBytes_METHODS \ - ICOM_METHOD3(HRESULT,FillAppend, const void*,pv, ULONG,cb, ULONG*,pcbWritten) \ - ICOM_METHOD4(HRESULT,FillAt, ULARGE_INTEGER,ulOffset, const void*,pv, ULONG,cb, ULONG*,pcbWritten) \ - ICOM_METHOD1(HRESULT,SetFillSize, ULARGE_INTEGER,ulSize) \ - ICOM_METHOD1(HRESULT,Terminate, BOOL,bCanceled) -#define IFillLockBytes_IMETHODS \ - IUnknown_IMETHODS \ - IFillLockBytes_METHODS -ICOM_DEFINE(IFillLockBytes,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IFillLockBytes_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IFillLockBytes_AddRef(p) ICOM_CALL (AddRef,p) -#define IFillLockBytes_Release(p) ICOM_CALL (Release,p) -/*** IFillLockBytes methods ***/ -#define IFillLockBytes_FillAppend(p,a,b,c) ICOM_CALL3(FillAppend,p,a,b,c) -#define IFillLockBytes_FillAt(p,a,b,c,d) ICOM_CALL4(FillAt,p,a,b,c,d) -#define IFillLockBytes_SetFillSize(p,a) ICOM_CALL1(SetFillSize,p,a) -#define IFillLockBytes_Terminate(p,a) ICOM_CALL1(Terminate,p,a) - - -/***************************************************************************** - * ILayoutStorage interface - */ -#define ICOM_INTERFACE ILayoutStorage -#define ILayoutStorage_METHODS \ - ICOM_METHOD2(HRESULT,LayoutScript, DWORD,nEntries, DWORD,glfInterleavedFlag) \ - ICOM_METHOD (HRESULT,BeginMonitor) \ - ICOM_METHOD (HRESULT,EndMonitor) \ - ICOM_METHOD1(HRESULT,ReLayoutDocfile, OLECHAR16*,pwcsNewDfName) \ - ICOM_METHOD1(HRESULT,ReLayoutDocfileOnILockBytes, ILockBytes*,pILockBytes) -#define ILayoutStorage_IMETHODS \ - IUnknown_IMETHODS \ - ILayoutStorage_METHODS -ICOM_DEFINE(ILayoutStorage,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ILayoutStorage_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ILayoutStorage_AddRef(p) ICOM_CALL (AddRef,p) -#define ILayoutStorage_Release(p) ICOM_CALL (Release,p) -/*** ILayoutStorage methods ***/ -#define ILayoutStorage_LayoutScript(p,a,b) ICOM_CALL2(LayoutScript,p,a,b) -#define ILayoutStorage_BeginMonitor(p) ICOM_CALL (BeginMonitor,p) -#define ILayoutStorage_EndMonitor(p) ICOM_CALL (EndMonitor,p) -#define ILayoutStorage_ReLayoutDocfile(p,a) ICOM_CALL1(ReLayoutDocfile,p,a) -#define ILayoutStorage_ReLayoutDocfileOnILockBytes(p,a) ICOM_CALL1(ReLayoutDocfileOnILockBytes,p,a) - - -/***************************************************************************** - * ILockBytes interface - */ -#define ICOM_INTERFACE ILockBytes -#define ILockBytes_METHODS \ - ICOM_METHOD4(HRESULT,ReadAt, ULARGE_INTEGER,ulOffset, void*,pv, ULONG,cb, ULONG*,pcbRead) \ - ICOM_METHOD4(HRESULT,WriteAt, ULARGE_INTEGER,ulOffset, const void*,pv, ULONG,cb, ULONG*,pcbWritten) \ - ICOM_METHOD (HRESULT,Flush) \ - ICOM_METHOD1(HRESULT,SetSize, ULARGE_INTEGER,cb) \ - ICOM_METHOD3(HRESULT,LockRegion, ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType) \ - ICOM_METHOD3(HRESULT,UnlockRegion, ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType) \ - ICOM_METHOD2(HRESULT,Stat, STATSTG*,pstatstg, DWORD,grfStatFlag) -#define ILockBytes_IMETHODS \ - IUnknown_IMETHODS \ - ILockBytes_METHODS -ICOM_DEFINE(ILockBytes,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ILockBytes_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ILockBytes_AddRef(p) ICOM_CALL (AddRef,p) -#define ILockBytes_Release(p) ICOM_CALL (Release,p) -/*** ILockBytes methods ***/ -#define ILockBytes_ReadAt(p,a,b,c,d) ICOM_CALL4(ReadAt,p,a,b,c,d) -#define ILockBytes_WriteAt(p,a,b,c,d) ICOM_CALL4(WriteAt,p,a,b,c,d) -#define ILockBytes_Flush(p) ICOM_CALL (Flush,p) -#define ILockBytes_SetSize(p,a) ICOM_CALL1(SetSize,p,a) -#define ILockBytes_LockRegion(p,a,b,c) ICOM_CALL3(LockRegion,p,a,b,c) -#define ILockBytes_UnlockRegion(p,a,b,c) ICOM_CALL3(UnlockRegion,p,a,b,c) -#define ILockBytes_Stat(p,a,b) ICOM_CALL2(Stat,p,a,b) - - -/***************************************************************************** - * IPersist interface - */ -#define ICOM_INTERFACE IPersist -#define IPersist_METHODS \ - ICOM_METHOD1(HRESULT,GetClassID, CLSID*,pClassID) -#define IPersist_IMETHODS \ - IUnknown_IMETHODS \ - IPersist_METHODS -ICOM_DEFINE(IPersist,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPersist_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPersist_AddRef(p) ICOM_CALL (AddRef,p) -#define IPersist_Release(p) ICOM_CALL (Release,p) -/*** IPersist methods ***/ -#define IPersist_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a) - - -/***************************************************************************** - * IPersistFile interface - */ -#define ICOM_INTERFACE IPersistFile -#define IPersistFile_METHODS \ - ICOM_METHOD (HRESULT,IsDirty) \ - ICOM_METHOD2 (HRESULT,Load, LPCOLESTR,pszFileName, DWORD,dwMode) \ - ICOM_METHOD2 (HRESULT,Save, LPCOLESTR,pszFileName, BOOL,fRemember) \ - ICOM_METHOD1 (HRESULT,SaveCompleted, LPCOLESTR,pszFileName) \ - ICOM_METHOD1(HRESULT,GetCurFile, LPOLESTR*,ppszFileName) -#define IPersistFile_IMETHODS \ - IPersist_IMETHODS \ - IPersistFile_METHODS -ICOM_DEFINE(IPersistFile,IPersist) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPersistFile_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPersistFile_AddRef(p) ICOM_CALL (AddRef,p) -#define IPersistFile_Release(p) ICOM_CALL (Release,p) -/*** IPersist methods ***/ -#define IPersistFile_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a) -/*** IPersistFile methods ***/ -#define IPersistFile_IsDirty(p) ICOM_CALL(IsDirty,p) -#define IPersistFile_Load(p,a,b) ICOM_CALL2(Load,p,a,b) -#define IPersistFile_Save(p,a,b) ICOM_CALL2(Save,p,a,b) -#define IPersistFile_SaveCompleted(p,a) ICOM_CALL1(SaveCompleted,p,a) -#define IPersistFile_GetCurFile(p,a) ICOM_CALL1(GetCurFile,p,a) - - -/***************************************************************************** - * IPersistStorage interface - */ -#define ICOM_INTERFACE IPersistStorage -#define IPersistStorage_METHODS \ - ICOM_METHOD (HRESULT,IsDirty) \ - ICOM_METHOD1(HRESULT,InitNew, IStorage*,pStg) \ - ICOM_METHOD1(HRESULT,Load, IStorage*,pStg) \ - ICOM_METHOD2(HRESULT,Save, IStorage*,pStg, BOOL,fSameAsLoad) \ - ICOM_METHOD1(HRESULT,SaveCompleted, IStorage*,pStgNew) \ - ICOM_METHOD (HRESULT,HandsOffStorage) -#define IPersistStorage_IMETHODS \ - IPersist_IMETHODS \ - IPersistStorage_METHODS -ICOM_DEFINE(IPersistStorage,IPersist) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPersistStorage_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPersistStorage_AddRef(p) ICOM_CALL (AddRef,p) -#define IPersistStorage_Release(p) ICOM_CALL (Release,p) -/*** IPersist methods ***/ -#define IPersistStorage_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a) -/*** IPersistStorage methods ***/ -#define IPersistStorage_IsDirty(p) ICOM_CALL (IsDirty,p) -#define IPersistStorage_InitNew(p,a) ICOM_CALL1(InitNew,p,a) -#define IPersistStorage_Load(p,a) ICOM_CALL1(Load,p,a) -#define IPersistStorage_Save(p,a,b) ICOM_CALL2(Save,p,a,b) -#define IPersistStorage_SaveCompleted(p,a) ICOM_CALL1(SaveCompleted,p,a) -#define IPersistStorage_HandsOffStorage(p) ICOM_CALL (HandsOffStorage,p) - - -/***************************************************************************** - * IPersistStream interface - */ -#define ICOM_INTERFACE IPersistStream -#define IPersistStream_METHODS \ - ICOM_METHOD (HRESULT,IsDirty) \ - ICOM_METHOD1(HRESULT,Load, IStream*,pStm) \ - ICOM_METHOD2(HRESULT,Save, IStream*,pStm, BOOL,fClearDirty) \ - ICOM_METHOD1(HRESULT,GetSizeMax, ULARGE_INTEGER*,pcbSize) -#define IPersistStream_IMETHODS \ - IPersist_IMETHODS \ - IPersistStream_METHODS -ICOM_DEFINE(IPersistStream,IPersist) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IPersistStream_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IPersistStream_AddRef(p) ICOM_CALL (AddRef,p) -#define IPersistStream_Release(p) ICOM_CALL (Release,p) -/*** IPersist methods ***/ -#define IPersistStream_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a) -/*** IPersistStream methods ***/ -#define IPersistStream_IsDirty(p) ICOM_CALL (IsDirty,p) -#define IPersistStream_Load(p,a) ICOM_CALL1(Load,p,a) -#define IPersistStream_Save(p,a,b) ICOM_CALL2(Save,p,a,b) -#define IPersistStream_GetSizeMax(p,a) ICOM_CALL1(GetSizeMax,p,a) - - -/***************************************************************************** - * IProgressNotify interface - */ -#define ICOM_INTERFACE IProgressNotify -#define IProgressNotify_METHODS \ - ICOM_METHOD4(HRESULT,OnProgress, DWORD,dwProgressCurrent, DWORD,dwProgressMaximum, BOOL,fAccurate, BOOL,fOwner) -#define IProgressNotify_IMETHODS \ - IUnknown_IMETHODS \ - IProgressNotify_METHODS -ICOM_DEFINE(IProgressNotify,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IProgressNotify_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IProgressNotify_AddRef(p) ICOM_CALL (AddRef,p) -#define IProgressNotify_Release(p) ICOM_CALL (Release,p) -/*** IProgressNotify methods ***/ -#define IProgressNotify_OnProgress(p,a,b,c,d) ICOM_CALL4(OnProgress,p,a,b,c,d) - - -/***************************************************************************** - * IRootStorage interface - */ -#define ICOM_INTERFACE IRootStorage -#define IRootStorage_METHODS \ - ICOM_METHOD1(HRESULT,SwitchToFile, LPOLESTR,pszFile) -#define IRootStorage_IMETHODS \ - IUnknown_IMETHODS \ - IRootStorage_METHODS -ICOM_DEFINE(IRootStorage,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IRootStorage_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IRootStorage_AddRef(p) ICOM_CALL (AddRef,p) -#define IRootStorage_Release(p) ICOM_CALL (Release,p) -/*** IRootStorage methods ***/ -#define IRootStorage_SwitchToFile(p,a) ICOM_CALLSwitchToFile(,p,a) - - -/***************************************************************************** - * ISequentialStream interface - */ -#define ICOM_INTERFACE ISequentialStream -#define ISequentialStream_METHODS \ - ICOM_METHOD3(HRESULT,Read, void*,pv, ULONG,cb, ULONG*,pcbRead) \ - ICOM_METHOD3(HRESULT,Write, const void*,pv, ULONG,cb, ULONG*,pcbWritten) -#define ISequentialStream_IMETHODS \ - IUnknown_IMETHODS \ - ISequentialStream_METHODS -ICOM_DEFINE(ISequentialStream,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define ISequentialStream_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define ISequentialStream_AddRef(p) ICOM_CALL (AddRef,p) -#define ISequentialStream_Release(p) ICOM_CALL (Release,p) -/*** ISequentialStream methods ***/ -#define ISequentialStream_Read(p,a,b,c) ICOM_CALL3(Read,p,a,b,c) -#define ISequentialStream_Write(p,a,b,c) ICOM_CALL3(Write,p,a,b,c) - - -/***************************************************************************** - * IStorage interface - */ -#define ICOM_INTERFACE IStorage16 -#define IStorage16_METHODS \ - ICOM_METHOD5(HRESULT,CreateStream, LPCOLESTR16,pwcsName, DWORD,grfMode, DWORD,reserved1, DWORD,reserved2, IStream16**,ppstm) \ - ICOM_METHOD5(HRESULT,OpenStream, LPCOLESTR16,pwcsName, void*,reserved1, DWORD,grfMode, DWORD,reserved2, IStream16**,ppstm) \ - ICOM_METHOD5(HRESULT,CreateStorage, LPCOLESTR16,pwcsName, DWORD,grfMode, DWORD,dwStgFmt, DWORD,reserved2, IStorage16**,ppstg) \ - ICOM_METHOD6(HRESULT,OpenStorage, LPCOLESTR16,pwcsName, IStorage16*,pstgPriority, DWORD,grfMode, SNB16,snb16Exclude, DWORD,reserved, IStorage16**,ppstg) \ - ICOM_METHOD4(HRESULT,CopyTo, DWORD,ciidExclude, const IID*,rgiidExclude, SNB16,snb16Exclude, IStorage16*,pstgDest) \ - ICOM_METHOD4(HRESULT,MoveElementTo, LPCOLESTR16,pwcsName, IStorage16*,pstgDest, LPCOLESTR16,pwcsNewName, DWORD,grfFlags) \ - ICOM_METHOD1(HRESULT,Commit, DWORD,grfCommitFlags) \ - ICOM_METHOD (HRESULT,Revert) \ - ICOM_METHOD4(HRESULT,EnumElements, DWORD,reserved1, void*,reserved2, DWORD,reserved3, IEnumSTATSTG**,ppenum) \ - ICOM_METHOD1(HRESULT,DestroyElement, LPCOLESTR16,pwcsName) \ - ICOM_METHOD2(HRESULT,RenameElement, LPCOLESTR16,pwcsOldName, LPOLESTR16,pwcsNewName) \ - ICOM_METHOD4(HRESULT,SetElementTimes,LPCOLESTR16,pwcsName, const FILETIME*,pctime, const FILETIME*,patime, const FILETIME*,pmtime) \ - ICOM_METHOD1(HRESULT,SetClass, REFCLSID,clsid) \ - ICOM_METHOD2(HRESULT,SetStateBits, DWORD,grfStateBits, DWORD,grfMask) \ - ICOM_METHOD2(HRESULT,Stat, STATSTG*,pstatstg, DWORD,grfStatFlag) -#define IStorage16_IMETHODS \ - IUnknown_IMETHODS \ - IStorage16_METHODS -ICOM_DEFINE(IStorage16,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IStorage16_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IStorage16_AddRef(p) ICOM_CALL (AddRef,p) -#define IStorage16_Release(p) ICOM_CALL (Release,p) -/*** IStorage16 methods ***/ -#define IStorage16_CreateStream(p,a,b,c,d,e) ICOM_CALL5(CreateStream,p,a,b,c,d,e) -#define IStorage16_OpenStream(p,a,b,c,d,e) ICOM_CALL5(OpenStream,p,a,b,c,d,e) -#define IStorage16_CreateStorage(p,a,b,c,d,e) ICOM_CALL5(CreateStorage,p,a,b,c,d,e) -#define IStorage16_OpenStorage(p,a,b,c,d,e,f) ICOM_CALL6(OpenStorage,p,a,b,c,d,e,f) -#define IStorage16_CopyTo(p,a,b,c,d) ICOM_CALL4(CopyTo,p,a,b,c,d) -#define IStorage16_MoveElementTo(p,a,b,c,d) ICOM_CALL4(MoveElementTo,p,a,b,c,d) -#define IStorage16_Commit(p,a) ICOM_CALL1(Commit,p,a) -#define IStorage16_Revert(p) ICOM_CALL (Revert,p) -#define IStorage16_EnumElements(p,a,b,c,d) ICOM_CALL4(EnumElements,p,a,b,c,d) -#define IStorage16_DestroyElement(p,a) ICOM_CALL1(DestroyElement,p,a) -#define IStorage16_RenameElement(p,a,b) ICOM_CALL2(RenameElement,p,a,b) -#define IStorage16_SetElementTimes(p,a,b,c,d) ICOM_CALL4(SetElementTimes,p,a,b,c,d) -#define IStorage16_SetClass(p,a) ICOM_CALL1(SetClass,p,a) -#define IStorage16_SetStateBits(p,a,b) ICOM_CALL2(SetStateBits,p,a,b) -#define IStorage16_Stat(p,a,b) ICOM_CALL2(Stat,p,a,b) - - -#define ICOM_INTERFACE IStorage -#define IStorage_METHODS \ - ICOM_METHOD5(HRESULT,CreateStream, LPCOLESTR,pwcsName, DWORD,grfMode, DWORD,reserved1, DWORD,reserved2, IStream**,ppstm) \ - ICOM_METHOD5(HRESULT,OpenStream, LPCOLESTR,pwcsName, void*,reserved1, DWORD,grfMode, DWORD,reserved2, IStream**,ppstm) \ - ICOM_METHOD5(HRESULT,CreateStorage, LPCOLESTR,pwcsName, DWORD,grfMode, DWORD,dwStgFmt, DWORD,reserved2, IStorage**,ppstg) \ - ICOM_METHOD6(HRESULT,OpenStorage, LPCOLESTR,pwcsName, IStorage*,pstgPriority, DWORD,grfMode, SNB,snb16Exclude, DWORD,reserved, IStorage**,ppstg) \ - ICOM_METHOD4(HRESULT,CopyTo, DWORD,ciidExclude, const IID*,rgiidExclude, SNB,snb16Exclude, IStorage*,pstgDest) \ - ICOM_METHOD4(HRESULT,MoveElementTo, LPCOLESTR,pwcsName, IStorage*,pstgDest, LPCOLESTR,pwcsNewName, DWORD,grfFlags) \ - ICOM_METHOD1(HRESULT,Commit, DWORD,grfCommitFlags) \ - ICOM_METHOD (HRESULT,Revert) \ - ICOM_METHOD4(HRESULT,EnumElements, DWORD,reserved1, void*,reserved2, DWORD,reserved3, IEnumSTATSTG**,ppenum) \ - ICOM_METHOD1(HRESULT,DestroyElement, LPCOLESTR,pwcsName) \ - ICOM_METHOD2(HRESULT,RenameElement, LPCOLESTR,pwcsOldName, LPCOLESTR,pwcsNewName) \ - ICOM_METHOD4(HRESULT,SetElementTimes,LPCOLESTR,pwcsName, const FILETIME*,pctime, const FILETIME*,patime, const FILETIME*,pmtime) \ - ICOM_METHOD1(HRESULT,SetClass, REFCLSID,clsid) \ - ICOM_METHOD2(HRESULT,SetStateBits, DWORD,grfStateBits, DWORD,grfMask) \ - ICOM_METHOD2(HRESULT,Stat, STATSTG*,pstatstg, DWORD,grfStatFlag) -#define IStorage_IMETHODS \ - IUnknown_IMETHODS \ - IStorage_METHODS -ICOM_DEFINE(IStorage,IUnknown) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IStorage_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IStorage_AddRef(p) ICOM_CALL (AddRef,p) -#define IStorage_Release(p) ICOM_CALL (Release,p) -/*** IStorage methods ***/ -#define IStorage_CreateStream(p,a,b,c,d,e) ICOM_CALL5(CreateStream,p,a,b,c,d,e) -#define IStorage_OpenStream(p,a,b,c,d,e) ICOM_CALL5(OpenStream,p,a,b,c,d,e) -#define IStorage_CreateStorage(p,a,b,c,d,e) ICOM_CALL5(CreateStorage,p,a,b,c,d,e) -#define IStorage_OpenStorage(p,a,b,c,d,e,f) ICOM_CALL6(OpenStorage,p,a,b,c,d,e,f) -#define IStorage_CopyTo(p,a,b,c,d) ICOM_CALL4(CopyTo,p,a,b,c,d) -#define IStorage_MoveElementTo(p,a,b,c,d) ICOM_CALL4(MoveElementTo,p,a,b,c,d) -#define IStorage_Commit(p,a) ICOM_CALL1(Commit,p,a) -#define IStorage_Revert(p) ICOM_CALL (Revert,p) -#define IStorage_EnumElements(p,a,b,c,d) ICOM_CALL4(EnumElements,p,a,b,c,d) -#define IStorage_DestroyElement(p,a) ICOM_CALL1(DestroyElement,p,a) -#define IStorage_RenameElement(p,a,b) ICOM_CALL2(RenameElement,p,a,b) -#define IStorage_SetElementTimes(p,a,b,c,d) ICOM_CALL4(SetElementTimes,p,a,b,c,d) -#define IStorage_SetClass(p,a) ICOM_CALL1(SetClass,p,a) -#define IStorage_SetStateBits(p,a,b) ICOM_CALL2(SetStateBits,p,a,b) -#define IStorage_Stat(p,a,b) ICOM_CALL2(Stat,p,a,b) - - -/***************************************************************************** - * IStream interface - */ -#define ICOM_INTERFACE IStream16 -#define IStream16_METHODS \ - ICOM_METHOD3(HRESULT,Seek, LARGE_INTEGER,dlibMove, DWORD,dwOrigin, ULARGE_INTEGER*,plibNewPosition) \ - ICOM_METHOD1(HRESULT,SetSize, ULARGE_INTEGER,libNewSize) \ - ICOM_METHOD4(HRESULT,CopyTo, IStream16*,pstm, ULARGE_INTEGER,cb, ULARGE_INTEGER*,pcbRead, ULARGE_INTEGER*,pcbWritten) \ - ICOM_METHOD1(HRESULT,Commit, DWORD,grfCommitFlags) \ - ICOM_METHOD (HRESULT,Revert) \ - ICOM_METHOD3(HRESULT,LockRegion, ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType) \ - ICOM_METHOD3(HRESULT,UnlockRegion,ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType) \ - ICOM_METHOD2(HRESULT,Stat, STATSTG*,pstatstg, DWORD,grfStatFlag) \ - ICOM_METHOD1(HRESULT,Clone, IStream16**,ppstm) -#define IStream16_IMETHODS \ - ISequentialStream_IMETHODS \ - IStream16_METHODS -ICOM_DEFINE(IStream16,ISequentialStream) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IStream16_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IStream16_AddRef(p) ICOM_CALL (AddRef,p) -#define IStream16_Release(p) ICOM_CALL (Release,p) -/*** ISequentialStream methods ***/ -#define IStream16_Read(p,a,b,c) ICOM_CALL3(Read,p,a,b,c) -#define IStream16_Write(p,a,b,c) ICOM_CALL3(Write,p,a,b,c) -/*** IStream16 methods ***/ -#define IStream16_Seek(p) ICOM_CALL3(Seek,p) -#define IStream16_SetSize(p,a,b) ICOM_CALL1(SetSize,p,a,b) -#define IStream16_CopyTo(pa,b,c,d) ICOM_CALL4(CopyTo,pa,b,c,d) -#define IStream16_Commit(p,a) ICOM_CALL1(Commit,p,a) -#define IStream16_Revert(p) ICOM_CALL (Revert,p) -#define IStream16_LockRegion(pa,b,c) ICOM_CALL3(LockRegion,pa,b,c) -#define IStream16_UnlockRegion(p,a,b,c) ICOM_CALL3(UnlockRegion,p,a,b,c) -#define IStream16_Stat(p,a,b) ICOM_CALL2(Stat,p,a,b) -#define IStream16_Clone(p,a) ICOM_CALL1(Clone,p,a) - - -#define ICOM_INTERFACE IStream -#define IStream_METHODS \ - ICOM_METHOD3(HRESULT,Seek, LARGE_INTEGER,dlibMove, DWORD,dwOrigin, ULARGE_INTEGER*,plibNewPosition) \ - ICOM_METHOD1(HRESULT,SetSize, ULARGE_INTEGER,libNewSize) \ - ICOM_METHOD4(HRESULT,CopyTo, IStream*,pstm, ULARGE_INTEGER,cb, ULARGE_INTEGER*,pcbRead, ULARGE_INTEGER*,pcbWritten) \ - ICOM_METHOD1(HRESULT,Commit, DWORD,grfCommitFlags) \ - ICOM_METHOD (HRESULT,Revert) \ - ICOM_METHOD3(HRESULT,LockRegion, ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType) \ - ICOM_METHOD3(HRESULT,UnlockRegion,ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType) \ - ICOM_METHOD2(HRESULT,Stat, STATSTG*,pstatstg, DWORD,grfStatFlag) \ - ICOM_METHOD1(HRESULT,Clone, IStream**,ppstm) -#define IStream_IMETHODS \ - ISequentialStream_IMETHODS \ - IStream_METHODS -ICOM_DEFINE(IStream,ISequentialStream) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IStream_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IStream_AddRef(p) ICOM_CALL (AddRef,p) -#define IStream_Release(p) ICOM_CALL (Release,p) -/*** ISequentialStream methods ***/ -#define IStream_Read(p,a,b,c) ICOM_CALL3(Read,p,a,b,c) -#define IStream_Write(p,a,b,c) ICOM_CALL3(Write,p,a,b,c) -/*** IStream methods ***/ -#define IStream_Seek(p,a,b,c) ICOM_CALL3(Seek,p,a,b,c) -#define IStream_SetSize(p,a) ICOM_CALL1(SetSize,p,a) -#define IStream_CopyTo(p,a,b,c,d) ICOM_CALL4(CopyTo,p,a,b,c,d) -#define IStream_Commit(p,a) ICOM_CALL1(Commit,p,a) -#define IStream_Revert(p) ICOM_CALL (Revert,p) -#define IStream_LockRegion(p,a,b,c) ICOM_CALL3(LockRegion,p,a,b,c) -#define IStream_UnlockRegion(p,a,b,c) ICOM_CALL3(UnlockRegion,p,a,b,c) -#define IStream_Stat(p,a,b) ICOM_CALL2(Stat,p,a,b) -#define IStream_Clone(p,a) ICOM_CALL1(Clone,p,a) - - -/***************************************************************************** - * StgXXX API - */ -/* FIXME: many functions are missing */ -HRESULT WINAPI StgCreateDocFile16(LPCOLESTR16 pwcsName,DWORD grfMode,DWORD reserved,IStorage16 **ppstgOpen); -HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName,DWORD grfMode,DWORD reserved,IStorage **ppstgOpen); - -HRESULT WINAPI StgIsStorageFile16(LPCOLESTR16 fn); -HRESULT WINAPI StgIsStorageFile(LPCOLESTR fn); -HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt); - -HRESULT WINAPI StgOpenStorage16(const OLECHAR16* pwcsName,IStorage16* pstgPriority,DWORD grfMode,SNB16 snbExclude,DWORD reserved,IStorage16**ppstgOpen); -HRESULT WINAPI StgOpenStorage(const OLECHAR* pwcsName,IStorage* pstgPriority,DWORD grfMode,SNB snbExclude,DWORD reserved,IStorage**ppstgOpen); - -HRESULT WINAPI WriteClassStg(IStorage* pStg, REFCLSID rclsid); -HRESULT WINAPI ReadClassStg(IStorage *pstg,CLSID *pclsid); - -HRESULT WINAPI WriteClassStm(IStream *pStm,REFCLSID rclsid); -HRESULT WINAPI ReadClassStm(IStream *pStm,REFCLSID rclsid); - -HRESULT WINAPI StgCreateDocfileOnILockBytes(ILockBytes *plkbyt,DWORD grfMode, DWORD reserved, IStorage** ppstgOpen); -HRESULT WINAPI StgOpenStorageOnILockBytes(ILockBytes *plkbyt, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen); - -/***************************************************************************** - * Other storage API - */ - -/* FIXME: not implemented */ -BOOL WINAPI CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime, FILETIME* lpFileTime); - -/* FIXME: not implemented */ -BOOL WINAPI CoFileTimeToDosDateTime(FILETIME* lpFileTime, WORD* lpDosDate, WORD* lpDosTime); - -HRESULT WINAPI GetHGlobalFromILockBytes(ILockBytes* plkbyt, HGLOBAL* phglobal); - -HRESULT WINAPI OleSaveToStream(IPersistStream *pPStm,IStream *pStm); - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_STORAGE_H */ diff --git a/reactos/include/ole32/obj_webbrowser.h b/reactos/include/ole32/obj_webbrowser.h deleted file mode 100644 index fb9f3d6ce8d..00000000000 --- a/reactos/include/ole32/obj_webbrowser.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Defines the COM interfaces and APIs related to the IE Web browser control - * - * 2001 John R. Sheets (for CodeWeavers) - */ - -#ifndef __WINE_WINE_OBJ_WEBBROWSER_H -#define __WINE_WINE_OBJ_WEBBROWSER_H - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - - -/***************************************************************************** - * Predeclare the interfaces and class IDs - */ -DEFINE_GUID(IID_IWebBrowser, 0xeab22ac1, 0x30c1, 0x11cf, 0xa7, 0xeb, 0x00, 0x00, 0xc0, 0x5b, 0xae, 0x0b); -typedef struct IWebBrowser IWebBrowser, *LPWEBBROWSER; - -DEFINE_GUID(CLSID_WebBrowser, 0x8856f961, 0x340a, 0x11d0, 0xa9, 0x6b, 0x00, 0xc0, 0x4f, 0xd7, 0x05, 0xa2); - -/***************************************************************************** - * IWebBrowser interface - */ -#define ICOM_INTERFACE IWebBrowser -#define IWebBrowser_METHODS \ - ICOM_METHOD(HRESULT,GoBack) \ - ICOM_METHOD(HRESULT,GoForward) \ - ICOM_METHOD(HRESULT,GoHome) \ - ICOM_METHOD(HRESULT,GoSearch) \ - ICOM_METHOD5(HRESULT,Navigate, BSTR*,URL, VARIANT*,Flags, VARIANT*,TargetFrameName, \ - VARIANT*,PostData, VARIANT*,Headers) \ - ICOM_METHOD(HRESULT,Refresh) \ - ICOM_METHOD1(HRESULT,Refresh2, VARIANT*,Level) \ - ICOM_METHOD(HRESULT,Stop) \ - ICOM_METHOD1(HRESULT,get_Application, void**,ppDisp) \ - ICOM_METHOD1(HRESULT,get_Parent, void**,ppDisp) \ - ICOM_METHOD1(HRESULT,get_Container, void**,ppDisp) \ - ICOM_METHOD1(HRESULT,get_Document, void**,ppDisp) \ - ICOM_METHOD1(HRESULT,get_TopLevelContainer, VARIANT*,pBool) \ - ICOM_METHOD1(HRESULT,get_Type, BSTR*,Type) \ - ICOM_METHOD1(HRESULT,get_Left, long*,pl) \ - ICOM_METHOD1(HRESULT,put_Left, long,Left) \ - ICOM_METHOD1(HRESULT,get_Top, long*,pl) \ - ICOM_METHOD1(HRESULT,put_Top, long,Top) \ - ICOM_METHOD1(HRESULT,get_Width, long*,pl) \ - ICOM_METHOD1(HRESULT,put_Width, long,Width) \ - ICOM_METHOD1(HRESULT,get_Height, long*,pl) \ - ICOM_METHOD1(HRESULT,put_Height, long,Height) \ - ICOM_METHOD1(HRESULT,get_LocationName, BSTR*,LocationName) \ - ICOM_METHOD1(HRESULT,get_LocationURL, BSTR*,LocationURL) \ - ICOM_METHOD1(HRESULT,get_Busy, VARIANT*,pBool) -#define IWebBrowser_IMETHODS \ - IDispatch_METHODS \ - IWebBrowser_METHODS -ICOM_DEFINE(IWebBrowser,IDispatch) -#undef ICOM_INTERFACE - -/*** IUnknown methods ***/ -#define IWebBrowser_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IWebBrowser_AddRef(p) ICOM_CALL (AddRef,p) -#define IWebBrowser_Release(p) ICOM_CALL (Release,p) -/*** IDispatch methods ***/ -#define IWebBrowser_GetTypeInfoCount(p,a) ICOM_CALL1 (GetTypeInfoCount,p,a) -#define IWebBrowser_GetTypeInfo(p,a,b,c) ICOM_CALL3 (GetTypeInfo,p,a,b,c) -#define IWebBrowser_GetIDsOfNames(p,a,b,c,d,e) ICOM_CALL5 (GetIDsOfNames,p,a,b,c,d,e) -#define IWebBrowser_Invoke(p,a,b,c,d,e,f,g,h) ICOM_CALL8 (Invoke,p,a,b,c,d,e,f,g,h) -/*** IWebBrowserContainer methods ***/ -#define IWebBrowser_GoBack(p,a) ICOM_CALL1(GoBack,p,a) -#define IWebBrowser_GoForward(p,a) ICOM_CALL1(GoForward,p,a) -#define IWebBrowser_GoHome(p,a) ICOM_CALL1(GoHome,p,a) -#define IWebBrowser_GoSearch(p,a) ICOM_CALL1(GoSearch,p,a) -#define IWebBrowser_Navigate(p,a) ICOM_CALL1(Navigate,p,a) -#define IWebBrowser_Refresh(p,a) ICOM_CALL1(Refresh,p,a) -#define IWebBrowser_Refresh2(p,a) ICOM_CALL1(Refresh2,p,a) -#define IWebBrowser_Stop(p,a) ICOM_CALL1(Stop,p,a) -#define IWebBrowser_get_Application(p,a) ICOM_CALL1(get_Application,p,a) -#define IWebBrowser_get_Parent(p,a) ICOM_CALL1(get_Parent,p,a) -#define IWebBrowser_get_Container(p,a) ICOM_CALL1(get_Container,p,a) -#define IWebBrowser_get_Document(p,a) ICOM_CALL1(get_Document,p,a) -#define IWebBrowser_get_TopLevelContainer(p,a) ICOM_CALL1(get_TopLevelContainer,p,a) -#define IWebBrowser_get_Type(p,a) ICOM_CALL1(get_Type,p,a) -#define IWebBrowser_get_Left(p,a) ICOM_CALL1(get_Left,p,a) -#define IWebBrowser_put_Left(p,a) ICOM_CALL1(put_Left,p,a) -#define IWebBrowser_get_Top(p,a) ICOM_CALL1(get_Top,p,a) -#define IWebBrowser_put_Top(p,a) ICOM_CALL1(put_Top,p,a) -#define IWebBrowser_get_Width(p,a) ICOM_CALL1(get_Width,p,a) -#define IWebBrowser_put_Width(p,a) ICOM_CALL1(put_Width,p,a) -#define IWebBrowser_get_Height(p,a) ICOM_CALL1(get_Height,p,a) -#define IWebBrowser_put_Height(p,a) ICOM_CALL1(put_Height,p,a) -#define IWebBrowser_get_LocationName(p,a) ICOM_CALL1(get_LocationName,p,a) -#define IWebBrowser_get_LocationURL(p,a) ICOM_CALL1(get_LocationURL,p,a) -#define IWebBrowser_get_Busy(p,a) ICOM_CALL1(get_Busy,p,a) - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __WINE_WINE_OBJ_WEBBROWSER_H */ diff --git a/reactos/include/ole32/objbase.h b/reactos/include/ole32/objbase.h deleted file mode 100644 index 15c2f01c9e9..00000000000 --- a/reactos/include/ole32/objbase.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: include\ole32\objbase.h - * PURPOSE: Header file for the ole32.dll implementation - * PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be] - * UPDATE HISTORY: - * Created 01/05/2001 - */ -/******************************************************************** - - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - -********************************************************************/ -#ifndef _OBJBASE -#define _OBJBASE - -#include "guiddef.h" - -#ifndef EXTERN_C - #ifdef __cplusplus - #define EXTERN_C extern "C" - #else - #define EXTERN_C extern - #endif -#endif - -#define STDMETHODCALLTYPE __stdcall -#define STDMETHODVCALLTYPE __cdecl - -#define STDAPICALLTYPE __stdcall -#define STDAPIVCALLTYPE __cdecl - - -#define STDAPI EXTERN_C HRESULT STDMETHODCALLTYPE -#define STDAPI_(type) EXTERN_C type STDAPICALLTYPE - -#define STDMETHODIMP HRESULT STDMETHODCALLTYPE -#define STDMETHODIMP_(type) type STDMETHODCALLTYPE - - -/* variable argument lists versions */ -#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE -#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE - -#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE -#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE - -#ifndef WINOLEAPI - #define WINOLEAPI STDAPI - #define WINOLEAPI_(type) STDAPI_(type) -#endif - -/* - * COM interface declaration macros [from the wine implementation - * - * These macros declare interfaces for both C and C++ depending for what - * language you are compiling - * - * DECLARE_INTERFACE(iface): declare not derived interface - * DECLARE_INTERFACE(iface, baseiface): declare derived interface - * - * Use CINTERFACE if you want to force a c style interface declaration, - * else, the compiler will look at the source file extension - */ -#if defined(__cplusplus) && !defined(CINTERFACE) - /* define the c++ macros */ - #define interface struct - #define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method - #define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method - #define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method - #define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method - #define PURE = 0 - #define THIS_ - #define THIS - #define DECLARE_INTERFACE(iface) interface iface - #define DECLARE_INTERFACE_(iface, baseiface) interface iface : public baseiface - -#else - /* define the c macros */ - #define interface struct - #define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE* method) - #define STDMETHOD_(type,method) type (STDMETHODCALLTYPE* method) - #define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE* method) - #define STDMETHODV_(type,method)type (STDMETHODVCALLTYPE* method) - #define PURE - #define THIS_ INTERFACE FAR* This, - #define THIS INTERFACE FAR* This - - #ifdef CONST_VTABLE - #define DECLARE_INTERFACE(iface) typedef interface iface { \ - const struct iface##Vtbl FAR* lpVtbl; \ - } iface; \ - typedef const struct iface##Vtbl iface##Vtbl; \ - const struct iface##Vtbl - #else - #define DECLARE_INTERFACE(iface) typedef interface iface { \ - struct iface##Vtbl FAR* lpVtbl; \ - } iface; \ - typedef struct iface##Vtbl iface##Vtbl; \ - struct iface##Vtbl - #endif - - #define DECLARE_INTERFACE_(iface, baseiface) DECLARE_INTERFACE(iface) -#endif - -#endif diff --git a/reactos/include/ole32/ole32.h b/reactos/include/ole32/ole32.h deleted file mode 100644 index 89cad83fdde..00000000000 --- a/reactos/include/ole32/ole32.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef ___OLE32_H -#define ___OLE32_H - -#include -#include "wtypes.h" -#include "objbase.h" -#include "obj_base.h" -#include "obj_misc.h" - -#include "obj_storage.h" -#include "obj_moniker.h" -#include "obj_clientserver.h" -#include "obj_dataobject.h" -#include "obj_dragdrop.h" -#include "obj_inplace.h" -#include "obj_oleobj.h" -#include "obj_oleview.h" -#include "obj_cache.h" -#include "obj_marshal.h" - -#include "rpc.h" - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -/* - * OLE version conversion declarations - */ - -typedef struct _OLESTREAM* LPOLESTREAM; -typedef struct _OLESTREAMVTBL { - DWORD CALLBACK (*Get)(LPOLESTREAM,LPSTR,DWORD); - DWORD CALLBACK (*Put)(LPOLESTREAM,LPSTR,DWORD); -} OLESTREAMVTBL; -typedef OLESTREAMVTBL* LPOLESTREAMVTBL; -typedef struct _OLESTREAM { - LPOLESTREAMVTBL lpstbl; -} OLESTREAM; - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __OLE32_H */ diff --git a/reactos/include/ole32/olectl.h b/reactos/include/ole32/olectl.h deleted file mode 100644 index 2c1ef57724b..00000000000 --- a/reactos/include/ole32/olectl.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS COm library - * FILE: include\ole32\olectl.c - * PURPOSE: OLE control interfaces - * PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be] - * UPDATE HISTORY: - * Created 31/12/2001 - */ -/******************************************************************** - - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - -********************************************************************/ -#include - -/* Dll register functions */ -STDAPI DllRegisterServer(void); -STDAPI DllUnregisterServer(void); \ No newline at end of file diff --git a/reactos/include/ole32/rpc.h b/reactos/include/ole32/rpc.h deleted file mode 100644 index f98625884ec..00000000000 --- a/reactos/include/ole32/rpc.h +++ /dev/null @@ -1,45 +0,0 @@ -/************************************** - * RPC interface - * - */ -#ifndef __WINE_RPC_H -#define __WINE_RPC_H - -#if !defined(RPC_NO_WINDOWS_H) && !defined(__WINE__) -#include "windows.h" -#endif - -#define __RPC_FAR -#define __RPC_API WINAPI -#define __RPC_USER WINAPI -#define __RPC_STUB WINAPI -#define RPC_ENTRY WINAPI -typedef long RPC_STATUS; - -typedef void* I_RPC_HANDLE; -/* -#ifndef _GUID_DEFINED -#define _GUID_DEFINED -typedef struct _GUID -{ - DWORD Data1; - WORD Data2; - WORD Data3; - BYTE Data4[8]; -} GUID; -#endif -*/ -#ifndef UUID_DEFINED -#define UUID_DEFINED -typedef GUID UUID; -#endif - -RPC_STATUS RPC_ENTRY UuidCreate(UUID *Uuid); - -#include "rpcdce.h" -/* #include "rpcnsi.h" */ -/* #include "rpcnterr.h" */ -/* #include "excpt.h" */ -/* #include "winerror.h" */ - -#endif /*__WINE_RPC_H */ diff --git a/reactos/include/ole32/rpcdce.h b/reactos/include/ole32/rpcdce.h deleted file mode 100644 index 6698f40e794..00000000000 --- a/reactos/include/ole32/rpcdce.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __WINE_RPCDCE_H -#define __WINE_RPCDCE_H - -typedef void* RPC_AUTH_IDENTITY_HANDLE; -typedef void* RPC_AUTHZ_HANDLE; -typedef void* RPC_IF_HANDLE; -typedef I_RPC_HANDLE RPC_BINDING_HANDLE; -typedef RPC_BINDING_HANDLE handle_t; -#define rpc_binding_handle_t RPC_BINDING_HANDLE -#define RPC_MGR_EPV void - -#include "rpcdcep.h" - -#endif /*__WINE_RPCDCE_H */ diff --git a/reactos/include/ole32/rpcdcep.h b/reactos/include/ole32/rpcdcep.h deleted file mode 100644 index ac005248196..00000000000 --- a/reactos/include/ole32/rpcdcep.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __WINE_RPCDCEP_H -#define __WINE_RPCDCEP_H - - -typedef struct _RPC_VERSION { - unsigned short MajorVersion; - unsigned short MinorVersion; -} RPC_VERSION; - -typedef struct _RPC_SYNTAX_IDENTIFIER { - GUID SyntaxGUID; - RPC_VERSION SyntaxVersion; -} RPC_SYNTAX_IDENTIFIER, *PRPC_SYNTAX_IDENTIFIER; - -typedef struct _RPC_MESSAGE -{ - RPC_BINDING_HANDLE Handle; - unsigned long DataRepresentation; - void* Buffer; - unsigned int BufferLength; - unsigned int ProcNum; - PRPC_SYNTAX_IDENTIFIER TransferSyntax; - void* RpcInterfaceInformation; - void* ReservedForRuntime; - RPC_MGR_EPV* ManagerEpv; - void* ImportContext; - unsigned long RpcFlags; -} RPC_MESSAGE, *PRPC_MESSAGE; - -#endif /*__WINE_RPCDCE_H */ diff --git a/reactos/include/ole32/unknwn.h b/reactos/include/ole32/unknwn.h deleted file mode 100644 index 287e6a42216..00000000000 --- a/reactos/include/ole32/unknwn.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: include\ole32\unknwn.h - * PURPOSE: Defines IUnknown and IClassFactory interface - * PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be] - * UPDATE HISTORY: - * Created 01/05/2001 - */ -/******************************************************************** - - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - -********************************************************************/ -#ifndef _UNKNWN_H -#define _UNKNWN_H - -#include - - - -#endif \ No newline at end of file diff --git a/reactos/include/ole32/winerror.h b/reactos/include/ole32/winerror.h deleted file mode 100644 index 23d28689edf..00000000000 --- a/reactos/include/ole32/winerror.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: include\ole32\winerror.h - * PURPOSE: Defines windows error codes - * PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be] - * UPDATE HISTORY: - * Created 01/05/2001 - */ -/******************************************************************** - - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - -********************************************************************/ -#ifndef _WINERROR_H -#define _WINERROR_H -#if 0 -/* - * Return Code macros - */ -#define SUCCEEDED(Status) ((HRESULT)(Status) >= 0) -#define FAILED(Status) ((HRESULT)(Status)<0) - -/* - * Success Codes - */ -#define S_OK 0x00000000L -#define S_FALSE 0x00000001L - -/* - * Error Codes - */ -#define E_NOINTERFACE 0x80000004L -#define E_POINTER 0x80004003L -#define E_FAIL 0x80004005L -#define E_UNEXPECTED 0x8000FFFFL -#define CLASS_E_NOAGGREGATION 0x80040110L -#define CLASS_E_CLASSNOTAVAILABLE 0x80040111L -#define E_OUTOFMEMORY 0x8007000EL -#define E_INVALIDARG 0x80070057L - -#endif - -#endif diff --git a/reactos/include/ole32/wtypes.h b/reactos/include/ole32/wtypes.h deleted file mode 100644 index 98c31d77b3a..00000000000 --- a/reactos/include/ole32/wtypes.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Defines the basic types used by COM interfaces. - */ - -#ifndef __WINE_WTYPES_H -#define __WINE_WTYPES_H - -#if 0 -#include "basetsd.h" -#include "guiddef.h" -#include "rpc.h" -#include "rpcndr.h" -#endif -#include -#include -#include - - -typedef void* HMETAFILEPICT; - -typedef WORD CLIPFORMAT, *LPCLIPFORMAT; - -/* FIXME: does not belong here */ -typedef CHAR OLECHAR16; -typedef LPSTR LPOLESTR16; -typedef LPCSTR LPCOLESTR16; -typedef OLECHAR16 *BSTR16; -typedef BSTR16 *LPBSTR16; -#define OLESTR16(x) x - -typedef WCHAR OLECHAR; -typedef LPWSTR LPOLESTR; -typedef LPCWSTR LPCOLESTR; -typedef OLECHAR *BSTR; -typedef BSTR *LPBSTR; -#ifndef __WINE__ -#define OLESTR(str) WINE_UNICODE_TEXT(str) -#endif - -typedef enum tagDVASPECT -{ - DVASPECT_CONTENT = 1, - DVASPECT_THUMBNAIL = 2, - DVASPECT_ICON = 4, - DVASPECT_DOCPRINT = 8 -} DVASPECT; - -typedef enum tagSTGC -{ - STGC_DEFAULT = 0, - STGC_OVERWRITE = 1, - STGC_ONLYIFCURRENT = 2, - STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4, - STGC_CONSOLIDATE = 8 -} STGC; - -typedef enum tagSTGMOVE -{ - STGMOVE_MOVE = 0, - STGMOVE_COPY = 1, - STGMOVE_SHALLOWCOPY = 2 -} STGMOVE; - - -typedef struct _COAUTHIDENTITY -{ - USHORT* User; - ULONG UserLength; - USHORT* Domain; - ULONG DomainLength; - USHORT* Password; - ULONG PasswordLength; - ULONG Flags; -} COAUTHIDENTITY; - -typedef struct _COAUTHINFO -{ - DWORD dwAuthnSvc; - DWORD dwAuthzSvc; - LPWSTR pwszServerPrincName; - DWORD dwAuthnLevel; - DWORD dwImpersonationLevel; - COAUTHIDENTITY* pAuthIdentityData; - DWORD dwCapabilities; -} COAUTHINFO; - -typedef struct _COSERVERINFO -{ - DWORD dwReserved1; - LPWSTR pwszName; - COAUTHINFO* pAuthInfo; - DWORD dwReserved2; -} COSERVERINFO; - -typedef enum tagCLSCTX -{ - CLSCTX_INPROC_SERVER = 0x1, - CLSCTX_INPROC_HANDLER = 0x2, - CLSCTX_LOCAL_SERVER = 0x4, - CLSCTX_INPROC_SERVER16 = 0x8, - CLSCTX_REMOTE_SERVER = 0x10, - CLSCTX_INPROC_HANDLER16 = 0x20, - CLSCTX_INPROC_SERVERX86 = 0x40, - CLSCTX_INPROC_HANDLERX86 = 0x80, - CLSCTX_ESERVER_HANDLER = 0x100 -} CLSCTX; - -#define CLSCTX_INPROC (CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER) -#define CLSCTX_ALL (CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER) -#define CLSCTX_SERVER (CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER) - -typedef enum tagMSHLFLAGS -{ - MSHLFLAGS_NORMAL = 0, - MSHLFLAGS_TABLESTRONG = 1, - MSHLFLAGS_TABLEWEAK = 2, - MSHLFLAGS_NOPING = 4 -} MSHLFLAGS; - -typedef enum tagMSHCTX -{ - MSHCTX_LOCAL = 0, - MSHCTX_NOSHAREDMEM = 1, - MSHCTX_DIFFERENTMACHINE = 2, - MSHCTX_INPROC = 3 -} MSHCTX; - -typedef unsigned short VARTYPE; - -typedef ULONG PROPID; - -#ifndef _tagCY_DEFINED -#define _tagCY_DEFINED - -typedef union tagCY { - struct { -#ifdef BIG_ENDIAN - LONG Hi; - LONG Lo; -#else /* defined(BIG_ENDIAN) */ - ULONG Lo; - LONG Hi; -#endif /* defined(BIG_ENDIAN) */ - } DUMMYSTRUCTNAME; - LONGLONG int64; -} CY; - -#endif /* _tagCY_DEFINED */ - -typedef struct tagDEC { - USHORT wReserved; - union { - struct { - BYTE scale; - BYTE sign; - } DUMMYSTRUCTNAME1; - USHORT signscale; - } DUMMYUNIONNAME1; - ULONG Hi32; - union { - struct { -#ifdef BIG_ENDIAN - ULONG Mid32; - ULONG Lo32; -#else /* defined(BIG_ENDIAN) */ - ULONG Lo32; - ULONG Mid32; -#endif /* defined(BIG_ENDIAN) */ - } DUMMYSTRUCTNAME2; - ULONGLONG Lo64; - } DUMMYUNIONNAME2; -} DECIMAL; - -#define DECIMAL_NEG ((BYTE)0x80) -#ifndef NONAMELESSUNION -#define DECIMAL_SETZERO(d) \ - do {(d).Lo64 = 0; (d).Hi32 = 0; (d).signscale = 0;} while (0) -#else -#define DECIMAL_SETZERO(d) \ - do {(d).u2.Lo64 = 0; (d).Hi32 = 0; (d).u1.signscale = 0;} while (0) -#endif - -/* - * 0 == FALSE and -1 == TRUE - */ -#define VARIANT_TRUE ((VARIANT_BOOL)0xFFFF) -#define VARIANT_FALSE ((VARIANT_BOOL)0x0000) -typedef short VARIANT_BOOL,_VARIANT_BOOL; - -typedef struct tagCLIPDATA -{ - ULONG cbSize; - long ulClipFmt; - BYTE *pClipData; -} CLIPDATA; - -/* Macro to calculate the size of the above pClipData */ -#define CBPCLIPDATA(clipdata) ( (clipdata).cbSize - sizeof((clipdata).ulClipFmt) ) - -typedef LONG SCODE; - -#ifndef _ROTFLAGS_DEFINED -#define _ROTFLAGS_DEFINED -#define ROTFLAGS_REGISTRATIONKEEPSALIVE 0x1 -#define ROTFLAGS_ALLOWANYCLIENT 0x2 -#endif /* !defined(_ROTFLAGS_DEFINED) */ - -#endif /* __WINE_WTYPES_H */ diff --git a/reactos/lib/comctl32/makefile b/reactos/lib/comctl32/makefile index 5ec52a4b711..d7c02d82ddd 100644 --- a/reactos/lib/comctl32/makefile +++ b/reactos/lib/comctl32/makefile @@ -28,14 +28,16 @@ DEFINES = \ TARGET_CFLAGS += \ $(DEFINES) \ -DDCX_USESTYLE=0x10000L \ - -I$(PATH_TO_TOP)/include/wine + -I$(PATH_TO_TOP)/include/wine \ + -Wno-unused TARGET_RCFLAGS += -D__REACTOS__ -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x501 TARGET_LFLAGS = -nostartfiles -nostdlib -TARGET_SDKLIBS = libwine.a gdi32.a msvcrt.a kernel32.a user32.a advapi32.a \ - winmm.a ole32.a ntdll.a +TARGET_SDKLIBS = libwine.a + +TARGET_GCCLIBS = gdi32 msvcrt kernel32 user32 advapi32 winmm ole32 ntdll TARGET_BASE = 0x76160000 diff --git a/reactos/lib/ole32/.cvsignore b/reactos/lib/ole32/.cvsignore index 0d3ac721cbe..a2a90a48943 100644 --- a/reactos/lib/ole32/.cvsignore +++ b/reactos/lib/ole32/.cvsignore @@ -1,7 +1,6 @@ *.coff *.dll -*.d *.o +*.d *.sym *.map - diff --git a/reactos/lib/ole32/CoXxx.c b/reactos/lib/ole32/CoXxx.c deleted file mode 100644 index 5da41efc771..00000000000 --- a/reactos/lib/ole32/CoXxx.c +++ /dev/null @@ -1,470 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib\ole32\CoXxx.c - * PURPOSE: The Co... function implementation - * PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be] - * UPDATE HISTORY: - * Created 01/05/2001 - */ -/******************************************************************** - - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - -********************************************************************/ - -//#define INITGUID -#include - -#include - -// -// lCOMLockCount is a reference count, when it reaches 0, all COM libraries are freed -// -static ULONG lCOMLockCount = 0; - -WINOLEAPI_(ULONG) CoAddRefServerProcess() -{ - UNIMPLEMENTED; - - return 0L; -} - -WINOLEAPI CoAllowSetForegroundWindow(IUnknown *pUnk, LPVOID lpvReserved) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - - -WINOLEAPI CoCancelCall(DWORD dwThreadId, ULONG ulTimeout) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -WINOLEAPI CoCopyProxy(IUnknown* pProxy, IUnknown** ppCopy) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoDisableCallCancellation(LPVOID pvReserved) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI_(BOOL) CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime, FILETIME* lpFileTime) -{ - UNIMPLEMENTED; - - return TRUE; -} - -// -// -// -WINOLEAPI CoEnableCallCancellation(LPVOID pvReserver) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI_(BOOL) CoFileTimeToDosDateTime(FILETIME* lpFileTime, LPWORD lpDosDate, LPWORD lpDosTime) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoGetCallContext(REFIID riid, void** ppInterface) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoGetCancelObject(DWORD dwThreadId, REFIID iid, void** ppUnk) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI_(DWORD) CoGetCurrentProcess() -{ - UNIMPLEMENTED; - - return 0; -} - -// -// -// -WINOLEAPI CoGetInstanceFromFile(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, - DWORD dwClsCtx, DWORD grfMode, OLECHAR* pwszName, DWORD dwCount, MULTI_QI* pResults) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, - DWORD dwClsCtx, IStorage *pstg, DWORD dwCount, MULTI_QI* pResults) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID iid, LPVOID* ppv) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoGetMarshalSizeMax(ULONG* pulSize, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, - LPVOID pvdestContext, DWORD mshlflags) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoGetObject(LPCWSTR pszName, BIND_OPTS* pBindOptions, REFIID riid, void** ppv) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoGetObjectContext(REFIID riid, LPVOID FAR* ppv) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoGetStandardMarshal(REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvdestContext, - DWORD mshlflags, LPMARSHAL* ppMarshal) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoGetStdMarshalEx(LPUNKNOWN pUnkOuter, DWORD smexflags, LPUNKNOWN* ppUnkInner) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew) -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -// -// -// -WINOLEAPI CoImpersonateClient() -{ - UNIMPLEMENTED; - - return E_FAIL; -} - -WINOLEAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoRevokeMallocSpy() -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoSuspendClassObjects() -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI_(ULONG) CoReleaseServerProcess() -{ - UNIMPLEMENTED; - - return 0; -} - -WINOLEAPI CoRegisterPSClsid(IN REFIID riid, IN REFCLSID rclsid) -{ - UNIMPLEMENTED; - - return S_OK; -} - -#if 0 -WINOLEAPI CoRegisterSurrogate(IN LPSURROGATE pSurrogate) -{ - UNIMPLEMENTED; - - return S_OK; -} -#endif - -WINOLEAPI CoMarshalInterface(LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, - DWORD mshlflags) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoUnmarshalInterface(LPSTREAM pStm, REFIID riid, LPVOID FAR* ppv) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoMarshalHresult(LPSTREAM pstm, HRESULT hresult) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoUnmarshalHresult(LPSTREAM pstm, HRESULT FAR * phresult) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoReleaseMarshalData(LPSTREAM pStm) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI_(BOOL) CoIsHandlerConnected(LPUNKNOWN pUnk) -{ - UNIMPLEMENTED; - - return S_OK; -} - - -WINOLEAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM *ppStm) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoInitializeSecurity( - PSECURITY_DESCRIPTOR pSecDesc, - LONG cAuthSvc, - SOLE_AUTHENTICATION_SERVICE *asAuthSvc, - void *pReserved1, - DWORD dwAuthnLevel, - DWORD dwImpLevel, - void *pAuthList, - DWORD dwCapabilities, - void *pReserved3 ) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoQueryProxyBlanket( - IUnknown *pProxy, - DWORD *pwAuthnSvc, - DWORD *pAuthzSvc, - OLECHAR **pServerPrincName, - DWORD *pAuthnLevel, - DWORD *pImpLevel, - RPC_AUTH_IDENTITY_HANDLE *pAuthInfo, - DWORD *pCapabilites ) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoSetProxyBlanket( - IUnknown *pProxy, - DWORD dwAuthnSvc, - DWORD dwAuthzSvc, - OLECHAR *pServerPrincName, - DWORD dwAuthnLevel, - DWORD dwImpLevel, - RPC_AUTH_IDENTITY_HANDLE pAuthInfo, - DWORD dwCapabilities ) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoQueryClientBlanket( - DWORD *pAuthnSvc, - DWORD *pAuthzSvc, - OLECHAR **pServerPrincName, - DWORD *pAuthnLevel, - DWORD *pImpLevel, - RPC_AUTHZ_HANDLE *pPrivs, - DWORD *pCapabilities ) -{ - UNIMPLEMENTED; - - return S_OK; - -} - -WINOLEAPI CoRevertToSelf() -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoQueryAuthenticationServices( - DWORD *pcAuthSvc, - SOLE_AUTHENTICATION_SERVICE **asAuthSvc ) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoSwitchCallContext(IUnknown *pNewObject, IUnknown **ppOldObject ) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoSetCancelObject(IUnknown *pUnk) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoTestCancel() -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoRegisterMessageFilter( IN LPMESSAGEFILTER lpMessageFilter, - OUT LPMESSAGEFILTER FAR* lplpMessageFilter) -{ - UNIMPLEMENTED; - - return S_OK; -} - -#if 0 -WINOLEAPI CoRegisterChannelHook(REFGUID ExtensionUuid, IChannelHook *pChannelHook ) -{ - UNIMPLEMENTED; - - return S_OK; -} -#endif - -WINOLEAPI CoWaitForMultipleHandles(IN DWORD dwFlags, - IN DWORD dwTimeout, - IN ULONG cHandles, - IN LPHANDLE pHandles, - OUT LPDWORD lpdwindex) -{ - UNIMPLEMENTED; - - return S_OK; -} - -WINOLEAPI CoTreatAsClass(IN REFCLSID clsidOld, IN REFCLSID clsidNew) -{ - UNIMPLEMENTED; - - return S_OK; -} diff --git a/reactos/lib/ole32/DllMain.c b/reactos/lib/ole32/DllMain.c deleted file mode 100644 index d904ec15d69..00000000000 --- a/reactos/lib/ole32/DllMain.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib\ole32\DllMain.c - * PURPOSE: The dll entry routine - * PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be] - * UPDATE HISTORY: - * Created 01/05/2001 - */ -/******************************************************************** - - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - -********************************************************************/ -#include - -#include - -#ifdef DBG - -DWORD DebugTraceLevel = MIN_TRACE; - -#endif /* DBG */ - -BOOL WINAPI DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved) -{ - return TRUE; -} diff --git a/reactos/lib/ole32/Misc.c b/reactos/lib/ole32/Misc.c deleted file mode 100644 index 4252a4ebdcb..00000000000 --- a/reactos/lib/ole32/Misc.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib\ole32\Misc.c - * PURPOSE: Ole32.dll helper functions - * PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be] - * UPDATE HISTORY: - * Created 14/05/2001 - */ -/******************************************************************** - - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - -********************************************************************/ -#include - -#if 0 - -WINOLEAPI PropVariantClear(PROPVARIANT *pvar){return S_OK;} -WINOLEAPI FreePropVariantArray( - ULONG cVariants, //Count of elements in the structure - PROPVARIANT *rgvars //Pointer to the PROPVARIANT structure -){return S_OK;} - -WINOLEAPI PropVariantCopy(PROPVARIANT* pvarDest, const PROPVARIANT* pvarSrc){return S_OK;} - -WINOLEAPI CreateDataAdviseHolder(OUT LPDATAADVISEHOLDER FAR* ppDAHolder) -{ - return S_OK; -} - -WINOLEAPI CreateDataCache(IN LPUNKNOWN pUnkOuter, IN REFCLSID rclsid, - IN REFIID iid, OUT LPVOID FAR* ppv) -{ - return S_OK; -} - -WINOLEAPI StringFromCLSID(IN REFCLSID rclsid, OUT LPOLESTR FAR* lplpsz) -{ - return S_OK; -} - -WINOLEAPI CLSIDFromString(IN LPOLESTR lpsz, OUT LPCLSID pclsid) -{ - return E_FAIL; -} - -WINOLEAPI StringFromIID(IN REFIID rclsid, OUT LPOLESTR FAR* lplpsz) -{ - return S_OK; -} - -WINOLEAPI IIDFromString(IN LPOLESTR lpsz, OUT LPIID lpiid) -{ - return S_OK; -} - -WINOLEAPI_(BOOL) CoIsOle1Class(IN REFCLSID rclsid) -{ - return S_OK; -} - -WINOLEAPI ProgIDFromCLSID (IN REFCLSID clsid, OUT LPOLESTR FAR* lplpszProgID) -{ - return S_OK; -} - -WINOLEAPI CLSIDFromProgID (IN LPCOLESTR lpszProgID, OUT LPCLSID lpclsid) -{ - return S_OK; -} - -WINOLEAPI CLSIDFromProgIDEx (IN LPCOLESTR lpszProgID, OUT LPCLSID lpclsid) -{ - return S_OK; -} - -WINOLEAPI_(int) StringFromGUID2(IN REFGUID rguid, OUT LPOLESTR lpsz, IN int cchMax) -{ - return S_OK; -} - -#endif - -/****************************************************************************** - * IsValidInterface [OLE32.78] - * - * RETURNS - * True, if the passed pointer is a valid interface - */ -BOOL WINAPI IsValidInterface( - LPUNKNOWN punk /* [in] interface to be tested */ -) { - return !( - IsBadReadPtr(punk,4) || - IsBadReadPtr(ICOM_VTBL(punk),4) || - IsBadReadPtr(ICOM_VTBL(punk)->QueryInterface,9) || - IsBadCodePtr((FARPROC)ICOM_VTBL(punk)->QueryInterface) - ); -} diff --git a/reactos/lib/ole32/Ole32.h b/reactos/lib/ole32/Ole32.h deleted file mode 100644 index 75473ecb1f7..00000000000 --- a/reactos/lib/ole32/Ole32.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib\ole32\Ole32.h - * PURPOSE: The internal include file for the ole32.dll - * PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be] - * UPDATE HISTORY: - * Created 01/05/2001 - */ -/******************************************************************** - - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - -********************************************************************/ -#ifndef _OLE32 -#define _OLE32 - - -// include windows stuff -#include -//#include -//#include -#include -//#include -#include - - -#endif diff --git a/reactos/lib/ole32/OleAuto.c b/reactos/lib/ole32/OleAuto.c deleted file mode 100644 index a7cf73af0c1..00000000000 --- a/reactos/lib/ole32/OleAuto.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib\ole32\oleauto.c - * PURPOSE: Ole automation helper functions - * PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be] - * UPDATE HISTORY: - * Created 01/05/2001 - */ -/******************************************************************** - - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - -********************************************************************/ -#include "Ole32.h" - -/*WINOLEAPI CreateErrorInfo(ICreateErrorInfo **pperrinfo){return S_OK;} -WINOLEAPI GetErrorInfo( - DWORD dwReserved, - IErrorInfo **pperrinfo -){return S_OK;}*/ diff --git a/reactos/lib/ole32/antimoniker.c b/reactos/lib/ole32/antimoniker.c index 67e3326d5a6..1a195e8e27e 100644 --- a/reactos/lib/ole32/antimoniker.c +++ b/reactos/lib/ole32/antimoniker.c @@ -2,24 +2,51 @@ * AntiMonikers implementation * * Copyright 1999 Noomen Hamza + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************************/ +#include +#include #include -#include -#include -#include -#include +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "wine/unicode.h" +#include "objbase.h" +#include "wine/debug.h" +#include "moniker.h" -#include +WINE_DEFAULT_DEBUG_CHANNEL(ole); +const CLSID CLSID_AntiMoniker = { + 0x305, 0, 0, {0xC0, 0, 0, 0, 0, 0, 0, 0x46} +}; /* AntiMoniker data structure */ typedef struct AntiMonikerImpl{ ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ - /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether + /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether * two monikers are equal. That's whay IROTData interface is implemented by monikers. */ ICOM_VTABLE(IROTData)* lpvtbl2; /* VTable relative to the IROTData interface.*/ @@ -125,13 +152,13 @@ static ICOM_VTABLE(IROTData) VT_ROTDataImpl = HRESULT WINAPI AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject) { ICOM_THIS(AntiMonikerImpl,iface); - - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,riid,ppvObject)); + + TRACE("(%p,%p,%p)\n",This,riid,ppvObject); /* Perform a sanity check on the parameters.*/ if ( (This==0) || (ppvObject==0) ) return E_INVALIDARG; - + /* Initialize the return parameter */ *ppvObject = 0; @@ -148,7 +175,7 @@ HRESULT WINAPI AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** /* Check that we obtained an interface.*/ if ((*ppvObject)==0) return E_NOINTERFACE; - + /* Query Interface always increases the reference count by one when it is successful */ AntiMonikerImpl_AddRef(iface); @@ -162,7 +189,7 @@ ULONG WINAPI AntiMonikerImpl_AddRef(IMoniker* iface) { ICOM_THIS(AntiMonikerImpl,iface); - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); return ++(This->ref); } @@ -174,7 +201,7 @@ ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface) { ICOM_THIS(AntiMonikerImpl,iface); - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); This->ref--; @@ -185,7 +212,7 @@ ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface) return 0; } - return This->ref;; + return This->ref; } /****************************************************************************** @@ -193,13 +220,13 @@ ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface) ******************************************************************************/ HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface,CLSID *pClassID) { - Print(MAX_TRACE, ("(%p,%p),stub!\n",iface,pClassID)); + TRACE("(%p,%p),stub!\n",iface,pClassID); if (pClassID==NULL) return E_POINTER; - + *pClassID = CLSID_AntiMoniker; - + return S_OK; } @@ -212,7 +239,7 @@ HRESULT WINAPI AntiMonikerImpl_IsDirty(IMoniker* iface) method in the OLE-provided moniker interfaces always return S_FALSE because their internal state never changes. */ - Print(MAX_TRACE, ("(%p)\n",iface)); + TRACE("(%p)\n",iface); return S_FALSE; } @@ -241,8 +268,8 @@ HRESULT WINAPI AntiMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDir { DWORD constant=1; HRESULT res; - - /* data writen by this function is only a DWORD constant seted to 1 ! */ + + /* data written by this function is only a DWORD constant set to 1 ! */ res=IStream_Write(pStm,&constant,sizeof(constant),NULL); return res; @@ -254,13 +281,13 @@ HRESULT WINAPI AntiMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDir HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize)/* Pointer to size of stream needed to save object */ { - Print(MAX_TRACE, ("(%p,%p)\n",iface,pcbSize)); + TRACE("(%p,%p)\n",iface,pcbSize); if (pcbSize!=NULL) return E_POINTER; /* for more details see AntiMonikerImpl_Save coments */ - + /* Normaly the sizemax must be the size of DWORD ! but I tested this function it ususlly return 16 bytes */ /* more than the number of bytes used by AntiMoniker::Save function */ pcbSize->u.LowPart = sizeof(DWORD)+16; @@ -276,7 +303,7 @@ HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface, HRESULT WINAPI AntiMonikerImpl_Construct(AntiMonikerImpl* This) { - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); /* Initialize the virtual fgunction table. */ This->lpvtbl1 = &VT_AntiMonikerImpl; @@ -291,7 +318,7 @@ HRESULT WINAPI AntiMonikerImpl_Construct(AntiMonikerImpl* This) *******************************************************************************/ HRESULT WINAPI AntiMonikerImpl_Destroy(AntiMonikerImpl* This) { - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); return HeapFree(GetProcessHeap(),0,This); } @@ -305,7 +332,7 @@ HRESULT WINAPI AntiMonikerImpl_BindToObject(IMoniker* iface, REFIID riid, VOID** ppvResult) { - Print(MAX_TRACE, ("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult)); + TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult); return E_NOTIMPL; } @@ -318,7 +345,7 @@ HRESULT WINAPI AntiMonikerImpl_BindToStorage(IMoniker* iface, REFIID riid, VOID** ppvResult) { - Print(MAX_TRACE, ("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult)); + TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult); return E_NOTIMPL; } @@ -331,7 +358,7 @@ HRESULT WINAPI AntiMonikerImpl_Reduce(IMoniker* iface, IMoniker** ppmkToLeft, IMoniker** ppmkReduced) { - Print(MAX_TRACE, ("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced)); + TRACE("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced); if (ppmkReduced==NULL) return E_POINTER; @@ -339,7 +366,7 @@ HRESULT WINAPI AntiMonikerImpl_Reduce(IMoniker* iface, AntiMonikerImpl_AddRef(iface); *ppmkReduced=iface; - + return MK_S_REDUCED_TO_SELF; } /****************************************************************************** @@ -351,13 +378,13 @@ HRESULT WINAPI AntiMonikerImpl_ComposeWith(IMoniker* iface, IMoniker** ppmkComposite) { - Print(MAX_TRACE, ("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite)); + TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite); if ((ppmkComposite==NULL)||(pmkRight==NULL)) return E_POINTER; *ppmkComposite=0; - + if (fOnlyIfNotGeneric) return MK_E_NEEDGENERIC; else @@ -369,11 +396,11 @@ HRESULT WINAPI AntiMonikerImpl_ComposeWith(IMoniker* iface, ******************************************************************************/ HRESULT WINAPI AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker) { - Print(MAX_TRACE, ("(%p,%d,%p)\n",iface,fForward,ppenumMoniker)); + TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker); if (ppenumMoniker == NULL) return E_POINTER; - + *ppenumMoniker = NULL; return S_OK; @@ -385,12 +412,12 @@ HRESULT WINAPI AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker* HRESULT WINAPI AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker) { DWORD mkSys; - - Print(MAX_TRACE, ("(%p,%p)\n",iface,pmkOtherMoniker)); + + TRACE("(%p,%p)\n",iface,pmkOtherMoniker); if (pmkOtherMoniker==NULL) return S_FALSE; - + IMoniker_IsSystemMoniker(pmkOtherMoniker,&mkSys); if (mkSys==MKSYS_ANTIMONIKER) @@ -423,7 +450,7 @@ HRESULT WINAPI AntiMonikerImpl_IsRunning(IMoniker* iface, IRunningObjectTable* rot; HRESULT res; - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning)); + TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning); if (pbc==NULL) return E_INVALIDARG; @@ -448,7 +475,7 @@ HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IMoniker* pmkToLeft, FILETIME* pAntiTime) { - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pAntiTime)); + TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pAntiTime); return E_NOTIMPL; } @@ -457,7 +484,7 @@ HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface, ******************************************************************************/ HRESULT WINAPI AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk) { - Print(MAX_TRACE, ("(%p,%p)\n",iface,ppmk)); + TRACE("(%p,%p)\n",iface,ppmk); if (ppmk==NULL) return E_POINTER; @@ -473,7 +500,7 @@ HRESULT WINAPI AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk) HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix) { DWORD mkSys; - + IMoniker_IsSystemMoniker(pmkOther,&mkSys); if(mkSys==MKSYS_ITEMMONIKER){ @@ -483,7 +510,7 @@ HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOth *ppmkPrefix=iface; IMoniker_AddRef(iface); - + return MK_S_US; } else @@ -495,7 +522,7 @@ HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOth ******************************************************************************/ HRESULT WINAPI AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath) { - Print(MAX_TRACE, ("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath)); + TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath); if (ppmkRelPath==NULL) return E_POINTER; @@ -516,14 +543,14 @@ HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface, LPOLESTR *ppszDisplayName) { WCHAR back[]={'\\','.','.',0}; - - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName)); + + TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName); if (ppszDisplayName==NULL) return E_POINTER; if (pmkToLeft!=NULL){ - Print(MIN_TRACE, ("() pmkToLeft!=NULL not implemented \n")); + FIXME("() pmkToLeft!=NULL not implemented \n"); return E_NOTIMPL; } @@ -532,8 +559,8 @@ HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface, if (*ppszDisplayName==NULL) return E_OUTOFMEMORY; - lstrcpyW(*ppszDisplayName,back); - + strcpyW(*ppszDisplayName,back); + return S_OK; } @@ -547,7 +574,7 @@ HRESULT WINAPI AntiMonikerImpl_ParseDisplayName(IMoniker* iface, ULONG* pchEaten, IMoniker** ppmkOut) { - Print(MAX_TRACE, ("(%p,%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut)); + TRACE("(%p,%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut); return E_NOTIMPL; } @@ -556,11 +583,11 @@ HRESULT WINAPI AntiMonikerImpl_ParseDisplayName(IMoniker* iface, ******************************************************************************/ HRESULT WINAPI AntiMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys) { - Print(MAX_TRACE, ("(%p,%p)\n",iface,pwdMksys)); + TRACE("(%p,%p)\n",iface,pwdMksys); if (!pwdMksys) return E_POINTER; - + (*pwdMksys)=MKSYS_ANTIMONIKER; return S_OK; @@ -574,7 +601,7 @@ HRESULT WINAPI AntiMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid ICOM_THIS_From_IROTData(IMoniker, iface); - Print(MAX_TRACE, ("(%p,%p,%p)\n",iface,riid,ppvObject)); + TRACE("(%p,%p,%p)\n",iface,riid,ppvObject); return AntiMonikerImpl_QueryInterface(This, riid, ppvObject); } @@ -586,7 +613,7 @@ ULONG WINAPI AntiMonikerROTDataImpl_AddRef(IROTData *iface) { ICOM_THIS_From_IROTData(IMoniker, iface); - Print(MAX_TRACE, ("(%p)\n",iface)); + TRACE("(%p)\n",iface); return AntiMonikerImpl_AddRef(This); } @@ -597,8 +624,8 @@ ULONG WINAPI AntiMonikerROTDataImpl_AddRef(IROTData *iface) ULONG WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface) { ICOM_THIS_From_IROTData(IMoniker, iface); - - Print(MAX_TRACE, ("(%p)\n",iface)); + + TRACE("(%p)\n",iface); return AntiMonikerImpl_Release(This); } @@ -611,20 +638,20 @@ HRESULT WINAPI AntiMonikerROTDataImpl_GetComparaisonData(IROTData* iface, ULONG cbMax, ULONG* pcbData) { - Print(MIN_TRACE, ("(),stub!\n")); + FIXME("(),stub!\n"); return E_NOTIMPL; } /****************************************************************************** - * CreateAntiMoniker [OLE.55] + * CreateAntiMoniker [OLE32.@] ******************************************************************************/ HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk) { AntiMonikerImpl* newAntiMoniker = 0; HRESULT hr = S_OK; IID riid=IID_IMoniker; - - Print(MAX_TRACE, ("(%p)\n",ppmk)); + + TRACE("(%p)\n",ppmk); newAntiMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(AntiMonikerImpl)); diff --git a/reactos/lib/ole32/bindctx.c b/reactos/lib/ole32/bindctx.c index 1a6e24e4d93..d79e6d29524 100644 --- a/reactos/lib/ole32/bindctx.c +++ b/reactos/lib/ole32/bindctx.c @@ -2,20 +2,39 @@ * BindCtx implementation * * Copyright 1999 Noomen Hamza + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************************/ +#include #include +#include +#ifdef __REACTOS__ +#include +#endif +#include "winerror.h" +#include "windef.h" +#include "winbase.h" +#include "wine/unicode.h" +#include "objbase.h" +#include "wine/debug.h" -#include -#include -#include -#include - -#include - +WINE_DEFAULT_DEBUG_CHANNEL(ole); /* represent the first size table and it's increment block size */ -#define BLOCK_TAB_SIZE 10 +#define BLOCK_TAB_SIZE 10 #define MAX_TAB_SIZE 0xFFFFFFFF /* data structure of the BindCtx table elements */ @@ -33,7 +52,7 @@ typedef struct BindCtxObject{ typedef struct BindCtxImpl{ ICOM_VFIELD(IBindCtx); /* VTable relative to the IBindCtx interface.*/ - + ULONG ref; /* reference counter for this object */ BindCtxObject* bindCtxTable; /* this is a table in which all bounded objects are stored*/ @@ -54,8 +73,8 @@ static ULONG WINAPI BindCtxImpl_Release(IBindCtx* iface); static HRESULT WINAPI BindCtxImpl_RegisterObjectBound(IBindCtx* iface,IUnknown* punk); static HRESULT WINAPI BindCtxImpl_RevokeObjectBound(IBindCtx* iface, IUnknown* punk); static HRESULT WINAPI BindCtxImpl_ReleaseBoundObjects(IBindCtx* iface); -static HRESULT WINAPI BindCtxImpl_SetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts); -static HRESULT WINAPI BindCtxImpl_GetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts); +static HRESULT WINAPI BindCtxImpl_SetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts); +static HRESULT WINAPI BindCtxImpl_GetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts); static HRESULT WINAPI BindCtxImpl_GetRunningObjectTable(IBindCtx* iface,IRunningObjectTable** pprot); static HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown* punk); static HRESULT WINAPI BindCtxImpl_GetObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown** punk); @@ -92,12 +111,12 @@ HRESULT WINAPI BindCtxImpl_QueryInterface(IBindCtx* iface,REFIID riid,void** ppv { ICOM_THIS(BindCtxImpl,iface); - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,riid,ppvObject)); + TRACE("(%p,%p,%p)\n",This,riid,ppvObject); /* Perform a sanity check on the parameters.*/ if ( (This==0) || (ppvObject==0) ) return E_INVALIDARG; - + /* Initialize the return parameter.*/ *ppvObject = 0; @@ -111,7 +130,7 @@ HRESULT WINAPI BindCtxImpl_QueryInterface(IBindCtx* iface,REFIID riid,void** ppv /* Check that we obtained an interface.*/ if ((*ppvObject)==0) return E_NOINTERFACE; - + /* Query Interface always increases the reference count by one when it is successful */ BindCtxImpl_AddRef(iface); @@ -125,7 +144,7 @@ ULONG WINAPI BindCtxImpl_AddRef(IBindCtx* iface) { ICOM_THIS(BindCtxImpl,iface); - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); return ++(This->ref); } @@ -137,7 +156,7 @@ ULONG WINAPI BindCtxImpl_Release(IBindCtx* iface) { ICOM_THIS(BindCtxImpl,iface); - Print(MAX_TRACE, ("(%p)\n",This);) + TRACE("(%p)\n",This); This->ref--; @@ -150,7 +169,7 @@ ULONG WINAPI BindCtxImpl_Release(IBindCtx* iface) return 0; } - return This->ref;; + return This->ref; } @@ -159,10 +178,10 @@ ULONG WINAPI BindCtxImpl_Release(IBindCtx* iface) *******************************************************************************/ HRESULT WINAPI BindCtxImpl_Construct(BindCtxImpl* This) { - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); /* Initialize the virtual function table.*/ - ICOM_VTBL(This) = &VT_BindCtxImpl; + This->lpVtbl = &VT_BindCtxImpl; This->ref = 0; /* Initialize the BIND_OPTS2 structure */ @@ -192,7 +211,7 @@ HRESULT WINAPI BindCtxImpl_Construct(BindCtxImpl* This) *******************************************************************************/ HRESULT WINAPI BindCtxImpl_Destroy(BindCtxImpl* This) { - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); /* free the table space memory */ HeapFree(GetProcessHeap(),0,This->bindCtxTable); @@ -209,31 +228,28 @@ HRESULT WINAPI BindCtxImpl_Destroy(BindCtxImpl* This) ******************************************************************************/ HRESULT WINAPI BindCtxImpl_RegisterObjectBound(IBindCtx* iface,IUnknown* punk) { - ICOM_THIS(BindCtxImpl,iface); DWORD lastIndex=This->bindCtxTableLastIndex; - BindCtxObject cell; - Print(MAX_TRACE, ("(%p,%p)\n",This,punk)); + TRACE("(%p,%p)\n",This,punk); if (punk==NULL) return E_POINTER; - + IUnknown_AddRef(punk); - + /* put the object in the first free element in the table */ This->bindCtxTable[lastIndex].pObj = punk; This->bindCtxTable[lastIndex].pkeyObj = NULL; This->bindCtxTable[lastIndex].regType = 0; - cell=This->bindCtxTable[lastIndex]; lastIndex= ++This->bindCtxTableLastIndex; if (lastIndex == This->bindCtxTableSize){ /* the table is full so it must be resized */ if (This->bindCtxTableSize > (MAX_TAB_SIZE-BLOCK_TAB_SIZE)){ - Print(MIN_TRACE, ("This->bindCtxTableSize: %ld is out of data limite \n",This->bindCtxTableSize)); + FIXME("This->bindCtxTableSize: %ld is out of data limite \n",This->bindCtxTableSize); return E_FAIL; -} + } This->bindCtxTableSize+=BLOCK_TAB_SIZE; /* new table size */ @@ -254,19 +270,21 @@ HRESULT WINAPI BindCtxImpl_RevokeObjectBound(IBindCtx* iface, IUnknown* punk) ICOM_THIS(BindCtxImpl,iface); - Print(MAX_TRACE, ("(%p,%p)\n",This,punk)); + TRACE("(%p,%p)\n",This,punk); /* check if the object was registred or not */ if (BindCtxImpl_GetObjectIndex(This,punk,NULL,&index)==S_FALSE) - return MK_E_NOTBOUND; - IUnknown_Release(This->bindCtxTable[index].pObj); + if(This->bindCtxTable[index].pObj) + IUnknown_Release(This->bindCtxTable[index].pObj); + if(This->bindCtxTable[index].pkeyObj) + HeapFree(GetProcessHeap(),0,This->bindCtxTable[index].pkeyObj); /* left-shift all elements in the right side of the current revoked object */ for(j=index; jbindCtxTableLastIndex-1; j++) This->bindCtxTable[j]= This->bindCtxTable[j+1]; - + This->bindCtxTableLastIndex--; return S_OK; @@ -281,11 +299,16 @@ HRESULT WINAPI BindCtxImpl_ReleaseBoundObjects(IBindCtx* iface) ICOM_THIS(BindCtxImpl,iface); - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); for(i=0;ibindCtxTableLastIndex;i++) - IUnknown_Release(This->bindCtxTable[i].pObj); - + { + if(This->bindCtxTable[i].pObj) + IUnknown_Release(This->bindCtxTable[i].pObj); + if(This->bindCtxTable[i].pkeyObj) + HeapFree(GetProcessHeap(),0,This->bindCtxTable[i].pkeyObj); + } + This->bindCtxTableLastIndex = 0; return S_OK; @@ -294,18 +317,18 @@ HRESULT WINAPI BindCtxImpl_ReleaseBoundObjects(IBindCtx* iface) /****************************************************************************** * BindCtx_SetBindOptions ******************************************************************************/ -HRESULT WINAPI BindCtxImpl_SetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts) +HRESULT WINAPI BindCtxImpl_SetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts) { ICOM_THIS(BindCtxImpl,iface); - Print(MAX_TRACE, ("(%p,%p)\n",This,pbindopts)); + TRACE("(%p,%p)\n",This,pbindopts); if (pbindopts==NULL) return E_POINTER; - + if (pbindopts->cbStruct > sizeof(BIND_OPTS2)) { - Print(MID_TRACE, ("invalid size\n")); + WARN("invalid size\n"); return E_INVALIDARG; /* FIXME : not verified */ } memcpy(&This->bindOption2, pbindopts, pbindopts->cbStruct); @@ -315,18 +338,18 @@ HRESULT WINAPI BindCtxImpl_SetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts /****************************************************************************** * BindCtx_GetBindOptions ******************************************************************************/ -HRESULT WINAPI BindCtxImpl_GetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts) +HRESULT WINAPI BindCtxImpl_GetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts) { ICOM_THIS(BindCtxImpl,iface); - Print(MAX_TRACE, ("(%p,%p)\n",This,pbindopts)); + TRACE("(%p,%p)\n",This,pbindopts); if (pbindopts==NULL) return E_POINTER; if (pbindopts->cbStruct > sizeof(BIND_OPTS2)) { - Print(MID_TRACE, ("invalid size\n")); + WARN("invalid size\n"); return E_INVALIDARG; /* FIXME : not verified */ } memcpy(pbindopts, &This->bindOption2, pbindopts->cbStruct); @@ -342,11 +365,11 @@ HRESULT WINAPI BindCtxImpl_GetRunningObjectTable(IBindCtx* iface,IRunningObjectT ICOM_THIS(BindCtxImpl,iface); - Print(MAX_TRACE, ("(%p,%p)\n",This,pprot)); + TRACE("(%p,%p)\n",This,pprot); if (pprot==NULL) return E_POINTER; - + res=GetRunningObjectTable(0, pprot); return res; @@ -357,15 +380,23 @@ HRESULT WINAPI BindCtxImpl_GetRunningObjectTable(IBindCtx* iface,IRunningObjectT ******************************************************************************/ HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown* punk) { + DWORD index=0; ICOM_THIS(BindCtxImpl,iface); - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,pszkey,punk)); + TRACE("(%p,%s,%p)\n",This,debugstr_w(pszkey),punk); if (punk==NULL) return E_INVALIDARG; - - IUnknown_AddRef(punk); + if (pszkey!=NULL && BindCtxImpl_GetObjectIndex(This,NULL,pszkey,&index)==S_OK) + { + TRACE("Overwriting existing key\n"); + if(This->bindCtxTable[index].pObj!=NULL) + IUnknown_Release(This->bindCtxTable[index].pObj); + This->bindCtxTable[index].pObj=punk; + IUnknown_AddRef(punk); + return S_OK; + } This->bindCtxTable[This->bindCtxTableLastIndex].pObj = punk; This->bindCtxTable[This->bindCtxTableLastIndex].regType = 1; @@ -380,17 +411,17 @@ HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey, if (This->bindCtxTable[This->bindCtxTableLastIndex].pkeyObj==NULL) return E_OUTOFMEMORY; - lstrcpyW(This->bindCtxTable[This->bindCtxTableLastIndex].pkeyObj,pszkey); -} + strcpyW(This->bindCtxTable[This->bindCtxTableLastIndex].pkeyObj,pszkey); + } This->bindCtxTableLastIndex++; - + if (This->bindCtxTableLastIndex == This->bindCtxTableSize){ /* table is full ! must be resized */ This->bindCtxTableSize+=BLOCK_TAB_SIZE; /* new table size */ if (This->bindCtxTableSize > (MAX_TAB_SIZE-BLOCK_TAB_SIZE)){ - Print(MIN_TRACE, ("This->bindCtxTableSize: %ld is out of data limite \n",This->bindCtxTableSize)); + FIXME("This->bindCtxTableSize: %ld is out of data limite \n",This->bindCtxTableSize); return E_FAIL; } This->bindCtxTable = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,This->bindCtxTable, @@ -398,8 +429,10 @@ HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey, if (!This->bindCtxTable) return E_OUTOFMEMORY; } + IUnknown_AddRef(punk); return S_OK; } + /****************************************************************************** * BindCtx_GetObjectParam ******************************************************************************/ @@ -408,18 +441,18 @@ HRESULT WINAPI BindCtxImpl_GetObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnkn DWORD index; ICOM_THIS(BindCtxImpl,iface); - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,pszkey,punk)); + TRACE("(%p,%s,%p)\n",This,debugstr_w(pszkey),punk); if (punk==NULL) return E_POINTER; *punk=0; - + if (BindCtxImpl_GetObjectIndex(This,NULL,pszkey,&index)==S_FALSE) return E_FAIL; IUnknown_AddRef(This->bindCtxTable[index].pObj); - + *punk = This->bindCtxTable[index].pObj; return S_OK; @@ -434,18 +467,21 @@ HRESULT WINAPI BindCtxImpl_RevokeObjectParam(IBindCtx* iface,LPOLESTR ppenum) ICOM_THIS(BindCtxImpl,iface); - Print(MAX_TRACE, ("(%p,%p)\n",This,ppenum)); + TRACE("(%p,%s)\n",This,debugstr_w(ppenum)); if (BindCtxImpl_GetObjectIndex(This,NULL,ppenum,&index)==S_FALSE) return E_FAIL; /* release the object if it's found */ - IUnknown_Release(This->bindCtxTable[index].pObj); + if(This->bindCtxTable[index].pObj) + IUnknown_Release(This->bindCtxTable[index].pObj); + if(This->bindCtxTable[index].pkeyObj) + HeapFree(GetProcessHeap(),0,This->bindCtxTable[index].pkeyObj); /* remove the object from the table with a left-shifting of all objects in the right side */ for(j=index; jbindCtxTableLastIndex-1; j++) This->bindCtxTable[j]= This->bindCtxTable[j+1]; - + This->bindCtxTableLastIndex--; return S_OK; @@ -456,7 +492,7 @@ HRESULT WINAPI BindCtxImpl_RevokeObjectParam(IBindCtx* iface,LPOLESTR ppenum) ******************************************************************************/ HRESULT WINAPI BindCtxImpl_EnumObjectParam(IBindCtx* iface,IEnumString** pszkey) { - UNIMPLEMENTED; + FIXME("(%p,%p),stub!\n",iface,pszkey); return E_NOTIMPL; } @@ -471,8 +507,8 @@ HRESULT WINAPI BindCtxImpl_GetObjectIndex(BindCtxImpl* This, DWORD i; BYTE found=0; - - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",This,punk,pszkey,index)); + + TRACE("(%p,%p,%p,%p)\n",This,punk,pszkey,index); if (punk==NULL) /* search object identified by a register key */ @@ -501,8 +537,8 @@ HRESULT WINAPI BindCtxImpl_GetObjectIndex(BindCtxImpl* This, if (found) return S_OK; - else - return S_FALSE; + TRACE("key not found\n"); + return S_FALSE; } /****************************************************************************** @@ -510,12 +546,12 @@ HRESULT WINAPI BindCtxImpl_GetObjectIndex(BindCtxImpl* This, ******************************************************************************/ HRESULT WINAPI CreateBindCtx16(DWORD reserved, LPBC * ppbc) { - UNIMPLEMENTED; + FIXME("(%ld,%p),stub!\n",reserved,ppbc); return E_NOTIMPL; } /****************************************************************************** - * CreateBindCtx + * CreateBindCtx (OLE32.@) ******************************************************************************/ HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC * ppbc) { @@ -523,7 +559,7 @@ HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC * ppbc) HRESULT hr; IID riid=IID_IBindCtx; - Print(MAX_TRACE, ("(%ld,%p)\n",reserved,ppbc)); + TRACE("(%ld,%p)\n",reserved,ppbc); newBindCtx = HeapAlloc(GetProcessHeap(), 0, sizeof(BindCtxImpl)); @@ -542,3 +578,16 @@ HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC * ppbc) return hr; } + +HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID riid, LPVOID * ppvResult) +{ + HRESULT res; + IBindCtx * pbc; + + TRACE("(%p, %lx, %s, %p)\n", pmk, grfOpt, debugstr_guid(riid), ppvResult); + + res = CreateBindCtx(grfOpt, &pbc); + if (SUCCEEDED(res)) + res = IMoniker_BindToObject(pmk, pbc, NULL, riid, ppvResult); + return res; +} diff --git a/reactos/lib/ole32/clipboard.c b/reactos/lib/ole32/clipboard.c new file mode 100644 index 00000000000..0673b9fcfbd --- /dev/null +++ b/reactos/lib/ole32/clipboard.c @@ -0,0 +1,1789 @@ +/* + * OLE 2 clipboard support + * + * Copyright 1999 Noel Borthwick + * Copyright 2000 Abey George + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * NOTES: + * This file contains the implementation for the OLE Clipboard and its + * internal interfaces. The OLE clipboard interacts with an IDataObject + * interface via the OleSetClipboard, OleGetClipboard and + * OleIsCurrentClipboard API's. An internal IDataObject delegates + * to a client supplied IDataObject or the WIN32 clipboard API depending + * on whether OleSetClipboard has been invoked. + * Here are some operating scenarios: + * + * 1. OleSetClipboard called: In this case the internal IDataObject + * delegates to the client supplied IDataObject. Additionally OLE takes + * ownership of the Windows clipboard and any HGLOCBAL IDataObject + * items are placed on the Windows clipboard. This allows non OLE aware + * applications to access these. A local WinProc fields WM_RENDERFORMAT + * and WM_RENDERALLFORMATS messages in this case. + * + * 2. OleGetClipboard called without previous OleSetClipboard. Here the internal + * IDataObject functionality wraps around the WIN32 clipboard API. + * + * 3. OleGetClipboard called after previous OleSetClipboard. Here the internal + * IDataObject delegates to the source IDataObjects functionality directly, + * thereby bypassing the Windows clipboard. + * + * Implementation references : Inside OLE 2'nd edition by Kraig Brockschmidt + * + * TODO: + * - Support for pasting between different processes. OLE clipboard support + * currently works only for in process copy and paste. Since we internally + * store a pointer to the source's IDataObject and delegate to that, this + * will fail if the IDataObject client belongs to a different process. + * - IDataObject::GetDataHere is not implemented + * - OleFlushClipboard needs to additionally handle TYMED_IStorage media + * by copying the storage into global memory. Subsequently the default + * data object exposed through OleGetClipboard must convert this TYMED_HGLOBAL + * back to TYMED_IStorage. + * - OLE1 compatibility formats to be synthesized from OLE2 formats and put on + * clipboard in OleSetClipboard. + * + */ + +#include +#include +#include + +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winerror.h" +#include "winnls.h" +#include "ole2.h" +#include "wine/debug.h" +#include "olestd.h" + +#include "storage32.h" + +#define HANDLE_ERROR(err) { hr = err; TRACE("(HRESULT=%lx)\n", (HRESULT)err); goto CLEANUP; } + +/* For CoGetMalloc (MEMCTX_TASK is currently ignored) */ +#ifndef MEMCTX_TASK + #define MEMCTX_TASK -1 +#endif + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +/**************************************************************************** + * OLEClipbrd + * DO NOT add any members before the VTables declaration! + */ +struct OLEClipbrd +{ + /* + * List all interface VTables here + */ + ICOM_VTABLE(IDataObject)* lpvtbl1; /* IDataObject VTable */ + + /* + * The hidden OLE clipboard window. This window is used as the bridge between the + * the OLE and windows clipboard API. (Windows creates one such window per process) + */ + HWND hWndClipboard; + + /* + * Pointer to the source data object (via OleSetClipboard) + */ + IDataObject* pIDataObjectSrc; + + /* + * The registered DataObject clipboard format + */ + UINT cfDataObj; + + /* + * The handle to ourself + */ + HGLOBAL hSelf; + + /* + * Reference count of this object + */ + ULONG ref; +}; + +typedef struct OLEClipbrd OLEClipbrd; + + +/**************************************************************************** +* IEnumFORMATETC implementation +* DO NOT add any members before the VTables declaration! +*/ +typedef struct +{ + /* IEnumFORMATETC VTable */ + ICOM_VFIELD(IEnumFORMATETC); + + /* IEnumFORMATETC fields */ + UINT posFmt; /* current enumerator position */ + UINT countFmt; /* number of EnumFORMATETC's in array */ + LPFORMATETC pFmt; /* array of EnumFORMATETC's */ + + /* + * Reference count of this object + */ + DWORD ref; + + /* + * IUnknown implementation of the parent data object. + */ + IUnknown* pUnkDataObj; + +} IEnumFORMATETCImpl; + +typedef struct PresentationDataHeader +{ + BYTE unknown1[28]; + DWORD dwObjectExtentX; + DWORD dwObjectExtentY; + DWORD dwSize; +} PresentationDataHeader; + +/* + * The one and only OLEClipbrd object which is created by OLEClipbrd_Initialize() + */ +static HGLOBAL hTheOleClipboard = 0; +static OLEClipbrd* theOleClipboard = NULL; + + +/* + * Prototypes for the methods of the OLEClipboard class. + */ +extern void OLEClipbrd_Initialize(); +extern void OLEClipbrd_UnInitialize(); +static OLEClipbrd* OLEClipbrd_Construct(); +static void OLEClipbrd_Destroy(OLEClipbrd* ptrToDestroy); +static HWND OLEClipbrd_CreateWindow(); +static void OLEClipbrd_DestroyWindow(HWND hwnd); +LRESULT CALLBACK OLEClipbrd_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +static HRESULT OLEClipbrd_RenderFormat( IDataObject *pIDataObject, LPFORMATETC pFormatetc ); +static HGLOBAL OLEClipbrd_GlobalDupMem( HGLOBAL hGlobalSrc ); + +/* + * Prototypes for the methods of the OLEClipboard class + * that implement IDataObject methods. + */ +static HRESULT WINAPI OLEClipbrd_IDataObject_QueryInterface( + IDataObject* iface, + REFIID riid, + void** ppvObject); +static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( + IDataObject* iface); +static ULONG WINAPI OLEClipbrd_IDataObject_Release( + IDataObject* iface); +static HRESULT WINAPI OLEClipbrd_IDataObject_GetData( + IDataObject* iface, + LPFORMATETC pformatetcIn, + STGMEDIUM* pmedium); +static HRESULT WINAPI OLEClipbrd_IDataObject_GetDataHere( + IDataObject* iface, + LPFORMATETC pformatetc, + STGMEDIUM* pmedium); +static HRESULT WINAPI OLEClipbrd_IDataObject_QueryGetData( + IDataObject* iface, + LPFORMATETC pformatetc); +static HRESULT WINAPI OLEClipbrd_IDataObject_GetCanonicalFormatEtc( + IDataObject* iface, + LPFORMATETC pformatectIn, + LPFORMATETC pformatetcOut); +static HRESULT WINAPI OLEClipbrd_IDataObject_SetData( + IDataObject* iface, + LPFORMATETC pformatetc, + STGMEDIUM* pmedium, + BOOL fRelease); +static HRESULT WINAPI OLEClipbrd_IDataObject_EnumFormatEtc( + IDataObject* iface, + DWORD dwDirection, + IEnumFORMATETC** ppenumFormatEtc); +static HRESULT WINAPI OLEClipbrd_IDataObject_DAdvise( + IDataObject* iface, + FORMATETC* pformatetc, + DWORD advf, + IAdviseSink* pAdvSink, + DWORD* pdwConnection); +static HRESULT WINAPI OLEClipbrd_IDataObject_DUnadvise( + IDataObject* iface, + DWORD dwConnection); +static HRESULT WINAPI OLEClipbrd_IDataObject_EnumDAdvise( + IDataObject* iface, + IEnumSTATDATA** ppenumAdvise); + +/* + * Prototypes for the IEnumFORMATETC methods. + */ +static LPENUMFORMATETC OLEClipbrd_IEnumFORMATETC_Construct(UINT cfmt, const FORMATETC afmt[], + LPUNKNOWN pUnkDataObj); +static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_QueryInterface(LPENUMFORMATETC iface, REFIID riid, + LPVOID* ppvObj); +static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_AddRef(LPENUMFORMATETC iface); +static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_Release(LPENUMFORMATETC iface); +static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_Next(LPENUMFORMATETC iface, ULONG celt, + FORMATETC* rgelt, ULONG* pceltFethed); +static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_Skip(LPENUMFORMATETC iface, ULONG celt); +static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_Reset(LPENUMFORMATETC iface); +static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_Clone(LPENUMFORMATETC iface, LPENUMFORMATETC* ppenum); + + +/* + * Virtual function table for the OLEClipbrd's exposed IDataObject interface + */ +static ICOM_VTABLE(IDataObject) OLEClipbrd_IDataObject_VTable = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + OLEClipbrd_IDataObject_QueryInterface, + OLEClipbrd_IDataObject_AddRef, + OLEClipbrd_IDataObject_Release, + OLEClipbrd_IDataObject_GetData, + OLEClipbrd_IDataObject_GetDataHere, + OLEClipbrd_IDataObject_QueryGetData, + OLEClipbrd_IDataObject_GetCanonicalFormatEtc, + OLEClipbrd_IDataObject_SetData, + OLEClipbrd_IDataObject_EnumFormatEtc, + OLEClipbrd_IDataObject_DAdvise, + OLEClipbrd_IDataObject_DUnadvise, + OLEClipbrd_IDataObject_EnumDAdvise +}; + +/* + * Virtual function table for IEnumFORMATETC interface + */ +static struct ICOM_VTABLE(IEnumFORMATETC) efvt = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + OLEClipbrd_IEnumFORMATETC_QueryInterface, + OLEClipbrd_IEnumFORMATETC_AddRef, + OLEClipbrd_IEnumFORMATETC_Release, + OLEClipbrd_IEnumFORMATETC_Next, + OLEClipbrd_IEnumFORMATETC_Skip, + OLEClipbrd_IEnumFORMATETC_Reset, + OLEClipbrd_IEnumFORMATETC_Clone +}; + +/* + * Name of our registered OLE clipboard window class + */ +CHAR OLEClipbrd_WNDCLASS[] = "CLIPBRDWNDCLASS"; + +/* + * If we need to store state info we can store it here. + * For now we dont need this functionality. + * +typedef struct tagClipboardWindowInfo +{ +} ClipboardWindowInfo; + */ + +/*---------------------------------------------------------------------* + * Win32 OLE clipboard API + *---------------------------------------------------------------------*/ + +/*********************************************************************** + * OleSetClipboard [OLE32.@] + * Places a pointer to the specified data object onto the clipboard, + * making the data object accessible to the OleGetClipboard function. + * + * RETURNS: + * + * S_OK IDataObject pointer placed on the clipboard + * CLIPBRD_E_CANT_OPEN OpenClipboard failed + * CLIPBRD_E_CANT_EMPTY EmptyClipboard failed + * CLIPBRD_E_CANT_CLOSE CloseClipboard failed + * CLIPBRD_E_CANT_SET SetClipboard failed + */ + +HRESULT WINAPI OleSetClipboard(IDataObject* pDataObj) +{ + HRESULT hr = S_OK; + IEnumFORMATETC* penumFormatetc = NULL; + FORMATETC rgelt; + BOOL bClipboardOpen = FALSE; +/* + HGLOBAL hDataObject = 0; + OLEClipbrd **ppDataObject; +*/ + + TRACE("(%p)\n", pDataObj); + + /* + * Make sure we have a clipboard object + */ + OLEClipbrd_Initialize(); + + /* + * If the Ole clipboard window hasn't been created yet, create it now. + */ + if ( !theOleClipboard->hWndClipboard ) + theOleClipboard->hWndClipboard = OLEClipbrd_CreateWindow(); + + if ( !theOleClipboard->hWndClipboard ) /* sanity check */ + HANDLE_ERROR( E_FAIL ); + + /* + * Open the Windows clipboard, associating it with our hidden window + */ + if ( !(bClipboardOpen = OpenClipboard(theOleClipboard->hWndClipboard)) ) + HANDLE_ERROR( CLIPBRD_E_CANT_OPEN ); + + /* + * Empty the current clipboard and make our window the clipboard owner + * NOTE: This will trigger a WM_DESTROYCLIPBOARD message + */ + if ( !EmptyClipboard() ) + HANDLE_ERROR( CLIPBRD_E_CANT_EMPTY ); + + /* + * If we are already holding on to an IDataObject first release that. + */ + if ( theOleClipboard->pIDataObjectSrc ) + { + IDataObject_Release(theOleClipboard->pIDataObjectSrc); + theOleClipboard->pIDataObjectSrc = NULL; + } + + /* + * AddRef the data object passed in and save its pointer. + * A NULL value indicates that the clipboard should be emptied. + */ + theOleClipboard->pIDataObjectSrc = pDataObj; + if ( pDataObj ) + { + IDataObject_AddRef(theOleClipboard->pIDataObjectSrc); + } + + /* + * Enumerate all HGLOBAL formats supported by the source and make + * those formats available using delayed rendering using SetClipboardData. + * Only global memory based data items may be made available to non-OLE + * applications via the standard Windows clipboard API. Data based on other + * mediums(non TYMED_HGLOBAL) can only be accessed via the Ole Clipboard API. + * + * TODO: Do we need to additionally handle TYMED_IStorage media by copying + * the storage into global memory? + */ + if ( pDataObj ) + { + if ( FAILED(hr = IDataObject_EnumFormatEtc( pDataObj, + DATADIR_GET, + &penumFormatetc ))) + { + HANDLE_ERROR( hr ); + } + + while ( S_OK == IEnumFORMATETC_Next(penumFormatetc, 1, &rgelt, NULL) ) + { + if ( rgelt.tymed == TYMED_HGLOBAL ) + { + CHAR szFmtName[80]; + TRACE("(cfFormat=%d:%s)\n", rgelt.cfFormat, + GetClipboardFormatNameA(rgelt.cfFormat, szFmtName, sizeof(szFmtName)-1) + ? szFmtName : ""); + + SetClipboardData( rgelt.cfFormat, NULL); + } + } + IEnumFORMATETC_Release(penumFormatetc); + } + + /* + * Windows additionally creates a new "DataObject" clipboard format + * and stores in on the clipboard. We could possibly store a pointer + * to our internal IDataObject interface on the clipboard. I'm not + * sure what the use of this is though. + * Enable the code below for this functionality. + */ +/* + theOleClipboard->cfDataObj = RegisterClipboardFormatA("DataObject"); + hDataObject = GlobalAlloc( GMEM_DDESHARE|GMEM_MOVEABLE|GMEM_ZEROINIT, + sizeof(OLEClipbrd *)); + if (hDataObject==0) + HANDLE_ERROR( E_OUTOFMEMORY ); + + ppDataObject = (OLEClipbrd**)GlobalLock(hDataObject); + *ppDataObject = theOleClipboard; + GlobalUnlock(hDataObject); + + if ( !SetClipboardData( theOleClipboard->cfDataObj, hDataObject ) ) + HANDLE_ERROR( CLIPBRD_E_CANT_SET ); +*/ + + hr = S_OK; + +CLEANUP: + + /* + * Close Windows clipboard (It remains associated with our window) + */ + if ( bClipboardOpen && !CloseClipboard() ) + hr = CLIPBRD_E_CANT_CLOSE; + + /* + * Release the source IDataObject if something failed + */ + if ( FAILED(hr) ) + { + if (theOleClipboard->pIDataObjectSrc) + { + IDataObject_Release(theOleClipboard->pIDataObjectSrc); + theOleClipboard->pIDataObjectSrc = NULL; + } + } + + return hr; +} + + +/*********************************************************************** + * OleGetClipboard [OLE32.@] + * Returns a pointer to our internal IDataObject which represents the conceptual + * state of the Windows clipboard. If the current clipboard already contains + * an IDataObject, our internal IDataObject will delegate to this object. + */ +HRESULT WINAPI OleGetClipboard(IDataObject** ppDataObj) +{ + HRESULT hr = S_OK; + TRACE("()\n"); + + /* + * Make sure we have a clipboard object + */ + OLEClipbrd_Initialize(); + + if (!theOleClipboard) + return E_OUTOFMEMORY; + + /* Return a reference counted IDataObject */ + hr = IDataObject_QueryInterface( (IDataObject*)&(theOleClipboard->lpvtbl1), + &IID_IDataObject, (void**)ppDataObj); + return hr; +} + +/*********************************************************************** + * OleFlushClipboard [OLE2.76] + */ + +HRESULT WINAPI OleFlushClipboard16(void) +{ + return OleFlushClipboard(); +} + + +/****************************************************************************** + * OleFlushClipboard [OLE32.@] + * Renders the data from the source IDataObject into the windows clipboard + * + * TODO: OleFlushClipboard needs to additionally handle TYMED_IStorage media + * by copying the storage into global memory. Subsequently the default + * data object exposed through OleGetClipboard must convert this TYMED_HGLOBAL + * back to TYMED_IStorage. + */ +HRESULT WINAPI OleFlushClipboard() +{ + IEnumFORMATETC* penumFormatetc = NULL; + FORMATETC rgelt; + HRESULT hr = S_OK; + BOOL bClipboardOpen = FALSE; + IDataObject* pIDataObjectSrc = NULL; + + TRACE("()\n"); + + /* + * Make sure we have a clipboard object + */ + OLEClipbrd_Initialize(); + + /* + * Already flushed or no source DataObject? Nothing to do. + */ + if (!theOleClipboard->pIDataObjectSrc) + return S_OK; + + /* + * Addref and save the source data object we are holding on to temporarily, + * since it will be released when we empty the clipboard. + */ + pIDataObjectSrc = theOleClipboard->pIDataObjectSrc; + IDataObject_AddRef(pIDataObjectSrc); + + /* + * Open the Windows clipboard + */ + if ( !(bClipboardOpen = OpenClipboard(theOleClipboard->hWndClipboard)) ) + HANDLE_ERROR( CLIPBRD_E_CANT_OPEN ); + + /* + * Empty the current clipboard + */ + if ( !EmptyClipboard() ) + HANDLE_ERROR( CLIPBRD_E_CANT_EMPTY ); + + /* + * Render all HGLOBAL formats supported by the source into + * the windows clipboard. + */ + if ( FAILED( hr = IDataObject_EnumFormatEtc( pIDataObjectSrc, + DATADIR_GET, + &penumFormatetc) )) + { + HANDLE_ERROR( hr ); + } + + while ( S_OK == IEnumFORMATETC_Next(penumFormatetc, 1, &rgelt, NULL) ) + { + if ( rgelt.tymed == TYMED_HGLOBAL ) + { + CHAR szFmtName[80]; + TRACE("(cfFormat=%d:%s)\n", rgelt.cfFormat, + GetClipboardFormatNameA(rgelt.cfFormat, szFmtName, sizeof(szFmtName)-1) + ? szFmtName : ""); + + /* + * Render the clipboard data + */ + if ( FAILED(OLEClipbrd_RenderFormat( pIDataObjectSrc, &rgelt )) ) + continue; + } + } + + IEnumFORMATETC_Release(penumFormatetc); + + /* + * Release the source data object we are holding on to + */ + IDataObject_Release(pIDataObjectSrc); + +CLEANUP: + + /* + * Close Windows clipboard (It remains associated with our window) + */ + if ( bClipboardOpen && !CloseClipboard() ) + hr = CLIPBRD_E_CANT_CLOSE; + + return hr; +} + + +/*********************************************************************** + * OleIsCurrentClipboard [OLE32.@] + */ +HRESULT WINAPI OleIsCurrentClipboard ( IDataObject *pDataObject) +{ + TRACE("()\n"); + /* + * Make sure we have a clipboard object + */ + OLEClipbrd_Initialize(); + + if (!theOleClipboard) + return E_OUTOFMEMORY; + + return (pDataObject == theOleClipboard->pIDataObjectSrc) ? S_OK : S_FALSE; +} + + +/*---------------------------------------------------------------------* + * Internal implementation methods for the OLE clipboard + *---------------------------------------------------------------------*/ + +/*********************************************************************** + * OLEClipbrd_Initialize() + * Initializes the OLE clipboard. + */ +void OLEClipbrd_Initialize() +{ + /* + * Create the clipboard if necessary + */ + if ( !theOleClipboard ) + { + TRACE("()\n"); + theOleClipboard = OLEClipbrd_Construct(); + } +} + + +/*********************************************************************** + * OLEClipbrd_UnInitialize() + * Un-Initializes the OLE clipboard + */ +void OLEClipbrd_UnInitialize() +{ + TRACE("()\n"); + /* + * Destroy the clipboard if no one holds a reference to us. + * Note that the clipboard was created with a reference count of 1. + */ + if ( theOleClipboard && (theOleClipboard->ref <= 1) ) + { + OLEClipbrd_Destroy( theOleClipboard ); + } + else + { + WARN( "() : OLEClipbrd_UnInitialize called while client holds an IDataObject reference!\n"); + } +} + + +/********************************************************* + * Construct the OLEClipbrd class. + */ +static OLEClipbrd* OLEClipbrd_Construct() +{ + OLEClipbrd* newObject = NULL; + HGLOBAL hNewObject = 0; + + /* + * Allocate space for the object. We use GlobalAlloc since we need + * an HGLOBAL to expose our DataObject as a registered clipboard type. + */ + hNewObject = GlobalAlloc( GMEM_DDESHARE|GMEM_MOVEABLE|GMEM_ZEROINIT, + sizeof(OLEClipbrd)); + if (hNewObject==0) + return NULL; + + /* + * Lock the handle for the entire lifetime of the clipboard. + */ + newObject = GlobalLock(hNewObject); + + /* + * Initialize the virtual function table. + */ + newObject->lpvtbl1 = &OLEClipbrd_IDataObject_VTable; + + /* + * Start with one reference count. The caller of this function + * must release the interface pointer when it is done. + */ + newObject->ref = 1; + + newObject->hSelf = hNewObject; + + /* + * The Ole clipboard is a singleton - save the global handle and pointer + */ + theOleClipboard = newObject; + hTheOleClipboard = hNewObject; + + return theOleClipboard; +} + +static void OLEClipbrd_Destroy(OLEClipbrd* ptrToDestroy) +{ + TRACE("()\n"); + + if ( !ptrToDestroy ) + return; + + /* + * Destroy the Ole clipboard window + */ + if ( ptrToDestroy->hWndClipboard ) + OLEClipbrd_DestroyWindow(ptrToDestroy->hWndClipboard); + + /* + * Free the actual OLE Clipboard structure. + */ + TRACE("() - Destroying clipboard data object.\n"); + GlobalUnlock(ptrToDestroy->hSelf); + GlobalFree(ptrToDestroy->hSelf); + + /* + * The Ole clipboard is a singleton (ptrToDestroy == theOleClipboard) + */ + theOleClipboard = NULL; + hTheOleClipboard = 0; +} + + +/*********************************************************************** + * OLEClipbrd_CreateWindow() + * Create the clipboard window + */ +static HWND OLEClipbrd_CreateWindow() +{ + HWND hwnd = 0; + WNDCLASSEXA wcex; + + /* + * Register the clipboard window class if necessary + */ + ZeroMemory( &wcex, sizeof(WNDCLASSEXA)); + + wcex.cbSize = sizeof(WNDCLASSEXA); + /* Windows creates this class with a style mask of 0 + * We dont bother doing this since the FindClassByAtom code + * would have to be changed to deal with this idiosyncracy. */ + wcex.style = CS_GLOBALCLASS; + wcex.lpfnWndProc = (WNDPROC)OLEClipbrd_WndProc; + wcex.hInstance = 0; + wcex.lpszClassName = OLEClipbrd_WNDCLASS; + + RegisterClassExA(&wcex); + + /* + * Create a hidden window to receive OLE clipboard messages + */ + +/* + * If we need to store state info we can store it here. + * For now we dont need this functionality. + * ClipboardWindowInfo clipboardInfo; + * ZeroMemory( &trackerInfo, sizeof(ClipboardWindowInfo)); + */ + + hwnd = CreateWindowA(OLEClipbrd_WNDCLASS, + "ClipboardWindow", + WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + 0, + 0, + 0, + 0 /*(LPVOID)&clipboardInfo */); + + return hwnd; +} + +/*********************************************************************** + * OLEClipbrd_DestroyWindow(HWND) + * Destroy the clipboard window and unregister its class + */ +static void OLEClipbrd_DestroyWindow(HWND hwnd) +{ + /* + * Destroy clipboard window and unregister its WNDCLASS + */ + DestroyWindow(hwnd); + UnregisterClassA( OLEClipbrd_WNDCLASS, 0 ); +} + +/*********************************************************************** + * OLEClipbrd_WndProc(HWND, unsigned, WORD, LONG) + * Processes messages sent to the OLE clipboard window. + * Note that we will intercept messages in our WndProc only when data + * has been placed in the clipboard via OleSetClipboard(). + * i.e. Only when OLE owns the windows clipboard. + */ +LRESULT CALLBACK OLEClipbrd_WndProc + (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + /* + * WM_RENDERFORMAT + * We receive this message to allow us to handle delayed rendering of + * a specific clipboard format when an application requests data in + * that format by calling GetClipboardData. + * (Recall that in OleSetClipboard, we used SetClipboardData to + * make all HGLOBAL formats supported by the source IDataObject + * available using delayed rendering) + * On receiving this mesage we must actually render the data in the + * specified format and place it on the clipboard by calling the + * SetClipboardData function. + */ + case WM_RENDERFORMAT: + { + FORMATETC rgelt; + + ZeroMemory( &rgelt, sizeof(FORMATETC)); + + /* + * Initialize FORMATETC to a Windows clipboard friendly format + */ + rgelt.cfFormat = (UINT) wParam; + rgelt.dwAspect = DVASPECT_CONTENT; + rgelt.lindex = -1; + rgelt.tymed = TYMED_HGLOBAL; + + TRACE("(): WM_RENDERFORMAT(cfFormat=%d)\n", rgelt.cfFormat); + + /* + * Render the clipboard data. + * (We must have a source data object or we wouldn't be in this WndProc) + */ + OLEClipbrd_RenderFormat( (IDataObject*)&(theOleClipboard->lpvtbl1), &rgelt ); + + break; + } + + /* + * WM_RENDERALLFORMATS + * Sent before the clipboard owner window is destroyed. + * We should receive this message only when OleUninitialize is called + * while we have an IDataObject in the clipboard. + * For the content of the clipboard to remain available to other + * applications, we must render data in all the formats the source IDataObject + * is capable of generating, and place the data on the clipboard by calling + * SetClipboardData. + */ + case WM_RENDERALLFORMATS: + { + IEnumFORMATETC* penumFormatetc = NULL; + FORMATETC rgelt; + + TRACE("(): WM_RENDERALLFORMATS\n"); + + /* + * Render all HGLOBAL formats supported by the source into + * the windows clipboard. + */ + if ( FAILED( IDataObject_EnumFormatEtc( (IDataObject*)&(theOleClipboard->lpvtbl1), + DATADIR_GET, &penumFormatetc) ) ) + { + WARN("(): WM_RENDERALLFORMATS failed to retrieve EnumFormatEtc!\n"); + return 0; + } + + while ( S_OK == IEnumFORMATETC_Next(penumFormatetc, 1, &rgelt, NULL) ) + { + if ( rgelt.tymed == TYMED_HGLOBAL ) + { + /* + * Render the clipboard data. + */ + if ( FAILED(OLEClipbrd_RenderFormat( (IDataObject*)&(theOleClipboard->lpvtbl1), &rgelt )) ) + continue; + + TRACE("(): WM_RENDERALLFORMATS(cfFormat=%d)\n", rgelt.cfFormat); + } + } + + IEnumFORMATETC_Release(penumFormatetc); + + break; + } + + /* + * WM_DESTROYCLIPBOARD + * This is sent by EmptyClipboard before the clipboard is emptied. + * We should release any IDataObject we are holding onto when we receive + * this message, since it indicates that the OLE clipboard should be empty + * from this point on. + */ + case WM_DESTROYCLIPBOARD: + { + TRACE("(): WM_DESTROYCLIPBOARD\n"); + /* + * Release the data object we are holding on to + */ + if ( theOleClipboard->pIDataObjectSrc ) + { + IDataObject_Release(theOleClipboard->pIDataObjectSrc); + theOleClipboard->pIDataObjectSrc = NULL; + } + break; + } + +/* + case WM_ASKCBFORMATNAME: + case WM_CHANGECBCHAIN: + case WM_DRAWCLIPBOARD: + case WM_SIZECLIPBOARD: + case WM_HSCROLLCLIPBOARD: + case WM_VSCROLLCLIPBOARD: + case WM_PAINTCLIPBOARD: +*/ + default: + return DefWindowProcA(hWnd, message, wParam, lParam); + } + + return 0; +} + +#define MAX_CLIPFORMAT_NAME 80 + +/*********************************************************************** + * OLEClipbrd_RenderFormat(LPFORMATETC) + * Render the clipboard data. Note that this call will delegate to the + * source data object. + * Note: This function assumes it is passed an HGLOBAL format to render. + */ +static HRESULT OLEClipbrd_RenderFormat(IDataObject *pIDataObject, LPFORMATETC pFormatetc) +{ + STGMEDIUM std; + HGLOBAL hDup; + HRESULT hr = S_OK; + char szFmtName[MAX_CLIPFORMAT_NAME]; + ILockBytes *ptrILockBytes = 0; + HGLOBAL hStorage = 0; + + GetClipboardFormatNameA(pFormatetc->cfFormat, szFmtName, MAX_CLIPFORMAT_NAME); + + /* If embed source */ + if (!strcmp(szFmtName, CF_EMBEDSOURCE)) + { + memset(&std, 0, sizeof(STGMEDIUM)); + std.tymed = pFormatetc->tymed = TYMED_ISTORAGE; + + hStorage = GlobalAlloc(GMEM_SHARE|GMEM_MOVEABLE, 0); + hr = CreateILockBytesOnHGlobal(hStorage, FALSE, &ptrILockBytes); + hr = StgCreateDocfileOnILockBytes(ptrILockBytes, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &std.u.pstg); + + if (FAILED(hr = IDataObject_GetDataHere(theOleClipboard->pIDataObjectSrc, pFormatetc, &std))) + { + WARN("() : IDataObject_GetDataHere failed to render clipboard data! (%lx)\n", hr); + return hr; + } + + if (1) /* check whether the presentation data is already -not- present */ + { + FORMATETC fmt2; + STGMEDIUM std2; + METAFILEPICT *mfp = 0; + + fmt2.cfFormat = CF_METAFILEPICT; + fmt2.ptd = 0; + fmt2.dwAspect = DVASPECT_CONTENT; + fmt2.lindex = -1; + fmt2.tymed = TYMED_MFPICT; + + memset(&std2, 0, sizeof(STGMEDIUM)); + std2.tymed = TYMED_MFPICT; + + /* Get the metafile picture out of it */ + + if (!FAILED(hr = IDataObject_GetData(theOleClipboard->pIDataObjectSrc, &fmt2, &std2))) + { + mfp = (METAFILEPICT *)GlobalLock(std2.u.hGlobal); + } + + if (mfp) + { + OLECHAR name[]={ 2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0}; + IStream *pStream = 0; + void *mfBits; + PresentationDataHeader pdh; + INT nSize; + CLSID clsID; + LPOLESTR strProgID; + CHAR strOleTypeName[51]; + BYTE OlePresStreamHeader [] = + { + 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }; + + nSize = GetMetaFileBitsEx(mfp->hMF, 0, NULL); + + memset(&pdh, 0, sizeof(PresentationDataHeader)); + memcpy(&pdh, OlePresStreamHeader, sizeof(OlePresStreamHeader)); + + pdh.dwObjectExtentX = mfp->xExt; + pdh.dwObjectExtentY = mfp->yExt; + pdh.dwSize = nSize; + + hr = IStorage_CreateStream(std.u.pstg, name, STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &pStream); + + hr = IStream_Write(pStream, &pdh, sizeof(PresentationDataHeader), NULL); + + mfBits = HeapAlloc(GetProcessHeap(), 0, nSize); + nSize = GetMetaFileBitsEx(mfp->hMF, nSize, mfBits); + + hr = IStream_Write(pStream, mfBits, nSize, NULL); + + IStream_Release(pStream); + + HeapFree(GetProcessHeap(), 0, mfBits); + + GlobalUnlock(std2.u.hGlobal); + + ReadClassStg(std.u.pstg, &clsID); + ProgIDFromCLSID(&clsID, &strProgID); + + WideCharToMultiByte( CP_ACP, 0, strProgID, -1, strOleTypeName, sizeof(strOleTypeName), NULL, NULL ); + OLECONVERT_CreateOleStream(std.u.pstg); + OLECONVERT_CreateCompObjStream(std.u.pstg, strOleTypeName); + } + } + } + else + { + if (FAILED(hr = IDataObject_GetData(pIDataObject, pFormatetc, &std))) + { + WARN("() : IDataObject_GetData failed to render clipboard data! (%lx)\n", hr); + return hr; + } + + /* To put a copy back on the clipboard */ + + hStorage = std.u.hGlobal; + } + + /* + * Put a copy of the rendered data back on the clipboard + */ + + if ( !(hDup = OLEClipbrd_GlobalDupMem(hStorage)) ) + HANDLE_ERROR( E_OUTOFMEMORY ); + + if ( !SetClipboardData( pFormatetc->cfFormat, hDup ) ) + { + GlobalFree(hDup); + WARN("() : Failed to set rendered clipboard data into clipboard!\n"); + } + +CLEANUP: + + ReleaseStgMedium(&std); + + return hr; +} + + +/*********************************************************************** + * OLEClipbrd_GlobalDupMem( HGLOBAL ) + * Helper method to duplicate an HGLOBAL chunk of memory + */ +static HGLOBAL OLEClipbrd_GlobalDupMem( HGLOBAL hGlobalSrc ) +{ + HGLOBAL hGlobalDest; + PVOID pGlobalSrc, pGlobalDest; + DWORD cBytes; + + if ( !hGlobalSrc ) + return 0; + + cBytes = GlobalSize(hGlobalSrc); + if ( 0 == cBytes ) + return 0; + + hGlobalDest = GlobalAlloc( GMEM_DDESHARE|GMEM_MOVEABLE, + cBytes ); + if ( !hGlobalDest ) + return 0; + + pGlobalSrc = GlobalLock(hGlobalSrc); + pGlobalDest = GlobalLock(hGlobalDest); + if ( !pGlobalSrc || !pGlobalDest ) + return 0; + + memcpy(pGlobalDest, pGlobalSrc, cBytes); + + GlobalUnlock(hGlobalSrc); + GlobalUnlock(hGlobalDest); + + return hGlobalDest; +} + + +/*---------------------------------------------------------------------* + * Implementation of the internal IDataObject interface exposed by + * the OLE clipboard. + *---------------------------------------------------------------------*/ + + +/************************************************************************ + * OLEClipbrd_IDataObject_QueryInterface (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static HRESULT WINAPI OLEClipbrd_IDataObject_QueryInterface( + IDataObject* iface, + REFIID riid, + void** ppvObject) +{ + /* + * Declare "This" pointer + */ + ICOM_THIS(OLEClipbrd, iface); + TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObject); + + /* + * Perform a sanity check on the parameters. + */ + if ( (This==0) || (ppvObject==0) ) + return E_INVALIDARG; + + /* + * Initialize the return parameter. + */ + *ppvObject = 0; + + /* + * Compare the riid with the interface IDs implemented by this object. + */ + if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) + { + *ppvObject = iface; + } + else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) + { + *ppvObject = (IDataObject*)&(This->lpvtbl1); + } + else /* We only support IUnknown and IDataObject */ + { + WARN( "() : asking for unsupported interface %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + /* + * Query Interface always increases the reference count by one when it is + * successful. + */ + IUnknown_AddRef((IUnknown*)*ppvObject); + + return S_OK; +} + +/************************************************************************ + * OLEClipbrd_IDataObject_AddRef (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( + IDataObject* iface) +{ + /* + * Declare "This" pointer + */ + ICOM_THIS(OLEClipbrd, iface); + + TRACE("(%p)->(count=%lu)\n",This, This->ref); + + This->ref++; + + return This->ref; +} + +/************************************************************************ + * OLEClipbrd_IDataObject_Release (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static ULONG WINAPI OLEClipbrd_IDataObject_Release( + IDataObject* iface) +{ + /* + * Declare "This" pointer + */ + ICOM_THIS(OLEClipbrd, iface); + + TRACE("(%p)->(count=%lu)\n",This, This->ref); + + /* + * Decrease the reference count on this object. + */ + This->ref--; + + /* + * If the reference count goes down to 0, perform suicide. + */ + if (This->ref==0) + { + OLEClipbrd_Destroy(This); + } + + return This->ref; +} + + +/************************************************************************ + * OLEClipbrd_IDataObject_GetData (IDataObject) + * + * The OLE Clipboard's implementation of this method delegates to + * a data source if there is one or wraps around the windows clipboard + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI OLEClipbrd_IDataObject_GetData( + IDataObject* iface, + LPFORMATETC pformatetcIn, + STGMEDIUM* pmedium) +{ + HANDLE hData = 0; + BOOL bClipboardOpen = FALSE; + HRESULT hr = S_OK; + LPVOID src; + + /* + * Declare "This" pointer + */ + ICOM_THIS(OLEClipbrd, iface); + + TRACE("(%p,%p,%p)\n", iface, pformatetcIn, pmedium); + + if ( !pformatetcIn || !pmedium ) + return E_INVALIDARG; + + /* + * If we have a data source placed on the clipboard (via OleSetClipboard) + * simply delegate to the source object's QueryGetData + * NOTE: This code assumes that the IDataObject is in the same address space! + * We will need to add marshalling support when Wine handles multiple processes. + */ + if ( This->pIDataObjectSrc ) + { + return IDataObject_GetData(This->pIDataObjectSrc, pformatetcIn, pmedium); + } + + if ( pformatetcIn->lindex != -1 ) + return DV_E_LINDEX; + if ( (pformatetcIn->tymed & TYMED_HGLOBAL) != TYMED_HGLOBAL ) + return DV_E_TYMED; +/* + if ( pformatetcIn->dwAspect != DVASPECT_CONTENT ) + return DV_E_DVASPECT; +*/ + + /* + * Otherwise, get the data from the windows clipboard using GetClipboardData + */ + if ( !(bClipboardOpen = OpenClipboard(theOleClipboard->hWndClipboard)) ) + HANDLE_ERROR( CLIPBRD_E_CANT_OPEN ); + + hData = GetClipboardData(pformatetcIn->cfFormat); + + /* Must make a copy of global handle returned by GetClipboardData; it + * is not valid after we call CloseClipboard + * Application is responsible for freeing the memory (Forte Agent does this) + */ + src = GlobalLock(hData); + if(src) { + LPVOID dest; + ULONG size; + HANDLE hDest; + + size = GlobalSize(hData); + hDest = GlobalAlloc(GHND, size); + dest = GlobalLock(hDest); + memcpy(dest, src, size); + GlobalUnlock(hDest); + GlobalUnlock(hData); + hData = hDest; + } + + /* + * Return the clipboard data in the storage medium structure + */ + pmedium->tymed = (hData == 0) ? TYMED_NULL : TYMED_HGLOBAL; + pmedium->u.hGlobal = (HGLOBAL)hData; + pmedium->pUnkForRelease = NULL; + + hr = S_OK; + +CLEANUP: + /* + * Close Windows clipboard + */ + if ( bClipboardOpen && !CloseClipboard() ) + hr = CLIPBRD_E_CANT_CLOSE; + + if ( FAILED(hr) ) + return hr; + return (hData == 0) ? DV_E_FORMATETC : S_OK; +} + +static HRESULT WINAPI OLEClipbrd_IDataObject_GetDataHere( + IDataObject* iface, + LPFORMATETC pformatetc, + STGMEDIUM* pmedium) +{ + FIXME(": Stub\n"); + return E_NOTIMPL; +} + +/************************************************************************ + * OLEClipbrd_IDataObject_QueryGetData (IDataObject) + * + * The OLE Clipboard's implementation of this method delegates to + * a data source if there is one or wraps around the windows clipboard + * function IsClipboardFormatAvailable() otherwise. + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI OLEClipbrd_IDataObject_QueryGetData( + IDataObject* iface, + LPFORMATETC pformatetc) +{ + /* + * Declare "This" pointer + */ + ICOM_THIS(OLEClipbrd, iface); + + TRACE("(%p, %p)\n", iface, pformatetc); + + /* + * If we have a data source placed on the clipboard (via OleSetClipboard) + * simply delegate to the source object's QueryGetData + */ + if ( This->pIDataObjectSrc ) + { + return IDataObject_QueryGetData(This->pIDataObjectSrc, pformatetc); + } + + if (!pformatetc) + return E_INVALIDARG; +/* + if ( pformatetc->dwAspect != DVASPECT_CONTENT ) + return DV_E_DVASPECT; +*/ + if ( pformatetc->lindex != -1 ) + return DV_E_LINDEX; + + /* TODO: Handle TYMED_IStorage media which were put on the clipboard + * by copying the storage into global memory. We must convert this + * TYMED_HGLOBAL back to TYMED_IStorage. + */ + if ( pformatetc->tymed != TYMED_HGLOBAL ) + return DV_E_TYMED; + + /* + * Delegate to the Windows clipboard function IsClipboardFormatAvailable + */ + return (IsClipboardFormatAvailable(pformatetc->cfFormat)) ? S_OK : DV_E_FORMATETC; +} + +/************************************************************************ + * OLEClipbrd_IDataObject_GetCanonicalFormatEtc (IDataObject) + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI OLEClipbrd_IDataObject_GetCanonicalFormatEtc( + IDataObject* iface, + LPFORMATETC pformatectIn, + LPFORMATETC pformatetcOut) +{ + TRACE("(%p, %p, %p)\n", iface, pformatectIn, pformatetcOut); + + if ( !pformatectIn || !pformatetcOut ) + return E_INVALIDARG; + + memcpy(pformatetcOut, pformatectIn, sizeof(FORMATETC)); + return DATA_S_SAMEFORMATETC; +} + +/************************************************************************ + * OLEClipbrd_IDataObject_SetData (IDataObject) + * + * The OLE Clipboard's does not implement this method + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI OLEClipbrd_IDataObject_SetData( + IDataObject* iface, + LPFORMATETC pformatetc, + STGMEDIUM* pmedium, + BOOL fRelease) +{ + TRACE("\n"); + return E_NOTIMPL; +} + +/************************************************************************ + * OLEClipbrd_IDataObject_EnumFormatEtc (IDataObject) + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI OLEClipbrd_IDataObject_EnumFormatEtc( + IDataObject* iface, + DWORD dwDirection, + IEnumFORMATETC** ppenumFormatEtc) +{ + HRESULT hr = S_OK; + FORMATETC *afmt = NULL; + int cfmt, i; + UINT format; + BOOL bClipboardOpen; + + /* + * Declare "This" pointer + */ + ICOM_THIS(OLEClipbrd, iface); + + TRACE("(%p, %lx, %p)\n", iface, dwDirection, ppenumFormatEtc); + + /* + * If we have a data source placed on the clipboard (via OleSetClipboard) + * simply delegate to the source object's EnumFormatEtc + */ + if ( This->pIDataObjectSrc ) + { + return IDataObject_EnumFormatEtc(This->pIDataObjectSrc, + dwDirection, ppenumFormatEtc); + } + + /* + * Otherwise we must provide our own enumerator which wraps around the + * Windows clipboard function EnumClipboardFormats + */ + if ( !ppenumFormatEtc ) + return E_INVALIDARG; + + if ( dwDirection != DATADIR_GET ) /* IDataObject_SetData not implemented */ + return E_NOTIMPL; + + /* + * Store all current clipboard formats in an array of FORMATETC's, + * and create an IEnumFORMATETC enumerator from this list. + */ + cfmt = CountClipboardFormats(); + afmt = (FORMATETC *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(FORMATETC) * cfmt); + /* + * Open the Windows clipboard, associating it with our hidden window + */ + if ( !(bClipboardOpen = OpenClipboard(This->hWndClipboard)) ) + HANDLE_ERROR( CLIPBRD_E_CANT_OPEN ); + + /* + * Store all current clipboard formats in an array of FORMATETC's + * TODO: Handle TYMED_IStorage media which were put on the clipboard + * by copying the storage into global memory. We must convert this + * TYMED_HGLOBAL back to TYMED_IStorage. + */ + for (i = 0, format = 0; i < cfmt; i++) + { + format = EnumClipboardFormats(format); + if (!format) /* Failed! */ + { + ERR("EnumClipboardFormats failed to return format!\n"); + HANDLE_ERROR( E_FAIL ); + } + + /* Init the FORMATETC struct */ + afmt[i].cfFormat = format; + afmt[i].ptd = NULL; + afmt[i].dwAspect = DVASPECT_CONTENT; + afmt[i].lindex = -1; + afmt[i].tymed = TYMED_HGLOBAL; + } + + /* + * Create an EnumFORMATETC enumerator and return an + * EnumFORMATETC after bumping up its ref count + */ + *ppenumFormatEtc = OLEClipbrd_IEnumFORMATETC_Construct( cfmt, afmt, (LPUNKNOWN)iface); + if (!(*ppenumFormatEtc)) + HANDLE_ERROR( E_OUTOFMEMORY ); + + if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenumFormatEtc))) + HANDLE_ERROR( hr ); + + hr = S_OK; + +CLEANUP: + /* + * Free the array of FORMATETC's + */ + if (afmt) + HeapFree(GetProcessHeap(), 0, afmt); + + /* + * Close Windows clipboard + */ + if ( bClipboardOpen && !CloseClipboard() ) + hr = CLIPBRD_E_CANT_CLOSE; + + return hr; +} + +/************************************************************************ + * OLEClipbrd_IDataObject_DAdvise (IDataObject) + * + * The OLE Clipboard's does not implement this method + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI OLEClipbrd_IDataObject_DAdvise( + IDataObject* iface, + FORMATETC* pformatetc, + DWORD advf, + IAdviseSink* pAdvSink, + DWORD* pdwConnection) +{ + TRACE("\n"); + return E_NOTIMPL; +} + +/************************************************************************ + * OLEClipbrd_IDataObject_DUnadvise (IDataObject) + * + * The OLE Clipboard's does not implement this method + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI OLEClipbrd_IDataObject_DUnadvise( + IDataObject* iface, + DWORD dwConnection) +{ + TRACE("\n"); + return E_NOTIMPL; +} + +/************************************************************************ + * OLEClipbrd_IDataObject_EnumDAdvise (IDataObject) + * + * The OLE Clipboard does not implement this method + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI OLEClipbrd_IDataObject_EnumDAdvise( + IDataObject* iface, + IEnumSTATDATA** ppenumAdvise) +{ + TRACE("\n"); + return E_NOTIMPL; +} + + +/*---------------------------------------------------------------------* + * Implementation of the internal IEnumFORMATETC interface returned by + * the OLE clipboard's IDataObject. + *---------------------------------------------------------------------*/ + +/************************************************************************ + * OLEClipbrd_IEnumFORMATETC_Construct (UINT, const FORMATETC, LPUNKNOWN) + * + * Creates an IEnumFORMATETC enumerator from an array of FORMATETC + * Structures. pUnkOuter is the outer unknown for reference counting only. + * NOTE: this does not AddRef the interface. + */ + +LPENUMFORMATETC OLEClipbrd_IEnumFORMATETC_Construct(UINT cfmt, const FORMATETC afmt[], + LPUNKNOWN pUnkDataObj) +{ + IEnumFORMATETCImpl* ef; + DWORD size=cfmt * sizeof(FORMATETC); + LPMALLOC pIMalloc; + + ef = (IEnumFORMATETCImpl*)HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(IEnumFORMATETCImpl)); + if (!ef) + return NULL; + + ef->ref = 0; + ef->lpVtbl = &efvt; + ef->pUnkDataObj = pUnkDataObj; + + ef->posFmt = 0; + ef->countFmt = cfmt; + if (FAILED(CoGetMalloc(MEMCTX_TASK, &pIMalloc))) { + HeapFree(GetProcessHeap(), 0, ef); + return NULL; + } + ef->pFmt = (LPFORMATETC)IMalloc_Alloc(pIMalloc, size); + IMalloc_Release(pIMalloc); + + if (ef->pFmt) + memcpy(ef->pFmt, afmt, size); + + TRACE("(%p)->()\n",ef); + return (LPENUMFORMATETC)ef; +} + + +/************************************************************************ + * OLEClipbrd_IEnumFORMATETC_QueryInterface (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_QueryInterface + (LPENUMFORMATETC iface, REFIID riid, LPVOID* ppvObj) +{ + ICOM_THIS(IEnumFORMATETCImpl,iface); + + TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); + + /* + * Since enumerators are separate objects from the parent data object + * we only need to support the IUnknown and IEnumFORMATETC interfaces + */ + + *ppvObj = NULL; + + if(IsEqualIID(riid, &IID_IUnknown)) + { + *ppvObj = This; + } + else if(IsEqualIID(riid, &IID_IEnumFORMATETC)) + { + *ppvObj = (IDataObject*)This; + } + + if(*ppvObj) + { + IEnumFORMATETC_AddRef((IEnumFORMATETC*)*ppvObj); + TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); + return S_OK; + } + + TRACE("-- Interface: E_NOINTERFACE\n"); + return E_NOINTERFACE; +} + +/************************************************************************ + * OLEClipbrd_IEnumFORMATETC_AddRef (IUnknown) + * + * Since enumerating formats only makes sense when our data object is around, + * we insure that it stays as long as we stay by calling our parents IUnknown + * for AddRef and Release. But since we are not controlled by the lifetime of + * the outer object, we still keep our own reference count in order to + * free ourselves. + */ +static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_AddRef(LPENUMFORMATETC iface) +{ + ICOM_THIS(IEnumFORMATETCImpl,iface); + TRACE("(%p)->(count=%lu)\n",This, This->ref); + + if (This->pUnkDataObj) + IUnknown_AddRef(This->pUnkDataObj); + + return ++(This->ref); +} + +/************************************************************************ + * OLEClipbrd_IEnumFORMATETC_Release (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_Release(LPENUMFORMATETC iface) +{ + ICOM_THIS(IEnumFORMATETCImpl,iface); + LPMALLOC pIMalloc; + + TRACE("(%p)->(count=%lu)\n",This, This->ref); + + if (This->pUnkDataObj) + IUnknown_Release(This->pUnkDataObj); /* Release parent data object */ + + if (!--(This->ref)) + { + TRACE("() - destroying IEnumFORMATETC(%p)\n",This); + if (SUCCEEDED(CoGetMalloc(MEMCTX_TASK, &pIMalloc))) + { + IMalloc_Free(pIMalloc, This->pFmt); + IMalloc_Release(pIMalloc); + } + + HeapFree(GetProcessHeap(),0,This); + return 0; + } + + return This->ref; +} + +/************************************************************************ + * OLEClipbrd_IEnumFORMATETC_Next (IEnumFORMATETC) + * + * Standard enumerator members for IEnumFORMATETC + */ +static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_Next + (LPENUMFORMATETC iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFethed) +{ + ICOM_THIS(IEnumFORMATETCImpl,iface); + UINT cfetch; + HRESULT hres = S_FALSE; + + TRACE("(%p)->(pos=%u)\n", This, This->posFmt); + + if (This->posFmt < This->countFmt) + { + cfetch = This->countFmt - This->posFmt; + if (cfetch >= celt) + { + cfetch = celt; + hres = S_OK; + } + + memcpy(rgelt, &This->pFmt[This->posFmt], cfetch * sizeof(FORMATETC)); + This->posFmt += cfetch; + } + else + { + cfetch = 0; + } + + if (pceltFethed) + { + *pceltFethed = cfetch; + } + + return hres; +} + +/************************************************************************ + * OLEClipbrd_IEnumFORMATETC_Skip (IEnumFORMATETC) + * + * Standard enumerator members for IEnumFORMATETC + */ +static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_Skip(LPENUMFORMATETC iface, ULONG celt) +{ + ICOM_THIS(IEnumFORMATETCImpl,iface); + TRACE("(%p)->(num=%lu)\n", This, celt); + + This->posFmt += celt; + if (This->posFmt > This->countFmt) + { + This->posFmt = This->countFmt; + return S_FALSE; + } + return S_OK; +} + +/************************************************************************ + * OLEClipbrd_IEnumFORMATETC_Reset (IEnumFORMATETC) + * + * Standard enumerator members for IEnumFORMATETC + */ +static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_Reset(LPENUMFORMATETC iface) +{ + ICOM_THIS(IEnumFORMATETCImpl,iface); + TRACE("(%p)->()\n", This); + + This->posFmt = 0; + return S_OK; +} + +/************************************************************************ + * OLEClipbrd_IEnumFORMATETC_Clone (IEnumFORMATETC) + * + * Standard enumerator members for IEnumFORMATETC + */ +static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_Clone + (LPENUMFORMATETC iface, LPENUMFORMATETC* ppenum) +{ + ICOM_THIS(IEnumFORMATETCImpl,iface); + HRESULT hr = S_OK; + + TRACE("(%p)->(ppenum=%p)\n", This, ppenum); + + if ( !ppenum ) + return E_INVALIDARG; + + *ppenum = OLEClipbrd_IEnumFORMATETC_Construct(This->countFmt, + This->pFmt, + This->pUnkDataObj); + + if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenum))) + return ( hr ); + + return (*ppenum) ? S_OK : E_OUTOFMEMORY; +} diff --git a/reactos/lib/ole32/compobj.c b/reactos/lib/ole32/compobj.c index bfd7cbcedee..bb69919cfc2 100644 --- a/reactos/lib/ole32/compobj.c +++ b/reactos/lib/ole32/compobj.c @@ -5,82 +5,59 @@ * Copyright 1998 Justin Bradford * Copyright 1999 Francis Beaudet * Copyright 1999 Sylvain St-Germain + * Copyright 2002 Marcus Meissner + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include "config.h" + #include +#include +#include #include +#include -#include -#include -#include -#include +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "objbase.h" +#include "ole2.h" +#include "ole2ver.h" +#include "rpc.h" +#include "winerror.h" +#include "winreg.h" +#ifndef __REACTOS__ +#include "wownt32.h" +#endif +#include "wine/unicode.h" +#include "objbase.h" +#include "ole32_main.h" +#include "compobj_private.h" -#include +#include "wine/debug.h" -/**************************************************************************** - * COM External Lock structures and methods declaration - * - * This api provides a linked list to managed external references to - * COM objects. - * - * The public interface consists of three calls: - * COM_ExternalLockAddRef - * COM_ExternalLockRelease - * COM_ExternalLockFreeList - */ - -#define EL_END_OF_LIST 0 -#define EL_NOT_FOUND 0 - -/* - * Declaration of the static structure that manage the - * external lock to COM objects. - */ -typedef struct COM_ExternalLock COM_ExternalLock; -typedef struct COM_ExternalLockList COM_ExternalLockList; - -struct COM_ExternalLock -{ - IUnknown *pUnk; /* IUnknown referenced */ - ULONG uRefCount; /* external lock counter to IUnknown object*/ - COM_ExternalLock *next; /* Pointer to next element in list */ -}; - -struct COM_ExternalLockList -{ - COM_ExternalLock *head; /* head of list */ -}; - -/* - * Declaration and initialization of the static structure that manages - * the external lock to COM objects. - */ -static COM_ExternalLockList elList = { EL_END_OF_LIST }; - -/* - * Public Interface to the external lock list - */ -static void COM_ExternalLockFreeList(); -static void COM_ExternalLockAddRef(IUnknown *pUnk); -static void COM_ExternalLockRelease(IUnknown *pUnk, BOOL bRelAll); -void COM_ExternalLockDump(); /* testing purposes, not static to avoid warning */ - -/* - * Private methods used to managed the linked list - */ -static BOOL COM_ExternalLockInsert( - IUnknown *pUnk); - -static void COM_ExternalLockDelete( - COM_ExternalLock *element); - -static COM_ExternalLock* COM_ExternalLockFind( - IUnknown *pUnk); - -static COM_ExternalLock* COM_ExternalLockLocate( - COM_ExternalLock *element, - IUnknown *pUnk); +WINE_DEFAULT_DEBUG_CHANNEL(ole); /**************************************************************************** * This section defines variables internal to the COM module. @@ -88,18 +65,30 @@ static COM_ExternalLock* COM_ExternalLockLocate( * TODO: Most of these things will have to be made thread-safe. */ HINSTANCE COMPOBJ_hInstance32 = 0; -static int COMPOBJ_Attach = 0; -LPMALLOC currentMalloc32=NULL; +static HRESULT COM_GetRegisteredClassObject(REFCLSID rclsid, DWORD dwClsContext, LPUNKNOWN* ppUnk); +static void COM_RevokeAllClasses(); +static void COM_ExternalLockFreeList(); -WORD Table_ETask[62]; +const CLSID CLSID_StdGlobalInterfaceTable = { 0x00000323, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46} }; + +APARTMENT MTA, *apts; + +static CRITICAL_SECTION csApartment; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &csApartment, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { 0, (DWORD)(__FILE__ ": csApartment") } +}; +static CRITICAL_SECTION csApartment = { &critsect_debug, -1, 0, 0, 0, 0 }; /* * This lock count counts the number of times CoInitialize is called. It is * decreased every time CoUninitialize is called. When it hits 0, the COM * libraries are freed */ -static ULONG s_COMLockCount = 0; +static LONG s_COMLockCount = 0; /* * This linked list contains the list of registered class objects. These @@ -116,58 +105,246 @@ typedef struct tagRegisteredClass DWORD runContext; DWORD connectFlags; DWORD dwCookie; + HANDLE hThread; /* only for localserver */ struct tagRegisteredClass* nextClass; } RegisteredClass; static RegisteredClass* firstRegisteredClass = NULL; -/* this open DLL table belongs in a per process table, but my guess is that - * it shouldn't live in the kernel, so I'll put them out here in DLL - * space assuming that there is one OLE32 per process. +static CRITICAL_SECTION csRegisteredClassList; +static CRITICAL_SECTION_DEBUG class_cs_debug = +{ + 0, 0, &csRegisteredClassList, + { &class_cs_debug.ProcessLocksList, &class_cs_debug.ProcessLocksList }, + 0, 0, { 0, (DWORD)(__FILE__ ": csRegisteredClassList") } +}; +static CRITICAL_SECTION csRegisteredClassList = { &class_cs_debug, -1, 0, 0, 0, 0 }; + +/***************************************************************************** + * This section contains OpenDllList definitions + * + * The OpenDllList contains only handles of dll loaded by CoGetClassObject or + * other functions what do LoadLibrary _without_ giving back a HMODULE. + * Without this list these handles would be freed never. + * + * FIXME: a DLL what says OK whenn asked for unloading is unloaded in the + * next unload-call but not before 600 sec. */ + typedef struct tagOpenDll { - HINSTANCE hLibrary; + HINSTANCE hLibrary; struct tagOpenDll *next; } OpenDll; static OpenDll *openDllList = NULL; /* linked list of open dlls */ -/***************************************************************************** - * This section contains prototypes to internal methods for this - * module - */ -static HRESULT COM_GetRegisteredClassObject(REFCLSID rclsid, - DWORD dwClsContext, - LPUNKNOWN* ppUnk); +static CRITICAL_SECTION csOpenDllList; +static CRITICAL_SECTION_DEBUG dll_cs_debug = +{ + 0, 0, &csOpenDllList, + { &dll_cs_debug.ProcessLocksList, &dll_cs_debug.ProcessLocksList }, + 0, 0, { 0, (DWORD)(__FILE__ ": csOpenDllList") } +}; +static CRITICAL_SECTION csOpenDllList = { &dll_cs_debug, -1, 0, 0, 0, 0 }; -static void COM_RevokeAllClasses(); +static const char aptWinClass[] = "WINE_OLE32_APT_CLASS"; +static LRESULT CALLBACK COM_AptWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + +static void COMPOBJ_DLLList_Add(HANDLE hLibrary); +static void COMPOBJ_DllList_FreeUnused(int Timeout); +/****************************************************************************** + * Initialize/Unitialize threading stuff. + */ +void COMPOBJ_InitProcess( void ) +{ + WNDCLASSA wclass; + + memset(&wclass, 0, sizeof(wclass)); + wclass.lpfnWndProc = &COM_AptWndProc; + wclass.hInstance = OLE32_hInstance; + wclass.lpszClassName = aptWinClass; + RegisterClassA(&wclass); +} + +void COMPOBJ_UninitProcess( void ) +{ + UnregisterClassA(aptWinClass, OLE32_hInstance); +} + +/****************************************************************************** + * Manage apartments. + */ +static void COM_InitMTA(void) +{ + /* FIXME: how does windoze create OXIDs? + * this method will only work for local RPC */ + MTA.oxid = ((OXID)GetCurrentProcessId() << 32); + InitializeCriticalSection(&MTA.cs); +} + +static void COM_UninitMTA(void) +{ + DeleteCriticalSection(&MTA.cs); + MTA.oxid = 0; +} + +static APARTMENT* COM_CreateApartment(DWORD model) +{ + APARTMENT *apt; + + apt = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(APARTMENT)); + apt->model = model; + apt->tid = GetCurrentThreadId(); + DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), + GetCurrentProcess(), &apt->thread, + THREAD_ALL_ACCESS, FALSE, 0); + if (model & COINIT_APARTMENTTHREADED) { + /* FIXME: how does windoze create OXIDs? */ + apt->oxid = MTA.oxid | GetCurrentThreadId(); + apt->win = CreateWindowA(aptWinClass, NULL, 0, + 0, 0, 0, 0, + 0, 0, OLE32_hInstance, NULL); + InitializeCriticalSection(&apt->cs); + } + else { + apt->parent = &MTA; + apt->oxid = MTA.oxid; + } + EnterCriticalSection(&csApartment); + if (apts) apts->prev = apt; + apt->next = apts; + apts = apt; + LeaveCriticalSection(&csApartment); + NtCurrentTeb()->ReservedForOle = apt; + return apt; +} + +static void COM_DestroyApartment(APARTMENT *apt) +{ + EnterCriticalSection(&csApartment); + if (apt->prev) apt->prev->next = apt->next; + if (apt->next) apt->next->prev = apt->prev; + if (apts == apt) apts = apt->next; + apt->prev = NULL; apt->next = NULL; + LeaveCriticalSection(&csApartment); + if (apt->model & COINIT_APARTMENTTHREADED) { + if (apt->win) DestroyWindow(apt->win); + DeleteCriticalSection(&apt->cs); + } + CloseHandle(apt->thread); + HeapFree(GetProcessHeap(), 0, apt); +} + +HWND COM_GetApartmentWin(OXID oxid) +{ + APARTMENT *apt; + HWND win = 0; + + EnterCriticalSection(&csApartment); + apt = apts; + while (apt && apt->oxid != oxid) apt = apt->next; + if (apt) win = apt->win; + LeaveCriticalSection(&csApartment); + return win; +} + +static LRESULT CALLBACK COM_AptWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + return DefWindowProcA(hWnd, msg, wParam, lParam); +} + +/***************************************************************************** + * This section contains OpenDllList implemantation + */ + +static void COMPOBJ_DLLList_Add(HANDLE hLibrary) +{ + OpenDll *ptr; + OpenDll *tmp; + + TRACE("\n"); + + EnterCriticalSection( &csOpenDllList ); + + if (openDllList == NULL) { + /* empty list -- add first node */ + openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll)); + openDllList->hLibrary=hLibrary; + openDllList->next = NULL; + } else { + /* search for this dll */ + int found = FALSE; + for (ptr = openDllList; ptr->next != NULL; ptr=ptr->next) { + if (ptr->hLibrary == hLibrary) { + found = TRUE; + break; + } + } + if (!found) { + /* dll not found, add it */ + tmp = openDllList; + openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll)); + openDllList->hLibrary = hLibrary; + openDllList->next = tmp; + } + } + + LeaveCriticalSection( &csOpenDllList ); +} + +static void COMPOBJ_DllList_FreeUnused(int Timeout) +{ + OpenDll *curr, *next, *prev = NULL; + typedef HRESULT(*DllCanUnloadNowFunc)(void); + DllCanUnloadNowFunc DllCanUnloadNow; + + TRACE("\n"); + + EnterCriticalSection( &csOpenDllList ); + + for (curr = openDllList; curr != NULL; ) { + DllCanUnloadNow = (DllCanUnloadNowFunc) GetProcAddress(curr->hLibrary, "DllCanUnloadNow"); + + if ( (DllCanUnloadNow != NULL) && (DllCanUnloadNow() == S_OK) ) { + next = curr->next; + + TRACE("freeing %p\n", curr->hLibrary); + FreeLibrary(curr->hLibrary); + + HeapFree(GetProcessHeap(), 0, curr); + if (curr == openDllList) { + openDllList = next; + } else { + prev->next = next; + } + + curr = next; + } else { + prev = curr; + curr = curr->next; + } + } + + LeaveCriticalSection( &csOpenDllList ); +} + /****************************************************************************** * CoBuildVersion [COMPOBJ.1] + * CoBuildVersion [OLE32.@] * * RETURNS * Current build version, hiword is majornumber, loword is minornumber */ DWORD WINAPI CoBuildVersion(void) { - Print(MAX_TRACE, ("Returning version %d, build %d.\n", 1, 0)); - return (1<<16)+0; + TRACE("Returning version %d, build %d.\n", rmm, rup); + return (rmm<<16)+rup; } /****************************************************************************** - * CoInitialize16 [COMPOBJ.2] - * Set the win16 IMalloc used for memory management - */ -HRESULT WINAPI CoInitialize16( - LPVOID lpReserved /* [in] pointer to win16 malloc interface */ -) { - UNIMPLEMENTED; - return S_OK; -} - -/****************************************************************************** - * CoInitialize [OLE32.26] + * CoInitialize [OLE32.@] * * Initializes the COM libraries. * @@ -176,20 +353,16 @@ HRESULT WINAPI CoInitialize16( HRESULT WINAPI CoInitialize( LPVOID lpReserved /* [in] pointer to win32 malloc interface (obsolete, should be NULL) */ -) +) { -#if 0 /* * Just delegate to the newer method. */ - return CoInitializeEx(lpReserved, )COINIT_APARTMENTTHREADED); -#else - return E_FAIL; -#endif + return CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED); } /****************************************************************************** - * CoInitializeEx [OLE32.163] + * CoInitializeEx [OLE32.@] * * Initializes the COM libraries. The behavior used to set the win32 IMalloc * used for memory management is obsolete. @@ -199,77 +372,55 @@ HRESULT WINAPI CoInitialize( * S_FALSE if this function was called already. * RPC_E_CHANGED_MODE if a previous call to CoInitialize specified another * threading model. - * - * BUGS - * Only the single threaded model is supported. As a result RPC_E_CHANGED_MODE - * is never returned. - * - * See the windows documentation for more details. */ HRESULT WINAPI CoInitializeEx( LPVOID lpReserved, /* [in] pointer to win32 malloc interface (obsolete, should be NULL) */ DWORD dwCoInit /* [in] A value from COINIT specifies the threading model */ -) +) { - HRESULT hr; + HRESULT hr = S_OK; + APARTMENT *apt; - Print(MAX_TRACE, ("(%p, %x)\n", lpReserved, (int)dwCoInit)); + TRACE("(%p, %x)\n", lpReserved, (int)dwCoInit); if (lpReserved!=NULL) { - Print(MIN_TRACE, ("(%p, %x) - Bad parameter passed-in %p, must be an old Windows Application\n", lpReserved, (int)dwCoInit, lpReserved)); + ERR("(%p, %x) - Bad parameter passed-in %p, must be an old Windows Application\n", lpReserved, (int)dwCoInit, lpReserved); } - /* - * Check for unsupported features. - */ - if (dwCoInit!=COINIT_APARTMENTTHREADED) - { - Print(MAX_TRACE, (":(%p,%x): unsupported flag %x\n", lpReserved, (int)dwCoInit, (int)dwCoInit)); - /* Hope for the best and continue anyway */ - } + apt = NtCurrentTeb()->ReservedForOle; + if (apt && dwCoInit != apt->model) return RPC_E_CHANGED_MODE; + hr = apt ? S_FALSE : S_OK; /* * Check the lock count. If this is the first time going through the initialize * process, we have to initialize the libraries. + * + * And crank-up that lock count. */ - if (s_COMLockCount==0) + if (InterlockedExchangeAdd(&s_COMLockCount,1)==0) { /* * Initialize the various COM libraries and data structures. */ - Print(MAX_TRACE, ("() - Initializing the COM libraries\n")); + TRACE("() - Initializing the COM libraries\n"); + + COM_InitMTA(); RunningObjectTableImpl_Initialize(); - - hr = S_OK; } - else - hr = S_FALSE; - /* - * Crank-up that lock count. - */ - s_COMLockCount++; + if (!apt) apt = COM_CreateApartment(dwCoInit); + + InterlockedIncrement(&apt->inits); + if (hr == S_OK) NtCurrentTeb()->ReservedForOle = apt; return hr; } /*********************************************************************** - * CoUninitialize16 [COMPOBJ.3] - * Don't know what it does. - * 3-Nov-98 -- this was originally misspelled, I changed it to what I - * believe is the correct spelling - */ -void WINAPI CoUninitialize16(void) -{ - Print(MAX_TRACE, ("Called\n")); - CoFreeAllLibraries(); -} - -/*********************************************************************** - * CoUninitialize [OLE32.47] + * CoUninitialize [OLE32.@] * * This method will release the COM libraries. * @@ -277,23 +428,31 @@ void WINAPI CoUninitialize16(void) */ void WINAPI CoUninitialize(void) { - Print(MAX_TRACE, ("Called\n")); - + LONG lCOMRefCnt; + APARTMENT *apt; + + TRACE("()\n"); + + apt = NtCurrentTeb()->ReservedForOle; + if (!apt) return; + if (InterlockedDecrement(&apt->inits)==0) { + NtCurrentTeb()->ReservedForOle = NULL; + COM_DestroyApartment(apt); + apt = NULL; + } + /* * Decrease the reference count. - */ - s_COMLockCount--; - - /* * If we are back to 0 locks on the COM library, make sure we free * all the associated data structures. */ - if (s_COMLockCount==0) + lCOMRefCnt = InterlockedExchangeAdd(&s_COMLockCount,-1); + if (lCOMRefCnt==1) { /* * Release the various COM libraries and data structures. */ - Print(MAX_TRACE, ("() - Releasing the COM libraries\n")); + TRACE("() - Releasing the COM libraries\n"); RunningObjectTableImpl_UnInitialize(); /* @@ -310,93 +469,52 @@ void WINAPI CoUninitialize(void) * This will free list of external references to COM objects. */ COM_ExternalLockFreeList(); -} -} -/*********************************************************************** - * CoGetMalloc16 [COMPOBJ.4] - * RETURNS - * The current win16 IMalloc - */ -HRESULT WINAPI CoGetMalloc16( - DWORD dwMemContext, /* [in] unknown */ - PVOID lpMalloc /* [out] current win16 malloc interface */ -) { - UNIMPLEMENTED; - return S_OK; -} - -/****************************************************************************** - * CoGetMalloc [OLE32.20] - * - * RETURNS - * The current win32 IMalloc - */ -HRESULT WINAPI CoGetMalloc( - DWORD dwMemContext, /* [in] unknown */ - LPMALLOC *lpMalloc /* [out] current win32 malloc interface */ -) { -#if 0 - if(!currentMalloc32) - currentMalloc32 = IMalloc_Constructor(); - *lpMalloc = currentMalloc32; - return S_OK; -#else - UNIMPLEMENTED; - return S_OK; -#endif -} - -/*********************************************************************** - * CoCreateStandardMalloc16 [COMPOBJ.71] - */ -HRESULT WINAPI CoCreateStandardMalloc16(DWORD dwMemContext, - PVOID lpMalloc) -{ - UNIMPLEMENTED; - return S_OK; + COM_UninitMTA(); + } + else if (lCOMRefCnt<1) { + ERR( "CoUninitialize() - not CoInitialized.\n" ); + InterlockedExchangeAdd(&s_COMLockCount,1); /* restore the lock count. */ + } } /****************************************************************************** * CoDisconnectObject [COMPOBJ.15] + * CoDisconnectObject [OLE32.@] */ HRESULT WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved ) { - Print(MAX_TRACE, ("(%p, %lx)\n",lpUnk,reserved)); + TRACE("(%p, %lx)\n",lpUnk,reserved); return S_OK; } -/*********************************************************************** - * IsEqualGUID16 [COMPOBJ.18] +/****************************************************************************** + * CoCreateGuid[OLE32.@] * - * Compares two Unique Identifiers. - * - * RETURNS - * TRUE if equal */ -BOOL WINAPI IsEqualGUID16( - GUID* g1, /* [in] unique id 1 */ - GUID* g2 /* [in] unique id 2 */ +HRESULT WINAPI CoCreateGuid( + GUID *pguid /* [out] points to the GUID to initialize */ ) { - return !memcmp( g1, g2, sizeof(GUID) ); + return UuidCreate(pguid); } /****************************************************************************** - * CLSIDFromString16 [COMPOBJ.20] - * Converts a unique identifier from its string representation into + * CLSIDFromString [OLE32.@] + * IIDFromString [OLE32.@] + * Converts a unique identifier from its string representation into * the GUID struct. * - * Class id: DWORD-WORD-WORD-BYTES[2]-BYTES[6] + * UNDOCUMENTED + * If idstr is not a valid CLSID string then it gets treated as a ProgID * * RETURNS * the converted GUID */ -HRESULT WINAPI CLSIDFromString16( - LPCOLESTR16 idstr, /* [in] string representation of guid */ - CLSID *id /* [out] GUID converted from string */ -) { - BYTE *s = (BYTE *) idstr; - BYTE *p; +HRESULT WINAPI __CLSIDFromStringA( + LPCSTR idstr, /* [in] string representation of guid */ + CLSID *id) /* [out] GUID converted from string */ +{ + const BYTE *s = (BYTE *) idstr; int i; BYTE table[256]; @@ -410,18 +528,16 @@ HRESULT WINAPI CLSIDFromString16( if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') || (s[24]!='-') || (s[37]!='}')) return CO_E_CLASSSTRING; - for (i=1; i<37; i++) - { + for (i=1; i<37; i++) { if ((i == 9)||(i == 14)||(i == 19)||(i == 24)) continue; if (!(((s[i] >= '0') && (s[i] <= '9')) || ((s[i] >= 'a') && (s[i] <= 'f')) || - ((s[i] >= 'A') && (s[i] <= 'F'))) - ) + ((s[i] >= 'A') && (s[i] <= 'F')))) return CO_E_CLASSSTRING; } } - Print(MAX_TRACE, ("%s -> %p\n", s, id)); + TRACE("%s -> %p\n", s, id); /* quick lookup table */ memset(table, 0, 256); @@ -436,83 +552,46 @@ HRESULT WINAPI CLSIDFromString16( /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */ - p = (BYTE *) id; - - s++; /* skip leading brace */ - for (i = 0; i < 4; i++) { - p[3 - i] = table[*s]<<4 | table[*(s+1)]; - s += 2; - } - p += 4; - s++; /* skip - */ - - for (i = 0; i < 2; i++) { - p[1-i] = table[*s]<<4 | table[*(s+1)]; - s += 2; - } - p += 2; - s++; /* skip - */ - - for (i = 0; i < 2; i++) { - p[1-i] = table[*s]<<4 | table[*(s+1)]; - s += 2; - } - p += 2; - s++; /* skip - */ + id->Data1 = (table[s[1]] << 28 | table[s[2]] << 24 | table[s[3]] << 20 | table[s[4]] << 16 | + table[s[5]] << 12 | table[s[6]] << 8 | table[s[7]] << 4 | table[s[8]]); + id->Data2 = table[s[10]] << 12 | table[s[11]] << 8 | table[s[12]] << 4 | table[s[13]]; + id->Data3 = table[s[15]] << 12 | table[s[16]] << 8 | table[s[17]] << 4 | table[s[18]]; /* these are just sequential bytes */ - for (i = 0; i < 2; i++) { - *p++ = table[*s]<<4 | table[*(s+1)]; - s += 2; - } - s++; /* skip - */ - - for (i = 0; i < 6; i++) { - *p++ = table[*s]<<4 | table[*(s+1)]; - s += 2; - } + id->Data4[0] = table[s[20]] << 4 | table[s[21]]; + id->Data4[1] = table[s[22]] << 4 | table[s[23]]; + id->Data4[2] = table[s[25]] << 4 | table[s[26]]; + id->Data4[3] = table[s[27]] << 4 | table[s[28]]; + id->Data4[4] = table[s[29]] << 4 | table[s[30]]; + id->Data4[5] = table[s[31]] << 4 | table[s[32]]; + id->Data4[6] = table[s[33]] << 4 | table[s[34]]; + id->Data4[7] = table[s[35]] << 4 | table[s[36]]; return S_OK; } -/****************************************************************************** - * CoCreateGuid[OLE32.6] - * - */ -HRESULT WINAPI CoCreateGuid( - GUID *pguid /* [out] points to the GUID to initialize */ -) { - return UuidCreate(pguid); -} +/*****************************************************************************/ -/****************************************************************************** - * CLSIDFromString [OLE32.3] - * Converts a unique identifier from its string representation into - * the GUID struct. - * - * UNDOCUMENTED - * If idstr is not a valid CLSID string then it gets treated as a ProgID - * - * RETURNS - * the converted GUID - */ HRESULT WINAPI CLSIDFromString( +#ifdef __REACTOS__ + LPOLESTR idstr, /* [in] string representation of GUID */ +#else LPCOLESTR idstr, /* [in] string representation of GUID */ - CLSID *id /* [out] GUID represented by above string */ -) { -#if 0 - LPOLESTR16 xid = HEAP_strdupWtoA(GetProcessHeap(),0,idstr); - HRESULT ret = CLSIDFromString16(xid,id); +#endif + CLSID *id ) /* [out] GUID represented by above string */ +{ + char xid[40]; + HRESULT ret; - HeapFree(GetProcessHeap(),0,xid); + if (!WideCharToMultiByte( CP_ACP, 0, idstr, -1, xid, sizeof(xid), NULL, NULL )) + return CO_E_CLASSSTRING; + + + ret = __CLSIDFromStringA(xid,id); if(ret != S_OK) { /* It appears a ProgID is also valid */ ret = CLSIDFromProgID(idstr, id); } return ret; -#else - UNIMPLEMENTED; - return (HRESULT)0; -#endif } /****************************************************************************** @@ -524,7 +603,7 @@ HRESULT WINAPI CLSIDFromString( * RETURNS * the string representation and HRESULT */ -static HRESULT WINE_StringFromCLSID( +HRESULT WINE_StringFromCLSID( const CLSID *id, /* [in] GUID to be converted */ LPSTR idstr /* [out] pointer to buffer to contain converted guid */ ) { @@ -533,11 +612,11 @@ static HRESULT WINE_StringFromCLSID( int i; if (!id) - { Print(MIN_TRACE, ("called with id=Null\n")); + { ERR("called with id=Null\n"); *idstr = 0x00; return E_FAIL; } - + sprintf(idstr, "{%08lX-%04X-%04X-%02X%02X-", id->Data1, id->Data2, id->Data3, id->Data4[0], id->Data4[1]); @@ -552,60 +631,15 @@ static HRESULT WINE_StringFromCLSID( *s++ = '}'; *s++ = '\0'; - Print(MAX_TRACE, ("%p->%s\n", id, idstr)); + TRACE("%p->%s\n", id, idstr); return S_OK; } -/****************************************************************************** - * StringFromCLSID16 [COMPOBJ.19] - * Converts a GUID into the respective string representation. - * The target string is allocated using the OLE IMalloc. - * RETURNS - * the string representation and HRESULT - */ -HRESULT WINAPI StringFromCLSID16( - REFCLSID id, /* [in] the GUID to be converted */ - LPOLESTR16 *idstr /* [out] a pointer to a to-be-allocated segmented pointer pointing to the resulting string */ - -) { -#if 0 - extern BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, - DWORD cbArgs, LPVOID pArgs, LPDWORD pdwRetCode ); - LPMALLOC16 mllc; - HRESULT ret; - DWORD args[2]; - - ret = CoGetMalloc16(0,&mllc); - if (ret) return ret; - - args[0] = (DWORD)mllc; - args[1] = 40; - - /* No need for a Callback entry, we have WOWCallback16Ex which does - * everything we need. - */ - if (!K32WOWCallback16Ex( - (DWORD)((ICOM_VTABLE(IMalloc16)*)MapSL( - (SEGPTR)ICOM_VTBL(((LPMALLOC16)MapSL((SEGPTR)mllc)))) - )->Alloc, - WCB16_CDECL, - 2*sizeof(DWORD), - (LPVOID)args, - (LPDWORD)idstr - )) { - WARN("CallTo16 IMalloc16 failed\n"); - return E_FAIL; - } - return WINE_StringFromCLSID(id,MapSL((SEGPTR)*idstr)); -#else - UNIMPLEMENTED; - return (HRESULT)0; -#endif -} /****************************************************************************** - * StringFromCLSID [OLE32.151] + * StringFromCLSID [OLE32.@] + * StringFromIID [OLE32.@] * Converts a GUID into the respective string representation. * The target string is allocated using the OLE IMalloc. * RETURNS @@ -628,12 +662,12 @@ HRESULT WINAPI StringFromCLSID( *idstr = IMalloc_Alloc( mllc, len * sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, buf, -1, *idstr, len ); } - IMalloc_Release ( mllc ); return ret; } /****************************************************************************** - * StringFromGUID2 [COMPOBJ.76] [OLE32.152] + * StringFromGUID2 [COMPOBJ.76] + * StringFromGUID2 [OLE32.@] * * Converts a global unique identifier into a string of an API- * specified fixed format. (The usual {.....} stuff.) @@ -653,7 +687,7 @@ StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax) } /****************************************************************************** - * ProgIDFromCLSID [OLE32.133] + * ProgIDFromCLSID [OLE32.@] * Converts a class id into the respective Program ID. (By using a registry lookup) * RETURNS S_OK on success * riid associated with the progid @@ -705,11 +739,12 @@ HRESULT WINAPI ProgIDFromCLSID( } /****************************************************************************** - * CLSIDFromProgID16 [COMPOBJ.61] + * CLSIDFromProgID [COMPOBJ.61] * Converts a program id into the respective GUID. (By using a registry lookup) * RETURNS * riid associated with the progid */ +#ifndef __REACTOS__ HRESULT WINAPI CLSIDFromProgID16( LPCOLESTR16 progid, /* [in] program id as found in registry */ LPCLSID riid /* [out] associated CLSID */ @@ -732,43 +767,56 @@ HRESULT WINAPI CLSIDFromProgID16( return CO_E_CLASSSTRING; } RegCloseKey(xhkey); - return CLSIDFromString16(buf2,riid); + return __CLSIDFromStringA(buf2,riid); } +#endif /****************************************************************************** - * CLSIDFromProgID [OLE32.2] + * CLSIDFromProgID [OLE32.@] * Converts a program id into the respective GUID. (By using a registry lookup) * RETURNS * riid associated with the progid */ HRESULT WINAPI CLSIDFromProgID( LPCOLESTR progid, /* [in] program id as found in registry */ - LPCLSID riid /* [out] associated CLSID */ -) { -#if 0 - LPOLESTR16 pid = HEAP_strdupWtoA(GetProcessHeap(),0,progid); - HRESULT ret = CLSIDFromProgID16(pid,riid); + LPCLSID riid ) /* [out] associated CLSID */ +{ + static const WCHAR clsidW[] = { '\\','C','L','S','I','D',0 }; + char buf2[80]; + DWORD buf2len = sizeof(buf2); + HKEY xhkey; - HeapFree(GetProcessHeap(),0,pid); - return ret; -#else - UNIMPLEMENTED; - return (HRESULT)0; -#endif + WCHAR *buf = HeapAlloc( GetProcessHeap(),0,(strlenW(progid)+8) * sizeof(WCHAR) ); + strcpyW( buf, progid ); + strcatW( buf, clsidW ); + if (RegOpenKeyW(HKEY_CLASSES_ROOT,buf,&xhkey)) + { + HeapFree(GetProcessHeap(),0,buf); + return CO_E_CLASSSTRING; + } + HeapFree(GetProcessHeap(),0,buf); + + if (RegQueryValueA(xhkey,NULL,buf2,&buf2len)) + { + RegCloseKey(xhkey); + return CO_E_CLASSSTRING; + } + RegCloseKey(xhkey); + return __CLSIDFromStringA(buf2,riid); } /***************************************************************************** - * CoGetPSClsid [OLE32.22] + * CoGetPSClsid [OLE32.@] * * This function returns the CLSID of the DLL that implements the proxy and stub - * for the specified interface. + * for the specified interface. * - * It determines this by searching the + * It determines this by searching the * HKEY_CLASSES_ROOT\Interface\{string form of riid}\ProxyStubClsid32 in the registry * and any interface id registered by CoRegisterPSClsid within the current process. - * + * * FIXME: We only search the registry, not ids registered with CoRegisterPSClsid. */ HRESULT WINAPI CoGetPSClsid( @@ -779,7 +827,7 @@ HRESULT WINAPI CoGetPSClsid( DWORD buf2len; HKEY xhkey; - Print(MAX_TRACE, ("() riid=%s, pclsid=%p\n", PRINT_GUID(riid), pclsid)); + TRACE("() riid=%s, pclsid=%p\n", debugstr_guid(riid), pclsid); /* Get the input iid as a string */ WINE_StringFromCLSID(riid, buf2); @@ -803,7 +851,7 @@ HRESULT WINAPI CoGetPSClsid( HeapFree(GetProcessHeap(),0,buf); /* ... Once we have the key, query the registry to get the - value of CLSID as a string, and convert it into a + value of CLSID as a string, and convert it into a proper CLSID structure to be passed back to the app */ buf2len = sizeof(buf2); if ( (RegQueryValueA(xhkey,NULL,buf2,&buf2len)) ) @@ -815,25 +863,24 @@ HRESULT WINAPI CoGetPSClsid( /* We have the CLSid we want back from the registry as a string, so lets convert it into a CLSID structure */ - if ( (CLSIDFromString16(buf2,pclsid)) != NOERROR) - { + if ( (__CLSIDFromStringA(buf2,pclsid)) != NOERROR) { return E_INVALIDARG; } - Print(MAX_TRACE, ("() Returning CLSID=%s\n", PRINT_GUID(pclsid))); + TRACE ("() Returning CLSID=%s\n", debugstr_guid(pclsid)); return (S_OK); } /*********************************************************************** - * WriteClassStm + * WriteClassStm (OLE32.@) * * This function write a CLSID on stream */ HRESULT WINAPI WriteClassStm(IStream *pStm,REFCLSID rclsid) { - Print(MAX_TRACE, ("(%p,%p)\n",pStm,rclsid)); + TRACE("(%p,%p)\n",pStm,rclsid); if (rclsid==NULL) return E_INVALIDARG; @@ -842,93 +889,39 @@ HRESULT WINAPI WriteClassStm(IStream *pStm,REFCLSID rclsid) } /*********************************************************************** - * ReadClassStm + * ReadClassStm (OLE32.@) * * This function read a CLSID from a stream */ -HRESULT WINAPI ReadClassStm(IStream *pStm,REFCLSID rclsid) +HRESULT WINAPI ReadClassStm(IStream *pStm,CLSID *pclsid) { ULONG nbByte; HRESULT res; - - Print(MAX_TRACE, ("(%p,%p)\n",pStm,rclsid)); - if (rclsid==NULL) + TRACE("(%p,%p)\n",pStm,pclsid); + + if (pclsid==NULL) return E_INVALIDARG; - - res = IStream_Read(pStm,(void*)rclsid,sizeof(CLSID),&nbByte); + + res = IStream_Read(pStm,(void*)pclsid,sizeof(CLSID),&nbByte); if (FAILED(res)) return res; - + if (nbByte != sizeof(CLSID)) return S_FALSE; else return S_OK; } -/* FIXME: this function is not declared in the WINELIB headers. But where should it go ? */ -/*********************************************************************** - * LookupETask (COMPOBJ.94) - */ -HRESULT WINAPI LookupETask16(PVOID hTask,LPVOID p) { - UNIMPLEMENTED; - return S_OK; -} - -/* FIXME: this function is not declared in the WINELIB headers. But where should it go ? */ -/*********************************************************************** - * SetETask (COMPOBJ.95) - */ -HRESULT WINAPI SetETask16(DWORD hTask, LPVOID p) { - UNIMPLEMENTED; - return S_OK; -} - -/* FIXME: this function is not declared in the WINELIB headers. But where should it go ? */ -/*********************************************************************** - * CallObjectInWOW (COMPOBJ.201) - */ -HRESULT WINAPI CallObjectInWOW(LPVOID p1,LPVOID p2) { - UNIMPLEMENTED; - return 0; -} - -/****************************************************************************** - * CoRegisterClassObject16 [COMPOBJ.5] - * - * Don't know where it registers it ... - */ -HRESULT WINAPI CoRegisterClassObject16( - REFCLSID rclsid, - LPUNKNOWN pUnk, - DWORD dwClsContext, /* [in] CLSCTX flags indicating the context in which to run the executable */ - DWORD flags, /* [in] REGCLS flags indicating how connections are made */ - LPDWORD lpdwRegister -) { - UNIMPLEMENTED; - return S_OK; -} - - -/****************************************************************************** - * CoRevokeClassObject16 [COMPOBJ.6] - * - */ -HRESULT WINAPI CoRevokeClassObject16(DWORD dwRegister) /* [in] token on class obj */ -{ - UNIMPLEMENTED; - return S_OK; -} - /*** * COM_GetRegisteredClassObject * - * This internal method is used to scan the registered class list to + * This internal method is used to scan the registered class list to * find a class object. * - * Params: + * Params: * rclsid Class ID of the class to find. * dwClsContext Class context to match. * ppv [out] returns a pointer to the class object. Complying @@ -940,8 +933,11 @@ static HRESULT COM_GetRegisteredClassObject( DWORD dwClsContext, LPUNKNOWN* ppUnk) { + HRESULT hr = S_FALSE; RegisteredClass* curClass; + EnterCriticalSection( &csRegisteredClassList ); + /* * Sanity check */ @@ -971,7 +967,8 @@ static HRESULT COM_GetRegisteredClassObject( IUnknown_AddRef(curClass->classObject); - return S_OK; + hr = S_OK; + goto end; } /* @@ -980,14 +977,93 @@ static HRESULT COM_GetRegisteredClassObject( curClass = curClass->nextClass; } +end: + LeaveCriticalSection( &csRegisteredClassList ); /* * If we get to here, we haven't found our class. */ - return S_FALSE; + return hr; +} + +static DWORD WINAPI +_LocalServerThread(LPVOID param) { + HANDLE hPipe; + char pipefn[200]; + RegisteredClass *newClass = (RegisteredClass*)param; + HRESULT hres; + IStream *pStm; + STATSTG ststg; + unsigned char *buffer; + int buflen; + IClassFactory *classfac; + LARGE_INTEGER seekto; + ULARGE_INTEGER newpos; + ULONG res; + + TRACE("Starting threader for %s.\n",debugstr_guid(&newClass->classIdentifier)); + strcpy(pipefn,PIPEPREF); + WINE_StringFromCLSID(&newClass->classIdentifier,pipefn+strlen(PIPEPREF)); + + hres = IUnknown_QueryInterface(newClass->classObject,&IID_IClassFactory,(LPVOID*)&classfac); + if (hres) return hres; + + hres = CreateStreamOnHGlobal(0,TRUE,&pStm); + if (hres) { + FIXME("Failed to create stream on hglobal.\n"); + return hres; + } + hres = CoMarshalInterface(pStm,&IID_IClassFactory,(LPVOID)classfac,0,NULL,0); + if (hres) { + FIXME("CoMarshalInterface failed, %lx!\n",hres); + return hres; + } + hres = IStream_Stat(pStm,&ststg,0); + if (hres) return hres; + + buflen = ststg.cbSize.u.LowPart; + buffer = HeapAlloc(GetProcessHeap(),0,buflen); + seekto.u.LowPart = 0; + seekto.u.HighPart = 0; + hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos); + if (hres) { + FIXME("IStream_Seek failed, %lx\n",hres); + return hres; + } + hres = IStream_Read(pStm,buffer,buflen,&res); + if (hres) { + FIXME("Stream Read failed, %lx\n",hres); + return hres; + } + IStream_Release(pStm); + + while (1) { + hPipe = CreateNamedPipeA( + pipefn, + PIPE_ACCESS_DUPLEX, + PIPE_TYPE_BYTE|PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, + 4096, + 4096, + NMPWAIT_USE_DEFAULT_WAIT, + NULL + ); + if (hPipe == INVALID_HANDLE_VALUE) { + FIXME("pipe creation failed for %s, le is %lx\n",pipefn,GetLastError()); + return 1; + } + if (!ConnectNamedPipe(hPipe,NULL)) { + ERR("Failure during ConnectNamedPipe %lx, ABORT!\n",GetLastError()); + CloseHandle(hPipe); + continue; + } + WriteFile(hPipe,buffer,buflen,&res,NULL); + CloseHandle(hPipe); + } + return 0; } /****************************************************************************** - * CoRegisterClassObject [OLE32.36] + * CoRegisterClassObject [OLE32.@] * * This method will register the class object for a given class ID. * @@ -999,29 +1075,18 @@ HRESULT WINAPI CoRegisterClassObject( DWORD dwClsContext, /* [in] CLSCTX flags indicating the context in which to run the executable */ DWORD flags, /* [in] REGCLS flags indicating how connections are made */ LPDWORD lpdwRegister -) +) { RegisteredClass* newClass; LPUNKNOWN foundObject; HRESULT hr; - char buf[80]; - WINE_StringFromCLSID(rclsid,buf); + TRACE("(%s,%p,0x%08lx,0x%08lx,%p)\n", + debugstr_guid(rclsid),pUnk,dwClsContext,flags,lpdwRegister); - Print(MAX_TRACE, ("(%s,%p,0x%08lx,0x%08lx,%p)\n", - buf,pUnk,dwClsContext,flags,lpdwRegister)); - - /* - * Perform a sanity check on the parameters - */ if ( (lpdwRegister==0) || (pUnk==0) ) - { return E_INVALIDARG; -} - /* - * Initialize the cookie (out parameter) - */ *lpdwRegister = 0; /* @@ -1029,32 +1094,24 @@ HRESULT WINAPI CoRegisterClassObject( * If it is, this should cause an error. */ hr = COM_GetRegisteredClassObject(rclsid, dwClsContext, &foundObject); - - if (hr == S_OK) - { - /* - * The COM_GetRegisteredClassObject increased the reference count on the - * object so it has to be released. - */ + if (hr == S_OK) { IUnknown_Release(foundObject); - return CO_E_OBJISREG; } - - /* - * If it is not registered, we must create a new entry for this class and - * append it to the registered class list. - * We use the address of the chain node as the cookie since we are sure it's - * unique. - */ - newClass = HeapAlloc(GetProcessHeap(), 0, sizeof(RegisteredClass)); - /* - * Initialize the node. - */ + newClass = HeapAlloc(GetProcessHeap(), 0, sizeof(RegisteredClass)); + if ( newClass == NULL ) + return E_OUTOFMEMORY; + + EnterCriticalSection( &csRegisteredClassList ); + newClass->classIdentifier = *rclsid; newClass->runContext = dwClsContext; newClass->connectFlags = flags; + /* + * Use the address of the chain node as the cookie since we are sure it's + * unique. + */ newClass->dwCookie = (DWORD)newClass; newClass->nextClass = firstRegisteredClass; @@ -1066,32 +1123,36 @@ HRESULT WINAPI CoRegisterClassObject( IUnknown_AddRef(newClass->classObject); firstRegisteredClass = newClass; + LeaveCriticalSection( &csRegisteredClassList ); - /* - * Assign the out parameter (cookie) - */ *lpdwRegister = newClass->dwCookie; - - /* - * We're successful Yippee! - */ + + if (dwClsContext & CLSCTX_LOCAL_SERVER) { + DWORD tid; + + STUBMGR_Start(); + newClass->hThread=CreateThread(NULL,0,_LocalServerThread,newClass,0,&tid); + } return S_OK; } /*********************************************************************** - * CoRevokeClassObject [OLE32.40] + * CoRevokeClassObject [OLE32.@] * * This method will remove a class object from the class registry * * See the Windows documentation for more details. */ HRESULT WINAPI CoRevokeClassObject( - DWORD dwRegister) + DWORD dwRegister) { + HRESULT hr = E_INVALIDARG; RegisteredClass** prevClassLink; RegisteredClass* curClass; - Print(MAX_TRACE, ("(%08lx)\n",dwRegister)); + TRACE("(%08lx)\n",dwRegister); + + EnterCriticalSection( &csRegisteredClassList ); /* * Iterate through the whole list and try to match the cookie. @@ -1118,11 +1179,12 @@ HRESULT WINAPI CoRevokeClassObject( /* * Free the memory used by the chain node. - */ + */ HeapFree(GetProcessHeap(), 0, curClass); - return S_OK; -} + hr = S_OK; + goto end; + } /* * Step to the next class in the list. @@ -1131,14 +1193,48 @@ HRESULT WINAPI CoRevokeClassObject( curClass = curClass->nextClass; } +end: + LeaveCriticalSection( &csRegisteredClassList ); /* * If we get to here, we haven't found our class. */ - return E_INVALIDARG; + return hr; +} + +/*********************************************************************** + * compobj_RegReadPath [internal] + * + * Reads a registry value and expands it when nessesary + */ +HRESULT compobj_RegReadPath(char * keyname, char * valuename, char * dst, int dstlen) +{ + HRESULT hres; + HKEY key; + DWORD keytype; + char src[MAX_PATH]; + DWORD dwLength = dstlen; + + if((hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &key)) == ERROR_SUCCESS) { + if( (hres = RegQueryValueExA(key, NULL, NULL, &keytype, (LPBYTE)src, &dwLength)) == ERROR_SUCCESS ) { + if (keytype == REG_EXPAND_SZ) { + if (dstlen <= ExpandEnvironmentStringsA(src, dst, dstlen)) hres = ERROR_MORE_DATA; + } else { + strncpy(dst, src, dstlen); + } + } + RegCloseKey (key); + } + return hres; } /*********************************************************************** * CoGetClassObject [COMPOBJ.7] + * CoGetClassObject [OLE32.@] + * + * FIXME. If request allows of several options and there is a failure + * with one (other than not being registered) do we try the + * others or return failure? (E.g. inprocess is registered but + * the DLL is not found but the server version works) */ HRESULT WINAPI CoGetClassObject( REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, @@ -1147,27 +1243,21 @@ HRESULT WINAPI CoGetClassObject( LPUNKNOWN regClassObject; HRESULT hres = E_UNEXPECTED; char xclsid[80]; - WCHAR dllName[MAX_PATH+1]; - DWORD dllNameLen = sizeof(dllName); HINSTANCE hLibrary; - typedef HRESULT CALLBACK (*DllGetClassObjectFunc)(REFCLSID clsid, - REFIID iid, LPVOID *ppv); + typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv); DllGetClassObjectFunc DllGetClassObject; WINE_StringFromCLSID((LPCLSID)rclsid,xclsid); - Print(MIN_TRACE, ("\n\tCLSID:\t%s,\n\tIID:\t%s\n", - PRINT_GUID(rclsid), - PRINT_GUID(iid) - )); + TRACE("\n\tCLSID:\t%s,\n\tIID:\t%s\n", debugstr_guid(rclsid), debugstr_guid(iid)); if (pServerInfo) { - Print(MIN_TRACE, ("\tpServerInfo: name=%S\n",pServerInfo->pwszName)); - Print(MIN_TRACE, ("\t\tpAuthInfo=%p\n",pServerInfo->pAuthInfo)); + FIXME("\tpServerInfo: name=%s\n",debugstr_w(pServerInfo->pwszName)); + FIXME("\t\tpAuthInfo=%p\n",pServerInfo->pAuthInfo); } /* - * First, try and see if we can't match the class ID with one of the + * First, try and see if we can't match the class ID with one of the * registered classes. */ if (S_OK == COM_GetRegisteredClassObject(rclsid, dwClsContext, ®ClassObject)) @@ -1187,85 +1277,80 @@ HRESULT WINAPI CoGetClassObject( return hres; } - /* out of process and remote servers not supported yet */ - if ( ((CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER) & dwClsContext) - && !((CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER) & dwClsContext) - ){ - Print(MIN_TRACE, ("%s %s not supported!\n", - (dwClsContext&CLSCTX_LOCAL_SERVER)?"CLSCTX_LOCAL_SERVER":"", - (dwClsContext&CLSCTX_REMOTE_SERVER)?"CLSCTX_REMOTE_SERVER":"" - )); - return E_ACCESSDENIED; + /* first try: in-process */ + if ((CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER) & dwClsContext) { + char keyname[MAX_PATH]; + char dllpath[MAX_PATH+1]; + + sprintf(keyname,"CLSID\\%s\\InprocServer32",xclsid); + + if ( compobj_RegReadPath(keyname, NULL, dllpath, sizeof(dllpath)) != ERROR_SUCCESS) { + /* failure: CLSID is not found in registry */ + WARN("class %s not registred\n", xclsid); + hres = REGDB_E_CLASSNOTREG; + } else { + if ((hLibrary = LoadLibraryExA(dllpath, 0, LOAD_WITH_ALTERED_SEARCH_PATH)) == 0) { + /* failure: DLL could not be loaded */ + ERR("couldn't load InprocServer32 dll %s\n", dllpath); + hres = E_ACCESSDENIED; /* FIXME: or should this be CO_E_DLLNOTFOUND? */ + } else if (!(DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject"))) { + /* failure: the dll did not export DllGetClassObject */ + ERR("couldn't find function DllGetClassObject in %s\n", dllpath); + FreeLibrary( hLibrary ); + hres = CO_E_DLLNOTFOUND; + } else { + /* OK: get the ClassObject */ + COMPOBJ_DLLList_Add( hLibrary ); + return DllGetClassObject(rclsid, iid, ppv); + } + } } - if ((CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER) & dwClsContext) { - HKEY key; - char buf[200]; - - sprintf(buf,"CLSID\\%s\\InprocServer32",xclsid); - hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, buf, 0, KEY_READ, &key); - - if (hres != ERROR_SUCCESS) { - return REGDB_E_CLASSNOTREG; - } - - memset(dllName,0,sizeof(dllName)); - hres= RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)dllName,&dllNameLen); - if (hres) - return REGDB_E_CLASSNOTREG; /* FIXME: check retval */ - RegCloseKey(key); - Print(MAX_TRACE, ("found InprocServer32 dll %S\n", dllName)); - - /* open dll, call DllGetClassObject */ - hLibrary = CoLoadLibrary(dllName, TRUE); - if (hLibrary == 0) { - Print(MIN_TRACE, ("couldn't load InprocServer32 dll %S\n", dllName)); - return E_ACCESSDENIED; /* or should this be CO_E_DLLNOTFOUND? */ - } - DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject"); - if (!DllGetClassObject) { - /* not sure if this should be called here CoFreeLibrary(hLibrary);*/ - Print(MIN_TRACE, ("couldn't find function DllGetClassObject in %S\n", dllName)); - return E_ACCESSDENIED; - } - - /* - * Ask the DLL for its class object. (there was a note here about class - * factories but this is good. - */ - return DllGetClassObject(rclsid, iid, ppv); + /* Next try out of process */ + if (CLSCTX_LOCAL_SERVER & dwClsContext) + { + return create_marshalled_proxy(rclsid,iid,ppv); } + + /* Finally try remote */ + if (CLSCTX_REMOTE_SERVER & dwClsContext) + { + FIXME ("CLSCTX_REMOTE_SERVER not supported\n"); + hres = E_NOINTERFACE; + } + return hres; } - /*********************************************************************** - * CoResumeClassObjects + * CoResumeClassObjects (OLE32.@) * * Resumes classobjects registered with REGCLS suspended */ HRESULT WINAPI CoResumeClassObjects(void) { - UNIMPLEMENTED; + FIXME("\n"); return S_OK; } /*********************************************************************** - * GetClassFile + * GetClassFile (OLE32.@) * * This function supplies the CLSID associated with the given filename. */ -HRESULT WINAPI GetClassFile(LPOLESTR filePathName,CLSID *pclsid) +HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid) { IStorage *pstg=0; HRESULT res; - int nbElm=0,length=0,i=0; - LONG sizeProgId=20; + int nbElm, length, i; + LONG sizeProgId; LPOLESTR *pathDec=0,absFile=0,progId=0; - WCHAR extention[100]={0}; + LPWSTR extension; + static const WCHAR bkslashW[] = {'\\',0}; + static const WCHAR dotW[] = {'.',0}; - Print(MAX_TRACE, ("()\n")); + TRACE("%s, %p\n", debugstr_w(filePathName), pclsid); - /* if the file contain a storage object the return the CLSID writen by IStorage_SetClass method*/ + /* if the file contain a storage object the return the CLSID written by IStorage_SetClass method*/ if((StgIsStorageFile(filePathName))==S_OK){ res=StgOpenStorage(filePathName,NULL,STGM_READ | STGM_SHARE_DENY_WRITE,NULL,0,&pstg); @@ -1280,7 +1365,7 @@ HRESULT WINAPI GetClassFile(LPOLESTR filePathName,CLSID *pclsid) /* if the file is not a storage object then attemps to match various bits in the file against a pattern in the registry. this case is not frequently used ! so I present only the psodocode for this case - + for(i=0;i=0) && (extention[i]=absFile[i]) );i--); - + for(i = length-1; (i >= 0) && *(extension = &absFile[i]) != '.'; i--) + /* nothing */; + + if (!extension || !lstrcmpW(extension, dotW)) + return MK_E_INVALIDEXTENSION; + + res=RegQueryValueW(HKEY_CLASSES_ROOT, extension, NULL, &sizeProgId); + /* get the progId associated to the extension */ - progId=CoTaskMemAlloc(sizeProgId); + progId = CoTaskMemAlloc(sizeProgId); + res = RegQueryValueW(HKEY_CLASSES_ROOT, extension, progId, &sizeProgId); - res=RegQueryValueW(HKEY_CLASSES_ROOT,extention,progId,&sizeProgId); - - if (res==ERROR_MORE_DATA){ - - progId = CoTaskMemRealloc(progId,sizeProgId); - res=RegQueryValueW(HKEY_CLASSES_ROOT,extention,progId,&sizeProgId); - } if (res==ERROR_SUCCESS) /* return the clsid associated to the progId */ res= CLSIDFromProgID(progId,pclsid); @@ -1339,26 +1425,16 @@ HRESULT WINAPI GetClassFile(LPOLESTR filePathName,CLSID *pclsid) return MK_E_INVALIDEXTENSION; } -/****************************************************************************** - * CoRegisterMessageFilter16 [COMPOBJ.27] - */ -HRESULT WINAPI CoRegisterMessageFilter16( - DWORD lpMessageFilter, - DWORD *lplpMessageFilter -) { - UNIMPLEMENTED; - return 0; -} - /*********************************************************************** - * CoCreateInstance [COMPOBJ.13, OLE32.7] + * CoCreateInstance [COMPOBJ.13] + * CoCreateInstance [OLE32.@] */ HRESULT WINAPI CoCreateInstance( REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, - LPVOID *ppv) + LPVOID *ppv) { HRESULT hres; LPCLASSFACTORY lpclf = 0; @@ -1373,6 +1449,20 @@ HRESULT WINAPI CoCreateInstance( * Initialize the "out" parameter */ *ppv = 0; + + /* + * The Standard Global Interface Table (GIT) object is a process-wide singleton. + * Rather than create a class factory, we can just check for it here + */ + if (IsEqualIID(rclsid, &CLSID_StdGlobalInterfaceTable)) { + if (StdGlobalInterfaceTableInstance == NULL) + StdGlobalInterfaceTableInstance = StdGlobalInterfaceTable_Construct(); + hres = IGlobalInterfaceTable_QueryInterface( (IGlobalInterfaceTable*) StdGlobalInterfaceTableInstance, iid, ppv); + if (hres) return hres; + + TRACE("Retrieved GIT (%p)\n", *ppv); + return S_OK; + } /* * Get a class factory to construct the object we want. @@ -1384,7 +1474,8 @@ HRESULT WINAPI CoCreateInstance( (LPVOID)&lpclf); if (FAILED(hres)) { - Print(MIN_TRACE, ("no instance created for %s, hres is 0x%08lx\n",PRINT_GUID(iid),hres)); + FIXME("no classfactory created for CLSID %s, hres is 0x%08lx\n", + debugstr_guid(rclsid),hres); return hres; } @@ -1393,17 +1484,20 @@ HRESULT WINAPI CoCreateInstance( */ hres = IClassFactory_CreateInstance(lpclf, pUnkOuter, iid, ppv); IClassFactory_Release(lpclf); + if(FAILED(hres)) + FIXME("no instance created for interface %s of class %s, hres is 0x%08lx\n", + debugstr_guid(iid), debugstr_guid(rclsid),hres); return hres; } /*********************************************************************** - * CoCreateInstanceEx [OLE32.165] + * CoCreateInstanceEx [OLE32.@] */ HRESULT WINAPI CoCreateInstanceEx( - REFCLSID rclsid, + REFCLSID rclsid, LPUNKNOWN pUnkOuter, - DWORD dwClsContext, + DWORD dwClsContext, COSERVERINFO* pServerInfo, ULONG cmq, MULTI_QI* pResults) @@ -1420,7 +1514,7 @@ HRESULT WINAPI CoCreateInstanceEx( return E_INVALIDARG; if (pServerInfo!=NULL) - Print(MIN_TRACE, ("() non-NULL pServerInfo not supported!\n")); + FIXME("() non-NULL pServerInfo not supported!\n"); /* * Initialize all the "out" parameters. @@ -1434,7 +1528,7 @@ HRESULT WINAPI CoCreateInstanceEx( /* * Get the object and get its IUnknown pointer. */ - hr = CoCreateInstance(rclsid, + hr = CoCreateInstance(rclsid, pUnkOuter, dwClsContext, &IID_IUnknown, @@ -1471,85 +1565,53 @@ HRESULT WINAPI CoCreateInstanceEx( } /*********************************************************************** - * CoFreeLibrary [COMPOBJ.13] + * CoLoadLibrary (OLE32.@) + */ +HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree) +{ + TRACE("(%s, %d)\n", debugstr_w(lpszLibName), bAutoFree); + + return LoadLibraryExW(lpszLibName, 0, LOAD_WITH_ALTERED_SEARCH_PATH); +} + +/*********************************************************************** + * CoFreeLibrary [OLE32.@] + * + * NOTES: don't belive the docu */ void WINAPI CoFreeLibrary(HINSTANCE hLibrary) { - OpenDll *ptr, *prev; - OpenDll *tmp; - - /* lookup library in linked list */ - prev = NULL; - for (ptr = openDllList; ptr != NULL; ptr=ptr->next) { - if (ptr->hLibrary == hLibrary) { - break; - } - prev = ptr; - } - - if (ptr == NULL) { - /* shouldn't happen if user passed in a valid hLibrary */ - return; - } - /* assert: ptr points to the library entry to free */ - - /* free library and remove node from list */ - FreeLibrary(hLibrary); - if (ptr == openDllList) { - tmp = openDllList->next; - HeapFree(GetProcessHeap(), 0, openDllList); - openDllList = tmp; - } else { - tmp = ptr->next; - HeapFree(GetProcessHeap(), 0, ptr); - prev->next = tmp; - } - + FreeLibrary(hLibrary); } /*********************************************************************** - * CoFreeAllLibraries [COMPOBJ.12] + * CoFreeAllLibraries [OLE32.@] + * + * NOTES: don't belive the docu */ void WINAPI CoFreeAllLibraries(void) { - OpenDll *ptr, *tmp; - - for (ptr = openDllList; ptr != NULL; ) { - tmp=ptr->next; - CoFreeLibrary(ptr->hLibrary); - ptr = tmp; - } + /* NOP */ } - /*********************************************************************** * CoFreeUnusedLibraries [COMPOBJ.17] + * CoFreeUnusedLibraries [OLE32.@] + * + * FIXME: Calls to CoFreeUnusedLibraries from any thread always route + * through the main apartment's thread to call DllCanUnloadNow */ void WINAPI CoFreeUnusedLibraries(void) { - OpenDll *ptr, *tmp; - typedef HRESULT(*DllCanUnloadNowFunc)(void); - DllCanUnloadNowFunc DllCanUnloadNow; - - for (ptr = openDllList; ptr != NULL; ) { - DllCanUnloadNow = (DllCanUnloadNowFunc) - GetProcAddress(ptr->hLibrary, "DllCanUnloadNow"); - - if ( (DllCanUnloadNow != NULL) && - (DllCanUnloadNow() == S_OK) ) { - tmp=ptr->next; - CoFreeLibrary(ptr->hLibrary); - ptr = tmp; - } else { - ptr=ptr->next; - } - } + COMPOBJ_DllList_FreeUnused(0); } /*********************************************************************** - * CoFileTimeNow [COMPOBJ.82, OLE32.10] + * CoFileTimeNow [COMPOBJ.82] + * CoFileTimeNow [OLE32.@] + * * RETURNS * the current system time in lpFileTime */ @@ -1560,313 +1622,68 @@ HRESULT WINAPI CoFileTimeNow( FILETIME *lpFileTime ) /* [out] the current time * } /*********************************************************************** - * CoTaskMemAlloc (OLE32.43) - * RETURNS - * pointer to newly allocated block - */ -LPVOID WINAPI CoTaskMemAlloc( - ULONG size /* [in] size of memoryblock to be allocated */ -) { - LPMALLOC lpmalloc; - HRESULT ret = CoGetMalloc(0,&lpmalloc); - - if (FAILED(ret)) - return NULL; - - return IMalloc_Alloc(lpmalloc,size); -} -/*********************************************************************** - * CoTaskMemFree (OLE32.44) - */ -VOID WINAPI CoTaskMemFree( - LPVOID ptr /* [in] pointer to be freed */ -) { - LPMALLOC lpmalloc; - HRESULT ret = CoGetMalloc(0,&lpmalloc); - - if (FAILED(ret)) - return; - - IMalloc_Free(lpmalloc, ptr); -} - -/*********************************************************************** - * CoTaskMemRealloc (OLE32.45) - * RETURNS - * pointer to newly allocated block - */ -LPVOID WINAPI CoTaskMemRealloc( - LPVOID pvOld, - ULONG size) /* [in] size of memoryblock to be allocated */ -{ - LPMALLOC lpmalloc; - HRESULT ret = CoGetMalloc(0,&lpmalloc); - - if (FAILED(ret)) - return NULL; - - return IMalloc_Realloc(lpmalloc, pvOld, size); -} - -/*********************************************************************** - * CoLoadLibrary (OLE32.30) - */ -HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree) -{ - HINSTANCE hLibrary; - OpenDll *ptr; - OpenDll *tmp; - - Print(MAX_TRACE, ("(%S, %d)\n", lpszLibName, bAutoFree)); - - hLibrary = LoadLibraryExW(lpszLibName, 0, LOAD_WITH_ALTERED_SEARCH_PATH); - - if (!bAutoFree) - return hLibrary; - - if (openDllList == NULL) { - /* empty list -- add first node */ - openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll)); - openDllList->hLibrary=hLibrary; - openDllList->next = NULL; - } else { - /* search for this dll */ - int found = FALSE; - for (ptr = openDllList; ptr->next != NULL; ptr=ptr->next) { - if (ptr->hLibrary == hLibrary) { - found = TRUE; - break; - } - } - if (!found) { - /* dll not found, add it */ - tmp = openDllList; - openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll)); - openDllList->hLibrary = hLibrary; - openDllList->next = tmp; - } - } - - return hLibrary; -} - -/*********************************************************************** - * CoInitializeWOW (OLE32.27) - */ -HRESULT WINAPI CoInitializeWOW(DWORD x,DWORD y) { - UNIMPLEMENTED; - return 0; -} - -/****************************************************************************** - * CoLockObjectExternal16 [COMPOBJ.63] - */ -HRESULT WINAPI CoLockObjectExternal16( - LPUNKNOWN pUnk, /* [in] object to be locked */ - BOOL fLock, /* [in] do lock */ - BOOL fLastUnlockReleases /* [in] ? */ -) { - UNIMPLEMENTED; - return S_OK; -} - -/****************************************************************************** - * CoLockObjectExternal [OLE32.31] - */ -HRESULT WINAPI CoLockObjectExternal( - LPUNKNOWN pUnk, /* [in] object to be locked */ - BOOL fLock, /* [in] do lock */ - BOOL fLastUnlockReleases) /* [in] unlock all */ -{ - - if (fLock) - { - /* - * Increment the external lock coutner, COM_ExternalLockAddRef also - * increment the object's internal lock counter. - */ - COM_ExternalLockAddRef( pUnk); - } - else - { - /* - * Decrement the external lock coutner, COM_ExternalLockRelease also - * decrement the object's internal lock counter. - */ - COM_ExternalLockRelease( pUnk, fLastUnlockReleases); - } - - return S_OK; -} - -/*********************************************************************** - * CoGetState16 [COMPOBJ.115] - */ -HRESULT WINAPI CoGetState16(LPDWORD state) -{ - UNIMPLEMENTED - return S_OK; -} -/*********************************************************************** - * CoSetState [COM32.42] - */ -HRESULT WINAPI CoSetState(LPDWORD state) -{ - UNIMPLEMENTED; - return S_OK; -} -/*********************************************************************** - * CoCreateFreeThreadedMarshaler [OLE32.5] - */ -HRESULT WINAPI CoCreateFreeThreadedMarshaler (LPUNKNOWN punkOuter, LPUNKNOWN* ppunkMarshal) -{ - UNIMPLEMENTED; - return S_OK; -} - - -/*********************************************************************** - * DllGetClassObject [OLE32.63] - */ -HRESULT WINAPI OLE32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv) -{ - UNIMPLEMENTED; - *ppv = NULL; - return CLASS_E_CLASSNOTAVAILABLE; -} - - -/*** - * COM_RevokeAllClasses - * - * This method is called when the COM libraries are uninitialized to - * release all the references to the class objects registered with - * the library + * CoLoadLibrary (OLE32.@) */ static void COM_RevokeAllClasses() { + EnterCriticalSection( &csRegisteredClassList ); + while (firstRegisteredClass!=0) { CoRevokeClassObject(firstRegisteredClass->dwCookie); } + + LeaveCriticalSection( &csRegisteredClassList ); } /**************************************************************************** * COM External Lock methods implementation + * + * This api provides a linked list to managed external references to + * COM objects. + * + * The public interface consists of three calls: + * COM_ExternalLockAddRef + * COM_ExternalLockRelease + * COM_ExternalLockFreeList */ -/**************************************************************************** - * Public - Method that increments the count for a IUnknown* in the linked - * list. The item is inserted if not already in the list. +#define EL_END_OF_LIST 0 +#define EL_NOT_FOUND 0 + +/* + * Declaration of the static structure that manage the + * external lock to COM objects. */ -static void COM_ExternalLockAddRef( - IUnknown *pUnk) +typedef struct COM_ExternalLock COM_ExternalLock; +typedef struct COM_ExternalLockList COM_ExternalLockList; + +struct COM_ExternalLock { - COM_ExternalLock *externalLock = COM_ExternalLockFind(pUnk); + IUnknown *pUnk; /* IUnknown referenced */ + ULONG uRefCount; /* external lock counter to IUnknown object*/ + COM_ExternalLock *next; /* Pointer to next element in list */ +}; - /* - * Add an external lock to the object. If it was already externally - * locked, just increase the reference count. If it was not. - * add the item to the list. - */ - if ( externalLock == EL_NOT_FOUND ) - COM_ExternalLockInsert(pUnk); - else - externalLock->uRefCount++; - - /* - * Add an internal lock to the object - */ - IUnknown_AddRef(pUnk); -} - -/**************************************************************************** - * Public - Method that decrements the count for a IUnknown* in the linked - * list. The item is removed from the list if its count end up at zero or if - * bRelAll is TRUE. - */ -static void COM_ExternalLockRelease( - IUnknown *pUnk, - BOOL bRelAll) +struct COM_ExternalLockList { - COM_ExternalLock *externalLock = COM_ExternalLockFind(pUnk); + COM_ExternalLock *head; /* head of list */ +}; - if ( externalLock != EL_NOT_FOUND ) - { - do - { - externalLock->uRefCount--; /* release external locks */ - IUnknown_Release(pUnk); /* release local locks as well */ - - if ( bRelAll == FALSE ) - break; /* perform single release */ - - } while ( externalLock->uRefCount > 0 ); - - if ( externalLock->uRefCount == 0 ) /* get rid of the list entry */ - COM_ExternalLockDelete(externalLock); - } -} -/**************************************************************************** - * Public - Method that frees the content of the list. +/* + * Declaration and initialization of the static structure that manages + * the external lock to COM objects. */ -static void COM_ExternalLockFreeList() -{ - COM_ExternalLock *head; +static COM_ExternalLockList elList = { EL_END_OF_LIST }; - head = elList.head; /* grab it by the head */ - while ( head != EL_END_OF_LIST ) - { - COM_ExternalLockDelete(head); /* get rid of the head stuff */ - - head = elList.head; /* get the new head... */ - } -} - -/**************************************************************************** - * Public - Method that dump the content of the list. +/* + * Private methods used to managed the linked list */ -void COM_ExternalLockDump() -{ - COM_ExternalLock *current = elList.head; - Print(MAX_TRACE, ("\nExternal lock list contains:\n")); - while ( current != EL_END_OF_LIST ) - { - Print(MAX_TRACE, ("\t%p with %lu references count.\n", current->pUnk, current->uRefCount)); - - /* Skip to the next item */ - current = current->next; - } - -} - -/**************************************************************************** - * Internal - Find a IUnknown* in the linked list - */ -static COM_ExternalLock* COM_ExternalLockFind( - IUnknown *pUnk) -{ - return COM_ExternalLockLocate(elList.head, pUnk); -} - -/**************************************************************************** - * Internal - Recursivity agent for IUnknownExternalLockList_Find - */ static COM_ExternalLock* COM_ExternalLockLocate( COM_ExternalLock *element, - IUnknown *pUnk) -{ - if ( element == EL_END_OF_LIST ) - return EL_NOT_FOUND; - - else if ( element->pUnk == pUnk ) /* We found it */ - return element; - - else /* Not the right guy, keep on looking */ - return COM_ExternalLockLocate( element->next, pUnk); -} + IUnknown *pUnk); /**************************************************************************** * Internal - Insert a new IUnknown* to the linked list @@ -1882,32 +1699,23 @@ static BOOL COM_ExternalLockInsert( */ newLock = HeapAlloc(GetProcessHeap(), 0, sizeof(COM_ExternalLock)); - if (newLock!=NULL) - { - if ( elList.head == EL_END_OF_LIST ) - { + if (newLock!=NULL) { + if ( elList.head == EL_END_OF_LIST ) { elList.head = newLock; /* The list is empty */ - } - else - { - /* - * insert does it at the head - */ + } else { + /* insert does it at the head */ previousHead = elList.head; elList.head = newLock; } - /* - * Set new list item data member - */ + /* Set new list item data member */ newLock->pUnk = pUnk; newLock->uRefCount = 1; newLock->next = previousHead; - + return TRUE; } - else - return FALSE; + return FALSE; } /**************************************************************************** @@ -1918,64 +1726,205 @@ static void COM_ExternalLockDelete( { COM_ExternalLock *current = elList.head; - if ( current == itemList ) - { - /* - * this section handles the deletion of the first node - */ + if ( current == itemList ) { + /* this section handles the deletion of the first node */ elList.head = itemList->next; - HeapFree( GetProcessHeap(), 0, itemList); - } - else - { - do - { - if ( current->next == itemList ) /* We found the item to free */ - { + HeapFree( GetProcessHeap(), 0, itemList); + } else { + do { + if ( current->next == itemList ){ /* We found the item to free */ current->next = itemList->next; /* readjust the list pointers */ - - HeapFree( GetProcessHeap(), 0, itemList); - break; + HeapFree( GetProcessHeap(), 0, itemList); + break; } - - /* Skip to the next item */ + + /* Skip to the next item */ current = current->next; - + } while ( current != EL_END_OF_LIST ); } } -/*********************************************************************** - * COMPOBJ_DllEntryPoint [COMPOBJ.entry] +/**************************************************************************** + * Internal - Recursivity agent for IUnknownExternalLockList_Find * - * Initialization code for the COMPOBJ DLL - * - * RETURNS: + * NOTES: how long can the list be ?? (recursive!!!) */ -BOOL WINAPI COMPOBJ_DllEntryPoint(DWORD Reason, DWORD hInst, WORD ds, WORD HeapSize, DWORD res1, WORD res2) +static COM_ExternalLock* COM_ExternalLockLocate( COM_ExternalLock *element, IUnknown *pUnk) { - Print(MAX_TRACE, ("(%08lx, %04x, %04x, %04x, %08lx, %04x)\n", Reason, hInst, ds, HeapSize, - res1, res2)); - switch(Reason) - { - case DLL_PROCESS_ATTACH: -#if 0 - if (!COMPOBJ_Attach++) COMPOBJ_hInstance = hInst; -#endif - break; + if ( element == EL_END_OF_LIST ) + return EL_NOT_FOUND; + else if ( element->pUnk == pUnk ) /* We found it */ + return element; + else /* Not the right guy, keep on looking */ + return COM_ExternalLockLocate( element->next, pUnk); +} - case DLL_PROCESS_DETACH: -#if 0 - if(!--COMPOBJ_Attach) - COMPOBJ_hInstance = 0; -#endif - break; - } - return TRUE; +/**************************************************************************** + * Public - Method that increments the count for a IUnknown* in the linked + * list. The item is inserted if not already in the list. + */ +static void COM_ExternalLockAddRef(IUnknown *pUnk) +{ + COM_ExternalLock *externalLock = COM_ExternalLockLocate(elList.head, pUnk); + + /* + * Add an external lock to the object. If it was already externally + * locked, just increase the reference count. If it was not. + * add the item to the list. + */ + if ( externalLock == EL_NOT_FOUND ) + COM_ExternalLockInsert(pUnk); + else + externalLock->uRefCount++; + + /* + * Add an internal lock to the object + */ + IUnknown_AddRef(pUnk); +} + +/**************************************************************************** + * Public - Method that decrements the count for a IUnknown* in the linked + * list. The item is removed from the list if its count end up at zero or if + * bRelAll is TRUE. + */ +static void COM_ExternalLockRelease( + IUnknown *pUnk, + BOOL bRelAll) +{ + COM_ExternalLock *externalLock = COM_ExternalLockLocate(elList.head, pUnk); + + if ( externalLock != EL_NOT_FOUND ) { + do { + externalLock->uRefCount--; /* release external locks */ + IUnknown_Release(pUnk); /* release local locks as well */ + + if ( bRelAll == FALSE ) break; /* perform single release */ + + } while ( externalLock->uRefCount > 0 ); + + if ( externalLock->uRefCount == 0 ) /* get rid of the list entry */ + COM_ExternalLockDelete(externalLock); + } +} +/**************************************************************************** + * Public - Method that frees the content of the list. + */ +static void COM_ExternalLockFreeList() +{ + COM_ExternalLock *head; + + head = elList.head; /* grab it by the head */ + while ( head != EL_END_OF_LIST ) { + COM_ExternalLockDelete(head); /* get rid of the head stuff */ + head = elList.head; /* get the new head... */ + } +} + +/**************************************************************************** + * Public - Method that dump the content of the list. + */ +void COM_ExternalLockDump() +{ + COM_ExternalLock *current = elList.head; + + DPRINTF("\nExternal lock list contains:\n"); + + while ( current != EL_END_OF_LIST ) { + DPRINTF( "\t%p with %lu references count.\n", current->pUnk, current->uRefCount); + + /* Skip to the next item */ + current = current->next; + } } /****************************************************************************** - * OleGetAutoConvert [OLE32.104] + * CoLockObjectExternal [OLE32.@] + */ +HRESULT WINAPI CoLockObjectExternal( + LPUNKNOWN pUnk, /* [in] object to be locked */ + BOOL fLock, /* [in] do lock */ + BOOL fLastUnlockReleases) /* [in] unlock all */ +{ + + if (fLock) { + /* + * Increment the external lock coutner, COM_ExternalLockAddRef also + * increment the object's internal lock counter. + */ + COM_ExternalLockAddRef( pUnk); + } else { + /* + * Decrement the external lock coutner, COM_ExternalLockRelease also + * decrement the object's internal lock counter. + */ + COM_ExternalLockRelease( pUnk, fLastUnlockReleases); + } + + return S_OK; +} + +/*********************************************************************** + * CoInitializeWOW (OLE32.@) + */ +HRESULT WINAPI CoInitializeWOW(DWORD x,DWORD y) { + FIXME("(0x%08lx,0x%08lx),stub!\n",x,y); + return 0; +} + +static IUnknown * pUnkState = 0; /* FIXME: thread local */ +static int nStatCounter = 0; /* global */ +static HMODULE hOleAut32 = 0; /* global */ + +/*********************************************************************** + * CoGetState [OLE32.@] + * + * NOTES: might be incomplete + */ +HRESULT WINAPI CoGetState(IUnknown ** ppv) +{ + FIXME("\n"); + + if(pUnkState) { + IUnknown_AddRef(pUnkState); + *ppv = pUnkState; + FIXME("-- %p\n", *ppv); + return S_OK; + } + *ppv = NULL; + return E_FAIL; + +} + +/*********************************************************************** + * CoSetState [OLE32.@] + * + * NOTES: FIXME: protect this with a crst + */ +HRESULT WINAPI CoSetState(IUnknown * pv) +{ + FIXME("(%p),stub!\n", pv); + + if (pv) { + IUnknown_AddRef(pv); + nStatCounter++; + if (nStatCounter == 1) LoadLibraryA("OLEAUT32.DLL"); + } + + if (pUnkState) { + TRACE("-- release %p now\n", pUnkState); + IUnknown_Release(pUnkState); + nStatCounter--; + if (!nStatCounter) FreeLibrary(hOleAut32); + } + pUnkState = pv; + return S_OK; +} + + +/****************************************************************************** + * OleGetAutoConvert [OLE32.@] */ HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew) { @@ -2002,21 +1951,20 @@ HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew) MultiByteToWideChar( CP_ACP, 0, buf, -1, wbuf, sizeof(wbuf)/sizeof(WCHAR) ); CLSIDFromString(wbuf,pClsidNew); done: - if (hkey) RegCloseKey(hkey); - - return res; + if (hkey) RegCloseKey(hkey); + return res; } /****************************************************************************** - * OleSetAutoConvert [OLE32.126] + * OleSetAutoConvert [OLE32.@] */ HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew) { - HKEY hkey = 0, hkeyConvert = 0; + HKEY hkey = 0; char buf[200], szClsidNew[200]; HRESULT res = S_OK; - Print(MAX_TRACE, ("(%p,%p);\n", clsidOld, clsidNew)); + TRACE("(%s,%s)\n", debugstr_guid(clsidOld), debugstr_guid(clsidNew)); sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]); WINE_StringFromCLSID(clsidNew, szClsidNew); if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey)) @@ -2024,27 +1972,91 @@ HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew) res = REGDB_E_CLASSNOTREG; goto done; } - if (RegCreateKeyA(hkey, "AutoConvertTo", &hkeyConvert)) - { - res = REGDB_E_WRITEREGDB; - goto done; - } - if (RegSetValueExA(hkeyConvert, NULL, 0, - REG_SZ, (LPBYTE)szClsidNew, strlen(szClsidNew)+1)) + if (RegSetValueA(hkey, "AutoConvertTo", REG_SZ, szClsidNew, strlen(szClsidNew)+1)) { res = REGDB_E_WRITEREGDB; goto done; } done: - if (hkeyConvert) RegCloseKey(hkeyConvert); if (hkey) RegCloseKey(hkey); - return res; } +/****************************************************************************** + * OleDoAutoConvert [OLE32.@] + */ +HRESULT WINAPI OleDoAutoConvert(IStorage *pStg, LPCLSID pClsidNew) +{ + FIXME("(%p,%p) : stub\n",pStg,pClsidNew); + return E_NOTIMPL; +} + +/****************************************************************************** + * CoTreatAsClass [OLE32.@] + */ +HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew) +{ + HKEY hkey = 0; + char buf[200], szClsidNew[200]; + HRESULT res = S_OK; + + FIXME("(%s,%s)\n", debugstr_guid(clsidOld), debugstr_guid(clsidNew)); + sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]); + WINE_StringFromCLSID(clsidNew, szClsidNew); + if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey)) + { + res = REGDB_E_CLASSNOTREG; + goto done; + } + if (RegSetValueA(hkey, "AutoTreatAs", REG_SZ, szClsidNew, strlen(szClsidNew)+1)) + { + res = REGDB_E_WRITEREGDB; + goto done; + } + +done: + if (hkey) RegCloseKey(hkey); + return res; +} + +/****************************************************************************** + * CoGetTreatAsClass [OLE32.@] + * + * Reads the TreatAs value from a class. + */ +HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID clsidNew) +{ + HKEY hkey = 0; + char buf[200], szClsidNew[200]; + HRESULT res = S_OK; + LONG len = sizeof(szClsidNew); + + FIXME("(%s,%p)\n", debugstr_guid(clsidOld), clsidNew); + sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]); + memcpy(clsidNew,clsidOld,sizeof(CLSID)); /* copy over old value */ + + if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey)) + { + res = REGDB_E_CLASSNOTREG; + goto done; + } + if (RegQueryValueA(hkey, "TreatAs", szClsidNew, &len)) + { + res = S_FALSE; + goto done; + } + res = __CLSIDFromStringA(szClsidNew,clsidNew); + if (FAILED(res)) + FIXME("Failed CLSIDFromStringA(%s), hres %lx?\n",szClsidNew,res); +done: + if (hkey) RegCloseKey(hkey); + return res; + +} + /*********************************************************************** - * IsEqualGUID [OLE32.76] + * IsEqualGUID [OLE32.@] * * Compares two Unique Identifiers. * @@ -2059,3 +2071,18 @@ BOOL WINAPI IsEqualGUID( { return !memcmp(rguid1,rguid2,sizeof(GUID)); } + +/*********************************************************************** + * CoInitializeSecurity [OLE32.@] + */ +HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, + SOLE_AUTHENTICATION_SERVICE* asAuthSvc, + void* pReserved1, DWORD dwAuthnLevel, + DWORD dwImpLevel, void* pReserved2, + DWORD dwCapabilities, void* pReserved3) +{ + FIXME("(%p,%ld,%p,%p,%ld,%ld,%p,%ld,%p) - stub!\n", pSecDesc, cAuthSvc, + asAuthSvc, pReserved1, dwAuthnLevel, dwImpLevel, pReserved2, + dwCapabilities, pReserved3); + return S_OK; +} diff --git a/reactos/lib/ole32/compobj_private.h b/reactos/lib/ole32/compobj_private.h new file mode 100644 index 00000000000..6c91af6e230 --- /dev/null +++ b/reactos/lib/ole32/compobj_private.h @@ -0,0 +1,226 @@ +/* + * Copyright 1995 Martin von Loewis + * Copyright 1998 Justin Bradford + * Copyright 1999 Francis Beaudet + * Copyright 1999 Sylvain St-Germain + * Copyright 2002 Marcus Meissner + * Copyright 2003 Ove Kåven, TransGaming Technologies + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WINE_OLE_COMPOBJ_H +#define __WINE_OLE_COMPOBJ_H + +/* All private prototype functions used by OLE will be added to this header file */ + +#include + +#include "windef.h" +#include "winbase.h" +#include "wtypes.h" +#include "dcom.h" +#include "winreg.h" +#include "winternl.h" + +/* exported interface */ +typedef struct tagXIF { + struct tagXIF *next; + LPVOID iface; /* interface pointer */ + IID iid; /* interface ID */ + IPID ipid; /* exported interface ID */ + LPRPCSTUBBUFFER stub; /* interface stub */ + DWORD refs; /* external reference count */ + HRESULT hres; /* result of stub creation attempt */ +} XIF; + +/* exported object */ +typedef struct tagXOBJECT { + ICOM_VTABLE(IRpcStubBuffer) *lpVtbl; + struct tagAPARTMENT *parent; + struct tagXOBJECT *next; + LPUNKNOWN obj; /* object identity (IUnknown) */ + OID oid; /* object ID */ + DWORD ifc; /* interface ID counter */ + XIF *ifaces; /* exported interfaces */ + DWORD refs; /* external reference count */ +} XOBJECT; + +/* imported interface */ +typedef struct tagIIF { + struct tagIIF *next; + LPVOID iface; /* interface pointer */ + IID iid; /* interface ID */ + IPID ipid; /* imported interface ID */ + LPRPCPROXYBUFFER proxy; /* interface proxy */ + DWORD refs; /* imported (public) references */ + HRESULT hres; /* result of proxy creation attempt */ +} IIF; + +/* imported object */ +typedef struct tagIOBJECT { + ICOM_VTABLE(IRemUnknown) *lpVtbl; + struct tagAPARTMENT *parent; + struct tagIOBJECT *next; + LPRPCCHANNELBUFFER chan; /* channel to object */ + OXID oxid; /* object exported ID */ + OID oid; /* object ID */ + IPID ipid; /* first imported interface ID */ + IIF *ifaces; /* imported interfaces */ + DWORD refs; /* proxy reference count */ +} IOBJECT; + +/* apartment */ +typedef struct tagAPARTMENT { + struct tagAPARTMENT *next, *prev, *parent; + DWORD model; /* threading model */ + DWORD inits; /* CoInitialize count */ + DWORD tid; /* thread id */ + HANDLE thread; /* thread handle */ + OXID oxid; /* object exporter ID */ + OID oidc; /* object ID counter */ + HWND win; /* message window */ + CRITICAL_SECTION cs; /* thread safety */ + LPMESSAGEFILTER filter; /* message filter */ + XOBJECT *objs; /* exported objects */ + IOBJECT *proxies; /* imported objects */ + LPVOID ErrorInfo; /* thread error info */ +} APARTMENT; + +extern APARTMENT MTA, *apts; + +extern void* StdGlobalInterfaceTable_Construct(); +extern void StdGlobalInterfaceTable_Destroy(void* self); +extern HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv); + +extern HRESULT WINE_StringFromCLSID(const CLSID *id,LPSTR idstr); +extern HRESULT create_marshalled_proxy(REFCLSID rclsid, REFIID iid, LPVOID *ppv); + +extern void* StdGlobalInterfaceTableInstance; + +inline static HRESULT +get_facbuf_for_iid(REFIID riid,IPSFactoryBuffer **facbuf) { + HRESULT hres; + CLSID pxclsid; + + if ((hres = CoGetPSClsid(riid,&pxclsid))) + return hres; + return CoGetClassObject(&pxclsid,CLSCTX_INPROC_SERVER,NULL,&IID_IPSFactoryBuffer,(LPVOID*)facbuf); +} + +#define PIPEPREF "\\\\.\\pipe\\" +#define OLESTUBMGR PIPEPREF"WINE_OLE_StubMgr" +/* Standard Marshalling definitions */ +typedef struct _wine_marshal_id { + DWORD processid; + DWORD objectid; /* unique value corresp. IUnknown of object */ + IID iid; +} wine_marshal_id; + +inline static BOOL +MARSHAL_Compare_Mids(wine_marshal_id *mid1,wine_marshal_id *mid2) { + return + (mid1->processid == mid2->processid) && + (mid1->objectid == mid2->objectid) && + IsEqualIID(&(mid1->iid),&(mid2->iid)) + ; +} + +/* compare without interface compare */ +inline static BOOL +MARSHAL_Compare_Mids_NoInterface(wine_marshal_id *mid1, wine_marshal_id *mid2) { + return + (mid1->processid == mid2->processid) && + (mid1->objectid == mid2->objectid) + ; +} + +HRESULT MARSHAL_Find_Stub_Buffer(wine_marshal_id *mid,IRpcStubBuffer **stub); +HRESULT MARSHAL_Find_Stub_Server(wine_marshal_id *mid,LPUNKNOWN *punk); +HRESULT MARSHAL_Register_Stub(wine_marshal_id *mid,LPUNKNOWN punk, IRpcStubBuffer *stub); + +HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv); + +typedef struct _wine_marshal_data { + DWORD dwDestContext; + DWORD mshlflags; +} wine_marshal_data; + + +#define REQTYPE_REQUEST 0 +typedef struct _wine_rpc_request_header { + DWORD reqid; + wine_marshal_id mid; + DWORD iMethod; + DWORD cbBuffer; +} wine_rpc_request_header; + +#define REQTYPE_RESPONSE 1 +typedef struct _wine_rpc_response_header { + DWORD reqid; + DWORD cbBuffer; + DWORD retval; +} wine_rpc_response_header; + +#define REQSTATE_START 0 +#define REQSTATE_REQ_QUEUED 1 +#define REQSTATE_REQ_WAITING_FOR_REPLY 2 +#define REQSTATE_REQ_GOT 3 +#define REQSTATE_INVOKING 4 +#define REQSTATE_RESP_QUEUED 5 +#define REQSTATE_RESP_GOT 6 +#define REQSTATE_DONE 6 + +void STUBMGR_Start(); + +extern HRESULT PIPE_GetNewPipeBuf(wine_marshal_id *mid, IRpcChannelBuffer **pipebuf); + +/* This function initialize the Running Object Table */ +HRESULT WINAPI RunningObjectTableImpl_Initialize(); + +/* This function uninitialize the Running Object Table */ +HRESULT WINAPI RunningObjectTableImpl_UnInitialize(); + +/* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */ +int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable); + +HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id); + +/* + * Per-thread values are stored in the TEB on offset 0xF80, + * see http://www.microsoft.com/msj/1099/bugslayer/bugslayer1099.htm + */ +#ifndef __REACTOS__ +static inline APARTMENT* COM_CurrentInfo(void) WINE_UNUSED; +#endif +static inline APARTMENT* COM_CurrentInfo(void) +{ + APARTMENT* apt = NtCurrentTeb()->ReservedForOle; + return apt; +} +#ifndef __REACTOS__ +static inline APARTMENT* COM_CurrentApt(void) WINE_UNUSED; +#endif +static inline APARTMENT* COM_CurrentApt(void) +{ + APARTMENT* apt = COM_CurrentInfo(); + if (apt && apt->parent) apt = apt->parent; + return apt; +} + +/* compobj.c */ +HWND COM_GetApartmentWin(OXID oxid); + +#endif /* __WINE_OLE_COMPOBJ_H */ diff --git a/reactos/lib/ole32/compositemoniker.c b/reactos/lib/ole32/compositemoniker.c index 337b096c5d3..f21d278d1e9 100644 --- a/reactos/lib/ole32/compositemoniker.c +++ b/reactos/lib/ole32/compositemoniker.c @@ -1,20 +1,49 @@ -/*************************************************************************************** +/* * CompositeMonikers implementation * * Copyright 1999 Noomen Hamza - ***************************************************************************************/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ -#include -#include +#include +#include #include -#include -#include -#include -#include +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "winerror.h" +#include "wine/debug.h" +#include "wine/unicode.h" +#include "ole2.h" +#include "moniker.h" -#include +WINE_DEFAULT_DEBUG_CHANNEL(ole); +const CLSID CLSID_CompositeMoniker = { + 0x309, 0, 0, {0xC0, 0, 0, 0, 0, 0, 0, 0x46} +}; #define BLOCK_TAB_SIZE 5 /* represent the first size table and it's increment block size */ @@ -23,8 +52,9 @@ typedef struct CompositeMonikerImpl{ ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ - /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether - * two monikers are equal. That's whay IROTData interface is implemented by monikers. + /* The ROT (RunningObjectTable implementation) uses the IROTData + * interface to test whether two monikers are equal. That's why IROTData + * interface is implemented by monikers. */ ICOM_VTABLE(IROTData)* lpvtbl2; /* VTable relative to the IROTData interface.*/ @@ -183,13 +213,13 @@ static ICOM_VTABLE(IEnumMoniker) VT_EnumMonikerImpl = HRESULT WINAPI CompositeMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject) { ICOM_THIS(CompositeMonikerImpl,iface); - - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,riid,ppvObject)); + + TRACE("(%p,%p,%p)\n",This,riid,ppvObject); /* Perform a sanity check on the parameters.*/ if ( (This==0) || (ppvObject==0) ) return E_INVALIDARG; - + /* Initialize the return parameter */ *ppvObject = 0; @@ -220,7 +250,7 @@ ULONG WINAPI CompositeMonikerImpl_AddRef(IMoniker* iface) { ICOM_THIS(CompositeMonikerImpl,iface); - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); return ++(This->ref); } @@ -232,8 +262,8 @@ ULONG WINAPI CompositeMonikerImpl_Release(IMoniker* iface) { ICOM_THIS(CompositeMonikerImpl,iface); ULONG i; - - Print(MAX_TRACE, ("(%p)\n",This)); + + TRACE("(%p)\n",This); This->ref--; @@ -243,12 +273,12 @@ ULONG WINAPI CompositeMonikerImpl_Release(IMoniker* iface) /* release all the components before destroying this object */ for (i=0;itabLastIndex;i++) IMoniker_Release(This->tabMoniker[i]); - + CompositeMonikerImpl_Destroy(This); return 0; } - return This->ref;; + return This->ref; } /****************************************************************************** @@ -256,13 +286,13 @@ ULONG WINAPI CompositeMonikerImpl_Release(IMoniker* iface) ******************************************************************************/ HRESULT WINAPI CompositeMonikerImpl_GetClassID(IMoniker* iface,CLSID *pClassID) { - Print(MAX_TRACE, ("(%p,%p),stub!\n",iface,pClassID)); + TRACE("(%p,%p),stub!\n",iface,pClassID); if (pClassID==NULL) return E_POINTER; - + *pClassID = CLSID_CompositeMoniker; - + return S_OK; } @@ -275,7 +305,7 @@ HRESULT WINAPI CompositeMonikerImpl_IsDirty(IMoniker* iface) method in the OLE-provided moniker interfaces always return S_FALSE because their internal state never changes. */ - Print(MAX_TRACE, ("(%p)\n",iface)); + TRACE("(%p)\n",iface); return S_FALSE; } @@ -289,14 +319,14 @@ HRESULT WINAPI CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm) DWORD constant; CLSID clsid; WCHAR string[1]={0}; - - ICOM_THIS(CompositeMonikerImpl,iface); - Print(MAX_TRACE, ("(%p,%p)\n",iface,pStm)); + ICOM_THIS(CompositeMonikerImpl,iface); + + TRACE("(%p,%p)\n",iface,pStm); /* this function call OleLoadFromStream function for each moniker within this object */ - /* read the a constant writen by CompositeMonikerImpl_Save (see CompositeMonikerImpl_Save for more details)*/ + /* read the a constant written by CompositeMonikerImpl_Save (see CompositeMonikerImpl_Save for more details)*/ res=IStream_Read(pStm,&constant,sizeof(DWORD),NULL); if (SUCCEEDED(res)&& constant!=3) @@ -307,7 +337,7 @@ HRESULT WINAPI CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm) res=OleLoadFromStream(pStm,&IID_IMoniker,(void**)&This->tabMoniker[This->tabLastIndex]); #endif res=ReadClassStm(pStm,&clsid); - Print(MAX_TRACE, ("res=%ld",res)); + DPRINTF("res=%ld",res); if (FAILED(res)) break; @@ -340,7 +370,7 @@ HRESULT WINAPI CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm) else { - Print(MIN_TRACE, ("()\n")); + FIXME("()\n"); /* FIXME: To whoever wrote this code: It's either return or break. it cannot be both! */ break; return E_NOTIMPL; @@ -348,7 +378,7 @@ HRESULT WINAPI CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm) /* resize the table if needed */ if (++This->tabLastIndex==This->tabSize){ - + This->tabSize+=BLOCK_TAB_SIZE; This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); @@ -369,13 +399,15 @@ HRESULT WINAPI CompositeMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fCle IEnumMoniker *enumMk; IMoniker *pmk; DWORD constant=3; - - Print(MAX_TRACE, ("(%p,%p,%d)\n",iface,pStm,fClearDirty)); - /* this function call OleSaveToStream function for each moniker within this object */ + TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty); - /* when I tested this function in windows system ! I usually found this constant in the begining of */ - /* the stream I dont known why (there's no indication in specification) ! */ + /* This function calls OleSaveToStream function for each moniker within + * this object. + * When I tested this function in windows, I usually found this constant + * at the beginning of the stream. I don't known why (there's no + * indication in the specification) ! + */ res=IStream_Write(pStm,&constant,sizeof(constant),NULL); IMoniker_Enum(iface,TRUE,&enumMk); @@ -407,10 +439,11 @@ HRESULT WINAPI CompositeMonikerImpl_GetSizeMax(IMoniker* iface,ULARGE_INTEGER* p IMoniker *pmk; ULARGE_INTEGER ptmpSize; - /* the sizeMax of this object is calculated by calling GetSizeMax on each moniker within this object then */ - /* suming all returned sizemax */ + /* The sizeMax of this object is calculated by calling GetSizeMax on + * each moniker within this object then summing all returned values + */ - Print(MAX_TRACE, ("(%p,%p)\n",iface,pcbSize)); + TRACE("(%p,%p)\n",iface,pcbSize); if (pcbSize!=NULL) return E_POINTER; @@ -444,10 +477,10 @@ HRESULT WINAPI CompositeMonikerImpl_Construct(CompositeMonikerImpl* This,LPMONIK IEnumMoniker *enumMoniker; IMoniker *tempMk; HRESULT res; - - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,pmkFirst,pmkRest)); - /* Initialize the virtual fgunction table. */ + TRACE("(%p,%p,%p)\n",This,pmkFirst,pmkRest); + + /* Initialize the virtual function table. */ This->lpvtbl1 = &VT_CompositeMonikerImpl; This->lpvtbl2 = &VT_ROTDataImpl; This->ref = 0; @@ -461,7 +494,7 @@ HRESULT WINAPI CompositeMonikerImpl_Construct(CompositeMonikerImpl* This,LPMONIK IMoniker_IsSystemMoniker(pmkFirst,&mkSys); - /* put the first moniker contents in the begining of the table */ + /* put the first moniker contents in the beginning of the table */ if (mkSys!=MKSYS_GENERICCOMPOSITE){ This->tabMoniker[(This->tabLastIndex)++]=pmkFirst; @@ -470,12 +503,12 @@ HRESULT WINAPI CompositeMonikerImpl_Construct(CompositeMonikerImpl* This,LPMONIK else{ IMoniker_Enum(pmkFirst,TRUE,&enumMoniker); - + while(IEnumMoniker_Next(enumMoniker,1,&This->tabMoniker[This->tabLastIndex],NULL)==S_OK){ if (++This->tabLastIndex==This->tabSize){ - + This->tabSize+=BLOCK_TAB_SIZE; This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); @@ -490,14 +523,14 @@ HRESULT WINAPI CompositeMonikerImpl_Construct(CompositeMonikerImpl* This,LPMONIK /* put the rest moniker contents after the first one and make simplification if needed */ IMoniker_IsSystemMoniker(pmkRest,&mkSys); - + if (mkSys!=MKSYS_GENERICCOMPOSITE){ /* add a simple moniker to the moniker table */ res=IMoniker_ComposeWith(This->tabMoniker[This->tabLastIndex-1],pmkRest,TRUE,&tempMk); - if (res==MK_E_NEEDGENERIC){ + if (res==MK_E_NEEDGENERIC){ /* there's no simplification in this case */ This->tabMoniker[This->tabLastIndex]=pmkRest; @@ -506,7 +539,7 @@ HRESULT WINAPI CompositeMonikerImpl_Construct(CompositeMonikerImpl* This,LPMONIK IMoniker_AddRef(pmkRest); } - else if (tempMk==NULL){ + else if (tempMk==NULL){ /* we have an antimoniker after a simple moniker so we can make a simplification in this case */ IMoniker_Release(This->tabMoniker[This->tabLastIndex-1]); @@ -524,7 +557,7 @@ HRESULT WINAPI CompositeMonikerImpl_Construct(CompositeMonikerImpl* This,LPMONIK /* resize tabMoniker if needed */ if (This->tabLastIndex==This->tabSize){ - + This->tabSize+=BLOCK_TAB_SIZE; This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); @@ -535,8 +568,10 @@ HRESULT WINAPI CompositeMonikerImpl_Construct(CompositeMonikerImpl* This,LPMONIK } else{ - /* add a composite moniker to the moniker table (do the same thing for each moniker within the */ - /* composite moniker as a simple moniker (see above how to add a simple moniker case) ) */ + /* add a composite moniker to the moniker table (do the same thing + * for each moniker within the composite moniker as a simple moniker + * (see above for how to add a simple moniker case) ) + */ IMoniker_Enum(pmkRest,TRUE,&enumMoniker); while(IEnumMoniker_Next(enumMoniker,1,&This->tabMoniker[This->tabLastIndex],NULL)==S_OK){ @@ -561,7 +596,7 @@ HRESULT WINAPI CompositeMonikerImpl_Construct(CompositeMonikerImpl* This,LPMONIK } if (This->tabLastIndex==This->tabSize){ - + This->tabSize+=BLOCK_TAB_SIZE; This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); @@ -582,7 +617,7 @@ HRESULT WINAPI CompositeMonikerImpl_Construct(CompositeMonikerImpl* This,LPMONIK *******************************************************************************/ HRESULT WINAPI CompositeMonikerImpl_Destroy(CompositeMonikerImpl* This) { - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); HeapFree(GetProcessHeap(),0,This->tabMoniker); @@ -604,12 +639,12 @@ HRESULT WINAPI CompositeMonikerImpl_BindToObject(IMoniker* iface, IRunningObjectTable *prot; IMoniker *tempMk,*antiMk,*mostRigthMk; IEnumMoniker *enumMoniker; - - Print(MAX_TRACE, ("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult)); + + TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult); if (ppvResult==NULL) return E_POINTER; - + *ppvResult=0; /* If pmkToLeft is NULL, this method looks for the moniker in the ROT, and if found, queries the retrieved */ /* object for the requested interface pointer. */ @@ -633,11 +668,11 @@ HRESULT WINAPI CompositeMonikerImpl_BindToObject(IMoniker* iface, IMoniker_Enum(iface,FALSE,&enumMoniker); IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); IEnumMoniker_Release(enumMoniker); - + res=CreateAntiMoniker(&antiMk); res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); IMoniker_Release(antiMk); - + res=CompositeMonikerImpl_BindToObject(mostRigthMk,pbc,tempMk,riid,ppvResult); IMoniker_Release(tempMk); @@ -660,7 +695,7 @@ HRESULT WINAPI CompositeMonikerImpl_BindToStorage(IMoniker* iface, IMoniker *tempMk,*antiMk,*mostRigthMk; IEnumMoniker *enumMoniker; - Print(MAX_TRACE, ("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult)); + TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult); *ppvResult=0; @@ -668,15 +703,15 @@ HRESULT WINAPI CompositeMonikerImpl_BindToStorage(IMoniker* iface, /* passing the rest of the composite as the pmkToLeft parameter for that call. */ if (pmkToLeft!=NULL){ - + IMoniker_Enum(iface,FALSE,&enumMoniker); IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); IEnumMoniker_Release(enumMoniker); - + res=CreateAntiMoniker(&antiMk); res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); IMoniker_Release(antiMk); - + res=CompositeMonikerImpl_BindToStorage(mostRigthMk,pbc,tempMk,riid,ppvResult); IMoniker_Release(tempMk); @@ -702,7 +737,7 @@ HRESULT WINAPI CompositeMonikerImpl_Reduce(IMoniker* iface, IMoniker *tempMk,*antiMk,*mostRigthMk,*leftReducedComposedMk,*mostRigthReducedMk; IEnumMoniker *enumMoniker; - Print(MAX_TRACE, ("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced)); + TRACE("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced); if (ppmkReduced==NULL) return E_POINTER; @@ -714,7 +749,7 @@ HRESULT WINAPI CompositeMonikerImpl_Reduce(IMoniker* iface, IMoniker_Enum(iface,FALSE,&enumMoniker); IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); IEnumMoniker_Release(enumMoniker); - + res=CreateAntiMoniker(&antiMk); res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); IMoniker_Release(antiMk); @@ -731,7 +766,7 @@ HRESULT WINAPI CompositeMonikerImpl_Reduce(IMoniker* iface, IMoniker_Enum(iface,FALSE,&enumMoniker); IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); IEnumMoniker_Release(enumMoniker); - + res=CreateAntiMoniker(&antiMk); res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); IMoniker_Release(antiMk); @@ -764,7 +799,7 @@ HRESULT WINAPI CompositeMonikerImpl_ComposeWith(IMoniker* iface, BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite) { - Print(MAX_TRACE, ("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite)); + TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite); if ((ppmkComposite==NULL)||(pmkRight==NULL)) return E_POINTER; @@ -774,10 +809,10 @@ HRESULT WINAPI CompositeMonikerImpl_ComposeWith(IMoniker* iface, /* If fOnlyIfNotGeneric is TRUE, this method sets *pmkComposite to NULL and returns MK_E_NEEDGENERIC; */ /* otherwise, the method returns the result of combining the two monikers by calling the */ /* CreateGenericComposite function */ - + if (fOnlyIfNotGeneric) return MK_E_NEEDGENERIC; - + return CreateGenericComposite(iface,pmkRight,ppmkComposite); } @@ -788,11 +823,11 @@ HRESULT WINAPI CompositeMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMon { ICOM_THIS(CompositeMonikerImpl,iface); - Print(MAX_TRACE, ("(%p,%d,%p)\n",iface,fForward,ppenumMoniker)); + TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker); if (ppenumMoniker == NULL) return E_POINTER; - + return EnumMonikerImpl_CreateEnumMoniker(This->tabMoniker,This->tabLastIndex,0,fForward,ppenumMoniker); } @@ -804,8 +839,8 @@ HRESULT WINAPI CompositeMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMo IEnumMoniker *enumMoniker1,*enumMoniker2; IMoniker *tempMk1,*tempMk2; HRESULT res1,res2,res; - - Print(MAX_TRACE, ("(%p,%p)\n",iface,pmkOtherMoniker)); + + TRACE("(%p,%p)\n",iface,pmkOtherMoniker); if (pmkOtherMoniker==NULL) return S_FALSE; @@ -816,14 +851,14 @@ HRESULT WINAPI CompositeMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMo if (enumMoniker1==NULL) return S_FALSE; - + IMoniker_Enum(iface,TRUE,&enumMoniker2); while(1){ res1=IEnumMoniker_Next(enumMoniker1,1,&tempMk1,NULL); res2=IEnumMoniker_Next(enumMoniker2,1,&tempMk2,NULL); - + if((res1==S_OK)&&(res2==S_OK)){ if(IMoniker_IsEqual(tempMk1,tempMk2)==S_FALSE){ @@ -859,7 +894,7 @@ HRESULT WINAPI CompositeMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMo ******************************************************************************/ HRESULT WINAPI CompositeMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash) { - Print(MIN_TRACE, ("(),stub!\n")); + FIXME("(),stub!\n"); return E_NOTIMPL; } @@ -877,7 +912,7 @@ HRESULT WINAPI CompositeMonikerImpl_IsRunning(IMoniker* iface, IMoniker *tempMk,*antiMk,*mostRigthMk; IEnumMoniker *enumMoniker; - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning)); + TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning); /* If pmkToLeft is non-NULL, this method composes pmkToLeft with this moniker and calls IsRunning on the result.*/ if (pmkToLeft!=NULL){ @@ -893,7 +928,7 @@ HRESULT WINAPI CompositeMonikerImpl_IsRunning(IMoniker* iface, else /* If pmkToLeft is NULL, this method returns S_OK if pmkNewlyRunning is non-NULL and is equal */ /* to this moniker */ - + if (pmkNewlyRunning!=NULL) if (IMoniker_IsEqual(iface,pmkNewlyRunning)==S_OK) @@ -911,7 +946,7 @@ HRESULT WINAPI CompositeMonikerImpl_IsRunning(IMoniker* iface, /* the moniker is running. If so, the method returns S_OK; otherwise, it recursively calls */ /* IMoniker::IsRunning on the rightmost component of the composite, passing the remainder of */ /* the composite as the pmkToLeft parameter for that call. */ - + res=IBindCtx_GetRunningObjectTable(pbc,&rot); if (FAILED(res)) @@ -955,8 +990,8 @@ HRESULT WINAPI CompositeMonikerImpl_GetTimeOfLastChange(IMoniker* iface, HRESULT res; IMoniker *tempMk,*antiMk,*mostRigthMk; IEnumMoniker *enumMoniker; - - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pCompositeTime)); + + TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pCompositeTime); if (pCompositeTime==NULL) return E_INVALIDARG; @@ -1006,7 +1041,7 @@ HRESULT WINAPI CompositeMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk) IMoniker *tempMk,*antiMk,*mostRigthMk,*tempInvMk,*mostRigthInvMk; IEnumMoniker *enumMoniker; - Print(MAX_TRACE, ("(%p,%p)\n",iface,ppmk)); + TRACE("(%p,%p)\n",iface,ppmk); if (ppmk==NULL) return E_POINTER; @@ -1052,19 +1087,19 @@ HRESULT WINAPI CompositeMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* p IMoniker *tempMk1,*tempMk2,*mostLeftMk1,*mostLeftMk2; IEnumMoniker *enumMoniker1,*enumMoniker2; ULONG i,nbCommonMk=0; - + /* If the other moniker is a composite, this method compares the components of each composite from left */ /* to right. The returned common prefix moniker might also be a composite moniker, depending on how many */ /* of the leftmost components were common to both monikers. */ if (ppmkPrefix==NULL) return E_POINTER; - + *ppmkPrefix=0; if (pmkOther==NULL) return MK_E_NOPREFIX; - + IMoniker_IsSystemMoniker(pmkOther,&mkSys); if((mkSys==MKSYS_GENERICCOMPOSITE)){ @@ -1128,7 +1163,7 @@ HRESULT WINAPI CompositeMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* p CreateGenericComposite(tempMk1,tempMk2,ppmkPrefix); IMoniker_Release(tempMk1); IMoniker_Release(tempMk2); - + /* compose all common monikers in a composite moniker */ for(i=0;iref); @@ -1513,13 +1548,13 @@ ULONG WINAPI EnumMonikerImpl_Release(IEnumMoniker* iface) ICOM_THIS(EnumMonikerImpl,iface); ULONG i ; - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); This->ref--; /* destroy the object if there's no more reference on it */ if (This->ref==0){ - + for(i=0;itabSize;i++) IMoniker_Release(This->tabMoniker[i]); @@ -1528,7 +1563,7 @@ ULONG WINAPI EnumMonikerImpl_Release(IEnumMoniker* iface) return 0; } - return This->ref;; + return This->ref; } /****************************************************************************** @@ -1546,7 +1581,7 @@ HRESULT WINAPI EnumMonikerImpl_Next(IEnumMoniker* iface,ULONG celt, IMoniker** r if (pceltFethed!=NULL) *pceltFethed= i; - + if (i==celt) return S_OK; else @@ -1564,7 +1599,7 @@ HRESULT WINAPI EnumMonikerImpl_Skip(IEnumMoniker* iface,ULONG celt){ return S_FALSE; This->currentPos+=celt; - + return S_OK; } @@ -1603,16 +1638,16 @@ HRESULT WINAPI EnumMonikerImpl_CreateEnumMoniker(IMoniker** tabMoniker, int i; + if (currentPos > tabSize) + return E_INVALIDARG; + newEnumMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(EnumMonikerImpl)); if (newEnumMoniker == 0) return STG_E_INSUFFICIENTMEMORY; - if (currentPos > tabSize) - return E_INVALIDARG; - /* Initialize the virtual function table. */ - ICOM_VTBL(newEnumMoniker) = &VT_EnumMonikerImpl; + newEnumMoniker->lpVtbl = &VT_EnumMonikerImpl; newEnumMoniker->ref = 0; newEnumMoniker->tabSize=tabSize; @@ -1620,8 +1655,10 @@ HRESULT WINAPI EnumMonikerImpl_CreateEnumMoniker(IMoniker** tabMoniker, newEnumMoniker->tabMoniker=HeapAlloc(GetProcessHeap(),0,tabSize*sizeof(IMoniker)); - if (newEnumMoniker->tabMoniker==NULL) + if (newEnumMoniker->tabMoniker==NULL) { + HeapFree(GetProcessHeap(), 0, newEnumMoniker); return E_OUTOFMEMORY; + } if (leftToRigth) for (i=0;i -#include +#include +#include #include -#include -#include -#include -#include - -#include +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winerror.h" +#include "wine/unicode.h" +#include "ole2.h" +#include "wine/debug.h" +WINE_DEFAULT_DEBUG_CHANNEL(ole); /**************************************************************************** * PresentationDataHeader @@ -73,10 +94,10 @@ struct DataCache /* * List all interface VTables here */ - ICOM_VTABLE(IDataObject)* lpvtbl1; + ICOM_VTABLE(IDataObject)* lpvtbl1; ICOM_VTABLE(IUnknown)* lpvtbl2; ICOM_VTABLE(IPersistStorage)* lpvtbl3; - ICOM_VTABLE(IViewObject2)* lpvtbl4; + ICOM_VTABLE(IViewObject2)* lpvtbl4; ICOM_VTABLE(IOleCache2)* lpvtbl5; ICOM_VTABLE(IOleCacheControl)* lpvtbl6; @@ -111,17 +132,17 @@ struct DataCache typedef struct DataCache DataCache; /* - * Here, I define utility macros to help with the casting of the + * Here, I define utility macros to help with the casting of the * "this" parameter. * There is a version to accomodate all of the VTables implemented * by this object. */ #define _ICOM_THIS_From_IDataObject(class,name) class* this = (class*)name; -#define _ICOM_THIS_From_NDIUnknown(class, name) class* this = (class*)(((char*)name)-sizeof(void*)); -#define _ICOM_THIS_From_IPersistStorage(class, name) class* this = (class*)(((char*)name)-2*sizeof(void*)); -#define _ICOM_THIS_From_IViewObject2(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*)); -#define _ICOM_THIS_From_IOleCache2(class, name) class* this = (class*)(((char*)name)-4*sizeof(void*)); -#define _ICOM_THIS_From_IOleCacheControl(class, name) class* this = (class*)(((char*)name)-5*sizeof(void*)); +#define _ICOM_THIS_From_NDIUnknown(class, name) class* this = (class*)(((char*)name)-sizeof(void*)); +#define _ICOM_THIS_From_IPersistStorage(class, name) class* this = (class*)(((char*)name)-2*sizeof(void*)); +#define _ICOM_THIS_From_IViewObject2(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*)); +#define _ICOM_THIS_From_IOleCache2(class, name) class* this = (class*)(((char*)name)-4*sizeof(void*)); +#define _ICOM_THIS_From_IOleCacheControl(class, name) class* this = (class*)(((char*)name)-5*sizeof(void*)); /* * Prototypes for the methods of the DataCache class. @@ -149,9 +170,9 @@ static HRESULT WINAPI DataCache_NDIUnknown_QueryInterface( IUnknown* iface, REFIID riid, void** ppvObject); -static ULONG WINAPI DataCache_NDIUnknown_AddRef( +static ULONG WINAPI DataCache_NDIUnknown_AddRef( IUnknown* iface); -static ULONG WINAPI DataCache_NDIUnknown_Release( +static ULONG WINAPI DataCache_NDIUnknown_Release( IUnknown* iface); /* @@ -162,39 +183,39 @@ static HRESULT WINAPI DataCache_IDataObject_QueryInterface( IDataObject* iface, REFIID riid, void** ppvObject); -static ULONG WINAPI DataCache_IDataObject_AddRef( +static ULONG WINAPI DataCache_IDataObject_AddRef( IDataObject* iface); -static ULONG WINAPI DataCache_IDataObject_Release( +static ULONG WINAPI DataCache_IDataObject_Release( IDataObject* iface); static HRESULT WINAPI DataCache_GetData( IDataObject* iface, - LPFORMATETC pformatetcIn, + LPFORMATETC pformatetcIn, STGMEDIUM* pmedium); static HRESULT WINAPI DataCache_GetDataHere( - IDataObject* iface, + IDataObject* iface, LPFORMATETC pformatetc, STGMEDIUM* pmedium); static HRESULT WINAPI DataCache_QueryGetData( IDataObject* iface, LPFORMATETC pformatetc); static HRESULT WINAPI DataCache_GetCanonicalFormatEtc( - IDataObject* iface, - LPFORMATETC pformatectIn, + IDataObject* iface, + LPFORMATETC pformatectIn, LPFORMATETC pformatetcOut); static HRESULT WINAPI DataCache_IDataObject_SetData( IDataObject* iface, - LPFORMATETC pformatetc, - STGMEDIUM* pmedium, + LPFORMATETC pformatetc, + STGMEDIUM* pmedium, BOOL fRelease); static HRESULT WINAPI DataCache_EnumFormatEtc( - IDataObject* iface, + IDataObject* iface, DWORD dwDirection, IEnumFORMATETC** ppenumFormatEtc); static HRESULT WINAPI DataCache_DAdvise( - IDataObject* iface, - FORMATETC* pformatetc, - DWORD advf, - IAdviseSink* pAdvSink, + IDataObject* iface, + FORMATETC* pformatetc, + DWORD advf, + IAdviseSink* pAdvSink, DWORD* pdwConnection); static HRESULT WINAPI DataCache_DUnadvise( IDataObject* iface, @@ -211,27 +232,27 @@ static HRESULT WINAPI DataCache_IPersistStorage_QueryInterface( IPersistStorage* iface, REFIID riid, void** ppvObject); -static ULONG WINAPI DataCache_IPersistStorage_AddRef( +static ULONG WINAPI DataCache_IPersistStorage_AddRef( IPersistStorage* iface); -static ULONG WINAPI DataCache_IPersistStorage_Release( +static ULONG WINAPI DataCache_IPersistStorage_Release( IPersistStorage* iface); -static HRESULT WINAPI DataCache_GetClassID( +static HRESULT WINAPI DataCache_GetClassID( IPersistStorage* iface, CLSID* pClassID); -static HRESULT WINAPI DataCache_IsDirty( +static HRESULT WINAPI DataCache_IsDirty( IPersistStorage* iface); -static HRESULT WINAPI DataCache_InitNew( - IPersistStorage* iface, - IStorage* pStg); -static HRESULT WINAPI DataCache_Load( +static HRESULT WINAPI DataCache_InitNew( IPersistStorage* iface, IStorage* pStg); -static HRESULT WINAPI DataCache_Save( +static HRESULT WINAPI DataCache_Load( IPersistStorage* iface, - IStorage* pStg, + IStorage* pStg); +static HRESULT WINAPI DataCache_Save( + IPersistStorage* iface, + IStorage* pStg, BOOL fSameAsLoad); -static HRESULT WINAPI DataCache_SaveCompleted( - IPersistStorage* iface, +static HRESULT WINAPI DataCache_SaveCompleted( + IPersistStorage* iface, IStorage* pStgNew); static HRESULT WINAPI DataCache_HandsOffStorage( IPersistStorage* iface); @@ -244,54 +265,54 @@ static HRESULT WINAPI DataCache_IViewObject2_QueryInterface( IViewObject2* iface, REFIID riid, void** ppvObject); -static ULONG WINAPI DataCache_IViewObject2_AddRef( +static ULONG WINAPI DataCache_IViewObject2_AddRef( IViewObject2* iface); -static ULONG WINAPI DataCache_IViewObject2_Release( +static ULONG WINAPI DataCache_IViewObject2_Release( IViewObject2* iface); static HRESULT WINAPI DataCache_Draw( IViewObject2* iface, DWORD dwDrawAspect, LONG lindex, void* pvAspect, - DVTARGETDEVICE* ptd, - HDC hdcTargetDev, + DVTARGETDEVICE* ptd, + HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, - IVO_ContCallback pfnContinue, + BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), DWORD dwContinue); static HRESULT WINAPI DataCache_GetColorSet( - IViewObject2* iface, - DWORD dwDrawAspect, - LONG lindex, - void* pvAspect, - DVTARGETDEVICE* ptd, - HDC hicTargetDevice, + IViewObject2* iface, + DWORD dwDrawAspect, + LONG lindex, + void* pvAspect, + DVTARGETDEVICE* ptd, + HDC hicTargetDevice, LOGPALETTE** ppColorSet); static HRESULT WINAPI DataCache_Freeze( IViewObject2* iface, DWORD dwDrawAspect, LONG lindex, - void* pvAspect, + void* pvAspect, DWORD* pdwFreeze); static HRESULT WINAPI DataCache_Unfreeze( IViewObject2* iface, DWORD dwFreeze); static HRESULT WINAPI DataCache_SetAdvise( IViewObject2* iface, - DWORD aspects, - DWORD advf, + DWORD aspects, + DWORD advf, IAdviseSink* pAdvSink); static HRESULT WINAPI DataCache_GetAdvise( - IViewObject2* iface, - DWORD* pAspects, - DWORD* pAdvf, + IViewObject2* iface, + DWORD* pAspects, + DWORD* pAdvf, IAdviseSink** ppAdvSink); static HRESULT WINAPI DataCache_GetExtent( - IViewObject2* iface, - DWORD dwDrawAspect, - LONG lindex, - DVTARGETDEVICE* ptd, + IViewObject2* iface, + DWORD dwDrawAspect, + LONG lindex, + DVTARGETDEVICE* ptd, LPSIZEL lpsizel); /* @@ -302,9 +323,9 @@ static HRESULT WINAPI DataCache_IOleCache2_QueryInterface( IOleCache2* iface, REFIID riid, void** ppvObject); -static ULONG WINAPI DataCache_IOleCache2_AddRef( +static ULONG WINAPI DataCache_IOleCache2_AddRef( IOleCache2* iface); -static ULONG WINAPI DataCache_IOleCache2_Release( +static ULONG WINAPI DataCache_IOleCache2_Release( IOleCache2* iface); static HRESULT WINAPI DataCache_Cache( IOleCache2* iface, @@ -327,7 +348,7 @@ static HRESULT WINAPI DataCache_IOleCache2_SetData( BOOL fRelease); static HRESULT WINAPI DataCache_UpdateCache( IOleCache2* iface, - LPDATAOBJECT pDataObject, + LPDATAOBJECT pDataObject, DWORD grfUpdf, LPVOID pReserved); static HRESULT WINAPI DataCache_DiscardCache( @@ -342,9 +363,9 @@ static HRESULT WINAPI DataCache_IOleCacheControl_QueryInterface( IOleCacheControl* iface, REFIID riid, void** ppvObject); -static ULONG WINAPI DataCache_IOleCacheControl_AddRef( +static ULONG WINAPI DataCache_IOleCacheControl_AddRef( IOleCacheControl* iface); -static ULONG WINAPI DataCache_IOleCacheControl_Release( +static ULONG WINAPI DataCache_IOleCacheControl_Release( IOleCacheControl* iface); static HRESULT WINAPI DataCache_OnRun( IOleCacheControl* iface, @@ -436,18 +457,18 @@ static ICOM_VTABLE(IOleCacheControl) DataCache_IOleCacheControl_VTable = }; /****************************************************************************** - * CreateDataCache [OLE32.54] + * CreateDataCache [OLE32.@] */ HRESULT WINAPI CreateDataCache( - LPUNKNOWN pUnkOuter, - REFCLSID rclsid, - REFIID riid, + LPUNKNOWN pUnkOuter, + REFCLSID rclsid, + REFIID riid, LPVOID* ppvObj) { DataCache* newCache = NULL; HRESULT hr = S_OK; - Print(MAX_TRACE, ("(%s, %p, %s, %p)\n", debugstr_guid(rclsid), pUnkOuter, debugstr_guid(riid), ppvObj)); + TRACE("(%s, %p, %s, %p)\n", debugstr_guid(rclsid), pUnkOuter, debugstr_guid(riid), ppvObj); /* * Sanity check @@ -463,14 +484,14 @@ HRESULT WINAPI CreateDataCache( * This is necessary because it's the only time the non-delegating * IUnknown pointer can be returned to the outside. */ - if ( (pUnkOuter!=NULL) && + if ( (pUnkOuter!=NULL) && (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) != 0) ) return CLASS_E_NOAGGREGATION; /* * Try to construct a new instance of the class. */ - newCache = DataCache_Construct(rclsid, + newCache = DataCache_Construct(rclsid, pUnkOuter); if (newCache == 0) @@ -506,7 +527,7 @@ static DataCache* DataCache_Construct( if (newObject==0) return newObject; - + /* * Initialize the virtual function table. */ @@ -516,16 +537,16 @@ static DataCache* DataCache_Construct( newObject->lpvtbl4 = &DataCache_IViewObject2_VTable; newObject->lpvtbl5 = &DataCache_IOleCache2_VTable; newObject->lpvtbl6 = &DataCache_IOleCacheControl_VTable; - + /* - * Start with one reference count. The caller of this function + * Start with one reference count. The caller of this function * must release the interface pointer when it is done. */ newObject->ref = 1; /* * Initialize the outer unknown - * We don't keep a reference on the outer unknown since, the way + * We don't keep a reference on the outer unknown since, the way * aggregation works, our lifetime is at least as large as it's * lifetime. */ @@ -548,7 +569,7 @@ static DataCache* DataCache_Construct( static void DataCache_Destroy( DataCache* ptrToDestroy) { - Print(MAX_TRACE, ("()\n")); + TRACE("()\n"); if (ptrToDestroy->sinkInterface != NULL) { @@ -571,7 +592,7 @@ static void DataCache_Destroy( /************************************************************************ * DataCache_ReadPresentationData * - * This method will read information for the requested presentation + * This method will read information for the requested presentation * into the given structure. * * Param: @@ -637,7 +658,7 @@ static void DataCache_FireOnViewChange( DWORD aspect, LONG lindex) { - Print(MAX_TRACE, ("(%p, %lx, %ld)\n", this, aspect, lindex)); + TRACE("(%p, %lx, %ld)\n", this, aspect, lindex); /* * The sink supplies a filter when it registers @@ -671,7 +692,6 @@ static void DataCache_FireOnViewChange( /* Helper for DataCache_OpenPresStream */ static BOOL DataCache_IsPresentationStream(const STATSTG *elem) { -#if 0 /* The presentation streams have names of the form "\002OlePresXXX", * where XXX goes from 000 to 999. */ static const WCHAR OlePres[] = { 2,'O','l','e','P','r','e','s' }; @@ -680,15 +700,11 @@ static BOOL DataCache_IsPresentationStream(const STATSTG *elem) return (elem->type == STGTY_STREAM) && (elem->cbSize.u.LowPart >= sizeof(PresentationDataHeader)) - && (lstrlenW(name) == 11) + && (strlenW(name) == 11) && (strncmpW(name, OlePres, 8) == 0) && (name[8] >= '0') && (name[8] <= '9') && (name[9] >= '0') && (name[9] <= '9') && (name[10] >= '0') && (name[10] <= '9'); -#else - UNIMPLEMENTED; - return FALSE; -#endif } /************************************************************************ @@ -779,7 +795,7 @@ static HRESULT DataCache_OpenPresStream( /************************************************************************ * DataCache_ReadPresentationData * - * This method will read information for the requested presentation + * This method will read information for the requested presentation * into the given structure. * * Param: @@ -805,12 +821,12 @@ static HMETAFILE DataCache_ReadPresMetafile( * Open the presentation stream. */ hres = DataCache_OpenPresStream( - this, + this, drawAspect, &presStream); if (FAILED(hres)) - return newMetafile; + return (HMETAFILE)hres; /* * Get the size of the stream. @@ -836,8 +852,8 @@ static HMETAFILE DataCache_ReadPresMetafile( /* * Allocate a buffer for the metafile bits. */ - metafileBits = HeapAlloc(GetProcessHeap(), - 0, + metafileBits = HeapAlloc(GetProcessHeap(), + 0, streamInfo.cbSize.u.LowPart); /* @@ -894,7 +910,7 @@ static HRESULT WINAPI DataCache_NDIUnknown_QueryInterface( */ if ( (this==0) || (ppvObject==0) ) return E_INVALIDARG; - + /* * Initialize the return parameter. */ @@ -903,11 +919,11 @@ static HRESULT WINAPI DataCache_NDIUnknown_QueryInterface( /* * Compare the riid with the interface IDs implemented by this object. */ - if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) + if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) { *ppvObject = iface; } - else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) + else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) { *ppvObject = (IDataObject*)&(this->lpvtbl1); } @@ -926,7 +942,7 @@ static HRESULT WINAPI DataCache_NDIUnknown_QueryInterface( { *ppvObject = (IOleCache2*)&(this->lpvtbl5); } - else if (memcmp(&IID_IOleCacheControl, riid, sizeof(IID_IOleCacheControl)) == 0) + else if (memcmp(&IID_IOleCacheControl, riid, sizeof(IID_IOleCacheControl)) == 0) { *ppvObject = (IOleCacheControl*)&(this->lpvtbl6); } @@ -936,17 +952,17 @@ static HRESULT WINAPI DataCache_NDIUnknown_QueryInterface( */ if ((*ppvObject)==0) { - Print(MID_TRACE, ( "() : asking for unsupported interface %s\n", PRINT_GUID(riid))); + WARN( "() : asking for unsupported interface %s\n", debugstr_guid(riid)); return E_NOINTERFACE; } - + /* * Query Interface always increases the reference count by one when it is - * successful. + * successful. */ IUnknown_AddRef((IUnknown*)*ppvObject); - return S_OK;; + return S_OK; } /************************************************************************ @@ -957,7 +973,7 @@ static HRESULT WINAPI DataCache_NDIUnknown_QueryInterface( * This version of QueryInterface will not delegate it's implementation * to the outer unknown. */ -static ULONG WINAPI DataCache_NDIUnknown_AddRef( +static ULONG WINAPI DataCache_NDIUnknown_AddRef( IUnknown* iface) { _ICOM_THIS_From_NDIUnknown(DataCache, iface); @@ -975,7 +991,7 @@ static ULONG WINAPI DataCache_NDIUnknown_AddRef( * This version of QueryInterface will not delegate it's implementation * to the outer unknown. */ -static ULONG WINAPI DataCache_NDIUnknown_Release( +static ULONG WINAPI DataCache_NDIUnknown_Release( IUnknown* iface) { _ICOM_THIS_From_NDIUnknown(DataCache, iface); @@ -994,7 +1010,7 @@ static ULONG WINAPI DataCache_NDIUnknown_Release( return 0; } - + return this->ref; } @@ -1015,7 +1031,7 @@ static HRESULT WINAPI DataCache_IDataObject_QueryInterface( { _ICOM_THIS_From_IDataObject(DataCache, iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); } /************************************************************************ @@ -1023,12 +1039,12 @@ static HRESULT WINAPI DataCache_IDataObject_QueryInterface( * * See Windows documentation for more details on IUnknown methods. */ -static ULONG WINAPI DataCache_IDataObject_AddRef( +static ULONG WINAPI DataCache_IDataObject_AddRef( IDataObject* iface) { _ICOM_THIS_From_IDataObject(DataCache, iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outerUnknown); } /************************************************************************ @@ -1036,12 +1052,12 @@ static ULONG WINAPI DataCache_IDataObject_AddRef( * * See Windows documentation for more details on IUnknown methods. */ -static ULONG WINAPI DataCache_IDataObject_Release( +static ULONG WINAPI DataCache_IDataObject_Release( IDataObject* iface) { _ICOM_THIS_From_IDataObject(DataCache, iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outerUnknown); } /************************************************************************ @@ -1053,7 +1069,7 @@ static ULONG WINAPI DataCache_IDataObject_Release( */ static HRESULT WINAPI DataCache_GetData( IDataObject* iface, - LPFORMATETC pformatetcIn, + LPFORMATETC pformatetcIn, STGMEDIUM* pmedium) { HRESULT hr = 0; @@ -1085,11 +1101,8 @@ static HRESULT WINAPI DataCache_GetData( goto cleanup; /* Save it to storage */ -#if 0 + hr = OleSave(pPersistStorage, pStorage, FALSE); -#else - Print(MIN_TRACE, ("OleSave() not found\n")); -#endif if (hr != S_OK) goto cleanup; @@ -1123,11 +1136,7 @@ static HRESULT WINAPI DataCache_GetData( hGlobalMF = GlobalAlloc(GMEM_SHARE|GMEM_MOVEABLE, sizeof(METAFILEPICT)); mfPict = (METAFILEPICT *)GlobalLock(hGlobalMF); -#if 0 mfPict->hMF = hMetaFile; -#else - Print(MIN_TRACE, ("Depending on MetaFile implementation\n")); -#endif GlobalUnlock(hGlobalMF); @@ -1158,11 +1167,11 @@ cleanup: } static HRESULT WINAPI DataCache_GetDataHere( - IDataObject* iface, + IDataObject* iface, LPFORMATETC pformatetc, STGMEDIUM* pmedium) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } @@ -1170,7 +1179,7 @@ static HRESULT WINAPI DataCache_QueryGetData( IDataObject* iface, LPFORMATETC pformatetc) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } @@ -1182,11 +1191,11 @@ static HRESULT WINAPI DataCache_QueryGetData( * See Windows documentation for more details on IDataObject methods. */ static HRESULT WINAPI DataCache_GetCanonicalFormatEtc( - IDataObject* iface, - LPFORMATETC pformatectIn, + IDataObject* iface, + LPFORMATETC pformatectIn, LPFORMATETC pformatetcOut) { - UNIMPLEMENTED; + TRACE("()\n"); return E_NOTIMPL; } @@ -1199,14 +1208,14 @@ static HRESULT WINAPI DataCache_GetCanonicalFormatEtc( */ static HRESULT WINAPI DataCache_IDataObject_SetData( IDataObject* iface, - LPFORMATETC pformatetc, - STGMEDIUM* pmedium, + LPFORMATETC pformatetc, + STGMEDIUM* pmedium, BOOL fRelease) { IOleCache2* oleCache = NULL; HRESULT hres; - Print(MAX_TRACE, ("(%p, %p, %p, %d)\n", iface, pformatetc, pmedium, fRelease)); + TRACE("(%p, %p, %p, %d)\n", iface, pformatetc, pmedium, fRelease); hres = IDataObject_QueryInterface(iface, &IID_IOleCache2, (void**)&oleCache); @@ -1217,7 +1226,7 @@ static HRESULT WINAPI DataCache_IDataObject_SetData( IOleCache2_Release(oleCache); - return hres;; + return hres; } /************************************************************************ @@ -1228,11 +1237,11 @@ static HRESULT WINAPI DataCache_IDataObject_SetData( * See Windows documentation for more details on IDataObject methods. */ static HRESULT WINAPI DataCache_EnumFormatEtc( - IDataObject* iface, + IDataObject* iface, DWORD dwDirection, IEnumFORMATETC** ppenumFormatEtc) { - UNIMPLEMENTED; + TRACE("()\n"); return E_NOTIMPL; } @@ -1244,13 +1253,13 @@ static HRESULT WINAPI DataCache_EnumFormatEtc( * See Windows documentation for more details on IDataObject methods. */ static HRESULT WINAPI DataCache_DAdvise( - IDataObject* iface, - FORMATETC* pformatetc, - DWORD advf, - IAdviseSink* pAdvSink, + IDataObject* iface, + FORMATETC* pformatetc, + DWORD advf, + IAdviseSink* pAdvSink, DWORD* pdwConnection) { - UNIMPLEMENTED; + TRACE("()\n"); return OLE_E_ADVISENOTSUPPORTED; } @@ -1265,7 +1274,7 @@ static HRESULT WINAPI DataCache_DUnadvise( IDataObject* iface, DWORD dwConnection) { - UNIMPLEMENTED; + TRACE("()\n"); return OLE_E_NOCONNECTION; } @@ -1280,7 +1289,7 @@ static HRESULT WINAPI DataCache_EnumDAdvise( IDataObject* iface, IEnumSTATDATA** ppenumAdvise) { - UNIMPLEMENTED; + TRACE("()\n"); return OLE_E_ADVISENOTSUPPORTED; } @@ -1301,7 +1310,7 @@ static HRESULT WINAPI DataCache_IPersistStorage_QueryInterface( { _ICOM_THIS_From_IPersistStorage(DataCache, iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); } /************************************************************************ @@ -1309,12 +1318,12 @@ static HRESULT WINAPI DataCache_IPersistStorage_QueryInterface( * * See Windows documentation for more details on IUnknown methods. */ -static ULONG WINAPI DataCache_IPersistStorage_AddRef( +static ULONG WINAPI DataCache_IPersistStorage_AddRef( IPersistStorage* iface) { _ICOM_THIS_From_IPersistStorage(DataCache, iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outerUnknown); } /************************************************************************ @@ -1322,12 +1331,12 @@ static ULONG WINAPI DataCache_IPersistStorage_AddRef( * * See Windows documentation for more details on IUnknown methods. */ -static ULONG WINAPI DataCache_IPersistStorage_Release( +static ULONG WINAPI DataCache_IPersistStorage_Release( IPersistStorage* iface) { _ICOM_THIS_From_IPersistStorage(DataCache, iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outerUnknown); } /************************************************************************ @@ -1337,26 +1346,26 @@ static ULONG WINAPI DataCache_IPersistStorage_Release( * * See Windows documentation for more details on IPersistStorage methods. */ -static HRESULT WINAPI DataCache_GetClassID( +static HRESULT WINAPI DataCache_GetClassID( IPersistStorage* iface, CLSID* pClassID) { - Print(MAX_TRACE, ("(%p, %p)\n", iface, pClassID)); + TRACE("(%p, %p)\n", iface, pClassID); return E_NOTIMPL; } /************************************************************************ * DataCache_IsDirty (IPersistStorage) * - * Until we actully connect to a running object and retrieve new + * Until we actully connect to a running object and retrieve new * information to it, we never get dirty. * * See Windows documentation for more details on IPersistStorage methods. */ -static HRESULT WINAPI DataCache_IsDirty( +static HRESULT WINAPI DataCache_IsDirty( IPersistStorage* iface) { - Print(MAX_TRACE, ("(%p)\n", iface)); + TRACE("(%p)\n", iface); return S_FALSE; } @@ -1369,11 +1378,11 @@ static HRESULT WINAPI DataCache_IsDirty( * * See Windows documentation for more details on IPersistStorage methods. */ -static HRESULT WINAPI DataCache_InitNew( - IPersistStorage* iface, +static HRESULT WINAPI DataCache_InitNew( + IPersistStorage* iface, IStorage* pStg) { - Print(MAX_TRACE, ("(%p, %p)\n", iface, pStg)); + TRACE("(%p, %p)\n", iface, pStg); return DataCache_Load(iface, pStg); } @@ -1381,20 +1390,20 @@ static HRESULT WINAPI DataCache_InitNew( /************************************************************************ * DataCache_Load (IPersistStorage) * - * The data cache implementation of IPersistStorage_Load doesn't + * The data cache implementation of IPersistStorage_Load doesn't * actually load anything. Instead, it holds on to the storage pointer - * and it will load the presentation information when the + * and it will load the presentation information when the * IDataObject_GetData or IViewObject2_Draw methods are called. * * See Windows documentation for more details on IPersistStorage methods. */ -static HRESULT WINAPI DataCache_Load( +static HRESULT WINAPI DataCache_Load( IPersistStorage* iface, IStorage* pStg) { _ICOM_THIS_From_IPersistStorage(DataCache, iface); - Print(MAX_TRACE, ("(%p, %p)\n", iface, pStg)); + TRACE("(%p, %p)\n", iface, pStg); if (this->presentationStorage != NULL) { @@ -1413,23 +1422,23 @@ static HRESULT WINAPI DataCache_Load( /************************************************************************ * DataCache_Save (IPersistStorage) * - * Until we actully connect to a running object and retrieve new + * Until we actully connect to a running object and retrieve new * information to it, we never have to save anything. However, it is * our responsability to copy the information when saving to a new * storage. * * See Windows documentation for more details on IPersistStorage methods. */ -static HRESULT WINAPI DataCache_Save( +static HRESULT WINAPI DataCache_Save( IPersistStorage* iface, - IStorage* pStg, + IStorage* pStg, BOOL fSameAsLoad) { _ICOM_THIS_From_IPersistStorage(DataCache, iface); - Print(MAX_TRACE, ("(%p, %p, %d)\n", iface, pStg, fSameAsLoad)); + TRACE("(%p, %p, %d)\n", iface, pStg, fSameAsLoad); - if ( (!fSameAsLoad) && + if ( (!fSameAsLoad) && (this->presentationStorage!=NULL) ) { return IStorage_CopyTo(this->presentationStorage, @@ -1450,11 +1459,11 @@ static HRESULT WINAPI DataCache_Save( * * See Windows documentation for more details on IPersistStorage methods. */ -static HRESULT WINAPI DataCache_SaveCompleted( - IPersistStorage* iface, +static HRESULT WINAPI DataCache_SaveCompleted( + IPersistStorage* iface, IStorage* pStgNew) { - Print(MAX_TRACE, ("(%p, %p)\n", iface, pStgNew)); + TRACE("(%p, %p)\n", iface, pStgNew); if (pStgNew) { @@ -1487,7 +1496,7 @@ static HRESULT WINAPI DataCache_HandsOffStorage( { _ICOM_THIS_From_IPersistStorage(DataCache, iface); - Print(MAX_TRACE, ("(%p)\n", iface)); + TRACE("(%p)\n", iface); if (this->presentationStorage != NULL) { @@ -1515,7 +1524,7 @@ static HRESULT WINAPI DataCache_IViewObject2_QueryInterface( { _ICOM_THIS_From_IViewObject2(DataCache, iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); } /************************************************************************ @@ -1523,12 +1532,12 @@ static HRESULT WINAPI DataCache_IViewObject2_QueryInterface( * * See Windows documentation for more details on IUnknown methods. */ -static ULONG WINAPI DataCache_IViewObject2_AddRef( +static ULONG WINAPI DataCache_IViewObject2_AddRef( IViewObject2* iface) { _ICOM_THIS_From_IViewObject2(DataCache, iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outerUnknown); } /************************************************************************ @@ -1536,12 +1545,12 @@ static ULONG WINAPI DataCache_IViewObject2_AddRef( * * See Windows documentation for more details on IUnknown methods. */ -static ULONG WINAPI DataCache_IViewObject2_Release( +static ULONG WINAPI DataCache_IViewObject2_Release( IViewObject2* iface) { _ICOM_THIS_From_IViewObject2(DataCache, iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outerUnknown); } /************************************************************************ @@ -1557,12 +1566,12 @@ static HRESULT WINAPI DataCache_Draw( DWORD dwDrawAspect, LONG lindex, void* pvAspect, - DVTARGETDEVICE* ptd, - HDC hdcTargetDev, + DVTARGETDEVICE* ptd, + HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, - IVO_ContCallback pfnContinue, + BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), DWORD dwContinue) { PresentationDataHeader presData; @@ -1571,17 +1580,17 @@ static HRESULT WINAPI DataCache_Draw( _ICOM_THIS_From_IViewObject2(DataCache, iface); - Print(MAX_TRACE, ("(%p, %lx, %ld, %p, %x, %x, %p, %p, %p, %lx)\n", + TRACE("(%p, %lx, %ld, %p, %p, %p, %p, %p, %p, %lx)\n", iface, dwDrawAspect, lindex, pvAspect, - hdcTargetDev, + hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, - dwContinue)); + dwContinue); /* * Sanity check @@ -1627,7 +1636,7 @@ static HRESULT WINAPI DataCache_Draw( presData.dwObjectExtentY, &oldWindowExt); - SetViewportExtEx(hdcDraw, + SetViewportExtEx(hdcDraw, lprcBounds->right - lprcBounds->left, lprcBounds->bottom - lprcBounds->top, &oldViewportExt); @@ -1644,7 +1653,7 @@ static HRESULT WINAPI DataCache_Draw( oldWindowExt.cy, NULL); - SetViewportExtEx(hdcDraw, + SetViewportExtEx(hdcDraw, oldViewportExt.cx, oldViewportExt.cy, NULL); @@ -1663,15 +1672,15 @@ static HRESULT WINAPI DataCache_Draw( } static HRESULT WINAPI DataCache_GetColorSet( - IViewObject2* iface, - DWORD dwDrawAspect, - LONG lindex, - void* pvAspect, - DVTARGETDEVICE* ptd, - HDC hicTargetDevice, + IViewObject2* iface, + DWORD dwDrawAspect, + LONG lindex, + void* pvAspect, + DVTARGETDEVICE* ptd, + HDC hicTargetDevice, LOGPALETTE** ppColorSet) { -UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } @@ -1679,10 +1688,10 @@ static HRESULT WINAPI DataCache_Freeze( IViewObject2* iface, DWORD dwDrawAspect, LONG lindex, - void* pvAspect, + void* pvAspect, DWORD* pdwFreeze) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } @@ -1690,7 +1699,7 @@ static HRESULT WINAPI DataCache_Unfreeze( IViewObject2* iface, DWORD dwFreeze) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } @@ -1704,13 +1713,13 @@ static HRESULT WINAPI DataCache_Unfreeze( */ static HRESULT WINAPI DataCache_SetAdvise( IViewObject2* iface, - DWORD aspects, - DWORD advf, + DWORD aspects, + DWORD advf, IAdviseSink* pAdvSink) { _ICOM_THIS_From_IViewObject2(DataCache, iface); - Print(MAX_TRACE, ("(%p, %lx, %lx, %p)\n", iface, aspects, advf, pAdvSink)); + TRACE("(%p, %lx, %lx, %p)\n", iface, aspects, advf, pAdvSink); /* * A call to this function removes the previous sink @@ -1719,7 +1728,7 @@ static HRESULT WINAPI DataCache_SetAdvise( { IAdviseSink_Release(this->sinkInterface); this->sinkInterface = NULL; - this->sinkAspects = 0; + this->sinkAspects = 0; this->sinkAdviseFlag = 0; } @@ -1729,8 +1738,8 @@ static HRESULT WINAPI DataCache_SetAdvise( if (pAdvSink!=NULL) { this->sinkInterface = pAdvSink; - this->sinkAspects = aspects; - this->sinkAdviseFlag = advf; + this->sinkAspects = aspects; + this->sinkAdviseFlag = advf; IAdviseSink_AddRef(this->sinkInterface); } @@ -1752,20 +1761,20 @@ static HRESULT WINAPI DataCache_SetAdvise( /************************************************************************ * DataCache_GetAdvise (IViewObject2) * - * This method queries the current state of the advise sink + * This method queries the current state of the advise sink * installed on the data cache. * * See Windows documentation for more details on IViewObject2 methods. */ static HRESULT WINAPI DataCache_GetAdvise( - IViewObject2* iface, - DWORD* pAspects, - DWORD* pAdvf, + IViewObject2* iface, + DWORD* pAspects, + DWORD* pAdvf, IAdviseSink** ppAdvSink) { _ICOM_THIS_From_IViewObject2(DataCache, iface); - Print(MAX_TRACE, ("(%p, %p, %p, %p)\n", iface, pAspects, pAdvf, ppAdvSink)); + TRACE("(%p, %p, %p, %p)\n", iface, pAspects, pAdvf, ppAdvSink); /* * Just copy all the requested values. @@ -1778,8 +1787,8 @@ static HRESULT WINAPI DataCache_GetAdvise( if (ppAdvSink!=NULL) { - IAdviseSink_QueryInterface(this->sinkInterface, - &IID_IAdviseSink, + IAdviseSink_QueryInterface(this->sinkInterface, + &IID_IAdviseSink, (void**)ppAdvSink); } @@ -1794,10 +1803,10 @@ static HRESULT WINAPI DataCache_GetAdvise( * See Windows documentation for more details on IViewObject2 methods. */ static HRESULT WINAPI DataCache_GetExtent( - IViewObject2* iface, - DWORD dwDrawAspect, - LONG lindex, - DVTARGETDEVICE* ptd, + IViewObject2* iface, + DWORD dwDrawAspect, + LONG lindex, + DVTARGETDEVICE* ptd, LPSIZEL lpsizel) { PresentationDataHeader presData; @@ -1805,8 +1814,8 @@ static HRESULT WINAPI DataCache_GetExtent( _ICOM_THIS_From_IViewObject2(DataCache, iface); - Print(MAX_TRACE, ("(%p, %lx, %ld, %p, %p)\n", - iface, dwDrawAspect, lindex, ptd, lpsizel)); + TRACE("(%p, %lx, %ld, %p, %p)\n", + iface, dwDrawAspect, lindex, ptd, lpsizel); /* * Sanity check @@ -1824,17 +1833,17 @@ static HRESULT WINAPI DataCache_GetExtent( * This flag should be set to -1. */ if (lindex!=-1) - Print(MIN_TRACE, ("Unimplemented flag lindex = %ld\n", lindex)); + FIXME("Unimplemented flag lindex = %ld\n", lindex); /* - * Right now, we suport only the callback from + * Right now, we support only the callback from * the default handler. */ if (ptd!=NULL) - Print(MIN_TRACE, ("Unimplemented ptd = %p\n", ptd)); - + FIXME("Unimplemented ptd = %p\n", ptd); + /* - * Get the presentation information from the + * Get the presentation information from the * cache. */ hres = DataCache_ReadPresentationData(this, @@ -1874,7 +1883,7 @@ static HRESULT WINAPI DataCache_IOleCache2_QueryInterface( { _ICOM_THIS_From_IOleCache2(DataCache, iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); } /************************************************************************ @@ -1882,12 +1891,12 @@ static HRESULT WINAPI DataCache_IOleCache2_QueryInterface( * * See Windows documentation for more details on IUnknown methods. */ -static ULONG WINAPI DataCache_IOleCache2_AddRef( +static ULONG WINAPI DataCache_IOleCache2_AddRef( IOleCache2* iface) { _ICOM_THIS_From_IOleCache2(DataCache, iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outerUnknown); } /************************************************************************ @@ -1895,12 +1904,12 @@ static ULONG WINAPI DataCache_IOleCache2_AddRef( * * See Windows documentation for more details on IUnknown methods. */ -static ULONG WINAPI DataCache_IOleCache2_Release( +static ULONG WINAPI DataCache_IOleCache2_Release( IOleCache2* iface) { _ICOM_THIS_From_IOleCache2(DataCache, iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outerUnknown); } static HRESULT WINAPI DataCache_Cache( @@ -1909,7 +1918,7 @@ static HRESULT WINAPI DataCache_Cache( DWORD advf, DWORD* pdwConnection) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } @@ -1917,7 +1926,7 @@ static HRESULT WINAPI DataCache_Uncache( IOleCache2* iface, DWORD dwConnection) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } @@ -1925,7 +1934,7 @@ static HRESULT WINAPI DataCache_EnumCache( IOleCache2* iface, IEnumSTATDATA** ppenumSTATDATA) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } @@ -1933,7 +1942,7 @@ static HRESULT WINAPI DataCache_InitCache( IOleCache2* iface, IDataObject* pDataObject) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } @@ -1943,17 +1952,17 @@ static HRESULT WINAPI DataCache_IOleCache2_SetData( STGMEDIUM* pmedium, BOOL fRelease) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } static HRESULT WINAPI DataCache_UpdateCache( IOleCache2* iface, - LPDATAOBJECT pDataObject, + LPDATAOBJECT pDataObject, DWORD grfUpdf, LPVOID pReserved) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } @@ -1961,7 +1970,7 @@ static HRESULT WINAPI DataCache_DiscardCache( IOleCache2* iface, DWORD dwDiscardOptions) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } @@ -1983,7 +1992,7 @@ static HRESULT WINAPI DataCache_IOleCacheControl_QueryInterface( { _ICOM_THIS_From_IOleCacheControl(DataCache, iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); } /************************************************************************ @@ -1991,12 +2000,12 @@ static HRESULT WINAPI DataCache_IOleCacheControl_QueryInterface( * * See Windows documentation for more details on IUnknown methods. */ -static ULONG WINAPI DataCache_IOleCacheControl_AddRef( +static ULONG WINAPI DataCache_IOleCacheControl_AddRef( IOleCacheControl* iface) { _ICOM_THIS_From_IOleCacheControl(DataCache, iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outerUnknown); } /************************************************************************ @@ -2004,27 +2013,25 @@ static ULONG WINAPI DataCache_IOleCacheControl_AddRef( * * See Windows documentation for more details on IUnknown methods. */ -static ULONG WINAPI DataCache_IOleCacheControl_Release( +static ULONG WINAPI DataCache_IOleCacheControl_Release( IOleCacheControl* iface) { _ICOM_THIS_From_IOleCacheControl(DataCache, iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outerUnknown); } static HRESULT WINAPI DataCache_OnRun( IOleCacheControl* iface, LPDATAOBJECT pDataObject) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } static HRESULT WINAPI DataCache_OnStop( IOleCacheControl* iface) { - UNIMPLEMENTED; + FIXME("stub\n"); return E_NOTIMPL; } - - diff --git a/reactos/lib/ole32/dcom.h b/reactos/lib/ole32/dcom.h new file mode 100644 index 00000000000..1194bbb8aa2 --- /dev/null +++ b/reactos/lib/ole32/dcom.h @@ -0,0 +1,511 @@ +/*** Autogenerated by WIDL 0.1 from dcom.idl - Do not edit ***/ +#include +#include + +#ifndef __WIDL_DCOM_H +#define __WIDL_DCOM_H +#ifdef __cplusplus +extern "C" { +#endif +#include +typedef MIDL_uhyper ID; + +typedef ID MID; + +typedef ID OXID; + +typedef ID OID; + +typedef ID SETID; + +typedef GUID IPID; + +typedef GUID CID; + +typedef REFGUID REFIPID; + +#define COM_MINOR_VERSION_1 (1) + +#define COM_MINOR_VERSION_2 (2) + +#define COM_MAJOR_VERSION (5) + +#define COM_MINOR_VERSION (3) + +typedef struct tagCOMVERSION { + unsigned short MajorVersion; + unsigned short MinorVersion; +} COMVERSION; + +#define ORPCF_NULL (0) + +#define ORPCF_LOCAL (1) + +#define ORPCF_RESERVED1 (2) + +#define ORPCF_RESERVED2 (4) + +#define ORPCF_RESERVED3 (8) + +#define ORPCF_RESERVED4 (16) + +typedef struct tagORPC_EXTENT { + GUID id; + unsigned long size; + byte data[1]; +} ORPC_EXTENT; + +typedef struct tagORPC_EXTENT_ARRAY { + unsigned long size; + unsigned long reserved; + ORPC_EXTENT **extent; +} ORPC_EXTENT_ARRAY; + +typedef struct tagORPCTHIS { + COMVERSION version; + unsigned long flags; + unsigned long reserved1; + CID cid; + ORPC_EXTENT_ARRAY *extensions; +} ORPCTHIS; + +typedef struct tagORPCTHAT { + unsigned long flags; + ORPC_EXTENT_ARRAY *extensions; +} ORPCTHAT; + +#define NCADG_IP_UDP (0x8) + +#define NCACN_IP_TCP (0x7) + +#define NCADG_IPX (0xe) + +#define NCACN_SPX (0xc) + +#define NCACN_NB_NB (0x12) + +#define NCACN_NB_IPX (0xd) + +#define NCACN_DNET_NSP (0x4) + +#define NCACN_HTTP (0x1f) + +typedef struct tagSTRINGBINDING { + unsigned short wTowerId; + unsigned short aNetworkAddr[1]; +} STRINGBINDING; + +#define COM_C_AUTHZ_NONE (0xffff) + +typedef struct tagSECURITYBINDING { + unsigned short wAuthnSvc; + unsigned short wAuthzSvc; + unsigned short aPrincName[1]; +} SECURITYBINDING; + +typedef struct tagDUALSTRINGARRAY { + unsigned short wNumEntries; + unsigned short wSecurityOffset; + unsigned short aStringArray[1]; +} DUALSTRINGARRAY; + +#define OBJREF_SIGNATURE (0x574f454d) + +#define OBJREF_STANDARD (0x1) + +#define OBJREF_HANDLER (0x2) + +#define OBJREF_CUSTOM (0x4) + +#define SORF_OXRES1 (0x1) + +#define SORF_OXRES2 (0x20) + +#define SORF_OXRES3 (0x40) + +#define SORF_OXRES4 (0x80) + +#define SORF_OXRES5 (0x100) + +#define SORF_OXRES6 (0x200) + +#define SORF_OXRES7 (0x400) + +#define SORF_OXRES8 (0x800) + +#define SORF_NULL (0x0) + +#define SORF_NOPING (0x1000) + +typedef struct tagSTDOBJREF { + unsigned long flags; + unsigned long cPublicRefs; + OXID oxid; + OID oid; + IPID ipid; +} STDOBJREF; + +typedef struct tagOBJREF { + unsigned long signature; + unsigned long flags; + GUID iid; + union { + struct OR_STANDARD { + STDOBJREF std; + DUALSTRINGARRAY saResAddr; + } u_standard; + struct OR_HANDLER { + STDOBJREF std; + CLSID clsid; + DUALSTRINGARRAY saResAddr; + } u_handler; + struct OR_CUSTOM { + CLSID clsid; + unsigned long cbExtension; + unsigned long size; + byte *pData; + } u_custom; + } u_objref; +} OBJREF; + +typedef struct tagMInterfacePointer { + ULONG ulCntData; + BYTE abData[1]; +} MInterfacePointer; + +typedef MInterfacePointer *PMInterfacePointer; + +#ifndef __IRemUnknown_FWD_DEFINED__ +#define __IRemUnknown_FWD_DEFINED__ +typedef struct IRemUnknown IRemUnknown; +#endif + +typedef IRemUnknown *LPREMUNKNOWN; + +typedef struct tagREMQIRESULT { + HRESULT hResult; + STDOBJREF std; +} REMQIRESULT; + +typedef struct tagREMINTERFACEREF { + IPID ipid; + unsigned long cPublicRefs; + unsigned long cPrivateRefs; +} REMINTERFACEREF; + +/***************************************************************************** + * IRemUnknown interface + */ +#ifndef __IRemUnknown_INTERFACE_DEFINED__ +#define __IRemUnknown_INTERFACE_DEFINED__ + +DEFINE_GUID(IID_IRemUnknown, 0x00000131, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); +#if defined(__cplusplus) && !defined(CINTERFACE) +struct IRemUnknown : public IUnknown +{ + virtual HRESULT STDMETHODCALLTYPE RemQueryInterface( + REFIPID ripid, + unsigned long cRefs, + unsigned short cIids, + IID* iids, + REMQIRESULT** ppQIResults) = 0; + + virtual HRESULT STDMETHODCALLTYPE RemAddRef( + unsigned short cInterfaceRefs, + REMINTERFACEREF* InterfaceRefs, + HRESULT* pResults) = 0; + + virtual HRESULT STDMETHODCALLTYPE RemRelease( + unsigned short cInterfaceRefs, + REMINTERFACEREF* InterfaceRefs) = 0; + +}; +#else +typedef struct IRemUnknownVtbl IRemUnknownVtbl; +struct IRemUnknown { + const IRemUnknownVtbl* lpVtbl; +}; +struct IRemUnknownVtbl { + ICOM_MSVTABLE_COMPAT_FIELDS + + /*** IUnknown methods ***/ + HRESULT (STDMETHODCALLTYPE *QueryInterface)( + IRemUnknown* This, + REFIID riid, + void** ppvObject); + + ULONG (STDMETHODCALLTYPE *AddRef)( + IRemUnknown* This); + + ULONG (STDMETHODCALLTYPE *Release)( + IRemUnknown* This); + + /*** IRemUnknown methods ***/ + HRESULT (STDMETHODCALLTYPE *RemQueryInterface)( + IRemUnknown* This, + REFIPID ripid, + unsigned long cRefs, + unsigned short cIids, + IID* iids, + REMQIRESULT** ppQIResults); + + HRESULT (STDMETHODCALLTYPE *RemAddRef)( + IRemUnknown* This, + unsigned short cInterfaceRefs, + REMINTERFACEREF* InterfaceRefs, + HRESULT* pResults); + + HRESULT (STDMETHODCALLTYPE *RemRelease)( + IRemUnknown* This, + unsigned short cInterfaceRefs, + REMINTERFACEREF* InterfaceRefs); + +}; + +/*** IUnknown methods ***/ +#define IRemUnknown_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IRemUnknown_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IRemUnknown_Release(p) (p)->lpVtbl->Release(p) +/*** IRemUnknown methods ***/ +#define IRemUnknown_RemQueryInterface(p,a,b,c,d,e) (p)->lpVtbl->RemQueryInterface(p,a,b,c,d,e) +#define IRemUnknown_RemAddRef(p,a,b,c) (p)->lpVtbl->RemAddRef(p,a,b,c) +#define IRemUnknown_RemRelease(p,a,b) (p)->lpVtbl->RemRelease(p,a,b) + +#endif + +#define IRemUnknown_METHODS \ + ICOM_MSVTABLE_COMPAT_FIELDS \ + /*** IUnknown methods ***/ \ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; \ + STDMETHOD_(ULONG,AddRef)(THIS) PURE; \ + STDMETHOD_(ULONG,Release)(THIS) PURE; \ + /*** IRemUnknown methods ***/ \ + STDMETHOD_(HRESULT,RemQueryInterface)(THIS_ REFIPID ripid, unsigned long cRefs, unsigned short cIids, IID* iids, REMQIRESULT** ppQIResults) PURE; \ + STDMETHOD_(HRESULT,RemAddRef)(THIS_ unsigned short cInterfaceRefs, REMINTERFACEREF* InterfaceRefs, HRESULT* pResults) PURE; \ + STDMETHOD_(HRESULT,RemRelease)(THIS_ unsigned short cInterfaceRefs, REMINTERFACEREF* InterfaceRefs) PURE; + +HRESULT CALLBACK IRemUnknown_RemQueryInterface_Proxy( + IRemUnknown* This, + REFIPID ripid, + unsigned long cRefs, + unsigned short cIids, + IID* iids, + REMQIRESULT** ppQIResults); +void __RPC_STUB IRemUnknown_RemQueryInterface_Stub( + struct IRpcStubBuffer* This, + struct IRpcChannelBuffer* pRpcChannelBuffer, + PRPC_MESSAGE pRpcMessage, + DWORD* pdwStubPhase); +HRESULT CALLBACK IRemUnknown_RemAddRef_Proxy( + IRemUnknown* This, + unsigned short cInterfaceRefs, + REMINTERFACEREF* InterfaceRefs, + HRESULT* pResults); +void __RPC_STUB IRemUnknown_RemAddRef_Stub( + struct IRpcStubBuffer* This, + struct IRpcChannelBuffer* pRpcChannelBuffer, + PRPC_MESSAGE pRpcMessage, + DWORD* pdwStubPhase); +HRESULT CALLBACK IRemUnknown_RemRelease_Proxy( + IRemUnknown* This, + unsigned short cInterfaceRefs, + REMINTERFACEREF* InterfaceRefs); +void __RPC_STUB IRemUnknown_RemRelease_Stub( + struct IRpcStubBuffer* This, + struct IRpcChannelBuffer* pRpcChannelBuffer, + PRPC_MESSAGE pRpcMessage, + DWORD* pdwStubPhase); + +#endif /* __IRemUnknown_INTERFACE_DEFINED__ */ + +#ifndef __IRemUnknown2_FWD_DEFINED__ +#define __IRemUnknown2_FWD_DEFINED__ +typedef struct IRemUnknown2 IRemUnknown2; +#endif + +typedef IRemUnknown2 *LPREMUNKNOWN2; + +/***************************************************************************** + * IRemUnknown2 interface + */ +#ifndef __IRemUnknown2_INTERFACE_DEFINED__ +#define __IRemUnknown2_INTERFACE_DEFINED__ + +DEFINE_GUID(IID_IRemUnknown2, 0x00000142, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); +#if defined(__cplusplus) && !defined(CINTERFACE) +struct IRemUnknown2 : public IRemUnknown +{ + virtual HRESULT STDMETHODCALLTYPE RemQueryInterface2( + REFIPID ripid, + unsigned short cIids, + IID* iids, + HRESULT* phr, + MInterfacePointer** ppMIF) = 0; + +}; +#else +typedef struct IRemUnknown2Vtbl IRemUnknown2Vtbl; +struct IRemUnknown2 { + const IRemUnknown2Vtbl* lpVtbl; +}; +struct IRemUnknown2Vtbl { + ICOM_MSVTABLE_COMPAT_FIELDS + + /*** IUnknown methods ***/ + HRESULT (STDMETHODCALLTYPE *QueryInterface)( + IRemUnknown2* This, + REFIID riid, + void** ppvObject); + + ULONG (STDMETHODCALLTYPE *AddRef)( + IRemUnknown2* This); + + ULONG (STDMETHODCALLTYPE *Release)( + IRemUnknown2* This); + + /*** IRemUnknown methods ***/ + HRESULT (STDMETHODCALLTYPE *RemQueryInterface)( + IRemUnknown2* This, + REFIPID ripid, + unsigned long cRefs, + unsigned short cIids, + IID* iids, + REMQIRESULT** ppQIResults); + + HRESULT (STDMETHODCALLTYPE *RemAddRef)( + IRemUnknown2* This, + unsigned short cInterfaceRefs, + REMINTERFACEREF* InterfaceRefs, + HRESULT* pResults); + + HRESULT (STDMETHODCALLTYPE *RemRelease)( + IRemUnknown2* This, + unsigned short cInterfaceRefs, + REMINTERFACEREF* InterfaceRefs); + + /*** IRemUnknown2 methods ***/ + HRESULT (STDMETHODCALLTYPE *RemQueryInterface2)( + IRemUnknown2* This, + REFIPID ripid, + unsigned short cIids, + IID* iids, + HRESULT* phr, + MInterfacePointer** ppMIF); + +}; + +/*** IUnknown methods ***/ +#define IRemUnknown2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IRemUnknown2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IRemUnknown2_Release(p) (p)->lpVtbl->Release(p) +/*** IRemUnknown methods ***/ +#define IRemUnknown2_RemQueryInterface(p,a,b,c,d,e) (p)->lpVtbl->RemQueryInterface(p,a,b,c,d,e) +#define IRemUnknown2_RemAddRef(p,a,b,c) (p)->lpVtbl->RemAddRef(p,a,b,c) +#define IRemUnknown2_RemRelease(p,a,b) (p)->lpVtbl->RemRelease(p,a,b) +/*** IRemUnknown2 methods ***/ +#define IRemUnknown2_RemQueryInterface2(p,a,b,c,d,e) (p)->lpVtbl->RemQueryInterface2(p,a,b,c,d,e) + +#endif + +#define IRemUnknown2_METHODS \ + ICOM_MSVTABLE_COMPAT_FIELDS \ + /*** IUnknown methods ***/ \ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; \ + STDMETHOD_(ULONG,AddRef)(THIS) PURE; \ + STDMETHOD_(ULONG,Release)(THIS) PURE; \ + /*** IRemUnknown methods ***/ \ + STDMETHOD_(HRESULT,RemQueryInterface)(THIS_ REFIPID ripid, unsigned long cRefs, unsigned short cIids, IID* iids, REMQIRESULT** ppQIResults) PURE; \ + STDMETHOD_(HRESULT,RemAddRef)(THIS_ unsigned short cInterfaceRefs, REMINTERFACEREF* InterfaceRefs, HRESULT* pResults) PURE; \ + STDMETHOD_(HRESULT,RemRelease)(THIS_ unsigned short cInterfaceRefs, REMINTERFACEREF* InterfaceRefs) PURE; \ + /*** IRemUnknown2 methods ***/ \ + STDMETHOD_(HRESULT,RemQueryInterface2)(THIS_ REFIPID ripid, unsigned short cIids, IID* iids, HRESULT* phr, MInterfacePointer** ppMIF) PURE; + +HRESULT CALLBACK IRemUnknown2_RemQueryInterface2_Proxy( + IRemUnknown2* This, + REFIPID ripid, + unsigned short cIids, + IID* iids, + HRESULT* phr, + MInterfacePointer** ppMIF); +void __RPC_STUB IRemUnknown2_RemQueryInterface2_Stub( + struct IRpcStubBuffer* This, + struct IRpcChannelBuffer* pRpcChannelBuffer, + PRPC_MESSAGE pRpcMessage, + DWORD* pdwStubPhase); + +#endif /* __IRemUnknown2_INTERFACE_DEFINED__ */ + +#if 0 +/***************************************************************************** + * IOXIDResolver interface (v0.0) + */ +DEFINE_GUID(IID_IOXIDResolver, 0x99fcfec4, 0x5260, 0x101b, 0xbb,0xcb, 0x00,0xaa,0x00,0x21,0x34,0x7a); +extern RPC_IF_HANDLE IOXIDResolver_v0_0_c_ifspec; +extern RPC_IF_HANDLE IOXIDResolver_v0_0_s_ifspec; +error_status_t ResolveOxid( + handle_t hRpc, + OXID* pOxid, + unsigned short cRequestedProtseqs, + unsigned short arRequestedProtseqs[], + DUALSTRINGARRAY** ppdsaOxidBindings, + IPID* pipidRemUnknown, + DWORD* pAuthnHint); +error_status_t SimplePing( + handle_t hRpc, + SETID* pSetId); +error_status_t ComplexPing( + handle_t hRpc, + SETID* pSetId, + unsigned short SequenceNum, + unsigned short cAddToSet, + unsigned short cDelFromSet, + OID AddToSet[], + OID DelFromSet[], + unsigned short* pPingBackoffFactor); +error_status_t ServerAlive( + handle_t hRpc); +error_status_t ResolveOxid2( + handle_t hRpc, + OXID* pOxid, + unsigned short cRequestedProtseqs, + unsigned short arRequestedProtseqs[], + DUALSTRINGARRAY** ppdsaOxidBindings, + IPID* pipidRemUnknown, + DWORD* pAuthnHint, + COMVERSION* pComVersion); + +#define MODE_GET_CLASS_OBJECT (0xffffffff) + +/***************************************************************************** + * IRemoteActivation interface (v0.0) + */ +DEFINE_GUID(IID_IRemoteActivation, 0x4d9f4ab8, 0x7d1c, 0x11cf, 0x86,0x1e, 0x00,0x20,0xaf,0x6e,0x7c,0x57); +extern RPC_IF_HANDLE IRemoteActivation_v0_0_c_ifspec; +extern RPC_IF_HANDLE IRemoteActivation_v0_0_s_ifspec; +HRESULT RemoteActivation( + handle_t hRpc, + ORPCTHIS* ORPCthis, + ORPCTHAT* ORPCthat, + GUID* Clsid, + WCHAR* pwszObjectName, + MInterfacePointer* pObjectStorage, + DWORD ClientImpLevel, + DWORD Mode, + DWORD Interfaces, + IID* pIIDs, + unsigned short cRequestedProtseqs, + unsigned short RequestedProtseqs[], + OXID* pOxid, + DUALSTRINGARRAY** ppdsaOxidBindings, + IPID* pipidRemUnknown, + DWORD* pAuthnHint, + COMVERSION* pServerVersion, + HRESULT* phr, + MInterfacePointer** ppInterfaceData, + HRESULT* pResults); + +#endif +#ifdef __cplusplus +} +#endif +#endif /* __WIDL_DCOM_H */ diff --git a/reactos/lib/ole32/defaulthandler.c b/reactos/lib/ole32/defaulthandler.c new file mode 100644 index 00000000000..d6f68cd0a99 --- /dev/null +++ b/reactos/lib/ole32/defaulthandler.c @@ -0,0 +1,1711 @@ +/* + * OLE 2 default object handler + * + * Copyright 1999 Francis Beaudet + * Copyright 2000 Abey George + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * NOTES: + * The OLE2 default object handler supports a whole whack of + * interfaces including: + * IOleObject, IDataObject, IPersistStorage, IViewObject2, + * IRunnableObject, IOleCache2, IOleCacheControl and much more. + * + * All the implementation details are taken from: Inside OLE + * second edition by Kraig Brockschmidt, + * + * TODO + * - This implementation of the default handler does not launch the + * server in the DoVerb, Update, GetData, GetDataHere and Run + * methods. When it is fixed to do so, all the methods will have + * to be revisited to allow delegating to the running object + * + * - All methods in the class that use the class ID should be + * aware that it is possible for a class to be treated as + * another one and go into emulation mode. Nothing has been + * done in this area. + * + * - Some functions still return E_NOTIMPL they have to be + * implemented. Most of those are related to the running of the + * actual server. + * + * - All the methods related to notification and advise sinks are + * in place but no notifications are sent to the sinks yet. + */ +#include +#include +#include + +#ifdef __REACTOS__ +#include +#endif +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "winerror.h" +#include "wine/unicode.h" +#include "ole2.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +/**************************************************************************** + * DefaultHandler + * + */ +struct DefaultHandler +{ + /* + * List all interface VTables here + */ + ICOM_VTABLE(IOleObject)* lpvtbl1; + ICOM_VTABLE(IUnknown)* lpvtbl2; + ICOM_VTABLE(IDataObject)* lpvtbl3; + ICOM_VTABLE(IRunnableObject)* lpvtbl4; + + /* + * Reference count of this object + */ + ULONG ref; + + /* + * IUnknown implementation of the outer object. + */ + IUnknown* outerUnknown; + + /* + * Class Id that this handler object represents. + */ + CLSID clsid; + + /* + * IUnknown implementation of the datacache. + */ + IUnknown* dataCache; + + /* + * Client site for the embedded object. + */ + IOleClientSite* clientSite; + + /* + * The IOleAdviseHolder maintains the connections + * on behalf of the default handler. + */ + IOleAdviseHolder* oleAdviseHolder; + + /* + * The IDataAdviseHolder maintains the data + * connections on behalf of the default handler. + */ + IDataAdviseHolder* dataAdviseHolder; + + /* + * Name of the container and object contained + */ + LPWSTR containerApp; + LPWSTR containerObj; + +}; + +typedef struct DefaultHandler DefaultHandler; + +/* + * Here, I define utility macros to help with the casting of the + * "this" parameter. + * There is a version to accomodate all of the VTables implemented + * by this object. + */ +#define _ICOM_THIS_From_IOleObject(class,name) class* this = (class*)name; +#define _ICOM_THIS_From_NDIUnknown(class, name) class* this = (class*)(((char*)name)-sizeof(void*)); +#define _ICOM_THIS_From_IDataObject(class, name) class* this = (class*)(((char*)name)-2*sizeof(void*)); +#define _ICOM_THIS_From_IRunnableObject(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*)); + +/* + * Prototypes for the methods of the DefaultHandler class. + */ +static DefaultHandler* DefaultHandler_Construct(REFCLSID clsid, + LPUNKNOWN pUnkOuter); +static void DefaultHandler_Destroy(DefaultHandler* ptrToDestroy); + +/* + * Prototypes for the methods of the DefaultHandler class + * that implement non delegating IUnknown methods. + */ +static HRESULT WINAPI DefaultHandler_NDIUnknown_QueryInterface( + IUnknown* iface, + REFIID riid, + void** ppvObject); +static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef( + IUnknown* iface); +static ULONG WINAPI DefaultHandler_NDIUnknown_Release( + IUnknown* iface); + +/* + * Prototypes for the methods of the DefaultHandler class + * that implement IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_QueryInterface( + IOleObject* iface, + REFIID riid, + void** ppvObject); +static ULONG WINAPI DefaultHandler_AddRef( + IOleObject* iface); +static ULONG WINAPI DefaultHandler_Release( + IOleObject* iface); +static HRESULT WINAPI DefaultHandler_SetClientSite( + IOleObject* iface, + IOleClientSite* pClientSite); +static HRESULT WINAPI DefaultHandler_GetClientSite( + IOleObject* iface, + IOleClientSite** ppClientSite); +static HRESULT WINAPI DefaultHandler_SetHostNames( + IOleObject* iface, + LPCOLESTR szContainerApp, + LPCOLESTR szContainerObj); +static HRESULT WINAPI DefaultHandler_Close( + IOleObject* iface, + DWORD dwSaveOption); +static HRESULT WINAPI DefaultHandler_SetMoniker( + IOleObject* iface, + DWORD dwWhichMoniker, + IMoniker* pmk); +static HRESULT WINAPI DefaultHandler_GetMoniker( + IOleObject* iface, + DWORD dwAssign, + DWORD dwWhichMoniker, + IMoniker** ppmk); +static HRESULT WINAPI DefaultHandler_InitFromData( + IOleObject* iface, + IDataObject* pDataObject, + BOOL fCreation, + DWORD dwReserved); +static HRESULT WINAPI DefaultHandler_GetClipboardData( + IOleObject* iface, + DWORD dwReserved, + IDataObject** ppDataObject); +static HRESULT WINAPI DefaultHandler_DoVerb( + IOleObject* iface, + LONG iVerb, + struct tagMSG* lpmsg, + IOleClientSite* pActiveSite, + LONG lindex, + HWND hwndParent, + LPCRECT lprcPosRect); +static HRESULT WINAPI DefaultHandler_EnumVerbs( + IOleObject* iface, + IEnumOLEVERB** ppEnumOleVerb); +static HRESULT WINAPI DefaultHandler_Update( + IOleObject* iface); +static HRESULT WINAPI DefaultHandler_IsUpToDate( + IOleObject* iface); +static HRESULT WINAPI DefaultHandler_GetUserClassID( + IOleObject* iface, + CLSID* pClsid); +static HRESULT WINAPI DefaultHandler_GetUserType( + IOleObject* iface, + DWORD dwFormOfType, + LPOLESTR* pszUserType); +static HRESULT WINAPI DefaultHandler_SetExtent( + IOleObject* iface, + DWORD dwDrawAspect, + SIZEL* psizel); +static HRESULT WINAPI DefaultHandler_GetExtent( + IOleObject* iface, + DWORD dwDrawAspect, + SIZEL* psizel); +static HRESULT WINAPI DefaultHandler_Advise( + IOleObject* iface, + IAdviseSink* pAdvSink, + DWORD* pdwConnection); +static HRESULT WINAPI DefaultHandler_Unadvise( + IOleObject* iface, + DWORD dwConnection); +static HRESULT WINAPI DefaultHandler_EnumAdvise( + IOleObject* iface, + IEnumSTATDATA** ppenumAdvise); +static HRESULT WINAPI DefaultHandler_GetMiscStatus( + IOleObject* iface, + DWORD dwAspect, + DWORD* pdwStatus); +static HRESULT WINAPI DefaultHandler_SetColorScheme( + IOleObject* iface, + struct tagLOGPALETTE* pLogpal); + +/* + * Prototypes for the methods of the DefaultHandler class + * that implement IDataObject methods. + */ +static HRESULT WINAPI DefaultHandler_IDataObject_QueryInterface( + IDataObject* iface, + REFIID riid, + void** ppvObject); +static ULONG WINAPI DefaultHandler_IDataObject_AddRef( + IDataObject* iface); +static ULONG WINAPI DefaultHandler_IDataObject_Release( + IDataObject* iface); +static HRESULT WINAPI DefaultHandler_GetData( + IDataObject* iface, + LPFORMATETC pformatetcIn, + STGMEDIUM* pmedium); +static HRESULT WINAPI DefaultHandler_GetDataHere( + IDataObject* iface, + LPFORMATETC pformatetc, + STGMEDIUM* pmedium); +static HRESULT WINAPI DefaultHandler_QueryGetData( + IDataObject* iface, + LPFORMATETC pformatetc); +static HRESULT WINAPI DefaultHandler_GetCanonicalFormatEtc( + IDataObject* iface, + LPFORMATETC pformatectIn, + LPFORMATETC pformatetcOut); +static HRESULT WINAPI DefaultHandler_SetData( + IDataObject* iface, + LPFORMATETC pformatetc, + STGMEDIUM* pmedium, + BOOL fRelease); +static HRESULT WINAPI DefaultHandler_EnumFormatEtc( + IDataObject* iface, + DWORD dwDirection, + IEnumFORMATETC** ppenumFormatEtc); +static HRESULT WINAPI DefaultHandler_DAdvise( + IDataObject* iface, + FORMATETC* pformatetc, + DWORD advf, + IAdviseSink* pAdvSink, + DWORD* pdwConnection); +static HRESULT WINAPI DefaultHandler_DUnadvise( + IDataObject* iface, + DWORD dwConnection); +static HRESULT WINAPI DefaultHandler_EnumDAdvise( + IDataObject* iface, + IEnumSTATDATA** ppenumAdvise); + +/* + * Prototypes for the methods of the DefaultHandler class + * that implement IRunnableObject methods. + */ +static HRESULT WINAPI DefaultHandler_IRunnableObject_QueryInterface( + IRunnableObject* iface, + REFIID riid, + void** ppvObject); +static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef( + IRunnableObject* iface); +static ULONG WINAPI DefaultHandler_IRunnableObject_Release( + IRunnableObject* iface); +static HRESULT WINAPI DefaultHandler_GetRunningClass( + IRunnableObject* iface, + LPCLSID lpClsid); +static HRESULT WINAPI DefaultHandler_Run( + IRunnableObject* iface, + IBindCtx* pbc); +static BOOL WINAPI DefaultHandler_IsRunning( + IRunnableObject* iface); +static HRESULT WINAPI DefaultHandler_LockRunning( + IRunnableObject* iface, + BOOL fLock, + BOOL fLastUnlockCloses); +static HRESULT WINAPI DefaultHandler_SetContainedObject( + IRunnableObject* iface, + BOOL fContained); + + +/* + * Virtual function tables for the DefaultHandler class. + */ +static ICOM_VTABLE(IOleObject) DefaultHandler_IOleObject_VTable = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + DefaultHandler_QueryInterface, + DefaultHandler_AddRef, + DefaultHandler_Release, + DefaultHandler_SetClientSite, + DefaultHandler_GetClientSite, + DefaultHandler_SetHostNames, + DefaultHandler_Close, + DefaultHandler_SetMoniker, + DefaultHandler_GetMoniker, + DefaultHandler_InitFromData, + DefaultHandler_GetClipboardData, + DefaultHandler_DoVerb, + DefaultHandler_EnumVerbs, + DefaultHandler_Update, + DefaultHandler_IsUpToDate, + DefaultHandler_GetUserClassID, + DefaultHandler_GetUserType, + DefaultHandler_SetExtent, + DefaultHandler_GetExtent, + DefaultHandler_Advise, + DefaultHandler_Unadvise, + DefaultHandler_EnumAdvise, + DefaultHandler_GetMiscStatus, + DefaultHandler_SetColorScheme +}; + +static ICOM_VTABLE(IUnknown) DefaultHandler_NDIUnknown_VTable = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + DefaultHandler_NDIUnknown_QueryInterface, + DefaultHandler_NDIUnknown_AddRef, + DefaultHandler_NDIUnknown_Release, +}; + +static ICOM_VTABLE(IDataObject) DefaultHandler_IDataObject_VTable = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + DefaultHandler_IDataObject_QueryInterface, + DefaultHandler_IDataObject_AddRef, + DefaultHandler_IDataObject_Release, + DefaultHandler_GetData, + DefaultHandler_GetDataHere, + DefaultHandler_QueryGetData, + DefaultHandler_GetCanonicalFormatEtc, + DefaultHandler_SetData, + DefaultHandler_EnumFormatEtc, + DefaultHandler_DAdvise, + DefaultHandler_DUnadvise, + DefaultHandler_EnumDAdvise +}; + +static ICOM_VTABLE(IRunnableObject) DefaultHandler_IRunnableObject_VTable = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + DefaultHandler_IRunnableObject_QueryInterface, + DefaultHandler_IRunnableObject_AddRef, + DefaultHandler_IRunnableObject_Release, + DefaultHandler_GetRunningClass, + DefaultHandler_Run, + DefaultHandler_IsRunning, + DefaultHandler_LockRunning, + DefaultHandler_SetContainedObject +}; + +/****************************************************************************** + * OleCreateDefaultHandler [OLE32.@] + */ +HRESULT WINAPI OleCreateDefaultHandler( + REFCLSID clsid, + LPUNKNOWN pUnkOuter, + REFIID riid, + LPVOID* ppvObj) +{ + DefaultHandler* newHandler = NULL; + HRESULT hr = S_OK; + + TRACE("(%s, %p, %s, %p)\n", debugstr_guid(clsid), pUnkOuter, debugstr_guid(riid), ppvObj); + + /* + * Sanity check + */ + if (ppvObj==0) + return E_POINTER; + + *ppvObj = 0; + + /* + * If this handler is constructed for aggregation, make sure + * the caller is requesting the IUnknown interface. + * This is necessary because it's the only time the non-delegating + * IUnknown pointer can be returned to the outside. + */ + if ( (pUnkOuter!=NULL) && + (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) != 0) ) + return CLASS_E_NOAGGREGATION; + + /* + * Try to construct a new instance of the class. + */ + newHandler = DefaultHandler_Construct(clsid, + pUnkOuter); + + if (newHandler == 0) + return E_OUTOFMEMORY; + + /* + * Make sure it supports the interface required by the caller. + */ + hr = IUnknown_QueryInterface((IUnknown*)&(newHandler->lpvtbl2), riid, ppvObj); + + /* + * Release the reference obtained in the constructor. If + * the QueryInterface was unsuccessful, it will free the class. + */ + IUnknown_Release((IUnknown*)&(newHandler->lpvtbl2)); + + return hr; +} + +/********************************************************* + * Methods implementation for the DefaultHandler class. + */ +static DefaultHandler* DefaultHandler_Construct( + REFCLSID clsid, + LPUNKNOWN pUnkOuter) +{ + DefaultHandler* newObject = 0; + + /* + * Allocate space for the object. + */ + newObject = HeapAlloc(GetProcessHeap(), 0, sizeof(DefaultHandler)); + + if (newObject==0) + return newObject; + + /* + * Initialize the virtual function table. + */ + newObject->lpvtbl1 = &DefaultHandler_IOleObject_VTable; + newObject->lpvtbl2 = &DefaultHandler_NDIUnknown_VTable; + newObject->lpvtbl3 = &DefaultHandler_IDataObject_VTable; + newObject->lpvtbl4 = &DefaultHandler_IRunnableObject_VTable; + + /* + * Start with one reference count. The caller of this function + * must release the interface pointer when it is done. + */ + newObject->ref = 1; + + /* + * Initialize the outer unknown + * We don't keep a reference on the outer unknown since, the way + * aggregation works, our lifetime is at least as large as it's + * lifetime. + */ + if (pUnkOuter==NULL) + pUnkOuter = (IUnknown*)&(newObject->lpvtbl2); + + newObject->outerUnknown = pUnkOuter; + + /* + * Create a datacache object. + * We aggregate with the datacache. Make sure we pass our outer + * unknown as the datacache's outer unknown. + */ + CreateDataCache(newObject->outerUnknown, + clsid, + &IID_IUnknown, + (void**)&newObject->dataCache); + + /* + * Initialize the other data members of the class. + */ + memcpy(&(newObject->clsid), clsid, sizeof(CLSID)); + newObject->clientSite = NULL; + newObject->oleAdviseHolder = NULL; + newObject->dataAdviseHolder = NULL; + newObject->containerApp = NULL; + newObject->containerObj = NULL; + + return newObject; +} + +static void DefaultHandler_Destroy( + DefaultHandler* ptrToDestroy) +{ + /* + * Free the strings idenfitying the object + */ + if (ptrToDestroy->containerApp!=NULL) + { + HeapFree( GetProcessHeap(), 0, ptrToDestroy->containerApp ); + ptrToDestroy->containerApp = NULL; + } + + if (ptrToDestroy->containerObj!=NULL) + { + HeapFree( GetProcessHeap(), 0, ptrToDestroy->containerObj ); + ptrToDestroy->containerObj = NULL; + } + + /* + * Release our reference to the data cache. + */ + if (ptrToDestroy->dataCache!=NULL) + { + IUnknown_Release(ptrToDestroy->dataCache); + ptrToDestroy->dataCache = NULL; + } + + /* + * Same thing for the client site. + */ + if (ptrToDestroy->clientSite!=NULL) + { + IOleClientSite_Release(ptrToDestroy->clientSite); + ptrToDestroy->clientSite = NULL; + } + + /* + * And the advise holder. + */ + if (ptrToDestroy->oleAdviseHolder!=NULL) + { + IOleAdviseHolder_Release(ptrToDestroy->oleAdviseHolder); + ptrToDestroy->oleAdviseHolder = NULL; + } + + /* + * And the data advise holder. + */ + if (ptrToDestroy->dataAdviseHolder!=NULL) + { + IDataAdviseHolder_Release(ptrToDestroy->dataAdviseHolder); + ptrToDestroy->dataAdviseHolder = NULL; + } + + + /* + * Free the actual default handler structure. + */ + HeapFree(GetProcessHeap(), 0, ptrToDestroy); +} + +/********************************************************* + * Method implementation for the non delegating IUnknown + * part of the DefaultHandler class. + */ + +/************************************************************************ + * DefaultHandler_NDIUnknown_QueryInterface (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + * + * This version of QueryInterface will not delegate it's implementation + * to the outer unknown. + */ +static HRESULT WINAPI DefaultHandler_NDIUnknown_QueryInterface( + IUnknown* iface, + REFIID riid, + void** ppvObject) +{ + _ICOM_THIS_From_NDIUnknown(DefaultHandler, iface); + + /* + * Perform a sanity check on the parameters. + */ + if ( (this==0) || (ppvObject==0) ) + return E_INVALIDARG; + + /* + * Initialize the return parameter. + */ + *ppvObject = 0; + + /* + * Compare the riid with the interface IDs implemented by this object. + */ + if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) + { + *ppvObject = iface; + } + else if (memcmp(&IID_IOleObject, riid, sizeof(IID_IOleObject)) == 0) + { + *ppvObject = (IOleObject*)&(this->lpvtbl1); + } + else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) + { + *ppvObject = (IDataObject*)&(this->lpvtbl3); + } + else if (memcmp(&IID_IRunnableObject, riid, sizeof(IID_IRunnableObject)) == 0) + { + *ppvObject = (IRunnableObject*)&(this->lpvtbl4); + } + else + { + /* + * Blind aggregate the data cache to "inherit" it's interfaces. + */ + if (IUnknown_QueryInterface(this->dataCache, riid, ppvObject) == S_OK) + return S_OK; + } + + /* + * Check that we obtained an interface. + */ + if ((*ppvObject)==0) + { + WARN( "() : asking for un supported interface %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + /* + * Query Interface always increases the reference count by one when it is + * successful. + */ + IUnknown_AddRef((IUnknown*)*ppvObject); + + return S_OK; +} + +/************************************************************************ + * DefaultHandler_NDIUnknown_AddRef (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + * + * This version of QueryInterface will not delegate it's implementation + * to the outer unknown. + */ +static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef( + IUnknown* iface) +{ + _ICOM_THIS_From_NDIUnknown(DefaultHandler, iface); + + this->ref++; + + return this->ref; +} + +/************************************************************************ + * DefaultHandler_NDIUnknown_Release (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + * + * This version of QueryInterface will not delegate it's implementation + * to the outer unknown. + */ +static ULONG WINAPI DefaultHandler_NDIUnknown_Release( + IUnknown* iface) +{ + _ICOM_THIS_From_NDIUnknown(DefaultHandler, iface); + + /* + * Decrease the reference count on this object. + */ + this->ref--; + + /* + * If the reference count goes down to 0, perform suicide. + */ + if (this->ref==0) + { + DefaultHandler_Destroy(this); + + return 0; + } + + return this->ref; +} + +/********************************************************* + * Methods implementation for the IOleObject part of + * the DefaultHandler class. + */ + +/************************************************************************ + * DefaultHandler_QueryInterface (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static HRESULT WINAPI DefaultHandler_QueryInterface( + IOleObject* iface, + REFIID riid, + void** ppvObject) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); +} + +/************************************************************************ + * DefaultHandler_AddRef (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static ULONG WINAPI DefaultHandler_AddRef( + IOleObject* iface) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + return IUnknown_AddRef(this->outerUnknown); +} + +/************************************************************************ + * DefaultHandler_Release (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static ULONG WINAPI DefaultHandler_Release( + IOleObject* iface) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + return IUnknown_Release(this->outerUnknown); +} + +/************************************************************************ + * DefaultHandler_SetClientSite (IOleObject) + * + * The default handler's implementation of this method only keeps the + * client site pointer for future reference. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_SetClientSite( + IOleObject* iface, + IOleClientSite* pClientSite) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + TRACE("(%p, %p)\n", iface, pClientSite); + + /* + * Make sure we release the previous client site if there + * was one. + */ + if (this->clientSite!=NULL) + { + IOleClientSite_Release(this->clientSite); + } + + this->clientSite = pClientSite; + + if (this->clientSite!=NULL) + { + IOleClientSite_AddRef(this->clientSite); + } + + return S_OK; +} + +/************************************************************************ + * DefaultHandler_GetClientSite (IOleObject) + * + * The default handler's implementation of this method returns the + * last pointer set in IOleObject_SetClientSite. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_GetClientSite( + IOleObject* iface, + IOleClientSite** ppClientSite) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + /* + * Sanity check. + */ + if (ppClientSite == NULL) + return E_POINTER; + + *ppClientSite = this->clientSite; + + if (this->clientSite != NULL) + { + IOleClientSite_AddRef(this->clientSite); + } + + return S_OK; +} + +/************************************************************************ + * DefaultHandler_SetHostNames (IOleObject) + * + * The default handler's implementation of this method just stores + * the strings and returns S_OK. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_SetHostNames( + IOleObject* iface, + LPCOLESTR szContainerApp, + LPCOLESTR szContainerObj) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + TRACE("(%p, %s, %s)\n", + iface, + debugstr_w(szContainerApp), + debugstr_w(szContainerObj)); + + /* + * Be sure to cleanup before re-assinging the strings. + */ + if (this->containerApp!=NULL) + { + HeapFree( GetProcessHeap(), 0, this->containerApp ); + this->containerApp = NULL; + } + + if (this->containerObj!=NULL) + { + HeapFree( GetProcessHeap(), 0, this->containerObj ); + this->containerObj = NULL; + } + + /* + * Copy the string supplied. + */ + if (szContainerApp != NULL) + { + if ((this->containerApp = HeapAlloc( GetProcessHeap(), 0, + (lstrlenW(szContainerApp) + 1) * sizeof(WCHAR) ))) + strcpyW( this->containerApp, szContainerApp ); + } + + if (szContainerObj != NULL) + { + if ((this->containerObj = HeapAlloc( GetProcessHeap(), 0, + (lstrlenW(szContainerObj) + 1) * sizeof(WCHAR) ))) + strcpyW( this->containerObj, szContainerObj ); + } + return S_OK; +} + +/************************************************************************ + * DefaultHandler_Close (IOleObject) + * + * The default handler's implementation of this method is meaningless + * without a running server so it does nothing. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_Close( + IOleObject* iface, + DWORD dwSaveOption) +{ + TRACE("()\n"); + return S_OK; +} + +/************************************************************************ + * DefaultHandler_SetMoniker (IOleObject) + * + * The default handler's implementation of this method does nothing. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_SetMoniker( + IOleObject* iface, + DWORD dwWhichMoniker, + IMoniker* pmk) +{ + TRACE("(%p, %ld, %p)\n", + iface, + dwWhichMoniker, + pmk); + + return S_OK; +} + +/************************************************************************ + * DefaultHandler_GetMoniker (IOleObject) + * + * Delegate this request to the client site if we have one. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_GetMoniker( + IOleObject* iface, + DWORD dwAssign, + DWORD dwWhichMoniker, + IMoniker** ppmk) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + TRACE("(%p, %ld, %ld, %p)\n", + iface, dwAssign, dwWhichMoniker, ppmk); + + if (this->clientSite) + { + return IOleClientSite_GetMoniker(this->clientSite, + dwAssign, + dwWhichMoniker, + ppmk); + + } + + return E_FAIL; +} + +/************************************************************************ + * DefaultHandler_InitFromData (IOleObject) + * + * This method is meaningless if the server is not running + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_InitFromData( + IOleObject* iface, + IDataObject* pDataObject, + BOOL fCreation, + DWORD dwReserved) +{ + TRACE("(%p, %p, %d, %ld)\n", + iface, pDataObject, fCreation, dwReserved); + + return OLE_E_NOTRUNNING; +} + +/************************************************************************ + * DefaultHandler_GetClipboardData (IOleObject) + * + * This method is meaningless if the server is not running + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_GetClipboardData( + IOleObject* iface, + DWORD dwReserved, + IDataObject** ppDataObject) +{ + TRACE("(%p, %ld, %p)\n", + iface, dwReserved, ppDataObject); + + return OLE_E_NOTRUNNING; +} + +static HRESULT WINAPI DefaultHandler_DoVerb( + IOleObject* iface, + LONG iVerb, + struct tagMSG* lpmsg, + IOleClientSite* pActiveSite, + LONG lindex, + HWND hwndParent, + LPCRECT lprcPosRect) +{ + FIXME(": Stub\n"); + return E_NOTIMPL; +} + +/************************************************************************ + * DefaultHandler_EnumVerbs (IOleObject) + * + * The default handler implementation of this method simply delegates + * to OleRegEnumVerbs + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_EnumVerbs( + IOleObject* iface, + IEnumOLEVERB** ppEnumOleVerb) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + TRACE("(%p, %p)\n", iface, ppEnumOleVerb); + + return OleRegEnumVerbs(&this->clsid, ppEnumOleVerb); +} + +static HRESULT WINAPI DefaultHandler_Update( + IOleObject* iface) +{ + FIXME(": Stub\n"); + return E_NOTIMPL; +} + +/************************************************************************ + * DefaultHandler_IsUpToDate (IOleObject) + * + * This method is meaningless if the server is not running + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_IsUpToDate( + IOleObject* iface) +{ + TRACE("(%p)\n", iface); + + return OLE_E_NOTRUNNING; +} + +/************************************************************************ + * DefaultHandler_GetUserClassID (IOleObject) + * + * TODO: Map to a new class ID if emulation is active. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_GetUserClassID( + IOleObject* iface, + CLSID* pClsid) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + TRACE("(%p, %p)\n", iface, pClsid); + + /* + * Sanity check. + */ + if (pClsid==NULL) + return E_POINTER; + + memcpy(pClsid, &this->clsid, sizeof(CLSID)); + + return S_OK; +} + +/************************************************************************ + * DefaultHandler_GetUserType (IOleObject) + * + * The default handler implementation of this method simply delegates + * to OleRegGetUserType + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_GetUserType( + IOleObject* iface, + DWORD dwFormOfType, + LPOLESTR* pszUserType) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + TRACE("(%p, %ld, %p)\n", iface, dwFormOfType, pszUserType); + + return OleRegGetUserType(&this->clsid, dwFormOfType, pszUserType); +} + +/************************************************************************ + * DefaultHandler_SetExtent (IOleObject) + * + * This method is meaningless if the server is not running + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_SetExtent( + IOleObject* iface, + DWORD dwDrawAspect, + SIZEL* psizel) +{ + TRACE("(%p, %lx, (%ld x %ld))\n", iface, + dwDrawAspect, psizel->cx, psizel->cy); + return OLE_E_NOTRUNNING; +} + +/************************************************************************ + * DefaultHandler_GetExtent (IOleObject) + * + * The default handler's implementation of this method returns uses + * the cache to locate the aspect and extract the extent from it. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_GetExtent( + IOleObject* iface, + DWORD dwDrawAspect, + SIZEL* psizel) +{ + DVTARGETDEVICE* targetDevice; + IViewObject2* cacheView = NULL; + HRESULT hres; + + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + TRACE("(%p, %lx, %p)\n", iface, dwDrawAspect, psizel); + + hres = IUnknown_QueryInterface(this->dataCache, &IID_IViewObject2, (void**)&cacheView); + + if (FAILED(hres)) + return E_UNEXPECTED; + + /* + * Prepare the call to the cache's GetExtent method. + * + * Here we would build a valid DVTARGETDEVICE structure + * but, since we are calling into the data cache, we + * know it's implementation and we'll skip this + * extra work until later. + */ + targetDevice = NULL; + + hres = IViewObject2_GetExtent(cacheView, + dwDrawAspect, + -1, + targetDevice, + psizel); + + /* + * Cleanup + */ + IViewObject2_Release(cacheView); + + return hres; +} + +/************************************************************************ + * DefaultHandler_Advise (IOleObject) + * + * The default handler's implementation of this method simply + * delegates to the OleAdviseHolder. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_Advise( + IOleObject* iface, + IAdviseSink* pAdvSink, + DWORD* pdwConnection) +{ + HRESULT hres = S_OK; + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + TRACE("(%p, %p, %p)\n", iface, pAdvSink, pdwConnection); + + /* + * Make sure we have an advise holder before we start. + */ + if (this->oleAdviseHolder==NULL) + { + hres = CreateOleAdviseHolder(&this->oleAdviseHolder); + } + + if (SUCCEEDED(hres)) + { + hres = IOleAdviseHolder_Advise(this->oleAdviseHolder, + pAdvSink, + pdwConnection); + } + + return hres; +} + +/************************************************************************ + * DefaultHandler_Unadvise (IOleObject) + * + * The default handler's implementation of this method simply + * delegates to the OleAdviseHolder. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_Unadvise( + IOleObject* iface, + DWORD dwConnection) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + TRACE("(%p, %ld)\n", iface, dwConnection); + + /* + * If we don't have an advise holder yet, it means we don't have + * a connection. + */ + if (this->oleAdviseHolder==NULL) + return OLE_E_NOCONNECTION; + + return IOleAdviseHolder_Unadvise(this->oleAdviseHolder, + dwConnection); +} + +/************************************************************************ + * DefaultHandler_EnumAdvise (IOleObject) + * + * The default handler's implementation of this method simply + * delegates to the OleAdviseHolder. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_EnumAdvise( + IOleObject* iface, + IEnumSTATDATA** ppenumAdvise) +{ + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + TRACE("(%p, %p)\n", iface, ppenumAdvise); + + /* + * Sanity check + */ + if (ppenumAdvise==NULL) + return E_POINTER; + + /* + * Initialize the out parameter. + */ + *ppenumAdvise = NULL; + + if (this->oleAdviseHolder==NULL) + return IOleAdviseHolder_EnumAdvise(this->oleAdviseHolder, + ppenumAdvise); + + return S_OK; +} + +/************************************************************************ + * DefaultHandler_GetMiscStatus (IOleObject) + * + * The default handler's implementation of this method simply delegates + * to OleRegGetMiscStatus. + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_GetMiscStatus( + IOleObject* iface, + DWORD dwAspect, + DWORD* pdwStatus) +{ + HRESULT hres; + _ICOM_THIS_From_IOleObject(DefaultHandler, iface); + + TRACE("(%p, %lx, %p)\n", iface, dwAspect, pdwStatus); + + hres = OleRegGetMiscStatus(&(this->clsid), dwAspect, pdwStatus); + + if (FAILED(hres)) + *pdwStatus = 0; + + return S_OK; +} + +/************************************************************************ + * DefaultHandler_SetExtent (IOleObject) + * + * This method is meaningless if the server is not running + * + * See Windows documentation for more details on IOleObject methods. + */ +static HRESULT WINAPI DefaultHandler_SetColorScheme( + IOleObject* iface, + struct tagLOGPALETTE* pLogpal) +{ + TRACE("(%p, %p))\n", iface, pLogpal); + return OLE_E_NOTRUNNING; +} + +/********************************************************* + * Methods implementation for the IDataObject part of + * the DefaultHandler class. + */ + +/************************************************************************ + * DefaultHandler_IDataObject_QueryInterface (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static HRESULT WINAPI DefaultHandler_IDataObject_QueryInterface( + IDataObject* iface, + REFIID riid, + void** ppvObject) +{ + _ICOM_THIS_From_IDataObject(DefaultHandler, iface); + + return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); +} + +/************************************************************************ + * DefaultHandler_IDataObject_AddRef (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static ULONG WINAPI DefaultHandler_IDataObject_AddRef( + IDataObject* iface) +{ + _ICOM_THIS_From_IDataObject(DefaultHandler, iface); + + return IUnknown_AddRef(this->outerUnknown); +} + +/************************************************************************ + * DefaultHandler_IDataObject_Release (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static ULONG WINAPI DefaultHandler_IDataObject_Release( + IDataObject* iface) +{ + _ICOM_THIS_From_IDataObject(DefaultHandler, iface); + + return IUnknown_Release(this->outerUnknown); +} + +/************************************************************************ + * DefaultHandler_GetData + * + * Get Data from a source dataobject using format pformatetcIn->cfFormat + * See Windows documentation for more details on GetData. + * Default handler's implementation of this method delegates to the cache. + */ +static HRESULT WINAPI DefaultHandler_GetData( + IDataObject* iface, + LPFORMATETC pformatetcIn, + STGMEDIUM* pmedium) +{ + IDataObject* cacheDataObject = NULL; + HRESULT hres; + + _ICOM_THIS_From_IDataObject(DefaultHandler, iface); + + TRACE("(%p, %p, %p)\n", iface, pformatetcIn, pmedium); + + hres = IUnknown_QueryInterface(this->dataCache, + &IID_IDataObject, + (void**)&cacheDataObject); + + if (FAILED(hres)) + return E_UNEXPECTED; + + hres = IDataObject_GetData(cacheDataObject, + pformatetcIn, + pmedium); + + IDataObject_Release(cacheDataObject); + + return hres; +} + +static HRESULT WINAPI DefaultHandler_GetDataHere( + IDataObject* iface, + LPFORMATETC pformatetc, + STGMEDIUM* pmedium) +{ + FIXME(": Stub\n"); + return E_NOTIMPL; +} + +/************************************************************************ + * DefaultHandler_QueryGetData (IDataObject) + * + * The default handler's implementation of this method delegates to + * the cache. + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI DefaultHandler_QueryGetData( + IDataObject* iface, + LPFORMATETC pformatetc) +{ + IDataObject* cacheDataObject = NULL; + HRESULT hres; + + _ICOM_THIS_From_IDataObject(DefaultHandler, iface); + + TRACE("(%p, %p)\n", iface, pformatetc); + + hres = IUnknown_QueryInterface(this->dataCache, + &IID_IDataObject, + (void**)&cacheDataObject); + + if (FAILED(hres)) + return E_UNEXPECTED; + + hres = IDataObject_QueryGetData(cacheDataObject, + pformatetc); + + IDataObject_Release(cacheDataObject); + + return hres; +} + +/************************************************************************ + * DefaultHandler_GetCanonicalFormatEtc (IDataObject) + * + * This method is meaningless if the server is not running + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI DefaultHandler_GetCanonicalFormatEtc( + IDataObject* iface, + LPFORMATETC pformatectIn, + LPFORMATETC pformatetcOut) +{ + FIXME("(%p, %p, %p)\n", iface, pformatectIn, pformatetcOut); + + return OLE_E_NOTRUNNING; +} + +/************************************************************************ + * DefaultHandler_SetData (IDataObject) + * + * The default handler's implementation of this method delegates to + * the cache. + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI DefaultHandler_SetData( + IDataObject* iface, + LPFORMATETC pformatetc, + STGMEDIUM* pmedium, + BOOL fRelease) +{ + IDataObject* cacheDataObject = NULL; + HRESULT hres; + + _ICOM_THIS_From_IDataObject(DefaultHandler, iface); + + TRACE("(%p, %p, %p, %d)\n", iface, pformatetc, pmedium, fRelease); + + hres = IUnknown_QueryInterface(this->dataCache, + &IID_IDataObject, + (void**)&cacheDataObject); + + if (FAILED(hres)) + return E_UNEXPECTED; + + hres = IDataObject_SetData(cacheDataObject, + pformatetc, + pmedium, + fRelease); + + IDataObject_Release(cacheDataObject); + + return hres; +} + +/************************************************************************ + * DefaultHandler_EnumFormatEtc (IDataObject) + * + * The default handler's implementation of this method simply delegates + * to OleRegEnumFormatEtc. + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI DefaultHandler_EnumFormatEtc( + IDataObject* iface, + DWORD dwDirection, + IEnumFORMATETC** ppenumFormatEtc) +{ + HRESULT hres; + _ICOM_THIS_From_IDataObject(DefaultHandler, iface); + + TRACE("(%p, %lx, %p)\n", iface, dwDirection, ppenumFormatEtc); + + hres = OleRegEnumFormatEtc(&(this->clsid), dwDirection, ppenumFormatEtc); + + return hres; +} + +/************************************************************************ + * DefaultHandler_DAdvise (IDataObject) + * + * The default handler's implementation of this method simply + * delegates to the DataAdviseHolder. + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI DefaultHandler_DAdvise( + IDataObject* iface, + FORMATETC* pformatetc, + DWORD advf, + IAdviseSink* pAdvSink, + DWORD* pdwConnection) +{ + HRESULT hres = S_OK; + _ICOM_THIS_From_IDataObject(DefaultHandler, iface); + + TRACE("(%p, %p, %ld, %p, %p)\n", + iface, pformatetc, advf, pAdvSink, pdwConnection); + + /* + * Make sure we have a data advise holder before we start. + */ + if (this->dataAdviseHolder==NULL) + { + hres = CreateDataAdviseHolder(&this->dataAdviseHolder); + } + + if (SUCCEEDED(hres)) + { + hres = IDataAdviseHolder_Advise(this->dataAdviseHolder, + iface, + pformatetc, + advf, + pAdvSink, + pdwConnection); + } + + return hres; +} + +/************************************************************************ + * DefaultHandler_DUnadvise (IDataObject) + * + * The default handler's implementation of this method simply + * delegates to the DataAdviseHolder. + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI DefaultHandler_DUnadvise( + IDataObject* iface, + DWORD dwConnection) +{ + _ICOM_THIS_From_IDataObject(DefaultHandler, iface); + + TRACE("(%p, %ld)\n", iface, dwConnection); + + /* + * If we don't have a data advise holder yet, it means that + * we don't have any connections.. + */ + if (this->dataAdviseHolder==NULL) + { + return OLE_E_NOCONNECTION; + } + + return IDataAdviseHolder_Unadvise(this->dataAdviseHolder, + dwConnection); +} + +/************************************************************************ + * DefaultHandler_EnumDAdvise (IDataObject) + * + * The default handler's implementation of this method simply + * delegates to the DataAdviseHolder. + * + * See Windows documentation for more details on IDataObject methods. + */ +static HRESULT WINAPI DefaultHandler_EnumDAdvise( + IDataObject* iface, + IEnumSTATDATA** ppenumAdvise) +{ + _ICOM_THIS_From_IDataObject(DefaultHandler, iface); + + TRACE("(%p, %p)\n", iface, ppenumAdvise); + + /* + * Sanity check + */ + if (ppenumAdvise == NULL) + return E_POINTER; + + /* + * Initialize the out parameter. + */ + *ppenumAdvise = NULL; + + /* + * If we have a data advise holder object, delegate. + */ + if (this->dataAdviseHolder!=NULL) + { + return IDataAdviseHolder_EnumAdvise(this->dataAdviseHolder, + ppenumAdvise); + } + + return S_OK; +} + +/********************************************************* + * Methods implementation for the IRunnableObject part + * of the DefaultHandler class. + */ + +/************************************************************************ + * DefaultHandler_IRunnableObject_QueryInterface (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static HRESULT WINAPI DefaultHandler_IRunnableObject_QueryInterface( + IRunnableObject* iface, + REFIID riid, + void** ppvObject) +{ + _ICOM_THIS_From_IRunnableObject(DefaultHandler, iface); + + return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); +} + +/************************************************************************ + * DefaultHandler_IRunnableObject_QueryInterface (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef( + IRunnableObject* iface) +{ + _ICOM_THIS_From_IRunnableObject(DefaultHandler, iface); + + return IUnknown_AddRef(this->outerUnknown); +} + +/************************************************************************ + * DefaultHandler_IRunnableObject_QueryInterface (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static ULONG WINAPI DefaultHandler_IRunnableObject_Release( + IRunnableObject* iface) +{ + _ICOM_THIS_From_IRunnableObject(DefaultHandler, iface); + + return IUnknown_Release(this->outerUnknown); +} + +/************************************************************************ + * DefaultHandler_GetRunningClass (IRunnableObject) + * + * According to Brockscmidt, Chapter 19, the default handler's + * implementation of IRunnableobject does nothing until the object + * is actually running. + * + * See Windows documentation for more details on IRunnableObject methods. + */ +static HRESULT WINAPI DefaultHandler_GetRunningClass( + IRunnableObject* iface, + LPCLSID lpClsid) +{ + TRACE("()\n"); + return S_OK; +} + +static HRESULT WINAPI DefaultHandler_Run( + IRunnableObject* iface, + IBindCtx* pbc) +{ + FIXME(": Stub\n"); + return E_NOTIMPL; +} + +/************************************************************************ + * DefaultHandler_IsRunning (IRunnableObject) + * + * According to Brockscmidt, Chapter 19, the default handler's + * implementation of IRunnableobject does nothing until the object + * is actually running. + * + * See Windows documentation for more details on IRunnableObject methods. + */ +static BOOL WINAPI DefaultHandler_IsRunning( + IRunnableObject* iface) +{ + TRACE("()\n"); + return S_FALSE; +} + +/************************************************************************ + * DefaultHandler_LockRunning (IRunnableObject) + * + * According to Brockscmidt, Chapter 19, the default handler's + * implementation of IRunnableobject does nothing until the object + * is actually running. + * + * See Windows documentation for more details on IRunnableObject methods. + */ +static HRESULT WINAPI DefaultHandler_LockRunning( + IRunnableObject* iface, + BOOL fLock, + BOOL fLastUnlockCloses) +{ + TRACE("()\n"); + return S_OK; +} + +/************************************************************************ + * DefaultHandler_SetContainedObject (IRunnableObject) + * + * According to Brockscmidt, Chapter 19, the default handler's + * implementation of IRunnableobject does nothing until the object + * is actually running. + * + * See Windows documentation for more details on IRunnableObject methods. + */ +static HRESULT WINAPI DefaultHandler_SetContainedObject( + IRunnableObject* iface, + BOOL fContained) +{ + TRACE("()\n"); + return S_OK; +} diff --git a/reactos/lib/ole32/drag_copy.cur b/reactos/lib/ole32/drag_copy.cur new file mode 100644 index 00000000000..8d275569aab Binary files /dev/null and b/reactos/lib/ole32/drag_copy.cur differ diff --git a/reactos/lib/ole32/drag_link.cur b/reactos/lib/ole32/drag_link.cur new file mode 100644 index 00000000000..1a1fb06bc9e Binary files /dev/null and b/reactos/lib/ole32/drag_link.cur differ diff --git a/reactos/lib/ole32/drag_move.cur b/reactos/lib/ole32/drag_move.cur new file mode 100644 index 00000000000..c293d18923b Binary files /dev/null and b/reactos/lib/ole32/drag_move.cur differ diff --git a/reactos/lib/ole32/errorinfo.c b/reactos/lib/ole32/errorinfo.c new file mode 100644 index 00000000000..5c3a6422d20 --- /dev/null +++ b/reactos/lib/ole32/errorinfo.c @@ -0,0 +1,516 @@ +/* + * ErrorInfo API + * + * Copyright 2000 Patrik Stridvall, Juergen Schmied + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * NOTES: + * + * The errorinfo is a per-thread object. The reference is stored in the + * TEB at offset 0xf80 + */ + +#include +#include + +#ifdef __REACTOS__ +#include +#endif +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "oleauto.h" +#include "winerror.h" + +#include "wine/unicode.h" +#include "compobj_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +/* this code is from SysAllocStringLen (ole2disp.c in oleaut32) */ +static BSTR WINAPI ERRORINFO_SysAllocString(const OLECHAR* in) +{ + DWORD bufferSize; + DWORD* newBuffer; + WCHAR* stringBuffer; + DWORD len; + + if (in == NULL) + return NULL; + /* + * Find the lenth of the buffer passed-in in bytes. + */ + len = strlenW(in); + bufferSize = len * sizeof (WCHAR); + + /* + * Allocate a new buffer to hold the string. + * dont't forget to keep an empty spot at the beginning of the + * buffer for the character count and an extra character at the + * end for the '\0'. + */ + newBuffer = (DWORD*)HeapAlloc(GetProcessHeap(), + 0, + bufferSize + sizeof(WCHAR) + sizeof(DWORD)); + + /* + * If the memory allocation failed, return a null pointer. + */ + if (newBuffer==0) + return 0; + + /* + * Copy the length of the string in the placeholder. + */ + *newBuffer = bufferSize; + + /* + * Skip the byte count. + */ + newBuffer++; + + /* + * Copy the information in the buffer. + * Since it is valid to pass a NULL pointer here, we'll initialize the + * buffer to nul if it is the case. + */ + if (in != 0) + memcpy(newBuffer, in, bufferSize); + else + memset(newBuffer, 0, bufferSize); + + /* + * Make sure that there is a nul character at the end of the + * string. + */ + stringBuffer = (WCHAR*)newBuffer; + stringBuffer[len] = 0; + + return (LPWSTR)stringBuffer; +} + +/* this code is from SysFreeString (ole2disp.c in oleaut32)*/ +static VOID WINAPI ERRORINFO_SysFreeString(BSTR in) +{ + DWORD* bufferPointer; + + /* NULL is a valid parameter */ + if(!in) return; + + /* + * We have to be careful when we free a BSTR pointer, it points to + * the beginning of the string but it skips the byte count contained + * before the string. + */ + bufferPointer = (DWORD*)in; + + bufferPointer--; + + /* + * Free the memory from it's "real" origin. + */ + HeapFree(GetProcessHeap(), 0, bufferPointer); +} + + +typedef struct ErrorInfoImpl +{ + ICOM_VTABLE(IErrorInfo) *lpvtei; + ICOM_VTABLE(ICreateErrorInfo) *lpvtcei; + ICOM_VTABLE(ISupportErrorInfo) *lpvtsei; + DWORD ref; + + GUID m_Guid; + BSTR bstrSource; + BSTR bstrDescription; + BSTR bstrHelpFile; + DWORD m_dwHelpContext; +} ErrorInfoImpl; + +static ICOM_VTABLE(IErrorInfo) IErrorInfoImpl_VTable; +static ICOM_VTABLE(ICreateErrorInfo) ICreateErrorInfoImpl_VTable; +static ICOM_VTABLE(ISupportErrorInfo) ISupportErrorInfoImpl_VTable; + +/* + converts a objectpointer to This + */ +#define _IErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtei))) +#define _ICOM_THIS_From_IErrorInfo(class, name) class* This = (class*)(((char*)name)-_IErrorInfo_Offset); + +#define _ICreateErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtcei))) +#define _ICOM_THIS_From_ICreateErrorInfo(class, name) class* This = (class*)(((char*)name)-_ICreateErrorInfo_Offset); + +#define _ISupportErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtsei))) +#define _ICOM_THIS_From_ISupportErrorInfo(class, name) class* This = (class*)(((char*)name)-_ISupportErrorInfo_Offset); + +/* + converts This to a objectpointer + */ +#define _IErrorInfo_(This) (IErrorInfo*)&(This->lpvtei) +#define _ICreateErrorInfo_(This) (ICreateErrorInfo*)&(This->lpvtcei) +#define _ISupportErrorInfo_(This) (ISupportErrorInfo*)&(This->lpvtsei) + +IErrorInfo * IErrorInfoImpl_Constructor() +{ + ErrorInfoImpl * ei = HeapAlloc(GetProcessHeap(), 0, sizeof(ErrorInfoImpl)); + if (ei) + { + ei->lpvtei = &IErrorInfoImpl_VTable; + ei->lpvtcei = &ICreateErrorInfoImpl_VTable; + ei->lpvtsei = &ISupportErrorInfoImpl_VTable; + ei->ref = 1; + ei->bstrSource = NULL; + ei->bstrDescription = NULL; + ei->bstrHelpFile = NULL; + ei->m_dwHelpContext = 0; + } + return (IErrorInfo *)ei; +} + + +static HRESULT WINAPI IErrorInfoImpl_QueryInterface( + IErrorInfo* iface, + REFIID riid, + VOID** ppvoid) +{ + _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvoid); + + *ppvoid = NULL; + + if(IsEqualIID(riid, &IID_IErrorInfo)) + { + *ppvoid = _IErrorInfo_(This); + } + else if(IsEqualIID(riid, &IID_ICreateErrorInfo)) + { + *ppvoid = _ICreateErrorInfo_(This); + } + else if(IsEqualIID(riid, &IID_ISupportErrorInfo)) + { + *ppvoid = _ISupportErrorInfo_(This); + } + + if(*ppvoid) + { + IUnknown_AddRef( (IUnknown*)*ppvoid ); + TRACE("-- Interface: (%p)->(%p)\n",ppvoid,*ppvoid); + return S_OK; + } + TRACE("-- Interface: E_NOINTERFACE\n"); + return E_NOINTERFACE; +} + +static ULONG WINAPI IErrorInfoImpl_AddRef( + IErrorInfo* iface) +{ + _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)->(count=%lu)\n",This,This->ref); + return InterlockedIncrement(&This->ref); +} + +static ULONG WINAPI IErrorInfoImpl_Release( + IErrorInfo* iface) +{ + _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)->(count=%lu)\n",This,This->ref); + + if (!InterlockedDecrement(&This->ref)) + { + TRACE("-- destroying IErrorInfo(%p)\n",This); + HeapFree(GetProcessHeap(),0,This); + return 0; + } + return This->ref; +} + +static HRESULT WINAPI IErrorInfoImpl_GetGUID( + IErrorInfo* iface, + GUID * pGUID) +{ + _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)->(count=%lu)\n",This,This->ref); + if(!pGUID )return E_INVALIDARG; + memcpy(pGUID, &This->m_Guid, sizeof(GUID)); + return S_OK; +} + +static HRESULT WINAPI IErrorInfoImpl_GetSource( + IErrorInfo* iface, + BSTR *pBstrSource) +{ + _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)->(pBstrSource=%p)\n",This,pBstrSource); + if (pBstrSource == NULL) + return E_INVALIDARG; + *pBstrSource = ERRORINFO_SysAllocString(This->bstrSource); + return S_OK; +} + +static HRESULT WINAPI IErrorInfoImpl_GetDescription( + IErrorInfo* iface, + BSTR *pBstrDescription) +{ + _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface); + + TRACE("(%p)->(pBstrDescription=%p)\n",This,pBstrDescription); + if (pBstrDescription == NULL) + return E_INVALIDARG; + *pBstrDescription = ERRORINFO_SysAllocString(This->bstrDescription); + + return S_OK; +} + +static HRESULT WINAPI IErrorInfoImpl_GetHelpFile( + IErrorInfo* iface, + BSTR *pBstrHelpFile) +{ + _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface); + + TRACE("(%p)->(pBstrHelpFile=%p)\n",This, pBstrHelpFile); + if (pBstrHelpFile == NULL) + return E_INVALIDARG; + *pBstrHelpFile = ERRORINFO_SysAllocString(This->bstrHelpFile); + + return S_OK; +} + +static HRESULT WINAPI IErrorInfoImpl_GetHelpContext( + IErrorInfo* iface, + DWORD *pdwHelpContext) +{ + _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)->(pdwHelpContext=%p)\n",This, pdwHelpContext); + if (pdwHelpContext == NULL) + return E_INVALIDARG; + *pdwHelpContext = This->m_dwHelpContext; + + return S_OK; +} + +static ICOM_VTABLE(IErrorInfo) IErrorInfoImpl_VTable = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IErrorInfoImpl_QueryInterface, + IErrorInfoImpl_AddRef, + IErrorInfoImpl_Release, + + IErrorInfoImpl_GetGUID, + IErrorInfoImpl_GetSource, + IErrorInfoImpl_GetDescription, + IErrorInfoImpl_GetHelpFile, + IErrorInfoImpl_GetHelpContext +}; + + +static HRESULT WINAPI ICreateErrorInfoImpl_QueryInterface( + ICreateErrorInfo* iface, + REFIID riid, + VOID** ppvoid) +{ + _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)\n", This); + return IErrorInfo_QueryInterface(_IErrorInfo_(This), riid, ppvoid); +} + +static ULONG WINAPI ICreateErrorInfoImpl_AddRef( + ICreateErrorInfo* iface) +{ + _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)\n", This); + return IErrorInfo_AddRef(_IErrorInfo_(This)); +} + +static ULONG WINAPI ICreateErrorInfoImpl_Release( + ICreateErrorInfo* iface) +{ + _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)\n", This); + return IErrorInfo_Release(_IErrorInfo_(This)); +} + + +static HRESULT WINAPI ICreateErrorInfoImpl_SetGUID( + ICreateErrorInfo* iface, + REFGUID rguid) +{ + _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)->(%s)\n", This, debugstr_guid(rguid)); + memcpy(&This->m_Guid, rguid, sizeof(GUID)); + return S_OK; +} + +static HRESULT WINAPI ICreateErrorInfoImpl_SetSource( + ICreateErrorInfo* iface, + LPOLESTR szSource) +{ + _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)\n",This); + if (This->bstrSource != NULL) + ERRORINFO_SysFreeString(This->bstrSource); + This->bstrSource = ERRORINFO_SysAllocString(szSource); + + return S_OK; +} + +static HRESULT WINAPI ICreateErrorInfoImpl_SetDescription( + ICreateErrorInfo* iface, + LPOLESTR szDescription) +{ + _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)\n",This); + if (This->bstrDescription != NULL) + ERRORINFO_SysFreeString(This->bstrDescription); + This->bstrDescription = ERRORINFO_SysAllocString(szDescription); + + return S_OK; +} + +static HRESULT WINAPI ICreateErrorInfoImpl_SetHelpFile( + ICreateErrorInfo* iface, + LPOLESTR szHelpFile) +{ + _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)\n",This); + if (This->bstrHelpFile != NULL) + ERRORINFO_SysFreeString(This->bstrHelpFile); + This->bstrHelpFile = ERRORINFO_SysAllocString(szHelpFile); + + return S_OK; +} + +static HRESULT WINAPI ICreateErrorInfoImpl_SetHelpContext( + ICreateErrorInfo* iface, + DWORD dwHelpContext) +{ + _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)\n",This); + This->m_dwHelpContext = dwHelpContext; + + return S_OK; +} + +static ICOM_VTABLE(ICreateErrorInfo) ICreateErrorInfoImpl_VTable = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ICreateErrorInfoImpl_QueryInterface, + ICreateErrorInfoImpl_AddRef, + ICreateErrorInfoImpl_Release, + + ICreateErrorInfoImpl_SetGUID, + ICreateErrorInfoImpl_SetSource, + ICreateErrorInfoImpl_SetDescription, + ICreateErrorInfoImpl_SetHelpFile, + ICreateErrorInfoImpl_SetHelpContext +}; + +static HRESULT WINAPI ISupportErrorInfoImpl_QueryInterface( + ISupportErrorInfo* iface, + REFIID riid, + VOID** ppvoid) +{ + _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)\n", This); + + return IErrorInfo_QueryInterface(_IErrorInfo_(This), riid, ppvoid); +} + +static ULONG WINAPI ISupportErrorInfoImpl_AddRef( + ISupportErrorInfo* iface) +{ + _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)\n", This); + return IErrorInfo_AddRef(_IErrorInfo_(This)); +} + +static ULONG WINAPI ISupportErrorInfoImpl_Release( + ISupportErrorInfo* iface) +{ + _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)\n", This); + return IErrorInfo_Release(_IErrorInfo_(This)); +} + + +static HRESULT WINAPI ISupportErrorInfoImpl_InterfaceSupportsErrorInfo( + ISupportErrorInfo* iface, + REFIID riid) +{ + _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface); + TRACE("(%p)->(%s)\n", This, debugstr_guid(riid)); + return (IsEqualIID(riid, &This->m_Guid)) ? S_OK : S_FALSE; +} + +static ICOM_VTABLE(ISupportErrorInfo) ISupportErrorInfoImpl_VTable = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ISupportErrorInfoImpl_QueryInterface, + ISupportErrorInfoImpl_AddRef, + ISupportErrorInfoImpl_Release, + + + ISupportErrorInfoImpl_InterfaceSupportsErrorInfo +}; +/*********************************************************************** + * CreateErrorInfo (OLE32.@) + */ +HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **pperrinfo) +{ + IErrorInfo * pei; + HRESULT res; + TRACE("(%p): stub:\n", pperrinfo); + if(! pperrinfo ) return E_INVALIDARG; + if(!(pei=IErrorInfoImpl_Constructor()))return E_OUTOFMEMORY; + + res = IErrorInfo_QueryInterface(pei, &IID_ICreateErrorInfo, (LPVOID*)pperrinfo); + IErrorInfo_Release(pei); + return res; +} + +/*********************************************************************** + * GetErrorInfo (OLE32.@) + */ +HRESULT WINAPI GetErrorInfo(ULONG dwReserved, IErrorInfo **pperrinfo) +{ + TRACE("(%ld, %p, %p): stub:\n", dwReserved, pperrinfo, COM_CurrentInfo()->ErrorInfo); + + if(! pperrinfo ) return E_INVALIDARG; + if(!(*pperrinfo = (IErrorInfo*)(COM_CurrentInfo()->ErrorInfo))) return S_FALSE; + + /* clear thread error state */ + COM_CurrentInfo()->ErrorInfo = NULL; + return S_OK; +} + +/*********************************************************************** + * SetErrorInfo (OLE32.@) + */ +HRESULT WINAPI SetErrorInfo(ULONG dwReserved, IErrorInfo *perrinfo) +{ + IErrorInfo * pei; + TRACE("(%ld, %p): stub:\n", dwReserved, perrinfo); + + /* release old errorinfo */ + pei = (IErrorInfo*)COM_CurrentInfo()->ErrorInfo; + if(pei) IErrorInfo_Release(pei); + + /* set to new value */ + COM_CurrentInfo()->ErrorInfo = perrinfo; + if(perrinfo) IErrorInfo_AddRef(perrinfo); + return S_OK; +} diff --git a/reactos/lib/ole32/filemoniker.c b/reactos/lib/ole32/filemoniker.c index d4aeb6d87b9..805ee281c31 100644 --- a/reactos/lib/ole32/filemoniker.c +++ b/reactos/lib/ole32/filemoniker.c @@ -2,23 +2,54 @@ * FileMonikers implementation * * Copyright 1999 Noomen Hamza + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************************/ +#include +#include #include -#include -#include -#include -#include +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winnls.h" +#include "wine/unicode.h" +#include "wine/debug.h" +#include "objbase.h" +#include "moniker.h" -#include +#include "compobj_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +const CLSID CLSID_FileMoniker = { + 0x303, 0, 0, {0xC0, 0, 0, 0, 0, 0, 0, 0x46} +}; /* filemoniker data structure */ typedef struct FileMonikerImpl{ ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ - /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether + /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether * two monikers are equal. That's whay IROTData interface is implemented by monikers. */ ICOM_VTABLE(IROTData)* lpvtbl2; /* VTable relative to the IROTData interface.*/ @@ -77,7 +108,7 @@ static HRESULT WINAPI FileMonikerROTDataImpl_GetComparaisonData(IROTData* iface, /* Local function used by filemoniker implementation */ HRESULT WINAPI FileMonikerImpl_Construct(FileMonikerImpl* iface, LPCOLESTR lpszPathName); HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* iface); -int WINAPI FileMonikerImpl_DecomposePath(LPOLESTR str, LPOLESTR** tabStr); +int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** tabStr); /********************************************************************************/ @@ -128,13 +159,13 @@ static ICOM_VTABLE(IROTData) VT_ROTDataImpl = HRESULT WINAPI FileMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject) { ICOM_THIS(FileMonikerImpl,iface); - - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,riid,ppvObject)); + + TRACE("(%p,%p,%p)\n",This,riid,ppvObject); /* Perform a sanity check on the parameters.*/ if ( (This==0) || (ppvObject==0) ) return E_INVALIDARG; - + /* Initialize the return parameter */ *ppvObject = 0; @@ -145,14 +176,14 @@ HRESULT WINAPI FileMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** IsEqualIID(&IID_IMoniker, riid) ) *ppvObject = iface; - + else if (IsEqualIID(&IID_IROTData, riid)) *ppvObject = (IROTData*)&(This->lpvtbl2); /* Check that we obtained an interface.*/ if ((*ppvObject)==0) return E_NOINTERFACE; - + /* Query Interface always increases the reference count by one when it is successful */ FileMonikerImpl_AddRef(iface); @@ -166,7 +197,7 @@ ULONG WINAPI FileMonikerImpl_AddRef(IMoniker* iface) { ICOM_THIS(FileMonikerImpl,iface); - Print(MAX_TRACE, ("(%p)\n",iface)); + TRACE("(%p)\n",iface); return ++(This->ref); } @@ -178,7 +209,7 @@ ULONG WINAPI FileMonikerImpl_Release(IMoniker* iface) { ICOM_THIS(FileMonikerImpl,iface); - Print(MAX_TRACE, ("(%p)\n",iface)); + TRACE("(%p)\n",iface); This->ref--; @@ -189,7 +220,7 @@ ULONG WINAPI FileMonikerImpl_Release(IMoniker* iface) return 0; } - return This->ref;; + return This->ref; } /****************************************************************************** @@ -198,13 +229,13 @@ ULONG WINAPI FileMonikerImpl_Release(IMoniker* iface) HRESULT WINAPI FileMonikerImpl_GetClassID(IMoniker* iface, CLSID *pClassID)/* Pointer to CLSID of object */ { - Print(MAX_TRACE, ("(%p,%p),stub!\n",iface,pClassID)); + TRACE("(%p,%p),stub!\n",iface,pClassID); if (pClassID==NULL) return E_POINTER; *pClassID = CLSID_FileMoniker; - + return S_OK; } @@ -217,7 +248,7 @@ HRESULT WINAPI FileMonikerImpl_IsDirty(IMoniker* iface) method in the OLE-provided moniker interfaces always return S_FALSE because their internal state never changes. */ - Print(MAX_TRACE, ("(%p)\n",iface)); + TRACE("(%p)\n",iface); return S_FALSE; } @@ -236,7 +267,7 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm) ICOM_THIS(FileMonikerImpl,iface); - Print(MAX_TRACE, ("(%p,%p)\n",iface,pStm)); + TRACE("(%p,%p)\n",iface,pStm); /* this function locates and reads from the stream the filePath string written by FileMonikerImpl_Save */ @@ -244,7 +275,7 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm) res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread); if (bread!=sizeof(WORD) || wbuffer!=0) return E_FAIL; - + /* read filePath string length (plus one) */ res=IStream_Read(pStm,&length,sizeof(DWORD),&bread); if (bread != sizeof(DWORD)) @@ -253,6 +284,7 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm) /* read filePath string */ filePathA=HeapAlloc(GetProcessHeap(),0,length); res=IStream_Read(pStm,filePathA,length,&bread); + HeapFree(GetProcessHeap(),0,filePathA); if (bread != length) return E_FAIL; @@ -260,18 +292,18 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm) IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread); if (bread != sizeof(DWORD) || dwbuffer != 0xDEADFFFF) return E_FAIL; - + length--; - + for(i=0;i<10;i++){ res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread); if (bread!=sizeof(WORD) || wbuffer!=0) return E_FAIL; } - + if (length>8) length=0; - + doubleLenHex=doubleLenDec=2*length; if (length > 5) doubleLenDec+=6; @@ -282,7 +314,7 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm) if (length==0) return res; - + res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread); if (bread!=sizeof(DWORD) || dwbuffer!=doubleLenHex) return E_FAIL; @@ -294,16 +326,16 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm) filePathW=HeapAlloc(GetProcessHeap(),0,(length+1)*sizeof(WCHAR)); filePathW[length]=0; res=IStream_Read(pStm,filePathW,doubleLenHex,&bread); - if (bread!=doubleLenHex) + if (bread!=doubleLenHex) { + HeapFree(GetProcessHeap(), 0, filePathW); return E_FAIL; + } if (This->filePathName!=NULL) HeapFree(GetProcessHeap(),0,This->filePathName); This->filePathName=filePathW; - HeapFree(GetProcessHeap(),0,filePathA); - return res; } @@ -314,18 +346,26 @@ HRESULT WINAPI FileMonikerImpl_Save(IMoniker* iface, IStream* pStm,/* pointer to the stream where the object is to be saved */ BOOL fClearDirty)/* Specifies whether to clear the dirty flag */ { - /* this function saves data of this object. In the begining I thougth that I have just to write - * the filePath string on Stream. But, when I tested this function whith windows programs samples ! - * I noted that it was not the case. So I analysed data written by this function on Windows system and - * what did this function do exactly ! but I have no idear a bout its logic ! - * I guessed data who must be written on stream wich is: - * 1) WORD constant:zero 2) length of the path string ("\0" included) 3) path string type A - * 4) DWORD constant : 0xDEADFFFF 5) ten WORD constant: zero 6) DWORD: double-length of the the path - * string type W ("\0" not included) 7) WORD constant: 0x3 8) filePath unicode string. - * if the length(filePath) > 8 or.length(filePath) == 8 stop at step 5) + /* this function saves data of this object. In the beginning I thougth + * that I have just to write the filePath string on Stream. But, when I + * tested this function whith windows programs samples, I noticed that it + * was not the case. So I analysed data written by this function on + * Windows and what this did function exactly ! But I have no idea about + * its logic ! + * I guessed data which must be written on stream is: + * 1) WORD constant:zero + * 2) length of the path string ("\0" included) + * 3) path string type A + * 4) DWORD constant : 0xDEADFFFF + * 5) ten WORD constant: zero + * 6) DWORD: double-length of the the path string type W ("\0" not + * included) + * 7) WORD constant: 0x3 + * 8) filePath unicode string. + * if the length(filePath) > 8 or length(filePath) == 8 stop at step 5) */ - ICOM_THIS(FileMonikerImpl,iface); + ICOM_THIS(FileMonikerImpl,iface); HRESULT res; LPOLESTR filePathW=This->filePathName; @@ -340,7 +380,7 @@ HRESULT WINAPI FileMonikerImpl_Save(IMoniker* iface, DWORD doubleLenDec; int i=0; - Print(MAX_TRACE, ("(%p,%p,%d)\n",iface,pStm,fClearDirty)); + TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty); if (pStm==NULL) return E_POINTER; @@ -360,15 +400,15 @@ HRESULT WINAPI FileMonikerImpl_Save(IMoniker* iface, /* write a DWORD set to 0xDEADFFFF: constant */ res=IStream_Write(pStm,&constant1,sizeof(DWORD),NULL); - + len--; /* write 10 times a DWORD set to 0 : constants */ for(i=0;i<10;i++) res=IStream_Write(pStm,&zero,sizeof(WORD),NULL); - + if (len>8) len=0; - + doubleLenHex=doubleLenDec=2*len; if (len > 5) doubleLenDec+=6; @@ -401,13 +441,13 @@ HRESULT WINAPI FileMonikerImpl_GetSizeMax(IMoniker* iface, DWORD len=lstrlenW(This->filePathName); DWORD sizeMAx; - Print(MAX_TRACE, ("(%p,%p)\n",iface,pcbSize)); + TRACE("(%p,%p)\n",iface,pcbSize); if (pcbSize!=NULL) return E_POINTER; /* for more details see FileMonikerImpl_Save coments */ - + sizeMAx = sizeof(WORD) + /* first WORD is 0 */ sizeof(DWORD)+ /* length of filePath including "\0" in the end of the string */ (len+1)+ /* filePath string */ @@ -417,11 +457,11 @@ HRESULT WINAPI FileMonikerImpl_GetSizeMax(IMoniker* iface, if (len==0 || len > 8) return S_OK; - + sizeMAx += sizeof(DWORD)+ /* size of the unicode filePath: "\0" not included */ sizeof(WORD)+ /* constant : 0x3 */ len*sizeof(WCHAR); /* unicde filePath string */ - + pcbSize->u.LowPart=sizeMAx; pcbSize->u.HighPart=0; @@ -439,8 +479,8 @@ HRESULT WINAPI FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa WCHAR twoPoint[]={'.','.',0}; WCHAR bkSlash[]={'\\',0}; BYTE addBkSlash; - - Print(MAX_TRACE, ("(%p,%p)\n",This,lpszPathName)); + + TRACE("(%p,%p)\n",This,lpszPathName); /* Initialize the virtual fgunction table. */ This->lpvtbl1 = &VT_FileMonikerImpl; @@ -452,7 +492,7 @@ HRESULT WINAPI FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa if (This->filePathName==NULL) return E_OUTOFMEMORY; - lstrcpyW(This->filePathName,lpszPathName); + strcpyW(This->filePathName,lpszPathName); nb=FileMonikerImpl_DecomposePath(This->filePathName,&tabStr); @@ -484,12 +524,12 @@ HRESULT WINAPI FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa This->filePathName=HeapReAlloc(GetProcessHeap(),0,This->filePathName,(sizeStr+1)*sizeof(WCHAR)); *This->filePathName=0; - + for(i=0;tabStr[i]!=NULL;i++) - lstrcatW(This->filePathName,tabStr[i]); - + strcatW(This->filePathName,tabStr[i]); + if (addBkSlash) - lstrcatW(This->filePathName,bkSlash); + strcatW(This->filePathName,bkSlash); } for(i=0; tabStr[i]!=NULL;i++) @@ -504,7 +544,7 @@ HRESULT WINAPI FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa *******************************************************************************/ HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* This) { - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); if (This->filePathName!=NULL) HeapFree(GetProcessHeap(),0,This->filePathName); @@ -530,15 +570,15 @@ HRESULT WINAPI FileMonikerImpl_BindToObject(IMoniker* iface, IPersistFile *ppf=0; IClassFactory *pcf=0; IClassActivator *pca=0; - - ICOM_THIS(FileMonikerImpl,iface); + + ICOM_THIS(FileMonikerImpl,iface); *ppvResult=0; - Print(MAX_TRACE, ("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult)); + TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult); if(pmkToLeft==NULL){ - + res=IBindCtx_GetRunningObjectTable(pbc,&prot); if (SUCCEEDED(res)){ @@ -570,7 +610,7 @@ HRESULT WINAPI FileMonikerImpl_BindToObject(IMoniker* iface, if (res==E_NOINTERFACE){ res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassActivator,(void**)&pca); - + if (res==E_NOINTERFACE) return MK_E_INTERMEDIATEINTERFACENOTSUPPORTED; } @@ -588,8 +628,8 @@ HRESULT WINAPI FileMonikerImpl_BindToObject(IMoniker* iface, } if (pca!=NULL){ - Print(MIN_TRACE, ("()\n")); - + FIXME("()\n"); + /*res=GetClassFile(This->filePathName,&clsID); if (SUCCEEDED(res)){ @@ -625,7 +665,7 @@ HRESULT WINAPI FileMonikerImpl_BindToObject(IMoniker* iface, if (pcf!=NULL) IClassFactory_Release(pcf); - + return res; } @@ -642,7 +682,7 @@ HRESULT WINAPI FileMonikerImpl_BindToStorage(IMoniker* iface, IStorage *pstg=0; HRESULT res; - Print(MAX_TRACE, ("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvObject)); + TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvObject); if (pmkToLeft==NULL){ @@ -672,17 +712,17 @@ HRESULT WINAPI FileMonikerImpl_BindToStorage(IMoniker* iface, else if ( (IsEqualIID(&IID_IStream, riid)) || (IsEqualIID(&IID_ILockBytes, riid)) ) - return E_UNSPEC; + return E_FAIL; else return E_NOINTERFACE; } else { - Print(MIN_TRACE, ("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvObject)); + FIXME("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvObject); - return E_NOTIMPL; -} + return E_NOTIMPL; + } return res; } @@ -695,7 +735,7 @@ HRESULT WINAPI FileMonikerImpl_Reduce(IMoniker* iface, IMoniker** ppmkToLeft, IMoniker** ppmkReduced) { - Print(MAX_TRACE, ("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced)); + TRACE("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced); if (ppmkReduced==NULL) return E_POINTER; @@ -722,7 +762,7 @@ HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface, int i=0,j=0,lastIdx1=0,lastIdx2=0; DWORD mkSys; - Print(MAX_TRACE, ("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite)); + TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite); if (ppmkComposite==NULL) return E_POINTER; @@ -731,7 +771,7 @@ HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface, return E_INVALIDARG; *ppmkComposite=0; - + IMoniker_IsSystemMoniker(pmkRight,&mkSys); /* check if we have two filemonikers to compose or not */ @@ -760,20 +800,20 @@ HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface, /* the length of the composed path string is raised by the sum of the two paths lengths */ newStr=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(lstrlenW(str1)+lstrlenW(str2)+1)); - + if (newStr==NULL) return E_OUTOFMEMORY; /* new path is the concatenation of the rest of str1 and str2 */ for(*newStr=0,j=0;j<=lastIdx1;j++) - lstrcatW(newStr,strDec1[j]); + strcatW(newStr,strDec1[j]); if ((strDec2[i]==NULL && lastIdx1>-1 && lastIdx2>-1) || lstrcmpW(strDec2[i],bkSlash)!=0) - lstrcatW(newStr,bkSlash); - + strcatW(newStr,bkSlash); + for(j=i;j<=lastIdx2;j++) - lstrcatW(newStr,strDec2[j]); - + strcatW(newStr,strDec2[j]); + /* create a new moniker with the new string */ res=CreateFileMoniker(newStr,ppmkComposite); @@ -812,7 +852,7 @@ HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface, ******************************************************************************/ HRESULT WINAPI FileMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker) { - Print(MAX_TRACE, ("(%p,%d,%p)\n",iface,fForward,ppenumMoniker)); + TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker); if (ppenumMoniker == NULL) return E_POINTER; @@ -833,7 +873,7 @@ HRESULT WINAPI FileMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker IBindCtx* bind; HRESULT res; - Print(MAX_TRACE, ("(%p,%p)\n",iface,pmkOtherMoniker)); + TRACE("(%p,%p)\n",iface,pmkOtherMoniker); if (pmkOtherMoniker==NULL) return S_FALSE; @@ -841,21 +881,18 @@ HRESULT WINAPI FileMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker IMoniker_GetClassID(pmkOtherMoniker,&clsid); if (!IsEqualCLSID(&clsid,&CLSID_FileMoniker)) - return S_FALSE; - res=CreateBindCtx(0,&bind); - if (FAILED(res)) - return res; + res = CreateBindCtx(0,&bind); + if (FAILED(res)) return res; - IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath); - - if (lstrcmpiW(filePath, - This->filePathName)!=0) + if (SUCCEEDED(IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath))) { + int result = lstrcmpiW(filePath, This->filePathName); + CoTaskMemFree(filePath); + if ( result == 0 ) return S_OK; + } + return S_FALSE; - return S_FALSE; - - return S_OK; } /****************************************************************************** @@ -871,7 +908,7 @@ HRESULT WINAPI FileMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash) if (pdwHash==NULL) return E_POINTER; - + val = This->filePathName; len = lstrlenW(val); @@ -885,7 +922,7 @@ HRESULT WINAPI FileMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash) for (i = len ; i > 0; i -= skip, off += skip) { h = (h * 39) + val[off]; } -} + } *pdwHash=h; @@ -903,7 +940,7 @@ HRESULT WINAPI FileMonikerImpl_IsRunning(IMoniker* iface, IRunningObjectTable* rot; HRESULT res; - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning)); + TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning); if ( (pmkNewlyRunning!=NULL) && (IMoniker_IsEqual(pmkNewlyRunning,iface)==S_OK) ) return S_OK; @@ -936,7 +973,7 @@ HRESULT WINAPI FileMonikerImpl_GetTimeOfLastChange(IMoniker* iface, HRESULT res; WIN32_FILE_ATTRIBUTE_DATA info; - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pFileTime)); + TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pFileTime); if (pFileTime==NULL) return E_POINTER; @@ -952,14 +989,12 @@ HRESULT WINAPI FileMonikerImpl_GetTimeOfLastChange(IMoniker* iface, res= IRunningObjectTable_GetTimeOfLastChange(rot,iface,pFileTime); if (FAILED(res)){ /* the moniker is not registred */ -#if 0 + if (!GetFileAttributesExW(This->filePathName,GetFileExInfoStandard,&info)) return MK_E_NOOBJECT; -#else - Print(MIN_TRACE, ("GetFileAttributesExW() nowhere to be found\n")); -#endif + *pFileTime=info.ftLastWriteTime; -} + } return S_OK; } @@ -970,7 +1005,7 @@ HRESULT WINAPI FileMonikerImpl_GetTimeOfLastChange(IMoniker* iface, HRESULT WINAPI FileMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk) { - Print(MAX_TRACE, ("(%p,%p)\n",iface,ppmk)); + TRACE("(%p,%p)\n",iface,ppmk); return CreateAntiMoniker(ppmk); } @@ -992,13 +1027,14 @@ HRESULT WINAPI FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOth if (pmkOther==NULL) return E_INVALIDARG; - + *ppmkPrefix=0; - + /* check if we have the same type of moniker */ IMoniker_IsSystemMoniker(pmkOther,&mkSys); if(mkSys==MKSYS_FILEMONIKER){ + HRESULT ret; CreateBindCtx(0,&pbind); @@ -1016,7 +1052,7 @@ HRESULT WINAPI FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOth commonPath=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(min(lstrlenW(pathThis),lstrlenW(pathOther))+1)); *commonPath=0; - + for(sameIdx=0; ( (stringTable1[sameIdx]!=NULL) && (stringTable2[sameIdx]!=NULL) && (lstrcmpiW(stringTable1[sameIdx],stringTable2[sameIdx])==0)); sameIdx++); @@ -1030,31 +1066,33 @@ HRESULT WINAPI FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOth if( (*stringTable1[i]=='\\') && (i+1 < sameIdx) && (*stringTable1[i+1]=='\\') ){ machimeNameCase=FALSE; break; -} + } } if (machimeNameCase && *stringTable1[sameIdx-1]=='\\') sameIdx--; - + if (machimeNameCase && (sameIdx<=3) && (nb1 > 3 || nb2 > 3) ) - return MK_E_NOPREFIX; - - for(i=0;i0 && !(len1==1 && len2==1 && sameIdx==0)) for(j=sameIdx;(tabStr1[j] != NULL); j++) if (*tabStr1[j]!='\\') - lstrcatW(relPath,back); + strcatW(relPath,back); /* add items of the second path (similar items with the first path are not included) to the relativePath */ for(j=sameIdx;tabStr2[j]!=NULL;j++) - lstrcatW(relPath,tabStr2[j]); - + strcatW(relPath,tabStr2[j]); + res=CreateFileMoniker(relPath,ppmkRelPath); - + for(j=0; tabStr1[j]!=NULL;j++) CoTaskMemFree(tabStr1[j]); for(j=0; tabStr2[j]!=NULL;j++) @@ -1200,7 +1240,7 @@ HRESULT WINAPI FileMonikerImpl_GetDisplayName(IMoniker* iface, int len=lstrlenW(This->filePathName); - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName)); + TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName); if (ppszDisplayName==NULL) return E_POINTER; @@ -1212,8 +1252,8 @@ HRESULT WINAPI FileMonikerImpl_GetDisplayName(IMoniker* iface, if (*ppszDisplayName==NULL) return E_OUTOFMEMORY; - lstrcpyW(*ppszDisplayName,This->filePathName); - + strcpyW(*ppszDisplayName,This->filePathName); + return S_OK; } @@ -1227,7 +1267,7 @@ HRESULT WINAPI FileMonikerImpl_ParseDisplayName(IMoniker* iface, ULONG* pchEaten, IMoniker** ppmkOut) { - Print(MIN_TRACE, ("(%p,%p,%p,%p,%p,%p),stub!\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut)); + FIXME("(%p,%p,%p,%p,%p,%p),stub!\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut); return E_NOTIMPL; } @@ -1236,11 +1276,11 @@ HRESULT WINAPI FileMonikerImpl_ParseDisplayName(IMoniker* iface, ******************************************************************************/ HRESULT WINAPI FileMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys) { - Print(MAX_TRACE, ("(%p,%p)\n",iface,pwdMksys)); + TRACE("(%p,%p)\n",iface,pwdMksys); if (!pwdMksys) return E_POINTER; - + (*pwdMksys)=MKSYS_FILEMONIKER; return S_OK; @@ -1254,7 +1294,7 @@ HRESULT WINAPI FileMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid ICOM_THIS_From_IROTData(IMoniker, iface); - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,riid,ppvObject)); + TRACE("(%p,%p,%p)\n",This,riid,ppvObject); return FileMonikerImpl_QueryInterface(This, riid, ppvObject); } @@ -1266,7 +1306,7 @@ ULONG WINAPI FileMonikerROTDataImpl_AddRef(IROTData *iface) { ICOM_THIS_From_IROTData(IMoniker, iface); - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); return FileMonikerImpl_AddRef(This); } @@ -1277,8 +1317,8 @@ ULONG WINAPI FileMonikerROTDataImpl_AddRef(IROTData *iface) ULONG WINAPI FileMonikerROTDataImpl_Release(IROTData* iface) { ICOM_THIS_From_IROTData(IMoniker, iface); - - Print(MAX_TRACE, ("(%p)\n",This)); + + TRACE("(%p)\n",This); return FileMonikerImpl_Release(This); } @@ -1291,22 +1331,24 @@ HRESULT WINAPI FileMonikerROTDataImpl_GetComparaisonData(IROTData* iface, ULONG cbMax, ULONG* pcbData) { - UNIMPLEMENTED; + FIXME("(),stub!\n"); return E_NOTIMPL; } /****************************************************************************** - * CreateFileMoniker16 + * CreateFileMoniker (OLE2.28) ******************************************************************************/ +#ifndef __REACTOS__ HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName,LPMONIKER* ppmk) { - UNIMPLEMENTED; + FIXME("(%s,%p),stub!\n",lpszPathName,ppmk); return E_NOTIMPL; } +#endif /****************************************************************************** - * CreateFileMoniker + * CreateFileMoniker (OLE32.@) ******************************************************************************/ HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER * ppmk) { @@ -1314,16 +1356,16 @@ HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER * ppmk) HRESULT hr = E_FAIL; IID riid=IID_IMoniker; - Print(MAX_TRACE, ("(%p,%p)\n",lpszPathName,ppmk)); + TRACE("(%p,%p)\n",lpszPathName,ppmk); if (ppmk==NULL) return E_POINTER; if(lpszPathName==NULL) return MK_E_SYNTAX; - + *ppmk=0; - + newFileMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(FileMonikerImpl)); if (newFileMoniker == 0) diff --git a/reactos/lib/ole32/ftmarshal.c b/reactos/lib/ole32/ftmarshal.c new file mode 100644 index 00000000000..9b76cb76924 --- /dev/null +++ b/reactos/lib/ole32/ftmarshal.c @@ -0,0 +1,243 @@ +/* + * free threaded marshaller + * + * Copyright 2002 Juergen Schmied + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#ifdef __REACTOS__ +#include +#endif +#include "windef.h" +#include "winbase.h" +#include "objbase.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +typedef struct _FTMarshalImpl { + ICOM_VFIELD (IUnknown); + DWORD ref; + ICOM_VTABLE (IMarshal) * lpvtblFTM; + + IUnknown *pUnkOuter; +} FTMarshalImpl; + +#define _IFTMUnknown_(This)(IUnknown*)&(This->lpVtbl) +#define _IFTMarshal_(This) (IMarshal*)&(This->lpvtblFTM) + +#define _IFTMarshall_Offset ((int)(&(((FTMarshalImpl*)0)->lpvtblFTM))) +#define _ICOM_THIS_From_IFTMarshal(class, name) class* This = (class*)(((char*)name)-_IFTMarshall_Offset); + +/* inner IUnknown to handle aggregation */ +HRESULT WINAPI IiFTMUnknown_fnQueryInterface (IUnknown * iface, REFIID riid, LPVOID * ppv) +{ + + ICOM_THIS (FTMarshalImpl, iface); + + TRACE ("\n"); + *ppv = NULL; + + if (IsEqualIID (&IID_IUnknown, riid)) + *ppv = _IFTMUnknown_ (This); + else if (IsEqualIID (&IID_IMarshal, riid)) + *ppv = _IFTMarshal_ (This); + else { + FIXME ("No interface for %s.\n", debugstr_guid (riid)); + return E_NOINTERFACE; + } + IUnknown_AddRef ((IUnknown *) * ppv); + return S_OK; +} + +ULONG WINAPI IiFTMUnknown_fnAddRef (IUnknown * iface) +{ + + ICOM_THIS (FTMarshalImpl, iface); + + TRACE ("\n"); + return InterlockedIncrement (&This->ref); +} + +ULONG WINAPI IiFTMUnknown_fnRelease (IUnknown * iface) +{ + + ICOM_THIS (FTMarshalImpl, iface); + + TRACE ("\n"); + if (InterlockedDecrement (&This->ref)) + return This->ref; + HeapFree (GetProcessHeap (), 0, This); + return 0; +} + +static ICOM_VTABLE (IUnknown) iunkvt = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IiFTMUnknown_fnQueryInterface, + IiFTMUnknown_fnAddRef, + IiFTMUnknown_fnRelease +}; + +HRESULT WINAPI FTMarshalImpl_QueryInterface (LPMARSHAL iface, REFIID riid, LPVOID * ppv) +{ + + _ICOM_THIS_From_IFTMarshal (FTMarshalImpl, iface); + + TRACE ("(%p)->(\n\tIID:\t%s,%p)\n", This, debugstr_guid (riid), ppv); + return IUnknown_QueryInterface (This->pUnkOuter, riid, ppv); +} + +ULONG WINAPI FTMarshalImpl_AddRef (LPMARSHAL iface) +{ + + _ICOM_THIS_From_IFTMarshal (FTMarshalImpl, iface); + + TRACE ("\n"); + return IUnknown_AddRef (This->pUnkOuter); +} + +ULONG WINAPI FTMarshalImpl_Release (LPMARSHAL iface) +{ + + _ICOM_THIS_From_IFTMarshal (FTMarshalImpl, iface); + + TRACE ("\n"); + return IUnknown_Release (This->pUnkOuter); +} + +HRESULT WINAPI FTMarshalImpl_GetUnmarshalClass (LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, + void *pvDestContext, DWORD mshlflags, CLSID * pCid) +{ + FIXME ("(), stub!\n"); + return S_OK; +} + +HRESULT WINAPI FTMarshalImpl_GetMarshalSizeMax (LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, + void *pvDestContext, DWORD mshlflags, DWORD * pSize) +{ + + IMarshal *pMarshal = NULL; + HRESULT hres; + + _ICOM_THIS_From_IFTMarshal (FTMarshalImpl, iface); + + FIXME ("(), stub!\n"); + + /* if the marshalling happens inside the same process the interface pointer is + copied between the apartments */ + if (dwDestContext == MSHCTX_INPROC || dwDestContext == MSHCTX_CROSSCTX) { + *pSize = sizeof (This); + return S_OK; + } + + /* use the standard marshaller to handle all other cases */ + CoGetStandardMarshal (riid, pv, dwDestContext, pvDestContext, mshlflags, &pMarshal); + hres = IMarshal_GetMarshalSizeMax (pMarshal, riid, pv, dwDestContext, pvDestContext, mshlflags, pSize); + IMarshal_Release (pMarshal); + return hres; + + return S_OK; +} + +HRESULT WINAPI FTMarshalImpl_MarshalInterface (LPMARSHAL iface, IStream * pStm, REFIID riid, void *pv, + DWORD dwDestContext, void *pvDestContext, DWORD mshlflags) +{ + + IMarshal *pMarshal = NULL; + HRESULT hres; + + _ICOM_THIS_From_IFTMarshal (FTMarshalImpl, iface); + + FIXME ("(), stub!\n"); + + /* if the marshalling happens inside the same process the interface pointer is + copied between the apartments */ + if (dwDestContext == MSHCTX_INPROC || dwDestContext == MSHCTX_CROSSCTX) { + return IStream_Write (pStm, This, sizeof (This), 0); + } + + /* use the standard marshaler to handle all other cases */ + CoGetStandardMarshal (riid, pv, dwDestContext, pvDestContext, mshlflags, &pMarshal); + hres = IMarshal_MarshalInterface (pMarshal, pStm, riid, pv, dwDestContext, pvDestContext, mshlflags); + IMarshal_Release (pMarshal); + return hres; +} + +HRESULT WINAPI FTMarshalImpl_UnmarshalInterface (LPMARSHAL iface, IStream * pStm, REFIID riid, void **ppv) +{ + FIXME ("(), stub!\n"); + return S_OK; +} + +HRESULT WINAPI FTMarshalImpl_ReleaseMarshalData (LPMARSHAL iface, IStream * pStm) +{ + FIXME ("(), stub!\n"); + return S_OK; +} + +HRESULT WINAPI FTMarshalImpl_DisconnectObject (LPMARSHAL iface, DWORD dwReserved) +{ + FIXME ("(), stub!\n"); + return S_OK; +} + +ICOM_VTABLE (IMarshal) ftmvtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + FTMarshalImpl_QueryInterface, + FTMarshalImpl_AddRef, + FTMarshalImpl_Release, + FTMarshalImpl_GetUnmarshalClass, + FTMarshalImpl_GetMarshalSizeMax, + FTMarshalImpl_MarshalInterface, + FTMarshalImpl_UnmarshalInterface, + FTMarshalImpl_ReleaseMarshalData, + FTMarshalImpl_DisconnectObject +}; + +/*********************************************************************** + * CoCreateFreeThreadedMarshaler [OLE32.@] + * + */ +HRESULT WINAPI CoCreateFreeThreadedMarshaler (LPUNKNOWN punkOuter, LPUNKNOWN * ppunkMarshal) +{ + + FTMarshalImpl *ftm; + + TRACE ("(%p %p)\n", punkOuter, ppunkMarshal); + + ftm = (FTMarshalImpl *) HeapAlloc (GetProcessHeap (), 0, sizeof (FTMarshalImpl)); + if (!ftm) + return E_OUTOFMEMORY; + + ftm->lpVtbl = &iunkvt; + ftm->lpvtblFTM = &ftmvtbl; + ftm->ref = 1; + ftm->pUnkOuter = punkOuter; + + *ppunkMarshal = _IFTMUnknown_ (ftm); + return S_OK; +} diff --git a/reactos/lib/ole32/git.c b/reactos/lib/ole32/git.c new file mode 100644 index 00000000000..5eea542bf50 --- /dev/null +++ b/reactos/lib/ole32/git.c @@ -0,0 +1,372 @@ +/* + * Implementation of the StdGlobalInterfaceTable object + * + * The GlobalInterfaceTable (GIT) object is used to marshal interfaces between + * threading apartments (contexts). When you want to pass an interface but not + * as a parameter, it wouldn't get marshalled automatically, so you can use this + * object to insert the interface into a table, and you get back a cookie. + * Then when it's retrieved, it'll be unmarshalled into the right apartment. + * + * Copyright 2003 Mike Hearn + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include +#include +#include +#include +#include + +#ifdef __REACTOS__ +#include +#endif +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "objbase.h" +#include "ole2.h" +#include "winerror.h" +#include "winreg.h" +#include "winternl.h" + +#include "compobj_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +/**************************************************************************** + * StdGlobalInterfaceTable definition + * + * This class implements IGlobalInterfaceTable and is a process-wide singleton + * used for marshalling interfaces between threading apartments using cookies. + */ + +/* Each entry in the linked list of GIT entries */ +typedef struct StdGITEntry +{ + DWORD cookie; + IID iid; /* IID of the interface */ + IStream* stream; /* Holds the marshalled interface */ + + struct StdGITEntry* next; + struct StdGITEntry* prev; +} StdGITEntry; + +/* Class data */ +typedef struct StdGlobalInterfaceTableImpl +{ + ICOM_VFIELD(IGlobalInterfaceTable); + + ULONG ref; + struct StdGITEntry* firstEntry; + struct StdGITEntry* lastEntry; + ULONG nextCookie; + +} StdGlobalInterfaceTableImpl; + +void* StdGlobalInterfaceTableInstance; + + +/* IUnknown */ +static HRESULT WINAPI StdGlobalInterfaceTable_QueryInterface(IGlobalInterfaceTable* iface, REFIID riid, void** ppvObject); +static ULONG WINAPI StdGlobalInterfaceTable_AddRef(IGlobalInterfaceTable* iface); +static ULONG WINAPI StdGlobalInterfaceTable_Release(IGlobalInterfaceTable* iface); +/* IGlobalInterfaceTable */ +static HRESULT WINAPI StdGlobalInterfaceTable_RegisterInterfaceInGlobal(IGlobalInterfaceTable* iface, IUnknown* pUnk, REFIID riid, DWORD* pdwCookie); +static HRESULT WINAPI StdGlobalInterfaceTable_RevokeInterfaceFromGlobal(IGlobalInterfaceTable* iface, DWORD dwCookie); +static HRESULT WINAPI StdGlobalInterfaceTable_GetInterfaceFromGlobal(IGlobalInterfaceTable* iface, DWORD dwCookie, REFIID riid, void **ppv); + +/* Virtual function table */ +static ICOM_VTABLE(IGlobalInterfaceTable) StdGlobalInterfaceTableImpl_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + StdGlobalInterfaceTable_QueryInterface, + StdGlobalInterfaceTable_AddRef, + StdGlobalInterfaceTable_Release, + StdGlobalInterfaceTable_RegisterInterfaceInGlobal, + StdGlobalInterfaceTable_RevokeInterfaceFromGlobal, + StdGlobalInterfaceTable_GetInterfaceFromGlobal +}; + +static CRITICAL_SECTION git_section; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &git_section, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { 0, (DWORD)(__FILE__ ": global interface table") } +}; +static CRITICAL_SECTION git_section = { &critsect_debug, -1, 0, 0, 0, 0 }; + + +/*** + * Let's go! Here is the constructor and destructor for the class. + * + */ + +/** This function constructs the GIT. It should only be called once **/ +void* StdGlobalInterfaceTable_Construct() { + StdGlobalInterfaceTableImpl* newGIT; + + newGIT = HeapAlloc(GetProcessHeap(), 0, sizeof(StdGlobalInterfaceTableImpl)); + if (newGIT == 0) return newGIT; + + newGIT->lpVtbl = &StdGlobalInterfaceTableImpl_Vtbl; + newGIT->ref = 1; /* Initialise the reference count */ + newGIT->firstEntry = NULL; /* we start with an empty table */ + newGIT->lastEntry = NULL; + newGIT->nextCookie = 0xf100; /* that's where windows starts, so that's where we start */ + TRACE("Created the GIT at %p\n", newGIT); + + return (void*)newGIT; +} + +/** This destroys it again. It should revoke all the held interfaces first **/ +void StdGlobalInterfaceTable_Destroy(void* self) { + TRACE("(%p)\n", self); + FIXME("Revoke held interfaces here\n"); + + HeapFree(GetProcessHeap(), 0, self); + StdGlobalInterfaceTableInstance = NULL; +} + +/*** + * A helper function to traverse the list and find the entry that matches the cookie. + * Returns NULL if not found + */ +StdGITEntry* StdGlobalInterfaceTable_FindEntry(IGlobalInterfaceTable* iface, DWORD cookie) { + StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface; + StdGITEntry* e; + + TRACE("iface=%p, cookie=0x%x\n", iface, (UINT)cookie); + + EnterCriticalSection(&git_section); + e = self->firstEntry; + while (e != NULL) { + if (e->cookie == cookie) { + LeaveCriticalSection(&git_section); + return e; + } + e = e->next; + } + LeaveCriticalSection(&git_section); + + TRACE("Entry not found\n"); + return NULL; +} + +/*** + * Here's the boring boilerplate stuff for IUnknown + */ + +HRESULT WINAPI StdGlobalInterfaceTable_QueryInterface(IGlobalInterfaceTable* iface, REFIID riid, void** ppvObject) { + StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface; + + /* Make sure silly coders can't crash us */ + if (ppvObject == 0) return E_INVALIDARG; + + *ppvObject = 0; /* assume we don't have the interface */ + + /* Do we implement that interface? */ + if (IsEqualIID(&IID_IUnknown, riid)) { + *ppvObject = (IGlobalInterfaceTable*) self; + } else if (IsEqualIID(&IID_IGlobalInterfaceTable, riid)) { + *ppvObject = (IGlobalInterfaceTable*) self; + } else return E_NOINTERFACE; + + /* Now inc the refcount */ + StdGlobalInterfaceTable_AddRef(iface); + return S_OK; +} + +ULONG WINAPI StdGlobalInterfaceTable_AddRef(IGlobalInterfaceTable* iface) { + StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface; + + /* InterlockedIncrement(&self->ref); */ + return self->ref; +} + +ULONG WINAPI StdGlobalInterfaceTable_Release(IGlobalInterfaceTable* iface) { + StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface; + + /* InterlockedDecrement(&self->ref); */ + if (self->ref == 0) { + /* Hey ho, it's time to go, so long again 'till next weeks show! */ + StdGlobalInterfaceTable_Destroy(self); + return 0; + } + + return self->ref; +} + +/*** + * Now implement the actual IGlobalInterfaceTable interface + */ + +HRESULT WINAPI StdGlobalInterfaceTable_RegisterInterfaceInGlobal(IGlobalInterfaceTable* iface, IUnknown* pUnk, REFIID riid, DWORD* pdwCookie) { + StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface; + IStream* stream = NULL; + HRESULT hres; + StdGITEntry* entry; + + TRACE("iface=%p, pUnk=%p, riid=%s, pdwCookie=0x%p\n", iface, pUnk, debugstr_guid(riid), pdwCookie); + + if (pUnk == NULL) return E_INVALIDARG; + + /* marshal the interface */ + TRACE("About to marshal the interface\n"); + hres = CoMarshalInterThreadInterfaceInStream(riid, pUnk, &stream); + if (hres) return hres; + entry = HeapAlloc(GetProcessHeap(), 0, sizeof(StdGITEntry)); + if (entry == NULL) return E_OUTOFMEMORY; + + EnterCriticalSection(&git_section); + + entry->iid = *riid; + entry->stream = stream; + entry->cookie = self->nextCookie; + self->nextCookie++; /* inc the cookie count */ + + /* insert the new entry at the end of the list */ + entry->next = NULL; + entry->prev = self->lastEntry; + if (entry->prev) entry->prev->next = entry; + else self->firstEntry = entry; + self->lastEntry = entry; + + /* and return the cookie */ + *pdwCookie = entry->cookie; + + LeaveCriticalSection(&git_section); + + TRACE("Cookie is 0x%lx\n", entry->cookie); + return S_OK; +} + +HRESULT WINAPI StdGlobalInterfaceTable_RevokeInterfaceFromGlobal(IGlobalInterfaceTable* iface, DWORD dwCookie) { + StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface; + StdGITEntry* entry; + + TRACE("iface=%p, dwCookie=0x%x\n", iface, (UINT)dwCookie); + + entry = StdGlobalInterfaceTable_FindEntry(iface, dwCookie); + if (entry == NULL) { + TRACE("Entry not found\n"); + return E_INVALIDARG; /* not found */ + } + + /* Free the stream */ + IStream_Release(entry->stream); + + /* chop entry out of the list, and free the memory */ + EnterCriticalSection(&git_section); + if (entry->prev) entry->prev->next = entry->next; + else self->firstEntry = entry->next; + if (entry->next) entry->next->prev = entry->prev; + else self->lastEntry = entry->prev; + LeaveCriticalSection(&git_section); + + HeapFree(GetProcessHeap(), 0, entry); + return S_OK; +} + +HRESULT WINAPI StdGlobalInterfaceTable_GetInterfaceFromGlobal(IGlobalInterfaceTable* iface, DWORD dwCookie, REFIID riid, void **ppv) { + StdGITEntry* entry; + HRESULT hres; + LARGE_INTEGER move; + LPUNKNOWN lpUnk; + + TRACE("dwCookie=0x%lx, riid=%s, ppv=%p\n", dwCookie, debugstr_guid(riid), ppv); + + entry = StdGlobalInterfaceTable_FindEntry(iface, dwCookie); + if (entry == NULL) return E_INVALIDARG; + + if (!IsEqualIID(&entry->iid, riid)) { + WARN("entry->iid (%s) != riid\n", debugstr_guid(&entry->iid)); + return E_INVALIDARG; + } + TRACE("entry=%p\n", entry); + + /* unmarshal the interface */ + hres = CoUnmarshalInterface(entry->stream, riid, ppv); + if (hres) { + WARN("Failed to unmarshal stream\n"); + return hres; + } + + /* rewind stream, in case it's used again */ + move.u.LowPart = 0; + move.u.HighPart = 0; + IStream_Seek(entry->stream, move, STREAM_SEEK_SET, NULL); + + /* addref it */ + lpUnk = *ppv; + IUnknown_AddRef(lpUnk); + TRACE("ppv=%p\n", *ppv); + return S_OK; +} + +/* Classfactory definition - despite what MSDN says, some programs need this */ + +static HRESULT WINAPI GITCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv) { + *ppv = NULL; + if (IsEqualIID(riid,&IID_IUnknown) || IsEqualIID(riid,&IID_IGlobalInterfaceTable)) { + *ppv = (LPVOID)iface; + return S_OK; + } + return E_NOINTERFACE; +} +static ULONG WINAPI GITCF_AddRef(LPCLASSFACTORY iface) { return 2; } +static ULONG WINAPI GITCF_Release(LPCLASSFACTORY iface) { return 1; } + +static HRESULT WINAPI GITCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv) { + if (IsEqualIID(riid,&IID_IGlobalInterfaceTable)) { + if (StdGlobalInterfaceTableInstance == NULL) + StdGlobalInterfaceTableInstance = StdGlobalInterfaceTable_Construct(); + return IGlobalInterfaceTable_QueryInterface( (IGlobalInterfaceTable*) StdGlobalInterfaceTableInstance, riid, ppv); + } + + FIXME("(%s), not supported.\n",debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static HRESULT WINAPI GITCF_LockServer(LPCLASSFACTORY iface, BOOL fLock) { + FIXME("(%d), stub!\n",fLock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) GITClassFactoryVtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + GITCF_QueryInterface, + GITCF_AddRef, + GITCF_Release, + GITCF_CreateInstance, + GITCF_LockServer +}; +static ICOM_VTABLE(IClassFactory) *PGITClassFactoryVtbl = &GITClassFactoryVtbl; + +HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv) { + *ppv = &PGITClassFactoryVtbl; + TRACE("Returning GIT classfactory\n"); + return S_OK; +} diff --git a/reactos/lib/ole32/hglobalstream.c b/reactos/lib/ole32/hglobalstream.c new file mode 100644 index 00000000000..6e97e321cf1 --- /dev/null +++ b/reactos/lib/ole32/hglobalstream.c @@ -0,0 +1,848 @@ +/* + * HGLOBAL Stream implementation + * + * This file contains the implementation of the stream interface + * for streams contained supported by an HGLOBAL pointer. + * + * Copyright 1999 Francis Beaudet + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "objbase.h" +#include "ole2.h" +#include "winerror.h" +#include "winreg.h" +#include "winternl.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(storage); + +/**************************************************************************** + * HGLOBALStreamImpl definition. + * + * This class imlements the IStream inteface and represents a stream + * supported by an HGLOBAL pointer. + */ +struct HGLOBALStreamImpl +{ + ICOM_VFIELD(IStream); /* Needs to be the first item in the stuct + * since we want to cast this in a IStream pointer */ + + /* + * Reference count + */ + ULONG ref; + + /* + * Support for the stream + */ + HGLOBAL supportHandle; + + /* + * This flag is TRUE if the HGLOBAL is destroyed when the stream + * is finally released. + */ + BOOL deleteOnRelease; + + /* + * Helper variable that contains the size of the stream + */ + ULARGE_INTEGER streamSize; + + /* + * This is the current position of the cursor in the stream + */ + ULARGE_INTEGER currentPosition; +}; + +typedef struct HGLOBALStreamImpl HGLOBALStreamImpl; + +/* + * Method definition for the StgStreamImpl class. + */ +HGLOBALStreamImpl* HGLOBALStreamImpl_Construct( + HGLOBAL hGlobal, + BOOL fDeleteOnRelease); + +void HGLOBALStreamImpl_Destroy( + HGLOBALStreamImpl* This); + +void HGLOBALStreamImpl_OpenBlockChain( + HGLOBALStreamImpl* This); + +HRESULT WINAPI HGLOBALStreamImpl_QueryInterface( + IStream* iface, + REFIID riid, /* [in] */ + void** ppvObject); /* [iid_is][out] */ + +ULONG WINAPI HGLOBALStreamImpl_AddRef( + IStream* iface); + +ULONG WINAPI HGLOBALStreamImpl_Release( + IStream* iface); + +HRESULT WINAPI HGLOBALStreamImpl_Read( + IStream* iface, + void* pv, /* [length_is][size_is][out] */ + ULONG cb, /* [in] */ + ULONG* pcbRead); /* [out] */ + +HRESULT WINAPI HGLOBALStreamImpl_Write( + IStream* iface, + const void* pv, /* [size_is][in] */ + ULONG cb, /* [in] */ + ULONG* pcbWritten); /* [out] */ + +HRESULT WINAPI HGLOBALStreamImpl_Seek( + IStream* iface, + LARGE_INTEGER dlibMove, /* [in] */ + DWORD dwOrigin, /* [in] */ + ULARGE_INTEGER* plibNewPosition); /* [out] */ + +HRESULT WINAPI HGLOBALStreamImpl_SetSize( + IStream* iface, + ULARGE_INTEGER libNewSize); /* [in] */ + +HRESULT WINAPI HGLOBALStreamImpl_CopyTo( + IStream* iface, + IStream* pstm, /* [unique][in] */ + ULARGE_INTEGER cb, /* [in] */ + ULARGE_INTEGER* pcbRead, /* [out] */ + ULARGE_INTEGER* pcbWritten); /* [out] */ + +HRESULT WINAPI HGLOBALStreamImpl_Commit( + IStream* iface, + DWORD grfCommitFlags); /* [in] */ + +HRESULT WINAPI HGLOBALStreamImpl_Revert( + IStream* iface); + +HRESULT WINAPI HGLOBALStreamImpl_LockRegion( + IStream* iface, + ULARGE_INTEGER libOffset, /* [in] */ + ULARGE_INTEGER cb, /* [in] */ + DWORD dwLockType); /* [in] */ + +HRESULT WINAPI HGLOBALStreamImpl_UnlockRegion( + IStream* iface, + ULARGE_INTEGER libOffset, /* [in] */ + ULARGE_INTEGER cb, /* [in] */ + DWORD dwLockType); /* [in] */ + +HRESULT WINAPI HGLOBALStreamImpl_Stat( + IStream* iface, + STATSTG* pstatstg, /* [out] */ + DWORD grfStatFlag); /* [in] */ + +HRESULT WINAPI HGLOBALStreamImpl_Clone( + IStream* iface, + IStream** ppstm); /* [out] */ + + +/* + * Virtual function table for the HGLOBALStreamImpl class. + */ +static ICOM_VTABLE(IStream) HGLOBALStreamImpl_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + HGLOBALStreamImpl_QueryInterface, + HGLOBALStreamImpl_AddRef, + HGLOBALStreamImpl_Release, + HGLOBALStreamImpl_Read, + HGLOBALStreamImpl_Write, + HGLOBALStreamImpl_Seek, + HGLOBALStreamImpl_SetSize, + HGLOBALStreamImpl_CopyTo, + HGLOBALStreamImpl_Commit, + HGLOBALStreamImpl_Revert, + HGLOBALStreamImpl_LockRegion, + HGLOBALStreamImpl_UnlockRegion, + HGLOBALStreamImpl_Stat, + HGLOBALStreamImpl_Clone +}; + +/*********************************************************************** + * CreateStreamOnHGlobal [OLE32.@] + */ +HRESULT WINAPI CreateStreamOnHGlobal( + HGLOBAL hGlobal, + BOOL fDeleteOnRelease, + LPSTREAM* ppstm) +{ + HGLOBALStreamImpl* newStream; + + newStream = HGLOBALStreamImpl_Construct(hGlobal, + fDeleteOnRelease); + + if (newStream!=NULL) + { + return IUnknown_QueryInterface((IUnknown*)newStream, + &IID_IStream, + (void**)ppstm); + } + + return E_OUTOFMEMORY; +} + +/*********************************************************************** + * GetHGlobalFromStream [OLE32.@] + */ +HRESULT WINAPI GetHGlobalFromStream(IStream* pstm, HGLOBAL* phglobal) +{ + HGLOBALStreamImpl* pStream; + + if (pstm == NULL) + return E_INVALIDARG; + + pStream = (HGLOBALStreamImpl*) pstm; + + /* + * Verify that the stream object was created with CreateStreamOnHGlobal. + */ + if (pStream->lpVtbl == &HGLOBALStreamImpl_Vtbl) + *phglobal = pStream->supportHandle; + else + { + *phglobal = 0; + return E_INVALIDARG; + } + + return S_OK; +} + +/****************************************************************************** +** HGLOBALStreamImpl implementation +*/ + +/*** + * This is the constructor for the HGLOBALStreamImpl class. + * + * Params: + * hGlobal - Handle that will support the stream. can be NULL. + * fDeleteOnRelease - Flag set to TRUE if the HGLOBAL will be released + * when the IStream object is destroyed. + */ +HGLOBALStreamImpl* HGLOBALStreamImpl_Construct( + HGLOBAL hGlobal, + BOOL fDeleteOnRelease) +{ + HGLOBALStreamImpl* newStream; + + newStream = HeapAlloc(GetProcessHeap(), 0, sizeof(HGLOBALStreamImpl)); + + if (newStream!=0) + { + /* + * Set-up the virtual function table and reference count. + */ + newStream->lpVtbl = &HGLOBALStreamImpl_Vtbl; + newStream->ref = 0; + + /* + * Initialize the support. + */ + newStream->supportHandle = hGlobal; + newStream->deleteOnRelease = fDeleteOnRelease; + + /* + * This method will allocate a handle if one is not supplied. + */ + if (!newStream->supportHandle) + { + newStream->supportHandle = GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD | + GMEM_SHARE, 0); + } + + /* + * Start the stream at the beginning. + */ + newStream->currentPosition.u.HighPart = 0; + newStream->currentPosition.u.LowPart = 0; + + /* + * Initialize the size of the stream to the size of the handle. + */ + newStream->streamSize.u.HighPart = 0; + newStream->streamSize.u.LowPart = GlobalSize(newStream->supportHandle); + } + + return newStream; +} + +/*** + * This is the destructor of the HGLOBALStreamImpl class. + * + * This method will clean-up all the resources used-up by the given HGLOBALStreamImpl + * class. The pointer passed-in to this function will be freed and will not + * be valid anymore. + */ +void HGLOBALStreamImpl_Destroy(HGLOBALStreamImpl* This) +{ + TRACE("(%p)\n", This); + + /* + * Release the HGlobal if the constructor asked for that. + */ + if (This->deleteOnRelease) + { + GlobalFree(This->supportHandle); + This->supportHandle=0; + } + + /* + * Finally, free the memory used-up by the class. + */ + HeapFree(GetProcessHeap(), 0, This); +} + +/*** + * This implements the IUnknown method QueryInterface for this + * class + */ +HRESULT WINAPI HGLOBALStreamImpl_QueryInterface( + IStream* iface, + REFIID riid, /* [in] */ + void** ppvObject) /* [iid_is][out] */ +{ + HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; + + /* + * Perform a sanity check on the parameters. + */ + if (ppvObject==0) + return E_INVALIDARG; + + /* + * Initialize the return parameter. + */ + *ppvObject = 0; + + /* + * Compare the riid with the interface IDs implemented by this object. + */ + if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) + { + *ppvObject = (IStream*)This; + } + else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0) + { + *ppvObject = (IStream*)This; + } + + /* + * Check that we obtained an interface. + */ + if ((*ppvObject)==0) + return E_NOINTERFACE; + + /* + * Query Interface always increases the reference count by one when it is + * successful + */ + HGLOBALStreamImpl_AddRef(iface); + + return S_OK; +} + +/*** + * This implements the IUnknown method AddRef for this + * class + */ +ULONG WINAPI HGLOBALStreamImpl_AddRef( + IStream* iface) +{ + HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; + + This->ref++; + + return This->ref; +} + +/*** + * This implements the IUnknown method Release for this + * class + */ +ULONG WINAPI HGLOBALStreamImpl_Release( + IStream* iface) +{ + HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; + + ULONG newRef; + + This->ref--; + + newRef = This->ref; + + /* + * If the reference count goes down to 0, perform suicide. + */ + if (newRef==0) + { + HGLOBALStreamImpl_Destroy(This); + } + + return newRef; +} + +/*** + * This method is part of the ISequentialStream interface. + * + * If reads a block of information from the stream at the current + * position. It then moves the current position at the end of the + * read block + * + * See the documentation of ISequentialStream for more info. + */ +HRESULT WINAPI HGLOBALStreamImpl_Read( + IStream* iface, + void* pv, /* [length_is][size_is][out] */ + ULONG cb, /* [in] */ + ULONG* pcbRead) /* [out] */ +{ + HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; + + void* supportBuffer; + ULONG bytesReadBuffer; + ULONG bytesToReadFromBuffer; + + TRACE("(%p, %p, %ld, %p)\n", iface, + pv, cb, pcbRead); + + /* + * If the caller is not interested in the nubmer of bytes read, + * we use another buffer to avoid "if" statements in the code. + */ + if (pcbRead==0) + pcbRead = &bytesReadBuffer; + + /* + * Using the known size of the stream, calculate the number of bytes + * to read from the block chain + */ + bytesToReadFromBuffer = min( This->streamSize.u.LowPart - This->currentPosition.u.LowPart, cb); + + /* + * Lock the buffer in position and copy the data. + */ + supportBuffer = GlobalLock(This->supportHandle); + + memcpy(pv, (char *) supportBuffer+This->currentPosition.u.LowPart, bytesToReadFromBuffer); + + /* + * Move the current position to the new position + */ + This->currentPosition.u.LowPart+=bytesToReadFromBuffer; + + /* + * Return the number of bytes read. + */ + *pcbRead = bytesToReadFromBuffer; + + /* + * Cleanup + */ + GlobalUnlock(This->supportHandle); + + /* + * The function returns S_OK if the buffer was filled completely + * it returns S_FALSE if the end of the stream is reached before the + * buffer is filled + */ + if(*pcbRead == cb) + return S_OK; + + return S_FALSE; +} + +/*** + * This method is part of the ISequentialStream interface. + * + * It writes a block of information to the stream at the current + * position. It then moves the current position at the end of the + * written block. If the stream is too small to fit the block, + * the stream is grown to fit. + * + * See the documentation of ISequentialStream for more info. + */ +HRESULT WINAPI HGLOBALStreamImpl_Write( + IStream* iface, + const void* pv, /* [size_is][in] */ + ULONG cb, /* [in] */ + ULONG* pcbWritten) /* [out] */ +{ + HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; + + void* supportBuffer; + ULARGE_INTEGER newSize; + ULONG bytesWritten = 0; + + TRACE("(%p, %p, %ld, %p)\n", iface, + pv, cb, pcbWritten); + + /* + * If the caller is not interested in the number of bytes written, + * we use another buffer to avoid "if" statements in the code. + */ + if (pcbWritten == 0) + pcbWritten = &bytesWritten; + + if (cb == 0) + { + return S_OK; + } + else + { + newSize.u.HighPart = 0; + newSize.u.LowPart = This->currentPosition.u.LowPart + cb; + } + + /* + * Verify if we need to grow the stream + */ + if (newSize.u.LowPart > This->streamSize.u.LowPart) + { + /* grow stream */ + IStream_SetSize(iface, newSize); + } + + /* + * Lock the buffer in position and copy the data. + */ + supportBuffer = GlobalLock(This->supportHandle); + + memcpy((char *) supportBuffer+This->currentPosition.u.LowPart, pv, cb); + + /* + * Move the current position to the new position + */ + This->currentPosition.u.LowPart+=cb; + + /* + * Return the number of bytes read. + */ + *pcbWritten = cb; + + /* + * Cleanup + */ + GlobalUnlock(This->supportHandle); + + return S_OK; +} + +/*** + * This method is part of the IStream interface. + * + * It will move the current stream pointer according to the parameters + * given. + * + * See the documentation of IStream for more info. + */ +HRESULT WINAPI HGLOBALStreamImpl_Seek( + IStream* iface, + LARGE_INTEGER dlibMove, /* [in] */ + DWORD dwOrigin, /* [in] */ + ULARGE_INTEGER* plibNewPosition) /* [out] */ +{ + HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; + + ULARGE_INTEGER newPosition; + + TRACE("(%p, %ld, %ld, %p)\n", iface, + dlibMove.u.LowPart, dwOrigin, plibNewPosition); + + /* + * The file pointer is moved depending on the given "function" + * parameter. + */ + switch (dwOrigin) + { + case STREAM_SEEK_SET: + newPosition.u.HighPart = 0; + newPosition.u.LowPart = 0; + break; + case STREAM_SEEK_CUR: + newPosition = This->currentPosition; + break; + case STREAM_SEEK_END: + newPosition = This->streamSize; + break; + default: + return STG_E_INVALIDFUNCTION; + } + + /* + * Move the actual file pointer + * If the file pointer ends-up after the end of the stream, the next Write operation will + * make the file larger. This is how it is documented. + */ + newPosition.QuadPart = RtlLargeIntegerAdd(newPosition.QuadPart, dlibMove.QuadPart); + if (newPosition.QuadPart < 0) return STG_E_INVALIDFUNCTION; + + if (plibNewPosition) *plibNewPosition = newPosition; + This->currentPosition = newPosition; + + return S_OK; +} + +/*** + * This method is part of the IStream interface. + * + * It will change the size of a stream. + * + * TODO: Switch from small blocks to big blocks and vice versa. + * + * See the documentation of IStream for more info. + */ +HRESULT WINAPI HGLOBALStreamImpl_SetSize( + IStream* iface, + ULARGE_INTEGER libNewSize) /* [in] */ +{ + HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; + HGLOBAL supportHandle; + + TRACE("(%p, %ld)\n", iface, libNewSize.u.LowPart); + + /* + * As documented. + */ + if (libNewSize.u.HighPart != 0) + return STG_E_INVALIDFUNCTION; + + if (This->streamSize.u.LowPart == libNewSize.u.LowPart) + return S_OK; + + /* + * Re allocate the HGlobal to fit the new size of the stream. + */ + supportHandle = GlobalReAlloc(This->supportHandle, libNewSize.u.LowPart, 0); + + if (supportHandle == 0) + return STG_E_MEDIUMFULL; + + This->supportHandle = supportHandle; + This->streamSize.u.LowPart = libNewSize.u.LowPart; + + return S_OK; +} + +/*** + * This method is part of the IStream interface. + * + * It will copy the 'cb' Bytes to 'pstm' IStream. + * + * See the documentation of IStream for more info. + */ +HRESULT WINAPI HGLOBALStreamImpl_CopyTo( + IStream* iface, + IStream* pstm, /* [unique][in] */ + ULARGE_INTEGER cb, /* [in] */ + ULARGE_INTEGER* pcbRead, /* [out] */ + ULARGE_INTEGER* pcbWritten) /* [out] */ +{ + HRESULT hr = S_OK; + BYTE tmpBuffer[128]; + ULONG bytesRead, bytesWritten, copySize; + ULARGE_INTEGER totalBytesRead; + ULARGE_INTEGER totalBytesWritten; + + TRACE("(%p, %p, %ld, %p, %p)\n", iface, pstm, + cb.u.LowPart, pcbRead, pcbWritten); + + /* + * Sanity check + */ + if ( pstm == 0 ) + return STG_E_INVALIDPOINTER; + + totalBytesRead.u.LowPart = totalBytesRead.u.HighPart = 0; + totalBytesWritten.u.LowPart = totalBytesWritten.u.HighPart = 0; + + /* + * use stack to store data temporarly + * there is surely more performant way of doing it, for now this basic + * implementation will do the job + */ + while ( cb.u.LowPart > 0 ) + { + if ( cb.u.LowPart >= 128 ) + copySize = 128; + else + copySize = cb.u.LowPart; + + IStream_Read(iface, tmpBuffer, copySize, &bytesRead); + + totalBytesRead.u.LowPart += bytesRead; + + IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten); + + totalBytesWritten.u.LowPart += bytesWritten; + + /* + * Check that read & write operations were succesfull + */ + if (bytesRead != bytesWritten) + { + hr = STG_E_MEDIUMFULL; + break; + } + + if (bytesRead!=copySize) + cb.u.LowPart = 0; + else + cb.u.LowPart -= bytesRead; + } + + /* + * Update number of bytes read and written + */ + if (pcbRead) + { + pcbRead->u.LowPart = totalBytesRead.u.LowPart; + pcbRead->u.HighPart = totalBytesRead.u.HighPart; + } + + if (pcbWritten) + { + pcbWritten->u.LowPart = totalBytesWritten.u.LowPart; + pcbWritten->u.HighPart = totalBytesWritten.u.HighPart; + } + return hr; +} + +/*** + * This method is part of the IStream interface. + * + * For streams supported by HGLOBALS, this function does nothing. + * This is what the documentation tells us. + * + * See the documentation of IStream for more info. + */ +HRESULT WINAPI HGLOBALStreamImpl_Commit( + IStream* iface, + DWORD grfCommitFlags) /* [in] */ +{ + return S_OK; +} + +/*** + * This method is part of the IStream interface. + * + * For streams supported by HGLOBALS, this function does nothing. + * This is what the documentation tells us. + * + * See the documentation of IStream for more info. + */ +HRESULT WINAPI HGLOBALStreamImpl_Revert( + IStream* iface) +{ + return S_OK; +} + +/*** + * This method is part of the IStream interface. + * + * For streams supported by HGLOBALS, this function does nothing. + * This is what the documentation tells us. + * + * See the documentation of IStream for more info. + */ +HRESULT WINAPI HGLOBALStreamImpl_LockRegion( + IStream* iface, + ULARGE_INTEGER libOffset, /* [in] */ + ULARGE_INTEGER cb, /* [in] */ + DWORD dwLockType) /* [in] */ +{ + return S_OK; +} + +/* + * This method is part of the IStream interface. + * + * For streams supported by HGLOBALS, this function does nothing. + * This is what the documentation tells us. + * + * See the documentation of IStream for more info. + */ +HRESULT WINAPI HGLOBALStreamImpl_UnlockRegion( + IStream* iface, + ULARGE_INTEGER libOffset, /* [in] */ + ULARGE_INTEGER cb, /* [in] */ + DWORD dwLockType) /* [in] */ +{ + return S_OK; +} + +/*** + * This method is part of the IStream interface. + * + * This method returns information about the current + * stream. + * + * See the documentation of IStream for more info. + */ +HRESULT WINAPI HGLOBALStreamImpl_Stat( + IStream* iface, + STATSTG* pstatstg, /* [out] */ + DWORD grfStatFlag) /* [in] */ +{ + HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; + + memset(pstatstg, 0, sizeof(STATSTG)); + + pstatstg->pwcsName = NULL; + pstatstg->type = STGTY_STREAM; + pstatstg->cbSize = This->streamSize; + + return S_OK; +} + +HRESULT WINAPI HGLOBALStreamImpl_Clone( + IStream* iface, + IStream** ppstm) /* [out] */ +{ + ULARGE_INTEGER dummy; + LARGE_INTEGER offset; + HRESULT hr; + HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; + TRACE(" Cloning %p (deleteOnRelease=%d seek position=%ld)\n",iface,This->deleteOnRelease,(long)This->currentPosition.QuadPart); + hr=CreateStreamOnHGlobal(This->supportHandle, FALSE, ppstm); + if(FAILED(hr)) + return hr; + offset.QuadPart=(LONGLONG)This->currentPosition.QuadPart; + HGLOBALStreamImpl_Seek(*ppstm,offset,STREAM_SEEK_SET,&dummy); + return S_OK; +} diff --git a/reactos/lib/ole32/ifs.c b/reactos/lib/ole32/ifs.c new file mode 100644 index 00000000000..11490ab0447 --- /dev/null +++ b/reactos/lib/ole32/ifs.c @@ -0,0 +1,642 @@ +/* + * basic interfaces + * + * Copyright 1997 Marcus Meissner + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#ifdef __REACTOS__ +#include +#endif +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "ole2.h" +#include "winerror.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +/****************************************************************************** + * IMalloc32 implementation + * + * NOTES + * For supporting CoRegisterMallocSpy the IMalloc implementation must know if + * a given memory block was allocated with a spy active. + * + *****************************************************************************/ +/* set the vtable later */ +extern ICOM_VTABLE(IMalloc) VT_IMalloc32; + +typedef struct { + ICOM_VFIELD(IMalloc); + DWORD dummy; /* nothing, we are static */ + IMallocSpy * pSpy; /* the spy when active */ + DWORD SpyedAllocationsLeft; /* number of spyed allocations left */ + BOOL SpyReleasePending; /* CoRevokeMallocSpy called with spyed allocations left*/ + LPVOID * SpyedBlocks; /* root of the table */ + int SpyedBlockTableLength; /* size of the table*/ +} _Malloc32; + +/* this is the static object instance */ +_Malloc32 Malloc32 = {&VT_IMalloc32, 0, NULL, 0, 0, NULL, 0}; + +/* with a spy active all calls from pre to post methods are threadsave */ +static CRITICAL_SECTION IMalloc32_SpyCS; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &IMalloc32_SpyCS, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { 0, (DWORD)(__FILE__ ": IMalloc32_SpyCS") } +}; +static CRITICAL_SECTION IMalloc32_SpyCS = { &critsect_debug, -1, 0, 0, 0, 0 }; + +/* resize the old table */ +static int SetSpyedBlockTableLength ( int NewLength ) +{ + if (!Malloc32.SpyedBlocks) Malloc32.SpyedBlocks = (LPVOID*)LocalAlloc(NewLength, GMEM_ZEROINIT); + else Malloc32.SpyedBlocks = (LPVOID*)LocalReAlloc((HLOCAL)Malloc32.SpyedBlocks, NewLength, GMEM_ZEROINIT); + Malloc32.SpyedBlockTableLength = NewLength; + return Malloc32.SpyedBlocks ? 1 : 0; +} + +/* add a location to the table */ +static int AddMemoryLocation(LPVOID * pMem) +{ + LPVOID * Current; + + /* allocate the table if not already allocated */ + if (!Malloc32.SpyedBlockTableLength) { + if (!SetSpyedBlockTableLength(0x1000)) return 0; + } + + /* find a free location */ + Current = Malloc32.SpyedBlocks; + while (*Current) { + Current++; + if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength) { + /* no more space in table, grow it */ + if (!SetSpyedBlockTableLength( Malloc32.SpyedBlockTableLength + 0x1000 )) return 0; + } + }; + + /* put the location in our table */ + *Current = pMem; + Malloc32.SpyedAllocationsLeft++; + /*TRACE("%lu\n",Malloc32.SpyedAllocationsLeft);*/ + return 1; +} + +static int RemoveMemoryLocation(LPVOID * pMem) +{ + LPVOID * Current; + + /* allocate the table if not already allocated */ + if (!Malloc32.SpyedBlockTableLength) { + if (!SetSpyedBlockTableLength(0x1000)) return 0; + } + + Current = Malloc32.SpyedBlocks; + + /* find the location */ + while (*Current != pMem) { + Current++; + if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength) return 0; /* not found */ + } + + /* location found */ + Malloc32.SpyedAllocationsLeft--; + /*TRACE("%lu\n",Malloc32.SpyedAllocationsLeft);*/ + *Current = NULL; + return 1; +} + +/****************************************************************************** + * IMalloc32_QueryInterface [VTABLE] + */ +static HRESULT WINAPI IMalloc_fnQueryInterface(LPMALLOC iface,REFIID refiid,LPVOID *obj) { + + TRACE("(%s,%p)\n",debugstr_guid(refiid),obj); + + if (IsEqualIID(&IID_IUnknown,refiid) || IsEqualIID(&IID_IMalloc,refiid)) { + *obj = (LPMALLOC)&Malloc32; + return S_OK; + } + return E_NOINTERFACE; +} + +/****************************************************************************** + * IMalloc32_AddRefRelease [VTABLE] + */ +static ULONG WINAPI IMalloc_fnAddRefRelease (LPMALLOC iface) { + return 1; +} + +/****************************************************************************** + * IMalloc32_Alloc [VTABLE] + */ +static LPVOID WINAPI IMalloc_fnAlloc(LPMALLOC iface, DWORD cb) { + + LPVOID addr; + + TRACE("(%ld)\n",cb); + + if(Malloc32.pSpy) { + DWORD preAllocResult; + + EnterCriticalSection(&IMalloc32_SpyCS); + preAllocResult = IMallocSpy_PreAlloc(Malloc32.pSpy, cb); + if ((cb != 0) && (preAllocResult == 0)) { + /* PreAlloc can force Alloc to fail, but not if cb == 0 */ + TRACE("returning null\n"); + LeaveCriticalSection(&IMalloc32_SpyCS); + return NULL; + } + } + + addr = HeapAlloc(GetProcessHeap(),0,cb); + + if(Malloc32.pSpy) { + addr = IMallocSpy_PostAlloc(Malloc32.pSpy, addr); + if (addr) AddMemoryLocation(addr); + LeaveCriticalSection(&IMalloc32_SpyCS); + } + + TRACE("--(%p)\n",addr); + return addr; +} + +/****************************************************************************** + * IMalloc32_Realloc [VTABLE] + */ +static LPVOID WINAPI IMalloc_fnRealloc(LPMALLOC iface,LPVOID pv,DWORD cb) { + + LPVOID pNewMemory; + + TRACE("(%p,%ld)\n",pv,cb); + + if(Malloc32.pSpy) { + LPVOID pRealMemory; + BOOL fSpyed; + + EnterCriticalSection(&IMalloc32_SpyCS); + fSpyed = RemoveMemoryLocation(pv); + cb = IMallocSpy_PreRealloc(Malloc32.pSpy, pv, cb, &pRealMemory, fSpyed); + + /* check if can release the spy */ + if(Malloc32.SpyReleasePending && !Malloc32.SpyedAllocationsLeft) { + IMallocSpy_Release(Malloc32.pSpy); + Malloc32.SpyReleasePending = FALSE; + Malloc32.pSpy = NULL; + } + + if (0==cb) { + /* PreRealloc can force Realloc to fail */ + LeaveCriticalSection(&IMalloc32_SpyCS); + return NULL; + } + pv = pRealMemory; + } + + if (!pv) pNewMemory = HeapAlloc(GetProcessHeap(),0,cb); + else if (cb) pNewMemory = HeapReAlloc(GetProcessHeap(),0,pv,cb); + else { + HeapFree(GetProcessHeap(),0,pv); + pNewMemory = NULL; + } + + if(Malloc32.pSpy) { + pNewMemory = IMallocSpy_PostRealloc(Malloc32.pSpy, pNewMemory, TRUE); + if (pNewMemory) AddMemoryLocation(pNewMemory); + LeaveCriticalSection(&IMalloc32_SpyCS); + } + + TRACE("--(%p)\n",pNewMemory); + return pNewMemory; +} + +/****************************************************************************** + * IMalloc32_Free [VTABLE] + */ +static VOID WINAPI IMalloc_fnFree(LPMALLOC iface,LPVOID pv) { + + BOOL fSpyed = 0; + + TRACE("(%p)\n",pv); + + if(Malloc32.pSpy) { + EnterCriticalSection(&IMalloc32_SpyCS); + fSpyed = RemoveMemoryLocation(pv); + pv = IMallocSpy_PreFree(Malloc32.pSpy, pv, fSpyed); + } + + HeapFree(GetProcessHeap(),0,pv); + + if(Malloc32.pSpy) { + IMallocSpy_PostFree(Malloc32.pSpy, fSpyed); + + /* check if can release the spy */ + if(Malloc32.SpyReleasePending && !Malloc32.SpyedAllocationsLeft) { + IMallocSpy_Release(Malloc32.pSpy); + Malloc32.SpyReleasePending = FALSE; + Malloc32.pSpy = NULL; + } + + LeaveCriticalSection(&IMalloc32_SpyCS); + } +} + +/****************************************************************************** + * IMalloc32_GetSize [VTABLE] + * + * NOTES + * FIXME returns: + * win95: size allocated (4 byte boundarys) + * win2k: size originally requested !!! (allocated on 8 byte boundarys) + */ +static DWORD WINAPI IMalloc_fnGetSize(LPMALLOC iface,LPVOID pv) { + + DWORD cb; + BOOL fSpyed = 0; + + TRACE("(%p)\n",pv); + + if(Malloc32.pSpy) { + EnterCriticalSection(&IMalloc32_SpyCS); + pv = IMallocSpy_PreGetSize(Malloc32.pSpy, pv, fSpyed); + } + + cb = HeapSize(GetProcessHeap(),0,pv); + + if(Malloc32.pSpy) { + cb = IMallocSpy_PostGetSize(Malloc32.pSpy, cb, fSpyed); + LeaveCriticalSection(&IMalloc32_SpyCS); + } + + return cb; +} + +/****************************************************************************** + * IMalloc32_DidAlloc [VTABLE] + */ +static INT WINAPI IMalloc_fnDidAlloc(LPMALLOC iface,LPVOID pv) { + + BOOL fSpyed = 0; + int didAlloc; + + TRACE("(%p)\n",pv); + + if(Malloc32.pSpy) { + EnterCriticalSection(&IMalloc32_SpyCS); + pv = IMallocSpy_PreDidAlloc(Malloc32.pSpy, pv, fSpyed); + } + + didAlloc = -1; + + if(Malloc32.pSpy) { + didAlloc = IMallocSpy_PostDidAlloc(Malloc32.pSpy, pv, fSpyed, didAlloc); + LeaveCriticalSection(&IMalloc32_SpyCS); + } + return didAlloc; +} + +/****************************************************************************** + * IMalloc32_HeapMinimize [VTABLE] + */ +static VOID WINAPI IMalloc_fnHeapMinimize(LPMALLOC iface) { + TRACE("()\n"); + + if(Malloc32.pSpy) { + EnterCriticalSection(&IMalloc32_SpyCS); + IMallocSpy_PreHeapMinimize(Malloc32.pSpy); + } + + if(Malloc32.pSpy) { + IMallocSpy_PostHeapMinimize(Malloc32.pSpy); + LeaveCriticalSection(&IMalloc32_SpyCS); + } +} + +static ICOM_VTABLE(IMalloc) VT_IMalloc32 = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IMalloc_fnQueryInterface, + IMalloc_fnAddRefRelease, + IMalloc_fnAddRefRelease, + IMalloc_fnAlloc, + IMalloc_fnRealloc, + IMalloc_fnFree, + IMalloc_fnGetSize, + IMalloc_fnDidAlloc, + IMalloc_fnHeapMinimize +}; + +/****************************************************************************** + * IMallocSpy implementation + *****************************************************************************/ + +/* set the vtable later */ +extern ICOM_VTABLE(IMallocSpy) VT_IMallocSpy; + +typedef struct { + ICOM_VFIELD(IMallocSpy); + DWORD ref; +} _MallocSpy; + +/* this is the static object instance */ +_MallocSpy MallocSpy = {&VT_IMallocSpy, 0}; + +/****************************************************************************** + * IMalloc32_QueryInterface [VTABLE] + */ +static HRESULT WINAPI IMallocSpy_fnQueryInterface(LPMALLOCSPY iface,REFIID refiid,LPVOID *obj) +{ + + TRACE("(%s,%p)\n",debugstr_guid(refiid),obj); + + if (IsEqualIID(&IID_IUnknown,refiid) || IsEqualIID(&IID_IMallocSpy,refiid)) { + *obj = (LPMALLOC)&MallocSpy; + return S_OK; + } + return E_NOINTERFACE; +} + +/****************************************************************************** + * IMalloc32_AddRef [VTABLE] + */ +static ULONG WINAPI IMallocSpy_fnAddRef (LPMALLOCSPY iface) +{ + + ICOM_THIS (_MallocSpy, iface); + + TRACE ("(%p)->(count=%lu)\n", This, This->ref); + + return ++(This->ref); +} + +/****************************************************************************** + * IMalloc32_AddRelease [VTABLE] + * + * NOTES + * Our MallocSpy is static. If the count reaches 0 we dump the leaks + */ +static ULONG WINAPI IMallocSpy_fnRelease (LPMALLOCSPY iface) +{ + + ICOM_THIS (_MallocSpy, iface); + + TRACE ("(%p)->(count=%lu)\n", This, This->ref); + + if (!--(This->ref)) { + /* our allocation list MUST be empty here */ + } + return This->ref; +} + +static ULONG WINAPI IMallocSpy_fnPreAlloc(LPMALLOCSPY iface, ULONG cbRequest) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->(%lu)\n", This, cbRequest); + return cbRequest; +} +static PVOID WINAPI IMallocSpy_fnPostAlloc(LPMALLOCSPY iface, void* pActual) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->(%p)\n", This, pActual); + return pActual; +} + +static PVOID WINAPI IMallocSpy_fnPreFree(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->(%p %u)\n", This, pRequest, fSpyed); + return pRequest; +} +static void WINAPI IMallocSpy_fnPostFree(LPMALLOCSPY iface, BOOL fSpyed) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->(%u)\n", This, fSpyed); +} + +static ULONG WINAPI IMallocSpy_fnPreRealloc(LPMALLOCSPY iface, void* pRequest, ULONG cbRequest, void** ppNewRequest, BOOL fSpyed) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->(%p %lu %u)\n", This, pRequest, cbRequest, fSpyed); + *ppNewRequest = pRequest; + return cbRequest; +} + +static PVOID WINAPI IMallocSpy_fnPostRealloc(LPMALLOCSPY iface, void* pActual, BOOL fSpyed) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->(%p %u)\n", This, pActual, fSpyed); + return pActual; +} + +static PVOID WINAPI IMallocSpy_fnPreGetSize(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->(%p %u)\n", This, pRequest, fSpyed); + return pRequest; +} + +static ULONG WINAPI IMallocSpy_fnPostGetSize(LPMALLOCSPY iface, ULONG cbActual, BOOL fSpyed) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->(%lu %u)\n", This, cbActual, fSpyed); + return cbActual; +} + +static PVOID WINAPI IMallocSpy_fnPreDidAlloc(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->(%p %u)\n", This, pRequest, fSpyed); + return pRequest; +} + +static int WINAPI IMallocSpy_fnPostDidAlloc(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed, int fActual) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->(%p %u %u)\n", This, pRequest, fSpyed, fActual); + return fActual; +} + +static void WINAPI IMallocSpy_fnPreHeapMinimize(LPMALLOCSPY iface) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->()\n", This); +} + +static void WINAPI IMallocSpy_fnPostHeapMinimize(LPMALLOCSPY iface) +{ + ICOM_THIS (_MallocSpy, iface); + TRACE ("(%p)->()\n", This); +} + +static void MallocSpyDumpLeaks() { + TRACE("leaks: %lu\n", Malloc32.SpyedAllocationsLeft); +} + +static ICOM_VTABLE(IMallocSpy) VT_IMallocSpy = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IMallocSpy_fnQueryInterface, + IMallocSpy_fnAddRef, + IMallocSpy_fnRelease, + IMallocSpy_fnPreAlloc, + IMallocSpy_fnPostAlloc, + IMallocSpy_fnPreFree, + IMallocSpy_fnPostFree, + IMallocSpy_fnPreRealloc, + IMallocSpy_fnPostRealloc, + IMallocSpy_fnPreGetSize, + IMallocSpy_fnPostGetSize, + IMallocSpy_fnPreDidAlloc, + IMallocSpy_fnPostDidAlloc, + IMallocSpy_fnPreHeapMinimize, + IMallocSpy_fnPostHeapMinimize +}; + +/****************************************************************************** + * CoGetMalloc [OLE32.@] + * + * RETURNS + * The win32 IMalloc + */ +HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC *lpMalloc) +{ + *lpMalloc = (LPMALLOC)&Malloc32; + return S_OK; +} + +/*********************************************************************** + * CoTaskMemAlloc [OLE32.@] + * RETURNS + * pointer to newly allocated block + */ +LPVOID WINAPI CoTaskMemAlloc(ULONG size) +{ + return IMalloc_Alloc((LPMALLOC)&Malloc32,size); +} +/*********************************************************************** + * CoTaskMemFree [OLE32.@] + */ +VOID WINAPI CoTaskMemFree(LPVOID ptr) +{ + IMalloc_Free((LPMALLOC)&Malloc32, ptr); +} + +/*********************************************************************** + * CoTaskMemRealloc [OLE32.@] + * RETURNS + * pointer to newly allocated block + */ +LPVOID WINAPI CoTaskMemRealloc(LPVOID pvOld, ULONG size) +{ + return IMalloc_Realloc((LPMALLOC)&Malloc32, pvOld, size); +} + +/*********************************************************************** + * CoRegisterMallocSpy [OLE32.@] + * + * NOTES + * if a mallocspy is already registered, we cant do it again since + * only the spy knows, how to free a memory block + */ +HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy) +{ + IMallocSpy* pSpy; + HRESULT hres = E_INVALIDARG; + + TRACE("\n"); + + /* HACK TO ACTIVATE OUT SPY */ + if (pMallocSpy == (LPVOID)-1) pMallocSpy =(IMallocSpy*)&MallocSpy; + + if(Malloc32.pSpy) return CO_E_OBJISREG; + + EnterCriticalSection(&IMalloc32_SpyCS); + + if (SUCCEEDED(IUnknown_QueryInterface(pMallocSpy, &IID_IMallocSpy, (LPVOID*)&pSpy))) { + Malloc32.pSpy = pSpy; + hres = S_OK; + } + + LeaveCriticalSection(&IMalloc32_SpyCS); + + return hres; +} + +/*********************************************************************** + * CoRevokeMallocSpy [OLE32.@] + * + * NOTES + * we can't rewoke a malloc spy as long as memory blocks allocated with + * the spy are active since only the spy knows how to free them + */ +HRESULT WINAPI CoRevokeMallocSpy(void) +{ + HRESULT hres = S_OK; + TRACE("\n"); + + EnterCriticalSection(&IMalloc32_SpyCS); + + /* if it's our spy it's time to dump the leaks */ + if (Malloc32.pSpy == (IMallocSpy*)&MallocSpy) { + MallocSpyDumpLeaks(); + } + + if (Malloc32.SpyedAllocationsLeft) { + TRACE("SpyReleasePending with %lu allocations left\n", Malloc32.SpyedAllocationsLeft); + Malloc32.SpyReleasePending = TRUE; + hres = E_ACCESSDENIED; + } else { + IMallocSpy_Release(Malloc32.pSpy); + Malloc32.pSpy = NULL; + } + LeaveCriticalSection(&IMalloc32_SpyCS); + + return S_OK; +} + +/****************************************************************************** + * IsValidInterface [OLE32.@] + * + * RETURNS + * True, if the passed pointer is a valid interface + */ +BOOL WINAPI IsValidInterface( + LPUNKNOWN punk /* [in] interface to be tested */ +) { + return !( + IsBadReadPtr(punk,4) || + IsBadReadPtr(punk->lpVtbl,4) || + IsBadReadPtr(punk->lpVtbl->QueryInterface,9) || + IsBadCodePtr((FARPROC)punk->lpVtbl->QueryInterface) + ); +} diff --git a/reactos/lib/ole32/ifs.h b/reactos/lib/ole32/ifs.h new file mode 100644 index 00000000000..2a399407746 --- /dev/null +++ b/reactos/lib/ole32/ifs.h @@ -0,0 +1,128 @@ +/* + * Copyright 1997 Marcus Meissner + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WINE_OLE_IFS_H +#define __WINE_OLE_IFS_H + +#include + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" + +/*********************************************************************** + * IMalloc16 interface + */ + +typedef struct IMalloc16 IMalloc16, *LPMALLOC16; + +#define INTERFACE IMalloc16 +#define IMalloc16_METHODS \ + IUnknown_METHODS \ + STDMETHOD_(LPVOID,Alloc)(THIS_ DWORD cb) PURE; \ + STDMETHOD_(LPVOID,Realloc)(THIS_ LPVOID pv, DWORD cb) PURE; \ + STDMETHOD_(void,Free)(THIS_ LPVOID pv) PURE; \ + STDMETHOD_(DWORD,GetSize)(THIS_ LPVOID pv) PURE; \ + STDMETHOD_(INT16,DidAlloc)(THIS_ LPVOID pv) PURE; \ + STDMETHOD_(LPVOID,HeapMinimize)(THIS) PURE; +ICOM_DEFINE(IMalloc16,IUnknown) +#undef INTERFACE + +/**********************************************************************/ + +extern LPMALLOC16 IMalloc16_Constructor(); + +/**********************************************************************/ + +typedef struct ILockBytes16 *LPLOCKBYTES16, ILockBytes16; + +#define INTERFACE ILockBytes +#define ILockBytes16_METHODS \ + IUnknown_METHODS \ + STDMETHOD(ReadAt)(THIS_ ULARGE_INTEGER ulOffset, void *pv, ULONG cb, ULONG *pcbRead) PURE; \ + STDMETHOD(WriteAt)(THIS_ ULARGE_INTEGER ulOffset, const void *pv, ULONG cb, ULONG *pcbWritten) PURE; \ + STDMETHOD(Flush)(THIS) PURE; \ + STDMETHOD(SetSize)(THIS_ ULARGE_INTEGER cb) PURE; \ + STDMETHOD(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE; \ + STDMETHOD(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE; \ + STDMETHOD(Stat)(THIS_ STATSTG *pstatstg, DWORD grfStatFlag) PURE; +ICOM_DEFINE(ILockBytes16,IUnknown) +#undef INTERFACE + +/**********************************************************************/ + +typedef struct tagSTATSTG16 +{ + LPOLESTR16 pwcsName; + DWORD type; + ULARGE_INTEGER cbSize; + FILETIME mtime; + FILETIME ctime; + FILETIME atime; + DWORD grfMode; + DWORD grfLocksSupported; + CLSID clsid; + DWORD grfStateBits; + DWORD reserved; +} STATSTG16; + +typedef struct IStream16 IStream16, *LPSTREAM16; + +#define INTERFACE IStream16 +#define IStream16_METHODS \ + ISequentialStream_METHODS \ + STDMETHOD(Seek)(THIS_ LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) PURE; \ + STDMETHOD(SetSize)(THIS_ ULARGE_INTEGER libNewSize) PURE; \ + STDMETHOD(CopyTo)(THIS_ IStream16* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) PURE; \ + STDMETHOD(Commit)(THIS_ DWORD grfCommitFlags) PURE; \ + STDMETHOD(Revert)(THIS) PURE; \ + STDMETHOD(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE; \ + STDMETHOD(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE; \ + STDMETHOD(Stat)(THIS_ STATSTG* pstatstg, DWORD grfStatFlag) PURE; \ + STDMETHOD(Clone)(THIS_ IStream16** ppstm) PURE; +ICOM_DEFINE(IStream16,ISequentialStream) +#undef INTERFACE + +/**********************************************************************/ + +typedef OLECHAR16 **SNB16; + +typedef struct IStorage16 IStorage16, *LPSTORAGE16; + +#define INTERFACE IStorage16 +#define IStorage16_METHODS \ + IUnknown_METHODS \ + STDMETHOD_(HRESULT,CreateStream)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream16** ppstm) PURE; \ + STDMETHOD_(HRESULT,OpenStream)(THIS_ LPCOLESTR16 pwcsName, void* reserved1, DWORD grfMode, DWORD reserved2, IStream16** ppstm) PURE; \ + STDMETHOD_(HRESULT,CreateStorage)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD dwStgFmt, DWORD reserved2, IStorage16** ppstg) PURE; \ + STDMETHOD_(HRESULT,OpenStorage)(THIS_ LPCOLESTR16 pwcsName, IStorage16* pstgPriority, DWORD grfMode, SNB16 snbExclude, DWORD reserved, IStorage16** ppstg) PURE; \ + STDMETHOD_(HRESULT,CopyTo)(THIS_ DWORD ciidExclude, const IID* rgiidExclude, SNB16 snbExclude, IStorage16* pstgDest) PURE; \ + STDMETHOD_(HRESULT,MoveElementTo)(THIS_ LPCOLESTR16 pwcsName, IStorage16* pstgDest, LPCOLESTR16 pwcsNewName, DWORD grfFlags) PURE; \ + STDMETHOD_(HRESULT,Commit)(THIS_ DWORD grfCommitFlags) PURE; \ + STDMETHOD_(HRESULT,Revert)(THIS) PURE; \ + STDMETHOD_(HRESULT,EnumElements)(THIS_ DWORD reserved1, void* reserved2, DWORD reserved3, IEnumSTATSTG** ppenum) PURE; \ + STDMETHOD_(HRESULT,DestroyElement)(THIS_ LPCOLESTR16 pwcsName) PURE; \ + STDMETHOD_(HRESULT,RenameElement)(THIS_ LPCOLESTR16 pwcsOldName, LPCOLESTR16 pwcsNewName) PURE; \ + STDMETHOD_(HRESULT,SetElementTimes)(THIS_ LPCOLESTR16 pwcsName, const FILETIME* pctime, const FILETIME* patime, const FILETIME* pmtime) PURE; \ + STDMETHOD_(HRESULT,SetClass)(THIS_ REFCLSID clsid) PURE; \ + STDMETHOD_(HRESULT,SetStateBits)(THIS_ DWORD grfStateBits, DWORD grfMask) PURE; \ + STDMETHOD_(HRESULT,Stat)(THIS_ STATSTG* pstatstg, DWORD grfStatFlag) PURE; +ICOM_DEFINE(IStorage16,IUnknown) +#undef INTERFACE + +#endif /* __WINE_OLE_IFS_H */ diff --git a/reactos/lib/ole32/include/compobj.h b/reactos/lib/ole32/include/compobj.h deleted file mode 100644 index b58041b15f5..00000000000 --- a/reactos/lib/ole32/include/compobj.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __WINE_OLE_COMPOBJ_H -#define __WINE_OLE_COMPOBJ_H - -/* All private prototype functions used by OLE will be added to this header file */ - -/* This function initialize the Running Object Table */ -HRESULT WINAPI RunningObjectTableImpl_Initialize(); - -/* This function uninitialize the Running Object Table */ -HRESULT WINAPI RunningObjectTableImpl_UnInitialize(); - -/* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */ -int WINAPI FileMonikerImpl_DecomposePath(LPOLESTR str, LPOLESTR** stringTable); - -#endif /* __WINE_OLE_COMPOBJ_H */ diff --git a/reactos/lib/ole32/include/debug.h b/reactos/lib/ole32/include/debug.h deleted file mode 100644 index 77a820bb79a..00000000000 --- a/reactos/lib/ole32/include/debug.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS WinSock 2 DLL - * FILE: include/debug.h - * PURPOSE: Debugging support macros - * DEFINES: DBG - Enable debug output - * NASSERT - Disable assertions - */ -#ifndef __DEBUG_H -#define __DEBUG_H - -#define NORMAL_MASK 0x000000FF -#define SPECIAL_MASK 0xFFFFFF00 -#define MIN_TRACE 0x00000001 -#define MID_TRACE 0x00000002 -#define MAX_TRACE 0x00000003 - -#define DEBUG_CHECK 0x00000100 -#define DEBUG_ULTRA 0xFFFFFFFF - -#ifdef DBG - -extern DWORD DebugTraceLevel; - -#define Print(_t_, _x_) \ - if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \ - ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \ - DbgPrint("(%hS:%d)(%hS) ", __FILE__, __LINE__, __FUNCTION__); \ - DbgPrint _x_; \ - } - -#ifdef ASSERT -#undef ASSERT -#endif - -#ifdef NASSERT -#define ASSERT(x) -#else /* NASSERT */ -#define ASSERT(x) if (!(x)) { Print(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); ExitProcess(0); } -#endif /* NASSERT */ - -#else /* DBG */ - -#define Print(_t_, _x_) - -#define ASSERT_IRQL(x) -#define ASSERT(x) - -#endif /* DBG */ - - -#define assert(x) ASSERT(x) -#define assert_irql(x) ASSERT_IRQL(x) - - -#define UNIMPLEMENTED \ - Print(MIN_TRACE, ("is unimplemented, please try again later.\n")); - -#define CHECKPOINT \ - Print(DEBUG_CHECK, ("\n")); - -#define CP CHECKPOINT - - -static char GuidBufferSpace[40]; - -static inline PCHAR PRINT_GUID( const GUID *id ) -{ - CHAR *str; - - if (!id) return "(null)"; - - str = &GuidBufferSpace[0]; - - if (!HIWORD(id)) - { - sprintf( str, "", LOWORD((ULONG)id) ); - } - else - { - sprintf( str, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - id->Data1, id->Data2, id->Data3, - id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3], - id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] ); - } - return str; -} - -#endif /* __DEBUG_H */ - -/* EOF */ diff --git a/reactos/lib/ole32/include/ole32_main.h b/reactos/lib/ole32/include/ole32_main.h deleted file mode 100644 index 97b000d641d..00000000000 --- a/reactos/lib/ole32/include/ole32_main.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __WINE_OLE32_MAIN_H -#define __WINE_OLE32_MAIN_H - -extern HINSTANCE OLE32_hInstance; - -#endif /* __WINE_OLE32_MAIN_H */ diff --git a/reactos/lib/ole32/itemmoniker.c b/reactos/lib/ole32/itemmoniker.c index 01e7e138054..008fcf9d60f 100644 --- a/reactos/lib/ole32/itemmoniker.c +++ b/reactos/lib/ole32/itemmoniker.c @@ -2,24 +2,56 @@ * ItemMonikers implementation * * Copyright 1999 Noomen Hamza + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************************/ +#include +#include #include -#include -#include -#include -#include +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "winerror.h" +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "winnls.h" +#include "wine/debug.h" +#include "ole2.h" +#include "wine/unicode.h" +#include "moniker.h" -#include +WINE_DEFAULT_DEBUG_CHANNEL(ole); +const CLSID CLSID_ItemMoniker = { + 0x304, 0, 0, {0xC0, 0, 0, 0, 0, 0, 0, 0x46} +}; /* ItemMoniker data structure */ typedef struct ItemMonikerImpl{ ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ - /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether + /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether * two monikers are equal. That's whay IROTData interface is implemented by monikers. */ ICOM_VTABLE(IROTData)* lpvtbl2; /* VTable relative to the IROTData interface.*/ @@ -29,7 +61,7 @@ typedef struct ItemMonikerImpl{ LPOLESTR itemName; /* item name identified by this ItemMoniker */ LPOLESTR itemDelimiter; /* Delimiter string */ - + } ItemMonikerImpl; /********************************************************************************/ @@ -130,12 +162,12 @@ HRESULT WINAPI ItemMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** { ICOM_THIS(ItemMonikerImpl,iface); - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,riid,ppvObject)); + TRACE("(%p,%p,%p)\n",This,riid,ppvObject); /* Perform a sanity check on the parameters.*/ if ( (This==0) || (ppvObject==0) ) return E_INVALIDARG; - + /* Initialize the return parameter */ *ppvObject = 0; @@ -146,14 +178,14 @@ HRESULT WINAPI ItemMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** IsEqualIID(&IID_IMoniker, riid) ) *ppvObject = iface; - + else if (IsEqualIID(&IID_IROTData, riid)) *ppvObject = (IROTData*)&(This->lpvtbl2); /* Check that we obtained an interface.*/ if ((*ppvObject)==0) return E_NOINTERFACE; - + /* Query Interface always increases the reference count by one when it is successful */ ItemMonikerImpl_AddRef(iface); @@ -167,7 +199,7 @@ ULONG WINAPI ItemMonikerImpl_AddRef(IMoniker* iface) { ICOM_THIS(ItemMonikerImpl,iface); - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); return ++(This->ref); } @@ -179,7 +211,7 @@ ULONG WINAPI ItemMonikerImpl_Release(IMoniker* iface) { ICOM_THIS(ItemMonikerImpl,iface); - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); This->ref--; @@ -190,7 +222,7 @@ ULONG WINAPI ItemMonikerImpl_Release(IMoniker* iface) return 0; } - return This->ref;; + return This->ref; } /****************************************************************************** @@ -198,13 +230,13 @@ ULONG WINAPI ItemMonikerImpl_Release(IMoniker* iface) ******************************************************************************/ HRESULT WINAPI ItemMonikerImpl_GetClassID(IMoniker* iface,CLSID *pClassID) { - Print(MAX_TRACE, ("(%p,%p),stub!\n",iface,pClassID)); + TRACE("(%p,%p),stub!\n",iface,pClassID); if (pClassID==NULL) return E_POINTER; - + *pClassID = CLSID_ItemMoniker; - + return S_OK; } @@ -217,7 +249,7 @@ HRESULT WINAPI ItemMonikerImpl_IsDirty(IMoniker* iface) method in the OLE-provided moniker interfaces always return S_FALSE because their internal state never changes. */ - Print(MAX_TRACE, ("(%p)\n",iface)); + TRACE("(%p)\n",iface); return S_FALSE; } @@ -300,7 +332,7 @@ HRESULT WINAPI ItemMonikerImpl_Save(IMoniker* iface, HRESULT res; CHAR *itemNameA,*itemDelimiterA; - /* data writen by this function are : 1) DWORD : size of item delimiter string ('\0' included ) */ + /* data written by this function are : 1) DWORD : size of item delimiter string ('\0' included ) */ /* 2) String (type A): item delimiter string ('\0' included) */ /* 3) DWORD : size of item name string ('\0' included) */ /* 4) String (type A): item name string ('\0' included) */ @@ -330,13 +362,13 @@ HRESULT WINAPI ItemMonikerImpl_GetSizeMax(IMoniker* iface, DWORD delimiterLength=lstrlenW(This->itemDelimiter)+1; DWORD nameLength=lstrlenW(This->itemName)+1; - Print(MAX_TRACE, ("(%p,%p)\n",iface,pcbSize)); + TRACE("(%p,%p)\n",iface,pcbSize); if (pcbSize!=NULL) return E_POINTER; /* for more details see ItemMonikerImpl_Save coments */ - + pcbSize->u.LowPart = sizeof(DWORD) + /* DWORD which contains delimiter length */ delimiterLength + /* item delimiter string */ sizeof(DWORD) + /* DWORD which contains item name length */ @@ -358,7 +390,7 @@ HRESULT WINAPI ItemMonikerImpl_Construct(ItemMonikerImpl* This, LPCOLESTR lpszDe static const OLECHAR emptystr[1]; LPCOLESTR delim; - Print(MAX_TRACE, ("(%p,%p)\n",This,lpszItem)); + TRACE("(%p,%p)\n",This,lpszItem); /* Initialize the virtual fgunction table. */ This->lpvtbl1 = &VT_ItemMonikerImpl; @@ -371,7 +403,7 @@ HRESULT WINAPI ItemMonikerImpl_Construct(ItemMonikerImpl* This, LPCOLESTR lpszDe lstrcpyW(This->itemName,lpszItem); if (!lpszDelim) - Print(MIN_TRACE, ("lpszDelim is NULL. Using empty string which is possibly wrong.\n")); + FIXME("lpszDelim is NULL. Using empty string which is possibly wrong.\n"); delim = lpszDelim ? lpszDelim : emptystr; @@ -390,7 +422,7 @@ HRESULT WINAPI ItemMonikerImpl_Construct(ItemMonikerImpl* This, LPCOLESTR lpszDe *******************************************************************************/ HRESULT WINAPI ItemMonikerImpl_Destroy(ItemMonikerImpl* This) { - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); if (This->itemName) HeapFree(GetProcessHeap(),0,This->itemName); @@ -413,12 +445,12 @@ HRESULT WINAPI ItemMonikerImpl_BindToObject(IMoniker* iface, VOID** ppvResult) { ICOM_THIS(ItemMonikerImpl,iface); - + HRESULT res; IID refid=IID_IOleItemContainer; IOleItemContainer *poic=0; - Print(MAX_TRACE, ("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult)); + TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult); if(ppvResult ==NULL) return E_POINTER; @@ -454,13 +486,13 @@ HRESULT WINAPI ItemMonikerImpl_BindToStorage(IMoniker* iface, HRESULT res; IOleItemContainer *poic=0; - Print(MAX_TRACE, ("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult)); + TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult); *ppvResult=0; if(pmkToLeft==NULL) return E_INVALIDARG; - + res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic); if (SUCCEEDED(res)){ @@ -482,7 +514,7 @@ HRESULT WINAPI ItemMonikerImpl_Reduce(IMoniker* iface, IMoniker** ppmkToLeft, IMoniker** ppmkReduced) { - Print(MAX_TRACE, ("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced)); + TRACE("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced); if (ppmkReduced==NULL) return E_POINTER; @@ -490,7 +522,7 @@ HRESULT WINAPI ItemMonikerImpl_Reduce(IMoniker* iface, ItemMonikerImpl_AddRef(iface); *ppmkReduced=iface; - + return MK_S_REDUCED_TO_SELF; } /****************************************************************************** @@ -507,13 +539,13 @@ HRESULT WINAPI ItemMonikerImpl_ComposeWith(IMoniker* iface, IMoniker *pmostLeftMk=0; IMoniker* tempMkComposite=0; - Print(MAX_TRACE, ("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite)); + TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite); if ((ppmkComposite==NULL)||(pmkRight==NULL)) return E_POINTER; *ppmkComposite=0; - + IMoniker_IsSystemMoniker(pmkRight,&mkSys); /* If pmkRight is an anti-moniker, the returned moniker is NULL */ @@ -523,7 +555,7 @@ HRESULT WINAPI ItemMonikerImpl_ComposeWith(IMoniker* iface, else /* if pmkRight is a composite whose leftmost component is an anti-moniker, */ /* the returned moniker is the composite after the leftmost anti-moniker is removed. */ - + if(mkSys==MKSYS_GENERICCOMPOSITE){ res=IMoniker_Enum(pmkRight,TRUE,&penumMk); @@ -541,7 +573,7 @@ HRESULT WINAPI ItemMonikerImpl_ComposeWith(IMoniker* iface, tempMkComposite=iface; IMoniker_AddRef(iface); - + while(IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL)==S_OK){ res=CreateGenericComposite(tempMkComposite,pmostLeftMk,ppmkComposite); @@ -551,7 +583,7 @@ HRESULT WINAPI ItemMonikerImpl_ComposeWith(IMoniker* iface, tempMkComposite=*ppmkComposite; IMoniker_AddRef(tempMkComposite); -} + } return res; } else @@ -573,7 +605,7 @@ HRESULT WINAPI ItemMonikerImpl_ComposeWith(IMoniker* iface, ******************************************************************************/ HRESULT WINAPI ItemMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker) { - Print(MAX_TRACE, ("(%p,%d,%p)\n",iface,fForward,ppenumMoniker)); + TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker); if (ppenumMoniker == NULL) return E_POINTER; @@ -592,32 +624,28 @@ HRESULT WINAPI ItemMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker CLSID clsid; LPOLESTR dispName1,dispName2; IBindCtx* bind; - HRESULT res; + HRESULT res = S_FALSE; - Print(MAX_TRACE, ("(%p,%p)\n",iface,pmkOtherMoniker)); + TRACE("(%p,%p)\n",iface,pmkOtherMoniker); - if (pmkOtherMoniker==NULL) - return S_FALSE; - - /* This method returns S_OK if both monikers are item monikers and their display names are */ - /* identical (using a case-insensitive comparison); otherwise, the method returns S_FALSE. */ + if (!pmkOtherMoniker) return S_FALSE; - IMoniker_GetClassID(pmkOtherMoniker,&clsid); - if (!IsEqualCLSID(&clsid,&CLSID_ItemMoniker)) - return S_FALSE; + /* check if both are ItemMoniker */ + if(FAILED (IMoniker_GetClassID(pmkOtherMoniker,&clsid))) return S_FALSE; + if(!IsEqualCLSID(&clsid,&CLSID_ItemMoniker)) return S_FALSE; - res=CreateBindCtx(0,&bind); - if (FAILED(res)) - return res; - - IMoniker_GetDisplayName(iface,bind,NULL,&dispName1); - IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2); - - if (lstrcmpW(dispName1,dispName2)!=0) - return S_FALSE; - - return S_OK; + /* check if both displaynames are the same */ + if(SUCCEEDED ((res = CreateBindCtx(0,&bind)))) { + if(SUCCEEDED (IMoniker_GetDisplayName(iface,bind,NULL,&dispName1))) { + if(SUCCEEDED (IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2))) { + if(lstrcmpW(dispName1,dispName2)==0) res = S_OK; + CoTaskMemFree(dispName2); + } + CoTaskMemFree(dispName1); + } + } + return res; } /****************************************************************************** @@ -633,14 +661,14 @@ HRESULT WINAPI ItemMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash) if (pdwHash==NULL) return E_POINTER; - + val = This->itemName; len = lstrlenW(val); if (len < 16) { for (i = len ; i > 0; i--) { h = (h * 37) + val[off++]; -} + } } else { /* only sample some characters */ skip = len / 8; @@ -667,7 +695,7 @@ HRESULT WINAPI ItemMonikerImpl_IsRunning(IMoniker* iface, IOleItemContainer *poic=0; ICOM_THIS(ItemMonikerImpl,iface); - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning)); + TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning); /* If pmkToLeft is NULL, this method returns TRUE if pmkNewlyRunning is non-NULL and is equal to this */ /* moniker. Otherwise, the method checks the ROT to see whether this moniker is running. */ @@ -692,7 +720,7 @@ HRESULT WINAPI ItemMonikerImpl_IsRunning(IMoniker* iface, /* If pmkToLeft is non-NULL, the method calls IMoniker::BindToObject on the pmkToLeft parameter, */ /* requesting an IOleItemContainer interface pointer. The method then calls IOleItemContainer::IsRunning,*/ /* passing the string contained within this moniker. */ - + res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic); if (SUCCEEDED(res)){ @@ -718,7 +746,7 @@ HRESULT WINAPI ItemMonikerImpl_GetTimeOfLastChange(IMoniker* iface, HRESULT res; IMoniker *compositeMk; - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pItemTime)); + TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pItemTime); if (pItemTime==NULL) return E_INVALIDARG; @@ -742,7 +770,7 @@ HRESULT WINAPI ItemMonikerImpl_GetTimeOfLastChange(IMoniker* iface, res=IMoniker_GetTimeOfLastChange(pmkToLeft,pbc,NULL,pItemTime); IMoniker_Release(compositeMk); -} + } return res; } @@ -752,7 +780,7 @@ HRESULT WINAPI ItemMonikerImpl_GetTimeOfLastChange(IMoniker* iface, ******************************************************************************/ HRESULT WINAPI ItemMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk) { - Print(MAX_TRACE, ("(%p,%p)\n",iface,ppmk)); + TRACE("(%p,%p)\n",iface,ppmk); if (ppmk==NULL) return E_POINTER; @@ -773,9 +801,9 @@ HRESULT WINAPI ItemMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOth if((mkSys==MKSYS_ITEMMONIKER) && (IMoniker_IsEqual(iface,pmkOther)==S_OK) ){ *ppmkPrefix=iface; - + IMoniker_AddRef(iface); - + return MK_S_US; } else @@ -789,13 +817,13 @@ HRESULT WINAPI ItemMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOth ******************************************************************************/ HRESULT WINAPI ItemMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath) { - Print(MAX_TRACE, ("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath)); + TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath); if (ppmkRelPath==NULL) return E_POINTER; *ppmkRelPath=0; - + return MK_E_NOTBINDABLE; } @@ -809,7 +837,7 @@ HRESULT WINAPI ItemMonikerImpl_GetDisplayName(IMoniker* iface, { ICOM_THIS(ItemMonikerImpl,iface); - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName)); + TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName); if (ppszDisplayName==NULL) return E_POINTER; @@ -825,7 +853,7 @@ HRESULT WINAPI ItemMonikerImpl_GetDisplayName(IMoniker* iface, lstrcpyW(*ppszDisplayName,This->itemDelimiter); lstrcatW(*ppszDisplayName,This->itemName); - + return S_OK; } @@ -852,7 +880,8 @@ HRESULT WINAPI ItemMonikerImpl_ParseDisplayName(IMoniker* iface, else{ /* Otherwise, the method calls IMoniker::BindToObject on the pmkToLeft parameter, requesting an */ - /* IParseDisplayName interface pointer to the object identified by the moniker, and passes the display */ /* name to IParseDisplayName::ParseDisplayName */ + /* IParseDisplayName interface pointer to the object identified by the moniker, and passes the display */ + /* name to IParseDisplayName::ParseDisplayName */ res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic); if (SUCCEEDED(res)){ @@ -866,7 +895,7 @@ HRESULT WINAPI ItemMonikerImpl_ParseDisplayName(IMoniker* iface, IOleItemContainer_Release(poic); IParseDisplayName_Release(ppdn); } -} + } return res; } @@ -875,11 +904,11 @@ HRESULT WINAPI ItemMonikerImpl_ParseDisplayName(IMoniker* iface, ******************************************************************************/ HRESULT WINAPI ItemMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys) { - Print(MAX_TRACE, ("(%p,%p)\n",iface,pwdMksys)); + TRACE("(%p,%p)\n",iface,pwdMksys); if (!pwdMksys) return E_POINTER; - + (*pwdMksys)=MKSYS_ITEMMONIKER; return S_OK; @@ -893,7 +922,7 @@ HRESULT WINAPI ItemMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid ICOM_THIS_From_IROTData(IMoniker, iface); - Print(MAX_TRACE, ("(%p,%p,%p)\n",iface,riid,ppvObject)); + TRACE("(%p,%p,%p)\n",iface,riid,ppvObject); return ItemMonikerImpl_QueryInterface(This, riid, ppvObject); } @@ -905,7 +934,7 @@ ULONG WINAPI ItemMonikerROTDataImpl_AddRef(IROTData *iface) { ICOM_THIS_From_IROTData(IMoniker, iface); - Print(MAX_TRACE, ("(%p)\n",iface)); + TRACE("(%p)\n",iface); return ItemMonikerImpl_AddRef(This); } @@ -916,8 +945,8 @@ ULONG WINAPI ItemMonikerROTDataImpl_AddRef(IROTData *iface) ULONG WINAPI ItemMonikerROTDataImpl_Release(IROTData* iface) { ICOM_THIS_From_IROTData(IMoniker, iface); - - Print(MAX_TRACE, ("(%p)\n",iface)); + + TRACE("(%p)\n",iface); return ItemMonikerImpl_Release(This); } @@ -930,23 +959,25 @@ HRESULT WINAPI ItemMonikerROTDataImpl_GetComparaisonData(IROTData* iface, ULONG cbMax, ULONG* pcbData) { - UNIMPLEMENTED; + FIXME("(),stub!\n"); return E_NOTIMPL; } /****************************************************************************** * CreateItemMoniker16 [OLE2.28] ******************************************************************************/ +#ifndef __REACTOS__ HRESULT WINAPI CreateItemMoniker16(LPCOLESTR16 lpszDelim,LPCOLESTR lpszItem,LPMONIKER* ppmk) { - Print(MIN_TRACE, ("(%s,%p),stub!\n",lpszDelim,ppmk)); + FIXME("(%s,%p),stub!\n",lpszDelim,ppmk); *ppmk = NULL; return E_NOTIMPL; } +#endif /****************************************************************************** - * CreateItemMoniker [OLE.55] + * CreateItemMoniker [OLE32.@] ******************************************************************************/ HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim,LPCOLESTR lpszItem, LPMONIKER * ppmk) { @@ -954,7 +985,7 @@ HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim,LPCOLESTR lpszItem, LPMONI HRESULT hr = S_OK; IID riid=IID_IMoniker; - Print(MAX_TRACE, ("(%p,%p,%p)\n",lpszDelim,lpszItem,ppmk)); + TRACE("(%p,%p,%p)\n",lpszDelim,lpszItem,ppmk); newItemMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(ItemMonikerImpl)); diff --git a/reactos/lib/ole32/makefile b/reactos/lib/ole32/makefile index 2b3cb1fd53f..02aa132371a 100644 --- a/reactos/lib/ole32/makefile +++ b/reactos/lib/ole32/makefile @@ -1,9 +1,4 @@ -# $Id: makefile,v 1.7 2003/08/07 04:03:23 royce Exp $ -# -# Jurgen Van Gael [jurgen.vangael@student.kuleuven.ac.be] -# -# Makefile for ReactOS ole32.dll -# +# $Id: makefile PATH_TO_TOP = ../.. @@ -13,38 +8,67 @@ TARGET_NAME = ole32 TARGET_BASE = 0x77a50000 -TARGET_DEFONLY = yes +TARGET_CFLAGS = \ + -Wall \ + -fno-builtin -TARGET_CFLAGS = -fno-rtti -I./include +# Compile definitions usage: +# __USE_W32API - Compilation with w32api headers +# __REACTOS__ - Compilation of Wine sources for ReactOS +# _WIN32_IE=0x600 - Internet Explorer 6 compatible defintions +# WINVER=0x501 - Windows XP definitions +# __need_offsetof - Force definition of macro offsetof in stddef.h +# +DEFINES = \ + -D__USE_W32API \ + -D__REACTOS__ \ + -D_WIN32_IE=0x600 \ + -D_WIN32_WINNT=0x501 \ + -DWINVER=0x501 \ + -DCOBJMACROS \ + -D__need_offsetof + +TARGET_CFLAGS += \ + $(DEFINES) \ + -I$(PATH_TO_TOP)/include/wine \ + -Wno-unused -# require os code to explicitly request A/W version of structs/functions -TARGET_CFLAGS += -D_DISABLE_TIDENTS +TARGET_RCFLAGS += -D__REACTOS__ -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x501 -TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a user32.a gdi32.a msvcrt.a +TARGET_SDKLIBS = libwine.a ntdll.a + +TARGET_GCCLIBS = uuid gdi32 rpcrt4 TARGET_OBJECTS = \ - DllMain.o \ - CoXxx.o \ - Moniker.o \ - Ole2.o \ - OleAuto.o \ - Misc.o \ - Storage.o \ - storage32.o \ - stg_stream.o \ - stg_bigblockfile.o \ - compobj.o \ - memlockbytes.o \ - rpcrt4_main.o \ - filemoniker.o \ - bindctx.o \ - compositemoniker.o \ - itemmoniker.o \ antimoniker.o \ - datacache.o + bindctx.o \ + clipboard.o \ + compobj.o \ + compositemoniker.o \ + datacache.o \ + defaulthandler.o \ + errorinfo.o \ + filemoniker.o \ + ftmarshal.o \ + git.o \ + hglobalstream.o \ + ifs.o \ + itemmoniker.o \ + marshal.o \ + memlockbytes.o \ + moniker.o \ + ole2.o \ + ole2stubs.o \ + ole2impl.o \ + ole32_main.o \ + oleobj.o \ + oleproxy.o \ + regsvr.o \ + rpc.o \ + stg_bigblockfile.o \ + stg_stream.o \ + storage32.o include $(PATH_TO_TOP)/rules.mak include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/lib/ole32/marshal.c b/reactos/lib/ole32/marshal.c new file mode 100644 index 00000000000..eb257bc7270 --- /dev/null +++ b/reactos/lib/ole32/marshal.c @@ -0,0 +1,648 @@ +/* + * Marshalling library + * + * Copyright 2002 Marcus Meissner + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#ifdef __REACTOS__ +#include +#endif +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "objbase.h" +#include "ole2.h" +#include "ole2ver.h" +#include "rpc.h" +#include "winerror.h" +#include "winreg.h" +#ifndef __REACTOS__ +#include "wownt32.h" +#endif +#include "wtypes.h" +#include "wine/unicode.h" +#ifndef __REACTOS__ +#include "wine/winbase16.h" +#endif +#include "compobj_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +extern const CLSID CLSID_DfMarshal; + +/* Marshalling just passes a unique identifier to the remote client, + * that makes it possible to find the passed interface again. + * + * So basically we need a set of values that make it unique. + * + * Process Identifier, Object IUnknown ptr, IID + * + * Note that the IUnknown_QI(ob,xiid,&ppv) always returns the SAME ppv value! + */ + +typedef struct _mid2unknown { + wine_marshal_id mid; + LPUNKNOWN pUnk; +} mid2unknown; + +typedef struct _mid2stub { + wine_marshal_id mid; + IRpcStubBuffer *stub; + LPUNKNOWN pUnkServer; +} mid2stub; + +static mid2stub *stubs = NULL; +static int nrofstubs = 0; + +static mid2unknown *proxies = NULL; +static int nrofproxies = 0; + +HRESULT +MARSHAL_Find_Stub_Server(wine_marshal_id *mid,LPUNKNOWN *punk) { + int i; + + for (i=0;iobjectid,debugstr_guid(&(mid->iid))); + return S_OK; + } + if (nrofstubs) + stubs=HeapReAlloc(GetProcessHeap(),0,stubs,sizeof(stubs[0])*(nrofstubs+1)); + else + stubs=HeapAlloc(GetProcessHeap(),0,sizeof(stubs[0])); + if (!stubs) return E_OUTOFMEMORY; + stubs[nrofstubs].stub = stub; + stubs[nrofstubs].pUnkServer = pUnk; + memcpy(&(stubs[nrofstubs].mid),mid,sizeof(*mid)); + nrofstubs++; + return S_OK; +} + +HRESULT +MARSHAL_Find_Proxy(wine_marshal_id *mid,LPUNKNOWN *punk) { + int i; + + for (i=0;iref++; + return This->ref; +} + +ULONG WINAPI +StdMarshalImpl_Release(LPMARSHAL iface) { + ICOM_THIS(StdMarshalImpl,iface); + This->ref--; + + if (This->ref) + return This->ref; + HeapFree(GetProcessHeap(),0,This); + return 0; +} + +HRESULT WINAPI +StdMarshalImpl_GetUnmarshalClass( + LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext, + void* pvDestContext, DWORD mshlflags, CLSID* pCid +) { + memcpy(pCid,&CLSID_DfMarshal,sizeof(CLSID_DfMarshal)); + return S_OK; +} + +HRESULT WINAPI +StdMarshalImpl_GetMarshalSizeMax( + LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext, + void* pvDestContext, DWORD mshlflags, DWORD* pSize +) { + *pSize = sizeof(wine_marshal_id)+sizeof(wine_marshal_data); + return S_OK; +} + +HRESULT WINAPI +StdMarshalImpl_MarshalInterface( + LPMARSHAL iface, IStream *pStm,REFIID riid, void* pv, DWORD dwDestContext, + void* pvDestContext, DWORD mshlflags +) { + wine_marshal_id mid; + wine_marshal_data md; + IUnknown *pUnk; + ULONG res; + HRESULT hres; + IRpcStubBuffer *stub; + IPSFactoryBuffer *psfacbuf; + + TRACE("(...,%s,...)\n",debugstr_guid(riid)); + IUnknown_QueryInterface((LPUNKNOWN)pv,&IID_IUnknown,(LPVOID*)&pUnk); + mid.processid = GetCurrentProcessId(); + mid.objectid = (DWORD)pUnk; /* FIXME */ + IUnknown_Release(pUnk); + memcpy(&mid.iid,riid,sizeof(mid.iid)); + md.dwDestContext = dwDestContext; + md.mshlflags = mshlflags; + hres = IStream_Write(pStm,&mid,sizeof(mid),&res); + if (hres) return hres; + hres = IStream_Write(pStm,&md,sizeof(md),&res); + if (hres) return hres; + + if (SUCCEEDED(MARSHAL_Find_Stub(&mid,&pUnk))) { + IUnknown_Release(pUnk); + return S_OK; + } + hres = get_facbuf_for_iid(riid,&psfacbuf); + if (hres) return hres; + hres = IPSFactoryBuffer_CreateStub(psfacbuf,riid,pv,&stub); + IPSFactoryBuffer_Release(psfacbuf); + if (hres) { + FIXME("Failed to create a stub for %s\n",debugstr_guid(riid)); + return hres; + } + IUnknown_QueryInterface((LPUNKNOWN)pv,riid,(LPVOID*)&pUnk); + MARSHAL_Register_Stub(&mid,pUnk,stub); + IUnknown_Release(pUnk); + return S_OK; +} + +HRESULT WINAPI +StdMarshalImpl_UnmarshalInterface( + LPMARSHAL iface, IStream *pStm, REFIID riid, void **ppv +) { + wine_marshal_id mid; + wine_marshal_data md; + ULONG res; + HRESULT hres; + IPSFactoryBuffer *psfacbuf; + IRpcProxyBuffer *rpcproxy; + IRpcChannelBuffer *chanbuf; + + TRACE("(...,%s,....)\n",debugstr_guid(riid)); + hres = IStream_Read(pStm,&mid,sizeof(mid),&res); + if (hres) return hres; + hres = IStream_Read(pStm,&md,sizeof(md),&res); + if (hres) return hres; + if (SUCCEEDED(MARSHAL_Find_Stub(&mid,(LPUNKNOWN*)ppv))) { + FIXME("Calling back to ourselves for %s!\n",debugstr_guid(riid)); + return S_OK; + } + hres = get_facbuf_for_iid(riid,&psfacbuf); + if (hres) return hres; + hres = IPSFactoryBuffer_CreateProxy(psfacbuf,NULL,riid,&rpcproxy,ppv); + if (hres) { + FIXME("Failed to create a proxy for %s\n",debugstr_guid(riid)); + return hres; + } + hres = PIPE_GetNewPipeBuf(&mid,&chanbuf); + if (hres) { + ERR("Failed to get an rpc channel buffer for %s\n",debugstr_guid(riid)); + } else { + IRpcProxyBuffer_Connect(rpcproxy,chanbuf); + IRpcProxyBuffer_Release(rpcproxy); /* no need */ + } + IPSFactoryBuffer_Release(psfacbuf); + return hres; +} + +HRESULT WINAPI +StdMarshalImpl_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm) { + FIXME("(), stub!\n"); + return S_OK; +} + +HRESULT WINAPI +StdMarshalImpl_DisconnectObject(LPMARSHAL iface, DWORD dwReserved) { + FIXME("(), stub!\n"); + return S_OK; +} + +ICOM_VTABLE(IMarshal) stdmvtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + StdMarshalImpl_QueryInterface, + StdMarshalImpl_AddRef, + StdMarshalImpl_Release, + StdMarshalImpl_GetUnmarshalClass, + StdMarshalImpl_GetMarshalSizeMax, + StdMarshalImpl_MarshalInterface, + StdMarshalImpl_UnmarshalInterface, + StdMarshalImpl_ReleaseMarshalData, + StdMarshalImpl_DisconnectObject +}; + +/*********************************************************************** + * CoGetStandardMarshal [OLE32.@] + * + * When the COM library in the client process receives a marshalled + * interface pointer, it looks for a CLSID to be used in creating a proxy + * for the purposes of unmarshalling the packet. If the packet does not + * contain a CLSID for the proxy, COM calls CoGetStandardMarshal, passing a + * NULL pUnk value. + * This function creates a standard proxy in the client process and returns + * a pointer to that proxy's implementation of IMarshal. + * COM uses this pointer to call CoUnmarshalInterface to retrieve the pointer + * to the requested interface. + */ +HRESULT WINAPI +CoGetStandardMarshal( + REFIID riid,IUnknown *pUnk,DWORD dwDestContext,LPVOID pvDestContext, + DWORD mshlflags, LPMARSHAL *pMarshal +) { + StdMarshalImpl *dm; + + if (pUnk == NULL) { + FIXME("(%s,NULL,%lx,%p,%lx,%p), unimplemented yet.\n", + debugstr_guid(riid),dwDestContext,pvDestContext,mshlflags,pMarshal + ); + return E_FAIL; + } + TRACE("(%s,%p,%lx,%p,%lx,%p)\n", + debugstr_guid(riid),pUnk,dwDestContext,pvDestContext,mshlflags,pMarshal + ); + dm = (StdMarshalImpl*) *pMarshal = HeapAlloc(GetProcessHeap(),0,sizeof(StdMarshalImpl)); + if (!dm) return E_FAIL; + dm->lpvtbl = &stdmvtbl; + dm->ref = 1; + + memcpy(&dm->iid,riid,sizeof(dm->iid)); + dm->dwDestContext = dwDestContext; + dm->pvDestContext = pvDestContext; + dm->mshlflags = mshlflags; + return S_OK; +} + +/* Helper function for getting Marshaler */ +static HRESULT WINAPI +_GetMarshaller(REFIID riid, IUnknown *pUnk,DWORD dwDestContext, + void *pvDestContext, DWORD mshlFlags, LPMARSHAL *pMarshal +) { + HRESULT hres; + + if (!pUnk) + return E_POINTER; + hres = IUnknown_QueryInterface(pUnk,&IID_IMarshal,(LPVOID*)pMarshal); + if (hres) + hres = CoGetStandardMarshal(riid,pUnk,dwDestContext,pvDestContext,mshlFlags,pMarshal); + return hres; +} + +/*********************************************************************** + * CoGetMarshalSizeMax [OLE32.@] + */ +HRESULT WINAPI +CoGetMarshalSizeMax(ULONG *pulSize, REFIID riid, IUnknown *pUnk, + DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags +) { + HRESULT hres; + LPMARSHAL pMarshal; + + hres = _GetMarshaller(riid,pUnk,dwDestContext,pvDestContext,mshlFlags,&pMarshal); + if (hres) + return hres; + hres = IMarshal_GetMarshalSizeMax(pMarshal,riid,pUnk,dwDestContext,pvDestContext,mshlFlags,pulSize); + *pulSize += sizeof(wine_marshal_id)+sizeof(wine_marshal_data)+sizeof(CLSID); + IMarshal_Release(pMarshal); + return hres; +} + + +/*********************************************************************** + * CoMarshalInterface [OLE32.@] + */ +HRESULT WINAPI +CoMarshalInterface( IStream *pStm, REFIID riid, IUnknown *pUnk, + DWORD dwDestContext, void *pvDestContext, DWORD mshlflags +) { + HRESULT hres; + LPMARSHAL pMarshal; + CLSID xclsid; + ULONG writeres; + wine_marshal_id mid; + wine_marshal_data md; + ULONG res; + IUnknown *pUnknown; + + TRACE("(%p, %s, %p, %lx, %p, %lx)\n", + pStm,debugstr_guid(riid),pUnk,dwDestContext,pvDestContext,mshlflags + ); + STUBMGR_Start(); /* Just to be sure we have one running. */ + mid.processid = GetCurrentProcessId(); + IUnknown_QueryInterface(pUnk,&IID_IUnknown,(LPVOID*)&pUnknown); + mid.objectid = (DWORD)pUnknown; + IUnknown_Release(pUnknown); + memcpy(&mid.iid,riid,sizeof(mid.iid)); + md.dwDestContext = dwDestContext; + md.mshlflags = mshlflags; + hres = IStream_Write(pStm,&mid,sizeof(mid),&res); + if (hres) return hres; + hres = IStream_Write(pStm,&md,sizeof(md),&res); + if (hres) return hres; + hres = _GetMarshaller(riid,pUnk,dwDestContext,pvDestContext,mshlflags,&pMarshal); + if (hres) { + FIXME("Failed to get marshaller, %lx?\n",hres); + return hres; + } + hres = IMarshal_GetUnmarshalClass(pMarshal,riid,pUnk,dwDestContext,pvDestContext,mshlflags,&xclsid); + if (hres) { + FIXME("IMarshal:GetUnmarshalClass failed, %lx\n",hres); + goto release_marshal; + } + hres = IStream_Write(pStm,&xclsid,sizeof(xclsid),&writeres); + if (hres) { + FIXME("Stream write failed, %lx\n",hres); + goto release_marshal; + } + hres = IMarshal_MarshalInterface(pMarshal,pStm,riid,pUnk,dwDestContext,pvDestContext,mshlflags); + if (hres) { + if (IsEqualGUID(riid,&IID_IClassFactory)) { + MESSAGE("\nERROR: You need to merge the 'winedefault.reg' file into your\n"); + MESSAGE(" Wine registry by running: `regedit winedefault.reg'\n\n"); + } else { + if (IsEqualGUID(riid,&IID_IOleObject)) { + ERR("WINE currently cannot marshal IOleObject interfaces. This means you cannot embed/link OLE objects between applications.\n"); + } else { + FIXME("Failed to marshal the interface %s, %lx?\n",debugstr_guid(riid),hres); + } + } + goto release_marshal; + } +release_marshal: + IMarshal_Release(pMarshal); + return hres; +} + + +/*********************************************************************** + * CoUnmarshalInterface [OLE32.@] + */ +HRESULT WINAPI +CoUnmarshalInterface(IStream *pStm, REFIID riid, LPVOID *ppv) { + HRESULT hres; + wine_marshal_id mid; + wine_marshal_data md; + ULONG res; + LPMARSHAL pMarshal; + LPUNKNOWN pUnk; + CLSID xclsid; + + TRACE("(%p,%s,%p)\n",pStm,debugstr_guid(riid),ppv); + + hres = IStream_Read(pStm,&mid,sizeof(mid),&res); + if (hres) { + FIXME("Stream read 1 failed, %lx, (%ld of %d)\n",hres,res,sizeof(mid)); + return hres; + } + hres = IStream_Read(pStm,&md,sizeof(md),&res); + if (hres) { + FIXME("Stream read 2 failed, %lx, (%ld of %d)\n",hres,res,sizeof(md)); + return hres; + } + hres = IStream_Read(pStm,&xclsid,sizeof(xclsid),&res); + if (hres) { + FIXME("Stream read 3 failed, %lx, (%ld of %d)\n",hres,res,sizeof(xclsid)); + return hres; + } + hres=CoCreateInstance(&xclsid,NULL,CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER,&IID_IMarshal,(void**)&pUnk); + if (hres) { + FIXME("Failed to create instance of unmarshaller %s.\n",debugstr_guid(&xclsid)); + return hres; + } + hres = _GetMarshaller(riid,pUnk,md.dwDestContext,NULL,md.mshlflags,&pMarshal); + if (hres) { + FIXME("Failed to get unmarshaller, %lx?\n",hres); + return hres; + } + hres = IMarshal_UnmarshalInterface(pMarshal,pStm,riid,ppv); + if (hres) { + FIXME("Failed to Unmarshal the interface, %lx?\n",hres); + goto release_marshal; + } +release_marshal: + IMarshal_Release(pMarshal); + return hres; +} + +/*********************************************************************** + * CoMarshalInterThreadInterfaceInStream [OLE32.@] + * + * Marshal interfaces across threads. We don't have a thread distinction, + * meaning most interfaces just work across different threads, the RPC + * handles it. + */ +HRESULT WINAPI +CoMarshalInterThreadInterfaceInStream( + REFIID riid, LPUNKNOWN pUnk, LPSTREAM * ppStm +) { + ULONG res; + ULARGE_INTEGER xpos; + LARGE_INTEGER seekto; + HRESULT hres; + + TRACE("(%s, %p, %p)\n",debugstr_guid(riid), pUnk, ppStm); + hres = CreateStreamOnHGlobal(0, TRUE, ppStm); + if (hres) return hres; + /* CoMarshalInterface(...); */ + hres = IStream_Write(*ppStm,&pUnk,sizeof(LPUNKNOWN),&res); + if (hres) return hres; + memset(&seekto,0,sizeof(seekto)); + IStream_Seek(*ppStm,seekto,SEEK_SET,&xpos); + return S_OK; +} + +/*********************************************************************** + * CoGetInterfaceAndReleaseStream [OLE32.@] + */ +HRESULT WINAPI +CoGetInterfaceAndReleaseStream(LPSTREAM pStm,REFIID riid, LPVOID *ppv) { + ULONG res; + HRESULT hres; + LPUNKNOWN pUnk; + + TRACE("(,%s,)\n",debugstr_guid(riid)); + /* CoUnmarshalInterface(...); */ + hres = IStream_Read(pStm,&pUnk,sizeof(LPUNKNOWN),&res); + if (hres) return hres; + IStream_Release(pStm); + return IUnknown_QueryInterface(pUnk,riid,ppv); +} + +static HRESULT WINAPI +SMCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv) { + *ppv = NULL; + if (IsEqualIID(riid,&IID_IUnknown) || IsEqualIID(riid,&IID_IClassFactory)) { + *ppv = (LPVOID)iface; + return S_OK; + } + return E_NOINTERFACE; +} +static ULONG WINAPI SMCF_AddRef(LPCLASSFACTORY iface) { return 2; } +static ULONG WINAPI SMCF_Release(LPCLASSFACTORY iface) { return 1; } + +static HRESULT WINAPI +SMCF_CreateInstance( + LPCLASSFACTORY iface, LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv +) { + if (IsEqualIID(riid,&IID_IMarshal)) { + StdMarshalImpl *dm; + dm=(StdMarshalImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(StdMarshalImpl)); + if (!dm) + return E_FAIL; + dm->lpvtbl = &stdmvtbl; + dm->ref = 1; + *ppv = (LPVOID)dm; + return S_OK; + } + FIXME("(%s), not supported.\n",debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static HRESULT WINAPI +SMCF_LockServer(LPCLASSFACTORY iface, BOOL fLock) { + FIXME("(%d), stub!\n",fLock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) dfmarshalcfvtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + SMCF_QueryInterface, + SMCF_AddRef, + SMCF_Release, + SMCF_CreateInstance, + SMCF_LockServer +}; +static ICOM_VTABLE(IClassFactory) *pdfmarshalcfvtbl = &dfmarshalcfvtbl; + +HRESULT +MARSHAL_GetStandardMarshalCF(LPVOID *ppv) { + *ppv = &pdfmarshalcfvtbl; + return S_OK; +} diff --git a/reactos/lib/ole32/memlockbytes.c b/reactos/lib/ole32/memlockbytes.c index f8770808113..3e82e082484 100644 --- a/reactos/lib/ole32/memlockbytes.c +++ b/reactos/lib/ole32/memlockbytes.c @@ -4,18 +4,48 @@ * * Copyright 1999 Thuy Nguyen * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include "config.h" + +#include +#include #include -#include -#include -#include -#include +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#ifndef __REACTOS__ +#include "wine/winbase16.h" +#endif +#include "objbase.h" +#include "ole2.h" +#include "winerror.h" -#include +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); /****************************************************************************** * HGLOBALLockBytesImpl definition. @@ -26,7 +56,7 @@ struct HGLOBALLockBytesImpl { /* - * Needs to be the first item in the stuct + * Needs to be the first item in the stuct * since we want to cast this in an ILockBytes pointer */ ICOM_VFIELD(ILockBytes); @@ -132,7 +162,7 @@ static ICOM_VTABLE(ILockBytes) HGLOBALLockBytesImpl_Vtbl = }; /****************************************************************************** - * CreateILockBytesOnHGlobal [OLE32.57] + * CreateILockBytesOnHGlobal [OLE32.@] */ HRESULT WINAPI CreateILockBytesOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, @@ -153,20 +183,43 @@ HRESULT WINAPI CreateILockBytesOnHGlobal(HGLOBAL hGlobal, } /****************************************************************************** - * GetHGlobalFromILockBytes [OLE32.70] + * GetHGlobalFromILockBytes [OLE32.@] */ HRESULT WINAPI GetHGlobalFromILockBytes(ILockBytes* plkbyt, HGLOBAL* phglobal) { HGLOBALLockBytesImpl* const pMemLockBytes = (HGLOBALLockBytesImpl*)plkbyt; + STATSTG stbuf; + HRESULT hres; + ULARGE_INTEGER start; + ULONG xread; - if (ICOM_VTBL(pMemLockBytes) == &HGLOBALLockBytesImpl_Vtbl) + *phglobal = 0; + if (pMemLockBytes->lpVtbl == &HGLOBALLockBytesImpl_Vtbl) { *phglobal = pMemLockBytes->supportHandle; - else - *phglobal = 0; - - if (*phglobal == 0) + if (*phglobal == 0) + return E_INVALIDARG; + return S_OK; + } + /* It is not our lockbytes implementation, so use a more generic way */ + hres = ILockBytes_Stat(plkbyt,&stbuf,0); + if (hres != S_OK) { + ERR("Cannot ILockBytes_Stat, %lx\n",hres); + return hres; + } + FIXME("cbSize is %ld\n",stbuf.cbSize.u.LowPart); + *phglobal = GlobalAlloc( GMEM_MOVEABLE|GMEM_SHARE, stbuf.cbSize.u.LowPart); + if (!*phglobal) return E_INVALIDARG; - + memset(&start,0,sizeof(start)); + hres = ILockBytes_ReadAt(plkbyt, start, GlobalLock(*phglobal), stbuf.cbSize.u.LowPart, &xread); + GlobalUnlock(*phglobal); + if (hres != S_OK) { + FIXME("%p->ReadAt failed with %lx\n",plkbyt,hres); + return hres; + } + if (stbuf.cbSize.u.LowPart != xread) { + FIXME("Read size is not requested size %ld vs %ld?\n",stbuf.cbSize.u.LowPart, xread); + } return S_OK; } @@ -189,15 +242,15 @@ HGLOBALLockBytesImpl* HGLOBALLockBytesImpl_Construct(HGLOBAL hGlobal, { HGLOBALLockBytesImpl* newLockBytes; newLockBytes = HeapAlloc(GetProcessHeap(), 0, sizeof(HGLOBALLockBytesImpl)); - + if (newLockBytes!=0) { /* * Set up the virtual function table and reference count. */ - ICOM_VTBL(newLockBytes) = &HGLOBALLockBytesImpl_Vtbl; + newLockBytes->lpVtbl = &HGLOBALLockBytesImpl_Vtbl; newLockBytes->ref = 0; - + /* * Initialize the support. */ @@ -295,7 +348,7 @@ HRESULT WINAPI HGLOBALLockBytesImpl_QueryInterface( */ HGLOBALLockBytesImpl_AddRef(iface); - return S_OK;; + return S_OK; } /****************************************************************************** @@ -399,7 +452,7 @@ HRESULT WINAPI HGLOBALLockBytesImpl_ReadAt( /* * The function returns S_OK if the specified number of bytes were read * or the end of the array was reached. - * It returns STG_E_READFAULT if the number of bytes to read does not equal + * It returns STG_E_READFAULT if the number of bytes to read does not equal * the number of bytes actually read. */ if(*pcbRead == cb) @@ -498,28 +551,28 @@ HRESULT WINAPI HGLOBALLockBytesImpl_SetSize( ULARGE_INTEGER libNewSize) /* [in] */ { HGLOBALLockBytesImpl* const This=(HGLOBALLockBytesImpl*)iface; + HGLOBAL supportHandle; /* * As documented. */ if (libNewSize.u.HighPart != 0) return STG_E_INVALIDFUNCTION; - + if (This->byteArraySize.u.LowPart == libNewSize.u.LowPart) return S_OK; /* * Re allocate the HGlobal to fit the new size of the stream. */ - This->supportHandle = GlobalReAlloc(This->supportHandle, - libNewSize.u.LowPart, - 0); + supportHandle = GlobalReAlloc(This->supportHandle, libNewSize.u.LowPart, 0); - if (This->supportHandle == 0) + if (supportHandle == 0) return STG_E_MEDIUMFULL; + This->supportHandle = supportHandle; This->byteArraySize.u.LowPart = libNewSize.u.LowPart; - + return S_OK; } @@ -578,4 +631,3 @@ HRESULT WINAPI HGLOBALLockBytesImpl_Stat( return S_OK; } - diff --git a/reactos/lib/ole32/moniker.c b/reactos/lib/ole32/moniker.c index 0b77f1022ee..01640e8fbc6 100644 --- a/reactos/lib/ole32/moniker.c +++ b/reactos/lib/ole32/moniker.c @@ -3,18 +3,44 @@ * * Copyright 1998 Marcus Meissner * Copyright 1999 Noomen Hamza + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include +#include #include -#include -#include -#include -#include -#include +#include "winerror.h" +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "wtypes.h" +#include "wine/debug.h" +#include "ole2.h" +#ifdef __REACTOS__ +#include +BOOL WINAPI IsValidInterface(LPUNKNOWN punk); +#endif -#include +#include "compobj_private.h" +WINE_DEFAULT_DEBUG_CHANNEL(ole); #define BLOCK_TAB_SIZE 20 /* represent the first size table and it's increment block size */ @@ -38,7 +64,7 @@ typedef struct RunningObjectTableImpl{ DWORD runObjTabSize; /* current table size */ DWORD runObjTabLastIndx; /* first free index element in the table. */ DWORD runObjTabRegister; /* registration key of the next registered object */ - + } RunningObjectTableImpl; RunningObjectTableImpl* runningObjectTableInstance=0; @@ -85,7 +111,7 @@ HRESULT WINAPI RunningObjectTableImpl_QueryInterface(IRunningObjectTable* iface, { ICOM_THIS(RunningObjectTableImpl,iface); - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,riid,ppvObject)); + TRACE("(%p,%p,%p)\n",This,riid,ppvObject); /* validate arguments */ if (This==0) @@ -117,7 +143,7 @@ ULONG WINAPI RunningObjectTableImpl_AddRef(IRunningObjectTable* iface) { ICOM_THIS(RunningObjectTableImpl,iface); - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); return ++(This->ref); } @@ -127,8 +153,8 @@ ULONG WINAPI RunningObjectTableImpl_AddRef(IRunningObjectTable* iface) */ HRESULT WINAPI RunningObjectTableImpl_Destroy() { - Print(MAX_TRACE, ("()\n")); - + TRACE("()\n"); + if (runningObjectTableInstance==NULL) return E_INVALIDARG; @@ -149,7 +175,7 @@ ULONG WINAPI RunningObjectTableImpl_Release(IRunningObjectTable* iface) DWORD i; ICOM_THIS(RunningObjectTableImpl,iface); - Print(MAX_TRACE, ("(%p)\n",This)); + TRACE("(%p)\n",This); This->ref--; @@ -161,7 +187,7 @@ ULONG WINAPI RunningObjectTableImpl_Release(IRunningObjectTable* iface) { if (( This->runObjTab[i].regTypeObj & ROTFLAGS_REGISTRATIONKEEPSALIVE) != 0) IUnknown_Release(This->runObjTab[i].pObj); - + IMoniker_Release(This->runObjTab[i].pmkObj); } /* RunningObjectTable data structure will be not destroyed here ! the destruction will be done only @@ -183,7 +209,7 @@ ULONG WINAPI RunningObjectTableImpl_Release(IRunningObjectTable* iface) */ HRESULT WINAPI RunningObjectTableImpl_Initialize() { - Print(MAX_TRACE, ("()\n")); + TRACE("()\n"); /* create the unique instance of the RunningObjectTableImpl structure */ runningObjectTableInstance = HeapAlloc(GetProcessHeap(), 0, sizeof(RunningObjectTableImpl)); @@ -192,10 +218,10 @@ HRESULT WINAPI RunningObjectTableImpl_Initialize() return E_OUTOFMEMORY; /* initialize the virtual table function */ - ICOM_VTBL(runningObjectTableInstance) = &VT_RunningObjectTableImpl; + runningObjectTableInstance->lpVtbl = &VT_RunningObjectTableImpl; /* the initial reference is set to "1" ! because if set to "0" it will be not practis when */ - /* the ROT refered many times not in the same time (all the objects in the ROT will */ + /* the ROT referred many times not in the same time (all the objects in the ROT will */ /* be removed every time the ROT is removed ) */ runningObjectTableInstance->ref = 1; @@ -217,11 +243,11 @@ HRESULT WINAPI RunningObjectTableImpl_Initialize() */ HRESULT WINAPI RunningObjectTableImpl_UnInitialize() { - Print(MAX_TRACE, ("()\n")); + TRACE("()\n"); if (runningObjectTableInstance==NULL) return E_POINTER; - + RunningObjectTableImpl_Release((IRunningObjectTable*)runningObjectTableInstance); RunningObjectTableImpl_Destroy(); @@ -241,7 +267,7 @@ HRESULT WINAPI RunningObjectTableImpl_Register(IRunningObjectTable* iface, HRESULT res=S_OK; ICOM_THIS(RunningObjectTableImpl,iface); - Print(MAX_TRACE, ("(%p,%ld,%p,%p,%p)\n",This,grfFlags,punkObject,pmkObjectName,pdwRegister)); + TRACE("(%p,%ld,%p,%p,%p)\n",This,grfFlags,punkObject,pmkObjectName,pdwRegister); /* there's only two types of register : strong and or weak registration (only one must be passed on parameter) */ if ( ( (grfFlags & ROTFLAGS_REGISTRATIONKEEPSALIVE) || !(grfFlags & ROTFLAGS_ALLOWANYCLIENT)) && @@ -262,18 +288,18 @@ HRESULT WINAPI RunningObjectTableImpl_Register(IRunningObjectTable* iface, This->runObjTab[This->runObjTabLastIndx].regTypeObj = grfFlags; This->runObjTab[This->runObjTabLastIndx].identRegObj = This->runObjTabRegister; CoFileTimeNow(&(This->runObjTab[This->runObjTabLastIndx].lastModifObj)); - + /* gives a registration identifier to the registered object*/ (*pdwRegister)= This->runObjTabRegister; if (This->runObjTabRegister == 0xFFFFFFFF){ - Print(MIN_TRACE, ("runObjTabRegister: %ld is out of data limite \n",This->runObjTabRegister)); + FIXME("runObjTabRegister: %ld is out of data limite \n",This->runObjTabRegister); return E_FAIL; -} + } This->runObjTabRegister++; This->runObjTabLastIndx++; - + if (This->runObjTabLastIndx == This->runObjTabSize){ /* table is full ! so it must be resized */ This->runObjTabSize+=BLOCK_TAB_SIZE; /* newsize table */ @@ -287,7 +313,7 @@ HRESULT WINAPI RunningObjectTableImpl_Register(IRunningObjectTable* iface, IUnknown_AddRef(punkObject); IMoniker_AddRef(pmkObjectName); - + return res; } @@ -301,7 +327,7 @@ HRESULT WINAPI RunningObjectTableImpl_Revoke( IRunningObjectTable* iface, DWORD index,j; ICOM_THIS(RunningObjectTableImpl,iface); - Print(MAX_TRACE, ("(%p,%ld)\n",This,dwRegister)); + TRACE("(%p,%ld)\n",This,dwRegister); /* verify if the object to be revoked was registered before or not */ if (RunningObjectTableImpl_GetObjectIndex(This,dwRegister,NULL,&index)==S_FALSE) @@ -313,11 +339,11 @@ HRESULT WINAPI RunningObjectTableImpl_Revoke( IRunningObjectTable* iface, IUnknown_Release(This->runObjTab[index].pObj); IMoniker_Release(This->runObjTab[index].pmkObj); - + /* remove the object from the table */ for(j=index; jrunObjTabLastIndx-1; j++) This->runObjTab[j]= This->runObjTab[j+1]; - + This->runObjTabLastIndx--; return S_OK; @@ -328,10 +354,10 @@ HRESULT WINAPI RunningObjectTableImpl_Revoke( IRunningObjectTable* iface, */ HRESULT WINAPI RunningObjectTableImpl_IsRunning( IRunningObjectTable* iface, IMoniker *pmkObjectName) /* Pointer to the moniker of the object whose status is desired */ -{ +{ ICOM_THIS(RunningObjectTableImpl,iface); - Print(MAX_TRACE, ("(%p,%p)\n",This,pmkObjectName)); + TRACE("(%p,%p)\n",This,pmkObjectName); return RunningObjectTableImpl_GetObjectIndex(This,-1,pmkObjectName,NULL); } @@ -346,11 +372,11 @@ HRESULT WINAPI RunningObjectTableImpl_GetObject( IRunningObjectTable* iface, DWORD index; ICOM_THIS(RunningObjectTableImpl,iface); - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,pmkObjectName,ppunkObject)); + TRACE("(%p,%p,%p)\n",This,pmkObjectName,ppunkObject); if (ppunkObject==NULL) return E_POINTER; - + *ppunkObject=0; /* verify if the object was registered before or not */ @@ -374,7 +400,7 @@ HRESULT WINAPI RunningObjectTableImpl_NoteChangeTime(IRunningObjectTable* iface, DWORD index=-1; ICOM_THIS(RunningObjectTableImpl,iface); - Print(MAX_TRACE, ("(%p,%ld,%p)\n",This,dwRegister,pfiletime)); + TRACE("(%p,%ld,%p)\n",This,dwRegister,pfiletime); /* verify if the object to be changed was registered before or not */ if (RunningObjectTableImpl_GetObjectIndex(This,dwRegister,NULL,&index)==S_FALSE) @@ -385,7 +411,7 @@ HRESULT WINAPI RunningObjectTableImpl_NoteChangeTime(IRunningObjectTable* iface, return S_OK; } - + /*********************************************************************** * RunningObjectTable_GetTimeOfLastChange */ @@ -396,14 +422,14 @@ HRESULT WINAPI RunningObjectTableImpl_GetTimeOfLastChange(IRunningObjectTable* i DWORD index=-1; ICOM_THIS(RunningObjectTableImpl,iface); - Print(MAX_TRACE, ("(%p,%p,%p)\n",This,pmkObjectName,pfiletime)); + TRACE("(%p,%p,%p)\n",This,pmkObjectName,pfiletime); if (pmkObjectName==NULL || pfiletime==NULL) return E_INVALIDARG; /* verify if the object was registered before or not */ if (RunningObjectTableImpl_GetObjectIndex(This,-1,pmkObjectName,&index)==S_FALSE) - return MK_E_UNAVAILABLE;; + return MK_E_UNAVAILABLE; (*pfiletime)= This->runObjTab[index].lastModifObj; @@ -416,7 +442,7 @@ HRESULT WINAPI RunningObjectTableImpl_GetTimeOfLastChange(IRunningObjectTable* i HRESULT WINAPI RunningObjectTableImpl_EnumRunning(IRunningObjectTable* iface, IEnumMoniker **ppenumMoniker) /* Address of output variable that receives the IEnumMoniker interface pointer */ { - UNIMPLEMENTED; + FIXME("(%p,%p) needs the IEnumMoniker implementation \n",iface,ppenumMoniker); return E_NOTIMPL; } @@ -431,7 +457,7 @@ HRESULT WINAPI RunningObjectTableImpl_GetObjectIndex(RunningObjectTableImpl* Thi DWORD i; - Print(MAX_TRACE, ("(%p,%ld,%p,%p)\n",This,identReg,pmk,indx)); + TRACE("(%p,%ld,%p,%p)\n",This,identReg,pmk,indx); if (pmk!=NULL) /* search object identified by a moniker */ @@ -439,7 +465,7 @@ HRESULT WINAPI RunningObjectTableImpl_GetObjectIndex(RunningObjectTableImpl* Thi else /* search object identified by a register identifier */ for(i=0;((irunObjTabLastIndx)&&(This->runObjTab[i].identRegObj!=identReg));i++); - + if (i==This->runObjTabLastIndx) return S_FALSE; if (indx != NULL) *indx=i; @@ -448,23 +474,23 @@ HRESULT WINAPI RunningObjectTableImpl_GetObjectIndex(RunningObjectTableImpl* Thi } /****************************************************************************** - * GetRunningObjectTable16 [OLE2.30] + * GetRunningObjectTable [OLE2.@] */ HRESULT WINAPI GetRunningObjectTable16(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot) { - UNIMPLEMENTED; + FIXME("(%ld,%p),stub!\n",reserved,pprot); return E_NOTIMPL; } /*********************************************************************** - * GetRunningObjectTable (OLE2.73) + * GetRunningObjectTable (OLE32.@) */ HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot) { IID riid=IID_IRunningObjectTable; HRESULT res; - Print(MAX_TRACE, ("()\n")); + TRACE("()\n"); if (reserved!=0) return E_UNEXPECTED; @@ -478,7 +504,7 @@ HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot } /****************************************************************************** - * OleRun [OLE32.123] + * OleRun [OLE32.@] */ HRESULT WINAPI OleRun(LPUNKNOWN pUnknown) { @@ -487,7 +513,7 @@ HRESULT WINAPI OleRun(LPUNKNOWN pUnknown) LRESULT ret; ret = IRunnableObject_QueryInterface(This,&IID_IRunnableObject,(LPVOID*)&runable); - if (ret) + if (ret) return 0; /* Appears to return no error. */ ret = IRunnableObject_Run(runable,NULL); IRunnableObject_Release(runable); @@ -495,14 +521,25 @@ HRESULT WINAPI OleRun(LPUNKNOWN pUnknown) } /****************************************************************************** - * MkParseDisplayName [OLE32.81] + * MkParseDisplayName [OLE32.@] */ HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szUserName, LPDWORD pchEaten, LPMONIKER *ppmk) { - Print(MIN_TRACE, ("(%p, %S, %p, %p): stub.\n", pbc, szUserName, pchEaten, *ppmk)); + FIXME("(%p, %s, %p, %p): stub.\n", pbc, debugstr_w(szUserName), pchEaten, *ppmk); if (!(IsValidInterface((LPUNKNOWN) pbc))) return E_INVALIDARG; return MK_E_SYNTAX; } + +/****************************************************************************** + * CreateClassMoniker [OLE32.*] + */ + HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker ** ppmk) + { + FIXME("%s\n", debugstr_guid( rclsid )); + if( ppmk ) + *ppmk = NULL; + return E_NOTIMPL; + } diff --git a/reactos/lib/ole32/moniker.h b/reactos/lib/ole32/moniker.h new file mode 100644 index 00000000000..8e4c6ca3ce8 --- /dev/null +++ b/reactos/lib/ole32/moniker.h @@ -0,0 +1,11 @@ +#ifndef __WINE_MONIKER_H__ +#define __WINE_MONIKER_H__ + +#define ICOM_THIS_From_IROTData(class, name) class* This = (class*)(((char*)name)-sizeof(void*)) + +extern const CLSID CLSID_FileMoniker; +extern const CLSID CLSID_ItemMoniker; +extern const CLSID CLSID_AntiMoniker; +extern const CLSID CLSID_CompositeMoniker; + +#endif /* __WINE_MONIKER_H__ */ diff --git a/reactos/lib/ole32/nodrop.cur b/reactos/lib/ole32/nodrop.cur new file mode 100644 index 00000000000..a299255d662 Binary files /dev/null and b/reactos/lib/ole32/nodrop.cur differ diff --git a/reactos/lib/ole32/ole2.c b/reactos/lib/ole32/ole2.c index 29e941b803b..a0c75ff819b 100644 --- a/reactos/lib/ole32/ole2.c +++ b/reactos/lib/ole32/ole2.c @@ -3,25 +3,67 @@ * * Copyright 1995 Martin von Loewis * Copyright 1999 Francis Beaudet - * Copyright 1999 Noel Borthwick + * Copyright 1999 Noel Borthwick + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include "config.h" + +#include #include +#include +#include #include -#include -#include -#include -#include +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "wingdi.h" +#include "winuser.h" +#include "winnls.h" +#include "winreg.h" +#include "commctrl.h" +#include "ole2.h" +#include "ole2ver.h" +#ifndef __REACTOS__ +#include "wownt32.h" +#else +BOOL WINAPI IsValidInterface(LPUNKNOWN punk); +#endif + +#ifndef __REACTOS__ +#include "wine/winbase16.h" +#include "wine/wingdi16.h" +#include "wine/winuser16.h" +#endif #include "ole32_main.h" -#include +#include "wine/debug.h" -#if 0 +WINE_DEFAULT_DEBUG_CHANNEL(ole); +WINE_DECLARE_DEBUG_CHANNEL(accel); + +#define HICON_16(h32) (LOWORD(h32)) +#define HICON_32(h16) ((HICON)(ULONG_PTR)(h16)) +#define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16)) /****************************************************************************** - * These are static/global variables and internal data structures that the + * These are static/global variables and internal data structures that the * OLE module uses to maintain it's state. */ typedef struct tagDropTargetNode @@ -42,7 +84,8 @@ typedef struct tagTrackerWindowInfo HRESULT returnValue; BOOL escPressed; - HWND curDragTargetHWND; + HWND curTargetHWND; /* window the mouse is hovering over */ + HWND curDragTargetHWND; /* might be a ancestor of curTargetHWND */ IDropTarget* curDragTarget; } TrackerWindowInfo; @@ -83,7 +126,7 @@ static const char OLEDD_DRAGTRACKERCLASS[] = "WineDragDropTracker32"; static DropTargetNode* targetListHead = NULL; /****************************************************************************** - * These are the prototypes of miscelaneous utility methods + * These are the prototypes of miscelaneous utility methods */ static void OLEUTL_ReadRegistryDWORDValue(HKEY regKey, DWORD* pdwValue); @@ -118,9 +161,9 @@ static DropTargetNode* OLEDD_ExtractDropTarget( static DropTargetNode* OLEDD_FindDropTarget( HWND hwndOfTarget); static LRESULT WINAPI OLEDD_DragTrackerWindowProc( - HWND hwnd, + HWND hwnd, UINT uMsg, - WPARAM wParam, + WPARAM wParam, LPARAM lParam); static void OLEDD_TrackMouseMove( TrackerWindowInfo* trackerInfo, @@ -135,21 +178,23 @@ static DWORD OLEDD_GetButtonState(); /****************************************************************************** * OleBuildVersion [OLE2.1] + * OleBuildVersion [OLE32.@] */ DWORD WINAPI OleBuildVersion(void) { - Print(MAX_TRACE, ("Returning version %d, build %d.\n", 1, 0)); - return (1<<16)+0; + TRACE("Returning version %d, build %d.\n", rmm, rup); + return (rmm<<16)+rup; } /*********************************************************************** - * OleInitialize (OLE2.2) (OLE32.108) + * OleInitialize (OLE2.2) + * OleInitialize (OLE32.@) */ HRESULT WINAPI OleInitialize(LPVOID reserved) { HRESULT hr; - Print(MAX_TRACE, ("(%p)\n", reserved)); + TRACE("(%p)\n", reserved); /* * The first duty of the OleInitialize is to initialize the COM libraries. @@ -157,11 +202,11 @@ HRESULT WINAPI OleInitialize(LPVOID reserved) hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); /* - * If the CoInitializeEx call failed, the OLE libraries can't be + * If the CoInitializeEx call failed, the OLE libraries can't be * initialized. */ if (FAILED(hr)) - return hr; + return hr; /* * Then, it has to initialize the OLE specific modules. @@ -172,11 +217,11 @@ HRESULT WINAPI OleInitialize(LPVOID reserved) * In-place activation */ if (OLE_moduleLockCount==0) -{ - /* + { + /* * Initialize the libraries. */ - Print(MAX_TRACE, ("() - Initializing the OLE libraries\n")); + TRACE("() - Initializing the OLE libraries\n"); /* * OLE Clipboard @@ -192,18 +237,19 @@ HRESULT WINAPI OleInitialize(LPVOID reserved) * OLE shared menu */ OLEMenu_Initialize(); -} + } /* * Then, we increase the lock count on the OLE module. */ - OLE_moduleLockCount++; + OLE_moduleLockCount++; return hr; } /****************************************************************************** - * CoGetCurrentProcess [COMPOBJ.34] [OLE2.2][OLE32.108] + * CoGetCurrentProcess [COMPOBJ.34] + * CoGetCurrentProcess [OLE32.@] * * NOTES * Is DWORD really the correct return type for this function? @@ -214,11 +260,12 @@ DWORD WINAPI CoGetCurrentProcess(void) } /****************************************************************************** - * OleUninitialize [OLE2.3] [OLE32.131] + * OleUninitialize [OLE2.3] + * OleUninitialize [OLE32.@] */ void WINAPI OleUninitialize(void) { - Print(MAX_TRACE, ("()\n")); + TRACE("()\n"); /* * Decrease the lock count on the OLE module. @@ -233,7 +280,7 @@ void WINAPI OleUninitialize(void) /* * Actually free the libraries. */ - Print(MAX_TRACE, ("() - Freeing the last reference count\n")); + TRACE("() - Freeing the last reference count\n"); /* * OLE Clipboard @@ -244,13 +291,13 @@ void WINAPI OleUninitialize(void) * Drag and Drop */ OLEDD_UnInitialize(); - + /* * OLE shared menu */ OLEMenu_UnInitialize(); } - + /* * Then, uninitialize the COM libraries. */ @@ -258,13 +305,13 @@ void WINAPI OleUninitialize(void) } /****************************************************************************** - * CoRegisterMessageFilter [OLE32.38] + * CoRegisterMessageFilter [OLE32.@] */ HRESULT WINAPI CoRegisterMessageFilter( LPMESSAGEFILTER lpMessageFilter, /* [in] Pointer to interface */ LPMESSAGEFILTER *lplpMessageFilter /* [out] Indirect pointer to prior instance if non-NULL */ ) { - Print(MIN_TRACE, ("stub\n")); + FIXME("stub\n"); if (lplpMessageFilter) { *lplpMessageFilter = NULL; } @@ -272,34 +319,23 @@ HRESULT WINAPI CoRegisterMessageFilter( } /****************************************************************************** - * OleInitializeWOW [OLE32.109] + * OleInitializeWOW [OLE32.@] */ HRESULT WINAPI OleInitializeWOW(DWORD x) { - Print(MIN_TRACE, ("(0x%08lx),stub!\n",x)); + FIXME("(0x%08lx),stub!\n",x); return 0; } /*********************************************************************** - * RegisterDragDrop16 (OLE2.35) - */ -HRESULT WINAPI RegisterDragDrop16( - DWORD hwnd, - LPDROPTARGET pDropTarget -) { - UNIMPLEMENTED; - return S_OK; -} - -/*********************************************************************** - * RegisterDragDrop (OLE32.139) + * RegisterDragDrop (OLE32.@) */ HRESULT WINAPI RegisterDragDrop( HWND hwnd, - LPDROPTARGET pDropTarget) + LPDROPTARGET pDropTarget) { DropTargetNode* dropTargetInfo; - Print(MAX_TRACE, ("(0x%x,%p)\n", hwnd, pDropTarget)); + TRACE("(%p,%p)\n", hwnd, pDropTarget); /* * First, check if the window is already registered. @@ -327,31 +363,21 @@ HRESULT WINAPI RegisterDragDrop( */ dropTargetInfo->dropTarget = pDropTarget; IDropTarget_AddRef(dropTargetInfo->dropTarget); - + OLEDD_InsertDropTarget(dropTargetInfo); return S_OK; } /*********************************************************************** - * RevokeDragDrop16 (OLE2.36) - */ -HRESULT WINAPI RevokeDragDrop16( - DWORD hwnd -) { - UNIMPLEMENTED; - return S_OK; -} - -/*********************************************************************** - * RevokeDragDrop (OLE32.141) + * RevokeDragDrop (OLE32.@) */ HRESULT WINAPI RevokeDragDrop( HWND hwnd) { DropTargetNode* dropTargetInfo; - Print(MAX_TRACE, ("(0x%x)\n", hwnd)); + TRACE("(%p)\n", hwnd); /* * First, check if the window is already registered. @@ -369,21 +395,21 @@ HRESULT WINAPI RevokeDragDrop( * references */ IDropTarget_Release(dropTargetInfo->dropTarget); - HeapFree(GetProcessHeap(), 0, dropTargetInfo); + HeapFree(GetProcessHeap(), 0, dropTargetInfo); return S_OK; } /*********************************************************************** - * OleRegGetUserType (OLE32.122) + * OleRegGetUserType (OLE32.@) * * This implementation of OleRegGetUserType ignores the dwFormOfType * parameter and always returns the full name of the object. This is * not too bad since this is the case for many objects because of the * way they are registered. */ -HRESULT WINAPI OleRegGetUserType( - REFCLSID clsid, +HRESULT WINAPI OleRegGetUserType( + REFCLSID clsid, DWORD dwFormOfType, LPOLESTR* pszUserType) { @@ -407,7 +433,7 @@ HRESULT WINAPI OleRegGetUserType( clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3], clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] ); - Print(MAX_TRACE, ("(%s, %ld, %p)\n", keyName, dwFormOfType, pszUserType)); + TRACE("(%s, %ld, %p)\n", keyName, dwFormOfType, pszUserType); /* * Open the class id Key @@ -467,7 +493,7 @@ HRESULT WINAPI OleRegGetUserType( RegCloseKey(clsidKey); - + if (hres!=ERROR_SUCCESS) { CoTaskMemFree(*pszUserType); @@ -486,7 +512,7 @@ HRESULT WINAPI OleRegGetUserType( } /*********************************************************************** - * DoDragDrop [OLE32.65] + * DoDragDrop [OLE32.@] */ HRESULT WINAPI DoDragDrop ( IDataObject *pDataObject, /* [in] ptr to the data obj */ @@ -498,11 +524,14 @@ HRESULT WINAPI DoDragDrop ( HWND hwndTrackWindow; MSG msg; - Print(MAX_TRACE, ("(DataObject %p, DropSource %p)\n", pDataObject, pDropSource)); + TRACE("(DataObject %p, DropSource %p)\n", pDataObject, pDropSource); /* * Setup the drag n drop tracking window. */ + if (!IsValidInterface((LPUNKNOWN)pDropSource)) + return E_INVALIDARG; + trackerInfo.dataObject = pDataObject; trackerInfo.dropSource = pDropSource; trackerInfo.dwOKEffect = dwOKEffect; @@ -510,6 +539,7 @@ HRESULT WINAPI DoDragDrop ( trackerInfo.trackingDone = FALSE; trackerInfo.escPressed = FALSE; trackerInfo.curDragTargetHWND = 0; + trackerInfo.curTargetHWND = 0; trackerInfo.curDragTarget = 0; hwndTrackWindow = CreateWindowA(OLEDD_DRAGTRACKERCLASS, @@ -534,7 +564,7 @@ HRESULT WINAPI DoDragDrop ( */ while (!trackerInfo.trackingDone && GetMessageA(&msg, 0, 0, 0) ) { - if ( (msg.message >= WM_KEYFIRST) && + if ( (msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST) ) { /* @@ -551,7 +581,7 @@ HRESULT WINAPI DoDragDrop ( /* * Notify the drop source. - */ + */ OLEDD_TrackStateChange(&trackerInfo, msg.pt, OLEDD_GetButtonState()); @@ -577,17 +607,17 @@ HRESULT WINAPI DoDragDrop ( } /*********************************************************************** - * OleQueryLinkFromData [OLE32.118] + * OleQueryLinkFromData [OLE32.@] */ HRESULT WINAPI OleQueryLinkFromData( IDataObject* pSrcDataObject) { - Print(MIN_TRACE, ("(%p),stub!\n", pSrcDataObject)); + FIXME("(%p),stub!\n", pSrcDataObject); return S_OK; } /*********************************************************************** - * OleRegGetMiscStatus [OLE32.121] + * OleRegGetMiscStatus [OLE32.@] */ HRESULT WINAPI OleRegGetMiscStatus( REFCLSID clsid, @@ -613,7 +643,7 @@ HRESULT WINAPI OleRegGetMiscStatus( clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3], clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] ); - Print(MAX_TRACE, ("(%s, %ld, %p)\n", keyName, dwAspect, pdwStatus)); + TRACE("(%s, %ld, %p)\n", keyName, dwAspect, pdwStatus); /* * Open the class id Key @@ -632,7 +662,7 @@ HRESULT WINAPI OleRegGetMiscStatus( "MiscStatus", &miscStatusKey); - + if (result != ERROR_SUCCESS) { RegCloseKey(clsidKey); @@ -652,7 +682,7 @@ HRESULT WINAPI OleRegGetMiscStatus( result = RegOpenKeyA(miscStatusKey, keyName, &aspectKey); - + if (result == ERROR_SUCCESS) { OLEUTL_ReadRegistryDWORDValue(aspectKey, pdwStatus); @@ -669,16 +699,16 @@ HRESULT WINAPI OleRegGetMiscStatus( } /****************************************************************************** - * OleSetContainedObject [OLE32.128] + * OleSetContainedObject [OLE32.@] */ HRESULT WINAPI OleSetContainedObject( - LPUNKNOWN pUnknown, + LPUNKNOWN pUnknown, BOOL fContained) { IRunnableObject* runnable = NULL; HRESULT hres; - Print(MAX_TRACE, ("(%p,%x), stub!\n", pUnknown, fContained)); + TRACE("(%p,%x), stub!\n", pUnknown, fContained); hres = IUnknown_QueryInterface(pUnknown, &IID_IRunnableObject, @@ -697,12 +727,12 @@ HRESULT WINAPI OleSetContainedObject( } /****************************************************************************** - * OleLoad [OLE32.112] + * OleLoad [OLE32.@] */ HRESULT WINAPI OleLoad( - LPSTORAGE pStg, - REFIID riid, - LPOLECLIENTSITE pClientSite, + LPSTORAGE pStg, + REFIID riid, + LPOLECLIENTSITE pClientSite, LPVOID* ppvObj) { IPersistStorage* persistStorage = NULL; @@ -710,8 +740,8 @@ HRESULT WINAPI OleLoad( STATSTG storageInfo; HRESULT hres; - Print(MAX_TRACE, ("(%p,%p,%p,%p)\n", pStg, riid, pClientSite, ppvObj)); - + TRACE("(%p,%p,%p,%p)\n", pStg, riid, pClientSite, ppvObj); + /* * TODO, Conversion ... OleDoAutoConvert */ @@ -760,7 +790,7 @@ HRESULT WINAPI OleLoad( &IID_IPersistStorage, (void**)&persistStorage); - if (SUCCEEDED(hres)) + if (SUCCEEDED(hres)) { IPersistStorage_Load(persistStorage, pStg); @@ -782,7 +812,7 @@ HRESULT WINAPI OleLoad( } /*********************************************************************** - * OleSave [OLE32.124] + * OleSave [OLE32.@] */ HRESULT WINAPI OleSave( LPPERSISTSTORAGE pPS, @@ -792,7 +822,7 @@ HRESULT WINAPI OleSave( HRESULT hres; CLSID objectClass; - Print(MAX_TRACE, ("(%p,%p,%x)\n", pPS, pStg, fSameAsLoad)); + TRACE("(%p,%p,%x)\n", pPS, pStg, fSameAsLoad); /* * First, we transfer the class ID (if available) @@ -815,20 +845,20 @@ HRESULT WINAPI OleSave( IStorage_Commit(pStg, STGC_DEFAULT); } - + return hres; } /****************************************************************************** - * OleLockRunning [OLE32.114] + * OleLockRunning [OLE32.@] */ -HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses) +HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses) { IRunnableObject* runnable = NULL; HRESULT hres; - Print(MAX_TRACE, ("(%p,%x,%x)\n", pUnknown, fLock, fLastUnlockCloses)); + TRACE("(%p,%x,%x)\n", pUnknown, fLock, fLastUnlockCloses); hres = IUnknown_QueryInterface(pUnknown, &IID_IRunnableObject, @@ -874,7 +904,7 @@ static void OLEMenu_UnInitialize() * OLEMenu_InstallHooks * Install thread scope message hooks for WH_GETMESSAGE and WH_CALLWNDPROC * - * RETURNS: TRUE if message hooks were succesfully installed + * RETURNS: TRUE if message hooks were successfully installed * FALSE on failure */ BOOL OLEMenu_InstallHooks( DWORD tid ) @@ -888,7 +918,7 @@ BOOL OLEMenu_InstallHooks( DWORD tid ) pHookItem->tid = tid; pHookItem->hHeap = GetProcessHeap(); - + /* Install a thread scope message hook for WH_GETMESSAGE */ pHookItem->GetMsg_hHook = SetWindowsHookExA( WH_GETMESSAGE, OLEMenu_GetMsgProc, 0, GetCurrentThreadId() ); @@ -904,9 +934,9 @@ BOOL OLEMenu_InstallHooks( DWORD tid ) /* Insert the hook table entry */ pHookItem->next = hook_list; hook_list = pHookItem; - + return TRUE; - + CLEANUP: /* Unhook any hooks */ if ( pHookItem->GetMsg_hHook ) @@ -915,7 +945,7 @@ CLEANUP: UnhookWindowsHookEx( pHookItem->CallWndProc_hHook ); /* Release the hook table entry */ HeapFree(pHookItem->hHeap, 0, pHookItem ); - + return FALSE; } @@ -923,7 +953,7 @@ CLEANUP: * OLEMenu_UnInstallHooks * UnInstall thread scope message hooks for WH_GETMESSAGE and WH_CALLWNDPROC * - * RETURNS: TRUE if message hooks were succesfully installed + * RETURNS: TRUE if message hooks were successfully installed * FALSE on failure */ BOOL OLEMenu_UnInstallHooks( DWORD tid ) @@ -980,7 +1010,7 @@ OleMenuHookItem * OLEMenu_IsHookInstalled( DWORD tid ) if ( tid == pHookItem->tid ) return pHookItem; } - + return NULL; } @@ -1001,7 +1031,7 @@ static BOOL OLEMenu_FindMainMenuIndex( HMENU hMainMenu, HMENU hPopupMenu, UINT * for (i = 0; i < nItems; i++) { HMENU hsubmenu; - + /* Is the current item a submenu? */ if ( (hsubmenu = GetSubMenu(hMainMenu, i)) ) { @@ -1048,12 +1078,12 @@ BOOL OLEMenu_SetIsServerMenu( HMENU hmenu, OleMenuDescriptor *pOleMenuDescriptor /* Find the menu item index in the shared OLE menu that this item belongs to */ if ( !OLEMenu_FindMainMenuIndex( pOleMenuDescriptor->hmenuCombined, hmenu, &nPos ) ) return FALSE; - + /* The group widths array has counts for the number of elements * in the groups File, Edit, Container, Object, Window, Help. * The Edit, Object & Help groups belong to the server object * and the other three belong to the container. - * Loop thru the group widths and locate the group we are a member of. + * Loop through the group widths and locate the group we are a member of. */ for ( i = 0, nWidth = 0; i < 6; i++ ) { @@ -1076,19 +1106,18 @@ BOOL OLEMenu_SetIsServerMenu( HMENU hmenu, OleMenuDescriptor *pOleMenuDescriptor */ LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lParam) { -#if 0 LPCWPSTRUCT pMsg = NULL; HOLEMENU hOleMenu = 0; OleMenuDescriptor *pOleMenuDescriptor = NULL; OleMenuHookItem *pHookItem = NULL; WORD fuFlags; - - Print(MAX_TRACE, ("%i, %04x, %08x\n", code, wParam, (unsigned)lParam )); + + TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam ); /* Check if we're being asked to process the message */ if ( HC_ACTION != code ) goto NEXTHOOK; - + /* Retrieve the current message being dispatched from lParam */ pMsg = (LPCWPSTRUCT)lParam; @@ -1118,14 +1147,14 @@ LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lParam) pMsg->message, pMsg->wParam, pMsg->lParam ); goto NEXTHOOK; } - + case WM_INITMENUPOPUP: { /* Save the state for whether this is a server owned menu */ OLEMenu_SetIsServerMenu( (HMENU)pMsg->wParam, pOleMenuDescriptor ); break; } - + case WM_MENUSELECT: { fuFlags = HIWORD(pMsg->wParam); /* Get flags */ @@ -1138,7 +1167,7 @@ LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lParam) break; } - + case WM_DRAWITEM: { LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT) pMsg->lParam; @@ -1158,26 +1187,21 @@ LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lParam) SendMessageA( pOleMenuDescriptor->hwndActiveObject, pMsg->message, pMsg->wParam, pMsg->lParam ); } - + NEXTHOOK: if ( pOleMenuDescriptor ) GlobalUnlock( hOleMenu ); - + /* Lookup the hook item for the current thread */ if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) ) { /* This should never fail!! */ - Print(MID_TRACE, ("could not retrieve hHook for current thread!\n" )); + WARN("could not retrieve hHook for current thread!\n" ); return 0; } - + /* Pass on the message to the next hooker */ return CallNextHookEx( pHookItem->CallWndProc_hHook, code, wParam, lParam ); - -#else - UNIMPLEMENTED; - return 0; -#endif } /************************************************************************* @@ -1192,13 +1216,13 @@ LRESULT CALLBACK OLEMenu_GetMsgProc(INT code, WPARAM wParam, LPARAM lParam) OleMenuDescriptor *pOleMenuDescriptor = NULL; OleMenuHookItem *pHookItem = NULL; WORD wCode; - - Print(MAX_TRACE, ("%i, %04x, %08x\n", code, wParam, (unsigned)lParam )); + + TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam ); /* Check if we're being asked to process a messages */ if ( HC_ACTION != code ) goto NEXTHOOK; - + /* Retrieve the current message being dispatched from lParam */ pMsg = (LPMSG)lParam; @@ -1237,25 +1261,25 @@ LRESULT CALLBACK OLEMenu_GetMsgProc(INT code, WPARAM wParam, LPARAM lParam) * dispatch it to the embedded objects window. */ pMsg->hwnd = pOleMenuDescriptor->hwndActiveObject; } - + NEXTHOOK: if ( pOleMenuDescriptor ) GlobalUnlock( hOleMenu ); - + /* Lookup the hook item for the current thread */ if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) ) { /* This should never fail!! */ - Print(MID_TRACE, ("could not retrieve hHook for current thread!\n" )); + WARN("could not retrieve hHook for current thread!\n" ); return FALSE; } - + /* Pass on the message to the next hooker */ return CallNextHookEx( pHookItem->GetMsg_hHook, code, wParam, lParam ); } /*********************************************************************** - * OleCreateMenuDescriptor [OLE32.97] + * OleCreateMenuDescriptor [OLE32.@] * Creates an OLE menu descriptor for OLE to use when dispatching * menu messages and commands. * @@ -1287,16 +1311,16 @@ HOLEMENU WINAPI OleCreateMenuDescriptor( /* Initialize menu group widths and hmenu */ for ( i = 0; i < 6; i++ ) pOleMenuDescriptor->mgw.width[i] = lpMenuWidths->width[i]; - + pOleMenuDescriptor->hmenuCombined = hmenuCombined; pOleMenuDescriptor->bIsServerItem = FALSE; GlobalUnlock( hOleMenu ); - + return hOleMenu; } /*********************************************************************** - * OleDestroyMenuDescriptor [OLE32.99] + * OleDestroyMenuDescriptor [OLE32.@] * Destroy the shared menu descriptor */ HRESULT WINAPI OleDestroyMenuDescriptor( @@ -1308,12 +1332,12 @@ HRESULT WINAPI OleDestroyMenuDescriptor( } /*********************************************************************** - * OleSetMenuDescriptor [OLE32.129] + * OleSetMenuDescriptor [OLE32.@] * Installs or removes OLE dispatching code for the containers frame window * FIXME: The lpFrame and lpActiveObject parameters are currently ignored * OLE should install context sensitive help F1 filtering for the app when * these are non null. - * + * * PARAMS: * hOleMenu Handle to composite menu descriptor * hwndFrame Handle to containers frame window @@ -1340,12 +1364,12 @@ HRESULT WINAPI OleSetMenuDescriptor( if ( lpFrame || lpActiveObject ) { - Print(MIN_TRACE, ("(%x, %x, %x, %p, %p), Context sensitive help filtering not implemented!\n", + FIXME("(%x, %p, %p, %p, %p), Context sensitive help filtering not implemented!\n", (unsigned int)hOleMenu, hwndFrame, hwndActiveObject, lpFrame, - lpActiveObject)); + lpActiveObject); } /* Set up a message hook to intercept the containers frame window messages. @@ -1361,7 +1385,7 @@ HRESULT WINAPI OleSetMenuDescriptor( * without first calling it with a null hOleMenu to uninstall */ if ( OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) return E_FAIL; - + /* Get the menu descriptor */ pOleMenuDescriptor = (OleMenuDescriptor *) GlobalLock( hOleMenu ); if ( !pOleMenuDescriptor ) @@ -1373,7 +1397,7 @@ HRESULT WINAPI OleSetMenuDescriptor( GlobalUnlock( hOleMenu ); pOleMenuDescriptor = NULL; - + /* Add a menu descriptor windows property to the frame window */ SetPropA( hwndFrame, "PROP_OLEMenuDescriptor", hOleMenu ); @@ -1386,29 +1410,29 @@ HRESULT WINAPI OleSetMenuDescriptor( /* Uninstall the hooks */ if ( !OLEMenu_UnInstallHooks( GetCurrentThreadId() ) ) return E_FAIL; - + /* Remove the menu descriptor property from the frame window */ RemovePropA( hwndFrame, "PROP_OLEMenuDescriptor" ); } - + return S_OK; } /****************************************************************************** - * IsAccelerator [OLE32.75] + * IsAccelerator [OLE32.@] * Mostly copied from controls/menu.c TranslateAccelerator implementation */ BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD* lpwCmd) { -#if 0 +#ifndef __REACTOS__ /* YES, Accel16! */ LPACCEL16 lpAccelTbl; int i; if(!lpMsg) return FALSE; - if (!hAccel || !(lpAccelTbl = (LPACCEL16)LockResource16(hAccel))) + if (!hAccel || !(lpAccelTbl = (LPACCEL16)LockResource16(HACCEL_16(hAccel)))) { - WARN_(accel)("invalid accel handle=%04x\n", hAccel); + WARN_(accel)("invalid accel handle=%p\n", hAccel); return FALSE; } if((lpMsg->message != WM_KEYDOWN && @@ -1417,10 +1441,10 @@ BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD* l lpMsg->message != WM_SYSKEYUP && lpMsg->message != WM_CHAR)) return FALSE; - Print(MAX_TRACE, ("hAccel=%04x, cAccelEntries=%d," - "msg->hwnd=%04x, msg->message=%04x, wParam=%08x, lParam=%08lx\n", + TRACE_(accel)("hAccel=%p, cAccelEntries=%d," + "msg->hwnd=%p, msg->message=%04x, wParam=%08x, lParam=%08lx\n", hAccel, cAccelEntries, - lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam)); + lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam); for(i = 0; i < cAccelEntries; i++) { if(lpAccelTbl[i].key != lpMsg->wParam) @@ -1430,7 +1454,7 @@ BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD* l { if(!(lpAccelTbl[i].fVirt & FALT) && !(lpAccelTbl[i].fVirt & FVIRTKEY)) { - Print(MAX_TRACE, ("found accel for WM_CHAR: ('%c')\n", lpMsg->wParam & 0xff)); + TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", lpMsg->wParam & 0xff); goto found; } } @@ -1439,13 +1463,13 @@ BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD* l if(lpAccelTbl[i].fVirt & FVIRTKEY) { INT mask = 0; - Print(MAX_TRACE, ("found accel for virt_key %04x (scan %04x)\n", - lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff)); + TRACE_(accel)("found accel for virt_key %04x (scan %04x)\n", + lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff); if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT; if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL; if(GetKeyState(VK_MENU) & 0x8000) mask |= FALT; if(mask == (lpAccelTbl[i].fVirt & (FSHIFT | FCONTROL | FALT))) goto found; - Print(MAX_TRACE, ("incorrect SHIFT/CTRL/ALT-state\n")); + TRACE_(accel)("incorrect SHIFT/CTRL/ALT-state\n"); } else { @@ -1453,13 +1477,13 @@ BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD* l { if((lpAccelTbl[i].fVirt & FALT) && (lpMsg->lParam & 0x20000000)) { /* ^^ ALT pressed */ - Print(MAX_TRACE, ("found accel for Alt-%c\n", lpMsg->wParam & 0xff)); + TRACE_(accel)("found accel for Alt-%c\n", lpMsg->wParam & 0xff); goto found; } } } } - } + } WARN_(accel)("couldn't translate accelerator key\n"); return FALSE; @@ -1468,12 +1492,12 @@ found: if(lpwCmd) *lpwCmd = lpAccelTbl[i].cmd; return TRUE; #else - return FALSE; + return FALSE; #endif } /*********************************************************************** - * ReleaseStgMedium [OLE32.140] + * ReleaseStgMedium [OLE32.@] */ void WINAPI ReleaseStgMedium( STGMEDIUM* pmedium) @@ -1482,11 +1506,9 @@ void WINAPI ReleaseStgMedium( { case TYMED_HGLOBAL: { - if ( (pmedium->pUnkForRelease==0) && + if ( (pmedium->pUnkForRelease==0) && (pmedium->u.hGlobal!=0) ) GlobalFree(pmedium->u.hGlobal); - - pmedium->u.hGlobal = 0; break; } case TYMED_FILE: @@ -1497,11 +1519,9 @@ void WINAPI ReleaseStgMedium( { DeleteFileW(pmedium->u.lpszFileName); } - + CoTaskMemFree(pmedium->u.lpszFileName); } - - pmedium->u.lpszFileName = 0; break; } case TYMED_ISTREAM: @@ -1510,8 +1530,6 @@ void WINAPI ReleaseStgMedium( { IStream_Release(pmedium->u.pstm); } - - pmedium->u.pstm = 0; break; } case TYMED_ISTORAGE: @@ -1520,52 +1538,41 @@ void WINAPI ReleaseStgMedium( { IStorage_Release(pmedium->u.pstg); } - - pmedium->u.pstg = 0; break; } case TYMED_GDI: { - if ( (pmedium->pUnkForRelease==0) && - (pmedium->u.hGlobal!=0) ) - DeleteObject(pmedium->u.hGlobal); - - pmedium->u.hGlobal = 0; + if ( (pmedium->pUnkForRelease==0) && + (pmedium->u.hBitmap!=0) ) + DeleteObject(pmedium->u.hBitmap); break; } case TYMED_MFPICT: { - if ( (pmedium->pUnkForRelease==0) && + if ( (pmedium->pUnkForRelease==0) && (pmedium->u.hMetaFilePict!=0) ) { -#if 0 LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hMetaFilePict); DeleteMetaFile(pMP->hMF); -#else - Print(MIN_TRACE, ("Depending on MetaFile implementation\n")); -#endif GlobalUnlock(pmedium->u.hMetaFilePict); GlobalFree(pmedium->u.hMetaFilePict); } - - pmedium->u.hMetaFilePict = 0; break; } case TYMED_ENHMF: { - if ( (pmedium->pUnkForRelease==0) && + if ( (pmedium->pUnkForRelease==0) && (pmedium->u.hEnhMetaFile!=0) ) { DeleteEnhMetaFile(pmedium->u.hEnhMetaFile); } - - pmedium->u.hEnhMetaFile = 0; break; } case TYMED_NULL: default: break; } + pmedium->tymed=TYMED_NULL; /* * After cleaning up, the unknown is released @@ -1584,9 +1591,9 @@ void WINAPI ReleaseStgMedium( */ static void OLEDD_Initialize() { - WNDCLASS wndClass; + WNDCLASSA wndClass; - ZeroMemory (&wndClass, sizeof(WNDCLASS)); + ZeroMemory (&wndClass, sizeof(WNDCLASSA)); wndClass.style = CS_GLOBALCLASS; wndClass.lpfnWndProc = (WNDPROC)OLEDD_DragTrackerWindowProc; wndClass.cbClsExtra = 0; @@ -1594,7 +1601,7 @@ static void OLEDD_Initialize() wndClass.hCursor = 0; wndClass.hbrBackground = 0; wndClass.lpszClassName = OLEDD_DRAGTRACKERCLASS; - + RegisterClassA (&wndClass); } @@ -1660,7 +1667,7 @@ static void OLEDD_InsertDropTarget(DropTargetNode* nodeToAdd) /* * If we get here, we have found a spot for our item. The parentNodeLink - * pointer points to the pointer that we have to modify. + * pointer points to the pointer that we have to modify. * The curNode should be NULL. We just have to establish the link and Voila! */ assert(curNode==NULL); @@ -1707,7 +1714,7 @@ static DropTargetNode* OLEDD_ExtractDropTarget(HWND hwndOfTarget) else { /* - * The item was found in the list. Detach it from it's parent and + * The item was found in the list. Detach it from it's parent and * re-insert it's kids in the tree. */ assert(parentNodeLink!=NULL); @@ -1797,20 +1804,20 @@ static DropTargetNode* OLEDD_FindDropTarget(HWND hwndOfTarget) * of this behavior. */ static LRESULT WINAPI OLEDD_DragTrackerWindowProc( - HWND hwnd, + HWND hwnd, UINT uMsg, - WPARAM wParam, + WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_CREATE: { - LPCREATESTRUCT createStruct = (LPCREATESTRUCT)lParam; + LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam; + + SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams); - SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams); - break; } case WM_MOUSEMOVE: @@ -1905,11 +1912,11 @@ static void OLEDD_TrackMouseMove( * If we are hovering over the same target as before, send the * DragOver notification */ - if ( (trackerInfo->curDragTarget != 0) && - (trackerInfo->curDragTargetHWND==hwndNewTarget) ) + if ( (trackerInfo->curDragTarget != 0) && + (trackerInfo->curTargetHWND == hwndNewTarget) ) { POINTL mousePosParam; - + /* * The documentation tells me that the coordinate should be in the target * window's coordinate space. However, the tests I made tell me the @@ -1917,7 +1924,7 @@ static void OLEDD_TrackMouseMove( */ mousePosParam.x = mousePos.x; mousePosParam.y = mousePos.y; - + IDropTarget_DragOver(trackerInfo->curDragTarget, keyState, mousePosParam, @@ -1926,7 +1933,7 @@ static void OLEDD_TrackMouseMove( else { DropTargetNode* newDropTargetNode = 0; - + /* * If we changed window, we have to notify our old target and check for * the new one. @@ -1935,7 +1942,7 @@ static void OLEDD_TrackMouseMove( { IDropTarget_DragLeave(trackerInfo->curDragTarget); } - + /* * Make sure we're hovering over a window. */ @@ -1945,6 +1952,8 @@ static void OLEDD_TrackMouseMove( * Find-out if there is a drag target under the mouse */ HWND nexttar = hwndNewTarget; + trackerInfo->curTargetHWND = hwndNewTarget; + do { newDropTargetNode = OLEDD_FindDropTarget(nexttar); } while (!newDropTargetNode && (nexttar = GetParent(nexttar)) != 0); @@ -1952,14 +1961,14 @@ static void OLEDD_TrackMouseMove( trackerInfo->curDragTargetHWND = hwndNewTarget; trackerInfo->curDragTarget = newDropTargetNode ? newDropTargetNode->dropTarget : 0; - + /* * If there is, notify it that we just dragged-in */ if (trackerInfo->curDragTarget!=0) { POINTL mousePosParam; - + /* * The documentation tells me that the coordinate should be in the target * window's coordinate space. However, the tests I made tell me the @@ -1967,7 +1976,7 @@ static void OLEDD_TrackMouseMove( */ mousePosParam.x = mousePos.x; mousePosParam.y = mousePos.y; - + IDropTarget_DragEnter(trackerInfo->curDragTarget, trackerInfo->dataObject, keyState, @@ -1981,13 +1990,14 @@ static void OLEDD_TrackMouseMove( * The mouse is not over a window so we don't track anything. */ trackerInfo->curDragTargetHWND = 0; + trackerInfo->curTargetHWND = 0; trackerInfo->curDragTarget = 0; } } /* - * Now that we have done that, we have to tell the source to give - * us feedback on the work being done by the target. If we don't + * Now that we have done that, we have to tell the source to give + * us feedback on the work being done by the target. If we don't * have a target, simulate no effect. */ if (trackerInfo->curDragTarget==0) @@ -2008,21 +2018,21 @@ static void OLEDD_TrackMouseMove( { if (*trackerInfo->pdwEffect & DROPEFFECT_MOVE) { - SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCE(1))); + SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(1))); } else if (*trackerInfo->pdwEffect & DROPEFFECT_COPY) { - SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCE(2))); + SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(2))); } else if (*trackerInfo->pdwEffect & DROPEFFECT_LINK) { - SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCE(3))); + SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(3))); } else { - SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCE(0))); + SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(0))); } - } + } } /*** @@ -2051,9 +2061,9 @@ static void OLEDD_TrackStateChange( */ trackerInfo->returnValue = IDropSource_QueryContinueDrag( trackerInfo->dropSource, - trackerInfo->escPressed, + trackerInfo->escPressed, keyState); - + /* * All the return valued will stop the operation except the S_OK * return value. @@ -2066,13 +2076,13 @@ static void OLEDD_TrackStateChange( trackerInfo->trackingDone = TRUE; /* - * Release the mouse in case the drop target decides to show a popup + * Release the mouse in case the drop target decides to show a popup * or a menu or something. */ ReleaseCapture(); - + /* - * If we end-up over a target, drop the object in the target or + * If we end-up over a target, drop the object in the target or * inform the target that the operation was cancelled. */ if (trackerInfo->curDragTarget!=0) @@ -2080,21 +2090,21 @@ static void OLEDD_TrackStateChange( switch (trackerInfo->returnValue) { /* - * If the source wants us to complete the operation, we tell + * If the source wants us to complete the operation, we tell * the drop target that we just dropped the object in it. */ case DRAGDROP_S_DROP: { POINTL mousePosParam; - + /* - * The documentation tells me that the coordinate should be + * The documentation tells me that the coordinate should be * in the target window's coordinate space. However, the tests * I made tell me the coordinates should be in screen coordinates. */ mousePosParam.x = mousePos.x; mousePosParam.y = mousePos.y; - + IDropTarget_Drop(trackerInfo->curDragTarget, trackerInfo->dataObject, keyState, @@ -2103,9 +2113,9 @@ static void OLEDD_TrackStateChange( break; } /* - * If the source told us that we should cancel, fool the drop + * If the source told us that we should cancel, fool the drop * target by telling it that the mouse left it's window. - * Also set the drop effect to "NONE" in case the application + * Also set the drop effect to "NONE" in case the application * ignores the result of DoDragDrop. */ case DRAGDROP_S_CANCEL: @@ -2158,13 +2168,13 @@ static DWORD OLEDD_GetButtonState() * * params: * regKey - Key to read the default value from - * pdwValue - Pointer to the location where the DWORD + * pdwValue - Pointer to the location where the DWORD * value is returned. This value is not modified * if the value is not found. */ static void OLEUTL_ReadRegistryDWORDValue( - HKEY regKey, + HKEY regKey, DWORD* pdwValue) { char buffer[20]; @@ -2196,33 +2206,341 @@ static void OLEUTL_ReadRegistryDWORDValue( } /****************************************************************************** - * OleMetaFilePictFromIconAndLabel + * OleDraw (OLE32.@) * - * Returns a global memory handle to a metafile which contains the icon and - * label given. - * I guess the result of that should look somehow like desktop icons. - * If no hIcon is given, we load the icon via lpszSourceFile and iIconIndex. - * This code might be wrong at some places. + * The operation of this function is documented literally in the WinAPI + * documentation to involve a QueryInterface for the IViewObject interface, + * followed by a call to IViewObject::Draw. */ -DWORD WINAPI OleMetaFilePictFromIconAndLabel16( - DWORD hIcon, - PVOID lpszLabel, - PVOID lpszSourceFile, - DWORD iIconIndex -) { - UNIMPLEMENTED; - return 0; +HRESULT WINAPI OleDraw( + IUnknown *pUnk, + DWORD dwAspect, + HDC hdcDraw, + LPCRECT lprcBounds) +{ + HRESULT hres; + IViewObject *viewobject; + + hres = IUnknown_QueryInterface(pUnk, + &IID_IViewObject, + (void**)&viewobject); + + if (SUCCEEDED(hres)) + { + RECTL rectl; + + rectl.left = lprcBounds->left; + rectl.right = lprcBounds->right; + rectl.top = lprcBounds->top; + rectl.bottom = lprcBounds->bottom; + hres = IViewObject_Draw(viewobject, dwAspect, -1, 0, 0, 0, hdcDraw, &rectl, 0, 0, 0); + + IViewObject_Release(viewobject); + return hres; + } + else + { + return DV_E_NOIVIEWOBJECT; + } +} + +/*********************************************************************** + * OleTranslateAccelerator [OLE32.@] + */ +HRESULT WINAPI OleTranslateAccelerator (LPOLEINPLACEFRAME lpFrame, + LPOLEINPLACEFRAMEINFO lpFrameInfo, LPMSG lpmsg) +{ + WORD wID; + + TRACE("(%p,%p,%p)\n", lpFrame, lpFrameInfo, lpmsg); + + if (IsAccelerator(lpFrameInfo->haccel,lpFrameInfo->cAccelEntries,lpmsg,&wID)) + return IOleInPlaceFrame_TranslateAccelerator(lpFrame,lpmsg,wID); + + return S_FALSE; } /****************************************************************************** - * DllDebugObjectRPCHook + * OleCreate [OLE32.@] + * + */ +HRESULT WINAPI OleCreate( + REFCLSID rclsid, + REFIID riid, + DWORD renderopt, + LPFORMATETC pFormatEtc, + LPOLECLIENTSITE pClientSite, + LPSTORAGE pStg, + LPVOID* ppvObj) +{ + HRESULT hres, hres1; + IUnknown * pUnk = NULL; + + FIXME("\n\t%s\n\t%s semi-stub!\n", debugstr_guid(rclsid), debugstr_guid(riid)); + + if (SUCCEEDED((hres = CoCreateInstance(rclsid, 0, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER|CLSCTX_LOCAL_SERVER , riid, (LPVOID*)&pUnk)))) + { + if (pClientSite) + { + IOleObject * pOE; + IPersistStorage * pPS; + if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IOleObject, (LPVOID*)&pOE)))) + { + TRACE("trying to set clientsite %p\n", pClientSite); + hres1 = IOleObject_SetClientSite(pOE, pClientSite); + TRACE("-- result 0x%08lx\n", hres1); + IOleObject_Release(pOE); + } + if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IPersistStorage, (LPVOID*)&pPS)))) + { + TRACE("trying to set stg %p\n", pStg); + hres1 = IPersistStorage_InitNew(pPS, pStg); + TRACE("-- result 0x%08lx\n", hres1); + IPersistStorage_Release(pPS); + } + } + } + + *ppvObj = pUnk; + + TRACE("-- %p \n", pUnk); + return hres; +} + +/*********************************************************************** + * OLE_FreeClipDataArray [internal] + * + * NOTES: + * frees the data associated with an array of CLIPDATAs + */ +static void OLE_FreeClipDataArray(ULONG count, CLIPDATA * pClipDataArray) +{ + ULONG i; + for (i = 0; i < count; i++) + if (pClipDataArray[i].pClipData) + CoTaskMemFree(pClipDataArray[i].pClipData); +} + +HRESULT WINAPI FreePropVariantArray(ULONG,PROPVARIANT*); + +/*********************************************************************** + * PropVariantClear [OLE32.@] + */ +HRESULT WINAPI PropVariantClear(PROPVARIANT * pvar) /* [in/out] */ +{ + TRACE("(%p)\n", pvar); + + if (!pvar) + return S_OK; + + switch(pvar->vt) + { + case VT_STREAM: + case VT_STREAMED_OBJECT: + case VT_STORAGE: + case VT_STORED_OBJECT: + IUnknown_Release((LPUNKNOWN)pvar->u.pStream); + break; + case VT_CLSID: + case VT_LPSTR: + case VT_LPWSTR: + /* pick an arbitary typed pointer - we don't care about the type + * as we are just freeing it */ + CoTaskMemFree(pvar->u.puuid); + break; + case VT_BLOB: + case VT_BLOB_OBJECT: + CoTaskMemFree(pvar->u.blob.pBlobData); + break; + case VT_BSTR: + FIXME("Need to load OLEAUT32 for SysFreeString\n"); + /* SysFreeString(pvar->u.bstrVal); */ + break; + case VT_CF: + if (pvar->u.pclipdata) + { + OLE_FreeClipDataArray(1, pvar->u.pclipdata); + CoTaskMemFree(pvar->u.pclipdata); + } + break; + default: + if (pvar->vt & VT_ARRAY) + { + FIXME("Need to call SafeArrayDestroy\n"); + /* SafeArrayDestroy(pvar->u.caub); */ + } + switch (pvar->vt & VT_VECTOR) + { + case VT_VARIANT: + FreePropVariantArray(pvar->u.capropvar.cElems, pvar->u.capropvar.pElems); + break; + case VT_CF: + OLE_FreeClipDataArray(pvar->u.caclipdata.cElems, pvar->u.caclipdata.pElems); + break; + case VT_BSTR: + case VT_LPSTR: + case VT_LPWSTR: + FIXME("Freeing of vector sub-type not supported yet\n"); + } + if (pvar->vt & VT_VECTOR) + { + /* pick an arbitary VT_VECTOR structure - they all have the same + * memory layout */ + CoTaskMemFree(pvar->u.capropvar.pElems); + } + } + + ZeroMemory(pvar, sizeof(*pvar)); + + return S_OK; +} + +/*********************************************************************** + * PropVariantCopy [OLE32.@] + */ +HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */ + const PROPVARIANT *pvarSrc) /* [in] */ +{ + ULONG len; + TRACE("(%p, %p): stub:\n", pvarDest, pvarSrc); + + /* this will deal with most cases */ + CopyMemory(pvarDest, pvarSrc, sizeof(*pvarDest)); + + switch(pvarSrc->vt) + { + case VT_STREAM: + case VT_STREAMED_OBJECT: + case VT_STORAGE: + case VT_STORED_OBJECT: + IUnknown_AddRef((LPUNKNOWN)pvarDest->u.pStream); + break; + case VT_CLSID: + pvarDest->u.puuid = CoTaskMemAlloc(sizeof(CLSID)); + CopyMemory(pvarDest->u.puuid, pvarSrc->u.puuid, sizeof(CLSID)); + break; + case VT_LPSTR: + len = strlen(pvarSrc->u.pszVal); + pvarDest->u.pszVal = CoTaskMemAlloc(len); + CopyMemory(pvarDest->u.pszVal, pvarSrc->u.pszVal, len); + break; + case VT_LPWSTR: + len = lstrlenW(pvarSrc->u.pwszVal); + pvarDest->u.pwszVal = CoTaskMemAlloc(len); + CopyMemory(pvarDest->u.pwszVal, pvarSrc->u.pwszVal, len); + break; + case VT_BLOB: + case VT_BLOB_OBJECT: + if (pvarSrc->u.blob.pBlobData) + { + len = pvarSrc->u.blob.cbSize; + pvarDest->u.blob.pBlobData = CoTaskMemAlloc(len); + CopyMemory(pvarDest->u.blob.pBlobData, pvarSrc->u.blob.pBlobData, len); + } + break; + case VT_BSTR: + FIXME("Need to copy BSTR\n"); + break; + case VT_CF: + if (pvarSrc->u.pclipdata) + { + len = pvarSrc->u.pclipdata->cbSize - sizeof(pvarSrc->u.pclipdata->ulClipFmt); + CoTaskMemAlloc(len); + CopyMemory(pvarDest->u.pclipdata->pClipData, pvarSrc->u.pclipdata->pClipData, len); + } + break; + default: + if (pvarSrc->vt & VT_ARRAY) + { + FIXME("Need to call SafeArrayCopy\n"); + /* SafeArrayCopy(...); */ + } + if (pvarSrc->vt & VT_VECTOR) + { + int elemSize; + switch(pvarSrc->vt & VT_VECTOR) + { + case VT_I1: elemSize = sizeof(pvarSrc->u.cVal); break; + case VT_UI1: elemSize = sizeof(pvarSrc->u.bVal); break; + case VT_I2: elemSize = sizeof(pvarSrc->u.iVal); break; + case VT_UI2: elemSize = sizeof(pvarSrc->u.uiVal); break; + case VT_BOOL: elemSize = sizeof(pvarSrc->u.boolVal); break; + case VT_I4: elemSize = sizeof(pvarSrc->u.lVal); break; + case VT_UI4: elemSize = sizeof(pvarSrc->u.ulVal); break; + case VT_R4: elemSize = sizeof(pvarSrc->u.fltVal); break; + case VT_R8: elemSize = sizeof(pvarSrc->u.dblVal); break; + case VT_ERROR: elemSize = sizeof(pvarSrc->u.scode); break; + case VT_I8: elemSize = sizeof(pvarSrc->u.hVal); break; + case VT_UI8: elemSize = sizeof(pvarSrc->u.uhVal); break; + case VT_CY: elemSize = sizeof(pvarSrc->u.cyVal); break; + case VT_DATE: elemSize = sizeof(pvarSrc->u.date); break; + case VT_FILETIME: elemSize = sizeof(pvarSrc->u.filetime); break; + case VT_CLSID: elemSize = sizeof(*pvarSrc->u.puuid); break; + case VT_CF: elemSize = sizeof(*pvarSrc->u.pclipdata); break; + + case VT_BSTR: + case VT_LPSTR: + case VT_LPWSTR: + case VT_VARIANT: + default: + FIXME("Invalid element type: %ul\n", pvarSrc->vt & VT_VECTOR); + return E_INVALIDARG; + } + len = pvarSrc->u.capropvar.cElems; + pvarDest->u.capropvar.pElems = CoTaskMemAlloc(len * elemSize); + if (pvarSrc->vt == (VT_VECTOR | VT_VARIANT)) + { + ULONG i; + for (i = 0; i < len; i++) + PropVariantCopy(&pvarDest->u.capropvar.pElems[i], &pvarSrc->u.capropvar.pElems[i]); + } + else if (pvarSrc->vt == (VT_VECTOR | VT_CF)) + { + FIXME("Copy clipformats\n"); + } + else if (pvarSrc->vt == (VT_VECTOR | VT_BSTR)) + { + FIXME("Copy BSTRs\n"); + } + else if (pvarSrc->vt == (VT_VECTOR | VT_LPSTR)) + { + FIXME("Copy LPSTRs\n"); + } + else if (pvarSrc->vt == (VT_VECTOR | VT_LPSTR)) + { + FIXME("Copy LPWSTRs\n"); + } + else + CopyMemory(pvarDest->u.capropvar.pElems, pvarSrc->u.capropvar.pElems, len * elemSize); + } + } + + return S_OK; +} + +/*********************************************************************** + * FreePropVariantArray [OLE32.@] + */ +HRESULT WINAPI FreePropVariantArray(ULONG cVariants, /* [in] */ + PROPVARIANT *rgvars) /* [in/out] */ +{ + ULONG i; + + TRACE("(%lu, %p)\n", cVariants, rgvars); + + for(i = 0; i < cVariants; i++) + PropVariantClear(&rgvars[i]); + + return S_OK; +} + +/****************************************************************************** + * DllDebugObjectRPCHook (OLE32.@) * turns on and off internal debugging, pointer is only used on macintosh */ BOOL WINAPI DllDebugObjectRPCHook(BOOL b, void *dummy) { - Print(MIN_TRACE, ("stub\n")); + FIXME("stub\n"); return TRUE; } - -#endif diff --git a/reactos/lib/ole32/ole2impl.c b/reactos/lib/ole32/ole2impl.c new file mode 100644 index 00000000000..903c5e7416d --- /dev/null +++ b/reactos/lib/ole32/ole2impl.c @@ -0,0 +1,195 @@ +/* + * Ole 2 Create functions implementation + * + * Copyright (C) 1999-2000 Abey George + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "wine/debug.h" +#include "ole2.h" +#include "olestd.h" +#include "winreg.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +#define MAX_CLIPFORMAT_NAME 80 + +/****************************************************************************** + * OleQueryCreateFromData [OLE32.@] + * + * Author : Abey George + * Checks whether an object can become an embedded object. + * the clipboard or OLE drag and drop. + * Returns : S_OK - Format that supports Embedded object creation are present. + * OLE_E_STATIC - Format that supports static object creation are present. + * S_FALSE - No acceptable format is available. + */ + +HRESULT WINAPI OleQueryCreateFromData(LPDATAOBJECT pSrcDataObject) +{ + IEnumFORMATETC *pfmt; + FORMATETC fmt; + CHAR szFmtName[MAX_CLIPFORMAT_NAME]; + BOOL bFoundStatic = FALSE; + + HRESULT hr = IDataObject_EnumFormatEtc(pSrcDataObject, DATADIR_GET, &pfmt); + + if (hr == S_OK) + hr = IEnumFORMATETC_Next(pfmt, 1, &fmt, NULL); + + while (hr == S_OK) + { + GetClipboardFormatNameA(fmt.cfFormat, szFmtName, MAX_CLIPFORMAT_NAME-1); + + /* first, Check for Embedded Object, Embed Source or Filename */ + + if (!strcmp(szFmtName, CF_EMBEDDEDOBJECT) || !strcmp(szFmtName, CF_EMBEDSOURCE) || !strcmp(szFmtName, CF_FILENAME)) + return S_OK; + + /* Check for Metafile, Bitmap or DIB */ + + if (fmt.cfFormat == CF_METAFILEPICT || fmt.cfFormat == CF_BITMAP || fmt.cfFormat == CF_DIB) + bFoundStatic = TRUE; + + hr = IEnumFORMATETC_Next(pfmt, 1, &fmt, NULL); + } + + /* Found a static format, but no embed format */ + + if (bFoundStatic) + return OLE_S_STATIC; + + return S_FALSE; +} + +/****************************************************************************** + * OleCreateFromData [OLE32.@] + * + * Author : Abey George + * Creates an embedded object from data transfer object retrieved from + * the clipboard or OLE drag and drop. + * Returns : S_OK - Embedded object was created successfully. + * OLE_E_STATIC - OLE can create only a static object + * DV_E_FORMATETC - No acceptable format is available (only error return code) + * TODO : CF_FILENAME, CF_EMBEDEDOBJECT formats. Parameter renderopt is currently ignored. + */ + +HRESULT WINAPI OleCreateFromData(LPDATAOBJECT pSrcDataObject, REFIID riid, + DWORD renderopt, LPFORMATETC pFormatEtc, + LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, + LPVOID* ppvObj) +{ + IEnumFORMATETC *pfmt; + FORMATETC fmt; + CHAR szFmtName[MAX_CLIPFORMAT_NAME]; + STGMEDIUM std; + HRESULT hr; + HRESULT hr1; + + hr = IDataObject_EnumFormatEtc(pSrcDataObject, DATADIR_GET, &pfmt); + + if (hr == S_OK) + { + memset(&std, 0, sizeof(STGMEDIUM)); + + hr = IEnumFORMATETC_Next(pfmt, 1, &fmt, NULL); + while (hr == S_OK) + { + GetClipboardFormatNameA(fmt.cfFormat, szFmtName, MAX_CLIPFORMAT_NAME-1); + + /* first, Check for Embedded Object, Embed Source or Filename */ + /* TODO: Currently checks only for Embed Source. */ + + if (!strcmp(szFmtName, CF_EMBEDSOURCE)) + { + std.tymed = TYMED_HGLOBAL; + + if ((hr1 = IDataObject_GetData(pSrcDataObject, &fmt, &std)) == S_OK) + { + ILockBytes *ptrILockBytes = 0; + IStorage *pStorage = 0; + IOleObject *pOleObject = 0; + IPersistStorage *pPersistStorage = 0; + CLSID clsID; + + /* Create ILock bytes */ + + hr1 = CreateILockBytesOnHGlobal(std.u.hGlobal, FALSE, &ptrILockBytes); + + /* Open storage on the ILock bytes */ + + if (hr1 == S_OK) + hr1 = StgOpenStorageOnILockBytes(ptrILockBytes, NULL, STGM_SHARE_EXCLUSIVE, NULL, 0, &pStorage); + + /* Get Class ID from the opened storage */ + + if (hr1 == S_OK) + hr1 = ReadClassStg(pStorage, &clsID); + + /* Create default handler for Persist storage */ + + if (hr1 == S_OK) + hr1 = OleCreateDefaultHandler(&clsID, NULL, &IID_IPersistStorage, (LPVOID*)&pPersistStorage); + + /* Load the storage to Persist storage */ + + if (hr1 == S_OK) + hr1 = IPersistStorage_Load(pPersistStorage, pStorage); + + /* Query for IOleObject */ + + if (hr1 == S_OK) + hr1 = IPersistStorage_QueryInterface(pPersistStorage, &IID_IOleObject, (LPVOID*)&pOleObject); + + /* Set client site with the IOleObject */ + + if (hr1 == S_OK) + hr1 = IOleObject_SetClientSite(pOleObject, pClientSite); + + IPersistStorage_Release(pPersistStorage); + /* Query for the requested interface */ + + if (hr1 == S_OK) + hr1 = IPersistStorage_QueryInterface(pPersistStorage, riid, ppvObj); + + IPersistStorage_Release(pPersistStorage); + + IStorage_Release(pStorage); + + if (hr1 == S_OK) + return S_OK; + } + + /* Return error */ + + return DV_E_FORMATETC; + } + + hr = IEnumFORMATETC_Next(pfmt, 1, &fmt, NULL); + } + } + + return DV_E_FORMATETC; +} diff --git a/reactos/lib/ole32/ole2stubs.c b/reactos/lib/ole32/ole2stubs.c new file mode 100644 index 00000000000..3a09201c4d0 --- /dev/null +++ b/reactos/lib/ole32/ole2stubs.c @@ -0,0 +1,195 @@ +/* + * Temporary place for ole2 stubs. + * + * Copyright (C) 1999 Corel Corporation + * Move these functions to dlls/ole32/ole2impl.c when you implement them. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include + +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "ole2.h" +#include "objidl.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +/****************************************************************************** + * OleCreateLinkToFile [OLE32.@] + */ +HRESULT WINAPI OleCreateLinkToFile(LPCOLESTR lpszFileName, REFIID riid, + DWORD renderopt, LPFORMATETC lpFormatEtc, + LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID* ppvObj) +{ + FIXME("(%p,%p,%li,%p,%p,%p,%p), stub!\n",lpszFileName, riid, renderopt, lpFormatEtc, pClientSite, pStg, ppvObj); + return E_NOTIMPL; +} + + +/****************************************************************************** + * OleDuplicateData [OLE32.@] + */ +#ifdef __REACTOS__ +HANDLE WINAPI OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat, + UINT uiFlags) +#else +HRESULT WINAPI OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat, + UINT uiFlags) +#endif +{ + FIXME("(%p,%x,%x), stub!\n", hSrc, cfFormat, uiFlags); + return E_NOTIMPL; +} + + +/****************************************************************************** + * SetConvertStg [OLE32.@] + */ +HRESULT WINAPI SetConvertStg(LPSTORAGE pStg, BOOL fConvert) +{ + FIXME("(%p,%x), stub!\n", pStg, fConvert); + return E_NOTIMPL; +} + +/****************************************************************************** + * OleCreateLink [OLE32.@] + */ +HRESULT WINAPI OleCreateLink(LPMONIKER pmkLinkSrc, REFIID riid, DWORD renderopt, LPFORMATETC lpFormatEtc, + LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID* ppvObj) +{ + FIXME("(not shown), stub!\n"); + return E_NOTIMPL; +} + +/****************************************************************************** + * OleCreateFromFile [OLE32.@] + */ +HRESULT WINAPI OleCreateFromFile(REFCLSID rclsid, LPCOLESTR lpszFileName, REFIID riid, + DWORD renderopt, LPFORMATETC lpFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID* ppvObj) +{ + FIXME("(not shown), stub!\n"); + return E_NOTIMPL; +} + + +/****************************************************************************** + * OleGetIconOfClass [OLE32.@] + */ +HGLOBAL WINAPI OleGetIconOfClass(REFCLSID rclsid, LPOLESTR lpszLabel, BOOL fUseTypeAsLabel) +{ + FIXME("(%p,%p,%x), stub!\n", rclsid, lpszLabel, fUseTypeAsLabel); + return NULL; +} + + +/****************************************************************************** + * OleCreateStaticFromData [OLE32.@] + */ +HRESULT WINAPI OleCreateStaticFromData(LPDATAOBJECT pSrcDataObj, REFIID iid, + DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite, + LPSTORAGE pStg, LPVOID* ppvObj) +{ + FIXME("(not shown), stub!\n"); + return E_NOTIMPL; +} + +/****************************************************************************** + * OleCreateLinkFromData [OLE32.@] + */ + +HRESULT WINAPI OleCreateLinkFromData(LPDATAOBJECT pSrcDataObj, REFIID riid, + DWORD renderopt, LPFORMATETC pFormatEtc, + LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, + LPVOID* ppvObj) +{ + FIXME("(not shown), stub!\n"); + return E_NOTIMPL; +} + +/****************************************************************************** + * OleIsRunning [OLE32.@] + */ +BOOL WINAPI OleIsRunning(LPOLEOBJECT pObject) +{ + FIXME("(%p), stub!\n", pObject); + return TRUE; +} + +/*********************************************************************** + * OleRegEnumVerbs [OLE32.@] + */ +HRESULT WINAPI OleRegEnumVerbs (REFCLSID clsid, LPENUMOLEVERB* ppenum) +{ + FIXME("(%p,%p), stub!\n", clsid, ppenum); + return OLEOBJ_E_NOVERBS; +} + +/*********************************************************************** + * OleRegEnumFormatEtc [OLE32.@] + */ +HRESULT WINAPI OleRegEnumFormatEtc ( + REFCLSID clsid, + DWORD dwDirection, + LPENUMFORMATETC* ppenumFormatetc) +{ + FIXME("(%p, %ld, %p), stub!\n", clsid, dwDirection, ppenumFormatetc); + + return E_NOTIMPL; +} + +/*********************************************************************** + * CoIsOle1Class [OLE32.@] + */ +BOOL WINAPI CoIsOle1Class(REFCLSID clsid) +{ + FIXME("%s\n", debugstr_guid(clsid)); + return FALSE; +} + +/*********************************************************************** + * DllGetClassObject [OLE2.4] + */ +HRESULT WINAPI DllGetClassObject16(REFCLSID rclsid, REFIID iid, LPVOID *ppv) +{ + FIXME("(%s, %s, %p): stub\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv); + return E_NOTIMPL; +} + +/*********************************************************************** + * OleSetClipboard [OLE2.49] + */ +HRESULT WINAPI OleSetClipboard16(IDataObject* pDataObj) +{ + FIXME("(%p): stub\n", pDataObj); + return S_OK; +} + +/*********************************************************************** + * OleGetClipboard [OLE2.50] + */ +HRESULT WINAPI OleGetClipboard16(IDataObject** ppDataObj) +{ + FIXME("(%p): stub\n", ppDataObj); + return E_NOTIMPL; +} diff --git a/reactos/lib/ole32/ole32.def b/reactos/lib/ole32/ole32.def index 60548b84f25..51d94f92b6c 100644 --- a/reactos/lib/ole32/ole32.def +++ b/reactos/lib/ole32/ole32.def @@ -1,307 +1,148 @@ +; File generated automatically from ole32/ole32.spec; do not edit! + LIBRARY ole32.dll EXPORTS -; BindMoniker @9 -; CLIPFORMAT_UserFree @10 -; CLIPFORMAT_UserMarshal @11 -; CLIPFORMAT_UserSize @12 -; CLIPFORMAT_UserUnmarshal @13 - CLSIDFromProgID@8 @14 -; CLSIDFromProgIDEx @15 - CLSIDFromString@8 @16 - CoAddRefServerProcess@0 @17 - CoAllowSetForegroundWindow@8 @18 - CoBuildVersion@0 @19 - CoCancelCall@8 @20 - CoCopyProxy@8 @21 - CoCreateFreeThreadedMarshaler@8 @22 - CoCreateGuid@4 @23 - CoCreateInstance@20 @24 - CoCreateInstanceEx@24 @25 -; CoCreateObjectInContext @26 -; CoDeactivateObject @27 - CoDisableCallCancellation@4 @28 - CoDisconnectObject@8 @29 - CoDosDateTimeToFileTime@12 @30 - CoEnableCallCancellation@4 @31 - CoFileTimeNow@4 @32 - CoFileTimeToDosDateTime@12 @33 - CoFreeAllLibraries@0 @34 - CoFreeLibrary@4 @35 - CoFreeUnusedLibraries@0 @36 -; CoGetApartmentID @37 - CoGetCallContext@8 @38 -; CoGetCallerTID @39 - CoGetCancelObject@12 @40 - CoGetClassObject@20 @41 -; CoGetClassVersion @42 -; CoGetCurrentLogicalThreadId @43 - CoGetCurrentProcess@0 @44 - CoGetInstanceFromFile@32 @45 - CoGetInstanceFromIStorage@28 @46 - CoGetInterfaceAndReleaseStream@12 @47 - CoGetMalloc@8 @48 - CoGetMarshalSizeMax@24 @49 - CoGetObject@16 @50 - CoGetObjectContext@8 @51 - CoGetPSClsid@8 @52 - CoGetStandardMarshal@24 @53 -; CoGetState @54 - CoGetStdMarshalEx@12 @55 - CoGetTreatAsClass@8 @56 - CoImpersonateClient@0 @57 - CoInitialize@4 @58 - CoInitializeEx@8 @59 - CoInitializeSecurity@36 @60 - CoInitializeWOW@8 @61 -; CoInstall @62 - CoIsHandlerConnected@4 @63 -; CoIsOle1Class @64 - CoLoadLibrary@8 @65 - CoLockObjectExternal@12 @66 - CoMarshalHresult@8 @67 - CoMarshalInterThreadInterfaceInStream@12 @68 - CoMarshalInterface@24 @69 - CoQueryAuthenticationServices@8 @70 - CoQueryClientBlanket@28 @71 - CoQueryProxyBlanket@32 @72 -; CoQueryReleaseObject @73 -; CoReactivateObject @74 -; CoRegisterChannelHook @75 - CoRegisterClassObject@20 @76 - CoRegisterMallocSpy@4 @77 - CoRegisterMessageFilter@8 @78 - CoRegisterPSClsid@8 @79 -; CoRegisterSurrogate @80 -; CoRegisterSurrogateEx @81 - CoReleaseMarshalData@4 @82 - CoReleaseServerProcess@0 @83 - CoResumeClassObjects@0 @84 - CoRevertToSelf@0 @85 - CoRevokeClassObject@4 @86 - CoRevokeMallocSpy@0 @87 - CoSetCancelObject@4 @88 - CoSetProxyBlanket@32 @89 - CoSetState@4 @90 - CoSuspendClassObjects@0 @91 - CoSwitchCallContext@8 @92 - CoTaskMemAlloc@4 @93 - CoTaskMemFree@4 @94 - CoTaskMemRealloc@8 @95 - CoTestCancel@0 @96 - CoTreatAsClass@8 @97 - CoUninitialize@0 @98 -; CoUnloadingWOW @99 - CoUnmarshalHresult@8 @100 - CoUnmarshalInterface@12 @101 - CoWaitForMultipleHandles@20 @102 - CreateAntiMoniker@4 @103 - CreateBindCtx@8 @104 -; CreateClassMoniker @105 -; CreateDataAdviseHolder @106 - CreateDataCache@16 @107 -; CreateErrorInfo @108 - CreateFileMoniker@8 @109 - CreateGenericComposite@12 @110 - CreateILockBytesOnHGlobal@12 @111 - CreateItemMoniker@12 @112 -; CreateObjrefMoniker @113 -; CreateOleAdviseHolder @114 -; CreatePointerMoniker @115 -; CreateStdProgressIndicator @116 -; CreateStreamOnHGlobal@12 @117 -; DcomChannelSetHResult @118 -; DllDebugObjectRPCHook @119 -; DllGetClassObject @120 -; DllGetClassObjectWOW @121 -; DllRegisterServer @122 -; DoDragDrop @123 -; EnableHookObject @124 -; FmtIdToPropStgName @125 -; FreePropVariantArray @126 - GetClassFile@8 @127 - GetConvertStg@4 @128 -; GetDocumentBitStg @129 -; GetErrorInfo @130 - GetHGlobalFromILockBytes@8 @131 -; GetHGlobalFromStream @132 -; GetHookInterface @133 - GetRunningObjectTable@8 @134 -; HACCEL_UserFree @135 -; HACCEL_UserMarshal @136 -; HACCEL_UserSize @137 -; HACCEL_UserUnmarshal @138 -; HBITMAP_UserFree @139 -; HBITMAP_UserMarshal @140 -; HBITMAP_UserSize @141 -; HBITMAP_UserUnmarshal @142 -; HBRUSH_UserFree @143 -; HBRUSH_UserMarshal @144 -; HBRUSH_UserSize @145 -; HBRUSH_UserUnmarshal @146 -; HDC_UserFree @147 -; HDC_UserMarshal @148 -; HDC_UserSize @149 -; HDC_UserUnmarshal @150 -; HENHMETAFILE_UserFree @151 -; HENHMETAFILE_UserMarshal @152 -; HENHMETAFILE_UserSize @153 -; HENHMETAFILE_UserUnmarshal @154 -; HGLOBAL_UserFree @155 -; HGLOBAL_UserMarshal @156 -; HGLOBAL_UserSize @157 -; HGLOBAL_UserUnmarshal @158 -; HICON_UserFree @159 -; HICON_UserMarshal @160 -; HICON_UserSize @161 -; HICON_UserUnmarshal @162 -; HMENU_UserFree @163 -; HMENU_UserMarshal @164 -; HMENU_UserSize @165 -; HMENU_UserUnmarshal @166 -; HMETAFILEPICT_UserFree @167 -; HMETAFILEPICT_UserMarshal @168 -; HMETAFILEPICT_UserSize @169 -; HMETAFILEPICT_UserUnmarshal @170 -; HMETAFILE_UserFree @171 -; HMETAFILE_UserMarshal @172 -; HMETAFILE_UserSize @173 -; HMETAFILE_UserUnmarshal @174 -; HPALETTE_UserFree @175 -; HPALETTE_UserMarshal @176 -; HPALETTE_UserSize @177 -; HPALETTE_UserUnmarshal @178 -; HWND_UserFree @179 -; HWND_UserMarshal @180 -; HWND_UserSize @181 -; HWND_UserUnmarshal @182 -; HkOleRegisterObject @183 -; IIDFromString @184 -; IsAccelerator @185 - IsEqualGUID@8 @186 -; IsValidIid @187 - IsValidInterface@4 @188 -; IsValidPtrIn @189 -; IsValidPtrOut @190 - MkParseDisplayName@16 @191 - MonikerCommonPrefixWith@12 @192 -; MonikerRelativePathTo @193 -; OleBuildVersion @194 - OleConvertIStorageToOLESTREAM@8 @195 -; OleConvertIStorageToOLESTREAMEx @196 - OleConvertOLESTREAMToIStorage@12 @197 -; OleConvertOLESTREAMToIStorageEx @198 -; OleCreate @199 -; OleCreateDefaultHandler @200 -; OleCreateEmbeddingHelper @201 -; OleCreateEx @202 -; OleCreateFromData @203 -; OleCreateFromDataEx @204 -; OleCreateFromFile @205 -; OleCreateFromFileEx @206 -; OleCreateLink @207 -; OleCreateLinkEx @208 -; OleCreateLinkFromData @209 -; OleCreateLinkFromDataEx @210 -; OleCreateLinkToFile @211 -; OleCreateLinkToFileEx @212 -; OleCreateMenuDescriptor @213 -; OleCreateStaticFromData @214 -; OleDestroyMenuDescriptor @215 -; OleDoAutoConvert @216 -; OleDraw @217 -; OleDuplicateData @218 -; OleFlushClipboard @219 - OleGetAutoConvert@8 @220 -; OleGetClipboard @221 -; OleGetIconOfClass @222 -; OleGetIconOfFile @223 -; OleInitialize @224 -; OleInitializeWOW @225 -; OleIsCurrentClipboard @226 -; OleIsRunning @227 -; OleLoad @228 - OleLoadFromStream@12 @229 -; OleLockRunning @230 -; OleMetafilePictFromIconAndLabel @231 -; OleNoteObjectVisible @232 -; OleQueryCreateFromData @233 -; OleQueryLinkFromData @234 -; OleRegEnumFormatEtc @235 -; OleRegEnumVerbs @236 -; OleRegGetMiscStatus @237 -; OleRegGetUserType @238 - OleRun@4 @239 -; OleSave @240 - OleSaveToStream@8 @241 - OleSetAutoConvert@8 @242 -; OleSetClipboard @243 -; OleSetContainedObject @244 -; OleSetMenuDescriptor @245 -; OleTranslateAccelerator @246 -; OleUninitialize @247 -; OpenOrCreateStream @248 - ProgIDFromCLSID@8 @249 -; PropStgNameToFmtId @250 -; PropSysAllocString @251 -; PropSysFreeString @252 -; PropVariantChangeType @1 -; PropVariantClear @253 -; PropVariantCopy @254 - ReadClassStg@8 @255 - ReadClassStm@8 @256 -; ReadFmtUserTypeStg @257 -; ReadOleStg @258 -; ReadStringStream @259 -; RegisterDragDrop @260 -; ReleaseStgMedium @261 -; RevokeDragDrop @262 -; SNB_UserFree @263 -; SNB_UserMarshal @264 -; SNB_UserSize @265 -; SNB_UserUnmarshal @266 -; STGMEDIUM_UserFree @267 -; STGMEDIUM_UserMarshal @268 -; STGMEDIUM_UserSize @269 -; STGMEDIUM_UserUnmarshal @270 -; SetConvertStg @271 -; SetDocumentBitStg @272 -; SetErrorInfo @273 -; StgConvertPropertyToVariant @2 -; StgConvertVariantToProperty @3 - StgCreateDocfile@16 @274 - StgCreateDocfileOnILockBytes@16 @275 -; StgCreatePropSetStg @276 -; StgCreatePropStg @277 -; StgCreateStorageEx @278 -; StgGetIFillLockBytesOnFile @279 -; StgGetIFillLockBytesOnILockBytes @280 - StgIsStorageFile@4 @281 - StgIsStorageILockBytes@4 @282 -; StgOpenAsyncDocfileOnIFillLockBytes @283 -; StgOpenPropStg @284 - StgOpenStorage@24 @285 -; StgOpenStorageEx @286 -; StgOpenStorageOnHandle @287 - StgOpenStorageOnILockBytes@24 @288 -; StgPropertyLengthAsVariant @4 - StgSetTimes@16 @289 - StringFromCLSID@8 @290 - StringFromGUID2@12 @291 -; StringFromIID @292 -; UpdateDCOMSettings @293 -; UtConvertDvtd16toDvtd32 @294 -; UtConvertDvtd32toDvtd16 @295 -; UtGetDvtd16Info @296 -; UtGetDvtd32Info @297 -; WdtpInterfacePointer_UserFree @5 -; WdtpInterfacePointer_UserMarshal @6 -; WdtpInterfacePointer_UserSize @7 -; WdtpInterfacePointer_UserUnmarshal @8 - WriteClassStg@8 @298 - WriteClassStm@8 @299 -; WriteFmtUserTypeStg @300 -; WriteOleStg @301 -; WriteStringStream @302 - -; EOF +BindMoniker@16 @1 +CLSIDFromProgID@8 @6 +CLSIDFromString@8 @7 +CoBuildVersion@0 @9 +CoCreateFreeThreadedMarshaler@8 @11 +CoCreateGuid@4 @12 +CoCreateInstance@20 @13 +CoCreateInstanceEx@24 @14 +CoDisconnectObject@8 @15 +;CoDosDateTimeToFileTime@12=kernel32.DosDateTimeToFileTime @16 +CoFileTimeNow@4 @17 +;CoFileTimeToDosDateTime@12=kernel32.FileTimeToDosDateTime @18 +CoFreeAllLibraries@0 @19 +CoFreeLibrary@4 @20 +CoFreeUnusedLibraries@0 @21 +CoGetClassObject@20 @24 +CoGetCurrentProcess@0 @26 +CoGetInterfaceAndReleaseStream@12 @29 +CoGetMalloc@8 @30 +CoGetMarshalSizeMax@24 @31 +CoGetPSClsid@8 @33 +CoGetStandardMarshal@24 @34 +CoGetState@4 @35 +CoGetTreatAsClass@8 @37 +CoInitialize@4 @39 +CoInitializeEx@8 @40 +CoInitializeSecurity@36 @41 +CoInitializeWOW@8 @42 +CoIsOle1Class@4 @44 +CoLoadLibrary@8 @45 +CoLockObjectExternal@12 @46 +CoMarshalInterThreadInterfaceInStream@12 @48 +CoMarshalInterface@24 @49 +CoRegisterClassObject@20 @55 +CoRegisterMallocSpy@4 @56 +CoRegisterMessageFilter@8 @57 +CoResumeClassObjects@0 @62 +CoRevokeClassObject@4 @64 +CoRevokeMallocSpy@0 @65 +CoSetState@4 @67 +CoTaskMemAlloc@4 @70 +CoTaskMemFree@4 @71 +CoTaskMemRealloc@8 @72 +CoTreatAsClass@8 @73 +CoUninitialize@0 @74 +CoUnmarshalInterface@12 @77 +CreateAntiMoniker@4 @78 +CreateBindCtx@8 @79 +CreateClassMoniker@8 @80 +CreateDataAdviseHolder@4 @81 +CreateDataCache@16 @82 +CreateErrorInfo@4 @83 +CreateFileMoniker@8 @84 +CreateGenericComposite@12 @85 +CreateILockBytesOnHGlobal@12 @86 +CreateItemMoniker@12 @87 +CreateOleAdviseHolder@4 @89 +CreateStreamOnHGlobal@12 @91 +DllDebugObjectRPCHook@8 @92 +;DllGetClassObject@12=OLE32_DllGetClassObject@12 @93 +;DllRegisterServer@0=OLE32_DllRegisterServer@0 @95 +;DllUnregisterServer@0=OLE32_DllUnregisterServer@0 @96 +DoDragDrop@16 @97 +FreePropVariantArray@8 @99 +GetClassFile@8 @100 +GetConvertStg@4 @101 +GetErrorInfo@8 @103 +GetHGlobalFromILockBytes@8 @104 +GetHGlobalFromStream@8 @105 +GetRunningObjectTable@8 @107 +;IIDFromString@8=CLSIDFromString@8 @148 +IsAccelerator@16 @150 +IsEqualGUID@8 @151 +IsValidInterface@4 @153 +MkParseDisplayName@16 @156 +MonikerCommonPrefixWith@12 @157 +OleBuildVersion@0 @159 +OleConvertIStorageToOLESTREAM@8 @160 +OleConvertOLESTREAMToIStorage@12 @162 +OleCreate@28 @164 +OleCreateDefaultHandler@16 @165 +OleCreateFromData@28 @168 +OleCreateFromFile@32 @170 +OleCreateLink@28 @172 +OleCreateLinkFromData@28 @174 +OleCreateLinkToFile@28 @176 +OleCreateMenuDescriptor@8 @178 +OleCreateStaticFromData@28 @179 +OleDestroyMenuDescriptor@4 @180 +OleDoAutoConvert@8 @181 +OleDraw@16 @182 +OleDuplicateData@12 @183 +OleFlushClipboard@0 @184 +OleGetAutoConvert@8 @185 +OleGetClipboard@4 @186 +OleGetIconOfClass@12 @187 +OleInitialize@4 @189 +OleInitializeWOW@4 @190 +OleIsCurrentClipboard@4 @191 +OleIsRunning@4 @192 +OleLoad@16 @193 +OleLoadFromStream@12 @194 +OleLockRunning@12 @195 +OleMetafilePictFromIconAndLabel@16 @196 +OleQueryCreateFromData@4 @198 +OleQueryLinkFromData@4 @199 +OleRegEnumFormatEtc@12 @200 +OleRegEnumVerbs@8 @201 +OleRegGetMiscStatus@12 @202 +OleRegGetUserType@12 @203 +OleRun@4 @204 +OleSave@12 @205 +OleSaveToStream@8 @206 +OleSetAutoConvert@8 @207 +OleSetClipboard@4 @208 +OleSetContainedObject@8 @209 +OleSetMenuDescriptor@20 @210 +OleTranslateAccelerator@12 @211 +OleUninitialize@0 @212 +ProgIDFromCLSID@8 @214 +PropVariantClear@4 @217 +PropVariantCopy@8 @218 +ReadClassStg@8 @219 +ReadClassStm@8 @220 +ReadFmtUserTypeStg@12 @221 +RegisterDragDrop@8 @224 +ReleaseStgMedium@4 @225 +RevokeDragDrop@4 @226 +SetConvertStg@8 @235 +SetErrorInfo@8 @237 +StgCreateDocfile@16 @238 +StgCreateDocfileOnILockBytes@16 @239 +StgIsStorageFile@4 @243 +StgIsStorageILockBytes@4 @244 +StgOpenStorage@24 @246 +StgOpenStorageOnILockBytes@24 @248 +StgSetTimes@16 @249 +StringFromCLSID@8 @250 +StringFromGUID2@12 @251 +;StringFromIID@8=StringFromCLSID@8 @252 +WriteClassStg@8 @262 +WriteClassStm@8 @263 +WriteFmtUserTypeStg@12 @264 diff --git a/reactos/lib/ole32/ole32.dll.dbg.c b/reactos/lib/ole32/ole32.dll.dbg.c new file mode 100644 index 00000000000..675ea99dca4 --- /dev/null +++ b/reactos/lib/ole32/ole32.dll.dbg.c @@ -0,0 +1,46 @@ +/* File generated automatically; do not edit! */ +/* This file can be copied, modified and distributed without restriction. */ + +char __wine_dbch_accel[] = "\003accel"; +char __wine_dbch_ole[] = "\003ole"; +char __wine_dbch_storage[] = "\003storage"; + +static char * const debug_channels[3] = +{ + __wine_dbch_accel, + __wine_dbch_ole, + __wine_dbch_storage +}; + +static void *debug_registration; + +#ifdef __GNUC__ +static void __wine_dbg_ole32_init(void) __attribute__((constructor)); +static void __wine_dbg_ole32_fini(void) __attribute__((destructor)); +#else +static void __asm__dummy_dll_init(void) { +asm("\t.section\t\".init\" ,\"ax\"\n" + "\tcall ___wine_dbg_ole32_init\n" + "\t.section\t\".fini\" ,\"ax\"\n" + "\tcall ___wine_dbg_ole32_fini\n" + "\t.section\t\".text\"\n"); +} +#endif /* defined(__GNUC__) */ + +#ifdef __GNUC__ +static +#endif +void __wine_dbg_ole32_init(void) +{ + extern void *__wine_dbg_register( char * const *, int ); + debug_registration = __wine_dbg_register( debug_channels, 3 ); +} + +#ifdef __GNUC__ +static +#endif +void __wine_dbg_ole32_fini(void) +{ + extern void __wine_dbg_unregister( void* ); + __wine_dbg_unregister( debug_registration ); +} diff --git a/reactos/lib/ole32/ole32.edf b/reactos/lib/ole32/ole32.edf new file mode 100644 index 00000000000..c3435d47d1a --- /dev/null +++ b/reactos/lib/ole32/ole32.edf @@ -0,0 +1,148 @@ +; File generated automatically from ole32/ole32.spec; do not edit! + +LIBRARY ole32.dll + +EXPORTS +BindMoniker=BindMoniker@16 @1 +CLSIDFromProgID=CLSIDFromProgID@8 @6 +CLSIDFromString=CLSIDFromString@8 @7 +CoBuildVersion=CoBuildVersion@0 @9 +CoCreateFreeThreadedMarshaler=CoCreateFreeThreadedMarshaler@8 @11 +CoCreateGuid=CoCreateGuid@4 @12 +CoCreateInstance=CoCreateInstance@20 @13 +CoCreateInstanceEx=CoCreateInstanceEx@24 @14 +CoDisconnectObject=CoDisconnectObject@8 @15 +CoDosDateTimeToFileTime@12=kernel32.DosDateTimeToFileTime @16 +CoFileTimeNow=CoFileTimeNow@4 @17 +CoFileTimeToDosDateTime@12=kernel32.FileTimeToDosDateTime @18 +CoFreeAllLibraries=CoFreeAllLibraries@0 @19 +CoFreeLibrary=CoFreeLibrary@4 @20 +CoFreeUnusedLibraries=CoFreeUnusedLibraries@0 @21 +CoGetClassObject=CoGetClassObject@20 @24 +CoGetCurrentProcess=CoGetCurrentProcess@0 @26 +CoGetInterfaceAndReleaseStream=CoGetInterfaceAndReleaseStream@12 @29 +CoGetMalloc=CoGetMalloc@8 @30 +CoGetMarshalSizeMax=CoGetMarshalSizeMax@24 @31 +CoGetPSClsid=CoGetPSClsid@8 @33 +CoGetStandardMarshal=CoGetStandardMarshal@24 @34 +CoGetState=CoGetState@4 @35 +CoGetTreatAsClass=CoGetTreatAsClass@8 @37 +CoInitialize=CoInitialize@4 @39 +CoInitializeEx=CoInitializeEx@8 @40 +CoInitializeSecurity=CoInitializeSecurity@36 @41 +CoInitializeWOW=CoInitializeWOW@8 @42 +CoIsOle1Class=CoIsOle1Class@4 @44 +CoLoadLibrary=CoLoadLibrary@8 @45 +CoLockObjectExternal=CoLockObjectExternal@12 @46 +CoMarshalInterThreadInterfaceInStream=CoMarshalInterThreadInterfaceInStream@12 @48 +CoMarshalInterface=CoMarshalInterface@24 @49 +CoRegisterClassObject=CoRegisterClassObject@20 @55 +CoRegisterMallocSpy=CoRegisterMallocSpy@4 @56 +CoRegisterMessageFilter=CoRegisterMessageFilter@8 @57 +CoResumeClassObjects=CoResumeClassObjects@0 @62 +CoRevokeClassObject=CoRevokeClassObject@4 @64 +CoRevokeMallocSpy=CoRevokeMallocSpy@0 @65 +CoSetState=CoSetState@4 @67 +CoTaskMemAlloc=CoTaskMemAlloc@4 @70 +CoTaskMemFree=CoTaskMemFree@4 @71 +CoTaskMemRealloc=CoTaskMemRealloc@8 @72 +CoTreatAsClass=CoTreatAsClass@8 @73 +CoUninitialize=CoUninitialize@0 @74 +CoUnmarshalInterface=CoUnmarshalInterface@12 @77 +CreateAntiMoniker=CreateAntiMoniker@4 @78 +CreateBindCtx=CreateBindCtx@8 @79 +CreateClassMoniker=CreateClassMoniker@8 @80 +CreateDataAdviseHolder=CreateDataAdviseHolder@4 @81 +CreateDataCache=CreateDataCache@16 @82 +CreateErrorInfo=CreateErrorInfo@4 @83 +CreateFileMoniker=CreateFileMoniker@8 @84 +CreateGenericComposite=CreateGenericComposite@12 @85 +CreateILockBytesOnHGlobal=CreateILockBytesOnHGlobal@12 @86 +CreateItemMoniker=CreateItemMoniker@12 @87 +CreateOleAdviseHolder=CreateOleAdviseHolder@4 @89 +CreateStreamOnHGlobal=CreateStreamOnHGlobal@12 @91 +DllDebugObjectRPCHook=DllDebugObjectRPCHook@8 @92 +DllGetClassObject@12=OLE32_DllGetClassObject@12 @93 +DllRegisterServer@0=OLE32_DllRegisterServer@0 @95 +DllUnregisterServer@0=OLE32_DllUnregisterServer@0 @96 +DoDragDrop=DoDragDrop@16 @97 +FreePropVariantArray=FreePropVariantArray@8 @99 +GetClassFile=GetClassFile@8 @100 +GetConvertStg=GetConvertStg@4 @101 +GetErrorInfo=GetErrorInfo@8 @103 +GetHGlobalFromILockBytes=GetHGlobalFromILockBytes@8 @104 +GetHGlobalFromStream=GetHGlobalFromStream@8 @105 +GetRunningObjectTable=GetRunningObjectTable@8 @107 +IIDFromString@8=CLSIDFromString@8 @148 +IsAccelerator=IsAccelerator@16 @150 +IsEqualGUID=IsEqualGUID@8 @151 +IsValidInterface=IsValidInterface@4 @153 +MkParseDisplayName=MkParseDisplayName@16 @156 +MonikerCommonPrefixWith=MonikerCommonPrefixWith@12 @157 +OleBuildVersion=OleBuildVersion@0 @159 +OleConvertIStorageToOLESTREAM=OleConvertIStorageToOLESTREAM@8 @160 +OleConvertOLESTREAMToIStorage=OleConvertOLESTREAMToIStorage@12 @162 +OleCreate=OleCreate@28 @164 +OleCreateDefaultHandler=OleCreateDefaultHandler@16 @165 +OleCreateFromData=OleCreateFromData@28 @168 +OleCreateFromFile=OleCreateFromFile@32 @170 +OleCreateLink=OleCreateLink@28 @172 +OleCreateLinkFromData=OleCreateLinkFromData@28 @174 +OleCreateLinkToFile=OleCreateLinkToFile@28 @176 +OleCreateMenuDescriptor=OleCreateMenuDescriptor@8 @178 +OleCreateStaticFromData=OleCreateStaticFromData@28 @179 +OleDestroyMenuDescriptor=OleDestroyMenuDescriptor@4 @180 +OleDoAutoConvert=OleDoAutoConvert@8 @181 +OleDraw=OleDraw@16 @182 +OleDuplicateData=OleDuplicateData@12 @183 +OleFlushClipboard=OleFlushClipboard@0 @184 +OleGetAutoConvert=OleGetAutoConvert@8 @185 +OleGetClipboard=OleGetClipboard@4 @186 +OleGetIconOfClass=OleGetIconOfClass@12 @187 +OleInitialize=OleInitialize@4 @189 +OleInitializeWOW=OleInitializeWOW@4 @190 +OleIsCurrentClipboard=OleIsCurrentClipboard@4 @191 +OleIsRunning=OleIsRunning@4 @192 +OleLoad=OleLoad@16 @193 +OleLoadFromStream=OleLoadFromStream@12 @194 +OleLockRunning=OleLockRunning@12 @195 +OleMetafilePictFromIconAndLabel=OleMetafilePictFromIconAndLabel@16 @196 +OleQueryCreateFromData=OleQueryCreateFromData@4 @198 +OleQueryLinkFromData=OleQueryLinkFromData@4 @199 +OleRegEnumFormatEtc=OleRegEnumFormatEtc@12 @200 +OleRegEnumVerbs=OleRegEnumVerbs@8 @201 +OleRegGetMiscStatus=OleRegGetMiscStatus@12 @202 +OleRegGetUserType=OleRegGetUserType@12 @203 +OleRun=OleRun@4 @204 +OleSave=OleSave@12 @205 +OleSaveToStream=OleSaveToStream@8 @206 +OleSetAutoConvert=OleSetAutoConvert@8 @207 +OleSetClipboard=OleSetClipboard@4 @208 +OleSetContainedObject=OleSetContainedObject@8 @209 +OleSetMenuDescriptor=OleSetMenuDescriptor@20 @210 +OleTranslateAccelerator=OleTranslateAccelerator@12 @211 +OleUninitialize=OleUninitialize@0 @212 +ProgIDFromCLSID=ProgIDFromCLSID@8 @214 +PropVariantClear=PropVariantClear@4 @217 +PropVariantCopy=PropVariantCopy@8 @218 +ReadClassStg=ReadClassStg@8 @219 +ReadClassStm=ReadClassStm@8 @220 +ReadFmtUserTypeStg=ReadFmtUserTypeStg@12 @221 +RegisterDragDrop=RegisterDragDrop@8 @224 +ReleaseStgMedium=ReleaseStgMedium@4 @225 +RevokeDragDrop=RevokeDragDrop@4 @226 +SetConvertStg=SetConvertStg@8 @235 +SetErrorInfo=SetErrorInfo@8 @237 +StgCreateDocfile=StgCreateDocfile@16 @238 +StgCreateDocfileOnILockBytes=StgCreateDocfileOnILockBytes@16 @239 +StgIsStorageFile=StgIsStorageFile@4 @243 +StgIsStorageILockBytes=StgIsStorageILockBytes@4 @244 +StgOpenStorage=StgOpenStorage@24 @246 +StgOpenStorageOnILockBytes=StgOpenStorageOnILockBytes@24 @248 +StgSetTimes=StgSetTimes@16 @249 +StringFromCLSID=StringFromCLSID@8 @250 +StringFromGUID2=StringFromGUID2@12 @251 +StringFromIID@8=StringFromCLSID@8 @252 +WriteClassStg=WriteClassStg@8 @262 +WriteClassStm=WriteClassStm@8 @263 +WriteFmtUserTypeStg=WriteFmtUserTypeStg@12 @264 diff --git a/reactos/lib/ole32/ole32_main.c b/reactos/lib/ole32/ole32_main.c new file mode 100644 index 00000000000..3dd9067ed8c --- /dev/null +++ b/reactos/lib/ole32/ole32_main.c @@ -0,0 +1,139 @@ +/* + * OLE32 Initialization + * + * Copyright 2000 Huw D M Davies for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +#include "windef.h" +#include "winerror.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winnls.h" +#include "ole32_main.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +HINSTANCE OLE32_hInstance = 0; + +/*********************************************************************** + * OleMetafilePictFromIconAndLabel (OLE32.@) + */ +HGLOBAL WINAPI OleMetafilePictFromIconAndLabel(HICON hIcon, LPOLESTR lpszLabel, + LPOLESTR lpszSourceFile, UINT iIconIndex) +{ + METAFILEPICT mfp; + HDC hdc; + UINT dy; + HGLOBAL hmem = NULL; + LPVOID mfdata; + static const char szIconOnly[] = "IconOnly"; + + TRACE("%p %p %s %d\n", hIcon, lpszLabel, debugstr_w(lpszSourceFile), iIconIndex); + + if( !hIcon ) + return NULL; + + hdc = CreateMetaFileW(NULL); + if( !hdc ) + return NULL; + + ExtEscape(hdc, MFCOMMENT, sizeof(szIconOnly), szIconOnly, 0, NULL); + + /* FIXME: things are drawn in the wrong place */ + DrawIcon(hdc, 0, 0, hIcon); + dy = GetSystemMetrics(SM_CXICON); + if(lpszLabel) + TextOutW(hdc, 0, dy, lpszLabel, lstrlenW(lpszLabel)); + + if (lpszSourceFile) + { + char szIconIndex[10]; + int path_length = WideCharToMultiByte(CP_ACP,0,lpszSourceFile,-1,NULL,0,NULL,NULL); + if (path_length > 1) + { + char * szPath = CoTaskMemAlloc(path_length * sizeof(CHAR)); + if (szPath) + { + WideCharToMultiByte(CP_ACP,0,lpszSourceFile,-1,szPath,path_length,NULL,NULL); + ExtEscape(hdc, MFCOMMENT, path_length, szPath, 0, NULL); + CoTaskMemFree(szPath); + } + } + snprintf(szIconIndex, 10, "%u", iIconIndex); + ExtEscape(hdc, MFCOMMENT, strlen(szIconIndex)+1, szIconIndex, 0, NULL); + } + + mfp.mm = MM_ISOTROPIC; + mfp.xExt = mfp.yExt = 0; /* FIXME ? */ + mfp.hMF = CloseMetaFile(hdc); + if( !mfp.hMF ) + return NULL; + + hmem = GlobalAlloc( GMEM_MOVEABLE, sizeof(mfp) ); + if( !hmem ) + { + DeleteMetaFile(mfp.hMF); + return NULL; + } + + mfdata = GlobalLock( hmem ); + if( !mfdata ) + { + GlobalFree( hmem ); + DeleteMetaFile(mfp.hMF); + return NULL; + } + + memcpy(mfdata,&mfp,sizeof(mfp)); + GlobalUnlock( hmem ); + + TRACE("returning %p\n",hmem); + + return hmem; +} + + +/*********************************************************************** + * DllMain (OLE32.@) + */ +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) +{ + TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad); + + switch(fdwReason) { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + OLE32_hInstance = hinstDLL; + COMPOBJ_InitProcess(); + if (TRACE_ON(ole)) CoRegisterMallocSpy((LPVOID)-1); + break; + + case DLL_PROCESS_DETACH: + if (TRACE_ON(ole)) CoRevokeMallocSpy(); + COMPOBJ_UninitProcess(); + OLE32_hInstance = 0; + break; + } + return TRUE; +} + +/* NOTE: DllRegisterServer and DllUnregisterServer are in regsvr.c */ diff --git a/reactos/lib/ole32/ole32_main.h b/reactos/lib/ole32/ole32_main.h new file mode 100644 index 00000000000..f488b07fe50 --- /dev/null +++ b/reactos/lib/ole32/ole32_main.h @@ -0,0 +1,33 @@ +/* + * Copyright 2000 Huw D M Davies for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WINE_OLE32_MAIN_H +#define __WINE_OLE32_MAIN_H + +#include + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" + +extern HINSTANCE OLE32_hInstance; + +void COMPOBJ_InitProcess( void ); +void COMPOBJ_UninitProcess( void ); + +#endif /* __WINE_OLE32_MAIN_H */ diff --git a/reactos/lib/ole32/oleobj.c b/reactos/lib/ole32/oleobj.c new file mode 100644 index 00000000000..4175084f150 --- /dev/null +++ b/reactos/lib/ole32/oleobj.c @@ -0,0 +1,766 @@ +/* + * OLE2 COM objects + * + * Copyright 1998 Eric Kohl + * Copyright 1999 Francis Beaudet + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#ifdef __REACTOS__ +#include +#endif +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "winerror.h" +#include "wine/debug.h" +#include "ole2.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +#define INITIAL_SINKS 10 + +/************************************************************************** + * OleAdviseHolderImpl Implementation + */ +typedef struct OleAdviseHolderImpl +{ + ICOM_VFIELD(IOleAdviseHolder); + + DWORD ref; + + DWORD maxSinks; + IAdviseSink** arrayOfSinks; + +} OleAdviseHolderImpl; + +static LPOLEADVISEHOLDER OleAdviseHolderImpl_Constructor(); +static void OleAdviseHolderImpl_Destructor(OleAdviseHolderImpl* ptrToDestroy); +static HRESULT WINAPI OleAdviseHolderImpl_QueryInterface(LPOLEADVISEHOLDER,REFIID,LPVOID*); +static ULONG WINAPI OleAdviseHolderImpl_AddRef(LPOLEADVISEHOLDER); +static ULONG WINAPI OleAdviseHolderImpl_Release(LPOLEADVISEHOLDER); +static HRESULT WINAPI OleAdviseHolderImpl_Advise(LPOLEADVISEHOLDER, IAdviseSink*, DWORD*); +static HRESULT WINAPI OleAdviseHolderImpl_Unadvise (LPOLEADVISEHOLDER, DWORD); +static HRESULT WINAPI OleAdviseHolderImpl_EnumAdvise (LPOLEADVISEHOLDER, IEnumSTATDATA **); +static HRESULT WINAPI OleAdviseHolderImpl_SendOnRename (LPOLEADVISEHOLDER, IMoniker *); +static HRESULT WINAPI OleAdviseHolderImpl_SendOnSave (LPOLEADVISEHOLDER); +static HRESULT WINAPI OleAdviseHolderImpl_SendOnClose (LPOLEADVISEHOLDER); + + +/************************************************************************** + * OleAdviseHolderImpl_VTable + */ +static struct ICOM_VTABLE(IOleAdviseHolder) oahvt = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + OleAdviseHolderImpl_QueryInterface, + OleAdviseHolderImpl_AddRef, + OleAdviseHolderImpl_Release, + OleAdviseHolderImpl_Advise, + OleAdviseHolderImpl_Unadvise, + OleAdviseHolderImpl_EnumAdvise, + OleAdviseHolderImpl_SendOnRename, + OleAdviseHolderImpl_SendOnSave, + OleAdviseHolderImpl_SendOnClose +}; + +/************************************************************************** + * OleAdviseHolderImpl_Constructor + */ + +static LPOLEADVISEHOLDER OleAdviseHolderImpl_Constructor() +{ + OleAdviseHolderImpl* lpoah; + DWORD index; + + lpoah= (OleAdviseHolderImpl*)HeapAlloc(GetProcessHeap(), + 0, + sizeof(OleAdviseHolderImpl)); + + lpoah->lpVtbl = &oahvt; + lpoah->ref = 1; + lpoah->maxSinks = INITIAL_SINKS; + lpoah->arrayOfSinks = HeapAlloc(GetProcessHeap(), + 0, + lpoah->maxSinks * sizeof(IAdviseSink*)); + + for (index = 0; index < lpoah->maxSinks; index++) + lpoah->arrayOfSinks[index]=0; + + TRACE("returning %p\n", lpoah); + return (LPOLEADVISEHOLDER)lpoah; +} + +/************************************************************************** + * OleAdviseHolderImpl_Destructor + */ +static void OleAdviseHolderImpl_Destructor( + OleAdviseHolderImpl* ptrToDestroy) +{ + DWORD index; + TRACE("%p\n", ptrToDestroy); + + for (index = 0; index < ptrToDestroy->maxSinks; index++) + { + if (ptrToDestroy->arrayOfSinks[index]!=0) + { + IAdviseSink_Release(ptrToDestroy->arrayOfSinks[index]); + ptrToDestroy->arrayOfSinks[index] = NULL; + } + } + + HeapFree(GetProcessHeap(), + 0, + ptrToDestroy->arrayOfSinks); + + + HeapFree(GetProcessHeap(), + 0, + ptrToDestroy); +} + +/************************************************************************** + * OleAdviseHolderImpl_QueryInterface + */ +static HRESULT WINAPI OleAdviseHolderImpl_QueryInterface( + LPOLEADVISEHOLDER iface, + REFIID riid, + LPVOID* ppvObj) +{ + ICOM_THIS(OleAdviseHolderImpl, iface); + TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObj); + /* + * Sanity check + */ + if (ppvObj==NULL) + return E_POINTER; + + *ppvObj = NULL; + + if (IsEqualIID(riid, &IID_IUnknown)) + { + /* IUnknown */ + *ppvObj = This; + } + else if(IsEqualIID(riid, &IID_IOleAdviseHolder)) + { + /* IOleAdviseHolder */ + *ppvObj = (IOleAdviseHolder*) This; + } + + if(*ppvObj == NULL) + return E_NOINTERFACE; + + /* + * A successful QI always increments the reference count. + */ + IUnknown_AddRef((IUnknown*)*ppvObj); + + return S_OK; +} + +/****************************************************************************** + * OleAdviseHolderImpl_AddRef + */ +static ULONG WINAPI OleAdviseHolderImpl_AddRef( + LPOLEADVISEHOLDER iface) +{ + ICOM_THIS(OleAdviseHolderImpl, iface); + TRACE("(%p)->(ref=%ld)\n", This, This->ref); + return ++(This->ref); +} + +/****************************************************************************** + * OleAdviseHolderImpl_Release + */ +static ULONG WINAPI OleAdviseHolderImpl_Release( + LPOLEADVISEHOLDER iface) +{ + ICOM_THIS(OleAdviseHolderImpl, iface); + TRACE("(%p)->(ref=%ld)\n", This, This->ref); + This->ref--; + + if (This->ref == 0) + { + OleAdviseHolderImpl_Destructor(This); + + return 0; + } + + return This->ref; +} + +/****************************************************************************** + * OleAdviseHolderImpl_Advise + */ +static HRESULT WINAPI OleAdviseHolderImpl_Advise( + LPOLEADVISEHOLDER iface, + IAdviseSink* pAdvise, + DWORD* pdwConnection) +{ + DWORD index; + + ICOM_THIS(OleAdviseHolderImpl, iface); + + TRACE("(%p)->(%p, %p)\n", This, pAdvise, pdwConnection); + + /* + * Sanity check + */ + if (pdwConnection==NULL) + return E_POINTER; + + *pdwConnection = 0; + + /* + * Find a free spot in the array. + */ + for (index = 0; index < This->maxSinks; index++) + { + if (This->arrayOfSinks[index]==NULL) + break; + } + + /* + * If the array is full, we need to grow it. + */ + if (index == This->maxSinks) + { + DWORD i; + + This->maxSinks+=INITIAL_SINKS; + + This->arrayOfSinks = HeapReAlloc(GetProcessHeap(), + 0, + This->arrayOfSinks, + This->maxSinks*sizeof(IAdviseSink*)); + + for (i=index;i < This->maxSinks; i++) + This->arrayOfSinks[i]=0; + } + + /* + * Store the new sink + */ + This->arrayOfSinks[index] = pAdvise; + + if (This->arrayOfSinks[index]!=NULL) + IAdviseSink_AddRef(This->arrayOfSinks[index]); + + /* + * Return the index as the cookie. + * Since 0 is not a valid cookie, we will increment by + * 1 the index in the table. + */ + *pdwConnection = index+1; + + return S_OK; +} + +/****************************************************************************** + * OleAdviseHolderImpl_Unadvise + */ +static HRESULT WINAPI OleAdviseHolderImpl_Unadvise( + LPOLEADVISEHOLDER iface, + DWORD dwConnection) +{ + ICOM_THIS(OleAdviseHolderImpl, iface); + + TRACE("(%p)->(%lu)\n", This, dwConnection); + + /* + * So we don't return 0 as a cookie, the index was + * incremented by 1 in OleAdviseHolderImpl_Advise + * we have to compensate. + */ + dwConnection--; + + /* + * Check for invalid cookies. + */ + if (dwConnection >= This->maxSinks) + return OLE_E_NOCONNECTION; + + if (This->arrayOfSinks[dwConnection] == NULL) + return OLE_E_NOCONNECTION; + + /* + * Release the sink and mark the spot in the list as free. + */ + IAdviseSink_Release(This->arrayOfSinks[dwConnection]); + This->arrayOfSinks[dwConnection] = NULL; + + return S_OK; +} + +/****************************************************************************** + * OleAdviseHolderImpl_EnumAdvise + */ +static HRESULT WINAPI +OleAdviseHolderImpl_EnumAdvise (LPOLEADVISEHOLDER iface, IEnumSTATDATA **ppenumAdvise) +{ + ICOM_THIS(OleAdviseHolderImpl, iface); + FIXME("(%p)->(%p)\n", This, ppenumAdvise); + + *ppenumAdvise = NULL; + + return S_OK; +} + +/****************************************************************************** + * OleAdviseHolderImpl_SendOnRename + */ +static HRESULT WINAPI +OleAdviseHolderImpl_SendOnRename (LPOLEADVISEHOLDER iface, IMoniker *pmk) +{ + ICOM_THIS(OleAdviseHolderImpl, iface); + FIXME("(%p)->(%p)\n", This, pmk); + + + return S_OK; +} + +/****************************************************************************** + * OleAdviseHolderImpl_SendOnSave + */ +static HRESULT WINAPI +OleAdviseHolderImpl_SendOnSave (LPOLEADVISEHOLDER iface) +{ + ICOM_THIS(OleAdviseHolderImpl, iface); + FIXME("(%p)\n", This); + + return S_OK; +} + +/****************************************************************************** + * OleAdviseHolderImpl_SendOnClose + */ +static HRESULT WINAPI +OleAdviseHolderImpl_SendOnClose (LPOLEADVISEHOLDER iface) +{ + ICOM_THIS(OleAdviseHolderImpl, iface); + FIXME("(%p)\n", This); + + + return S_OK; +} + +/************************************************************************** + * DataAdviseHolder Implementation + */ +typedef struct DataAdviseConnection { + IAdviseSink *sink; + FORMATETC fmat; + DWORD advf; +} DataAdviseConnection; + +typedef struct DataAdviseHolder +{ + ICOM_VFIELD(IDataAdviseHolder); + + DWORD ref; + DWORD maxCons; + DataAdviseConnection* Connections; +} DataAdviseHolder; + +/************************************************************************** + * DataAdviseHolder method prototypes + */ +static IDataAdviseHolder* DataAdviseHolder_Constructor(); +static void DataAdviseHolder_Destructor(DataAdviseHolder* ptrToDestroy); +static HRESULT WINAPI DataAdviseHolder_QueryInterface( + IDataAdviseHolder* iface, + REFIID riid, + void** ppvObject); +static ULONG WINAPI DataAdviseHolder_AddRef( + IDataAdviseHolder* iface); +static ULONG WINAPI DataAdviseHolder_Release( + IDataAdviseHolder* iface); +static HRESULT WINAPI DataAdviseHolder_Advise( + IDataAdviseHolder* iface, + IDataObject* pDataObject, + FORMATETC* pFetc, + DWORD advf, + IAdviseSink* pAdvise, + DWORD* pdwConnection); +static HRESULT WINAPI DataAdviseHolder_Unadvise( + IDataAdviseHolder* iface, + DWORD dwConnection); +static HRESULT WINAPI DataAdviseHolder_EnumAdvise( + IDataAdviseHolder* iface, + IEnumSTATDATA** ppenumAdvise); +static HRESULT WINAPI DataAdviseHolder_SendOnDataChange( + IDataAdviseHolder* iface, + IDataObject* pDataObject, + DWORD dwReserved, + DWORD advf); + +/************************************************************************** + * DataAdviseHolderImpl_VTable + */ +static struct ICOM_VTABLE(IDataAdviseHolder) DataAdviseHolderImpl_VTable = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + DataAdviseHolder_QueryInterface, + DataAdviseHolder_AddRef, + DataAdviseHolder_Release, + DataAdviseHolder_Advise, + DataAdviseHolder_Unadvise, + DataAdviseHolder_EnumAdvise, + DataAdviseHolder_SendOnDataChange +}; + +/****************************************************************************** + * DataAdviseHolder_Constructor + */ +static IDataAdviseHolder* DataAdviseHolder_Constructor() +{ + DataAdviseHolder* newHolder; + + newHolder = (DataAdviseHolder*)HeapAlloc(GetProcessHeap(), + 0, + sizeof(DataAdviseHolder)); + + newHolder->lpVtbl = &DataAdviseHolderImpl_VTable; + newHolder->ref = 1; + newHolder->maxCons = INITIAL_SINKS; + newHolder->Connections = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + newHolder->maxCons * + sizeof(DataAdviseConnection)); + + TRACE("returning %p\n", newHolder); + return (IDataAdviseHolder*)newHolder; +} + +/****************************************************************************** + * DataAdviseHolder_Destructor + */ +static void DataAdviseHolder_Destructor(DataAdviseHolder* ptrToDestroy) +{ + DWORD index; + TRACE("%p\n", ptrToDestroy); + + for (index = 0; index < ptrToDestroy->maxCons; index++) + { + if (ptrToDestroy->Connections[index].sink != NULL) + { + IAdviseSink_Release(ptrToDestroy->Connections[index].sink); + ptrToDestroy->Connections[index].sink = NULL; + } + } + + HeapFree(GetProcessHeap(), 0, ptrToDestroy->Connections); + HeapFree(GetProcessHeap(), 0, ptrToDestroy); +} + +/************************************************************************ + * DataAdviseHolder_QueryInterface (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static HRESULT WINAPI DataAdviseHolder_QueryInterface( + IDataAdviseHolder* iface, + REFIID riid, + void** ppvObject) +{ + ICOM_THIS(DataAdviseHolder, iface); + TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject); + /* + * Perform a sanity check on the parameters. + */ + if ( (This==0) || (ppvObject==0) ) + return E_INVALIDARG; + + /* + * Initialize the return parameter. + */ + *ppvObject = 0; + + /* + * Compare the riid with the interface IDs implemented by this object. + */ + if ( (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) || + (memcmp(&IID_IDataAdviseHolder, riid, sizeof(IID_IDataAdviseHolder)) == 0) ) + { + *ppvObject = iface; + } + + /* + * Check that we obtained an interface. + */ + if ((*ppvObject)==0) + { + return E_NOINTERFACE; + } + + /* + * Query Interface always increases the reference count by one when it is + * successful. + */ + IUnknown_AddRef((IUnknown*)*ppvObject); + + return S_OK; +} + +/************************************************************************ + * DataAdviseHolder_AddRef (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static ULONG WINAPI DataAdviseHolder_AddRef( + IDataAdviseHolder* iface) +{ + ICOM_THIS(DataAdviseHolder, iface); + TRACE("(%p) (ref=%ld)\n", This, This->ref); + This->ref++; + + return This->ref; +} + +/************************************************************************ + * DataAdviseHolder_Release (IUnknown) + * + * See Windows documentation for more details on IUnknown methods. + */ +static ULONG WINAPI DataAdviseHolder_Release( + IDataAdviseHolder* iface) +{ + ICOM_THIS(DataAdviseHolder, iface); + TRACE("(%p) (ref=%ld)\n", This, This->ref); + + /* + * Decrease the reference count on this object. + */ + This->ref--; + + /* + * If the reference count goes down to 0, perform suicide. + */ + if (This->ref==0) + { + DataAdviseHolder_Destructor(This); + + return 0; + } + + return This->ref; +} + +/************************************************************************ + * DataAdviseHolder_Advise + * + */ +static HRESULT WINAPI DataAdviseHolder_Advise( + IDataAdviseHolder* iface, + IDataObject* pDataObject, + FORMATETC* pFetc, + DWORD advf, + IAdviseSink* pAdvise, + DWORD* pdwConnection) +{ + DWORD index; + + ICOM_THIS(DataAdviseHolder, iface); + + TRACE("(%p)->(%p, %p, %08lx, %p, %p)\n", This, pDataObject, pFetc, advf, + pAdvise, pdwConnection); + /* + * Sanity check + */ + if (pdwConnection==NULL) + return E_POINTER; + + *pdwConnection = 0; + + /* + * Find a free spot in the array. + */ + for (index = 0; index < This->maxCons; index++) + { + if (This->Connections[index].sink == NULL) + break; + } + + /* + * If the array is full, we need to grow it. + */ + if (index == This->maxCons) + { + This->maxCons+=INITIAL_SINKS; + This->Connections = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + This->Connections, + This->maxCons*sizeof(DataAdviseConnection)); + } + /* + * Store the new sink + */ + This->Connections[index].sink = pAdvise; + memcpy(&(This->Connections[index].fmat), pFetc, sizeof(FORMATETC)); + This->Connections[index].advf = advf; + + if (This->Connections[index].sink != NULL) { + IAdviseSink_AddRef(This->Connections[index].sink); + if(advf & ADVF_PRIMEFIRST) { + DataAdviseHolder_SendOnDataChange(iface, pDataObject, 0, advf); + } + } + /* + * Return the index as the cookie. + * Since 0 is not a valid cookie, we will increment by + * 1 the index in the table. + */ + *pdwConnection = index+1; + + return S_OK; +} + +/****************************************************************************** + * DataAdviseHolder_Unadvise + */ +static HRESULT WINAPI DataAdviseHolder_Unadvise( + IDataAdviseHolder* iface, + DWORD dwConnection) +{ + ICOM_THIS(DataAdviseHolder, iface); + + TRACE("(%p)->(%lu)\n", This, dwConnection); + + /* + * So we don't return 0 as a cookie, the index was + * incremented by 1 in OleAdviseHolderImpl_Advise + * we have to compensate. + */ + dwConnection--; + + /* + * Check for invalid cookies. + */ + if (dwConnection >= This->maxCons) + return OLE_E_NOCONNECTION; + + if (This->Connections[dwConnection].sink == NULL) + return OLE_E_NOCONNECTION; + + /* + * Release the sink and mark the spot in the list as free. + */ + IAdviseSink_Release(This->Connections[dwConnection].sink); + memset(&(This->Connections[dwConnection]), 0, sizeof(DataAdviseConnection)); + return S_OK; +} + +static HRESULT WINAPI DataAdviseHolder_EnumAdvise( + IDataAdviseHolder* iface, + IEnumSTATDATA** ppenumAdvise) +{ + ICOM_THIS(DataAdviseHolder, iface); + + FIXME("(%p)->(%p)\n", This, ppenumAdvise); + return E_NOTIMPL; +} + +/****************************************************************************** + * DataAdviseHolder_SendOnDataChange + */ +static HRESULT WINAPI DataAdviseHolder_SendOnDataChange( + IDataAdviseHolder* iface, + IDataObject* pDataObject, + DWORD dwReserved, + DWORD advf) +{ + ICOM_THIS(DataAdviseHolder, iface); + DWORD index; + STGMEDIUM stg; + HRESULT res; + + TRACE("(%p)->(%p,%08lx,%08lx)\n", This, pDataObject, dwReserved, advf); + + for(index = 0; index < This->maxCons; index++) { + if(This->Connections[index].sink != NULL) { + if(!(This->Connections[index].advf & ADVF_NODATA)) { + TRACE("Calling IDataObject_GetData\n"); + res = IDataObject_GetData(pDataObject, + &(This->Connections[index].fmat), + &stg); + TRACE("returns %08lx\n", res); + } + TRACE("Calling IAdviseSink_OnDataChange\n"); + IAdviseSink_OnDataChange(This->Connections[index].sink, + &(This->Connections[index].fmat), + &stg); + TRACE("Done IAdviseSink_OnDataChange\n"); + if(This->Connections[index].advf & ADVF_ONLYONCE) { + TRACE("Removing connection\n"); + DataAdviseHolder_Unadvise(iface, index+1); + } + } + } + return S_OK; +} + +/*********************************************************************** + * API functions + */ + +/*********************************************************************** + * CreateOleAdviseHolder [OLE32.@] + */ +HRESULT WINAPI CreateOleAdviseHolder( + LPOLEADVISEHOLDER *ppOAHolder) +{ + TRACE("(%p)\n", ppOAHolder); + + /* + * Sanity check, + */ + if (ppOAHolder==NULL) + return E_POINTER; + + *ppOAHolder = OleAdviseHolderImpl_Constructor (); + + if (*ppOAHolder != NULL) + return S_OK; + + return E_OUTOFMEMORY; +} + +/****************************************************************************** + * CreateDataAdviseHolder [OLE32.@] + */ +HRESULT WINAPI CreateDataAdviseHolder( + LPDATAADVISEHOLDER* ppDAHolder) +{ + TRACE("(%p)\n", ppDAHolder); + + /* + * Sanity check, + */ + if (ppDAHolder==NULL) + return E_POINTER; + + *ppDAHolder = DataAdviseHolder_Constructor(); + + if (*ppDAHolder != NULL) + return S_OK; + + return E_OUTOFMEMORY; +} diff --git a/reactos/lib/ole32/oleproxy.c b/reactos/lib/ole32/oleproxy.c new file mode 100644 index 00000000000..30b881bb252 --- /dev/null +++ b/reactos/lib/ole32/oleproxy.c @@ -0,0 +1,537 @@ +/* + * OLE32 proxy/stub handler + * + * Copyright 2002 Marcus Meissner + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* Documentation on MSDN: + * + * (COM Proxy) + * http://msdn.microsoft.com/library/en-us/com/comext_1q0p.asp + * + * (COM Stub) + * http://msdn.microsoft.com/library/en-us/com/comext_1lia.asp + * + * (Marshal) + * http://msdn.microsoft.com/library/en-us/com/comext_1gfn.asp + * + */ + +#include "config.h" + +#include +#include +#include +#include + +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "objbase.h" +#include "ole2.h" +#include "rpc.h" +#include "winerror.h" +#include "winreg.h" +#include "wtypes.h" + +#include "compobj_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +const CLSID CLSID_DfMarshal = { 0x0000030b, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46} }; +const CLSID CLSID_PSFactoryBuffer = { 0x00000320, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46} }; + +/* From: http://msdn.microsoft.com/library/en-us/com/cmi_m_4lda.asp + * + * The first time a client requests a pointer to an interface on a + * particular object, COM loads an IClassFactory stub in the server + * process and uses it to marshal the first pointer back to the + * client. In the client process, COM loads the generic proxy for the + * class factory object and calls its implementation of IMarshal to + * unmarshal that first pointer. COM then creates the first interface + * proxy and hands it a pointer to the RPC channel. Finally, COM returns + * the IClassFactory pointer to the client, which uses it to call + * IClassFactory::CreateInstance, passing it a reference to the interface. + * + * Back in the server process, COM now creates a new instance of the + * object, along with a stub for the requested interface. This stub marshals + * the interface pointer back to the client process, where another object + * proxy is created, this time for the object itself. Also created is a + * proxy for the requested interface, a pointer to which is returned to + * the client. With subsequent calls to other interfaces on the object, + * COM will load the appropriate interface stubs and proxies as needed. + */ +typedef struct _CFStub { + ICOM_VTABLE(IRpcStubBuffer) *lpvtbl; + DWORD ref; + + LPUNKNOWN pUnkServer; +} CFStub; + +static HRESULT WINAPI +CFStub_QueryInterface(LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *ppv) { + if (IsEqualIID(&IID_IUnknown,riid)||IsEqualIID(&IID_IRpcStubBuffer,riid)) { + *ppv = (LPVOID)iface; + IUnknown_AddRef(iface); + return S_OK; + } + FIXME("(%s), interface not supported.\n",debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI +CFStub_AddRef(LPRPCSTUBBUFFER iface) { + ICOM_THIS(CFStub,iface); + + This->ref++; + return This->ref; +} + +static ULONG WINAPI +CFStub_Release(LPRPCSTUBBUFFER iface) { + ICOM_THIS(CFStub,iface); + + This->ref--; + if (This->ref) + return This->ref; + HeapFree(GetProcessHeap(),0,This); + return 0; +} + +static HRESULT WINAPI +CFStub_Connect(LPRPCSTUBBUFFER iface, IUnknown *pUnkServer) { + ICOM_THIS(CFStub,iface); + + This->pUnkServer = pUnkServer; + IUnknown_AddRef(pUnkServer); + return S_OK; +} + +static void WINAPI +CFStub_Disconnect(LPRPCSTUBBUFFER iface) { + ICOM_THIS(CFStub,iface); + + IUnknown_Release(This->pUnkServer); + This->pUnkServer = NULL; +} +static HRESULT WINAPI +CFStub_Invoke( + LPRPCSTUBBUFFER iface,RPCOLEMESSAGE* msg,IRpcChannelBuffer* chanbuf +) { + ICOM_THIS(CFStub,iface); + HRESULT hres; + + if (msg->iMethod == 3) { /* CreateInstance */ + IID iid; + IClassFactory *classfac; + IUnknown *ppv; + IStream *pStm; + STATSTG ststg; + ULARGE_INTEGER newpos; + LARGE_INTEGER seekto; + ULONG res; + + if (msg->cbBuffer < sizeof(IID)) { + FIXME("Not enough bytes in buffer (%ld instead of %d)?\n",msg->cbBuffer,sizeof(IID)); + return E_FAIL; + } + memcpy(&iid,msg->Buffer,sizeof(iid)); + TRACE("->CreateInstance(%s)\n",debugstr_guid(&iid)); + hres = IUnknown_QueryInterface(This->pUnkServer,&IID_IClassFactory,(LPVOID*)&classfac); + if (hres) { + FIXME("Ole server does not provide a IClassFactory?\n"); + return hres; + } + hres = IClassFactory_CreateInstance(classfac,NULL,&iid,(LPVOID*)&ppv); + IClassFactory_Release(classfac); + if (hres) { + msg->cbBuffer = 0; + FIXME("Failed to create an instance of %s\n",debugstr_guid(&iid)); + return hres; + } + hres = CreateStreamOnHGlobal(0,TRUE,&pStm); + if (hres) { + FIXME("Failed to create stream on hglobal\n"); + return hres; + } + hres = CoMarshalInterface(pStm,&iid,ppv,0,NULL,0); + if (hres) { + FIXME("CoMarshalInterface failed, %lx!\n",hres); + msg->cbBuffer = 0; + return hres; + } + hres = IStream_Stat(pStm,&ststg,0); + if (hres) { + FIXME("Stat failed.\n"); + return hres; + } + + msg->cbBuffer = ststg.cbSize.u.LowPart; + + if (msg->Buffer) + msg->Buffer = HeapReAlloc(GetProcessHeap(),0,msg->Buffer,ststg.cbSize.u.LowPart); + else + msg->Buffer = HeapAlloc(GetProcessHeap(),0,ststg.cbSize.u.LowPart); + + seekto.u.LowPart = 0;seekto.u.HighPart = 0; + hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos); + if (hres) { + FIXME("IStream_Seek failed, %lx\n",hres); + return hres; + } + hres = IStream_Read(pStm,msg->Buffer,msg->cbBuffer,&res); + if (hres) { + FIXME("Stream Read failed, %lx\n",hres); + return hres; + } + IStream_Release(pStm); + return S_OK; + } + FIXME("(%p,%p), stub!\n",msg,chanbuf); + FIXME("iMethod is %ld\n",msg->iMethod); + FIXME("cbBuffer is %ld\n",msg->cbBuffer); + return E_FAIL; +} + +static LPRPCSTUBBUFFER WINAPI +CFStub_IsIIDSupported(LPRPCSTUBBUFFER iface,REFIID riid) { + FIXME("(%s), stub!\n",debugstr_guid(riid)); + return NULL; +} + +static ULONG WINAPI +CFStub_CountRefs(LPRPCSTUBBUFFER iface) { + FIXME("(), stub!\n"); + return 1; +} + +static HRESULT WINAPI +CFStub_DebugServerQueryInterface(LPRPCSTUBBUFFER iface,void** ppv) { + FIXME("(%p), stub!\n",ppv); + return E_FAIL; +} +static void WINAPI +CFStub_DebugServerRelease(LPRPCSTUBBUFFER iface,void *pv) { + FIXME("(%p), stub!\n",pv); +} + +static ICOM_VTABLE(IRpcStubBuffer) cfstubvt = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + CFStub_QueryInterface, + CFStub_AddRef, + CFStub_Release, + CFStub_Connect, + CFStub_Disconnect, + CFStub_Invoke, + CFStub_IsIIDSupported, + CFStub_CountRefs, + CFStub_DebugServerQueryInterface, + CFStub_DebugServerRelease +}; + +static HRESULT +CFStub_Construct(LPRPCSTUBBUFFER *ppv) { + CFStub *cfstub; + cfstub = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(CFStub)); + if (!cfstub) + return E_OUTOFMEMORY; + *ppv = (LPRPCSTUBBUFFER)cfstub; + cfstub->lpvtbl = &cfstubvt; + cfstub->ref = 1; + return S_OK; +} + +/* Since we create proxy buffers and classfactory in a pair, there is + * no need for 2 separate structs. Just put them in one, but remember + * the refcount. + */ +typedef struct _CFProxy { + ICOM_VTABLE(IClassFactory) *lpvtbl_cf; + ICOM_VTABLE(IRpcProxyBuffer) *lpvtbl_proxy; + DWORD ref; + + IRpcChannelBuffer *chanbuf; +} CFProxy; + +static HRESULT WINAPI IRpcProxyBufferImpl_QueryInterface(LPRPCPROXYBUFFER iface,REFIID riid,LPVOID *ppv) { + *ppv = NULL; + if (IsEqualIID(riid,&IID_IRpcProxyBuffer)||IsEqualIID(riid,&IID_IUnknown)) { + IRpcProxyBuffer_AddRef(iface); + *ppv = (LPVOID)iface; + return S_OK; + } + FIXME("(%s), no interface.\n",debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI IRpcProxyBufferImpl_AddRef(LPRPCPROXYBUFFER iface) { + ICOM_THIS_MULTI(CFProxy,lpvtbl_proxy,iface); + return ++(This->ref); +} + +static ULONG WINAPI IRpcProxyBufferImpl_Release(LPRPCPROXYBUFFER iface) { + ICOM_THIS_MULTI(CFProxy,lpvtbl_proxy,iface); + + if (!--(This->ref)) { + IRpcChannelBuffer_Release(This->chanbuf);This->chanbuf = NULL; + HeapFree(GetProcessHeap(),0,This); + return 0; + } + return This->ref; +} + +static HRESULT WINAPI IRpcProxyBufferImpl_Connect(LPRPCPROXYBUFFER iface,IRpcChannelBuffer* pRpcChannelBuffer) { + ICOM_THIS_MULTI(CFProxy,lpvtbl_proxy,iface); + + This->chanbuf = pRpcChannelBuffer; + IRpcChannelBuffer_AddRef(This->chanbuf); + return S_OK; +} +static void WINAPI IRpcProxyBufferImpl_Disconnect(LPRPCPROXYBUFFER iface) { + ICOM_THIS_MULTI(CFProxy,lpvtbl_proxy,iface); + if (This->chanbuf) { + IRpcChannelBuffer_Release(This->chanbuf); + This->chanbuf = NULL; + } +} + +static HRESULT WINAPI +CFProxy_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv) { + *ppv = NULL; + if (IsEqualIID(&IID_IClassFactory,riid) || IsEqualIID(&IID_IUnknown,riid)) { + *ppv = (LPVOID)iface; + IClassFactory_AddRef(iface); + return S_OK; + } + if (IsEqualIID(riid,&IID_IMarshal)) /* just to avoid debug output */ + return E_NOINTERFACE; + FIXME("Unhandled interface: %s\n",debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI CFProxy_AddRef(LPCLASSFACTORY iface) { + ICOM_THIS_MULTI(CFProxy,lpvtbl_cf,iface); + This->ref++; + return This->ref; +} + +static ULONG WINAPI CFProxy_Release(LPCLASSFACTORY iface) { + ICOM_THIS_MULTI(CFProxy,lpvtbl_cf,iface); + This->ref--; + if (This->ref) + return This->ref; + HeapFree(GetProcessHeap(),0,This); + return 0; +} + +static HRESULT WINAPI CFProxy_CreateInstance( + LPCLASSFACTORY iface, + LPUNKNOWN pUnkOuter,/* [in] */ + REFIID riid, /* [in] */ + LPVOID *ppv /* [out] */ +) { + ICOM_THIS_MULTI(CFProxy,lpvtbl_cf,iface); + HRESULT hres; + LPSTREAM pStream; + HGLOBAL hGlobal; + ULONG srstatus; + RPCOLEMESSAGE msg; + + TRACE("(%p,%s,%p)\n",pUnkOuter,debugstr_guid(riid),ppv); + + /* Send CreateInstance to the remote classfactory. + * + * Data: Only the 'IID'. + */ + msg.iMethod = 3; + msg.cbBuffer = sizeof(*riid); + msg.Buffer = NULL; + hres = IRpcChannelBuffer_GetBuffer(This->chanbuf,&msg,&IID_IClassFactory); + if (hres) { + FIXME("IRpcChannelBuffer_GetBuffer failed with %lx?\n",hres); + return hres; + } + memcpy(msg.Buffer,riid,sizeof(*riid)); + hres = IRpcChannelBuffer_SendReceive(This->chanbuf,&msg,&srstatus); + if (hres) { + FIXME("IRpcChannelBuffer_SendReceive failed with %lx?\n",hres); + return hres; + } + + if (!msg.cbBuffer) /* interface not found on remote */ + return srstatus; + + /* We got back: [Marshalled Interface data] */ + TRACE("got %ld bytes data.\n",msg.cbBuffer); + hGlobal = GlobalAlloc(GMEM_MOVEABLE|GMEM_NODISCARD|GMEM_SHARE,msg.cbBuffer); + memcpy(GlobalLock(hGlobal),msg.Buffer,msg.cbBuffer); + hres = CreateStreamOnHGlobal(hGlobal,TRUE,&pStream); + if (hres) { + FIXME("CreateStreamOnHGlobal failed with %lx\n",hres); + return hres; + } + hres = CoUnmarshalInterface( + pStream, + riid, + ppv + ); + IStream_Release(pStream); /* Does GlobalFree hGlobal too. */ + if (hres) { + FIXME("CoMarshalInterface failed, %lx\n",hres); + return hres; + } + return S_OK; +} + +static HRESULT WINAPI CFProxy_LockServer(LPCLASSFACTORY iface,BOOL fLock) { + /*ICOM_THIS_MULTI(CFProxy,lpvtbl_cf,iface);*/ + FIXME("(%d), stub!\n",fLock); + /* basically: write BOOL, read empty */ + return S_OK; +} + +static ICOM_VTABLE(IRpcProxyBuffer) pspbvtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IRpcProxyBufferImpl_QueryInterface, + IRpcProxyBufferImpl_AddRef, + IRpcProxyBufferImpl_Release, + IRpcProxyBufferImpl_Connect, + IRpcProxyBufferImpl_Disconnect +}; +static ICOM_VTABLE(IClassFactory) cfproxyvt = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + CFProxy_QueryInterface, + CFProxy_AddRef, + CFProxy_Release, + CFProxy_CreateInstance, + CFProxy_LockServer +}; + +static HRESULT +CFProxy_Construct(LPVOID *ppv,LPVOID *ppProxy) { + CFProxy *cf; + + cf = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(CFProxy)); + if (!cf) + return E_OUTOFMEMORY; + + cf->lpvtbl_cf = &cfproxyvt; + cf->lpvtbl_proxy = &pspbvtbl; + cf->ref = 2; /* we return 2 references to the object! */ + *ppv = &(cf->lpvtbl_cf); + *ppProxy = &(cf->lpvtbl_proxy); + return S_OK; +} + + +/********************* OLE Proxy/Stub Factory ********************************/ +static HRESULT WINAPI +PSFacBuf_QueryInterface(LPPSFACTORYBUFFER iface, REFIID iid, LPVOID *ppv) { + if (IsEqualIID(iid,&IID_IPSFactoryBuffer)||IsEqualIID(iid,&IID_IUnknown)) { + *ppv = (LPVOID)iface; + /* No ref counting, static class */ + return S_OK; + } + FIXME("(%s) unknown IID?\n",debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI PSFacBuf_AddRef(LPPSFACTORYBUFFER iface) { return 2; } +static ULONG WINAPI PSFacBuf_Release(LPPSFACTORYBUFFER iface) { return 1; } + +static HRESULT WINAPI +PSFacBuf_CreateProxy( + LPPSFACTORYBUFFER iface, IUnknown* pUnkOuter, REFIID riid, + IRpcProxyBuffer **ppProxy, LPVOID *ppv +) { + if (IsEqualIID(&IID_IClassFactory,riid) || + IsEqualIID(&IID_IUnknown,riid) + ) + return CFProxy_Construct(ppv,(LPVOID*)ppProxy); + FIXME("proxying not implemented for (%s) yet!\n",debugstr_guid(riid)); + return E_FAIL; +} + +static HRESULT WINAPI +PSFacBuf_CreateStub( + LPPSFACTORYBUFFER iface, REFIID riid,IUnknown *pUnkServer, + IRpcStubBuffer** ppStub +) { + HRESULT hres; + + TRACE("(%s,%p,%p)\n",debugstr_guid(riid),pUnkServer,ppStub); + + if (IsEqualIID(&IID_IClassFactory,riid) || + IsEqualIID(&IID_IUnknown,riid) + ) { + hres = CFStub_Construct(ppStub); + if (!hres) + IRpcStubBuffer_Connect((*ppStub),pUnkServer); + return hres; + } + FIXME("stubbing not implemented for (%s) yet!\n",debugstr_guid(riid)); + return E_FAIL; +} + +static ICOM_VTABLE(IPSFactoryBuffer) psfacbufvtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + PSFacBuf_QueryInterface, + PSFacBuf_AddRef, + PSFacBuf_Release, + PSFacBuf_CreateProxy, + PSFacBuf_CreateStub +}; + +/* This is the whole PSFactoryBuffer object, just the vtableptr */ +static ICOM_VTABLE(IPSFactoryBuffer) *lppsfac = &psfacbufvtbl; + +/*********************************************************************** + * DllGetClassObject [OLE32.@] + */ +HRESULT WINAPI OLE32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv) +{ + *ppv = NULL; + if (IsEqualIID(rclsid,&CLSID_PSFactoryBuffer)) { + *ppv = &lppsfac; + /* If we create a ps factory, we might need a stub manager later + * anyway + */ + STUBMGR_Start(); + return S_OK; + } + if (IsEqualIID(rclsid,&CLSID_DfMarshal)&&( + IsEqualIID(iid,&IID_IClassFactory) || + IsEqualIID(iid,&IID_IUnknown) + ) + ) + return MARSHAL_GetStandardMarshalCF(ppv); + if (IsEqualIID(rclsid,&CLSID_StdGlobalInterfaceTable) && (IsEqualIID(iid,&IID_IClassFactory) || IsEqualIID(iid,&IID_IUnknown))) + return StdGlobalInterfaceTable_GetFactory(ppv); + + FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid)); + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/reactos/lib/ole32/olestd.h b/reactos/lib/ole32/olestd.h new file mode 100644 index 00000000000..b5814fad4a4 --- /dev/null +++ b/reactos/lib/ole32/olestd.h @@ -0,0 +1,56 @@ +/* + * Copyright 2000 Abey George + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#if !defined( __WINE_OLESTD_H_ ) +#define __WINE_OLESTD_H_ + +#if !defined(__cplusplus) && !defined( __TURBOC__) +#define NONAMELESSUNION /* use strict ANSI standard (for DVOBJ.H) */ +#endif + +/* Clipboard format strings */ +#define CF_EMBEDSOURCE "Embed Source" +#define CF_EMBEDDEDOBJECT "Embedded Object" +#define CF_LINKSOURCE "Link Source" +#define CF_CUSTOMLINKSOURCE "Custom Link Source" +#define CF_OBJECTDESCRIPTOR "Object Descriptor" +#define CF_LINKSRCDESCRIPTOR "Link Source Descriptor" +#define CF_OWNERLINK "OwnerLink" +#define CF_FILENAME "FileName" + +#define OleStdQueryOleObjectData(lpformatetc) \ + (((lpformatetc)->tymed & TYMED_ISTORAGE) ? \ + NOERROR : ResultFromScode(DV_E_FORMATETC)) + +#define OleStdQueryLinkSourceData(lpformatetc) \ + (((lpformatetc)->tymed & TYMED_ISTREAM) ? \ + NOERROR : ResultFromScode(DV_E_FORMATETC)) + +#define OleStdQueryObjectDescriptorData(lpformatetc) \ + (((lpformatetc)->tymed & TYMED_HGLOBAL) ? \ + NOERROR : ResultFromScode(DV_E_FORMATETC)) + +#define OleStdQueryFormatMedium(lpformatetc, tymd) \ + (((lpformatetc)->tymed & tymd) ? \ + NOERROR : ResultFromScode(DV_E_FORMATETC)) + +/* Make an independent copy of a MetafilePict */ +#define OleStdCopyMetafilePict(hpictin, phpictout) \ + (*(phpictout) = OleDuplicateData(hpictin,CF_METAFILEPICT,GHND|GMEM_SHARE)) + +#endif /* __WINE_OLESTD_H_ */ diff --git a/reactos/lib/ole32/regsvr.c b/reactos/lib/ole32/regsvr.c new file mode 100644 index 00000000000..4d198c79afd --- /dev/null +++ b/reactos/lib/ole32/regsvr.c @@ -0,0 +1,877 @@ +/* + * self-registerable dll functions for ole32.dll + * + * Copyright (C) 2003 John K. Hohm + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include + +#ifdef __REACTOS__ +#include +#endif +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "winreg.h" +#include "winerror.h" + +#include "ole2.h" +#include "olectl.h" +#ifdef __REACTOS__ +#include "ocidl.h" +#endif + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +/* + * Near the bottom of this file are the exported DllRegisterServer and + * DllUnregisterServer, which make all this worthwhile. + */ + +/*********************************************************************** + * interface for self-registering + */ +struct regsvr_interface +{ + IID const *iid; /* NULL for end of list */ + LPCSTR name; /* can be NULL to omit */ + IID const *base_iid; /* can be NULL to omit */ + int num_methods; /* can be <0 to omit */ + CLSID const *ps_clsid; /* can be NULL to omit */ + CLSID const *ps_clsid32; /* can be NULL to omit */ +}; + +static HRESULT register_interfaces(struct regsvr_interface const *list); +static HRESULT unregister_interfaces(struct regsvr_interface const *list); + +struct regsvr_coclass +{ + CLSID const *clsid; /* NULL for end of list */ + LPCSTR name; /* can be NULL to omit */ + LPCSTR ips; /* can be NULL to omit */ + LPCSTR ips32; /* can be NULL to omit */ + LPCSTR ips32_tmodel; /* can be NULL to omit */ +}; + +static HRESULT register_coclasses(struct regsvr_coclass const *list); +static HRESULT unregister_coclasses(struct regsvr_coclass const *list); + +/*********************************************************************** + * static string constants + */ +static WCHAR const interface_keyname[10] = { + 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 }; +static WCHAR const base_ifa_keyname[14] = { + 'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', + 'e', 0 }; +static WCHAR const num_methods_keyname[11] = { + 'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 }; +static WCHAR const ps_clsid_keyname[15] = { + 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', + 'i', 'd', 0 }; +static WCHAR const ps_clsid32_keyname[17] = { + 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', + 'i', 'd', '3', '2', 0 }; +static WCHAR const clsid_keyname[6] = { + 'C', 'L', 'S', 'I', 'D', 0 }; +static WCHAR const ips_keyname[13] = { + 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', + 0 }; +static WCHAR const ips32_keyname[15] = { + 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', + '3', '2', 0 }; +static char const tmodel_valuename[] = "ThreadingModel"; + +/*********************************************************************** + * static helper functions + */ +static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid); +static LONG register_key_defvalueW(HKEY base, WCHAR const *name, + WCHAR const *value); +static LONG register_key_defvalueA(HKEY base, WCHAR const *name, + char const *value); +static LONG recursive_delete_key(HKEY key); + + +/*********************************************************************** + * register_interfaces + */ +static HRESULT register_interfaces(struct regsvr_interface const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY interface_key; + + res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &interface_key, NULL); + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->iid; ++list) { + WCHAR buf[39]; + HKEY iid_key; + + StringFromGUID2(list->iid, buf, 39); + res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &iid_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_interface_key; + + if (list->name) { + res = RegSetValueExA(iid_key, NULL, 0, REG_SZ, + (CONST BYTE*)(list->name), + strlen(list->name) + 1); + if (res != ERROR_SUCCESS) goto error_close_iid_key; + } + + if (list->base_iid) { + register_key_guid(iid_key, base_ifa_keyname, list->base_iid); + if (res != ERROR_SUCCESS) goto error_close_iid_key; + } + + if (0 <= list->num_methods) { + static WCHAR const fmt[3] = { '%', 'd', 0 }; + HKEY key; + + res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &key, NULL); + if (res != ERROR_SUCCESS) goto error_close_iid_key; + + wsprintfW(buf, fmt, list->num_methods); + res = RegSetValueExW(key, NULL, 0, REG_SZ, + (CONST BYTE*)buf, + (lstrlenW(buf) + 1) * sizeof(WCHAR)); + RegCloseKey(key); + + if (res != ERROR_SUCCESS) goto error_close_iid_key; + } + + if (list->ps_clsid) { + register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid); + if (res != ERROR_SUCCESS) goto error_close_iid_key; + } + + if (list->ps_clsid32) { + register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32); + if (res != ERROR_SUCCESS) goto error_close_iid_key; + } + + error_close_iid_key: + RegCloseKey(iid_key); + } + +error_close_interface_key: + RegCloseKey(interface_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** + * unregister_interfaces + */ +static HRESULT unregister_interfaces(struct regsvr_interface const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY interface_key; + + res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, + KEY_READ | KEY_WRITE, &interface_key); + if (res == ERROR_FILE_NOT_FOUND) return S_OK; + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->iid; ++list) { + WCHAR buf[39]; + HKEY iid_key; + + StringFromGUID2(list->iid, buf, 39); + res = RegOpenKeyExW(interface_key, buf, 0, + KEY_READ | KEY_WRITE, &iid_key); + if (res == ERROR_FILE_NOT_FOUND) { + res = ERROR_SUCCESS; + continue; + } + if (res != ERROR_SUCCESS) goto error_close_interface_key; + res = recursive_delete_key(iid_key); + RegCloseKey(iid_key); + if (res != ERROR_SUCCESS) goto error_close_interface_key; + } + +error_close_interface_key: + RegCloseKey(interface_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** + * register_coclasses + */ +static HRESULT register_coclasses(struct regsvr_coclass const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY coclass_key; + + res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL); + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->clsid; ++list) { + WCHAR buf[39]; + HKEY clsid_key; + + StringFromGUID2(list->clsid, buf, 39); + res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + + if (list->name) { + res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ, + (CONST BYTE*)(list->name), + strlen(list->name) + 1); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->ips) { + res = register_key_defvalueA(clsid_key, ips_keyname, list->ips); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->ips32) { + HKEY ips32_key; + + res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, + &ips32_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + + res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ, + (CONST BYTE*)list->ips32, + lstrlenA(list->ips32) + 1); + if (res == ERROR_SUCCESS && list->ips32_tmodel) + res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ, + (CONST BYTE*)list->ips32_tmodel, + strlen(list->ips32_tmodel) + 1); + RegCloseKey(ips32_key); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + error_close_clsid_key: + RegCloseKey(clsid_key); + } + +error_close_coclass_key: + RegCloseKey(coclass_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** + * unregister_coclasses + */ +static HRESULT unregister_coclasses(struct regsvr_coclass const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY coclass_key; + + res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, + KEY_READ | KEY_WRITE, &coclass_key); + if (res == ERROR_FILE_NOT_FOUND) return S_OK; + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->clsid; ++list) { + WCHAR buf[39]; + HKEY clsid_key; + + StringFromGUID2(list->clsid, buf, 39); + res = RegOpenKeyExW(coclass_key, buf, 0, + KEY_READ | KEY_WRITE, &clsid_key); + if (res == ERROR_FILE_NOT_FOUND) { + res = ERROR_SUCCESS; + continue; + } + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + res = recursive_delete_key(clsid_key); + RegCloseKey(clsid_key); + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + } + +error_close_coclass_key: + RegCloseKey(coclass_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** + * regsvr_key_guid + */ +static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid) +{ + WCHAR buf[39]; + + StringFromGUID2(guid, buf, 39); + return register_key_defvalueW(base, name, buf); +} + +/*********************************************************************** + * regsvr_key_defvalueW + */ +static LONG register_key_defvalueW( + HKEY base, + WCHAR const *name, + WCHAR const *value) +{ + LONG res; + HKEY key; + + res = RegCreateKeyExW(base, name, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &key, NULL); + if (res != ERROR_SUCCESS) return res; + res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value, + (lstrlenW(value) + 1) * sizeof(WCHAR)); + RegCloseKey(key); + return res; +} + +/*********************************************************************** + * regsvr_key_defvalueA + */ +static LONG register_key_defvalueA( + HKEY base, + WCHAR const *name, + char const *value) +{ + LONG res; + HKEY key; + + res = RegCreateKeyExW(base, name, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &key, NULL); + if (res != ERROR_SUCCESS) return res; + res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value, + lstrlenA(value) + 1); + RegCloseKey(key); + return res; +} + +/*********************************************************************** + * recursive_delete_key + */ +static LONG recursive_delete_key(HKEY key) +{ + LONG res; + WCHAR subkey_name[MAX_PATH]; + DWORD cName; + HKEY subkey; + + for (;;) { + cName = sizeof(subkey_name) / sizeof(WCHAR); + res = RegEnumKeyExW(key, 0, subkey_name, &cName, + NULL, NULL, NULL, NULL); + if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) { + res = ERROR_SUCCESS; /* presumably we're done enumerating */ + break; + } + res = RegOpenKeyExW(key, subkey_name, 0, + KEY_READ | KEY_WRITE, &subkey); + if (res == ERROR_FILE_NOT_FOUND) continue; + if (res != ERROR_SUCCESS) break; + + res = recursive_delete_key(subkey); + RegCloseKey(subkey); + if (res != ERROR_SUCCESS) break; + } + + if (res == ERROR_SUCCESS) res = RegDeleteKeyW(key, 0); + return res; +} + +/*********************************************************************** + * coclass list + */ +static GUID const CLSID_FileMoniker = { + 0x00000303, 0x0000, 0x0000, {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} }; + +static GUID const CLSID_ItemMoniker = { + 0x00000304, 0x0000, 0x0000, {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} }; + +/* FIXME: DfMarshal and PSFactoryBuffer are defined elsewhere too */ + +static GUID const CLSID_DfMarshal = { + 0x0000030B, 0x0000, 0x0000, {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} }; + +static GUID const CLSID_PSFactoryBuffer = { + 0x00000320, 0x0000, 0x0000, {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} }; + +static struct regsvr_coclass const coclass_list[] = { + { &CLSID_FileMoniker, + "FileMoniker", + NULL, + "ole32.dll", + "Both" + }, + { &CLSID_ItemMoniker, + "ItemMoniker", + NULL, + "ole32.dll", + "Both" + }, + { &CLSID_DfMarshal, + "DfMarshal", + NULL, + "ole32.dll", + "Both" + }, + { &CLSID_PSFactoryBuffer, + "PSFactoryBuffer", + NULL, + "ole32.dll", + "Both" + }, + { &CLSID_StdGlobalInterfaceTable, + "StdGlobalInterfaceTable", + NULL, + "ole32.dll", + "Apartment" + }, + { NULL } /* list terminator */ +}; + +/*********************************************************************** + * interface list + */ + +/* FIXME: perhaps the interfaces that are proxied by another dll + * should be registered in that dll? Or maybe the choice of proxy is + * arbitrary at this point? */ + +static GUID const CLSID_PSFactoryBuffer_ole2disp = { + 0x00020420, 0x0000, 0x0000, {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} }; + +static GUID const CLSID_PSFactoryBuffer_oleaut32 = { + 0xB196B286, 0xBAB4, 0x101A, {0xB6,0x9C,0x00,0xAA,0x00,0x34,0x1D,0x07} }; + +/* FIXME: these interfaces should be defined in ocidl.idl */ + +static IID const IID_IFontEventsDisp = { + 0x4EF6100A, 0xAF88, 0x11D0, {0x98,0x46,0x00,0xC0,0x4F,0xC2,0x99,0x93} }; + +static IID const IID_IProvideMultipleClassInfo = { + 0xA7ABA9C1, 0x8983, 0x11CF, {0x8F,0x20,0x00,0x80,0x5F,0x2C,0xD0,0x64} }; + +static IID const IID_IObjectWithSite = { + 0xFC4801A3, 0x2BA9, 0x11CF, {0xA2,0x29,0x00,0xAA,0x00,0x3D,0x73,0x52} }; + +static struct regsvr_interface const interface_list[] = { + { &IID_IUnknown, + "IUnknown", + NULL, + 3, + NULL, + &CLSID_PSFactoryBuffer + }, + { &IID_IClassFactory, + "IClassFactory", + NULL, + 5, + NULL, + &CLSID_PSFactoryBuffer + }, + { &IID_IStorage, + "IStorage", + NULL, + 18, + NULL, + &CLSID_PSFactoryBuffer + }, + { &IID_IStream, + "IStream", + NULL, + 14, + NULL, + &CLSID_PSFactoryBuffer + }, + { &IID_IPersistStorage, + "IPersistStorage", + NULL, + 10, + NULL, + &CLSID_PSFactoryBuffer + }, + { &IID_IDataObject, + "IDataObject", + NULL, + 12, + NULL, + &CLSID_PSFactoryBuffer + }, + { &IID_IAdviseSink, + "IAdviseSink", + NULL, + 8, + NULL, + &CLSID_PSFactoryBuffer + }, + { &IID_IOleObject, + "IOleObject", + NULL, + 24, + NULL, + &CLSID_PSFactoryBuffer + }, + { &IID_IOleClientSite, + "IOleClientSite", + NULL, + 9, + NULL, + &CLSID_PSFactoryBuffer + }, + { &IID_IDispatch, + "IDispatch", + NULL, + 7, + &CLSID_PSFactoryBuffer_ole2disp, + &CLSID_PSFactoryBuffer_ole2disp + }, + { &IID_ITypeLib2, + "ITypeLib2", + NULL, + 16, + NULL, + &CLSID_PSFactoryBuffer_ole2disp + }, + { &IID_ITypeInfo2, + "ITypeInfo2", + NULL, + 32, + NULL, + &CLSID_PSFactoryBuffer_ole2disp + }, + { &IID_IPropertyPage2, + "IPropertyPage2", + NULL, + 15, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IErrorInfo, + "IErrorInfo", + NULL, + 8, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_ICreateErrorInfo, + "ICreateErrorInfo", + NULL, + 8, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPersistPropertyBag2, + "IPersistPropertyBag2", + NULL, + 8, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPropertyBag2, + "IPropertyBag2", + NULL, + 8, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IErrorLog, + "IErrorLog", + NULL, + 4, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPerPropertyBrowsing, + "IPerPropertyBrowsing", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPersistPropertyBag, + "IPersistPropertyBag", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IAdviseSinkEx, + "IAdviseSinkEx", + NULL, + 9, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IFontEventsDisp, + "IFontEventsDisp", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPropertyBag, + "IPropertyBag", + NULL, + 5, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPointerInactive, + "IPointerInactive", + NULL, + 6, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_ISimpleFrameSite, + "ISimpleFrameSite", + NULL, + 5, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPicture, + "IPicture", + NULL, + 17, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPictureDisp, + "IPictureDisp", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPersistStreamInit, + "IPersistStreamInit", + NULL, + 9, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IOleUndoUnit, + "IOleUndoUnit", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPropertyNotifySink, + "IPropertyNotifySink", + NULL, + 5, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IOleInPlaceSiteEx, + "IOleInPlaceSiteEx", + NULL, + 18, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IOleParentUndoUnit, + "IOleParentUndoUnit", + NULL, + 12, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IProvideClassInfo2, + "IProvideClassInfo2", + NULL, + 5, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IProvideMultipleClassInfo, + "IProvideMultipleClassInfo", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IProvideClassInfo, + "IProvideClassInfo", + NULL, + 4, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IConnectionPointContainer, + "IConnectionPointContainer", + NULL, + 5, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IEnumConnectionPoints, + "IEnumConnectionPoints", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IConnectionPoint, + "IConnectionPoint", + NULL, + 8, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IEnumConnections, + "IEnumConnections", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IOleControl, + "IOleControl", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IOleControlSite, + "IOleControlSite", + NULL, + 10, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_ISpecifyPropertyPages, + "ISpecifyPropertyPages", + NULL, + 4, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPropertyPageSite, + "IPropertyPageSite", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPropertyPage, + "IPropertyPage", + NULL, + 14, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IClassFactory2, + "IClassFactory2", + NULL, + 8, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IEnumOleUndoUnits, + "IEnumOleUndoUnits", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IPersistMemory, + "IPersistMemory", + NULL, + 9, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IFont, + "IFont", + NULL, + 27, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IFontDisp, + "IFontDisp", + NULL, + 7, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IQuickActivate, + "IQuickActivate", + NULL, + 6, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IOleUndoManager, + "IOleUndoManager", + NULL, + 15, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { &IID_IObjectWithSite, + "IObjectWithSite", + NULL, + 5, + NULL, + &CLSID_PSFactoryBuffer_oleaut32 + }, + { NULL } /* list terminator */ +}; + +/*********************************************************************** + * DllRegisterServer (OLE32.@) + */ +HRESULT WINAPI OLE32_DllRegisterServer() +{ + HRESULT hr; + + TRACE("\n"); + + hr = register_coclasses(coclass_list); + if (SUCCEEDED(hr)) + hr = register_interfaces(interface_list); + return hr; +} + +/*********************************************************************** + * DllUnregisterServer (OLE32.@) + */ +HRESULT WINAPI OLE32_DllUnregisterServer() +{ + HRESULT hr; + + TRACE("\n"); + + hr = unregister_coclasses(coclass_list); + if (SUCCEEDED(hr)) + hr = unregister_interfaces(interface_list); + return hr; +} diff --git a/reactos/lib/ole32/rpc.c b/reactos/lib/ole32/rpc.c new file mode 100644 index 00000000000..f2f107db99f --- /dev/null +++ b/reactos/lib/ole32/rpc.c @@ -0,0 +1,712 @@ +/* + * (Local) RPC Stuff + * + * Copyright 2002 Marcus Meissner + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "objbase.h" +#include "ole2.h" +#include "ole2ver.h" +#include "rpc.h" +#include "winerror.h" +#include "winreg.h" +#ifndef __REACTOS__ +#include "wownt32.h" +#endif +#include "wtypes.h" +#include "wine/unicode.h" +#ifndef __REACTOS__ +#include "wine/winbase16.h" +#endif +#include "compobj_private.h" +#ifndef __REACTOS__ +#include "ifs.h" +#endif + +#include "compobj_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +typedef struct _wine_rpc_request { + int state; + HANDLE hPipe; /* temp copy of handle */ + wine_rpc_request_header reqh; + wine_rpc_response_header resph; + LPBYTE Buffer; +} wine_rpc_request; + +static wine_rpc_request **reqs = NULL; +static int nrofreqs = 0; + +/* This pipe is _thread_ based */ +typedef struct _wine_pipe { + wine_marshal_id mid; /* target mid */ + DWORD tid; /* thread in which we execute */ + HANDLE hPipe; + + int pending; + HANDLE hThread; + CRITICAL_SECTION crit; +} wine_pipe; + +static wine_pipe *pipes = NULL; +static int nrofpipes = 0; + +typedef struct _PipeBuf { + ICOM_VTABLE(IRpcChannelBuffer) *lpVtbl; + DWORD ref; + + wine_marshal_id mid; + wine_pipe *pipe; +} PipeBuf; + +static HRESULT WINAPI +_xread(HANDLE hf, LPVOID ptr, DWORD size) { + DWORD res; + if (!ReadFile(hf,ptr,size,&res,NULL)) { + FIXME("Failed to read from %p, le is %lx\n",hf,GetLastError()); + return E_FAIL; + } + if (res!=size) { + FIXME("Read only %ld of %ld bytes from %p.\n",res,size,hf); + return E_FAIL; + } + return S_OK; +} + +static void +drs(LPCSTR where) { +#if 0 + static int nrofreaders = 0; + + int i, states[10]; + + memset(states,0,sizeof(states)); + for (i=nrofreqs;i--;) + states[reqs[i]->state]++; + FIXME("%lx/%s/%d: rq %d, w %d, rg %d, rsq %d, rsg %d, d %d\n", + GetCurrentProcessId(), + where, + nrofreaders, + states[REQSTATE_REQ_QUEUED], + states[REQSTATE_REQ_WAITING_FOR_REPLY], + states[REQSTATE_REQ_GOT], + states[REQSTATE_RESP_QUEUED], + states[REQSTATE_RESP_GOT], + states[REQSTATE_DONE] + ); +#endif + + return ; +} + +static HRESULT WINAPI +_xwrite(HANDLE hf, LPVOID ptr, DWORD size) { + DWORD res; + if (!WriteFile(hf,ptr,size,&res,NULL)) { + FIXME("Failed to write to %p, le is %lx\n",hf,GetLastError()); + return E_FAIL; + } + if (res!=size) { + FIXME("Wrote only %ld of %ld bytes to %p.\n",res,size,hf); + return E_FAIL; + } + return S_OK; +} + +static DWORD WINAPI _StubReaderThread(LPVOID); + +static HRESULT +PIPE_RegisterPipe(wine_marshal_id *mid, HANDLE hPipe, BOOL startreader) { + int i; + char pipefn[100]; + wine_pipe *new_pipes; + + for (i=0;iprocessid) + return S_OK; + if (pipes) + new_pipes=(wine_pipe*)HeapReAlloc(GetProcessHeap(),0,pipes,sizeof(pipes[0])*(nrofpipes+1)); + else + new_pipes=(wine_pipe*)HeapAlloc(GetProcessHeap(),0,sizeof(pipes[0])); + if (!new_pipes) return E_OUTOFMEMORY; + pipes = new_pipes; + sprintf(pipefn,OLESTUBMGR"_%08lx",mid->processid); + memcpy(&(pipes[nrofpipes].mid),mid,sizeof(*mid)); + pipes[nrofpipes].hPipe = hPipe; + InitializeCriticalSection(&(pipes[nrofpipes].crit)); + nrofpipes++; + if (startreader) { + pipes[nrofpipes-1].hThread = CreateThread(NULL,0,_StubReaderThread,(LPVOID)(pipes+(nrofpipes-1)),0,&(pipes[nrofpipes-1].tid)); + } else { + pipes[nrofpipes-1].tid = GetCurrentThreadId(); + } + return S_OK; +} + +static HANDLE +PIPE_FindByMID(wine_marshal_id *mid) { + int i; + for (i=0;iprocessid) && + (GetCurrentThreadId()==pipes[i].tid) + ) + return pipes[i].hPipe; + return INVALID_HANDLE_VALUE; +} + +static wine_pipe* +PIPE_GetFromMID(wine_marshal_id *mid) { + int i; + for (i=0;iprocessid) && + (GetCurrentThreadId()==pipes[i].tid) + ) + return pipes+i; + } + return NULL; +} + +static HRESULT +RPC_GetRequest(wine_rpc_request **req) { + static int reqid = 0xdeadbeef; + int i; + + for (i=0;istate == REQSTATE_DONE) { + reqs[i]->reqh.reqid = reqid++; + reqs[i]->resph.reqid = reqs[i]->reqh.reqid; + reqs[i]->hPipe = INVALID_HANDLE_VALUE; + *req = reqs[i]; + reqs[i]->state = REQSTATE_START; + return S_OK; + } + } + /* create new */ + if (reqs) + reqs = (wine_rpc_request**)HeapReAlloc( + GetProcessHeap(), + HEAP_ZERO_MEMORY, + reqs, + sizeof(wine_rpc_request*)*(nrofreqs+1) + ); + else + reqs = (wine_rpc_request**)HeapAlloc( + GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(wine_rpc_request*) + ); + if (!reqs) + return E_OUTOFMEMORY; + reqs[nrofreqs] = (wine_rpc_request*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(wine_rpc_request)); + reqs[nrofreqs]->reqh.reqid = reqid++; + reqs[nrofreqs]->resph.reqid = reqs[nrofreqs]->reqh.reqid; + reqs[nrofreqs]->hPipe = INVALID_HANDLE_VALUE; + *req = reqs[nrofreqs]; + reqs[nrofreqs]->state = REQSTATE_START; + nrofreqs++; + return S_OK; +} + +static void +RPC_FreeRequest(wine_rpc_request *req) { + req->state = REQSTATE_DONE; /* Just reuse slot. */ + return; +} + +static HRESULT WINAPI +PipeBuf_QueryInterface( + LPRPCCHANNELBUFFER iface,REFIID riid,LPVOID *ppv +) { + *ppv = NULL; + if (IsEqualIID(riid,&IID_IRpcChannelBuffer) || IsEqualIID(riid,&IID_IUnknown)) { + *ppv = (LPVOID)iface; + IUnknown_AddRef(iface); + return S_OK; + } + return E_NOINTERFACE; +} + +static ULONG WINAPI +PipeBuf_AddRef(LPRPCCHANNELBUFFER iface) { + ICOM_THIS(PipeBuf,iface); + This->ref++; + return This->ref; +} + +static ULONG WINAPI +PipeBuf_Release(LPRPCCHANNELBUFFER iface) { + ICOM_THIS(PipeBuf,iface); + This->ref--; + if (This->ref) + return This->ref; + ERR("Free all stuff.\n"); + HeapFree(GetProcessHeap(),0,This); + return 0; +} + +static HRESULT WINAPI +PipeBuf_GetBuffer( + LPRPCCHANNELBUFFER iface,RPCOLEMESSAGE* msg,REFIID riid +) { + /*ICOM_THIS(PipeBuf,iface);*/ + + TRACE("(%p,%s), slightly wrong.\n",msg,debugstr_guid(riid)); + /* probably reuses IID in real. */ + if (msg->cbBuffer && (msg->Buffer == NULL)) + msg->Buffer = HeapAlloc(GetProcessHeap(),0,msg->cbBuffer); + return S_OK; +} + +static HRESULT +_invoke_onereq(wine_rpc_request *req) { + IRpcStubBuffer *stub; + RPCOLEMESSAGE msg; + HRESULT hres; + DWORD reqtype; + + hres = MARSHAL_Find_Stub_Buffer(&(req->reqh.mid),&stub); + if (hres) { + ERR("Stub not found?\n"); + return hres; + } + msg.Buffer = req->Buffer; + msg.iMethod = req->reqh.iMethod; + msg.cbBuffer = req->reqh.cbBuffer; + req->state = REQSTATE_INVOKING; + req->resph.retval = IRpcStubBuffer_Invoke(stub,&msg,NULL); + req->Buffer = msg.Buffer; + req->resph.cbBuffer = msg.cbBuffer; + reqtype = REQTYPE_RESPONSE; + hres = _xwrite(req->hPipe,&reqtype,sizeof(reqtype)); + if (hres) return hres; + hres = _xwrite(req->hPipe,&(req->resph),sizeof(req->resph)); + if (hres) return hres; + hres = _xwrite(req->hPipe,req->Buffer,req->resph.cbBuffer); + if (hres) return hres; + req->state = REQSTATE_DONE; + drs("invoke"); + return S_OK; +} + +static HRESULT _read_one(wine_pipe *xpipe); + +static HRESULT +RPC_QueueRequestAndWait(wine_rpc_request *req) { + int i; + wine_rpc_request *xreq; + HRESULT hres; + DWORD reqtype; + wine_pipe *xpipe = PIPE_GetFromMID(&(req->reqh.mid)); + + if (!xpipe) { + FIXME("no pipe found.\n"); + return E_POINTER; + } + if (GetCurrentProcessId() == req->reqh.mid.processid) { + ERR("In current process?\n"); + return E_FAIL; + } + req->hPipe = xpipe->hPipe; + req->state = REQSTATE_REQ_WAITING_FOR_REPLY; + reqtype = REQTYPE_REQUEST; + hres = _xwrite(req->hPipe,&reqtype,sizeof(reqtype)); + if (hres) return hres; + hres = _xwrite(req->hPipe,&(req->reqh),sizeof(req->reqh)); + if (hres) return hres; + hres = _xwrite(req->hPipe,req->Buffer,req->reqh.cbBuffer); + if (hres) return hres; + + while (1) { + /*WaitForSingleObject(hRpcChanged,INFINITE);*/ + hres = _read_one(xpipe); + if (hres) break; + + for (i=0;istate==REQSTATE_REQ_GOT) && (xreq->hPipe==req->hPipe)) { + _invoke_onereq(xreq); + } + } + if (req->state == REQSTATE_RESP_GOT) + return S_OK; + } + return hres; +} + +static HRESULT WINAPI +PipeBuf_SendReceive( + LPRPCCHANNELBUFFER iface,RPCOLEMESSAGE* msg,ULONG *status +) { + ICOM_THIS(PipeBuf,iface); + wine_rpc_request *req; + HRESULT hres; + + TRACE("()\n"); + + if (This->mid.processid == GetCurrentProcessId()) { + ERR("Need to call directly!\n"); + return E_FAIL; + } + + hres = RPC_GetRequest(&req); + if (hres) return hres; + req->reqh.iMethod = msg->iMethod; + req->reqh.cbBuffer = msg->cbBuffer; + memcpy(&(req->reqh.mid),&(This->mid),sizeof(This->mid)); + req->Buffer = msg->Buffer; + hres = RPC_QueueRequestAndWait(req); + if (hres) { + RPC_FreeRequest(req); + return hres; + } + msg->cbBuffer = req->resph.cbBuffer; + msg->Buffer = req->Buffer; + *status = req->resph.retval; + RPC_FreeRequest(req); + return S_OK; +} + + +static HRESULT WINAPI +PipeBuf_FreeBuffer(LPRPCCHANNELBUFFER iface,RPCOLEMESSAGE* msg) { + FIXME("(%p), stub!\n",msg); + return E_FAIL; +} + +static HRESULT WINAPI +PipeBuf_GetDestCtx( + LPRPCCHANNELBUFFER iface,DWORD* pdwDestContext,void** ppvDestContext +) { + FIXME("(%p,%p), stub!\n",pdwDestContext,ppvDestContext); + return E_FAIL; +} + +static HRESULT WINAPI +PipeBuf_IsConnected(LPRPCCHANNELBUFFER iface) { + FIXME("(), stub!\n"); + return S_OK; +} + +static ICOM_VTABLE(IRpcChannelBuffer) pipebufvt = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + PipeBuf_QueryInterface, + PipeBuf_AddRef, + PipeBuf_Release, + PipeBuf_GetBuffer, + PipeBuf_SendReceive, + PipeBuf_FreeBuffer, + PipeBuf_GetDestCtx, + PipeBuf_IsConnected +}; + +HRESULT +PIPE_GetNewPipeBuf(wine_marshal_id *mid, IRpcChannelBuffer **pipebuf) { + wine_marshal_id ourid; + DWORD res; + HANDLE hPipe; + HRESULT hres; + PipeBuf *pbuf; + + hPipe = PIPE_FindByMID(mid); + if (hPipe == INVALID_HANDLE_VALUE) { + char pipefn[200]; + sprintf(pipefn,OLESTUBMGR"_%08lx",mid->processid); + hPipe = CreateFileA( + pipefn, + GENERIC_READ|GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + 0, + 0 + ); + if (hPipe == INVALID_HANDLE_VALUE) { + FIXME("Could not open named pipe %s, le is %lx\n",pipefn,GetLastError()); + return E_FAIL; + } + hres = PIPE_RegisterPipe(mid, hPipe, FALSE); + if (hres) return hres; + memset(&ourid,0,sizeof(ourid)); + ourid.processid = GetCurrentProcessId(); + if (!WriteFile(hPipe,&ourid,sizeof(ourid),&res,NULL)||(res!=sizeof(ourid))) { + ERR("Failed writing startup mid!\n"); + return E_FAIL; + } + } + pbuf = (PipeBuf*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PipeBuf)); + pbuf->lpVtbl = &pipebufvt; + pbuf->ref = 1; + memcpy(&(pbuf->mid),mid,sizeof(*mid)); + *pipebuf = (IRpcChannelBuffer*)pbuf; + return S_OK; +} + +static HRESULT +create_server(REFCLSID rclsid) { + HKEY key; + char buf[200]; + HRESULT hres = E_UNEXPECTED; + char xclsid[80]; + WCHAR dllName[MAX_PATH+1]; + DWORD dllNameLen = sizeof(dllName); + STARTUPINFOW sinfo; + PROCESS_INFORMATION pinfo; + + WINE_StringFromCLSID((LPCLSID)rclsid,xclsid); + + sprintf(buf,"CLSID\\%s\\LocalServer32",xclsid); + hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, buf, 0, KEY_READ, &key); + + if (hres != ERROR_SUCCESS) + return REGDB_E_READREGDB; /* Probably */ + + memset(dllName,0,sizeof(dllName)); + hres= RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)dllName,&dllNameLen); + RegCloseKey(key); + if (hres) + return REGDB_E_CLASSNOTREG; /* FIXME: check retval */ + memset(&sinfo,0,sizeof(sinfo)); + sinfo.cb = sizeof(sinfo); + if (!CreateProcessW(NULL,dllName,NULL,NULL,FALSE,0,NULL,NULL,&sinfo,&pinfo)) + return E_FAIL; + return S_OK; +} +/* http://msdn.microsoft.com/library/en-us/dnmsj99/html/com0199.asp, Figure 4 */ +HRESULT create_marshalled_proxy(REFCLSID rclsid, REFIID iid, LPVOID *ppv) { + HRESULT hres; + HANDLE hPipe; + char pipefn[200]; + DWORD res,bufferlen; + char marshalbuffer[200]; + IStream *pStm; + LARGE_INTEGER seekto; + ULARGE_INTEGER newpos; + int tries = 0; +#define MAXTRIES 10000 + + strcpy(pipefn,PIPEPREF); + WINE_StringFromCLSID(rclsid,pipefn+strlen(PIPEPREF)); + + while (tries++=MAXTRIES) + return E_NOINTERFACE; + hres = CreateStreamOnHGlobal(0,TRUE,&pStm); + if (hres) return hres; + hres = IStream_Write(pStm,marshalbuffer,bufferlen,&res); + if (hres) goto out; + seekto.u.LowPart = 0;seekto.u.HighPart = 0; + hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos); + hres = CoUnmarshalInterface(pStm,&IID_IClassFactory,ppv); +out: + IStream_Release(pStm); + return hres; +} + + +static void WINAPI +PIPE_StartRequestThread(HANDLE xhPipe) { + wine_marshal_id remoteid; + HRESULT hres; + + hres = _xread(xhPipe,&remoteid,sizeof(remoteid)); + if (hres) { + ERR("Failed to read remote mid!\n"); + return; + } + PIPE_RegisterPipe(&remoteid,xhPipe, TRUE); +} + +static HRESULT +_read_one(wine_pipe *xpipe) { + DWORD reqtype; + HRESULT hres = S_OK; + HANDLE xhPipe = xpipe->hPipe; + + /*FIXME("%lx %d reading reqtype\n",GetCurrentProcessId(),xhPipe);*/ + hres = _xread(xhPipe,&reqtype,sizeof(reqtype)); + if (hres) goto end; + EnterCriticalSection(&(xpipe->crit)); + /*FIXME("%lx got reqtype %ld\n",GetCurrentProcessId(),reqtype);*/ + + if (reqtype == REQTYPE_REQUEST) { + wine_rpc_request *xreq; + RPC_GetRequest(&xreq); + xreq->hPipe = xhPipe; + hres = _xread(xhPipe,&(xreq->reqh),sizeof(xreq->reqh)); + if (hres) goto end; + xreq->resph.reqid = xreq->reqh.reqid; + xreq->Buffer = HeapAlloc(GetProcessHeap(),0, xreq->reqh.cbBuffer); + hres = _xread(xhPipe,xreq->Buffer,xreq->reqh.cbBuffer); + if (hres) goto end; + xreq->state = REQSTATE_REQ_GOT; + goto end; + } + if (reqtype == REQTYPE_RESPONSE) { + wine_rpc_response_header resph; + int i; + + hres = _xread(xhPipe,&resph,sizeof(resph)); + if (hres) goto end; + for (i=nrofreqs;i--;) { + wine_rpc_request *xreq = reqs[i]; + if (xreq->state != REQSTATE_REQ_WAITING_FOR_REPLY) + continue; + if (xreq->reqh.reqid == resph.reqid) { + memcpy(&(xreq->resph),&resph,sizeof(resph)); + + if (xreq->Buffer) + xreq->Buffer = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,xreq->Buffer,xreq->resph.cbBuffer); + else + xreq->Buffer = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,xreq->resph.cbBuffer); + + hres = _xread(xhPipe,xreq->Buffer,xreq->resph.cbBuffer); + if (hres) goto end; + xreq->state = REQSTATE_RESP_GOT; + /*PulseEvent(hRpcChanged);*/ + goto end; + } + } + ERR("Did not find request for id %lx\n",resph.reqid); + hres = S_OK; + goto end; + } + ERR("Unknown reqtype %ld\n",reqtype); + hres = E_FAIL; +end: + LeaveCriticalSection(&(xpipe->crit)); + return hres; +} + +static DWORD WINAPI +_StubReaderThread(LPVOID param) { + wine_pipe *xpipe = (wine_pipe*)param; + HANDLE xhPipe = xpipe->hPipe; + HRESULT hres; + + TRACE("STUB reader thread %lx\n",GetCurrentProcessId()); + while (1) { + int i; + hres = _read_one(xpipe); + if (hres) break; + + for (i=nrofreqs;i--;) { + wine_rpc_request *xreq = reqs[i]; + if ((xreq->state == REQSTATE_REQ_GOT) && (xreq->hPipe == xhPipe)) { + _invoke_onereq(xreq); + } + } + } + FIXME("Failed with hres %lx\n",hres); + CloseHandle(xhPipe); + return 0; +} + +static DWORD WINAPI +_StubMgrThread(LPVOID param) { + char pipefn[200]; + HANDLE listenPipe; + + sprintf(pipefn,OLESTUBMGR"_%08lx",GetCurrentProcessId()); + TRACE("Stub Manager Thread starting on (%s)\n",pipefn); + + while (1) { + listenPipe = CreateNamedPipeA( + pipefn, + PIPE_ACCESS_DUPLEX, + PIPE_TYPE_BYTE|PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, + 4096, + 4096, + NMPWAIT_USE_DEFAULT_WAIT, + NULL + ); + if (listenPipe == INVALID_HANDLE_VALUE) { + FIXME("pipe creation failed for %s, le is %lx\n",pipefn,GetLastError()); + return 1; /* permanent failure, so quit stubmgr thread */ + } + if (!ConnectNamedPipe(listenPipe,NULL)) { + ERR("Failure during ConnectNamedPipe %lx!\n",GetLastError()); + CloseHandle(listenPipe); + continue; + } + PIPE_StartRequestThread(listenPipe); + } + return 0; +} + +void +STUBMGR_Start() { + static BOOL stubMgrRunning = FALSE; + DWORD tid; + + if (!stubMgrRunning) { + stubMgrRunning = TRUE; + CreateThread(NULL,0,_StubMgrThread,NULL,0,&tid); + Sleep(2000); /* actually we just try opening the pipe until it succeeds */ + } +} diff --git a/reactos/lib/ole32/rpcrt4_main.c b/reactos/lib/ole32/rpcrt4_main.c deleted file mode 100644 index f826c383af7..00000000000 --- a/reactos/lib/ole32/rpcrt4_main.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - * RPCRT4 - * - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -/*********************************************************************** - * RPCRT4_LibMain - * - * PARAMS - * hinstDLL [I] handle to the DLL's instance - * fdwReason [I] - * lpvReserved [I] reserved, must be NULL - * - * RETURNS - * Success: TRUE - * Failure: FALSE - */ - -BOOL WINAPI -RPCRT4_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - switch (fdwReason) { - case DLL_PROCESS_ATTACH: - break; - - case DLL_PROCESS_DETACH: - break; - } - - return TRUE; -} - -/************************************************************************* - * UuidCreate [RPCRT4] - * - * Creates a 128bit UUID. - * Implemented according the DCE specification for UUID generation. - * Code is based upon uuid library in e2fsprogs by Theodore Ts'o. - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * RETURNS - * - * S_OK if successful. - */ -RPC_STATUS WINAPI UuidCreate(UUID *Uuid) -{ -#if 1 - UNIMPLEMENTED; - return S_OK; -#else - static char has_init = 0; - unsigned char a[6]; - static int adjustment = 0; - static struct timeval last = {0, 0}; - static UINT16 clock_seq; - struct timeval tv; - unsigned long long clock_reg; - UINT clock_high, clock_low; - UINT16 temp_clock_seq, temp_clock_mid, temp_clock_hi_and_version; -#ifdef HAVE_NET_IF_H - int sd; - struct ifreq ifr, *ifrp; - struct ifconf ifc; - char buf[1024]; - int n, i; -#endif - - /* Have we already tried to get the MAC address? */ - if (!has_init) { -#ifdef HAVE_NET_IF_H - /* BSD 4.4 defines the size of an ifreq to be - * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len - * However, under earlier systems, sa_len isn't present, so - * the size is just sizeof(struct ifreq) - */ -#ifdef HAVE_SA_LEN -# ifndef max -# define max(a,b) ((a) > (b) ? (a) : (b)) -# endif -# define ifreq_size(i) max(sizeof(struct ifreq),\ -sizeof((i).ifr_name)+(i).ifr_addr.sa_len) -# else -# define ifreq_size(i) sizeof(struct ifreq) -# endif /* HAVE_SA_LEN */ - - sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); - if (sd < 0) { - /* if we can't open a socket, just use random numbers */ - /* set the multicast bit to prevent conflicts with real cards */ - a[0] = (rand() & 0xff) | 0x80; - a[1] = rand() & 0xff; - a[2] = rand() & 0xff; - a[3] = rand() & 0xff; - a[4] = rand() & 0xff; - a[5] = rand() & 0xff; - } else { - memset(buf, 0, sizeof(buf)); - ifc.ifc_len = sizeof(buf); - ifc.ifc_buf = buf; - /* get the ifconf interface */ - if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) { - close(sd); - /* no ifconf, so just use random numbers */ - /* set the multicast bit to prevent conflicts with real cards */ - a[0] = (rand() & 0xff) | 0x80; - a[1] = rand() & 0xff; - a[2] = rand() & 0xff; - a[3] = rand() & 0xff; - a[4] = rand() & 0xff; - a[5] = rand() & 0xff; - } else { - /* loop through the interfaces, looking for a valid one */ - n = ifc.ifc_len; - for (i = 0; i < n; i+= ifreq_size(*ifr) ) { - ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i); - strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ); - /* try to get the address for this interface */ -# ifdef SIOCGIFHWADDR - if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0) - continue; - memcpy(a, (unsigned char *)&ifr.ifr_hwaddr.sa_data, 6); -# else -# ifdef SIOCGENADDR - if (ioctl(sd, SIOCGENADDR, &ifr) < 0) - continue; - memcpy(a, (unsigned char *) ifr.ifr_enaddr, 6); -# else - /* XXX we don't have a way of getting the hardware address */ - close(sd); - a[0] = 0; - break; -# endif /* SIOCGENADDR */ -# endif /* SIOCGIFHWADDR */ - /* make sure it's not blank */ - if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]) - continue; - - goto valid_address; - } - /* if we didn't find a valid address, make a random one */ - /* once again, set multicast bit to avoid conflicts */ - a[0] = (rand() & 0xff) | 0x80; - a[1] = rand() & 0xff; - a[2] = rand() & 0xff; - a[3] = rand() & 0xff; - a[4] = rand() & 0xff; - a[5] = rand() & 0xff; - - valid_address: - close(sd); - } - } -#else - /* no networking info, so generate a random address */ - a[0] = (rand() & 0xff) | 0x80; - a[1] = rand() & 0xff; - a[2] = rand() & 0xff; - a[3] = rand() & 0xff; - a[4] = rand() & 0xff; - a[5] = rand() & 0xff; -#endif /* HAVE_NET_IF_H */ - has_init = 1; - } - - /* generate time element of GUID */ - - /* Assume that the gettimeofday() has microsecond granularity */ -#define MAX_ADJUSTMENT 10 - - try_again: - gettimeofday(&tv, 0); - if ((last.tv_sec == 0) && (last.tv_usec == 0)) { - clock_seq = ((rand() & 0xff) << 8) + (rand() & 0xff); - clock_seq &= 0x1FFF; - last = tv; - last.tv_sec--; - } - if ((tv.tv_sec < last.tv_sec) || - ((tv.tv_sec == last.tv_sec) && - (tv.tv_usec < last.tv_usec))) { - clock_seq = (clock_seq+1) & 0x1FFF; - adjustment = 0; - } else if ((tv.tv_sec == last.tv_sec) && - (tv.tv_usec == last.tv_usec)) { - if (adjustment >= MAX_ADJUSTMENT) - goto try_again; - adjustment++; - } else - adjustment = 0; - - clock_reg = tv.tv_usec*10 + adjustment; - clock_reg += ((unsigned long long) tv.tv_sec)*10000000; - clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000; - - clock_high = clock_reg >> 32; - clock_low = clock_reg; - temp_clock_seq = clock_seq | 0x8000; - temp_clock_mid = (UINT16)clock_high; - temp_clock_hi_and_version = (clock_high >> 16) | 0x1000; - - /* pack the information into the GUID structure */ - - ((unsigned char*)&Uuid->Data1)[3] = (unsigned char)clock_low; - clock_low >>= 8; - ((unsigned char*)&Uuid->Data1)[2] = (unsigned char)clock_low; - clock_low >>= 8; - ((unsigned char*)&Uuid->Data1)[1] = (unsigned char)clock_low; - clock_low >>= 8; - ((unsigned char*)&Uuid->Data1)[0] = (unsigned char)clock_low; - - ((unsigned char*)&Uuid->Data2)[1] = (unsigned char)temp_clock_mid; - temp_clock_mid >>= 8; - ((unsigned char*)&Uuid->Data2)[0] = (unsigned char)temp_clock_mid; - - ((unsigned char*)&Uuid->Data3)[1] = (unsigned char)temp_clock_hi_and_version; - temp_clock_hi_and_version >>= 8; - ((unsigned char*)&Uuid->Data3)[0] = (unsigned char)temp_clock_hi_and_version; - - ((unsigned char*)Uuid->Data4)[1] = (unsigned char)temp_clock_seq; - temp_clock_seq >>= 8; - ((unsigned char*)Uuid->Data4)[0] = (unsigned char)temp_clock_seq; - - ((unsigned char*)Uuid->Data4)[2] = a[0]; - ((unsigned char*)Uuid->Data4)[3] = a[1]; - ((unsigned char*)Uuid->Data4)[4] = a[2]; - ((unsigned char*)Uuid->Data4)[5] = a[3]; - ((unsigned char*)Uuid->Data4)[6] = a[4]; - ((unsigned char*)Uuid->Data4)[7] = a[5]; - - Print(MAX_TRACE, ("%s\n", PRINT_GUID(Uuid))); - - return S_OK; -#endif -} - -/************************************************************************* - * RpcStringFreeA [RPCRT4.436] - * - * Frees a character string allocated by the RPC run-time library. - * - * RETURNS - * - * S_OK if successful. - */ -RPC_STATUS WINAPI RpcStringFreeA(unsigned char** String) -{ - HeapFree( GetProcessHeap(), 0, *String); - - return S_OK; -} - -/************************************************************************* - * UuidToStringA [RPCRT4.450] - * - * Converts a UUID to a string. - * - * UUID format is 8 hex digits, followed by a hyphen then three groups of - * 4 hex digits each followed by a hyphen and then 12 hex digits - * - * RETURNS - * - * S_OK if successful. - * S_OUT_OF_MEMORY if unsucessful. - */ -RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, unsigned char** StringUuid) -{ - *StringUuid = HeapAlloc( GetProcessHeap(), 0, sizeof(char) * 37); - - - /* FIXME: this should be RPC_S_OUT_OF_MEMORY */ - if(!(*StringUuid)) - return ERROR_OUTOFMEMORY; - - sprintf(*StringUuid, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - Uuid->Data1, Uuid->Data2, Uuid->Data3, - Uuid->Data4[0], Uuid->Data4[1], Uuid->Data4[2], - Uuid->Data4[3], Uuid->Data4[4], Uuid->Data4[5], - Uuid->Data4[6], Uuid->Data4[7] ); - - return S_OK; /*FIXME: this should be RPC_S_OK */ -} - -/*********************************************************************** - * NdrDllRegisterProxy (RPCRT4.@) - */ -HRESULT WINAPI NdrDllRegisterProxy( - HMODULE hDll, /* [in] */ - void **pProxyFileList, /* [???] FIXME: const ProxyFileInfo ** */ - const CLSID *pclsid /* [in] */ -) { - Print(MIN_TRACE, ("(%x,%p,%s), stub!\n",hDll,pProxyFileList,PRINT_GUID(pclsid))); - return S_OK; -} diff --git a/reactos/lib/ole32/stg_bigblockfile.c b/reactos/lib/ole32/stg_bigblockfile.c index 68dc3b90d54..8f4867fd21a 100644 --- a/reactos/lib/ole32/stg_bigblockfile.c +++ b/reactos/lib/ole32/stg_bigblockfile.c @@ -2,32 +2,62 @@ * * BigBlockFile * - * This is the implementation of a file that consists of blocks of + * This is the implementation of a file that consists of blocks of * a predetermined size. - * This class is used in the Compound File implementation of the - * IStorage and IStream interfaces. It provides the functionality - * to read and write any blocks in the file as well as setting and + * This class is used in the Compound File implementation of the + * IStorage and IStream interfaces. It provides the functionality + * to read and write any blocks in the file as well as setting and * obtaining the size of the file. * The blocks are indexed sequentially from the start of the file * starting with -1. - * + * * TODO: * - Support for a transacted mode * * Copyright 1999 Thuy Nguyen * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include +#include #include #include #include -#include -#include +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "winerror.h" +#include "objbase.h" +#include "ole2.h" + #include "storage32.h" -#include +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(storage); /*********************************************************** * Data structures used internally by the BigBlockFile @@ -52,7 +82,7 @@ typedef struct /*** * This structure identifies the paged that are mapped - * from the file and their position in memory. It is + * from the file and their position in memory. It is * also used to hold a reference count to those pages. * * page_index identifies which PAGE_SIZE chunk from the @@ -85,7 +115,7 @@ static void BIGBLOCKFILE_RemapAllMappedPages(LPBIGBLOCKFILE This); static void* BIGBLOCKFILE_GetBigBlockPointer(LPBIGBLOCKFILE This, ULONG index, DWORD desired_access); -static MappedPage* BIGBLOCKFILE_GetPageFromPointer(LPBIGBLOCKFILE This, +static MappedPage* BIGBLOCKFILE_GetPageFromPointer(LPBIGBLOCKFILE This, void* pBlock); static MappedPage* BIGBLOCKFILE_CreatePage(LPBIGBLOCKFILE This, ULONG page_index); @@ -95,7 +125,7 @@ static BOOL BIGBLOCKFILE_MemInit(LPBIGBLOCKFILE This, ILockBytes* plkbyt); /* Note that this evaluates a and b multiple times, so don't * pass expressions with side effects. */ -#define ROUNDUP(a, b) ((((a) + (b) - 1)/(b))*(b)) +#define ROUND_UP(a, b) ((((a) + (b) - 1)/(b))*(b)) /*********************************************************** * Blockbits functions. @@ -133,7 +163,7 @@ static inline void BIGBLOCKFILE_Zero(BlockBits *bb) /****************************************************************************** * BIGBLOCKFILE_Construct * - * Construct a big block file. Create the file mapping object. + * Construct a big block file. Create the file mapping object. * Create the read only mapped pages list, the writable mapped page list * and the blocks in use list. */ @@ -217,7 +247,7 @@ static BOOL BIGBLOCKFILE_FileInit(LPBIGBLOCKFILE This, HANDLE hFile) This->maplist = NULL; - Print(MAX_TRACE, ("file len %lu\n", This->filesize.u.LowPart)); + TRACE("file len %lu\n", This->filesize.u.LowPart); return TRUE; } @@ -237,7 +267,7 @@ static BOOL BIGBLOCKFILE_MemInit(LPBIGBLOCKFILE This, ILockBytes* plkbyt) */ if (GetHGlobalFromILockBytes(plkbyt, &(This->hbytearray)) != S_OK) { - Print(MIN_TRACE, ("May not be an ILockBytes on HGLOBAL\n")); + FIXME("May not be an ILockBytes on HGLOBAL\n"); return FALSE; } @@ -254,7 +284,7 @@ static BOOL BIGBLOCKFILE_MemInit(LPBIGBLOCKFILE This, ILockBytes* plkbyt) This->pbytearray = GlobalLock(This->hbytearray); - Print(MAX_TRACE, ("mem on %p len %lu\n", This->pbytearray, This->filesize.u.LowPart)); + TRACE("mem on %p len %lu\n", This->pbytearray, This->filesize.u.LowPart); return TRUE; } @@ -306,13 +336,13 @@ void* BIGBLOCKFILE_GetROBigBlock( /* * validate the block index - * + * */ if (This->blocksize * (index + 1) - > ROUNDUP(This->filesize.u.LowPart, This->blocksize)) + > ROUND_UP(This->filesize.u.LowPart, This->blocksize)) { - Print(MAX_TRACE, ("out of range %lu vs %lu\n", This->blocksize * (index + 1), - This->filesize.u.LowPart)); + TRACE("out of range %lu vs %lu\n", This->blocksize * (index + 1), + This->filesize.u.LowPart); return NULL; } @@ -376,19 +406,19 @@ void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This, void *pBlock) * BIGBLOCKFILE_SetSize * * Sets the size of the file. - * + * */ void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize) { if (This->filesize.u.LowPart == newSize.u.LowPart) return; - Print(MAX_TRACE, ("from %lu to %lu\n", This->filesize.u.LowPart, newSize.u.LowPart)); + TRACE("from %lu to %lu\n", This->filesize.u.LowPart, newSize.u.LowPart); /* * unmap all views, must be done before call to SetEndFile */ BIGBLOCKFILE_UnmapAllMappedPages(This); - + if (This->fileBased) { char buf[10]; @@ -406,7 +436,7 @@ void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize) * to that dir: crash. * * The problem is that the SetFilePointer-SetEndOfFile combo below - * doesn't always succeed. The file is not grown. It seems like the + * doesn't always succeed. The file is not grown. It seems like the * operation is cached. By doing the WriteFile, the file is actually * grown on disk. * This hack is only needed when saving to smbfs. @@ -415,7 +445,7 @@ void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize) SetFilePointer(This->hfile, newSize.u.LowPart, NULL, FILE_BEGIN); WriteFile(This->hfile, buf, 10, NULL, NULL); /* - * END HACK + * END HACK */ /* @@ -423,14 +453,14 @@ void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize) */ SetFilePointer(This->hfile, newSize.u.LowPart, NULL, FILE_BEGIN); SetEndOfFile(This->hfile); - + /* * re-create the file mapping object */ This->hfilemap = CreateFileMappingA(This->hfile, NULL, This->flProtect, - 0, 0, + 0, 0, NULL); } else @@ -459,7 +489,7 @@ void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize) * BIGBLOCKFILE_GetSize * * Returns the size of the file. - * + * */ ULARGE_INTEGER BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This) { @@ -502,8 +532,8 @@ static BOOL BIGBLOCKFILE_AccessCheck(MappedPage *page, ULONG block_index, * Returns a pointer to the specified block. */ static void* BIGBLOCKFILE_GetBigBlockPointer( - LPBIGBLOCKFILE This, - ULONG block_index, + LPBIGBLOCKFILE This, + ULONG block_index, DWORD desired_access) { DWORD page_index = block_index / BLOCKS_PER_PAGE; @@ -656,7 +686,7 @@ static BOOL BIGBLOCKFILE_MapPage(LPBIGBLOCKFILE This, MappedPage *page) page->lpBytes = (LPBYTE)This->pbytearray + lowoffset; } - Print(MAX_TRACE, ("mapped page %lu to %p\n", page->page_index, page->lpBytes)); + TRACE("mapped page %lu to %p\n", page->page_index, page->lpBytes); return page->lpBytes != NULL; } @@ -686,9 +716,9 @@ static MappedPage *BIGBLOCKFILE_CreatePage(LPBIGBLOCKFILE This, static void BIGBLOCKFILE_UnmapPage(LPBIGBLOCKFILE This, MappedPage *page) { - Print(MAX_TRACE, ("%ld at %p\n", page->page_index, page->lpBytes)); + TRACE("%ld at %p\n", page->page_index, page->lpBytes); if (page->refcnt > 0) - Print(MIN_TRACE, ("unmapping inuse page %p\n", page->lpBytes)); + ERR("unmapping inuse page %p\n", page->lpBytes); if (This->fileBased && page->lpBytes) UnmapViewOfFile(page->lpBytes); @@ -800,7 +830,7 @@ static void BIGBLOCKFILE_RemapList(LPBIGBLOCKFILE This, MappedPage *list) if (list->page_index * PAGE_SIZE > This->filesize.u.LowPart) { - Print(MAX_TRACE, ("discarding %lu\n", list->page_index)); + TRACE("discarding %lu\n", list->page_index); /* page is entirely outside of the file, delete it */ BIGBLOCKFILE_UnlinkPage(list); diff --git a/reactos/lib/ole32/stg_stream.c b/reactos/lib/ole32/stg_stream.c index fb4b9ab68cf..e1ff69b7888 100644 --- a/reactos/lib/ole32/stg_stream.c +++ b/reactos/lib/ole32/stg_stream.c @@ -7,17 +7,43 @@ * * Copyright 1999 Francis Beaudet * Copyright 1999 Thuy Nguyen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include #include +#include #include #include -#include -#include -#include +#ifdef __REACTOS__ +#include +#endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winreg.h" +#include "winternl.h" +#include "wine/debug.h" + #include "storage32.h" -#include +WINE_DEFAULT_DEBUG_CHANNEL(storage); /* @@ -61,15 +87,15 @@ StgStreamImpl* StgStreamImpl_Construct( StgStreamImpl* newStream; newStream = HeapAlloc(GetProcessHeap(), 0, sizeof(StgStreamImpl)); - + if (newStream!=0) { /* * Set-up the virtual function table and reference count. */ - ICOM_VTBL(newStream) = &StgStreamImpl_Vtbl; + newStream->lpVtbl = &StgStreamImpl_Vtbl; newStream->ref = 0; - + /* * We want to nail-down the reference to the storage in case the * stream out-lives the storage in the client application. @@ -77,15 +103,15 @@ StgStreamImpl* StgStreamImpl_Construct( newStream->parentStorage = parentStorage; IStorage_AddRef((IStorage*)newStream->parentStorage); - newStream->grfMode = grfMode; + newStream->grfMode = grfMode; newStream->ownerProperty = ownerProperty; - + /* - * Start the stream at the begining. + * Start the stream at the beginning. */ newStream->currentPosition.u.HighPart = 0; newStream->currentPosition.u.LowPart = 0; - + /* * Initialize the rest of the data. */ @@ -93,27 +119,27 @@ StgStreamImpl* StgStreamImpl_Construct( newStream->streamSize.u.LowPart = 0; newStream->bigBlockChain = 0; newStream->smallBlockChain = 0; - + /* * Read the size from the property and determine if the blocks forming * this stream are large or small. */ StgStreamImpl_OpenBlockChain(newStream); } - + return newStream; } /*** * This is the destructor of the StgStreamImpl class. * - * This method will clean-up all the resources used-up by the given StgStreamImpl + * This method will clean-up all the resources used-up by the given StgStreamImpl * class. The pointer passed-in to this function will be freed and will not * be valid anymore. */ void StgStreamImpl_Destroy(StgStreamImpl* This) { - Print(MAX_TRACE, ("(%p)\n", This)); + TRACE("(%p)\n", This); /* * Release the reference we are holding on the parent storage. @@ -139,7 +165,7 @@ void StgStreamImpl_Destroy(StgStreamImpl* This) /* * Finally, free the memory used-up by the class. */ - HeapFree(GetProcessHeap(), 0, This); + HeapFree(GetProcessHeap(), 0, This); } /*** @@ -148,8 +174,8 @@ void StgStreamImpl_Destroy(StgStreamImpl* This) */ HRESULT WINAPI StgStreamImpl_QueryInterface( IStream* iface, - REFIID riid, /* [in] */ - void** ppvObject) /* [iid_is][out] */ + REFIID riid, /* [in] */ + void** ppvObject) /* [iid_is][out] */ { StgStreamImpl* const This=(StgStreamImpl*)iface; @@ -158,37 +184,37 @@ HRESULT WINAPI StgStreamImpl_QueryInterface( */ if (ppvObject==0) return E_INVALIDARG; - + /* * Initialize the return parameter. */ *ppvObject = 0; - + /* * Compare the riid with the interface IDs implemented by this object. */ - if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) + if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) { *ppvObject = (IStream*)This; } - else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0) + else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0) { *ppvObject = (IStream*)This; } - + /* * Check that we obtained an interface. */ if ((*ppvObject)==0) return E_NOINTERFACE; - + /* * Query Interface always increases the reference count by one when it is * successful */ StgStreamImpl_AddRef(iface); - - return S_OK;; + + return S_OK; } /*** @@ -201,7 +227,7 @@ ULONG WINAPI StgStreamImpl_AddRef( StgStreamImpl* const This=(StgStreamImpl*)iface; This->ref++; - + return This->ref; } @@ -215,11 +241,11 @@ ULONG WINAPI StgStreamImpl_Release( StgStreamImpl* const This=(StgStreamImpl*)iface; ULONG newRef; - + This->ref--; - + newRef = This->ref; - + /* * If the reference count goes down to 0, perform suicide. */ @@ -227,7 +253,7 @@ ULONG WINAPI StgStreamImpl_Release( { StgStreamImpl_Destroy(This); } - + return newRef; } @@ -243,7 +269,7 @@ void StgStreamImpl_OpenBlockChain( BOOL readSucessful; /* - * Make sure no old object is staying behind. + * Make sure no old object is left over. */ if (This->smallBlockChain != 0) { @@ -263,16 +289,16 @@ void StgStreamImpl_OpenBlockChain( readSucessful = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage, This->ownerProperty, &curProperty); - + if (readSucessful) { This->streamSize = curProperty.size; - + /* * This code supports only streams that are <32 bits in size. */ assert(This->streamSize.u.HighPart == 0); - + if(curProperty.startingBlock == BLOCK_END_OF_CHAIN) { assert( (This->streamSize.u.HighPart == 0) && (This->streamSize.u.LowPart == 0) ); @@ -283,7 +309,7 @@ void StgStreamImpl_OpenBlockChain( (This->streamSize.u.LowPart < LIMIT_TO_USE_SMALL_BLOCK) ) { This->smallBlockChain = SmallBlockChainStream_Construct( - This->parentStorage->ancestorStorage, + This->parentStorage->ancestorStorage, This->ownerProperty); } else @@ -300,42 +326,43 @@ void StgStreamImpl_OpenBlockChain( /*** * This method is part of the ISequentialStream interface. * - * If reads a block of information from the stream at the current + * It reads a block of information from the stream at the current * position. It then moves the current position at the end of the * read block * * See the documentation of ISequentialStream for more info. */ -HRESULT WINAPI StgStreamImpl_Read( +HRESULT WINAPI StgStreamImpl_Read( IStream* iface, void* pv, /* [length_is][size_is][out] */ - ULONG cb, /* [in] */ - ULONG* pcbRead) /* [out] */ + ULONG cb, /* [in] */ + ULONG* pcbRead) /* [out] */ { StgStreamImpl* const This=(StgStreamImpl*)iface; ULONG bytesReadBuffer; ULONG bytesToReadFromBuffer; + HRESULT res = S_FALSE; - Print(MAX_TRACE, ("(%p, %p, %ld, %p)\n", - iface, pv, cb, pcbRead)); + TRACE("(%p, %p, %ld, %p)\n", + iface, pv, cb, pcbRead); - /* - * If the caller is not interested in the nubmer of bytes read, + /* + * If the caller is not interested in the number of bytes read, * we use another buffer to avoid "if" statements in the code. */ if (pcbRead==0) pcbRead = &bytesReadBuffer; - + /* * Using the known size of the stream, calculate the number of bytes * to read from the block chain */ bytesToReadFromBuffer = min( This->streamSize.u.LowPart - This->currentPosition.u.LowPart, cb); - + /* * Depending on the type of chain that was opened when the stream was constructed, - * we delegate the work to the method that read the block chains. + * we delegate the work to the method that reads the block chains. */ if (This->smallBlockChain!=0) { @@ -344,7 +371,7 @@ HRESULT WINAPI StgStreamImpl_Read( bytesToReadFromBuffer, pv, pcbRead); - + } else if (This->bigBlockChain!=0) { @@ -362,7 +389,8 @@ HRESULT WINAPI StgStreamImpl_Read( */ *pcbRead = 0; - return S_OK; + res = S_OK; + goto end; } /* @@ -375,18 +403,26 @@ HRESULT WINAPI StgStreamImpl_Read( * Advance the pointer for the number of positions read. */ This->currentPosition.u.LowPart += *pcbRead; - - /* - * The function returns S_OK if the buffer was filled completely - * it returns S_FALSE if the end of the stream is reached before the - * buffer is filled - */ - if(*pcbRead == cb) - return S_OK; - - return S_FALSE; + + if(*pcbRead != cb) + { + WARN("read %ld instead of the required %ld bytes !\n", *pcbRead, cb); + /* + * this used to return S_FALSE, however MSDN docu says that an app should + * be prepared to handle error in case of stream end reached, as *some* + * implementations *might* return an error (IOW: most do *not*). + * As some program fails on returning S_FALSE, I better use S_OK here. + */ + res = S_OK; + } + else + res = S_OK; + +end: + TRACE("<-- %08lx\n", res); + return res; } - + /*** * This method is part of the ISequentialStream interface. * @@ -399,18 +435,18 @@ HRESULT WINAPI StgStreamImpl_Read( */ HRESULT WINAPI StgStreamImpl_Write( IStream* iface, - const void* pv, /* [size_is][in] */ - ULONG cb, /* [in] */ - ULONG* pcbWritten) /* [out] */ + const void* pv, /* [size_is][in] */ + ULONG cb, /* [in] */ + ULONG* pcbWritten) /* [out] */ { StgStreamImpl* const This=(StgStreamImpl*)iface; ULARGE_INTEGER newSize; ULONG bytesWritten = 0; - Print(MAX_TRACE, ("(%p, %p, %ld, %p)\n", - iface, pv, cb, pcbWritten)); - + TRACE("(%p, %p, %ld, %p)\n", + iface, pv, cb, pcbWritten); + /* * Do we have permission to write to this stream? */ @@ -424,7 +460,7 @@ HRESULT WINAPI StgStreamImpl_Write( */ if (pcbWritten == 0) pcbWritten = &bytesWritten; - + /* * Initialize the out parameter */ @@ -439,7 +475,7 @@ HRESULT WINAPI StgStreamImpl_Write( newSize.u.HighPart = 0; newSize.u.LowPart = This->currentPosition.u.LowPart + cb; } - + /* * Verify if we need to grow the stream */ @@ -448,7 +484,7 @@ HRESULT WINAPI StgStreamImpl_Write( /* grow stream */ IStream_SetSize(iface, newSize); } - + /* * Depending on the type of chain that was opened when the stream was constructed, * we delegate the work to the method that readwrites to the block chains. @@ -460,7 +496,7 @@ HRESULT WINAPI StgStreamImpl_Write( cb, pv, pcbWritten); - + } else if (This->bigBlockChain!=0) { @@ -472,12 +508,12 @@ HRESULT WINAPI StgStreamImpl_Write( } else assert(FALSE); - + /* * Advance the position pointer for the number of positions written. */ This->currentPosition.u.LowPart += *pcbWritten; - + return S_OK; } @@ -488,22 +524,21 @@ HRESULT WINAPI StgStreamImpl_Write( * given. * * See the documentation of IStream for more info. - */ -HRESULT WINAPI StgStreamImpl_Seek( + */ +HRESULT WINAPI StgStreamImpl_Seek( IStream* iface, - LARGE_INTEGER dlibMove, /* [in] */ - DWORD dwOrigin, /* [in] */ + LARGE_INTEGER dlibMove, /* [in] */ + DWORD dwOrigin, /* [in] */ ULARGE_INTEGER* plibNewPosition) /* [out] */ { StgStreamImpl* const This=(StgStreamImpl*)iface; ULARGE_INTEGER newPosition; - LARGE_INTEGER Position; - Print(MAX_TRACE, ("(%p, %ld, %ld, %p)\n", - iface, dlibMove.u.LowPart, dwOrigin, plibNewPosition)); + TRACE("(%p, %ld, %ld, %p)\n", + iface, dlibMove.u.LowPart, dwOrigin, plibNewPosition); - /* + /* * The caller is allowed to pass in NULL as the new position return value. * If it happens, we assign it to a dynamic variable to avoid special cases * in the code below. @@ -533,15 +568,13 @@ HRESULT WINAPI StgStreamImpl_Seek( return STG_E_INVALIDFUNCTION; } - Position = RtlLargeIntegerAdd( *((PLARGE_INTEGER)plibNewPosition), dlibMove ); - - plibNewPosition->QuadPart = Position.QuadPart; + plibNewPosition->QuadPart = RtlLargeIntegerAdd( plibNewPosition->QuadPart, dlibMove.QuadPart ); /* * tell the caller what we calculated */ This->currentPosition = *plibNewPosition; - + return S_OK; } @@ -554,16 +587,16 @@ HRESULT WINAPI StgStreamImpl_Seek( * * See the documentation of IStream for more info. */ -HRESULT WINAPI StgStreamImpl_SetSize( +HRESULT WINAPI StgStreamImpl_SetSize( IStream* iface, - ULARGE_INTEGER libNewSize) /* [in] */ + ULARGE_INTEGER libNewSize) /* [in] */ { StgStreamImpl* const This=(StgStreamImpl*)iface; StgProperty curProperty; BOOL Success; - Print(MAX_TRACE, ("(%p, %ld)\n", iface, libNewSize.u.LowPart)); + TRACE("(%p, %ld)\n", iface, libNewSize.u.LowPart); /* * As documented. @@ -605,11 +638,11 @@ HRESULT WINAPI StgStreamImpl_SetSize( */ Success = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage, This->ownerProperty, - &curProperty); + &curProperty); /* * Determine if we have to switch from small to big blocks or vice versa - */ - if ( (This->smallBlockChain!=0) && + */ + if ( (This->smallBlockChain!=0) && (curProperty.size.u.LowPart < LIMIT_TO_USE_SMALL_BLOCK) ) { if (libNewSize.u.LowPart >= LIMIT_TO_USE_SMALL_BLOCK) @@ -633,7 +666,7 @@ HRESULT WINAPI StgStreamImpl_SetSize( } /* - * Write to the property the new information about this stream + * Write the new information about this stream to the property */ Success = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage, This->ownerProperty, @@ -641,19 +674,19 @@ HRESULT WINAPI StgStreamImpl_SetSize( curProperty.size.u.HighPart = libNewSize.u.HighPart; curProperty.size.u.LowPart = libNewSize.u.LowPart; - + if (Success) { StorageImpl_WriteProperty(This->parentStorage->ancestorStorage, This->ownerProperty, &curProperty); } - + This->streamSize = libNewSize; - + return S_OK; } - + /*** * This method is part of the IStream interface. * @@ -661,12 +694,12 @@ HRESULT WINAPI StgStreamImpl_SetSize( * * See the documentation of IStream for more info. */ -HRESULT WINAPI StgStreamImpl_CopyTo( +HRESULT WINAPI StgStreamImpl_CopyTo( IStream* iface, - IStream* pstm, /* [unique][in] */ - ULARGE_INTEGER cb, /* [in] */ - ULARGE_INTEGER* pcbRead, /* [out] */ - ULARGE_INTEGER* pcbWritten) /* [out] */ + IStream* pstm, /* [unique][in] */ + ULARGE_INTEGER cb, /* [in] */ + ULARGE_INTEGER* pcbRead, /* [out] */ + ULARGE_INTEGER* pcbWritten) /* [out] */ { HRESULT hr = S_OK; BYTE tmpBuffer[128]; @@ -674,8 +707,8 @@ HRESULT WINAPI StgStreamImpl_CopyTo( ULARGE_INTEGER totalBytesRead; ULARGE_INTEGER totalBytesWritten; - Print(MAX_TRACE, ("(%p, %p, %ld, %p, %p)\n", - iface, pstm, cb.u.LowPart, pcbRead, pcbWritten)); + TRACE("(%p, %p, %ld, %p, %p)\n", + iface, pstm, cb.u.LowPart, pcbRead, pcbWritten); /* * Sanity check @@ -687,8 +720,8 @@ HRESULT WINAPI StgStreamImpl_CopyTo( totalBytesWritten.u.LowPart = totalBytesWritten.u.HighPart = 0; /* - * use stack to store data temporarly - * there is surely more performant way of doing it, for now this basic + * use stack to store data temporarily + * there is surely a more performant way of doing it, for now this basic * implementation will do the job */ while ( cb.u.LowPart > 0 ) @@ -697,24 +730,24 @@ HRESULT WINAPI StgStreamImpl_CopyTo( copySize = 128; else copySize = cb.u.LowPart; - + IStream_Read(iface, tmpBuffer, copySize, &bytesRead); totalBytesRead.u.LowPart += bytesRead; - + IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten); totalBytesWritten.u.LowPart += bytesWritten; /* - * Check that read & write operations were succesfull + * Check that read & write operations were successful */ if (bytesRead != bytesWritten) { hr = STG_E_MEDIUMFULL; break; } - + if (bytesRead!=copySize) cb.u.LowPart = 0; else @@ -745,10 +778,10 @@ HRESULT WINAPI StgStreamImpl_CopyTo( * does nothing. This is what the documentation tells us. * * See the documentation of IStream for more info. - */ -HRESULT WINAPI StgStreamImpl_Commit( + */ +HRESULT WINAPI StgStreamImpl_Commit( IStream* iface, - DWORD grfCommitFlags) /* [in] */ + DWORD grfCommitFlags) /* [in] */ { return S_OK; } @@ -760,30 +793,30 @@ HRESULT WINAPI StgStreamImpl_Commit( * does nothing. This is what the documentation tells us. * * See the documentation of IStream for more info. - */ -HRESULT WINAPI StgStreamImpl_Revert( + */ +HRESULT WINAPI StgStreamImpl_Revert( IStream* iface) { return S_OK; } -HRESULT WINAPI StgStreamImpl_LockRegion( +HRESULT WINAPI StgStreamImpl_LockRegion( IStream* iface, - ULARGE_INTEGER libOffset, /* [in] */ - ULARGE_INTEGER cb, /* [in] */ - DWORD dwLockType) /* [in] */ + ULARGE_INTEGER libOffset, /* [in] */ + ULARGE_INTEGER cb, /* [in] */ + DWORD dwLockType) /* [in] */ { - UNIMPLEMENTED; + FIXME("not implemented!\n"); return E_NOTIMPL; } -HRESULT WINAPI StgStreamImpl_UnlockRegion( +HRESULT WINAPI StgStreamImpl_UnlockRegion( IStream* iface, - ULARGE_INTEGER libOffset, /* [in] */ - ULARGE_INTEGER cb, /* [in] */ - DWORD dwLockType) /* [in] */ + ULARGE_INTEGER libOffset, /* [in] */ + ULARGE_INTEGER cb, /* [in] */ + DWORD dwLockType) /* [in] */ { - UNIMPLEMENTED; + FIXME("not implemented!\n"); return E_NOTIMPL; } @@ -794,42 +827,76 @@ HRESULT WINAPI StgStreamImpl_UnlockRegion( * stream. * * See the documentation of IStream for more info. - */ -HRESULT WINAPI StgStreamImpl_Stat( + */ +HRESULT WINAPI StgStreamImpl_Stat( IStream* iface, STATSTG* pstatstg, /* [out] */ - DWORD grfStatFlag) /* [in] */ + DWORD grfStatFlag) /* [in] */ { StgStreamImpl* const This=(StgStreamImpl*)iface; StgProperty curProperty; BOOL readSucessful; - + /* * Read the information from the property. */ readSucessful = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage, This->ownerProperty, &curProperty); - + if (readSucessful) { - StorageUtl_CopyPropertyToSTATSTG(pstatstg, - &curProperty, + StorageUtl_CopyPropertyToSTATSTG(pstatstg, + &curProperty, grfStatFlag); pstatstg->grfMode = This->grfMode; - + return S_OK; } - + return E_FAIL; } - -HRESULT WINAPI StgStreamImpl_Clone( + +/*** + * This method is part of the IStream interface. + * + * This method returns a clone of the interface that allows for + * another seek pointer + * + * See the documentation of IStream for more info. + * + * I am not totally sure what I am doing here but I presume that this + * should be basically as simple as creating a new stream with the same + * parent etc and positioning its seek cursor. + */ +HRESULT WINAPI StgStreamImpl_Clone( IStream* iface, - IStream** ppstm) /* [out] */ + IStream** ppstm) /* [out] */ { - UNIMPLEMENTED; - return E_NOTIMPL; + StgStreamImpl* const This=(StgStreamImpl*)iface; + HRESULT hres; + StgStreamImpl* new_stream; + LARGE_INTEGER seek_pos; + + /* + * Sanity check + */ + if ( ppstm == 0 ) + return STG_E_INVALIDPOINTER; + + new_stream = StgStreamImpl_Construct (This->parentStorage, This->grfMode, This->ownerProperty); + + if (!new_stream) + return STG_E_INSUFFICIENTMEMORY; /* Currently the only reason for new_stream=0 */ + + *ppstm = (IStream*) new_stream; + seek_pos.QuadPart = This->currentPosition.QuadPart; + + hres=StgStreamImpl_Seek (*ppstm, seek_pos, STREAM_SEEK_SET, NULL); + + assert (SUCCEEDED(hres)); + + return S_OK; } diff --git a/reactos/lib/ole32/storage.c b/reactos/lib/ole32/storage.c index e0a2f00d56a..e69de29bb2d 100644 --- a/reactos/lib/ole32/storage.c +++ b/reactos/lib/ole32/storage.c @@ -1,778 +0,0 @@ -/* Compound Storage - * - * Implemented using the documentation of the LAOLA project at - * - * (Thanks to Martin Schwartz ) - * - * Copyright 1998 Marcus Meissner - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -struct storage_header { - BYTE magic[8]; /* 00: magic */ - BYTE unknown1[36]; /* 08: unknown */ - DWORD num_of_bbd_blocks;/* 2C: length of big datablocks */ - DWORD root_startblock;/* 30: root storage first big block */ - DWORD unknown2[2]; /* 34: unknown */ - DWORD sbd_startblock; /* 3C: small block depot first big block */ - DWORD unknown3[3]; /* 40: unknown */ - DWORD bbd_list[109]; /* 4C: big data block list (up to end of sector)*/ -}; -struct storage_pps_entry { - WCHAR pps_rawname[32];/* 00: \0 terminated widechar name */ - WORD pps_sizeofname; /* 40: namelength in bytes */ - BYTE pps_type; /* 42: flags, 1 storage/dir, 2 stream, 5 root */ - BYTE pps_unknown0; /* 43: unknown */ - DWORD pps_prev; /* 44: previous pps */ - DWORD pps_next; /* 48: next pps */ - DWORD pps_dir; /* 4C: directory pps */ - GUID pps_guid; /* 50: class ID */ - DWORD pps_unknown1; /* 60: unknown */ - FILETIME pps_ft1; /* 64: filetime1 */ - FILETIME pps_ft2; /* 70: filetime2 */ - DWORD pps_sb; /* 74: data startblock */ - DWORD pps_size; /* 78: datalength. (<0x1000)?small:big blocks*/ - DWORD pps_unknown2; /* 7C: unknown */ -}; - -#define STORAGE_CHAINENTRY_FAT 0xfffffffd -#define STORAGE_CHAINENTRY_ENDOFCHAIN 0xfffffffe -#define STORAGE_CHAINENTRY_FREE 0xffffffff - - -//static const BYTE STORAGE_magic[8] ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1}; -//static const BYTE STORAGE_notmagic[8]={0x0e,0x11,0xfc,0x0d,0xd0,0xcf,0x11,0xe0}; -//static const BYTE STORAGE_oldmagic[8]={0xd0,0xcf,0x11,0xe0,0x0e,0x11,0xfc,0x0d}; - -#define BIGSIZE 512 -#define SMALLSIZE 64 - -#define SMALLBLOCKS_PER_BIGBLOCK (BIGSIZE/SMALLSIZE) - -#define READ_HEADER assert(STORAGE_get_big_block(hf,-1,(LPBYTE)&sth));assert(!memcmp(STORAGE_magic,sth.magic,sizeof(STORAGE_magic))); -static ICOM_VTABLE(IStorage16) stvt16; -static ICOM_VTABLE(IStorage16) *segstvt16 = NULL; -static ICOM_VTABLE(IStream16) strvt16; -static ICOM_VTABLE(IStream16) *segstrvt16 = NULL; - -/*ULONG WINAPI IStorage16_AddRef(LPSTORAGE16 this);*/ -static void _create_istorage16(LPSTORAGE16 *stg); -static void _create_istream16(LPSTREAM16 *str); - -#define IMPLEMENTED 1 - - -/****************************************************************************** - * STORAGE_get_big_block [Internal] - * - * Reading OLE compound storage - */ -static BOOL -STORAGE_get_big_block(HFILE hf,int n,BYTE *block) { - assert(n>=-1); - if (-1==_llseek(hf,(n+1)*BIGSIZE,SEEK_SET)) { - Print(MID_TRACE, (" seek failed (%ld)\n",GetLastError())); - return FALSE; - } - assert((n+1)*BIGSIZE==_llseek(hf,0,SEEK_CUR)); - if (BIGSIZE!=_lread(hf,block,BIGSIZE)) { - Print(MID_TRACE, ("(block size %d): read didn't read (%ld)\n",n,GetLastError())); - assert(0); - return FALSE; - } - return TRUE; -} - -/****************************************************************************** - * STORAGE_put_big_block [INTERNAL] - */ -static BOOL -STORAGE_put_big_block(HFILE hf,int n,BYTE *block) { - assert(n>=-1); - if (-1==_llseek(hf,(n+1)*BIGSIZE,SEEK_SET)) { - Print(MID_TRACE, (" seek failed (%ld)\n",GetLastError())); - return FALSE; - } - assert((n+1)*BIGSIZE==_llseek(hf,0,SEEK_CUR)); - if (BIGSIZE!=_lwrite(hf,block,BIGSIZE)) { - Print(MID_TRACE, (" write failed (%ld)\n",GetLastError())); - return FALSE; - } - return TRUE; -} - -/****************************************************************************** - * STORAGE_get_next_big_blocknr [INTERNAL] - */ -static int -STORAGE_get_next_big_blocknr(HFILE hf,int blocknr) { - INT bbs[BIGSIZE/sizeof(INT)]; - struct storage_header sth; - - READ_HEADER; - - assert(blocknr>>7>7]==0xffffffff) - return -5; - if (!STORAGE_get_big_block(hf,sth.bbd_list[blocknr>>7],(LPBYTE)bbs)) - return -5; - assert(bbs[blocknr&0x7f]!=STORAGE_CHAINENTRY_FREE); - return bbs[blocknr&0x7f]; -} - -/****************************************************************************** - * STORAGE_get_nth_next_big_blocknr [INTERNAL] - */ -static int -STORAGE_get_nth_next_big_blocknr(HFILE hf,int blocknr,int nr) { - INT bbs[BIGSIZE/sizeof(INT)]; - int lastblock = -1; - struct storage_header sth; - - READ_HEADER; - - assert(blocknr>=0); - while (nr--) { - assert((blocknr>>7)>7]!=0xffffffff); - - /* simple caching... */ - if (lastblock!=sth.bbd_list[blocknr>>7]) { - assert(STORAGE_get_big_block(hf,sth.bbd_list[blocknr>>7],(LPBYTE)bbs)); - lastblock = sth.bbd_list[blocknr>>7]; - } - blocknr = bbs[blocknr&0x7f]; - } - return blocknr; -} - -/****************************************************************************** - * STORAGE_get_root_pps_entry [Internal] - */ -static BOOL -STORAGE_get_root_pps_entry(HFILE hf,struct storage_pps_entry *pstde) { - int blocknr,i; - BYTE block[BIGSIZE]; - struct storage_pps_entry *stde=(struct storage_pps_entry*)block; - struct storage_header sth; - - READ_HEADER; - blocknr = sth.root_startblock; - while (blocknr>=0) { - assert(STORAGE_get_big_block(hf,blocknr,block)); - for (i=0;i<4;i++) { - if (!stde[i].pps_sizeofname) - continue; - if (stde[i].pps_type==5) { - *pstde=stde[i]; - return TRUE; - } - } - blocknr=STORAGE_get_next_big_blocknr(hf,blocknr); - } - return FALSE; -} - -/****************************************************************************** - * STORAGE_get_small_block [INTERNAL] - */ -static BOOL -STORAGE_get_small_block(HFILE hf,int blocknr,BYTE *sblock) { - BYTE block[BIGSIZE]; - int bigblocknr; - struct storage_pps_entry root; - - assert(blocknr>=0); - assert(STORAGE_get_root_pps_entry(hf,&root)); - bigblocknr = STORAGE_get_nth_next_big_blocknr(hf,root.pps_sb,blocknr/SMALLBLOCKS_PER_BIGBLOCK); - assert(bigblocknr>=0); - assert(STORAGE_get_big_block(hf,bigblocknr,block)); - - memcpy(sblock,((LPBYTE)block)+SMALLSIZE*(blocknr&(SMALLBLOCKS_PER_BIGBLOCK-1)),SMALLSIZE); - return TRUE; -} - -/****************************************************************************** - * STORAGE_put_small_block [INTERNAL] - */ -static BOOL -STORAGE_put_small_block(HFILE hf,int blocknr,BYTE *sblock) { - BYTE block[BIGSIZE]; - int bigblocknr; - struct storage_pps_entry root; - - assert(blocknr>=0); - - assert(STORAGE_get_root_pps_entry(hf,&root)); - bigblocknr = STORAGE_get_nth_next_big_blocknr(hf,root.pps_sb,blocknr/SMALLBLOCKS_PER_BIGBLOCK); - assert(bigblocknr>=0); - assert(STORAGE_get_big_block(hf,bigblocknr,block)); - - memcpy(((LPBYTE)block)+SMALLSIZE*(blocknr&(SMALLBLOCKS_PER_BIGBLOCK-1)),sblock,SMALLSIZE); - assert(STORAGE_put_big_block(hf,bigblocknr,block)); - return TRUE; -} - -/****************************************************************************** - * STORAGE_get_next_small_blocknr [INTERNAL] - */ -static int -STORAGE_get_next_small_blocknr(HFILE hf,int blocknr) { - BYTE block[BIGSIZE]; - LPINT sbd = (LPINT)block; - int bigblocknr; - struct storage_header sth; - - READ_HEADER; - assert(blocknr>=0); - bigblocknr = STORAGE_get_nth_next_big_blocknr(hf,sth.sbd_startblock,blocknr/128); - assert(bigblocknr>=0); - assert(STORAGE_get_big_block(hf,bigblocknr,block)); - assert(sbd[blocknr & 127]!=STORAGE_CHAINENTRY_FREE); - return sbd[blocknr & (128-1)]; -} - -/****************************************************************************** - * STORAGE_get_nth_next_small_blocknr [INTERNAL] - */ -static int -STORAGE_get_nth_next_small_blocknr(HFILE hf,int blocknr,int nr) { - int lastblocknr; - BYTE block[BIGSIZE]; - LPINT sbd = (LPINT)block; - struct storage_header sth; - - READ_HEADER; - lastblocknr=-1; - assert(blocknr>=0); - while ((nr--) && (blocknr>=0)) { - if (lastblocknr/128!=blocknr/128) { - int bigblocknr; - bigblocknr = STORAGE_get_nth_next_big_blocknr(hf,sth.sbd_startblock,blocknr/128); - assert(bigblocknr>=0); - assert(STORAGE_get_big_block(hf,bigblocknr,block)); - lastblocknr = blocknr; - } - assert(lastblocknr>=0); - lastblocknr=blocknr; - blocknr=sbd[blocknr & (128-1)]; - assert(blocknr!=STORAGE_CHAINENTRY_FREE); - } - return blocknr; -} - -/****************************************************************************** - * STORAGE_get_pps_entry [INTERNAL] - */ -static int -STORAGE_get_pps_entry(HFILE hf,int n,struct storage_pps_entry *pstde) { - int blocknr; - BYTE block[BIGSIZE]; - struct storage_pps_entry *stde = (struct storage_pps_entry*)(((LPBYTE)block)+128*(n&3)); - struct storage_header sth; - - READ_HEADER; - /* we have 4 pps entries per big block */ - blocknr = STORAGE_get_nth_next_big_blocknr(hf,sth.root_startblock,n/4); - assert(blocknr>=0); - assert(STORAGE_get_big_block(hf,blocknr,block)); - - *pstde=*stde; - return 1; -} - -/****************************************************************************** - * STORAGE_put_pps_entry [Internal] - */ -static int -STORAGE_put_pps_entry(HFILE hf,int n,struct storage_pps_entry *pstde) { - int blocknr; - BYTE block[BIGSIZE]; - struct storage_pps_entry *stde = (struct storage_pps_entry*)(((LPBYTE)block)+128*(n&3)); - struct storage_header sth; - - READ_HEADER; - - /* we have 4 pps entries per big block */ - blocknr = STORAGE_get_nth_next_big_blocknr(hf,sth.root_startblock,n/4); - assert(blocknr>=0); - assert(STORAGE_get_big_block(hf,blocknr,block)); - *stde=*pstde; - assert(STORAGE_put_big_block(hf,blocknr,block)); - return 1; -} - -/****************************************************************************** - * STORAGE_look_for_named_pps [Internal] - */ -static int -STORAGE_look_for_named_pps(HFILE hf,int n,LPOLESTR name) { - struct storage_pps_entry stde; - int ret; - - if (n==-1) - return -1; - if (1!=STORAGE_get_pps_entry(hf,n,&stde)) - return -1; - - if (!lstrcmpW(name,stde.pps_rawname)) - return n; - if (stde.pps_prev != -1) { - ret=STORAGE_look_for_named_pps(hf,stde.pps_prev,name); - if (ret!=-1) - return ret; - } - if (stde.pps_next != -1) { - ret=STORAGE_look_for_named_pps(hf,stde.pps_next,name); - if (ret!=-1) - return ret; - } - return -1; -} - -/****************************************************************************** - * STORAGE_dump_pps_entry [Internal] - * - * FIXME - * Function is unused - */ -void -STORAGE_dump_pps_entry(struct storage_pps_entry *stde) { -#if 0 - char name[33]; - - WideCharToMultiByte( CP_ACP, 0, stde->pps_rawname, -1, name, sizeof(name), NULL, NULL); - if (!stde->pps_sizeofname) - return; - Print(MAX_TRACE, ("name: %s\n",name)); - Print(MAX_TRACE, ("type: %d\n",stde->pps_type)); - Print(MAX_TRACE, ("prev pps: %ld\n",stde->pps_prev)); - Print(MAX_TRACE, ("next pps: %ld\n",stde->pps_next)); - Print(MAX_TRACE, ("dir pps: %ld\n",stde->pps_dir)); - Print(MAX_TRACE, ("guid: %s\n",PRINT_GUID(&(stde->pps_guid)))); - if (stde->pps_type !=2) { - time_t t; - DWORD dw; - RtlTimeToSecondsSince1970(&(stde->pps_ft1),&dw); - t = dw; - Print(MAX_TRACE, ("ts1: %s\n",ctime(&t))); - RtlTimeToSecondsSince1970(&(stde->pps_ft2),&dw); - t = dw; - Print(MAX_TRACE, ("ts2: %s\n",ctime(&t))); - } - Print(MAX_TRACE, ("startblock: %ld\n",stde->pps_sb)); - Print(MAX_TRACE, ("size: %ld\n",stde->pps_size)); -#endif -} - -/****************************************************************************** - * STORAGE_init_storage [INTERNAL] - */ -static BOOL -STORAGE_init_storage(HFILE hf) { - BYTE block[BIGSIZE]; - LPDWORD bbs; - struct storage_header *sth; - struct storage_pps_entry *stde; - - assert(-1!=_llseek(hf,0,SEEK_SET)); - /* block -1 is the storage header */ - sth = (struct storage_header*)block; - memcpy(sth->magic,STORAGE_magic,8); - memset(sth->unknown1,0,sizeof(sth->unknown1)); - memset(sth->unknown2,0,sizeof(sth->unknown2)); - memset(sth->unknown3,0,sizeof(sth->unknown3)); - sth->num_of_bbd_blocks = 1; - sth->root_startblock = 1; - sth->sbd_startblock = 0xffffffff; - memset(sth->bbd_list,0xff,sizeof(sth->bbd_list)); - sth->bbd_list[0] = 0; - assert(BIGSIZE==_lwrite(hf,block,BIGSIZE)); - /* block 0 is the big block directory */ - bbs=(LPDWORD)block; - memset(block,0xff,sizeof(block)); /* mark all blocks as free */ - bbs[0]=STORAGE_CHAINENTRY_ENDOFCHAIN; /* for this block */ - bbs[1]=STORAGE_CHAINENTRY_ENDOFCHAIN; /* for directory entry */ - assert(BIGSIZE==_lwrite(hf,block,BIGSIZE)); - /* block 1 is the root directory entry */ - memset(block,0x00,sizeof(block)); - stde = (struct storage_pps_entry*)block; - MultiByteToWideChar( CP_ACP, 0, "RootEntry", -1, stde->pps_rawname, - sizeof(stde->pps_rawname)/sizeof(WCHAR)); - stde->pps_sizeofname = (lstrlenW(stde->pps_rawname)+1) * sizeof(WCHAR); - stde->pps_type = 5; - stde->pps_dir = -1; - stde->pps_next = -1; - stde->pps_prev = -1; - stde->pps_sb = 0xffffffff; - stde->pps_size = 0; - assert(BIGSIZE==_lwrite(hf,block,BIGSIZE)); - return TRUE; -} - -/****************************************************************************** - * STORAGE_set_big_chain [Internal] - */ -static BOOL -STORAGE_set_big_chain(HFILE hf,int blocknr,INT type) { - BYTE block[BIGSIZE]; - LPINT bbd = (LPINT)block; - int nextblocknr,bigblocknr; - struct storage_header sth; - - READ_HEADER; - assert(blocknr!=type); - while (blocknr>=0) { - bigblocknr = sth.bbd_list[blocknr/128]; - assert(bigblocknr>=0); - assert(STORAGE_get_big_block(hf,bigblocknr,block)); - - nextblocknr = bbd[blocknr&(128-1)]; - bbd[blocknr&(128-1)] = type; - if (type>=0) - return TRUE; - assert(STORAGE_put_big_block(hf,bigblocknr,block)); - type = STORAGE_CHAINENTRY_FREE; - blocknr = nextblocknr; - } - return TRUE; -} - -/****************************************************************************** - * STORAGE_set_small_chain [Internal] - */ -static BOOL -STORAGE_set_small_chain(HFILE hf,int blocknr,INT type) { - BYTE block[BIGSIZE]; - LPINT sbd = (LPINT)block; - int lastblocknr,nextsmallblocknr,bigblocknr; - struct storage_header sth; - - READ_HEADER; - - assert(blocknr!=type); - lastblocknr=-129;bigblocknr=-2; - while (blocknr>=0) { - /* cache block ... */ - if (lastblocknr/128!=blocknr/128) { - bigblocknr = STORAGE_get_nth_next_big_blocknr(hf,sth.sbd_startblock,blocknr/128); - assert(bigblocknr>=0); - assert(STORAGE_get_big_block(hf,bigblocknr,block)); - } - lastblocknr = blocknr; - nextsmallblocknr = sbd[blocknr&(128-1)]; - sbd[blocknr&(128-1)] = type; - assert(STORAGE_put_big_block(hf,bigblocknr,block)); - if (type>=0) - return TRUE; - type = STORAGE_CHAINENTRY_FREE; - blocknr = nextsmallblocknr; - } - return TRUE; -} - -/****************************************************************************** - * STORAGE_get_free_big_blocknr [Internal] - */ -static int -STORAGE_get_free_big_blocknr(HFILE hf) { - BYTE block[BIGSIZE]; - LPINT sbd = (LPINT)block; - int lastbigblocknr,i,curblock,bigblocknr; - struct storage_header sth; - - READ_HEADER; - curblock = 0; - lastbigblocknr = -1; - bigblocknr = sth.bbd_list[curblock]; - while (curblock=0); - assert(STORAGE_get_big_block(hf,bigblocknr,block)); - for (i=0;i<128;i++) - if (sbd[i]==STORAGE_CHAINENTRY_FREE) { - sbd[i] = STORAGE_CHAINENTRY_ENDOFCHAIN; - assert(STORAGE_put_big_block(hf,bigblocknr,block)); - memset(block,0x42,sizeof(block)); - assert(STORAGE_put_big_block(hf,i+curblock*128,block)); - return i+curblock*128; - } - lastbigblocknr = bigblocknr; - bigblocknr = sth.bbd_list[++curblock]; - } - bigblocknr = curblock*128; - /* since we have marked all blocks from 0 up to curblock*128-1 - * the next free one is curblock*128, where we happily put our - * next large block depot. - */ - memset(block,0xff,sizeof(block)); - /* mark the block allocated and returned by this function */ - sbd[1] = STORAGE_CHAINENTRY_ENDOFCHAIN; - assert(STORAGE_put_big_block(hf,bigblocknr,block)); - - /* if we had a bbd block already (mostlikely) we need - * to link the new one into the chain - */ - if (lastbigblocknr!=-1) - assert(STORAGE_set_big_chain(hf,lastbigblocknr,bigblocknr)); - sth.bbd_list[curblock]=bigblocknr; - sth.num_of_bbd_blocks++; - assert(sth.num_of_bbd_blocks==curblock+1); - assert(STORAGE_put_big_block(hf,-1,(LPBYTE)&sth)); - - /* Set the end of the chain for the bigblockdepots */ - assert(STORAGE_set_big_chain(hf,bigblocknr,STORAGE_CHAINENTRY_ENDOFCHAIN)); - /* add 1, for the first entry is used for the additional big block - * depot. (means we already used bigblocknr) */ - memset(block,0x42,sizeof(block)); - /* allocate this block (filled with 0x42) */ - assert(STORAGE_put_big_block(hf,bigblocknr+1,block)); - return bigblocknr+1; -} - - -/****************************************************************************** - * STORAGE_get_free_small_blocknr [Internal] - */ -static int -STORAGE_get_free_small_blocknr(HFILE hf) { - BYTE block[BIGSIZE]; - LPINT sbd = (LPINT)block; - int lastbigblocknr,newblocknr,i,curblock,bigblocknr; - struct storage_pps_entry root; - struct storage_header sth; - - READ_HEADER; - bigblocknr = sth.sbd_startblock; - curblock = 0; - lastbigblocknr = -1; - newblocknr = -1; - while (bigblocknr>=0) { - if (!STORAGE_get_big_block(hf,bigblocknr,block)) - return -1; - for (i=0;i<128;i++) - if (sbd[i]==STORAGE_CHAINENTRY_FREE) { - sbd[i]=STORAGE_CHAINENTRY_ENDOFCHAIN; - newblocknr = i+curblock*128; - break; - } - if (i!=128) - break; - lastbigblocknr = bigblocknr; - bigblocknr = STORAGE_get_next_big_blocknr(hf,bigblocknr); - curblock++; - } - if (newblocknr==-1) { - bigblocknr = STORAGE_get_free_big_blocknr(hf); - if (bigblocknr<0) - return -1; - READ_HEADER; - memset(block,0xff,sizeof(block)); - sbd[0]=STORAGE_CHAINENTRY_ENDOFCHAIN; - if (!STORAGE_put_big_block(hf,bigblocknr,block)) - return -1; - if (lastbigblocknr==-1) { - sth.sbd_startblock = bigblocknr; - if (!STORAGE_put_big_block(hf,-1,(LPBYTE)&sth)) /* need to write it */ - return -1; - } else { - if (!STORAGE_set_big_chain(hf,lastbigblocknr,bigblocknr)) - return -1; - } - if (!STORAGE_set_big_chain(hf,bigblocknr,STORAGE_CHAINENTRY_ENDOFCHAIN)) - return -1; - newblocknr = curblock*128; - } - /* allocate enough big blocks for storing the allocated small block */ - if (!STORAGE_get_root_pps_entry(hf,&root)) - return -1; - if (root.pps_sb==-1) - lastbigblocknr = -1; - else - lastbigblocknr = STORAGE_get_nth_next_big_blocknr(hf,root.pps_sb,(root.pps_size-1)/BIGSIZE); - while (root.pps_size < (newblocknr*SMALLSIZE+SMALLSIZE-1)) { - /* we need to allocate more stuff */ - bigblocknr = STORAGE_get_free_big_blocknr(hf); - if (bigblocknr<0) - return -1; - READ_HEADER; - if (root.pps_sb==-1) { - root.pps_sb = bigblocknr; - root.pps_size += BIGSIZE; - } else { - if (!STORAGE_set_big_chain(hf,lastbigblocknr,bigblocknr)) - return -1; - root.pps_size += BIGSIZE; - } - lastbigblocknr = bigblocknr; - } - if (!STORAGE_set_big_chain(hf,lastbigblocknr,STORAGE_CHAINENTRY_ENDOFCHAIN)) - return -1; - if (!STORAGE_put_pps_entry(hf,0,&root)) - return -1; - return newblocknr; -} - -/****************************************************************************** - * STORAGE_get_free_pps_entry [Internal] - */ -static int -STORAGE_get_free_pps_entry(HFILE hf) { - int blocknr,i,curblock,lastblocknr; - BYTE block[BIGSIZE]; - struct storage_pps_entry *stde = (struct storage_pps_entry*)block; - struct storage_header sth; - - READ_HEADER; - blocknr = sth.root_startblock; - assert(blocknr>=0); - curblock=0; - while (blocknr>=0) { - if (!STORAGE_get_big_block(hf,blocknr,block)) - return -1; - for (i=0;i<4;i++) - if (stde[i].pps_sizeofname==0) /* free */ - return curblock*4+i; - lastblocknr = blocknr; - blocknr = STORAGE_get_next_big_blocknr(hf,blocknr); - curblock++; - } - assert(blocknr==STORAGE_CHAINENTRY_ENDOFCHAIN); - blocknr = STORAGE_get_free_big_blocknr(hf); - /* sth invalidated */ - if (blocknr<0) - return -1; - - if (!STORAGE_set_big_chain(hf,lastblocknr,blocknr)) - return -1; - if (!STORAGE_set_big_chain(hf,blocknr,STORAGE_CHAINENTRY_ENDOFCHAIN)) - return -1; - memset(block,0,sizeof(block)); - STORAGE_put_big_block(hf,blocknr,block); - return curblock*4; -} - -/* --- IStream32 implementation */ - -typedef struct -{ - /* IUnknown fields */ - ICOM_VFIELD(IStream); - DWORD ref; - /* IStream32 fields */ - struct storage_pps_entry stde; - int ppsent; - HFILE hf; - ULARGE_INTEGER offset; -} IStream32Impl; - -/***************************************************************************** - * IStream32_QueryInterface [VTABLE] - */ -HRESULT WINAPI IStream_fnQueryInterface( - IStream* iface,REFIID refiid,LPVOID *obj -) { - ICOM_THIS(IStream32Impl,iface); - - Print(MAX_TRACE, ("(%p)->(%s,%p)\n",This,debugstr_guid(refiid),obj)); - if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) { - *obj = This; - return 0; - } - return OLE_E_ENUM_NOMORE; - -} - -/****************************************************************************** - * IStream32_AddRef [VTABLE] - */ -ULONG WINAPI IStream_fnAddRef(IStream* iface) { - ICOM_THIS(IStream32Impl,iface); - return ++(This->ref); -} - -/****************************************************************************** - * IStream32_Release [VTABLE] - */ -ULONG WINAPI IStream_fnRelease(IStream* iface) { -#if 0 - ICOM_THIS(IStream32Impl,iface); - FlushFileBuffers(This->hf); - This->ref--; - if (!This->ref) { - CloseHandle(This->hf); - SEGPTR_FREE(This); - return 0; - } - return This->ref; -#else - UNIMPLEMENTED; - return 0; -#endif -} - - -/****************************************************************************** - * Storage API functions - */ - -/****************************************************************************** - * StgCreateDocFile16 [STORAGE.1] - */ -HRESULT WINAPI StgCreateDocFile16( - LPCOLESTR16 pwcsName,DWORD grfMode,DWORD reserved,IStorage16 **ppstgOpen -) { - UNIMPLEMENTED; - return S_OK; -} - -/****************************************************************************** - * StgIsStorageFile16 [STORAGE.5] - */ -HRESULT WINAPI StgIsStorageFile16(LPCOLESTR16 fn) { - UNIMPLEMENTED; - return S_OK; -} - -/****************************************************************************** - * StgIsStorageFile [OLE32.146] - */ -HRESULT WINAPI -StgIsStorageFile(LPCOLESTR fn) -{ -#if 0 - LPOLESTR16 xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn); - HRESULT ret = StgIsStorageFile16(xfn); - - HeapFree(GetProcessHeap(),0,xfn); - return ret; -#else - UNIMPLEMENTED; - return S_OK; -#endif -} - - -/****************************************************************************** - * StgOpenStorage16 [STORAGE.3] - */ -HRESULT WINAPI StgOpenStorage16( - LPCOLESTR16 pwcsName,IStorage16 *pstgPriority,DWORD grfMode, - SNB16 snbExclude,DWORD reserved, IStorage16 **ppstgOpen -) { - UNIMPLEMENTED; - return S_OK; -} - - diff --git a/reactos/lib/ole32/storage32.c b/reactos/lib/ole32/storage32.c index 80987cd849e..2cbf9e5246f 100644 --- a/reactos/lib/ole32/storage32.c +++ b/reactos/lib/ole32/storage32.c @@ -8,33 +8,55 @@ * Copyright 1999 Francis Beaudet * Copyright 1999 Sylvain St-Germain * Copyright 1999 Thuy Nguyen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include +#include #include #include #include -#include -#include -#include - -#include - -#if 1 - -/* From wingdi16.h of WINE */ - -typedef HANDLE HMETAFILE16; - -typedef struct -{ - INT16 mm; - INT16 xExt; - INT16 yExt; - HMETAFILE16 hMF; -} METAFILEPICT16, *LPMETAFILEPICT16; - +#ifdef __REACTOS__ +#include #endif +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#include "winnls.h" +#ifdef __REACTOS__ +#include "wingdi.h" +#endif +#include "winuser.h" +#include "wine/unicode.h" +#include "wine/debug.h" + +#include "storage32.h" +#include "ole2.h" /* For Write/ReadClassStm */ + +#include "winreg.h" +#ifndef __REACTOS__ +#include "wine/wingdi16.h" +#endif + +WINE_DEFAULT_DEBUG_CHANNEL(storage); + +#define FILE_BEGIN 0 + /* Used for OleConvertIStorageToOLESTREAM and OleConvertOLESTREAMToIStorage */ #define OLESTREAM_ID 0x501 @@ -45,7 +67,7 @@ static const char rootPropertyName[] = "Root Entry"; /* OLESTREAM memory structure to use for Get and Put Routines */ /* Used for OleConvertIStorageToOLESTREAM and OleConvertOLESTREAMToIStorage */ -typedef struct +typedef struct { DWORD dwOleID; DWORD dwTypeID; @@ -83,7 +105,7 @@ typedef struct BYTE byUnknown1[28]; DWORD dwExtentX; DWORD dwExtentY; - DWORD dwSize; + DWORD dwSize; BYTE *pData; }OLECONVERT_ISTORAGE_OLEPRES; @@ -108,7 +130,7 @@ static HRESULT findPlaceholder( ULONG storagePropertyIndex, INT typeOfRelation); -static HRESULT adjustPropertyChain( +static HRESULT adjustPropertyChain( StorageImpl *This, StgProperty propertyToDelete, StgProperty parentProperty, @@ -135,7 +157,7 @@ static LONG propertyNameCmp( /*********************************************************************** * Declaration of miscellaneous functions... */ -static HRESULT validateSTGM(DWORD stgmValue); +static HRESULT validateSTGM(DWORD stgmValue); static DWORD GetShareModeFromSTGM(DWORD stgm); static DWORD GetAccessModeFromSTGM(DWORD stgm); @@ -164,7 +186,7 @@ static ICOM_VTABLE(IStorage) Storage32Impl_Vtbl = StorageImpl_SetElementTimes, StorageBaseImpl_SetClass, StorageImpl_SetStateBits, - StorageBaseImpl_Stat + StorageImpl_Stat }; /* @@ -221,7 +243,7 @@ static ICOM_VTABLE(IEnumSTATSTG) IEnumSTATSTGImpl_Vtbl = * * This method implements the common QueryInterface for all IStorage32 * implementations contained in this file. - * + * * See Windows documentation for more details on IUnknown methods. */ HRESULT WINAPI StorageBaseImpl_QueryInterface( @@ -235,30 +257,30 @@ HRESULT WINAPI StorageBaseImpl_QueryInterface( */ if ( (This==0) || (ppvObject==0) ) return E_INVALIDARG; - + /* * Initialize the return parameter. */ *ppvObject = 0; - + /* * Compare the riid with the interface IDs implemented by this object. */ - if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) + if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) { *ppvObject = (IStorage*)This; } - else if (memcmp(&IID_IStorage, riid, sizeof(IID_IStorage)) == 0) + else if (memcmp(&IID_IStorage, riid, sizeof(IID_IStorage)) == 0) { *ppvObject = (IStorage*)This; } - + /* * Check that we obtained an interface. */ if ((*ppvObject)==0) return E_NOINTERFACE; - + /* * Query Interface always increases the reference count by one when it is * successful @@ -267,16 +289,16 @@ HRESULT WINAPI StorageBaseImpl_QueryInterface( return S_OK; } - + /************************************************************************ * Storage32BaseImpl_AddRef (IUnknown) * * This method implements the common AddRef for all IStorage32 * implementations contained in this file. - * + * * See Windows documentation for more details on IUnknown methods. */ -ULONG WINAPI StorageBaseImpl_AddRef( +ULONG WINAPI StorageBaseImpl_AddRef( IStorage* iface) { ICOM_THIS(StorageBaseImpl,iface); @@ -284,16 +306,16 @@ ULONG WINAPI StorageBaseImpl_AddRef( return This->ref; } - + /************************************************************************ * Storage32BaseImpl_Release (IUnknown) * * This method implements the common Release for all IStorage32 * implementations contained in this file. - * + * * See Windows documentation for more details on IUnknown methods. */ -ULONG WINAPI StorageBaseImpl_Release( +ULONG WINAPI StorageBaseImpl_Release( IStorage* iface) { ICOM_THIS(StorageBaseImpl,iface); @@ -308,15 +330,15 @@ ULONG WINAPI StorageBaseImpl_Release( if (This->ref==0) { /* - * Since we are using a system of base-classes, we want to call the - * destructor of the appropriate derived class. To do this, we are + * Since we are using a system of base-classes, we want to call the + * destructor of the appropriate derived class. To do this, we are * using virtual functions to implement the destructor. */ This->v_destructor(This); return 0; } - + return This->ref; } @@ -327,39 +349,46 @@ ULONG WINAPI StorageBaseImpl_Release( * * See Windows documentation for more details on IStorage methods. */ -HRESULT WINAPI StorageBaseImpl_OpenStream( +HRESULT WINAPI StorageBaseImpl_OpenStream( IStorage* iface, const OLECHAR* pwcsName, /* [string][in] */ void* reserved1, /* [unique][in] */ - DWORD grfMode, /* [in] */ - DWORD reserved2, /* [in] */ - IStream** ppstm) /* [out] */ + DWORD grfMode, /* [in] */ + DWORD reserved2, /* [in] */ + IStream** ppstm) /* [out] */ { ICOM_THIS(StorageBaseImpl,iface); IEnumSTATSTGImpl* propertyEnumeration; StgStreamImpl* newStream; StgProperty currentProperty; ULONG foundPropertyIndex; + HRESULT res = STG_E_UNKNOWN; - Print(MAX_TRACE, ("(%p, %S, %p, %lx, %ld, %p)\n", - iface, pwcsName, reserved1, grfMode, reserved2, ppstm)); + TRACE("(%p, %s, %p, %lx, %ld, %p)\n", + iface, debugstr_w(pwcsName), reserved1, grfMode, reserved2, ppstm); /* * Perform a sanity check on the parameters. */ if ( (pwcsName==NULL) || (ppstm==0) ) - return E_INVALIDARG; - + { + res = E_INVALIDARG; + goto end; + } + /* * Initialize the out parameter */ - *ppstm = 0; - + *ppstm = NULL; + /* * Validate the STGM flags */ if ( FAILED( validateSTGM(grfMode) )) - return STG_E_INVALIDFLAG; + { + res = STG_E_INVALIDFLAG; + goto end; + } /* * As documented. @@ -367,15 +396,18 @@ HRESULT WINAPI StorageBaseImpl_OpenStream( if ( !(grfMode & STGM_SHARE_EXCLUSIVE) || (grfMode & STGM_DELETEONRELEASE) || (grfMode & STGM_TRANSACTED) ) - return STG_E_INVALIDFUNCTION; + { + res = STG_E_INVALIDFUNCTION; + goto end; + } /* * Create a property enumeration to search the properties */ propertyEnumeration = IEnumSTATSTGImpl_Construct( - This->ancestorStorage, + This->ancestorStorage, This->rootPropertySetIndex); - + /* * Search the enumeration for the property with the given name */ @@ -383,98 +415,123 @@ HRESULT WINAPI StorageBaseImpl_OpenStream( propertyEnumeration, pwcsName, ¤tProperty); - + /* * Delete the property enumeration since we don't need it anymore */ IEnumSTATSTGImpl_Destroy(propertyEnumeration); - + /* * If it was found, construct the stream object and return a pointer to it. */ - if ( (foundPropertyIndex!=PROPERTY_NULL) && + if ( (foundPropertyIndex!=PROPERTY_NULL) && (currentProperty.propertyType==PROPTYPE_STREAM) ) { newStream = StgStreamImpl_Construct(This, grfMode, foundPropertyIndex); - + if (newStream!=0) { newStream->grfMode = grfMode; *ppstm = (IStream*)newStream; /* - * Since we are returning a pointer to the interface, we have to + * Since we are returning a pointer to the interface, we have to * nail down the reference. */ StgStreamImpl_AddRef(*ppstm); - - return S_OK; + + res = S_OK; + goto end; } - - return E_OUTOFMEMORY; + + res = E_OUTOFMEMORY; + goto end; } - - return STG_E_FILENOTFOUND; + + res = STG_E_FILENOTFOUND; + +end: + if (res == S_OK) + TRACE("<-- IStream %p\n", *ppstm); + TRACE("<-- %08lx\n", res); + return res; } /************************************************************************ * Storage32BaseImpl_OpenStorage (IStorage) * * This method will open a new storage object from the current storage. - * + * * See Windows documentation for more details on IStorage methods. - */ -HRESULT WINAPI StorageBaseImpl_OpenStorage( + */ +HRESULT WINAPI StorageBaseImpl_OpenStorage( IStorage* iface, - const OLECHAR* pwcsName, /* [string][unique][in] */ - IStorage* pstgPriority, /* [unique][in] */ - DWORD grfMode, /* [in] */ - SNB snbExclude, /* [unique][in] */ - DWORD reserved, /* [in] */ - IStorage** ppstg) /* [out] */ + const OLECHAR* pwcsName, /* [string][unique][in] */ + IStorage* pstgPriority, /* [unique][in] */ + DWORD grfMode, /* [in] */ + SNB snbExclude, /* [unique][in] */ + DWORD reserved, /* [in] */ + IStorage** ppstg) /* [out] */ { ICOM_THIS(StorageBaseImpl,iface); StorageInternalImpl* newStorage; IEnumSTATSTGImpl* propertyEnumeration; StgProperty currentProperty; ULONG foundPropertyIndex; + HRESULT res = STG_E_UNKNOWN; + + TRACE("(%p, %s, %p, %lx, %p, %ld, %p)\n", + iface, debugstr_w(pwcsName), pstgPriority, + grfMode, snbExclude, reserved, ppstg); - Print(MAX_TRACE, ("(%p, %S, %p, %lx, %p, %ld, %p)\n", - iface, pwcsName, pstgPriority, - grfMode, snbExclude, reserved, ppstg)); - /* * Perform a sanity check on the parameters. */ if ( (This==0) || (pwcsName==NULL) || (ppstg==0) ) - return E_INVALIDARG; - + { + res = E_INVALIDARG; + goto end; + } + + /* as documented */ + if (snbExclude != NULL) + { + res = STG_E_INVALIDPARAMETER; + goto end; + } + /* * Validate the STGM flags */ if ( FAILED( validateSTGM(grfMode) )) - return STG_E_INVALIDFLAG; + { + res = STG_E_INVALIDFLAG; + goto end; + } /* * As documented. */ - if ( !(grfMode & STGM_SHARE_EXCLUSIVE) || + if ( !(grfMode & STGM_SHARE_EXCLUSIVE) || (grfMode & STGM_DELETEONRELEASE) || (grfMode & STGM_PRIORITY) ) - return STG_E_INVALIDFUNCTION; + { + res = STG_E_INVALIDFUNCTION; + goto end; + } /* * Initialize the out parameter */ - *ppstg = 0; - + *ppstg = NULL; + /* * Create a property enumeration to search the properties */ propertyEnumeration = IEnumSTATSTGImpl_Construct( - This->ancestorStorage, + This->ancestorStorage, This->rootPropertySetIndex); - + /* * Search the enumeration for the property with the given name */ @@ -482,16 +539,16 @@ HRESULT WINAPI StorageBaseImpl_OpenStorage( propertyEnumeration, pwcsName, ¤tProperty); - + /* * Delete the property enumeration since we don't need it anymore */ IEnumSTATSTGImpl_Destroy(propertyEnumeration); - + /* * If it was found, construct the stream object and return a pointer to it. */ - if ( (foundPropertyIndex!=PROPERTY_NULL) && + if ( (foundPropertyIndex!=PROPERTY_NULL) && (currentProperty.propertyType==PROPTYPE_STORAGE) ) { /* @@ -500,53 +557,59 @@ HRESULT WINAPI StorageBaseImpl_OpenStorage( newStorage = StorageInternalImpl_Construct( This->ancestorStorage, foundPropertyIndex); - + if (newStorage != 0) { *ppstg = (IStorage*)newStorage; /* - * Since we are returning a pointer to the interface, + * Since we are returning a pointer to the interface, * we have to nail down the reference. */ StorageBaseImpl_AddRef(*ppstg); - - return S_OK; + + res = S_OK; + goto end; } - - return STG_E_INSUFFICIENTMEMORY; + + res = STG_E_INSUFFICIENTMEMORY; + goto end; } - - return STG_E_FILENOTFOUND; + + res = STG_E_FILENOTFOUND; + +end: + TRACE("<-- %08lx\n", res); + return res; } /************************************************************************ * Storage32BaseImpl_EnumElements (IStorage) * - * This method will create an enumerator object that can be used to + * This method will create an enumerator object that can be used to * retrieve informatino about all the properties in the storage object. - * + * * See Windows documentation for more details on IStorage methods. - */ -HRESULT WINAPI StorageBaseImpl_EnumElements( + */ +HRESULT WINAPI StorageBaseImpl_EnumElements( IStorage* iface, - DWORD reserved1, /* [in] */ - void* reserved2, /* [size_is][unique][in] */ - DWORD reserved3, /* [in] */ - IEnumSTATSTG** ppenum) /* [out] */ + DWORD reserved1, /* [in] */ + void* reserved2, /* [size_is][unique][in] */ + DWORD reserved3, /* [in] */ + IEnumSTATSTG** ppenum) /* [out] */ { ICOM_THIS(StorageBaseImpl,iface); IEnumSTATSTGImpl* newEnum; - Print(MAX_TRACE, ("(%p, %ld, %p, %ld, %p)\n", - iface, reserved1, reserved2, reserved3, ppenum)); + TRACE("(%p, %ld, %p, %ld, %p)\n", + iface, reserved1, reserved2, reserved3, ppenum); /* * Perform a sanity check on the parameters. */ if ( (This==0) || (ppenum==0)) return E_INVALIDARG; - + /* * Construct the enumerator. */ @@ -563,7 +626,7 @@ HRESULT WINAPI StorageBaseImpl_EnumElements( * returning it. */ IEnumSTATSTGImpl_AddRef(*ppenum); - + return S_OK; } @@ -574,26 +637,30 @@ HRESULT WINAPI StorageBaseImpl_EnumElements( * Storage32BaseImpl_Stat (IStorage) * * This method will retrieve information about this storage object. - * + * * See Windows documentation for more details on IStorage methods. - */ -HRESULT WINAPI StorageBaseImpl_Stat( + */ +HRESULT WINAPI StorageBaseImpl_Stat( IStorage* iface, - STATSTG* pstatstg, /* [out] */ - DWORD grfStatFlag) /* [in] */ + STATSTG* pstatstg, /* [out] */ + DWORD grfStatFlag) /* [in] */ { ICOM_THIS(StorageBaseImpl,iface); StgProperty curProperty; - BOOL readSuccessful; + BOOL readSuccessful; + HRESULT res = STG_E_UNKNOWN; - Print(MAX_TRACE, ("(%p, %p, %lx)\n", - iface, pstatstg, grfStatFlag)); + TRACE("(%p, %p, %lx)\n", + iface, pstatstg, grfStatFlag); /* * Perform a sanity check on the parameters. */ if ( (This==0) || (pstatstg==0)) - return E_INVALIDARG; + { + res = E_INVALIDARG; + goto end; + } /* * Read the information from the property. @@ -606,25 +673,34 @@ HRESULT WINAPI StorageBaseImpl_Stat( if (readSuccessful) { StorageUtl_CopyPropertyToSTATSTG( - pstatstg, - &curProperty, + pstatstg, + &curProperty, grfStatFlag); - - return S_OK; + + res = S_OK; + goto end; } - - return E_FAIL; + + res = E_FAIL; + +end: + if (res == S_OK) + { + TRACE("<-- STATSTG: pwcsName: %s, type: %ld, cbSize.Low/High: %ld/%ld, grfMode: %08lx, grfLocksSupported: %ld, grfStateBits: %08lx\n", debugstr_w(pstatstg->pwcsName), pstatstg->type, pstatstg->cbSize.u.LowPart, pstatstg->cbSize.u.HighPart, pstatstg->grfMode, pstatstg->grfLocksSupported, pstatstg->grfStateBits); + } + TRACE("<-- %08lx\n", res); + return res; } /************************************************************************ * Storage32BaseImpl_RenameElement (IStorage) * - * This method will rename the specified element. + * This method will rename the specified element. * * See Windows documentation for more details on IStorage methods. - * - * Implementation notes: The method used to rename consists of creating a clone - * of the deleted StgProperty object setting it with the new name and to + * + * Implementation notes: The method used to rename consists of creating a clone + * of the deleted StgProperty object setting it with the new name and to * perform a DestroyElement of the old StgProperty. */ HRESULT WINAPI StorageBaseImpl_RenameElement( @@ -637,8 +713,8 @@ HRESULT WINAPI StorageBaseImpl_RenameElement( StgProperty currentProperty; ULONG foundPropertyIndex; - Print(MAX_TRACE, ("(%p, %S, %S)\n", - iface, pwcsOldName, pwcsNewName)); + TRACE("(%p, %s, %s)\n", + iface, debugstr_w(pwcsOldName), debugstr_w(pwcsNewName)); /* * Create a property enumeration to search the properties @@ -684,65 +760,65 @@ HRESULT WINAPI StorageBaseImpl_RenameElement( /* * Setup a new property for the renamed property */ - renamedProperty.sizeOfNameString = + renamedProperty.sizeOfNameString = ( lstrlenW(pwcsNewName)+1 ) * sizeof(WCHAR); - + if (renamedProperty.sizeOfNameString > PROPERTY_NAME_BUFFER_LEN) return STG_E_INVALIDNAME; - - lstrcpyW(renamedProperty.name, pwcsNewName); - + + strcpyW(renamedProperty.name, pwcsNewName); + renamedProperty.propertyType = currentProperty.propertyType; renamedProperty.startingBlock = currentProperty.startingBlock; renamedProperty.size.u.LowPart = currentProperty.size.u.LowPart; renamedProperty.size.u.HighPart = currentProperty.size.u.HighPart; - + renamedProperty.previousProperty = PROPERTY_NULL; renamedProperty.nextProperty = PROPERTY_NULL; - + /* * Bring the dirProperty link in case it is a storage and in which * case the renamed storage elements don't require to be reorganized. */ renamedProperty.dirProperty = currentProperty.dirProperty; - - /* call CoFileTime to get the current time + + /* call CoFileTime to get the current time renamedProperty.timeStampS1 renamedProperty.timeStampD1 renamedProperty.timeStampS2 renamedProperty.timeStampD2 - renamedProperty.propertyUniqueID + renamedProperty.propertyUniqueID */ - - /* + + /* * Obtain a free property in the property chain */ renamedPropertyIndex = getFreeProperty(This->ancestorStorage); - + /* * Save the new property into the new property spot - */ + */ StorageImpl_WriteProperty( This->ancestorStorage, - renamedPropertyIndex, + renamedPropertyIndex, &renamedProperty); - - /* + + /* * Find a spot in the property chain for our newly created property. */ updatePropertyChain( (StorageImpl*)This, - renamedPropertyIndex, + renamedPropertyIndex, renamedProperty); /* - * At this point the renamed property has been inserted in the tree, - * now, before to Destroy the old property we must zeroed it's dirProperty - * otherwise the DestroyProperty below will zap it all and we do not want + * At this point the renamed property has been inserted in the tree, + * now, before to Destroy the old property we must zeroed it's dirProperty + * otherwise the DestroyProperty below will zap it all and we do not want * this to happen. * Also, we fake that the old property is a storage so the DestroyProperty * will not do a SetSize(0) on the stream data. - * + * * This means that we need to tweek the StgProperty if it is a stream or a * non empty storage. */ @@ -754,14 +830,14 @@ HRESULT WINAPI StorageBaseImpl_RenameElement( currentProperty.propertyType = PROPTYPE_STORAGE; StorageImpl_WriteProperty( This->ancestorStorage, - foundPropertyIndex, + foundPropertyIndex, ¤tProperty); - /* - * Invoke Destroy to get rid of the ole property and automatically redo - * the linking of it's previous and next members... - */ - StorageImpl_DestroyElement((IStorage*)This->ancestorStorage, pwcsOldName); + /* + * Invoke Destroy to get rid of the ole property and automatically redo + * the linking of it's previous and next members... + */ + StorageImpl_DestroyElement((IStorage*)This->ancestorStorage, pwcsOldName); } else @@ -778,7 +854,7 @@ HRESULT WINAPI StorageBaseImpl_RenameElement( /************************************************************************ * Storage32BaseImpl_CreateStream (IStorage) * - * This method will create a stream object within this storage + * This method will create a stream object within this storage * * See Windows documentation for more details on IStorage methods. */ @@ -796,9 +872,9 @@ HRESULT WINAPI StorageBaseImpl_CreateStream( StgProperty currentProperty, newStreamProperty; ULONG foundPropertyIndex, newPropertyIndex; - Print(MAX_TRACE, ("(%p, %S, %lx, %ld, %ld, %p)\n", - iface, pwcsName, grfMode, - reserved1, reserved2, ppstm)); + TRACE("(%p, %s, %lx, %ld, %ld, %p)\n", + iface, debugstr_w(pwcsName), grfMode, + reserved1, reserved2, ppstm); /* * Validate parameters @@ -843,18 +919,18 @@ HRESULT WINAPI StorageBaseImpl_CreateStream( if (foundPropertyIndex != PROPERTY_NULL) { /* - * An element with this name already exists + * An element with this name already exists */ if (grfMode & STGM_CREATE) { - IStorage_DestroyElement(iface, pwcsName); + IStorage_DestroyElement(iface, pwcsName); } - else + else return STG_E_FILEALREADYEXISTS; } - /* - * memset the empty property + /* + * memset the empty property */ memset(&newStreamProperty, 0, sizeof(StgProperty)); @@ -864,7 +940,7 @@ HRESULT WINAPI StorageBaseImpl_CreateStream( if (newStreamProperty.sizeOfNameString > PROPERTY_NAME_BUFFER_LEN) return STG_E_INVALIDNAME; - lstrcpyW(newStreamProperty.name, pwcsName); + strcpyW(newStreamProperty.name, pwcsName); newStreamProperty.propertyType = PROPTYPE_STREAM; newStreamProperty.startingBlock = BLOCK_END_OF_CHAIN; @@ -875,7 +951,7 @@ HRESULT WINAPI StorageBaseImpl_CreateStream( newStreamProperty.nextProperty = PROPERTY_NULL; newStreamProperty.dirProperty = PROPERTY_NULL; - /* call CoFileTime to get the current time + /* call CoFileTime to get the current time newStreamProperty.timeStampS1 newStreamProperty.timeStampD1 newStreamProperty.timeStampS2 @@ -885,27 +961,27 @@ HRESULT WINAPI StorageBaseImpl_CreateStream( /* newStreamProperty.propertyUniqueID */ /* - * Get a free property or create a new one + * Get a free property or create a new one */ newPropertyIndex = getFreeProperty(This->ancestorStorage); /* * Save the new property into the new property spot - */ + */ StorageImpl_WriteProperty( This->ancestorStorage, - newPropertyIndex, + newPropertyIndex, &newStreamProperty); - /* + /* * Find a spot in the property chain for our newly created property. */ updatePropertyChain( (StorageImpl*)This, - newPropertyIndex, + newPropertyIndex, newStreamProperty); - /* + /* * Open the stream to return it. */ newStream = StgStreamImpl_Construct(This, grfMode, newPropertyIndex); @@ -931,7 +1007,7 @@ HRESULT WINAPI StorageBaseImpl_CreateStream( /************************************************************************ * Storage32BaseImpl_SetClass (IStorage) * - * This method will write the specified CLSID in the property of this + * This method will write the specified CLSID in the property of this * storage. * * See Windows documentation for more details on IStorage methods. @@ -945,8 +1021,8 @@ HRESULT WINAPI StorageBaseImpl_SetClass( StgProperty curProperty; BOOL success; - Print(MAX_TRACE, ("(%p, %p)\n", iface, clsid)); - + TRACE("(%p, %p)\n", iface, clsid); + success = StorageImpl_ReadProperty(This->ancestorStorage, This->rootPropertySetIndex, &curProperty); @@ -967,7 +1043,7 @@ HRESULT WINAPI StorageBaseImpl_SetClass( /************************************************************************ ** Storage32Impl implementation */ - + /************************************************************************ * Storage32Impl_CreateStorage (IStorage) * @@ -975,13 +1051,13 @@ HRESULT WINAPI StorageBaseImpl_SetClass( * * See Windows documentation for more details on IStorage methods. */ -HRESULT WINAPI StorageImpl_CreateStorage( +HRESULT WINAPI StorageImpl_CreateStorage( IStorage* iface, - const OLECHAR *pwcsName, /* [string][in] */ - DWORD grfMode, /* [in] */ - DWORD reserved1, /* [in] */ - DWORD reserved2, /* [in] */ - IStorage **ppstg) /* [out] */ + const OLECHAR *pwcsName, /* [string][in] */ + DWORD grfMode, /* [in] */ + DWORD reserved1, /* [in] */ + DWORD reserved2, /* [in] */ + IStorage **ppstg) /* [out] */ { StorageImpl* const This=(StorageImpl*)iface; @@ -992,10 +1068,10 @@ HRESULT WINAPI StorageImpl_CreateStorage( ULONG newPropertyIndex; HRESULT hr; - Print(MAX_TRACE, ("(%p, %S, %lx, %ld, %ld, %p)\n", - iface, pwcsName, grfMode, - reserved1, reserved2, ppstg)); - + TRACE("(%p, %s, %lx, %ld, %ld, %p)\n", + iface, debugstr_w(pwcsName), grfMode, + reserved1, reserved2, ppstg); + /* * Validate parameters */ @@ -1031,16 +1107,16 @@ HRESULT WINAPI StorageImpl_CreateStorage( if (foundPropertyIndex != PROPERTY_NULL) { /* - * An element with this name already exists + * An element with this name already exists */ if (grfMode & STGM_CREATE) - IStorage_DestroyElement(iface, pwcsName); - else + IStorage_DestroyElement(iface, pwcsName); + else return STG_E_FILEALREADYEXISTS; } - /* - * memset the empty property + /* + * memset the empty property */ memset(&newProperty, 0, sizeof(StgProperty)); @@ -1049,7 +1125,7 @@ HRESULT WINAPI StorageImpl_CreateStorage( if (newProperty.sizeOfNameString > PROPERTY_NAME_BUFFER_LEN) return STG_E_INVALIDNAME; - lstrcpyW(newProperty.name, pwcsName); + strcpyW(newProperty.name, pwcsName); newProperty.propertyType = PROPTYPE_STORAGE; newProperty.startingBlock = BLOCK_END_OF_CHAIN; @@ -1060,7 +1136,7 @@ HRESULT WINAPI StorageImpl_CreateStorage( newProperty.nextProperty = PROPERTY_NULL; newProperty.dirProperty = PROPERTY_NULL; - /* call CoFileTime to get the current time + /* call CoFileTime to get the current time newProperty.timeStampS1 newProperty.timeStampD1 newProperty.timeStampS2 @@ -1069,28 +1145,28 @@ HRESULT WINAPI StorageImpl_CreateStorage( /* newStorageProperty.propertyUniqueID */ - /* + /* * Obtain a free property in the property chain */ newPropertyIndex = getFreeProperty(This->ancestorStorage); /* * Save the new property into the new property spot - */ + */ StorageImpl_WriteProperty( This->ancestorStorage, - newPropertyIndex, + newPropertyIndex, &newProperty); - /* + /* * Find a spot in the property chain for our newly created property. */ updatePropertyChain( This, - newPropertyIndex, + newPropertyIndex, newProperty); - /* + /* * Open it to get a pointer to return. */ hr = IStorage_OpenStorage( @@ -1107,7 +1183,7 @@ HRESULT WINAPI StorageImpl_CreateStorage( return hr; } - + return S_OK; } @@ -1138,7 +1214,7 @@ static ULONG getFreeProperty( { if (currentProperty.sizeOfNameString == 0) { - /* + /* * The property existis and is available, we found it. */ newPropertyIndex = currentPropertyIndex; @@ -1155,8 +1231,8 @@ static ULONG getFreeProperty( } while (newPropertyIndex == PROPERTY_NULL); - /* - * grow the property chain + /* + * grow the property chain */ if (! readSuccessful) { @@ -1166,34 +1242,34 @@ static ULONG getFreeProperty( ULONG lastProperty = 0; ULONG blockCount = 0; - /* - * obtain the new count of property blocks + /* + * obtain the new count of property blocks */ blockCount = BlockChainStream_GetCount( storage->ancestorStorage->rootBlockChain)+1; - /* - * initialize the size used by the property stream + /* + * initialize the size used by the property stream */ newSize.u.HighPart = 0; newSize.u.LowPart = storage->bigBlockSize * blockCount; - /* - * add a property block to the property chain + /* + * add a property block to the property chain */ BlockChainStream_SetSize(storage->ancestorStorage->rootBlockChain, newSize); - /* - * memset the empty property in order to initialize the unused newly + /* + * memset the empty property in order to initialize the unused newly * created property */ memset(&emptyProperty, 0, sizeof(StgProperty)); - /* + /* * initialize them */ - lastProperty = storage->bigBlockSize / PROPSET_BLOCK_SIZE * blockCount; - + lastProperty = storage->bigBlockSize / PROPSET_BLOCK_SIZE * blockCount; + for( propertyIndex = newPropertyIndex; propertyIndex < lastProperty; @@ -1201,7 +1277,7 @@ static ULONG getFreeProperty( { StorageImpl_WriteProperty( storage->ancestorStorage, - propertyIndex, + propertyIndex, &emptyProperty); } } @@ -1213,7 +1289,7 @@ static ULONG getFreeProperty( * * Internal Method * - * Case insensitive comparaison of StgProperty.name by first considering + * Case insensitive comparaison of StgProperty.name by first considering * their size. * * Returns <0 when newPrpoerty < currentProperty @@ -1226,15 +1302,15 @@ static LONG propertyNameCmp( { LONG diff = lstrlenW(newProperty) - lstrlenW(currentProperty); - if (diff == 0) + if (diff == 0) { - /* - * We compare the string themselves only when they are of the same lenght + /* + * We compare the string themselves only when they are of the same length */ diff = lstrcmpiW( newProperty, currentProperty); } - return diff; + return diff; } /**************************************************************************** @@ -1246,7 +1322,7 @@ static LONG propertyNameCmp( static void updatePropertyChain( StorageImpl *storage, ULONG newPropertyIndex, - StgProperty newProperty) + StgProperty newProperty) { StgProperty currentProperty; @@ -1259,7 +1335,7 @@ static void updatePropertyChain( if (currentProperty.dirProperty != PROPERTY_NULL) { - /* + /* * The root storage contains some element, therefore, start the research * for the appropriate location. */ @@ -1272,7 +1348,7 @@ static void updatePropertyChain( currentPropertyId = currentProperty.dirProperty; /* - * Read + * Read */ StorageImpl_ReadProperty(storage->ancestorStorage, currentProperty.dirProperty, @@ -1285,7 +1361,7 @@ static void updatePropertyChain( while (found == 0) { LONG diff = propertyNameCmp( newProperty.name, currentProperty.name); - + if (diff < 0) { if (previous != PROPERTY_NULL) @@ -1337,7 +1413,7 @@ static void updatePropertyChain( } else { - /* + /* * The root storage is empty, link the new property to it's dir property */ currentProperty.dirProperty = newPropertyIndex; @@ -1347,16 +1423,16 @@ static void updatePropertyChain( } } - + /************************************************************************* * CopyTo (IStorage) */ -HRESULT WINAPI StorageImpl_CopyTo( +HRESULT WINAPI StorageImpl_CopyTo( IStorage* iface, - DWORD ciidExclude, /* [in] */ - const IID* rgiidExclude, /* [size_is][unique][in] */ - SNB snbExclude, /* [unique][in] */ - IStorage* pstgDest) /* [unique][in] */ + DWORD ciidExclude, /* [in] */ + const IID* rgiidExclude, /* [size_is][unique][in] */ + SNB snbExclude, /* [unique][in] */ + IStorage* pstgDest) /* [unique][in] */ { IEnumSTATSTG *elements = 0; STATSTG curElement, strStat; @@ -1365,11 +1441,11 @@ HRESULT WINAPI StorageImpl_CopyTo( IStream *pstrTmp, *pstrChild; if ((ciidExclude != 0) || (rgiidExclude != NULL) || (snbExclude != NULL)) - UNIMPLEMENTED; + FIXME("Exclude option not implemented\n"); - Print(MAX_TRACE, ("(%p, %ld, %p, %p, %p)\n", - iface, ciidExclude, rgiidExclude, - snbExclude, pstgDest)); + TRACE("(%p, %ld, %p, %p, %p)\n", + iface, ciidExclude, rgiidExclude, + snbExclude, pstgDest); /* * Perform a sanity check @@ -1377,7 +1453,7 @@ HRESULT WINAPI StorageImpl_CopyTo( if ( pstgDest == 0 ) return STG_E_INVALIDPOINTER; - /* + /* * Enumerate the elements */ hr = IStorage_EnumElements( iface, 0, 0, 0, &elements ); @@ -1390,7 +1466,7 @@ HRESULT WINAPI StorageImpl_CopyTo( */ IStorage_Stat( iface, &curElement, STATFLAG_NONAME); IStorage_SetClass( pstgDest, &curElement.clsid ); - + do { /* @@ -1426,7 +1502,7 @@ HRESULT WINAPI StorageImpl_CopyTo( return STG_E_ACCESSDENIED; } - + /* * create a new storage in destination storage */ @@ -1443,17 +1519,17 @@ HRESULT WINAPI StorageImpl_CopyTo( STGM_WRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &pstgTmp ); } - + if (hr != S_OK) break; - + /* * do the copy recursively */ hr = IStorage_CopyTo( pstgChild, ciidExclude, rgiidExclude, snbExclude, pstgTmp ); - + IStorage_Release( pstgTmp ); IStorage_Release( pstgChild ); } @@ -1489,19 +1565,19 @@ HRESULT WINAPI StorageImpl_CopyTo( * Set the size of the destination stream. */ IStream_SetSize(pstrTmp, strStat.cbSize); - + /* * do the copy */ hr = IStream_CopyTo( pstrChild, pstrTmp, strStat.cbSize, NULL, NULL ); - + IStream_Release( pstrTmp ); IStream_Release( pstrChild ); } else { - Print(MIN_TRACE, ("unknown element type: %ld\n", curElement.type)); + WARN("unknown element type: %ld\n", curElement.type); } } while (hr == S_OK); @@ -1510,59 +1586,59 @@ HRESULT WINAPI StorageImpl_CopyTo( * Clean-up */ IEnumSTATSTG_Release(elements); - + return hr; } - + /************************************************************************* * MoveElementTo (IStorage) */ -HRESULT WINAPI StorageImpl_MoveElementTo( +HRESULT WINAPI StorageImpl_MoveElementTo( IStorage* iface, - const OLECHAR *pwcsName, /* [string][in] */ - IStorage *pstgDest, /* [unique][in] */ - const OLECHAR *pwcsNewName,/* [string][in] */ - DWORD grfFlags) /* [in] */ + const OLECHAR *pwcsName, /* [string][in] */ + IStorage *pstgDest, /* [unique][in] */ + const OLECHAR *pwcsNewName,/* [string][in] */ + DWORD grfFlags) /* [in] */ { - UNIMPLEMENTED; + FIXME("not implemented!\n"); return E_NOTIMPL; } - + /************************************************************************* * Commit (IStorage) */ -HRESULT WINAPI StorageImpl_Commit( +HRESULT WINAPI StorageImpl_Commit( IStorage* iface, - DWORD grfCommitFlags)/* [in] */ + DWORD grfCommitFlags)/* [in] */ { - UNIMPLEMENTED; + FIXME("(%ld): stub!\n", grfCommitFlags); return S_OK; } - + /************************************************************************* * Revert (IStorage) */ -HRESULT WINAPI StorageImpl_Revert( +HRESULT WINAPI StorageImpl_Revert( IStorage* iface) { - UNIMPLEMENTED; + FIXME("not implemented!\n"); return E_NOTIMPL; } /************************************************************************* * DestroyElement (IStorage) * - * Stategy: This implementation is build this way for simplicity not for speed. + * Stategy: This implementation is build this way for simplicity not for speed. * I always delete the top most element of the enumeration and adjust - * the deleted element pointer all the time. This takes longer to - * do but allow to reinvoke DestroyElement whenever we encounter a + * the deleted element pointer all the time. This takes longer to + * do but allow to reinvoke DestroyElement whenever we encounter a * storage object. The optimisation reside in the usage of another - * enumeration stategy that would give all the leaves of a storage + * enumeration stategy that would give all the leaves of a storage * first. (postfix order) */ -HRESULT WINAPI StorageImpl_DestroyElement( +HRESULT WINAPI StorageImpl_DestroyElement( IStorage* iface, - const OLECHAR *pwcsName)/* [string][in] */ + const OLECHAR *pwcsName)/* [string][in] */ { StorageImpl* const This=(StorageImpl*)iface; @@ -1575,22 +1651,22 @@ HRESULT WINAPI StorageImpl_DestroyElement( ULONG typeOfRelation; ULONG parentPropertyId; - Print(MAX_TRACE, ("(%p, %S)\n", - iface, pwcsName)); + TRACE("(%p, %s)\n", + iface, debugstr_w(pwcsName)); /* * Perform a sanity check on the parameters. */ - if (pwcsName==NULL) + if (pwcsName==NULL) return STG_E_INVALIDPOINTER; - + /* * Create a property enumeration to search the property with the given name */ propertyEnumeration = IEnumSTATSTGImpl_Construct( - This->ancestorStorage, + This->ancestorStorage, This->rootPropertySetIndex); - + foundPropertyIndexToDelete = IEnumSTATSTGImpl_FindProperty( propertyEnumeration, pwcsName, @@ -1598,51 +1674,51 @@ HRESULT WINAPI StorageImpl_DestroyElement( IEnumSTATSTGImpl_Destroy(propertyEnumeration); - if ( foundPropertyIndexToDelete == PROPERTY_NULL ) + if ( foundPropertyIndexToDelete == PROPERTY_NULL ) { return STG_E_FILENOTFOUND; } - /* - * Find the parent property of the property to delete (the one that - * link to it). If This->dirProperty == foundPropertyIndexToDelete, + /* + * Find the parent property of the property to delete (the one that + * link to it). If This->dirProperty == foundPropertyIndexToDelete, * the parent is This. Otherwise, the parent is one of it's sibling... */ - /* + /* * First, read This's StgProperty.. */ - res = StorageImpl_ReadProperty( + res = StorageImpl_ReadProperty( This->ancestorStorage, This->rootPropertySetIndex, &parentProperty); assert(res==TRUE); - /* + /* * Second, check to see if by any chance the actual storage (This) is not * the parent of the property to delete... We never know... */ if ( parentProperty.dirProperty == foundPropertyIndexToDelete ) { - /* + /* * Set data as it would have been done in the else part... */ typeOfRelation = PROPERTY_RELATION_DIR; parentPropertyId = This->rootPropertySetIndex; } - else - { + else + { /* - * Create a property enumeration to search the parent properties, and + * Create a property enumeration to search the parent properties, and * delete it once done. */ IEnumSTATSTGImpl* propertyEnumeration2; propertyEnumeration2 = IEnumSTATSTGImpl_Construct( - This->ancestorStorage, + This->ancestorStorage, This->rootPropertySetIndex); - + typeOfRelation = IEnumSTATSTGImpl_FindParentProperty( propertyEnumeration2, foundPropertyIndexToDelete, @@ -1652,22 +1728,22 @@ HRESULT WINAPI StorageImpl_DestroyElement( IEnumSTATSTGImpl_Destroy(propertyEnumeration2); } - if ( propertyToDelete.propertyType == PROPTYPE_STORAGE ) + if ( propertyToDelete.propertyType == PROPTYPE_STORAGE ) { hr = deleteStorageProperty( - This, + This, foundPropertyIndexToDelete, propertyToDelete); - } + } else if ( propertyToDelete.propertyType == PROPTYPE_STREAM ) { hr = deleteStreamProperty( - This, + This, foundPropertyIndexToDelete, propertyToDelete); } - if (hr!=S_OK) + if (hr!=S_OK) return hr; /* @@ -1675,7 +1751,7 @@ HRESULT WINAPI StorageImpl_DestroyElement( */ hr = adjustPropertyChain( This, - propertyToDelete, + propertyToDelete, parentProperty, parentPropertyId, typeOfRelation); @@ -1684,6 +1760,32 @@ HRESULT WINAPI StorageImpl_DestroyElement( } +/************************************************************************ + * StorageImpl_Stat (IStorage) + * + * This method will retrieve information about this storage object. + * + * See Windows documentation for more details on IStorage methods. + */ +HRESULT WINAPI StorageImpl_Stat( IStorage* iface, + STATSTG* pstatstg, /* [out] */ + DWORD grfStatFlag) /* [in] */ +{ + StorageImpl* const This = (StorageImpl*)iface; + HRESULT result = StorageBaseImpl_Stat( iface, pstatstg, grfStatFlag ); + + if ( !FAILED(result) && ((grfStatFlag & STATFLAG_NONAME) == 0) && This->pwcsName ) + { + CoTaskMemFree(pstatstg->pwcsName); + pstatstg->pwcsName = CoTaskMemAlloc((lstrlenW(This->pwcsName)+1)*sizeof(WCHAR)); + strcpyW(pstatstg->pwcsName, This->pwcsName); + } + + return result; +} + + + /********************************************************************* * * Internal Method @@ -1719,7 +1821,7 @@ static HRESULT deleteStorageProperty( return hr; } - /* + /* * Enumerate the elements */ IStorage_EnumElements( childStorage, 0, 0, 0, &elements); @@ -1733,7 +1835,7 @@ static HRESULT deleteStorageProperty( if (hr==S_OK) { destroyHr = StorageImpl_DestroyElement( - (IStorage*)childStorage, + (IStorage*)childStorage, (OLECHAR*)currentElement.pwcsName); CoTaskMemFree(currentElement.pwcsName); @@ -1758,7 +1860,7 @@ static HRESULT deleteStorageProperty( IStorage_Release(childStorage); IEnumSTATSTG_Release(elements); - + return destroyHr; } @@ -1788,16 +1890,16 @@ static HRESULT deleteStreamProperty( STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, &pis); - + if (hr!=S_OK) { return(hr); } - /* - * Zap the stream - */ - hr = IStream_SetSize(pis, size); + /* + * Zap the stream + */ + hr = IStream_SetSize(pis, size); if(hr != S_OK) { @@ -1809,17 +1911,17 @@ static HRESULT deleteStreamProperty( */ IStream_Release(pis); - /* + /* * Invalidate the property by zeroing it's name member. */ propertyToDelete.sizeOfNameString = 0; - /* + /* * Here we should re-read the property so we get the updated pointer * but since we are here to zap it, I don't do it... */ StorageImpl_WriteProperty( - parentStorage->ancestorStorage, + parentStorage->ancestorStorage, indexOfPropertyToDelete, &propertyToDelete); @@ -1848,7 +1950,7 @@ static HRESULT findPlaceholder( */ res = StorageImpl_ReadProperty( storage->ancestorStorage, - storePropertyIndex, + storePropertyIndex, &storeProperty); if(! res) @@ -1862,7 +1964,7 @@ static HRESULT findPlaceholder( { return findPlaceholder( storage, - propertyIndexToStore, + propertyIndexToStore, storeProperty.previousProperty, typeOfRelation); } @@ -1877,7 +1979,7 @@ static HRESULT findPlaceholder( { return findPlaceholder( storage, - propertyIndexToStore, + propertyIndexToStore, storeProperty.nextProperty, typeOfRelation); } @@ -1885,14 +1987,14 @@ static HRESULT findPlaceholder( { storeProperty.nextProperty = propertyIndexToStore; } - } + } else if (typeOfRelation == PROPERTY_RELATION_DIR) { if (storeProperty.dirProperty != PROPERTY_NULL) { return findPlaceholder( storage, - propertyIndexToStore, + propertyIndexToStore, storeProperty.dirProperty, typeOfRelation); } @@ -1904,7 +2006,7 @@ static HRESULT findPlaceholder( hr = StorageImpl_WriteProperty( storage->ancestorStorage, - storePropertyIndex, + storePropertyIndex, &storeProperty); if(! hr) @@ -1919,10 +2021,10 @@ static HRESULT findPlaceholder( * * Internal Method * - * This method takes the previous and the next property link of a property + * This method takes the previous and the next property link of a property * to be deleted and find them a place in the Storage. */ -static HRESULT adjustPropertyChain( +static HRESULT adjustPropertyChain( StorageImpl *This, StgProperty propertyToDelete, StgProperty parentProperty, @@ -1936,116 +2038,116 @@ static HRESULT adjustPropertyChain( INT relationType = 0; HRESULT hr = S_OK; BOOL res = TRUE; - - if (typeOfRelation == PROPERTY_RELATION_PREVIOUS) + + if (typeOfRelation == PROPERTY_RELATION_PREVIOUS) { - if (propertyToDelete.previousProperty != PROPERTY_NULL) + if (propertyToDelete.previousProperty != PROPERTY_NULL) { - /* + /* * Set the parent previous to the property to delete previous */ newLinkProperty = propertyToDelete.previousProperty; - if (propertyToDelete.nextProperty != PROPERTY_NULL) + if (propertyToDelete.nextProperty != PROPERTY_NULL) { /* - * We also need to find a storage for the other link, setup variables + * We also need to find a storage for the other link, setup variables * to do this at the end... - */ + */ needToFindAPlaceholder = TRUE; storeNode = propertyToDelete.previousProperty; toStoreNode = propertyToDelete.nextProperty; relationType = PROPERTY_RELATION_NEXT; } - } - else if (propertyToDelete.nextProperty != PROPERTY_NULL) + } + else if (propertyToDelete.nextProperty != PROPERTY_NULL) { - /* + /* * Set the parent previous to the property to delete next */ newLinkProperty = propertyToDelete.nextProperty; } - - /* + + /* * Link it for real... - */ + */ parentProperty.previousProperty = newLinkProperty; - - } - else if (typeOfRelation == PROPERTY_RELATION_NEXT) + + } + else if (typeOfRelation == PROPERTY_RELATION_NEXT) { - if (propertyToDelete.previousProperty != PROPERTY_NULL) + if (propertyToDelete.previousProperty != PROPERTY_NULL) { - /* + /* * Set the parent next to the property to delete next previous */ newLinkProperty = propertyToDelete.previousProperty; - - if (propertyToDelete.nextProperty != PROPERTY_NULL) + + if (propertyToDelete.nextProperty != PROPERTY_NULL) { /* - * We also need to find a storage for the other link, setup variables + * We also need to find a storage for the other link, setup variables * to do this at the end... - */ + */ needToFindAPlaceholder = TRUE; storeNode = propertyToDelete.previousProperty; toStoreNode = propertyToDelete.nextProperty; relationType = PROPERTY_RELATION_NEXT; } - } - else if (propertyToDelete.nextProperty != PROPERTY_NULL) + } + else if (propertyToDelete.nextProperty != PROPERTY_NULL) { - /* + /* * Set the parent next to the property to delete next */ newLinkProperty = propertyToDelete.nextProperty; } - /* + /* * Link it for real... - */ + */ parentProperty.nextProperty = newLinkProperty; - } + } else /* (typeOfRelation == PROPERTY_RELATION_DIR) */ { - if (propertyToDelete.previousProperty != PROPERTY_NULL) + if (propertyToDelete.previousProperty != PROPERTY_NULL) { - /* + /* * Set the parent dir to the property to delete previous */ newLinkProperty = propertyToDelete.previousProperty; - if (propertyToDelete.nextProperty != PROPERTY_NULL) + if (propertyToDelete.nextProperty != PROPERTY_NULL) { /* - * We also need to find a storage for the other link, setup variables + * We also need to find a storage for the other link, setup variables * to do this at the end... - */ + */ needToFindAPlaceholder = TRUE; storeNode = propertyToDelete.previousProperty; toStoreNode = propertyToDelete.nextProperty; relationType = PROPERTY_RELATION_NEXT; } - } - else if (propertyToDelete.nextProperty != PROPERTY_NULL) + } + else if (propertyToDelete.nextProperty != PROPERTY_NULL) { - /* + /* * Set the parent dir to the property to delete next */ newLinkProperty = propertyToDelete.nextProperty; } - /* + /* * Link it for real... - */ + */ parentProperty.dirProperty = newLinkProperty; } - /* - * Write back the parent property + /* + * Write back the parent property */ res = StorageImpl_WriteProperty( - This->ancestorStorage, + This->ancestorStorage, parentPropertyId, &parentProperty); if(! res) @@ -2054,14 +2156,14 @@ static HRESULT adjustPropertyChain( } /* - * If a placeholder is required for the other link, then, find one and + * If a placeholder is required for the other link, then, find one and * get out of here... */ - if (needToFindAPlaceholder) + if (needToFindAPlaceholder) { hr = findPlaceholder( - This, - toStoreNode, + This, + toStoreNode, storeNode, relationType); } @@ -2073,32 +2175,33 @@ static HRESULT adjustPropertyChain( /****************************************************************************** * SetElementTimes (IStorage) */ -HRESULT WINAPI StorageImpl_SetElementTimes( +HRESULT WINAPI StorageImpl_SetElementTimes( IStorage* iface, - const OLECHAR *pwcsName,/* [string][in] */ - const FILETIME *pctime, /* [in] */ - const FILETIME *patime, /* [in] */ - const FILETIME *pmtime) /* [in] */ + const OLECHAR *pwcsName,/* [string][in] */ + const FILETIME *pctime, /* [in] */ + const FILETIME *patime, /* [in] */ + const FILETIME *pmtime) /* [in] */ { - UNIMPLEMENTED; - return E_NOTIMPL; + FIXME("(%s,...), stub!\n",debugstr_w(pwcsName)); + return S_OK; } /****************************************************************************** * SetStateBits (IStorage) */ -HRESULT WINAPI StorageImpl_SetStateBits( +HRESULT WINAPI StorageImpl_SetStateBits( IStorage* iface, - DWORD grfStateBits,/* [in] */ - DWORD grfMask) /* [in] */ + DWORD grfStateBits,/* [in] */ + DWORD grfMask) /* [in] */ { - UNIMPLEMENTED; + FIXME("not implemented!\n"); return E_NOTIMPL; } HRESULT StorageImpl_Construct( StorageImpl* This, HANDLE hFile, + LPCOLESTR pwcsName, ILockBytes* pLkbyt, DWORD openFlags, BOOL fileBased, @@ -2108,29 +2211,40 @@ HRESULT StorageImpl_Construct( StgProperty currentProperty; BOOL readSuccessful; ULONG currentPropertyIndex; - + if ( FAILED( validateSTGM(openFlags) )) return STG_E_INVALIDFLAG; memset(This, 0, sizeof(StorageImpl)); - + /* - * Initialize the virtual fgunction table. + * Initialize the virtual function table. */ - ICOM_VTBL(This) = &Storage32Impl_Vtbl; + This->lpVtbl = &Storage32Impl_Vtbl; This->v_destructor = &StorageImpl_Destroy; - + /* - * This is the top-level storage so initialize the ancester pointer + * This is the top-level storage so initialize the ancestor pointer * to this. */ This->ancestorStorage = This; - + /* * Initialize the physical support of the storage. */ This->hFile = hFile; - + + /* + * Store copy of file path. + */ + if(pwcsName) { + This->pwcsName = HeapAlloc(GetProcessHeap(), 0, + (lstrlenW(pwcsName)+1)*sizeof(WCHAR)); + if (!This->pwcsName) + return STG_E_INSUFFICIENTMEMORY; + strcpyW(This->pwcsName, pwcsName); + } + /* * Initialize the big block cache. */ @@ -2144,7 +2258,7 @@ HRESULT StorageImpl_Construct( if (This->bigBlockFile == 0) return E_FAIL; - + if (fileCreate) { ULARGE_INTEGER size; @@ -2156,8 +2270,8 @@ HRESULT StorageImpl_Construct( * - The properties start at block 1 * - There is no small block depot */ - memset( This->bigBlockDepotStart, - BLOCK_UNUSED, + memset( This->bigBlockDepotStart, + BLOCK_UNUSED, sizeof(This->bigBlockDepotStart)); This->bigBlockDepotCount = 1; @@ -2211,20 +2325,21 @@ HRESULT StorageImpl_Construct( * Start searching for free blocks with block 0. */ This->prevFreeBlock = 0; - + /* * Create the block chain abstractions. */ - This->rootBlockChain = - BlockChainStream_Construct(This, &This->rootStartBlock, PROPERTY_NULL); + if(!(This->rootBlockChain = + BlockChainStream_Construct(This, &This->rootStartBlock, PROPERTY_NULL))) + return STG_E_READFAULT; - This->smallBlockDepotChain = BlockChainStream_Construct( - This, - &This->smallBlockDepotStart, - PROPERTY_NULL); + if(!(This->smallBlockDepotChain = + BlockChainStream_Construct(This, &This->smallBlockDepotStart, + PROPERTY_NULL))) + return STG_E_READFAULT; /* - * Write the root property + * Write the root property */ if (fileCreate) { @@ -2235,7 +2350,7 @@ HRESULT StorageImpl_Construct( memset(&rootProp, 0, sizeof(rootProp)); MultiByteToWideChar( CP_ACP, 0, rootPropertyName, -1, rootProp.name, sizeof(rootProp.name)/sizeof(WCHAR) ); - rootProp.sizeOfNameString = (lstrlenW(rootProp.name)+1) * sizeof(WCHAR); + rootProp.sizeOfNameString = (strlenW(rootProp.name)+1) * sizeof(WCHAR); rootProp.propertyType = PROPTYPE_ROOT; rootProp.previousProperty = PROPERTY_NULL; rootProp.nextProperty = PROPERTY_NULL; @@ -2248,17 +2363,17 @@ HRESULT StorageImpl_Construct( } /* - * Find the ID of the root int he property sets. + * Find the ID of the root in the property sets. */ currentPropertyIndex = 0; - + do { readSuccessful = StorageImpl_ReadProperty( - This, - currentPropertyIndex, + This, + currentPropertyIndex, ¤tProperty); - + if (readSuccessful) { if ( (currentProperty.sizeOfNameString != 0 ) && @@ -2269,30 +2384,32 @@ HRESULT StorageImpl_Construct( } currentPropertyIndex++; - + } while (readSuccessful && (This->rootPropertySetIndex == PROPERTY_NULL) ); - + if (!readSuccessful) { /* TODO CLEANUP */ - return E_FAIL; + return STG_E_READFAULT; } /* * Create the block chain abstraction for the small block root chain. */ - This->smallBlockRootChain = BlockChainStream_Construct( - This, - NULL, - This->rootPropertySetIndex); - + if(!(This->smallBlockRootChain = + BlockChainStream_Construct(This, NULL, This->rootPropertySetIndex))) + return STG_E_READFAULT; + return hr; } void StorageImpl_Destroy( StorageImpl* This) { - Print(MAX_TRACE, ("(%p)\n", This)); + TRACE("(%p)\n", This); + + if(This->pwcsName) + HeapFree(GetProcessHeap(), 0, This->pwcsName); BlockChainStream_Destroy(This->smallBlockRootChain); BlockChainStream_Destroy(This->rootBlockChain); @@ -2622,6 +2739,7 @@ void StorageImpl_FreeBigBlock( * Params: This - Pointer to the Storage object. * blockIndex - Index of the block to retrieve the chain * for. + * nextBlockIndex - receives the return value. * * Returns: This method returns the index of the next block in the chain. * It will return the constants: @@ -2636,18 +2754,26 @@ void StorageImpl_FreeBigBlock( * * See Windows documentation for more details on IStorage methods. */ -ULONG StorageImpl_GetNextBlockInChain( +HRESULT StorageImpl_GetNextBlockInChain( StorageImpl* This, - ULONG blockIndex) + ULONG blockIndex, + ULONG* nextBlockIndex) { ULONG offsetInDepot = blockIndex * sizeof (ULONG); ULONG depotBlockCount = offsetInDepot / This->bigBlockSize; ULONG depotBlockOffset = offsetInDepot % This->bigBlockSize; - ULONG nextBlockIndex = BLOCK_SPECIAL; void* depotBuffer; ULONG depotBlockIndexPos; + int index; - assert(depotBlockCount < This->bigBlockDepotCount); + *nextBlockIndex = BLOCK_SPECIAL; + + if(depotBlockCount >= This->bigBlockDepotCount) + { + WARN("depotBlockCount %ld, bigBlockDepotCount %ld\n", depotBlockCount, + This->bigBlockDepotCount); + return STG_E_READFAULT; + } /* * Cache the currently accessed depot block. @@ -2670,23 +2796,20 @@ ULONG StorageImpl_GetNextBlockInChain( depotBuffer = StorageImpl_GetROBigBlock(This, depotBlockIndexPos); - if (depotBuffer!=0) + if (!depotBuffer) + return STG_E_READFAULT; + + for (index = 0; index < NUM_BLOCKS_PER_DEPOT_BLOCK; index++) { - int index; - - for (index = 0; index < NUM_BLOCKS_PER_DEPOT_BLOCK; index++) - { - StorageUtl_ReadDWord(depotBuffer, index*sizeof(ULONG), &nextBlockIndex); - This->blockDepotCached[index] = nextBlockIndex; - } - - StorageImpl_ReleaseBigBlock(This, depotBuffer); + StorageUtl_ReadDWord(depotBuffer, index*sizeof(ULONG), nextBlockIndex); + This->blockDepotCached[index] = *nextBlockIndex; } + StorageImpl_ReleaseBigBlock(This, depotBuffer); } - nextBlockIndex = This->blockDepotCached[depotBlockOffset/sizeof(ULONG)]; + *nextBlockIndex = This->blockDepotCached[depotBlockOffset/sizeof(ULONG)]; - return nextBlockIndex; + return S_OK; } /****************************************************************************** @@ -2818,48 +2941,48 @@ HRESULT StorageImpl_LoadFileHeader( } StorageUtl_ReadWord( - headerBigBlock, - OFFSET_BIGBLOCKSIZEBITS, + headerBigBlock, + OFFSET_BIGBLOCKSIZEBITS, &This->bigBlockSizeBits); StorageUtl_ReadWord( - headerBigBlock, - OFFSET_SMALLBLOCKSIZEBITS, + headerBigBlock, + OFFSET_SMALLBLOCKSIZEBITS, &This->smallBlockSizeBits); StorageUtl_ReadDWord( - headerBigBlock, - OFFSET_BBDEPOTCOUNT, + headerBigBlock, + OFFSET_BBDEPOTCOUNT, &This->bigBlockDepotCount); StorageUtl_ReadDWord( - headerBigBlock, - OFFSET_ROOTSTARTBLOCK, + headerBigBlock, + OFFSET_ROOTSTARTBLOCK, &This->rootStartBlock); StorageUtl_ReadDWord( - headerBigBlock, - OFFSET_SBDEPOTSTART, + headerBigBlock, + OFFSET_SBDEPOTSTART, &This->smallBlockDepotStart); - StorageUtl_ReadDWord( - headerBigBlock, - OFFSET_EXTBBDEPOTSTART, + StorageUtl_ReadDWord( + headerBigBlock, + OFFSET_EXTBBDEPOTSTART, &This->extBigBlockDepotStart); StorageUtl_ReadDWord( - headerBigBlock, - OFFSET_EXTBBDEPOTCOUNT, + headerBigBlock, + OFFSET_EXTBBDEPOTCOUNT, &This->extBigBlockDepotCount); - + for (index = 0; index < COUNT_BBDEPOTINHEADER; index ++) { StorageUtl_ReadDWord( - headerBigBlock, + headerBigBlock, OFFSET_BBDEPOTSTART + (sizeof(ULONG)*index), &(This->bigBlockDepotStart[index])); } - + /* * Make the bitwise arithmetic to get the size of the blocks in bytes. */ @@ -2873,22 +2996,26 @@ HRESULT StorageImpl_LoadFileHeader( This->bigBlockSize = 0x000000001 >> (DWORD)This->bigBlockSizeBits; This->smallBlockSize = 0x000000001 >> (DWORD)This->smallBlockSizeBits; } - + /* - * Right now, the code is making some assumptions about the size of the + * Right now, the code is making some assumptions about the size of the * blocks, just make sure they are what we're expecting. */ - assert( (This->bigBlockSize==DEF_BIG_BLOCK_SIZE) && - (This->smallBlockSize==DEF_SMALL_BLOCK_SIZE)); - + if (This->bigBlockSize != DEF_BIG_BLOCK_SIZE || + This->smallBlockSize != DEF_SMALL_BLOCK_SIZE) + { + WARN("Broken OLE storage file\n"); + hr = STG_E_INVALIDHEADER; + } + else + hr = S_OK; + /* * Release the block. */ StorageImpl_ReleaseBigBlock(This, headerBigBlock); - - hr = S_OK; } - + return hr; } @@ -2908,7 +3035,7 @@ void StorageImpl_SaveFileHeader( * Get a pointer to the big block of data containing the header. */ success = StorageImpl_ReadBigBlock(This, -1, headerBigBlock); - + /* * If the block read failed, the file is probably new. */ @@ -2918,12 +3045,12 @@ void StorageImpl_SaveFileHeader( * Initialize for all unknown fields. */ memset(headerBigBlock, 0, BIG_BLOCK_SIZE); - + /* * Initialize the magic number. */ memcpy(headerBigBlock, STORAGE_magic, sizeof(STORAGE_magic)); - + /* * And a bunch of things we don't know what they mean */ @@ -2931,58 +3058,60 @@ void StorageImpl_SaveFileHeader( StorageUtl_WriteWord(headerBigBlock, 0x1a, 0x3); StorageUtl_WriteWord(headerBigBlock, 0x1c, (WORD)-2); StorageUtl_WriteDWord(headerBigBlock, 0x38, (DWORD)0x1000); - StorageUtl_WriteDWord(headerBigBlock, 0x40, (DWORD)0x0001); } - + /* * Write the information to the header. */ - if (headerBigBlock!=0) + StorageUtl_WriteWord( + headerBigBlock, + OFFSET_BIGBLOCKSIZEBITS, + This->bigBlockSizeBits); + + StorageUtl_WriteWord( + headerBigBlock, + OFFSET_SMALLBLOCKSIZEBITS, + This->smallBlockSizeBits); + + StorageUtl_WriteDWord( + headerBigBlock, + OFFSET_BBDEPOTCOUNT, + This->bigBlockDepotCount); + + StorageUtl_WriteDWord( + headerBigBlock, + OFFSET_ROOTSTARTBLOCK, + This->rootStartBlock); + + StorageUtl_WriteDWord( + headerBigBlock, + OFFSET_SBDEPOTSTART, + This->smallBlockDepotStart); + + StorageUtl_WriteDWord( + headerBigBlock, + OFFSET_SBDEPOTCOUNT, + This->smallBlockDepotChain ? + BlockChainStream_GetCount(This->smallBlockDepotChain) : 0); + + StorageUtl_WriteDWord( + headerBigBlock, + OFFSET_EXTBBDEPOTSTART, + This->extBigBlockDepotStart); + + StorageUtl_WriteDWord( + headerBigBlock, + OFFSET_EXTBBDEPOTCOUNT, + This->extBigBlockDepotCount); + + for (index = 0; index < COUNT_BBDEPOTINHEADER; index ++) { - StorageUtl_WriteWord( - headerBigBlock, - OFFSET_BIGBLOCKSIZEBITS, - This->bigBlockSizeBits); - - StorageUtl_WriteWord( - headerBigBlock, - OFFSET_SMALLBLOCKSIZEBITS, - This->smallBlockSizeBits); - StorageUtl_WriteDWord( - headerBigBlock, - OFFSET_BBDEPOTCOUNT, - This->bigBlockDepotCount); - - StorageUtl_WriteDWord( - headerBigBlock, - OFFSET_ROOTSTARTBLOCK, - This->rootStartBlock); - - StorageUtl_WriteDWord( - headerBigBlock, - OFFSET_SBDEPOTSTART, - This->smallBlockDepotStart); - - StorageUtl_WriteDWord( - headerBigBlock, - OFFSET_EXTBBDEPOTSTART, - This->extBigBlockDepotStart); - - StorageUtl_WriteDWord( - headerBigBlock, - OFFSET_EXTBBDEPOTCOUNT, - This->extBigBlockDepotCount); - - for (index = 0; index < COUNT_BBDEPOTINHEADER; index ++) - { - StorageUtl_WriteDWord( - headerBigBlock, - OFFSET_BBDEPOTSTART + (sizeof(ULONG)*index), - (This->bigBlockDepotStart[index])); - } + headerBigBlock, + OFFSET_BBDEPOTSTART + (sizeof(ULONG)*index), + (This->bigBlockDepotStart[index])); } - + /* * Write the big block back to the file. */ @@ -3006,77 +3135,82 @@ BOOL StorageImpl_ReadProperty( offsetInPropSet.u.HighPart = 0; offsetInPropSet.u.LowPart = index * PROPSET_BLOCK_SIZE; - + readSuccessful = BlockChainStream_ReadAt( This->rootBlockChain, offsetInPropSet, PROPSET_BLOCK_SIZE, currentProperty, &bytesRead); - + if (readSuccessful) { + /* replace the name of root entry (often "Root Entry") by the file name */ + WCHAR *propName = (index == This->rootPropertySetIndex) ? + This->filename : (WCHAR *)currentProperty+OFFSET_PS_NAME; + memset(buffer->name, 0, sizeof(buffer->name)); memcpy( - buffer->name, - currentProperty+OFFSET_PS_NAME, + buffer->name, + propName, PROPERTY_NAME_BUFFER_LEN ); + TRACE("storage name: %s\n", debugstr_w(buffer->name)); memcpy(&buffer->propertyType, currentProperty + OFFSET_PS_PROPERTYTYPE, 1); - + StorageUtl_ReadWord( - currentProperty, - OFFSET_PS_NAMELENGTH, + currentProperty, + OFFSET_PS_NAMELENGTH, &buffer->sizeOfNameString); StorageUtl_ReadDWord( - currentProperty, - OFFSET_PS_PREVIOUSPROP, + currentProperty, + OFFSET_PS_PREVIOUSPROP, &buffer->previousProperty); StorageUtl_ReadDWord( - currentProperty, - OFFSET_PS_NEXTPROP, + currentProperty, + OFFSET_PS_NEXTPROP, &buffer->nextProperty); StorageUtl_ReadDWord( - currentProperty, - OFFSET_PS_DIRPROP, + currentProperty, + OFFSET_PS_DIRPROP, &buffer->dirProperty); StorageUtl_ReadGUID( - currentProperty, - OFFSET_PS_GUID, + currentProperty, + OFFSET_PS_GUID, &buffer->propertyUniqueID); StorageUtl_ReadDWord( - currentProperty, - OFFSET_PS_TSS1, + currentProperty, + OFFSET_PS_TSS1, &buffer->timeStampS1); StorageUtl_ReadDWord( - currentProperty, - OFFSET_PS_TSD1, + currentProperty, + OFFSET_PS_TSD1, &buffer->timeStampD1); StorageUtl_ReadDWord( - currentProperty, - OFFSET_PS_TSS2, + currentProperty, + OFFSET_PS_TSS2, &buffer->timeStampS2); StorageUtl_ReadDWord( - currentProperty, - OFFSET_PS_TSD2, + currentProperty, + OFFSET_PS_TSD2, &buffer->timeStampD2); StorageUtl_ReadDWord( - currentProperty, - OFFSET_PS_STARTBLOCK, + currentProperty, + OFFSET_PS_STARTBLOCK, &buffer->startingBlock); StorageUtl_ReadDWord( - currentProperty, - OFFSET_PS_SIZE, + currentProperty, + OFFSET_PS_SIZE, &buffer->size.u.LowPart); buffer->size.u.HighPart = 0; @@ -3104,65 +3238,65 @@ BOOL StorageImpl_WriteProperty( memset(currentProperty, 0, PROPSET_BLOCK_SIZE); memcpy( - currentProperty + OFFSET_PS_NAME, - buffer->name, + currentProperty + OFFSET_PS_NAME, + buffer->name, PROPERTY_NAME_BUFFER_LEN ); memcpy(currentProperty + OFFSET_PS_PROPERTYTYPE, &buffer->propertyType, 1); StorageUtl_WriteWord( - currentProperty, - OFFSET_PS_NAMELENGTH, + currentProperty, + OFFSET_PS_NAMELENGTH, buffer->sizeOfNameString); StorageUtl_WriteDWord( - currentProperty, - OFFSET_PS_PREVIOUSPROP, + currentProperty, + OFFSET_PS_PREVIOUSPROP, buffer->previousProperty); StorageUtl_WriteDWord( - currentProperty, - OFFSET_PS_NEXTPROP, + currentProperty, + OFFSET_PS_NEXTPROP, buffer->nextProperty); StorageUtl_WriteDWord( - currentProperty, - OFFSET_PS_DIRPROP, + currentProperty, + OFFSET_PS_DIRPROP, buffer->dirProperty); StorageUtl_WriteGUID( - currentProperty, - OFFSET_PS_GUID, + currentProperty, + OFFSET_PS_GUID, &buffer->propertyUniqueID); StorageUtl_WriteDWord( - currentProperty, - OFFSET_PS_TSS1, + currentProperty, + OFFSET_PS_TSS1, buffer->timeStampS1); StorageUtl_WriteDWord( - currentProperty, - OFFSET_PS_TSD1, + currentProperty, + OFFSET_PS_TSD1, buffer->timeStampD1); StorageUtl_WriteDWord( - currentProperty, - OFFSET_PS_TSS2, + currentProperty, + OFFSET_PS_TSS2, buffer->timeStampS2); StorageUtl_WriteDWord( - currentProperty, - OFFSET_PS_TSD2, + currentProperty, + OFFSET_PS_TSD2, buffer->timeStampD2); StorageUtl_WriteDWord( - currentProperty, - OFFSET_PS_STARTBLOCK, + currentProperty, + OFFSET_PS_STARTBLOCK, buffer->startingBlock); StorageUtl_WriteDWord( - currentProperty, - OFFSET_PS_SIZE, + currentProperty, + OFFSET_PS_SIZE, buffer->size.u.LowPart); writeSuccessful = BlockChainStream_WriteAt(This->rootBlockChain, @@ -3208,10 +3342,10 @@ BOOL StorageImpl_WriteBigBlock( memcpy(bigBlockBuffer, buffer, This->bigBlockSize); StorageImpl_ReleaseBigBlock(This, bigBlockBuffer); - + return TRUE; } - + return FALSE; } @@ -3264,7 +3398,7 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks( bbTempChain = BlockChainStream_Construct(This, &bbHeadOfChain, PROPERTY_NULL); - + if(!bbTempChain) return NULL; /* * Grow the big block chain. */ @@ -3341,7 +3475,7 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks( */ StorageInternalImpl* StorageInternalImpl_Construct( - StorageImpl* ancestorStorage, + StorageImpl* ancestorStorage, ULONG rootPropertyIndex) { StorageInternalImpl* newStorage; @@ -3358,7 +3492,7 @@ StorageInternalImpl* StorageInternalImpl_Construct( /* * Initialize the virtual function table. */ - ICOM_VTBL(newStorage) = &Storage32InternalImpl_Vtbl; + newStorage->lpVtbl = &Storage32InternalImpl_Vtbl; newStorage->v_destructor = &StorageInternalImpl_Destroy; /* @@ -3392,13 +3526,13 @@ void StorageInternalImpl_Destroy( ** The non-root storages cannot be opened in transacted mode thus this function ** does nothing. */ -HRESULT WINAPI StorageInternalImpl_Commit( +HRESULT WINAPI StorageInternalImpl_Commit( IStorage* iface, - DWORD grfCommitFlags) /* [in] */ + DWORD grfCommitFlags) /* [in] */ { return S_OK; } - + /****************************************************************************** ** ** Storage32InternalImpl_Revert @@ -3406,7 +3540,7 @@ HRESULT WINAPI StorageInternalImpl_Commit( ** The non-root storages cannot be opened in transacted mode thus this function ** does nothing. */ -HRESULT WINAPI StorageInternalImpl_Revert( +HRESULT WINAPI StorageInternalImpl_Revert( IStorage* iface) { return S_OK; @@ -3423,38 +3557,38 @@ IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct( IEnumSTATSTGImpl* newEnumeration; newEnumeration = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumSTATSTGImpl)); - + if (newEnumeration!=0) { /* * Set-up the virtual function table and reference count. */ - ICOM_VTBL(newEnumeration) = &IEnumSTATSTGImpl_Vtbl; + newEnumeration->lpVtbl = &IEnumSTATSTGImpl_Vtbl; newEnumeration->ref = 0; - + /* * We want to nail-down the reference to the storage in case the * enumeration out-lives the storage in the client application. */ newEnumeration->parentStorage = parentStorage; IStorage_AddRef((IStorage*)newEnumeration->parentStorage); - + newEnumeration->firstPropertyNode = firstPropertyNode; - + /* * Initialize the search stack */ newEnumeration->stackSize = 0; newEnumeration->stackMaxSize = ENUMSTATSGT_SIZE_INCREMENT; - newEnumeration->stackToVisit = + newEnumeration->stackToVisit = HeapAlloc(GetProcessHeap(), 0, sizeof(ULONG)*ENUMSTATSGT_SIZE_INCREMENT); - + /* * Make sure the current node of the iterator is the first one. */ IEnumSTATSTGImpl_Reset((IEnumSTATSTG*)newEnumeration); } - + return newEnumeration; } @@ -3486,11 +3620,11 @@ HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface( /* * Compare the riid with the interface IDs implemented by this object. */ - if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) + if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) { *ppvObject = (IEnumSTATSTG*)This; } - else if (memcmp(&IID_IStorage, riid, sizeof(IID_IEnumSTATSTG)) == 0) + else if (memcmp(&IID_IStorage, riid, sizeof(IID_IEnumSTATSTG)) == 0) { *ppvObject = (IEnumSTATSTG*)This; } @@ -3509,7 +3643,7 @@ HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface( return S_OK; } - + ULONG WINAPI IEnumSTATSTGImpl_AddRef( IEnumSTATSTG* iface) { @@ -3518,7 +3652,7 @@ ULONG WINAPI IEnumSTATSTGImpl_AddRef( This->ref++; return This->ref; } - + ULONG WINAPI IEnumSTATSTGImpl_Release( IEnumSTATSTG* iface) { @@ -3537,7 +3671,7 @@ ULONG WINAPI IEnumSTATSTGImpl_Release( IEnumSTATSTGImpl_Destroy(This); } - return newRef;; + return newRef; } HRESULT WINAPI IEnumSTATSTGImpl_Next( @@ -3557,15 +3691,15 @@ HRESULT WINAPI IEnumSTATSTGImpl_Next( * Perform a sanity check on the parameters. */ if ( (rgelt==0) || ( (celt!=1) && (pceltFetched==0) ) ) - return E_INVALIDARG; - + return E_INVALIDARG; + /* * To avoid the special case, get another pointer to a ULONG value if * the caller didn't supply one. */ if (pceltFetched==0) pceltFetched = &objectFetched; - + /* * Start the iteration, we will iterate until we hit the end of the * linked list or until we hit the number of items to iterate through @@ -3577,10 +3711,10 @@ HRESULT WINAPI IEnumSTATSTGImpl_Next( */ currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE); - while ( ( *pceltFetched < celt) && + while ( ( *pceltFetched < celt) && ( currentSearchNode!=PROPERTY_NULL) ) { - /* + /* * Remove the top node from the stack */ IEnumSTATSTGImpl_PopSearchNode(This, TRUE); @@ -3589,7 +3723,7 @@ HRESULT WINAPI IEnumSTATSTGImpl_Next( * Read the property from the storage. */ StorageImpl_ReadProperty(This->parentStorage, - currentSearchNode, + currentSearchNode, ¤tProperty); /* @@ -3598,7 +3732,7 @@ HRESULT WINAPI IEnumSTATSTGImpl_Next( StorageUtl_CopyPropertyToSTATSTG(currentReturnStruct, ¤tProperty, STATFLAG_DEFAULT); - + /* * Step to the next item in the iteration */ @@ -3622,7 +3756,7 @@ HRESULT WINAPI IEnumSTATSTGImpl_Next( return S_FALSE; } - + HRESULT WINAPI IEnumSTATSTGImpl_Skip( IEnumSTATSTG* iface, ULONG celt) @@ -3638,10 +3772,10 @@ HRESULT WINAPI IEnumSTATSTGImpl_Skip( */ currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE); - while ( (objectFetched < celt) && + while ( (objectFetched < celt) && (currentSearchNode!=PROPERTY_NULL) ) { - /* + /* * Remove the top node from the stack */ IEnumSTATSTGImpl_PopSearchNode(This, TRUE); @@ -3650,9 +3784,9 @@ HRESULT WINAPI IEnumSTATSTGImpl_Skip( * Read the property from the storage. */ StorageImpl_ReadProperty(This->parentStorage, - currentSearchNode, + currentSearchNode, ¤tProperty); - + /* * Step to the next item in the iteration */ @@ -3674,7 +3808,7 @@ HRESULT WINAPI IEnumSTATSTGImpl_Skip( return S_FALSE; } - + HRESULT WINAPI IEnumSTATSTGImpl_Reset( IEnumSTATSTG* iface) { @@ -3693,7 +3827,7 @@ HRESULT WINAPI IEnumSTATSTGImpl_Reset( */ readSuccessful = StorageImpl_ReadProperty( This->parentStorage, - This->firstPropertyNode, + This->firstPropertyNode, &rootProperty); if (readSuccessful) @@ -3708,7 +3842,7 @@ HRESULT WINAPI IEnumSTATSTGImpl_Reset( return S_OK; } - + HRESULT WINAPI IEnumSTATSTGImpl_Clone( IEnumSTATSTG* iface, IEnumSTATSTG** ppenum) @@ -3722,23 +3856,23 @@ HRESULT WINAPI IEnumSTATSTGImpl_Clone( */ if (ppenum==0) return E_INVALIDARG; - + newClone = IEnumSTATSTGImpl_Construct(This->parentStorage, This->firstPropertyNode); - + /* * The new clone enumeration must point to the same current node as * the ole one. */ newClone->stackSize = This->stackSize ; newClone->stackMaxSize = This->stackMaxSize ; - newClone->stackToVisit = + newClone->stackToVisit = HeapAlloc(GetProcessHeap(), 0, sizeof(ULONG) * newClone->stackMaxSize); memcpy( - newClone->stackToVisit, - This->stackToVisit, + newClone->stackToVisit, + This->stackToVisit, sizeof(ULONG) * newClone->stackSize); *ppenum = (IEnumSTATSTG*)newClone; @@ -3754,7 +3888,7 @@ HRESULT WINAPI IEnumSTATSTGImpl_Clone( INT IEnumSTATSTGImpl_FindParentProperty( IEnumSTATSTGImpl *This, - ULONG childProperty, + ULONG childProperty, StgProperty *currentProperty, ULONG *thisNodeId) { @@ -3772,7 +3906,7 @@ INT IEnumSTATSTGImpl_FindParentProperty( * Start with the node at the top of the stack. */ currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE); - + while (currentSearchNode!=PROPERTY_NULL) { @@ -3781,7 +3915,7 @@ INT IEnumSTATSTGImpl_FindParentProperty( */ *thisNodeId = currentSearchNode; - /* + /* * Remove the top node from the stack */ IEnumSTATSTGImpl_PopSearchNode(This, TRUE); @@ -3791,18 +3925,18 @@ INT IEnumSTATSTGImpl_FindParentProperty( */ StorageImpl_ReadProperty( This->parentStorage, - currentSearchNode, + currentSearchNode, currentProperty); - + if (currentProperty->previousProperty == childProperty) return PROPERTY_RELATION_PREVIOUS; - else if (currentProperty->nextProperty == childProperty) + else if (currentProperty->nextProperty == childProperty) return PROPERTY_RELATION_NEXT; - + else if (currentProperty->dirProperty == childProperty) return PROPERTY_RELATION_DIR; - + /* * Push the next search node in the search stack. */ @@ -3831,7 +3965,7 @@ ULONG IEnumSTATSTGImpl_FindProperty( while (currentSearchNode!=PROPERTY_NULL) { - /* + /* * Remove the top node from the stack */ IEnumSTATSTGImpl_PopSearchNode(This, TRUE); @@ -3840,11 +3974,11 @@ ULONG IEnumSTATSTGImpl_FindProperty( * Read the property from the storage. */ StorageImpl_ReadProperty(This->parentStorage, - currentSearchNode, + currentSearchNode, currentProperty); if ( propertyNameCmp( - (OLECHAR*)currentProperty->name, + (OLECHAR*)currentProperty->name, (OLECHAR*)lpszPropName) == 0) return currentSearchNode; @@ -3883,7 +4017,7 @@ void IEnumSTATSTGImpl_PushSearchNode( This->stackMaxSize += ENUMSTATSGT_SIZE_INCREMENT; This->stackToVisit = HeapReAlloc( - GetProcessHeap(), + GetProcessHeap(), 0, This->stackToVisit, sizeof(ULONG) * This->stackMaxSize); @@ -3897,7 +4031,7 @@ void IEnumSTATSTGImpl_PushSearchNode( */ readSuccessful = StorageImpl_ReadProperty( This->parentStorage, - nodeToPush, + nodeToPush, &rootProperty); if (readSuccessful) @@ -3984,12 +4118,12 @@ void StorageUtl_CopyPropertyToSTATSTG( } else { - destination->pwcsName = + destination->pwcsName = CoTaskMemAlloc((lstrlenW(source->name)+1)*sizeof(WCHAR)); - lstrcpyW((LPWSTR)destination->pwcsName, source->name); + strcpyW((LPWSTR)destination->pwcsName, source->name); } - + switch (source->propertyType) { case PROPTYPE_STORAGE: @@ -4001,20 +4135,20 @@ void StorageUtl_CopyPropertyToSTATSTG( break; default: destination->type = STGTY_STREAM; - break; + break; } destination->cbSize = source->size; -/* +/* currentReturnStruct->mtime = {0}; TODO currentReturnStruct->ctime = {0}; - currentReturnStruct->atime = {0}; + currentReturnStruct->atime = {0}; */ destination->grfMode = 0; - destination->grfLocksSupported = 0; + destination->grfLocksSupported = 0; destination->clsid = source->propertyUniqueID; - destination->grfStateBits = 0; - destination->reserved = 0; + destination->grfStateBits = 0; + destination->reserved = 0; } /****************************************************************************** @@ -4022,7 +4156,7 @@ void StorageUtl_CopyPropertyToSTATSTG( */ BlockChainStream* BlockChainStream_Construct( - StorageImpl* parentStorage, + StorageImpl* parentStorage, ULONG* headOfStreamPlaceHolder, ULONG propertyIndex) { @@ -4045,9 +4179,14 @@ BlockChainStream* BlockChainStream_Construct( newStream->numBlocks++; newStream->tailIndex = blockIndex; - blockIndex = StorageImpl_GetNextBlockInChain( - parentStorage, - blockIndex); + if(FAILED(StorageImpl_GetNextBlockInChain( + parentStorage, + blockIndex, + &blockIndex))) + { + HeapFree(GetProcessHeap(), 0, newStream); + return NULL; + } } return newStream; @@ -4095,7 +4234,7 @@ ULONG BlockChainStream_GetHeadOfChain(BlockChainStream* This) * * Returns the number of blocks that comprises this chain. * This is not the size of the stream as the last block may not be full! - * + * */ ULONG BlockChainStream_GetCount(BlockChainStream* This) { @@ -4108,16 +4247,18 @@ ULONG BlockChainStream_GetCount(BlockChainStream* This) { count++; - blockIndex = StorageImpl_GetNextBlockInChain( - This->parentStorage, - blockIndex); + if(FAILED(StorageImpl_GetNextBlockInChain( + This->parentStorage, + blockIndex, + &blockIndex))) + return 0; } return count; } /****************************************************************************** - * BlockChainStream_ReadAt + * BlockChainStream_ReadAt * * Reads a specified number of bytes from this chain at the specified offset. * bytesRead may be NULL. @@ -4157,9 +4298,8 @@ BOOL BlockChainStream_ReadAt(BlockChainStream* This, while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) { - blockIndex = - StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); - + if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, &blockIndex))) + return FALSE; blockNoInSequence--; } @@ -4170,30 +4310,30 @@ BOOL BlockChainStream_ReadAt(BlockChainStream* This, */ *bytesRead = 0; bufferWalker = buffer; - + while ( (size > 0) && (blockIndex != BLOCK_END_OF_CHAIN) ) { /* * Calculate how many bytes we can copy from this big block. */ - bytesToReadInBuffer = + bytesToReadInBuffer = min(This->parentStorage->bigBlockSize - offsetInBlock, size); - + /* * Copy those bytes to the buffer */ - bigBlockBuffer = + bigBlockBuffer = StorageImpl_GetROBigBlock(This->parentStorage, blockIndex); - + memcpy(bufferWalker, bigBlockBuffer + offsetInBlock, bytesToReadInBuffer); - + StorageImpl_ReleaseBigBlock(This->parentStorage, bigBlockBuffer); - + /* * Step to the next big block. */ - blockIndex = - StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); + if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, &blockIndex))) + return FALSE; bufferWalker += bytesToReadInBuffer; size -= bytesToReadInBuffer; @@ -4201,7 +4341,7 @@ BOOL BlockChainStream_ReadAt(BlockChainStream* This, offsetInBlock = 0; /* There is no offset on the next block */ } - + return (size == 0); } @@ -4246,9 +4386,9 @@ BOOL BlockChainStream_WriteAt(BlockChainStream* This, while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) { - blockIndex = - StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); - + if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, + &blockIndex))) + return FALSE; blockNoInSequence--; } @@ -4266,30 +4406,30 @@ BOOL BlockChainStream_WriteAt(BlockChainStream* This, /* * Calculate how many bytes we can copy from this big block. */ - bytesToWrite = + bytesToWrite = min(This->parentStorage->bigBlockSize - offsetInBlock, size); - + /* * Copy those bytes to the buffer */ bigBlockBuffer = StorageImpl_GetBigBlock(This->parentStorage, blockIndex); - + memcpy(bigBlockBuffer + offsetInBlock, bufferWalker, bytesToWrite); - + StorageImpl_ReleaseBigBlock(This->parentStorage, bigBlockBuffer); - + /* * Step to the next big block. */ - blockIndex = - StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); - + if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, + &blockIndex))) + return FALSE; bufferWalker += bytesToWrite; size -= bytesToWrite; *bytesWritten += bytesToWrite; offsetInBlock = 0; /* There is no offset on the next block */ } - + return (size == 0); } @@ -4326,20 +4466,21 @@ BOOL BlockChainStream_Shrink(BlockChainStream* This, */ while (count < numBlocks) { - blockIndex = - StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); - + if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, + &blockIndex))) + return FALSE; count++; } /* Get the next block before marking the new end */ - extraBlock = - StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); + if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, + &extraBlock))) + return FALSE; /* Mark the new end of chain */ StorageImpl_SetNextBlockInChain( - This->parentStorage, - blockIndex, + This->parentStorage, + blockIndex, BLOCK_END_OF_CHAIN); This->tailIndex = blockIndex; @@ -4350,9 +4491,9 @@ BOOL BlockChainStream_Shrink(BlockChainStream* This, */ while (extraBlock != BLOCK_END_OF_CHAIN) { - blockIndex = - StorageImpl_GetNextBlockInChain(This->parentStorage, extraBlock); - + if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, extraBlock, + &blockIndex))) + return FALSE; StorageImpl_FreeBigBlock(This->parentStorage, extraBlock); extraBlock = blockIndex; } @@ -4394,14 +4535,14 @@ BOOL BlockChainStream_Enlarge(BlockChainStream* This, assert(This->ownerPropertyIndex != PROPERTY_NULL); StorageImpl_ReadProperty( - This->parentStorage, + This->parentStorage, This->ownerPropertyIndex, &chainProp); - chainProp.startingBlock = blockIndex; + chainProp.startingBlock = blockIndex; StorageImpl_WriteProperty( - This->parentStorage, + This->parentStorage, This->ownerPropertyIndex, &chainProp); } @@ -4430,8 +4571,9 @@ BOOL BlockChainStream_Enlarge(BlockChainStream* This, This->numBlocks++; currentBlock = blockIndex; - blockIndex = - StorageImpl_GetNextBlockInChain(This->parentStorage, currentBlock); + if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, currentBlock, + &blockIndex))) + return FALSE; } This->tailIndex = currentBlock; @@ -4450,13 +4592,13 @@ BOOL BlockChainStream_Enlarge(BlockChainStream* This, blockIndex = StorageImpl_GetNextFreeBigBlock(This->parentStorage); StorageImpl_SetNextBlockInChain( - This->parentStorage, - currentBlock, + This->parentStorage, + currentBlock, blockIndex); StorageImpl_SetNextBlockInChain( - This->parentStorage, - blockIndex, + This->parentStorage, + blockIndex, BLOCK_END_OF_CHAIN); currentBlock = blockIndex; @@ -4478,7 +4620,7 @@ BOOL BlockChainStream_Enlarge(BlockChainStream* This, * * TODO: Free the actual blocks in the file when we shrink the chain. * Currently, the blocks are still in the file. So the file size - * doesn't shrink even if we shrink streams. + * doesn't shrink even if we shrink streams. */ BOOL BlockChainStream_SetSize( BlockChainStream* This, @@ -4495,7 +4637,7 @@ BOOL BlockChainStream_SetSize( } else { - ULARGE_INTEGER fileSize = + ULARGE_INTEGER fileSize = BIGBLOCKFILE_GetSize(This->parentStorage->bigBlockFile); ULONG diff = newSize.u.LowPart - size.u.LowPart; @@ -4504,7 +4646,7 @@ BOOL BlockChainStream_SetSize( * Make sure the file stays a multiple of blocksize */ if ((diff % This->parentStorage->bigBlockSize) != 0) - diff += (This->parentStorage->bigBlockSize - + diff += (This->parentStorage->bigBlockSize - (diff % This->parentStorage->bigBlockSize) ); fileSize.u.LowPart += diff; @@ -4528,8 +4670,8 @@ ULARGE_INTEGER BlockChainStream_GetSize(BlockChainStream* This) if(This->headOfStreamPlaceHolder == NULL) { - /* - * This chain is a data stream read the property and return + /* + * This chain is a data stream read the property and return * the appropriate size */ StorageImpl_ReadProperty( @@ -4542,15 +4684,15 @@ ULARGE_INTEGER BlockChainStream_GetSize(BlockChainStream* This) else { /* - * this chain is a chain that does not have a property, figure out the - * size by making the product number of used blocks times the + * this chain is a chain that does not have a property, figure out the + * size by making the product number of used blocks times the * size of them */ ULARGE_INTEGER result; result.u.HighPart = 0; - result.u.LowPart = - BlockChainStream_GetCount(This) * + result.u.LowPart = + BlockChainStream_GetCount(This) * This->parentStorage->bigBlockSize; return result; @@ -4562,7 +4704,7 @@ ULARGE_INTEGER BlockChainStream_GetSize(BlockChainStream* This) */ SmallBlockChainStream* SmallBlockChainStream_Construct( - StorageImpl* parentStorage, + StorageImpl* parentStorage, ULONG propertyIndex) { SmallBlockChainStream* newStream; @@ -4613,21 +4755,23 @@ ULONG SmallBlockChainStream_GetHeadOfChain( * SmallBlockChainStream_GetNextBlockInChain * * Returns the index of the next small block in this chain. - * + * * Return Values: * - BLOCK_END_OF_CHAIN: end of this chain * - BLOCK_UNUSED: small block 'blockIndex' is free */ -ULONG SmallBlockChainStream_GetNextBlockInChain( +HRESULT SmallBlockChainStream_GetNextBlockInChain( SmallBlockChainStream* This, - ULONG blockIndex) + ULONG blockIndex, + ULONG* nextBlockInChain) { ULARGE_INTEGER offsetOfBlockInDepot; DWORD buffer; - ULONG nextBlockInChain = BLOCK_END_OF_CHAIN; ULONG bytesRead; BOOL success; + *nextBlockInChain = BLOCK_END_OF_CHAIN; + offsetOfBlockInDepot.u.HighPart = 0; offsetOfBlockInDepot.u.LowPart = blockIndex * sizeof(ULONG); @@ -4643,10 +4787,11 @@ ULONG SmallBlockChainStream_GetNextBlockInChain( if (success) { - StorageUtl_ReadDWord(&buffer, 0, &nextBlockInChain); + StorageUtl_ReadDWord(&buffer, 0, nextBlockInChain); + return S_OK; } - return nextBlockInChain; + return STG_E_READFAULT; } /****************************************************************************** @@ -4740,7 +4885,7 @@ ULONG SmallBlockChainStream_GetNextFreeBlock( } else { - ULONG count = + ULONG count = BlockChainStream_GetCount(This->parentStorage->smallBlockDepotChain); ULONG sbdIndex = This->parentStorage->smallBlockDepotStart; @@ -4751,26 +4896,25 @@ ULONG SmallBlockChainStream_GetNextFreeBlock( while (nextBlock != BLOCK_END_OF_CHAIN) { sbdIndex = nextBlock; - nextBlock = - StorageImpl_GetNextBlockInChain(This->parentStorage, sbdIndex); + StorageImpl_GetNextBlockInChain(This->parentStorage, sbdIndex, &nextBlock); } newsbdIndex = StorageImpl_GetNextFreeBigBlock(This->parentStorage); if (sbdIndex != BLOCK_END_OF_CHAIN) StorageImpl_SetNextBlockInChain( - This->parentStorage, - sbdIndex, + This->parentStorage, + sbdIndex, newsbdIndex); StorageImpl_SetNextBlockInChain( - This->parentStorage, - newsbdIndex, + This->parentStorage, + newsbdIndex, BLOCK_END_OF_CHAIN); /* * Initialize all the small blocks to free */ - smallBlockDepot = + smallBlockDepot = StorageImpl_GetBigBlock(This->parentStorage, newsbdIndex); memset(smallBlockDepot, BLOCK_UNUSED, This->parentStorage->bigBlockSize); @@ -4782,7 +4926,7 @@ ULONG SmallBlockChainStream_GetNextFreeBlock( * We have just created the small block depot. */ StgProperty rootProp; - ULONG sbStartIndex; + ULONG sbStartIndex; /* * Save it in the header @@ -4791,19 +4935,19 @@ ULONG SmallBlockChainStream_GetNextFreeBlock( StorageImpl_SaveFileHeader(This->parentStorage); /* - * And allocate the first big block that will contain small blocks + * And allocate the first big block that will contain small blocks */ - sbStartIndex = + sbStartIndex = StorageImpl_GetNextFreeBigBlock(This->parentStorage); StorageImpl_SetNextBlockInChain( - This->parentStorage, - sbStartIndex, + This->parentStorage, + sbStartIndex, BLOCK_END_OF_CHAIN); StorageImpl_ReadProperty( - This->parentStorage, - This->parentStorage->rootPropertySetIndex, + This->parentStorage, + This->parentStorage->rootPropertySetIndex, &rootProp); rootProp.startingBlock = sbStartIndex; @@ -4811,14 +4955,14 @@ ULONG SmallBlockChainStream_GetNextFreeBlock( rootProp.size.u.LowPart = This->parentStorage->bigBlockSize; StorageImpl_WriteProperty( - This->parentStorage, - This->parentStorage->rootPropertySetIndex, + This->parentStorage, + This->parentStorage->rootPropertySetIndex, &rootProp); } } } - smallBlocksPerBigBlock = + smallBlocksPerBigBlock = This->parentStorage->bigBlockSize / This->parentStorage->smallBlockSize; /* @@ -4830,22 +4974,22 @@ ULONG SmallBlockChainStream_GetNextFreeBlock( ULONG blocksRequired = (blockIndex / smallBlocksPerBigBlock) + 1; StorageImpl_ReadProperty( - This->parentStorage, - This->parentStorage->rootPropertySetIndex, + This->parentStorage, + This->parentStorage->rootPropertySetIndex, &rootProp); - if (rootProp.size.u.LowPart < + if (rootProp.size.u.LowPart < (blocksRequired * This->parentStorage->bigBlockSize)) { rootProp.size.u.LowPart += This->parentStorage->bigBlockSize; BlockChainStream_SetSize( - This->parentStorage->smallBlockRootChain, + This->parentStorage->smallBlockRootChain, rootProp.size); StorageImpl_WriteProperty( - This->parentStorage, - This->parentStorage->rootPropertySetIndex, + This->parentStorage, + This->parentStorage->rootPropertySetIndex, &rootProp); } } @@ -4858,7 +5002,7 @@ ULONG SmallBlockChainStream_GetNextFreeBlock( * * Reads a specified number of bytes from this chain at the specified offset. * bytesRead may be NULL. - * Failure will be returned if the specified number of bytes has not been read. + * Failure will be returned if the specified number of bytes has not been read. */ BOOL SmallBlockChainStream_ReadAt( SmallBlockChainStream* This, @@ -4868,7 +5012,7 @@ BOOL SmallBlockChainStream_ReadAt( ULONG* bytesRead) { ULARGE_INTEGER offsetInBigBlockFile; - ULONG blockNoInSequence = + ULONG blockNoInSequence = offset.u.LowPart / This->parentStorage->smallBlockSize; ULONG offsetInBlock = offset.u.LowPart % This->parentStorage->smallBlockSize; @@ -4889,8 +5033,9 @@ BOOL SmallBlockChainStream_ReadAt( while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) { - blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); - + if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, + &blockIndex))) + return FALSE; blockNoInSequence--; } @@ -4905,14 +5050,14 @@ BOOL SmallBlockChainStream_ReadAt( /* * Calculate how many bytes we can copy from this small block. */ - bytesToReadInBuffer = + bytesToReadInBuffer = min(This->parentStorage->smallBlockSize - offsetInBlock, size); /* * Calculate the offset of the small block in the small block file. */ offsetInBigBlockFile.u.HighPart = 0; - offsetInBigBlockFile.u.LowPart = + offsetInBigBlockFile.u.LowPart = blockIndex * This->parentStorage->smallBlockSize; offsetInBigBlockFile.u.LowPart += offsetInBlock; @@ -4931,7 +5076,8 @@ BOOL SmallBlockChainStream_ReadAt( /* * Step to the next big block. */ - blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); + if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, &blockIndex))) + return FALSE; bufferWalker += bytesToReadInBuffer; size -= bytesToReadInBuffer; *bytesRead += bytesToReadInBuffer; @@ -4956,7 +5102,7 @@ BOOL SmallBlockChainStream_WriteAt( ULONG* bytesWritten) { ULARGE_INTEGER offsetInBigBlockFile; - ULONG blockNoInSequence = + ULONG blockNoInSequence = offset.u.LowPart / This->parentStorage->smallBlockSize; ULONG offsetInBlock = offset.u.LowPart % This->parentStorage->smallBlockSize; @@ -4964,24 +5110,24 @@ BOOL SmallBlockChainStream_WriteAt( ULONG blockIndex; ULONG bytesWrittenFromBigBlockFile; BYTE* bufferWalker; - + /* * This should never happen on a small block file. */ assert(offset.u.HighPart==0); - + /* * Find the first block in the stream that contains part of the buffer. */ blockIndex = SmallBlockChainStream_GetHeadOfChain(This); - + while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) { - blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); - + if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, &blockIndex))) + return FALSE; blockNoInSequence--; } - + /* * Start writing the buffer. * @@ -4995,18 +5141,18 @@ BOOL SmallBlockChainStream_WriteAt( /* * Calculate how many bytes we can copy to this small block. */ - bytesToWriteInBuffer = + bytesToWriteInBuffer = min(This->parentStorage->smallBlockSize - offsetInBlock, size); - + /* * Calculate the offset of the small block in the small block file. */ offsetInBigBlockFile.u.HighPart = 0; - offsetInBigBlockFile.u.LowPart = + offsetInBigBlockFile.u.LowPart = blockIndex * This->parentStorage->smallBlockSize; offsetInBigBlockFile.u.LowPart += offsetInBlock; - + /* * Write those bytes in the buffer to the small block file. */ @@ -5015,26 +5161,28 @@ BOOL SmallBlockChainStream_WriteAt( bytesToWriteInBuffer, bufferWalker, &bytesWrittenFromBigBlockFile); - + assert(bytesWrittenFromBigBlockFile == bytesToWriteInBuffer); - + /* * Step to the next big block. */ - blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); + if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, + &blockIndex))) + return FALSE; bufferWalker += bytesToWriteInBuffer; size -= bytesToWriteInBuffer; *bytesWritten += bytesToWriteInBuffer; offsetInBlock = 0; /* There is no offset on the next block */ } - + return (size == 0); } /****************************************************************************** * SmallBlockChainStream_Shrink * - * Shrinks this chain in the small block depot. + * Shrinks this chain in the small block depot. */ BOOL SmallBlockChainStream_Shrink( SmallBlockChainStream* This, @@ -5056,19 +5204,21 @@ BOOL SmallBlockChainStream_Shrink( */ while (count < numBlocks) { - blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); + if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, + &blockIndex))) + return FALSE; count++; } /* * If the count is 0, we have a special case, the head of the chain was - * just freed. + * just freed. */ if (count == 0) { StgProperty chainProp; - StorageImpl_ReadProperty(This->parentStorage, + StorageImpl_ReadProperty(This->parentStorage, This->ownerPropertyIndex, &chainProp); @@ -5086,12 +5236,14 @@ BOOL SmallBlockChainStream_Shrink( else { /* Get the next block before marking the new end */ - extraBlock = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); + if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, + &extraBlock))) + return FALSE; /* Mark the new end of chain */ SmallBlockChainStream_SetNextBlockInChain( - This, - blockIndex, + This, + blockIndex, BLOCK_END_OF_CHAIN); } @@ -5100,12 +5252,14 @@ BOOL SmallBlockChainStream_Shrink( */ while (extraBlock != BLOCK_END_OF_CHAIN) { - blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, extraBlock); + if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, extraBlock, + &blockIndex))) + return FALSE; SmallBlockChainStream_FreeBlock(This, extraBlock); extraBlock = blockIndex; } - return TRUE; + return TRUE; } /****************************************************************************** @@ -5141,8 +5295,8 @@ BOOL SmallBlockChainStream_Enlarge( blockIndex = chainProp.startingBlock; SmallBlockChainStream_SetNextBlockInChain( - This, - blockIndex, + This, + blockIndex, BLOCK_END_OF_CHAIN); } @@ -5163,7 +5317,8 @@ BOOL SmallBlockChainStream_Enlarge( { oldNumBlocks++; currentBlock = blockIndex; - blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, currentBlock); + if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, currentBlock, &blockIndex))) + return FALSE; } /* @@ -5175,8 +5330,8 @@ BOOL SmallBlockChainStream_Enlarge( SmallBlockChainStream_SetNextBlockInChain(This, currentBlock, blockIndex); SmallBlockChainStream_SetNextBlockInChain( - This, - blockIndex, + This, + blockIndex, BLOCK_END_OF_CHAIN); currentBlock = blockIndex; @@ -5203,7 +5358,8 @@ ULONG SmallBlockChainStream_GetCount(SmallBlockChainStream* This) { count++; - blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); + if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, &blockIndex))) + return 0; } return count; @@ -5217,7 +5373,7 @@ ULONG SmallBlockChainStream_GetCount(SmallBlockChainStream* This) * * TODO: Free the actual blocks in the file when we shrink the chain. * Currently, the blocks are still in the file. So the file size - * doesn't shrink even if we shrink streams. + * doesn't shrink even if we shrink streams. */ BOOL SmallBlockChainStream_SetSize( SmallBlockChainStream* This, @@ -5258,7 +5414,7 @@ ULARGE_INTEGER SmallBlockChainStream_GetSize(SmallBlockChainStream* This) } /****************************************************************************** - * StgCreateDocfile [OLE32.144] + * StgCreateDocfile [OLE32.@] */ HRESULT WINAPI StgCreateDocfile( LPCOLESTR pwcsName, @@ -5275,9 +5431,9 @@ HRESULT WINAPI StgCreateDocfile( DWORD fileAttributes; WCHAR tempFileName[MAX_PATH]; - Print(MAX_TRACE, ("(%S, %lx, %ld, %p)\n", - pwcsName, grfMode, - reserved, ppstgOpen)); + TRACE("(%s, %lx, %ld, %p)\n", + debugstr_w(pwcsName), grfMode, + reserved, ppstgOpen); /* * Validate the parameters @@ -5323,7 +5479,7 @@ HRESULT WINAPI StgCreateDocfile( } /* - * Interpret the STGM value grfMode + * Interpret the STGM value grfMode */ shareMode = GetShareModeFromSTGM(grfMode); accessMode = GetAccessModeFromSTGM(grfMode); @@ -5334,7 +5490,7 @@ HRESULT WINAPI StgCreateDocfile( fileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS; if (grfMode & STGM_TRANSACTED) - UNIMPLEMENTED; + FIXME("Transacted mode not implemented.\n"); /* * Initialize the "out" parameter. @@ -5348,7 +5504,7 @@ HRESULT WINAPI StgCreateDocfile( creationMode, fileAttributes, 0); - + if (hFile == INVALID_HANDLE_VALUE) { return E_FAIL; @@ -5358,18 +5514,19 @@ HRESULT WINAPI StgCreateDocfile( * Allocate and initialize the new IStorage32object. */ newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl)); - + if (newStorage == 0) return STG_E_INSUFFICIENTMEMORY; hr = StorageImpl_Construct( newStorage, hFile, + pwcsName, NULL, grfMode, TRUE, TRUE); - + if (FAILED(hr)) { HeapFree(GetProcessHeap(), 0, newStorage); @@ -5388,14 +5545,14 @@ HRESULT WINAPI StgCreateDocfile( } /****************************************************************************** - * StgOpenStorage [OLE32.148] + * StgOpenStorage [OLE32.@] */ HRESULT WINAPI StgOpenStorage( const OLECHAR *pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, - DWORD reserved, + DWORD reserved, IStorage **ppstgOpen) { StorageImpl* newStorage = 0; @@ -5403,22 +5560,30 @@ HRESULT WINAPI StgOpenStorage( HANDLE hFile = 0; DWORD shareMode; DWORD accessMode; + WCHAR fullname[MAX_PATH]; + DWORD length; - Print(MAX_TRACE, ("(%S, %p, %lx, %p, %ld, %p)\n", - pwcsName, pstgPriority, grfMode, - snbExclude, reserved, ppstgOpen)); + TRACE("(%s, %p, %lx, %p, %ld, %p)\n", + debugstr_w(pwcsName), pstgPriority, grfMode, + snbExclude, reserved, ppstgOpen); /* * Perform a sanity check */ if (( pwcsName == 0) || (ppstgOpen == 0) ) - return STG_E_INVALIDPOINTER; + { + hr = STG_E_INVALIDPOINTER; + goto end; + } /* * Validate the STGM flags */ if ( FAILED( validateSTGM(grfMode) )) - return STG_E_INVALIDFLAG; + { + hr = STG_E_INVALIDFLAG; + goto end; + } /* * Interpret the STGM value grfMode @@ -5430,21 +5595,23 @@ HRESULT WINAPI StgOpenStorage( * Initialize the "out" parameter. */ *ppstgOpen = 0; - - hFile = CreateFileW( pwcsName, + + hFile = CreateFileW( pwcsName, accessMode, shareMode, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, 0); - - + + length = GetFileSize(hFile, NULL); + if (hFile==INVALID_HANDLE_VALUE) { - HRESULT hr = E_FAIL; DWORD last_error = GetLastError(); + hr = E_FAIL; + switch (last_error) { case ERROR_FILE_NOT_FOUND: @@ -5468,25 +5635,30 @@ HRESULT WINAPI StgOpenStorage( hr = E_FAIL; } - return hr; + goto end; } /* * Allocate and initialize the new IStorage32object. */ newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl)); - - if (newStorage == 0) - return STG_E_INSUFFICIENTMEMORY; + if (newStorage == 0) + { + hr = STG_E_INSUFFICIENTMEMORY; + goto end; + } + + /* if the file's length was zero, initialize the storage */ hr = StorageImpl_Construct( newStorage, hFile, + pwcsName, NULL, grfMode, TRUE, - FALSE); - + !length ); + if (FAILED(hr)) { HeapFree(GetProcessHeap(), 0, newStorage); @@ -5494,10 +5666,15 @@ HRESULT WINAPI StgOpenStorage( * According to the docs if the file is not a storage, return STG_E_FILEALREADYEXISTS */ if(hr == STG_E_INVALIDHEADER) - return STG_E_FILEALREADYEXISTS; - return hr; + hr = STG_E_FILEALREADYEXISTS; + goto end; } - + + /* prepare the file name string given in lieu of the root property name */ + GetFullPathNameW(pwcsName, MAX_PATH, fullname, NULL); + memcpy(newStorage->filename, fullname, PROPERTY_NAME_BUFFER_LEN); + newStorage->filename[PROPERTY_NAME_BUFFER_LEN-1] = '\0'; + /* * Get an "out" pointer for the caller. */ @@ -5505,12 +5682,14 @@ HRESULT WINAPI StgOpenStorage( (IStorage*)newStorage, (REFIID)&IID_IStorage, (void**)ppstgOpen); - + +end: + TRACE("<-- %08lx, IStorage %p\n", hr, ppstgOpen ? *ppstgOpen : NULL); return hr; } /****************************************************************************** - * StgCreateDocfileOnILockBytes [OLE32.145] + * StgCreateDocfileOnILockBytes [OLE32.@] */ HRESULT WINAPI StgCreateDocfileOnILockBytes( ILockBytes *plkbyt, @@ -5538,6 +5717,7 @@ HRESULT WINAPI StgCreateDocfileOnILockBytes( hr = StorageImpl_Construct( newStorage, 0, + 0, plkbyt, grfMode, FALSE, @@ -5557,11 +5737,11 @@ HRESULT WINAPI StgCreateDocfileOnILockBytes( (REFIID)&IID_IStorage, (void**)ppstgOpen); - return hr; + return hr; } /****************************************************************************** - * StgOpenStorageOnILockBytes [OLE32.149] + * StgOpenStorageOnILockBytes [OLE32.@] */ HRESULT WINAPI StgOpenStorageOnILockBytes( ILockBytes *plkbyt, @@ -5595,13 +5775,14 @@ HRESULT WINAPI StgOpenStorageOnILockBytes( * Allocate and initialize the new IStorage object. */ newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl)); - + if (newStorage == 0) return STG_E_INSUFFICIENTMEMORY; hr = StorageImpl_Construct( newStorage, 0, + 0, plkbyt, grfMode, FALSE, @@ -5625,19 +5806,23 @@ HRESULT WINAPI StgOpenStorageOnILockBytes( } /****************************************************************************** - * StgSetTimes [ole32.150] + * StgSetTimes [ole32.@] + * StgSetTimes [OLE32.@] * * */ -HRESULT WINAPI StgSetTimes(WCHAR * str, FILETIME * a, FILETIME * b, FILETIME *c ) +#ifdef __REACTOS__ +HRESULT WINAPI StgSetTimes(OLECHAR const *str, FILETIME const *a, FILETIME const *b, FILETIME const *c ) +#else +HRESULT WINAPI StgSetTimes(OLECHAR *str, FILETIME *a, FILETIME *b, FILETIME *c ) +#endif { - - UNIMPLEMENTED; - return FALSE; + FIXME("(%s, %p, %p, %p),stub!\n", debugstr_w(str), a, b, c); + return S_OK; } /****************************************************************************** - * StgIsStorageILockBytes [OLE32.147] + * StgIsStorageILockBytes [OLE32.@] * * Determines if the ILockBytes contains a storage object. */ @@ -5658,7 +5843,7 @@ HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt) } /****************************************************************************** - * WriteClassStg [OLE32.158] + * WriteClassStg [OLE32.@] * * This method will store the specified CLSID in the specified storage object */ @@ -5674,7 +5859,7 @@ HRESULT WINAPI WriteClassStg(IStorage* pStg, REFCLSID rclsid) } /*********************************************************************** - * ReadClassStg + * ReadClassStg (OLE32.@) * * This method reads the CLSID previously written to a storage object with the WriteClassStg. */ @@ -5682,8 +5867,8 @@ HRESULT WINAPI ReadClassStg(IStorage *pstg,CLSID *pclsid){ STATSTG pstatstg; HRESULT hRes; - - Print(MAX_TRACE, ("()\n")); + + TRACE("()\n"); if(pclsid==NULL) return E_POINTER; @@ -5699,7 +5884,7 @@ HRESULT WINAPI ReadClassStg(IStorage *pstg,CLSID *pclsid){ } /*********************************************************************** - * OleLoadFromStream + * OleLoadFromStream (OLE32.@) * * This function loads an object from stream */ @@ -5709,7 +5894,7 @@ HRESULT WINAPI OleLoadFromStream(IStream *pStm,REFIID iidInterface,void** ppvOb HRESULT res; LPPERSISTSTREAM xstm; - Print(MAX_TRACE, ("(%p,%s,%p)\n",pStm,PRINT_GUID(iidInterface),ppvObj)); + TRACE("(%p,%s,%p)\n",pStm,debugstr_guid(iidInterface),ppvObj); res=ReadClassStm(pStm,&clsid); if (!SUCCEEDED(res)) @@ -5733,7 +5918,7 @@ HRESULT WINAPI OleLoadFromStream(IStream *pStm,REFIID iidInterface,void** ppvOb } /*********************************************************************** - * OleSaveToStream + * OleSaveToStream (OLE32.@) * * This function saves an object with the IPersistStream interface on it * to the specified stream. @@ -5743,13 +5928,13 @@ HRESULT WINAPI OleSaveToStream(IPersistStream *pPStm,IStream *pStm) CLSID clsid; HRESULT res; - - Print(MAX_TRACE, ("(%p,%p)\n",pPStm,pStm)); + + TRACE("(%p,%p)\n",pPStm,pStm); res=IPersistStream_GetClassID(pPStm,&clsid); if (SUCCEEDED(res)){ - + res=WriteClassStm(pStm,&clsid); if (SUCCEEDED(res)) @@ -5757,7 +5942,7 @@ HRESULT WINAPI OleSaveToStream(IPersistStream *pPStm,IStream *pStm) res=IPersistStream_Save(pPStm,pStm,TRUE); } - Print(MAX_TRACE, ("Finished Save\n")); + TRACE("Finished Save\n"); return res; } @@ -5767,16 +5952,16 @@ HRESULT WINAPI OleSaveToStream(IPersistStream *pPStm,IStream *pStm) * STGM_DIRECT 0x00000000 * STGM_TRANSACTED 0x00010000 * STGM_SIMPLE 0x08000000 - * + * * STGM_READ 0x00000000 * STGM_WRITE 0x00000001 * STGM_READWRITE 0x00000002 - * + * * STGM_SHARE_DENY_NONE 0x00000040 * STGM_SHARE_DENY_READ 0x00000030 * STGM_SHARE_DENY_WRITE 0x00000020 * STGM_SHARE_EXCLUSIVE 0x00000010 - * + * * STGM_PRIORITY 0x00040000 * STGM_DELETEONRELEASE 0x04000000 * @@ -5792,11 +5977,11 @@ static HRESULT validateSTGM(DWORD stgm) BOOL bSTGM_TRANSACTED = ((stgm & STGM_TRANSACTED) == STGM_TRANSACTED); BOOL bSTGM_SIMPLE = ((stgm & STGM_SIMPLE) == STGM_SIMPLE); BOOL bSTGM_DIRECT = ! (bSTGM_TRANSACTED || bSTGM_SIMPLE); - + BOOL bSTGM_WRITE = ((stgm & STGM_WRITE) == STGM_WRITE); BOOL bSTGM_READWRITE = ((stgm & STGM_READWRITE) == STGM_READWRITE); BOOL bSTGM_READ = ! (bSTGM_WRITE || bSTGM_READWRITE); - + BOOL bSTGM_SHARE_DENY_NONE = ((stgm & STGM_SHARE_DENY_NONE) == STGM_SHARE_DENY_NONE); @@ -5811,18 +5996,18 @@ static HRESULT validateSTGM(DWORD stgm) BOOL bSTGM_CREATE = ((stgm & STGM_CREATE) == STGM_CREATE); BOOL bSTGM_CONVERT = ((stgm & STGM_CONVERT) == STGM_CONVERT); - + BOOL bSTGM_NOSCRATCH = ((stgm & STGM_NOSCRATCH) == STGM_NOSCRATCH); BOOL bSTGM_NOSNAPSHOT = ((stgm & STGM_NOSNAPSHOT) == STGM_NOSNAPSHOT); - /* + /* * STGM_DIRECT | STGM_TRANSACTED | STGM_SIMPLE */ if ( ! bSTGM_DIRECT ) if( bSTGM_TRANSACTED && bSTGM_SIMPLE ) return E_FAIL; - /* + /* * STGM_WRITE | STGM_READWRITE | STGM_READ */ if ( ! bSTGM_READ ) @@ -5830,13 +6015,13 @@ static HRESULT validateSTGM(DWORD stgm) return E_FAIL; /* - * STGM_SHARE_DENY_NONE | others + * STGM_SHARE_DENY_NONE | others * (I assume here that DENY_READ implies DENY_WRITE) */ if ( bSTGM_SHARE_DENY_NONE ) if ( bSTGM_SHARE_DENY_READ || - bSTGM_SHARE_DENY_WRITE || - bSTGM_SHARE_EXCLUSIVE) + bSTGM_SHARE_DENY_WRITE || + bSTGM_SHARE_EXCLUSIVE) return E_FAIL; /* @@ -5851,14 +6036,14 @@ static HRESULT validateSTGM(DWORD stgm) */ if ( bSTGM_NOSCRATCH && ! bSTGM_TRANSACTED ) return E_FAIL; - + /* - * STGM_NOSNAPSHOT requires STGM_TRANSACTED and + * STGM_NOSNAPSHOT requires STGM_TRANSACTED and * not STGM_SHARE_EXCLUSIVE or STGM_SHARE_DENY_WRITE` */ if (bSTGM_NOSNAPSHOT) { - if ( ! ( bSTGM_TRANSACTED && + if ( ! ( bSTGM_TRANSACTED && !(bSTGM_SHARE_EXCLUSIVE || bSTGM_SHARE_DENY_WRITE)) ) return E_FAIL; } @@ -5870,7 +6055,7 @@ static HRESULT validateSTGM(DWORD stgm) * GetShareModeFromSTGM * * This method will return a share mode flag from a STGM value. - * The STGM value is assumed valid. + * The STGM value is assumed valid. */ static DWORD GetShareModeFromSTGM(DWORD stgm) { @@ -5935,20 +6120,20 @@ static DWORD GetCreationModeFromSTGM(DWORD stgm) if ( stgm & STGM_CREATE) return CREATE_ALWAYS; if (stgm & STGM_CONVERT) { - UNIMPLEMENTED; + FIXME("STGM_CONVERT not implemented!\n"); return CREATE_NEW; } /* All other cases */ if (stgm & ~ (STGM_CREATE|STGM_CONVERT)) - Print(MIN_TRACE, ("unhandled storage mode : 0x%08lx\n",stgm & ~ (STGM_CREATE|STGM_CONVERT))); + FIXME("unhandled storage mode : 0x%08lx\n",stgm & ~ (STGM_CREATE|STGM_CONVERT)); return CREATE_NEW; } /************************************************************************* - * OLECONVERT_LoadOLE10 [Internal] + * OLECONVERT_LoadOLE10 [Internal] * - * Loads the OLE10 STREAM to memory + * Loads the OLE10 STREAM to memory * * PARAMS * pOleStream [I] The OLESTREAM @@ -5961,7 +6146,7 @@ static DWORD GetCreationModeFromSTGM(DWORD stgm) * * NOTES * This function is used by OleConvertOLESTREAMToIStorage only. - * + * * Memory allocated for pData must be freed by the caller */ HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM pOleStream, OLECONVERT_OLESTREAM_DATA *pData, BOOL bStrem1) @@ -6006,7 +6191,7 @@ HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM pOleStream, OLECONVERT_OLESTREAM_DATA * { if(pData->dwTypeID != 0) { - /* Get the lenght of the OleTypeName */ + /* Get the length of the OleTypeName */ dwSize = pOleStream->lpstbl->Get(pOleStream, (void *) &(pData->dwOleTypeNameLength), sizeof(pData->dwOleTypeNameLength)); if(dwSize != sizeof(pData->dwOleTypeNameLength)) { @@ -6036,7 +6221,7 @@ HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM pOleStream, OLECONVERT_OLESTREAM_DATA * { if(pData->dwOleObjFileNameLength < 1) /* there is no file name exist */ pData->dwOleObjFileNameLength = sizeof(pData->dwOleObjFileNameLength); - pData->pstrOleObjFileName = (CHAR *)malloc(pData->dwOleObjFileNameLength); + pData->pstrOleObjFileName = (CHAR *)HeapAlloc(GetProcessHeap(), 0, pData->dwOleObjFileNameLength); if(pData->pstrOleObjFileName) { dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)(pData->pstrOleObjFileName),pData->dwOleObjFileNameLength); @@ -6069,7 +6254,7 @@ HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM pOleStream, OLECONVERT_OLESTREAM_DATA * } if(hRes == S_OK) { - /* Get the Lenght of the Data */ + /* Get the Length of the Data */ dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwDataLength), sizeof(pData->dwDataLength)); if(dwSize != sizeof(pData->dwDataLength)) { @@ -6116,9 +6301,9 @@ HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM pOleStream, OLECONVERT_OLESTREAM_DATA * } /************************************************************************* - * OLECONVERT_SaveOLE10 [Internal] + * OLECONVERT_SaveOLE10 [Internal] * - * Saves the OLE10 STREAM From memory + * Saves the OLE10 STREAM From memory * * PARAMS * pData [I] Data Structure for the OLESTREAM Data @@ -6130,7 +6315,7 @@ HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM pOleStream, OLECONVERT_OLESTREAM_DATA * * * NOTES * This function is used by OleConvertIStorageToOLESTREAM only. - * + * */ HRESULT OLECONVERT_SaveOLE10(OLECONVERT_OLESTREAM_DATA *pData, LPOLESTREAM pOleStream) { @@ -6157,7 +6342,7 @@ HRESULT OLECONVERT_SaveOLE10(OLECONVERT_OLESTREAM_DATA *pData, LPOLESTREAM pOleS if(pData->dwOleID == OLESTREAM_ID && pData->dwTypeID != 0 && hRes == S_OK) { - /* Set the Lenght of the OleTypeName */ + /* Set the Length of the OleTypeName */ dwSize = pOleStream->lpstbl->Put(pOleStream, (void *)&(pData->dwOleTypeNameLength), sizeof(pData->dwOleTypeNameLength)); if(dwSize != sizeof(pData->dwOleTypeNameLength)) { @@ -6199,7 +6384,7 @@ HRESULT OLECONVERT_SaveOLE10(OLECONVERT_OLESTREAM_DATA *pData, LPOLESTREAM pOleS if(hRes == S_OK) { - /* Set the lenght of the Data */ + /* Set the length of the Data */ dwSize = pOleStream->lpstbl->Put(pOleStream, (void *)&(pData->dwDataLength), sizeof(pData->dwDataLength)); if(dwSize != sizeof(pData->dwDataLength)) { @@ -6224,12 +6409,12 @@ HRESULT OLECONVERT_SaveOLE10(OLECONVERT_OLESTREAM_DATA *pData, LPOLESTREAM pOleS } /************************************************************************* - * OLECONVERT_GetOLE20FromOLE10[Internal] + * OLECONVERT_GetOLE20FromOLE10[Internal] * * This function copies OLE10 Data (the IStorage in the OLESTREAM) to disk, - * opens it, and copies the content to the dest IStorage for + * opens it, and copies the content to the dest IStorage for * OleConvertOLESTREAMToIStorage - * + * * * PARAMS * pDestStorage [I] The IStorage to copy the data to @@ -6240,8 +6425,8 @@ HRESULT OLECONVERT_SaveOLE10(OLECONVERT_OLESTREAM_DATA *pData, LPOLESTREAM pOleS * Nothing * * NOTES - * - * + * + * */ void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, BYTE *pBuffer, DWORD nBufferLength) { @@ -6276,9 +6461,9 @@ void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, BYTE *pBuffer, DWORD n /************************************************************************* - * OLECONVERT_WriteOLE20ToBuffer [Internal] + * OLECONVERT_WriteOLE20ToBuffer [Internal] * - * Saves the OLE10 STREAM From memory + * Saves the OLE10 STREAM From memory * * PARAMS * pStorage [I] The Src IStorage to copy @@ -6291,7 +6476,7 @@ void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, BYTE *pBuffer, DWORD n * Memory allocated for pData must be freed by the caller * * Used by OleConvertIStorageToOLESTREAM only. - * + * */ DWORD OLECONVERT_WriteOLE20ToBuffer(LPSTORAGE pStorage, BYTE **pData) { @@ -6303,7 +6488,7 @@ DWORD OLECONVERT_WriteOLE20ToBuffer(LPSTORAGE pStorage, BYTE **pData) WCHAR wstrPrefix[] = {'s', 'i', 's', 0}; *pData = NULL; - + /* Create temp Storage */ GetTempPathW(MAX_PATH, wstrTempDir); GetTempFileNameW(wstrTempDir, wstrPrefix, 0, wstrTempFile); @@ -6330,9 +6515,9 @@ DWORD OLECONVERT_WriteOLE20ToBuffer(LPSTORAGE pStorage, BYTE **pData) } /************************************************************************* - * OLECONVERT_CreateOleStream [Internal] + * OLECONVERT_CreateOleStream [Internal] * - * Creates the "\001OLE" stream in the IStorage if neccessary. + * Creates the "\001OLE" stream in the IStorage if necessary. * * PARAMS * pStorage [I] Dest storage to create the stream in @@ -6345,24 +6530,24 @@ DWORD OLECONVERT_WriteOLE20ToBuffer(LPSTORAGE pStorage, BYTE **pData) * * This stream is still unknown, MS Word seems to have extra data * but since the data is stored in the OLESTREAM there should be - * no need to recreate the stream. If the stream is manually + * no need to recreate the stream. If the stream is manually * deleted it will create it with this default data. - * + * */ void OLECONVERT_CreateOleStream(LPSTORAGE pStorage) { HRESULT hRes; IStream *pStream; WCHAR wstrStreamName[] = {1,'O', 'l', 'e', 0}; - BYTE pOleStreamHeader [] = + BYTE pOleStreamHeader [] = { - 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; - + /* Create stream if not present */ - hRes = IStorage_CreateStream(pStorage, wstrStreamName, + hRes = IStorage_CreateStream(pStorage, wstrStreamName, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); if(hRes == S_OK) @@ -6373,14 +6558,293 @@ void OLECONVERT_CreateOleStream(LPSTORAGE pStorage) } } +/* write a string to a stream, preceded by its length */ +static HRESULT STREAM_WriteString( IStream *stm, LPCWSTR string ) +{ + HRESULT r; + LPSTR str; + DWORD len = 0; + + if( string ) + len = WideCharToMultiByte( CP_ACP, 0, string, -1, NULL, 0, NULL, NULL); + r = IStream_Write( stm, &len, sizeof(len), NULL); + if( FAILED( r ) ) + return r; + if(len == 0) + return r; + str = CoTaskMemAlloc( len ); + WideCharToMultiByte( CP_ACP, 0, string, -1, str, len, NULL, NULL); + r = IStream_Write( stm, str, len, NULL); + CoTaskMemFree( str ); + return r; +} + +/* read a string preceded by its length from a stream */ +static HRESULT STREAM_ReadString( IStream *stm, LPWSTR *string ) +{ + HRESULT r; + DWORD len, count = 0; + LPSTR str; + LPWSTR wstr; + + r = IStream_Read( stm, &len, sizeof(len), &count ); + if( FAILED( r ) ) + return r; + if( count != sizeof(len) ) + return E_OUTOFMEMORY; + + TRACE("%ld bytes\n",len); + + str = CoTaskMemAlloc( len ); + if( !str ) + return E_OUTOFMEMORY; + count = 0; + r = IStream_Read( stm, str, len, &count ); + if( FAILED( r ) ) + return r; + if( count != len ) + { + CoTaskMemFree( str ); + return E_OUTOFMEMORY; + } + + TRACE("Read string %s\n",debugstr_an(str,len)); + + len = MultiByteToWideChar( CP_ACP, 0, str, count, NULL, 0 ); + wstr = CoTaskMemAlloc( (len + 1)*sizeof (WCHAR) ); + if( wstr ) + MultiByteToWideChar( CP_ACP, 0, str, count, wstr, len ); + CoTaskMemFree( str ); + + *string = wstr; + + return r; +} + + +static HRESULT STORAGE_WriteCompObj( LPSTORAGE pstg, CLSID *clsid, + LPCWSTR lpszUserType, LPCWSTR szClipName, LPCWSTR szProgIDName ) +{ + IStream *pstm; + HRESULT r = S_OK; + WCHAR szwStreamName[] = {1, 'C', 'o', 'm', 'p', 'O', 'b', 'j', 0}; + + static const BYTE unknown1[12] = + { 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF}; + static const BYTE unknown2[16] = + { 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + TRACE("%p %s %s %s %s\n", pstg, debugstr_guid(clsid), + debugstr_w(lpszUserType), debugstr_w(szClipName), + debugstr_w(szProgIDName)); + + /* Create a CompObj stream if it doesn't exist */ + r = IStorage_CreateStream(pstg, szwStreamName, + STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pstm ); + if( FAILED (r) ) + return r; + + /* Write CompObj Structure to stream */ + r = IStream_Write(pstm, unknown1, sizeof(unknown1), NULL); + + if( SUCCEEDED( r ) ) + r = WriteClassStm( pstm, clsid ); + + if( SUCCEEDED( r ) ) + r = STREAM_WriteString( pstm, lpszUserType ); + if( SUCCEEDED( r ) ) + r = STREAM_WriteString( pstm, szClipName ); + if( SUCCEEDED( r ) ) + r = STREAM_WriteString( pstm, szProgIDName ); + if( SUCCEEDED( r ) ) + r = IStream_Write(pstm, unknown2, sizeof(unknown2), NULL); + + IStream_Release( pstm ); + + return r; +} + +/* enumerate HKEY_CLASSES_ROOT\\CLSID looking for a CLSID whose name matches */ +static HRESULT CLSIDFromUserType(LPCWSTR lpszUserType, CLSID *clsid) +{ + LONG r, count, i, len; + WCHAR szKey[0x40]; + HKEY hkey, hkeyclsid; + LPWSTR buffer = NULL; + BOOL found = FALSE; + const WCHAR szclsid[] = { 'C','L','S','I','D',0 }; + + TRACE("Finding CLSID for %s\n", debugstr_w(lpszUserType)); + + r = RegOpenKeyW( HKEY_CLASSES_ROOT, szclsid, &hkeyclsid ); + if( r ) + return E_INVALIDARG; + + len = lstrlenW( lpszUserType ) + 1; + buffer = CoTaskMemAlloc( len * sizeof (WCHAR) ); + if( !buffer ) + goto end; + + for(i=0; !found; i++ ) + { + r = RegEnumKeyW( hkeyclsid, i, szKey, sizeof(szKey)/sizeof(WCHAR)); + if( r != ERROR_SUCCESS ) + break; + hkey = 0; + r = RegOpenKeyW( hkeyclsid, szKey, &hkey ); + if( r != ERROR_SUCCESS ) + break; + count = len * sizeof (WCHAR); + r = RegQueryValueW( hkey, NULL, buffer, &count ); + found = ( r == ERROR_SUCCESS ) && + ( count == len*sizeof(WCHAR) ) && + !lstrcmpW( buffer, lpszUserType ) ; + RegCloseKey( hkey ); + } + +end: + if( buffer ) + CoTaskMemFree( buffer ); + RegCloseKey( hkeyclsid ); + + if ( !found ) + return E_INVALIDARG; + + TRACE("clsid is %s\n", debugstr_w( szKey ) ); + + r = CLSIDFromString( szKey, clsid ); + + return r; +} + + +/*********************************************************************** + * WriteFmtUserTypeStg (OLE32.@) + */ +HRESULT WINAPI WriteFmtUserTypeStg( + LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType) +{ + HRESULT r; + WCHAR szwClipName[0x40]; + WCHAR szCLSIDName[OLESTREAM_MAX_STR_LEN]; + CLSID clsid; + LPWSTR wstrProgID; + DWORD n; + LPMALLOC allocator = NULL; + + TRACE("(%p,%x,%s)\n",pstg,cf,debugstr_w(lpszUserType)); + + r = CoGetMalloc(0, &allocator); + if( FAILED( r) ) + return E_OUTOFMEMORY; + + /* get the clipboard format name */ + n = GetClipboardFormatNameW( cf, szwClipName, sizeof(szwClipName) ); + szwClipName[n]=0; + + TRACE("Clipboard name is %s\n", debugstr_w(szwClipName)); + + /* Get the CLSID */ + szCLSIDName[0]=0; + r = CLSIDFromUserType(lpszUserType, &clsid); + if( FAILED( r ) ) + return r; + + TRACE("CLSID is %s\n",debugstr_guid(&clsid)); + + /* get the real program ID */ + r = ProgIDFromCLSID( &clsid, &wstrProgID); + if( FAILED( r ) ) + return r; + + TRACE("progid is %s\n",debugstr_w(wstrProgID)); + + /* if we have a good string, write the stream */ + if( wstrProgID ) + r = STORAGE_WriteCompObj( pstg, &clsid, + lpszUserType, szwClipName, wstrProgID ); + else + r = E_OUTOFMEMORY; + + IMalloc_Free( allocator, wstrProgID); + + return r; +} + + +/****************************************************************************** + * ReadFmtUserTypeStg [OLE32.@] + */ +HRESULT WINAPI ReadFmtUserTypeStg (LPSTORAGE pstg, CLIPFORMAT* pcf, LPOLESTR* lplpszUserType) +{ + HRESULT r; + IStream *stm = 0; + const WCHAR szCompObj[] = { 1, 'C','o','m','p','O','b','j', 0 }; + unsigned char unknown1[12]; + unsigned char unknown2[16]; + DWORD count; + LPWSTR szProgIDName = NULL, szCLSIDName = NULL, szOleTypeName = NULL; + CLSID clsid; + + TRACE("(%p,%p,%p)\n", pstg, pcf, lplpszUserType); + + r = IStorage_OpenStream( pstg, szCompObj, NULL, + STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm ); + if( FAILED ( r ) ) + { + ERR("Failed to open stream\n"); + return r; + } + + /* read the various parts of the structure */ + r = IStream_Read( stm, unknown1, sizeof(unknown1), &count ); + if( FAILED( r ) || ( count != sizeof(unknown1) ) ) + goto end; + r = ReadClassStm( stm, &clsid ); + if( FAILED( r ) ) + goto end; + + r = STREAM_ReadString( stm, &szCLSIDName ); + if( FAILED( r ) ) + goto end; + + r = STREAM_ReadString( stm, &szOleTypeName ); + if( FAILED( r ) ) + goto end; + + r = STREAM_ReadString( stm, &szProgIDName ); + if( FAILED( r ) ) + goto end; + + r = IStream_Read( stm, unknown2, sizeof(unknown2), &count ); + if( FAILED( r ) || ( count != sizeof(unknown2) ) ) + goto end; + + /* ok, success... now we just need to store what we found */ + if( pcf ) + *pcf = RegisterClipboardFormatW( szOleTypeName ); + CoTaskMemFree( szOleTypeName ); + + if( lplpszUserType ) + *lplpszUserType = szCLSIDName; + CoTaskMemFree( szProgIDName ); + +end: + IStream_Release( stm ); + + return r; +} + /************************************************************************* - * OLECONVERT_CreateCompObjStream [Internal] + * OLECONVERT_CreateCompObjStream [Internal] * * Creates a "\001CompObj" is the destination IStorage if necessary. * * PARAMS - * pStorage [I] The dest IStorage to create the CompObj Stream + * pStorage [I] The dest IStorage to create the CompObj Stream * if necessary. * strOleTypeName [I] The ProgID * @@ -6392,10 +6856,10 @@ void OLECONVERT_CreateOleStream(LPSTORAGE pStorage) * This function is used by OleConvertOLESTREAMToIStorage only. * * The stream data is stored in the OLESTREAM and there should be - * no need to recreate the stream. If the stream is manually + * no need to recreate the stream. If the stream is manually * deleted it will attempt to create it by querying the registry. * - * + * */ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName) { @@ -6414,7 +6878,7 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName /* Create a CompObj stream if it doesn't exist */ - hStorageRes = IStorage_CreateStream(pStorage, wstrStreamName, + hStorageRes = IStorage_CreateStream(pStorage, wstrStreamName, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); if(hStorageRes == S_OK) { @@ -6428,14 +6892,24 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName strcpy(IStorageCompObj.strProgIDName, strOleTypeName); /* Get the CLSID */ +#ifdef __REACTOS__ + { + LPOLESTR WideBuffer; + WideBuffer = HeapAlloc(GetProcessHeap(), 0, IStorageCompObj.dwProgIDNameLength * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, strOleTypeName, -1, WideBuffer, IStorageCompObj.dwProgIDNameLength); + hRes = CLSIDFromProgID(WideBuffer, &(IStorageCompObj.clsid)); + HeapFree(GetProcessHeap(), 0, WideBuffer); + } +#else hRes = CLSIDFromProgID16(IStorageCompObj.strProgIDName, &(IStorageCompObj.clsid)); +#endif if(hRes == S_OK) { HKEY hKey; LONG hErr; /* Get the CLSID Default Name from the Registry */ - hErr = RegOpenKeyA(HKEY_CLASSES_ROOT, IStorageCompObj.strProgIDName, &hKey); + hErr = RegOpenKeyA(HKEY_CLASSES_ROOT, IStorageCompObj.strProgIDName, &hKey); if(hErr == ERROR_SUCCESS) { char strTemp[OLESTREAM_MAX_STR_LEN]; @@ -6477,14 +6951,14 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName /************************************************************************* - * OLECONVERT_CreateOlePresStream[Internal] + * OLECONVERT_CreateOlePresStream[Internal] * * Creates the "\002OlePres000" Stream with the Metafile data * * PARAMS * pStorage [I] The dest IStorage to create \002OLEPres000 stream in. * dwExtentX [I] Width of the Metafile - * dwExtentY [I] Height of the Metafile + * dwExtentY [I] Height of the Metafile * pData [I] Metafile data * dwDataLength [I] Size of the Metafile data * @@ -6494,31 +6968,31 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName * * NOTES * This function is used by OleConvertOLESTREAMToIStorage only. - * + * */ void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX, DWORD dwExtentY , BYTE *pData, DWORD dwDataLength) { HRESULT hRes; IStream *pStream; WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0}; - BYTE pOlePresStreamHeader [] = + BYTE pOlePresStreamHeader [] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - BYTE pOlePresStreamHeaderEmpty [] = + BYTE pOlePresStreamHeaderEmpty [] = { - 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - + /* Create the OlePres000 Stream */ - hRes = IStorage_CreateStream(pStorage, wstrStreamName, + hRes = IStorage_CreateStream(pStorage, wstrStreamName, STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); if(hRes == S_OK) @@ -6542,12 +7016,20 @@ void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX, DWORD d OlePres.dwExtentX = dwExtentX; OlePres.dwExtentY = -dwExtentY; - /* Set Data and Lenght */ + /* Set Data and Length */ +#ifdef __REACTOS__ + if(dwDataLength > sizeof(METAFILEPICT)) + { + OlePres.dwSize = dwDataLength - sizeof(METAFILEPICT); + OlePres.pData = &(pData[8]); + } +#else if(dwDataLength > sizeof(METAFILEPICT16)) { OlePres.dwSize = dwDataLength - sizeof(METAFILEPICT16); OlePres.pData = &(pData[8]); } +#endif /* Save OlePres000 Data to Stream */ hRes = IStream_Write(pStream, OlePres.byUnknown1, nHeaderSize, NULL); hRes = IStream_Write(pStream, &(OlePres.dwExtentX), sizeof(OlePres.dwExtentX), NULL); @@ -6562,7 +7044,7 @@ void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX, DWORD d } /************************************************************************* - * OLECONVERT_CreateOle10NativeStream [Internal] + * OLECONVERT_CreateOle10NativeStream [Internal] * * Creates the "\001Ole10Native" Stream (should contain a BMP) * @@ -6578,16 +7060,16 @@ void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX, DWORD d * This function is used by OleConvertOLESTREAMToIStorage only. * * Might need to verify the data and return appropriate error message - * + * */ void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, BYTE *pData, DWORD dwDataLength) { HRESULT hRes; IStream *pStream; WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0}; - + /* Create the Ole10Native Stream */ - hRes = IStorage_CreateStream(pStorage, wstrStreamName, + hRes = IStorage_CreateStream(pStorage, wstrStreamName, STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); if(hRes == S_OK) @@ -6601,7 +7083,7 @@ void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, BYTE *pData, DWORD d } /************************************************************************* - * OLECONVERT_GetOLE10ProgID [Internal] + * OLECONVERT_GetOLE10ProgID [Internal] * * Finds the ProgID (or OleTypeID) from the IStorage * @@ -6617,7 +7099,7 @@ void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, BYTE *pData, DWORD d * NOTES * This function is used by OleConvertIStorageToOLESTREAM only. * - * + * */ HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DWORD *dwSize) { @@ -6628,7 +7110,7 @@ HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DWORD *dw WCHAR wstrStreamName[] = {1,'C', 'o', 'm', 'p', 'O', 'b', 'j', 0}; /* Open the CompObj Stream */ - hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, + hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream ); if(hRes == S_OK) { @@ -6665,13 +7147,13 @@ HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DWORD *dw { *dwSize = WideCharToMultiByte(CP_ACP, 0, wstrProgID, -1, strProgID, *dwSize, NULL, FALSE); } - + } return hRes; } /************************************************************************* - * OLECONVERT_GetOle10PresData [Internal] + * OLECONVERT_GetOle10PresData [Internal] * * Converts IStorage "/001Ole10Native" stream to a OLE10 Stream * @@ -6686,8 +7168,8 @@ HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DWORD *dw * This function is used by OleConvertIStorageToOLESTREAM only. * * Memory allocated for pData must be freed by the caller - * - * + * + * */ void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA *pOleStreamData) { @@ -6707,7 +7189,7 @@ void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA * pOleStreamData[1].pData = NULL; /* Open Ole10Native Stream */ - hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, + hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream ); if(hRes == S_OK) { @@ -6726,7 +7208,7 @@ void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA * /************************************************************************* - * OLECONVERT_GetOle20PresData[Internal] + * OLECONVERT_GetOle20PresData[Internal] * * Converts IStorage "/002OlePres000" stream to a OLE10 Stream * @@ -6739,7 +7221,7 @@ void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA * * * NOTES * This function is used by OleConvertIStorageToOLESTREAM only. - * + * * Memory allocated for pData must be freed by the caller */ void OLECONVERT_GetOle20PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA *pOleStreamData) @@ -6766,12 +7248,16 @@ void OLECONVERT_GetOle20PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA * /* Open OlePress000 stream */ - hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, + hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream ); if(hRes == S_OK) { LARGE_INTEGER iSeekPos; +#ifdef __REACTOS__ + METAFILEPICT MetaFilePict; +#else METAFILEPICT16 MetaFilePict; +#endif char strMetafilePictName[] = "METAFILEPICT"; /* Set the TypeID for a Metafile */ @@ -6796,7 +7282,11 @@ void OLECONVERT_GetOle20PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA * if(olePress.dwSize > 0) { /* Set Length */ - pOleStreamData[1].dwDataLength = olePress.dwSize + sizeof(METAFILEPICT16); +#ifdef __REACTOS__ + pOleStreamData[1].dwDataLength = olePress.dwSize + sizeof(METAFILEPICT); +#else + pOleStreamData[1].dwDataLength = olePress.dwSize + sizeof(METAFILEPICT16); +#endif /* Set MetaFilePict struct */ MetaFilePict.mm = 8; @@ -6807,14 +7297,18 @@ void OLECONVERT_GetOle20PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA * /* Get Metafile Data */ pOleStreamData[1].pData = (BYTE *) HeapAlloc(GetProcessHeap(),0,pOleStreamData[1].dwDataLength); memcpy(pOleStreamData[1].pData, &MetaFilePict, sizeof(MetaFilePict)); +#ifdef __REACTOS__ + IStream_Read(pStream, &(pOleStreamData[1].pData[sizeof(MetaFilePict)]), pOleStreamData[1].dwDataLength-sizeof(METAFILEPICT), NULL); +#else IStream_Read(pStream, &(pOleStreamData[1].pData[sizeof(MetaFilePict)]), pOleStreamData[1].dwDataLength-sizeof(METAFILEPICT16), NULL); +#endif } IStream_Release(pStream); } } /************************************************************************* - * OleConvertOLESTREAMToIStorage [OLE32.87] + * OleConvertOLESTREAMToIStorage [OLE32.@] * * Read info on MSDN * @@ -6823,11 +7317,11 @@ void OLECONVERT_GetOle20PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA * * Still unsure of some mem fields for OLE 10 Stream * Still some unknowns for the IStorage: "\002OlePres000", "\001CompObj", * and "\001OLE" streams - * + * */ HRESULT WINAPI OleConvertOLESTREAMToIStorage ( - LPOLESTREAM pOleStream, - LPSTORAGE pstg, + LPOLESTREAM pOleStream, + LPSTORAGE pstg, const DVTARGETDEVICE* ptd) { int i; @@ -6838,7 +7332,7 @@ HRESULT WINAPI OleConvertOLESTREAMToIStorage ( if(ptd != NULL) { - Print(MIN_TRACE, ("DVTARGETDEVICE is not NULL, unhandled parameter\n")); + FIXME("DVTARGETDEVICE is not NULL, unhandled parameter\n"); } if(pstg == NULL || pOleStream == NULL) @@ -6908,7 +7402,7 @@ HRESULT WINAPI OleConvertOLESTREAMToIStorage ( } /************************************************************************* - * OleConvertIStorageToOLESTREAM [OLE32.85] + * OleConvertIStorageToOLESTREAM [OLE32.@] * * Read info on MSDN * @@ -6918,10 +7412,10 @@ HRESULT WINAPI OleConvertOLESTREAMToIStorage ( * Still unsure of some mem fields for OLE 10 Stream * Still some unknowns for the IStorage: "\002OlePres000", "\001CompObj", * and "\001OLE" streams. - * + * */ HRESULT WINAPI OleConvertIStorageToOLESTREAM ( - LPSTORAGE pstg, + LPSTORAGE pstg, LPOLESTREAM pOleStream) { int i; @@ -6945,17 +7439,17 @@ HRESULT WINAPI OleConvertIStorageToOLESTREAM ( } if(hRes == S_OK) { - /*Was it originaly Ole10 */ - hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream); + /* Was it originally Ole10 */ + hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream); if(hRes == S_OK) { IStream_Release(pStream); - /*Get Presentation Data for Ole10Native */ + /* Get Presentation Data for Ole10Native */ OLECONVERT_GetOle10PresData(pstg, pOleStreamData); } else { - /*Get Presentation Data (OLE20)*/ + /* Get Presentation Data (OLE20) */ OLECONVERT_GetOle20PresData(pstg, pOleStreamData); } @@ -6981,9 +7475,55 @@ HRESULT WINAPI OleConvertIStorageToOLESTREAM ( } /*********************************************************************** - * GetConvertStg (OLE32.68) + * GetConvertStg (OLE32.@) */ +#ifdef __REACTOS__ +HRESULT WINAPI GetConvertStg(LPSTORAGE guid) { + FIXME("(%s), unimplemented stub!\n",debugstr_guid((LPGUID)guid)); +#else HRESULT WINAPI GetConvertStg(LPGUID guid) { - UNIMPLEMENTED; + FIXME("(%s), unimplemented stub!\n",debugstr_guid(guid)); +#endif return E_FAIL; } + +/****************************************************************************** + * StgIsStorageFile [OLE32.@] + */ +HRESULT WINAPI +StgIsStorageFile(LPCOLESTR fn) +{ + HANDLE hf; + BYTE magic[8]; + DWORD bytes_read; + + TRACE("(\'%s\')\n", debugstr_w(fn)); + hf = CreateFileW(fn, GENERIC_READ, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + + if (hf == INVALID_HANDLE_VALUE) + return STG_E_FILENOTFOUND; + + if (!ReadFile(hf, magic, 8, &bytes_read, NULL)) + { + WARN(" unable to read file\n"); + CloseHandle(hf); + return S_FALSE; + } + + CloseHandle(hf); + + if (bytes_read != 8) { + WARN(" too short\n"); + return S_FALSE; + } + + if (!memcmp(magic,STORAGE_magic,8)) { + WARN(" -> YES\n"); + return S_OK; + } + + WARN(" -> Invalid header.\n"); + return S_FALSE; +} diff --git a/reactos/lib/ole32/include/storage32.h b/reactos/lib/ole32/storage32.h similarity index 76% rename from reactos/lib/ole32/include/storage32.h rename to reactos/lib/ole32/storage32.h index 5a9589ffa41..f9b0fb27334 100644 --- a/reactos/lib/ole32/include/storage32.h +++ b/reactos/lib/ole32/storage32.h @@ -6,16 +6,35 @@ * (Thanks to Martin Schwartz ) * * This include file contains definitions of types and function - * prototypes that are used in the many files implementing the + * prototypes that are used in the many files implementing the * storage functionality * * Copyright 1998,1999 Francis Beaudet * Copyright 1998,1999 Thuy Nguyen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __STORAGE32_H__ #define __STORAGE32_H__ -#include +#include + +#include "windef.h" +#include "winbase.h" +#include "winnt.h" +#include "objbase.h" /* * Definitions for the file format offsets. @@ -25,6 +44,7 @@ static const ULONG OFFSET_SMALLBLOCKSIZEBITS = 0x00000020; static const ULONG OFFSET_BBDEPOTCOUNT = 0x0000002C; static const ULONG OFFSET_ROOTSTARTBLOCK = 0x00000030; static const ULONG OFFSET_SBDEPOTSTART = 0x0000003C; +static const ULONG OFFSET_SBDEPOTCOUNT = 0x00000040; static const ULONG OFFSET_EXTBBDEPOTSTART = 0x00000044; static const ULONG OFFSET_EXTBBDEPOTCOUNT = 0x00000048; static const ULONG OFFSET_BBDEPOTSTART = 0x0000004C; @@ -32,15 +52,15 @@ static const ULONG OFFSET_PS_NAME = 0x00000000; static const ULONG OFFSET_PS_NAMELENGTH = 0x00000040; static const ULONG OFFSET_PS_PROPERTYTYPE = 0x00000042; static const ULONG OFFSET_PS_PREVIOUSPROP = 0x00000044; -static const ULONG OFFSET_PS_NEXTPROP = 0x00000048; +static const ULONG OFFSET_PS_NEXTPROP = 0x00000048; static const ULONG OFFSET_PS_DIRPROP = 0x0000004C; static const ULONG OFFSET_PS_GUID = 0x00000050; static const ULONG OFFSET_PS_TSS1 = 0x00000064; static const ULONG OFFSET_PS_TSD1 = 0x00000068; static const ULONG OFFSET_PS_TSS2 = 0x0000006C; static const ULONG OFFSET_PS_TSD2 = 0x00000070; -static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074; -static const ULONG OFFSET_PS_SIZE = 0x00000078; +static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074; +static const ULONG OFFSET_PS_SIZE = 0x00000078; static const WORD DEF_BIG_BLOCK_SIZE_BITS = 0x0009; static const WORD DEF_SMALL_BLOCK_SIZE_BITS = 0x0006; static const WORD DEF_BIG_BLOCK_SIZE = 0x0200; @@ -52,7 +72,7 @@ static const ULONG BLOCK_UNUSED = 0xFFFFFFFF; static const ULONG PROPERTY_NULL = 0xFFFFFFFF; #define PROPERTY_NAME_MAX_LEN 0x20 -#define PROPERTY_NAME_BUFFER_LEN 0x40 +#define PROPERTY_NAME_BUFFER_LEN 0x40 #define PROPSET_BLOCK_SIZE 0x00000080 @@ -124,7 +144,7 @@ struct StgProperty * Big Block File support * * The big block file is an abstraction of a flat file separated in - * same sized blocks. The implementation for the methods described in + * same sized blocks. The implementation for the methods described in * this section appear in stg_bigblockfile.c */ @@ -176,34 +196,34 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName /**************************************************************************** * Storage32BaseImpl definitions. * - * This stucture defines the base information contained in all implementations - * of IStorage32 contained in this filee storage implementation. + * This structure defines the base information contained in all implementations + * of IStorage32 contained in this file storage implementation. * * In OOP terms, this is the base class for all the IStorage32 implementations * contained in this file. */ struct StorageBaseImpl { - ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct + ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct * since we want to cast this in a Storage32 pointer */ /* * Reference count of this object */ ULONG ref; - - /* - * Ancestor storage (top level) + + /* + * Ancestor storage (top level) */ - StorageImpl* ancestorStorage; - + StorageImpl* ancestorStorage; + /* * Index of the property for the root of * this storage */ ULONG rootPropertySetIndex; - - /* + + /* * virtual Destructor method. */ void (*v_destructor)(StorageBaseImpl*); @@ -217,41 +237,41 @@ HRESULT WINAPI StorageBaseImpl_QueryInterface( IStorage* iface, REFIID riid, void** ppvObject); - -ULONG WINAPI StorageBaseImpl_AddRef( + +ULONG WINAPI StorageBaseImpl_AddRef( IStorage* iface); - -ULONG WINAPI StorageBaseImpl_Release( + +ULONG WINAPI StorageBaseImpl_Release( IStorage* iface); - -HRESULT WINAPI StorageBaseImpl_OpenStream( + +HRESULT WINAPI StorageBaseImpl_OpenStream( IStorage* iface, const OLECHAR* pwcsName, /* [string][in] */ void* reserved1, /* [unique][in] */ - DWORD grfMode, /* [in] */ - DWORD reserved2, /* [in] */ - IStream** ppstm); /* [out] */ - -HRESULT WINAPI StorageBaseImpl_OpenStorage( - IStorage* iface, - const OLECHAR* pwcsName, /* [string][unique][in] */ - IStorage* pstgPriority, /* [unique][in] */ - DWORD grfMode, /* [in] */ - SNB snbExclude, /* [unique][in] */ - DWORD reserved, /* [in] */ - IStorage** ppstg); /* [out] */ - -HRESULT WINAPI StorageBaseImpl_EnumElements( - IStorage* iface, - DWORD reserved1, /* [in] */ - void* reserved2, /* [size_is][unique][in] */ - DWORD reserved3, /* [in] */ - IEnumSTATSTG** ppenum); /* [out] */ + DWORD grfMode, /* [in] */ + DWORD reserved2, /* [in] */ + IStream** ppstm); /* [out] */ -HRESULT WINAPI StorageBaseImpl_Stat( +HRESULT WINAPI StorageBaseImpl_OpenStorage( IStorage* iface, - STATSTG* pstatstg, /* [out] */ - DWORD grfStatFlag); /* [in] */ + const OLECHAR* pwcsName, /* [string][unique][in] */ + IStorage* pstgPriority, /* [unique][in] */ + DWORD grfMode, /* [in] */ + SNB snbExclude, /* [unique][in] */ + DWORD reserved, /* [in] */ + IStorage** ppstg); /* [out] */ + +HRESULT WINAPI StorageBaseImpl_EnumElements( + IStorage* iface, + DWORD reserved1, /* [in] */ + void* reserved2, /* [size_is][unique][in] */ + DWORD reserved3, /* [in] */ + IEnumSTATSTG** ppenum); /* [out] */ + +HRESULT WINAPI StorageBaseImpl_Stat( + IStorage* iface, + STATSTG* pstatstg, /* [out] */ + DWORD grfStatFlag); /* [in] */ HRESULT WINAPI StorageBaseImpl_RenameElement( IStorage* iface, @@ -278,24 +298,28 @@ HRESULT WINAPI StorageBaseImpl_SetClass( */ struct StorageImpl { - ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct - * since we want to cast this in a Storage32 pointer */ + ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct + * since we want to cast this in a Storage32 pointer */ /* * Declare the member of the Storage32BaseImpl class to allow * casting as a Storage32BaseImpl */ ULONG ref; - struct StorageImpl* ancestorStorage; + struct StorageImpl* ancestorStorage; ULONG rootPropertySetIndex; void (*v_destructor)(struct StorageImpl*); - + /* * The following data members are specific to the Storage32Impl * class */ HANDLE hFile; /* Physical support for the Docfile */ - + LPOLESTR pwcsName; /* Full path of the document file */ + + /* FIXME: should this be in Storage32BaseImpl ? */ + WCHAR filename[PROPERTY_NAME_BUFFER_LEN]; + /* * File header */ @@ -319,69 +343,74 @@ struct StorageImpl */ BlockChainStream* rootBlockChain; BlockChainStream* smallBlockDepotChain; - BlockChainStream* smallBlockRootChain; + BlockChainStream* smallBlockRootChain; /* * Pointer to the big block file abstraction */ - BigBlockFile* bigBlockFile; + BigBlockFile* bigBlockFile; }; /* * Method declaration for the Storage32Impl class - */ + */ -HRESULT WINAPI StorageImpl_CreateStorage( +HRESULT WINAPI StorageImpl_CreateStorage( IStorage* iface, - const OLECHAR* pwcsName, /* [string][in] */ - DWORD grfMode, /* [in] */ - DWORD dwStgFmt, /* [in] */ - DWORD reserved2, /* [in] */ - IStorage** ppstg); /* [out] */ - -HRESULT WINAPI StorageImpl_CopyTo( + const OLECHAR* pwcsName, /* [string][in] */ + DWORD grfMode, /* [in] */ + DWORD dwStgFmt, /* [in] */ + DWORD reserved2, /* [in] */ + IStorage** ppstg); /* [out] */ + +HRESULT WINAPI StorageImpl_CopyTo( IStorage* iface, - DWORD ciidExclude, /* [in] */ - const IID* rgiidExclude, /* [size_is][unique][in] */ - SNB snbExclude, /* [unique][in] */ - IStorage* pstgDest); /* [unique][in] */ - -HRESULT WINAPI StorageImpl_MoveElementTo( + DWORD ciidExclude, /* [in] */ + const IID* rgiidExclude, /* [size_is][unique][in] */ + SNB snbExclude, /* [unique][in] */ + IStorage* pstgDest); /* [unique][in] */ + +HRESULT WINAPI StorageImpl_MoveElementTo( IStorage* iface, - const OLECHAR* pwcsName, /* [string][in] */ - IStorage* pstgDest, /* [unique][in] */ - const OLECHAR* pwcsNewName, /* [string][in] */ - DWORD grfFlags); /* [in] */ - -HRESULT WINAPI StorageImpl_Commit( + const OLECHAR* pwcsName, /* [string][in] */ + IStorage* pstgDest, /* [unique][in] */ + const OLECHAR* pwcsNewName, /* [string][in] */ + DWORD grfFlags); /* [in] */ + +HRESULT WINAPI StorageImpl_Commit( IStorage* iface, - DWORD grfCommitFlags); /* [in] */ - -HRESULT WINAPI StorageImpl_Revert( + DWORD grfCommitFlags); /* [in] */ + +HRESULT WINAPI StorageImpl_Revert( IStorage* iface); - -HRESULT WINAPI StorageImpl_DestroyElement( - IStorage* iface, - const OLECHAR* pwcsName); /* [string][in] */ - -HRESULT WINAPI StorageImpl_SetElementTimes( - IStorage* iface, - const OLECHAR* pwcsName, /* [string][in] */ - const FILETIME* pctime, /* [in] */ - const FILETIME* patime, /* [in] */ - const FILETIME* pmtime); /* [in] */ -HRESULT WINAPI StorageImpl_SetStateBits( +HRESULT WINAPI StorageImpl_DestroyElement( IStorage* iface, - DWORD grfStateBits, /* [in] */ - DWORD grfMask); /* [in] */ - + const OLECHAR* pwcsName); /* [string][in] */ + +HRESULT WINAPI StorageImpl_SetElementTimes( + IStorage* iface, + const OLECHAR* pwcsName, /* [string][in] */ + const FILETIME* pctime, /* [in] */ + const FILETIME* patime, /* [in] */ + const FILETIME* pmtime); /* [in] */ + +HRESULT WINAPI StorageImpl_SetStateBits( + IStorage* iface, + DWORD grfStateBits, /* [in] */ + DWORD grfMask); /* [in] */ + +HRESULT WINAPI StorageImpl_Stat(IStorage* iface, + STATSTG* pstatstg, /* [out] */ + DWORD grfStatFlag); /* [in] */ + void StorageImpl_Destroy( StorageImpl* This); HRESULT StorageImpl_Construct( StorageImpl* This, HANDLE hFile, + LPCOLESTR pwcsName, ILockBytes* pLkbyt, DWORD openFlags, BOOL fileBased, @@ -416,14 +445,15 @@ void StorageImpl_FreeBigBlock( StorageImpl* This, ULONG blockIndex); -ULONG StorageImpl_GetNextBlockInChain( +HRESULT StorageImpl_GetNextBlockInChain( StorageImpl* This, - ULONG blockIndex); + ULONG blockIndex, + ULONG* nextBlockIndex); void StorageImpl_SetNextBlockInChain( StorageImpl* This, ULONG blockIndex, - ULONG nextBlock); + ULONG nextBlock); HRESULT StorageImpl_LoadFileHeader( StorageImpl* This); @@ -468,7 +498,7 @@ void Storage32Impl_SetExtDepotBlock(StorageImpl* This, */ struct StorageInternalImpl { - ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct + ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct * since we want to cast this in a Storage32 pointer */ /* @@ -476,7 +506,7 @@ struct StorageInternalImpl * casting as a Storage32BaseImpl */ ULONG ref; - struct StorageImpl* ancestorStorage; + struct StorageImpl* ancestorStorage; ULONG rootPropertySetIndex; void (*v_destructor)(struct StorageInternalImpl*); @@ -489,17 +519,17 @@ struct StorageInternalImpl * Method definitions for the Storage32InternalImpl class. */ StorageInternalImpl* StorageInternalImpl_Construct( - StorageImpl* ancestorStorage, + StorageImpl* ancestorStorage, ULONG rootTropertyIndex); void StorageInternalImpl_Destroy( StorageInternalImpl* This); -HRESULT WINAPI StorageInternalImpl_Commit( +HRESULT WINAPI StorageInternalImpl_Commit( IStorage* iface, - DWORD grfCommitFlags); /* [in] */ + DWORD grfCommitFlags); /* [in] */ -HRESULT WINAPI StorageInternalImpl_Revert( +HRESULT WINAPI StorageInternalImpl_Revert( IStorage* iface); @@ -512,9 +542,9 @@ HRESULT WINAPI StorageInternalImpl_Revert( */ struct IEnumSTATSTGImpl { - ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the stuct + ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the struct * since we want to cast this in a IEnumSTATSTG pointer */ - + ULONG ref; /* Reference count */ StorageImpl* parentStorage; /* Reference to the parent storage */ ULONG firstPropertyNode; /* Index of the root of the storage to enumerate */ @@ -538,26 +568,26 @@ HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface( IEnumSTATSTG* iface, REFIID riid, void** ppvObject); - + ULONG WINAPI IEnumSTATSTGImpl_AddRef( - IEnumSTATSTG* iface); - + IEnumSTATSTG* iface); + ULONG WINAPI IEnumSTATSTGImpl_Release( IEnumSTATSTG* iface); - + HRESULT WINAPI IEnumSTATSTGImpl_Next( IEnumSTATSTG* iface, ULONG celt, STATSTG* rgelt, ULONG* pceltFetched); - + HRESULT WINAPI IEnumSTATSTGImpl_Skip( IEnumSTATSTG* iface, ULONG celt); - + HRESULT WINAPI IEnumSTATSTGImpl_Reset( IEnumSTATSTG* iface); - + HRESULT WINAPI IEnumSTATSTGImpl_Clone( IEnumSTATSTG* iface, IEnumSTATSTG** ppenum); @@ -597,9 +627,9 @@ INT IEnumSTATSTGImpl_FindParentProperty( */ struct StgStreamImpl { - ICOM_VFIELD(IStream); /* Needs to be the first item in the stuct + ICOM_VFIELD(IStream); /* Needs to be the first item in the struct * since we want to cast this in a IStream pointer */ - + /* * Reference count */ @@ -629,7 +659,7 @@ struct StgStreamImpl * This is the current position of the cursor in the stream */ ULARGE_INTEGER currentPosition; - + /* * The information in the stream is represented by a chain of small blocks * or a chain of large blocks. Depending on the case, one of the two @@ -655,76 +685,76 @@ void StgStreamImpl_OpenBlockChain( HRESULT WINAPI StgStreamImpl_QueryInterface( IStream* iface, - REFIID riid, /* [in] */ - void** ppvObject); /* [iid_is][out] */ - + REFIID riid, /* [in] */ + void** ppvObject); /* [iid_is][out] */ + ULONG WINAPI StgStreamImpl_AddRef( IStream* iface); - + ULONG WINAPI StgStreamImpl_Release( IStream* iface); - -HRESULT WINAPI StgStreamImpl_Read( + +HRESULT WINAPI StgStreamImpl_Read( IStream* iface, void* pv, /* [length_is][size_is][out] */ - ULONG cb, /* [in] */ - ULONG* pcbRead); /* [out] */ - + ULONG cb, /* [in] */ + ULONG* pcbRead); /* [out] */ + HRESULT WINAPI StgStreamImpl_Write( IStream* iface, - const void* pv, /* [size_is][in] */ - ULONG cb, /* [in] */ - ULONG* pcbWritten); /* [out] */ - -HRESULT WINAPI StgStreamImpl_Seek( - IStream* iface, - LARGE_INTEGER dlibMove, /* [in] */ - DWORD dwOrigin, /* [in] */ - ULARGE_INTEGER* plibNewPosition); /* [out] */ - -HRESULT WINAPI StgStreamImpl_SetSize( - IStream* iface, - ULARGE_INTEGER libNewSize); /* [in] */ - -HRESULT WINAPI StgStreamImpl_CopyTo( - IStream* iface, - IStream* pstm, /* [unique][in] */ - ULARGE_INTEGER cb, /* [in] */ - ULARGE_INTEGER* pcbRead, /* [out] */ - ULARGE_INTEGER* pcbWritten); /* [out] */ + const void* pv, /* [size_is][in] */ + ULONG cb, /* [in] */ + ULONG* pcbWritten); /* [out] */ -HRESULT WINAPI StgStreamImpl_Commit( +HRESULT WINAPI StgStreamImpl_Seek( + IStream* iface, + LARGE_INTEGER dlibMove, /* [in] */ + DWORD dwOrigin, /* [in] */ + ULARGE_INTEGER* plibNewPosition); /* [out] */ + +HRESULT WINAPI StgStreamImpl_SetSize( + IStream* iface, + ULARGE_INTEGER libNewSize); /* [in] */ + +HRESULT WINAPI StgStreamImpl_CopyTo( + IStream* iface, + IStream* pstm, /* [unique][in] */ + ULARGE_INTEGER cb, /* [in] */ + ULARGE_INTEGER* pcbRead, /* [out] */ + ULARGE_INTEGER* pcbWritten); /* [out] */ + +HRESULT WINAPI StgStreamImpl_Commit( IStream* iface, - DWORD grfCommitFlags); /* [in] */ - -HRESULT WINAPI StgStreamImpl_Revert( + DWORD grfCommitFlags); /* [in] */ + +HRESULT WINAPI StgStreamImpl_Revert( IStream* iface); - -HRESULT WINAPI StgStreamImpl_LockRegion( + +HRESULT WINAPI StgStreamImpl_LockRegion( IStream* iface, - ULARGE_INTEGER libOffset, /* [in] */ - ULARGE_INTEGER cb, /* [in] */ - DWORD dwLockType); /* [in] */ - -HRESULT WINAPI StgStreamImpl_UnlockRegion( + ULARGE_INTEGER libOffset, /* [in] */ + ULARGE_INTEGER cb, /* [in] */ + DWORD dwLockType); /* [in] */ + +HRESULT WINAPI StgStreamImpl_UnlockRegion( IStream* iface, - ULARGE_INTEGER libOffset, /* [in] */ - ULARGE_INTEGER cb, /* [in] */ - DWORD dwLockType); /* [in] */ - -HRESULT WINAPI StgStreamImpl_Stat( + ULARGE_INTEGER libOffset, /* [in] */ + ULARGE_INTEGER cb, /* [in] */ + DWORD dwLockType); /* [in] */ + +HRESULT WINAPI StgStreamImpl_Stat( IStream* iface, STATSTG* pstatstg, /* [out] */ - DWORD grfStatFlag); /* [in] */ - -HRESULT WINAPI StgStreamImpl_Clone( + DWORD grfStatFlag); /* [in] */ + +HRESULT WINAPI StgStreamImpl_Clone( IStream* iface, - IStream** ppstm); /* [out] */ + IStream** ppstm); /* [out] */ /******************************************************************************** * The StorageUtl_ functions are miscelaneous utility functions. Most of which are - * abstractions used to read values from file buffers without having to worry + * abstractions used to read values from file buffers without having to worry * about bit order */ void StorageUtl_ReadWord(void* buffer, ULONG offset, WORD* value); @@ -758,7 +788,7 @@ struct BlockChainStream * Methods for the BlockChainStream class. */ BlockChainStream* BlockChainStream_Construct( - StorageImpl* parentStorage, + StorageImpl* parentStorage, ULONG* headOfStreamPlaceHolder, ULONG propertyIndex); @@ -808,7 +838,7 @@ struct SmallBlockChainStream * Methods of the SmallBlockChainStream class. */ SmallBlockChainStream* SmallBlockChainStream_Construct( - StorageImpl* parentStorage, + StorageImpl* parentStorage, ULONG propertyIndex); void SmallBlockChainStream_Destroy( @@ -817,9 +847,10 @@ void SmallBlockChainStream_Destroy( ULONG SmallBlockChainStream_GetHeadOfChain( SmallBlockChainStream* This); -ULONG SmallBlockChainStream_GetNextBlockInChain( +HRESULT SmallBlockChainStream_GetNextBlockInChain( SmallBlockChainStream* This, - ULONG blockIndex); + ULONG blockIndex, + ULONG* nextBlockIndex); void SmallBlockChainStream_SetNextBlockInChain( SmallBlockChainStream* This, @@ -859,6 +890,3 @@ ULONG SmallBlockChainStream_GetCount( #endif /* __STORAGE32_H__ */ - - - diff --git a/reactos/lib/winmm/Makefile b/reactos/lib/winmm/Makefile index b9e946cb77d..2f24a9dd4b7 100644 --- a/reactos/lib/winmm/Makefile +++ b/reactos/lib/winmm/Makefile @@ -27,18 +27,15 @@ DEFINES = \ -D__REACTOS__ \ -D_WIN32_IE=0x600 \ -D_WIN32_WINNT=0x501 \ - -DWINVER=0x501 \ - -DCOBJMACROS \ - -D__need_offsetof + -DWINVER=0x501 TARGET_CFLAGS += \ $(DEFINES) \ - -DDCX_USESTYLE=0x10000L \ -I$(PATH_TO_TOP)/include/wine TARGET_RCFLAGS += -D__REACTOS__ -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x501 -TARGET_SDKLIBS = ntdll.a kernel32.a libwine.a ntdll.a +TARGET_SDKLIBS = libwine.a ntdll.a kernel32.a TARGET_OBJECTS = \ driver.o \