diff --git a/reactos/lib/shdocvw/classinfo.c b/reactos/lib/shdocvw/classinfo.c index e93218ae5cc..11f888e867c 100644 --- a/reactos/lib/shdocvw/classinfo.c +++ b/reactos/lib/shdocvw/classinfo.c @@ -38,27 +38,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); static HRESULT WINAPI WBPCI_QueryInterface(LPPROVIDECLASSINFO iface, REFIID riid, LPVOID *ppobj) { - IProvideClassInfoImpl *This = (IProvideClassInfoImpl *)iface; + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); + + if (ppobj == NULL) return E_POINTER; - FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } static ULONG WINAPI WBPCI_AddRef(LPPROVIDECLASSINFO iface) { - IProvideClassInfoImpl *This = (IProvideClassInfoImpl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } static ULONG WINAPI WBPCI_Release(LPPROVIDECLASSINFO iface) { - IProvideClassInfoImpl *This = (IProvideClassInfoImpl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } /* Return an ITypeInfo interface to retrieve type library info about @@ -82,7 +80,7 @@ static IProvideClassInfoVtbl WBPCI_Vtbl = WBPCI_GetClassInfo }; -IProvideClassInfoImpl SHDOCVW_ProvideClassInfo = { &WBPCI_Vtbl, 1 }; +IProvideClassInfoImpl SHDOCVW_ProvideClassInfo = { &WBPCI_Vtbl}; /********************************************************************** @@ -93,27 +91,25 @@ IProvideClassInfoImpl SHDOCVW_ProvideClassInfo = { &WBPCI_Vtbl, 1 }; static HRESULT WINAPI WBPCI2_QueryInterface(LPPROVIDECLASSINFO2 iface, REFIID riid, LPVOID *ppobj) { - IProvideClassInfo2Impl *This = (IProvideClassInfo2Impl *)iface; + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); - FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI WBPCI2_AddRef(LPPROVIDECLASSINFO2 iface) { - IProvideClassInfo2Impl *This = (IProvideClassInfo2Impl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } static ULONG WINAPI WBPCI2_Release(LPPROVIDECLASSINFO2 iface) { - IProvideClassInfo2Impl *This = (IProvideClassInfo2Impl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } /* Return an ITypeInfo interface to retrieve type library info about @@ -167,4 +163,4 @@ static IProvideClassInfo2Vtbl WBPCI2_Vtbl = WBPCI2_GetGUID }; -IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2 = { &WBPCI2_Vtbl, 1 }; +IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2 = { &WBPCI2_Vtbl}; diff --git a/reactos/lib/shdocvw/events.c b/reactos/lib/shdocvw/events.c index 1a1b59d6722..df611246e18 100644 --- a/reactos/lib/shdocvw/events.c +++ b/reactos/lib/shdocvw/events.c @@ -38,27 +38,25 @@ static const GUID IID_INotifyDBEvents = static HRESULT WINAPI WBCPC_QueryInterface(LPCONNECTIONPOINTCONTAINER iface, REFIID riid, LPVOID *ppobj) { - IConnectionPointContainerImpl *This = (IConnectionPointContainerImpl *)iface; + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); - FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI WBCPC_AddRef(LPCONNECTIONPOINTCONTAINER iface) { - IConnectionPointContainerImpl *This = (IConnectionPointContainerImpl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } static ULONG WINAPI WBCPC_Release(LPCONNECTIONPOINTCONTAINER iface) { - IConnectionPointContainerImpl *This = (IConnectionPointContainerImpl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } /* Get a list of connection points inside this container. */ @@ -112,7 +110,7 @@ static IConnectionPointContainerVtbl WBCPC_Vtbl = WBCPC_FindConnectionPoint }; -IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = { &WBCPC_Vtbl, 1 }; +IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = {&WBCPC_Vtbl}; /********************************************************************** @@ -122,27 +120,25 @@ IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = { &WBCPC_Vtbl, static HRESULT WINAPI WBCP_QueryInterface(LPCONNECTIONPOINT iface, REFIID riid, LPVOID *ppobj) { - IConnectionPointImpl *This = (IConnectionPointImpl *)iface; + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); - FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI WBCP_AddRef(LPCONNECTIONPOINT iface) { - IConnectionPointImpl *This = (IConnectionPointImpl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } static ULONG WINAPI WBCP_Release(LPCONNECTIONPOINT iface) { - IConnectionPointImpl *This = (IConnectionPointImpl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } static HRESULT WINAPI WBCP_GetConnectionInterface(LPCONNECTIONPOINT iface, IID* pIId) @@ -209,4 +205,4 @@ static IConnectionPointVtbl WBCP_Vtbl = WBCP_EnumConnections }; -IConnectionPointImpl SHDOCVW_ConnectionPoint = { &WBCP_Vtbl, 1 }; +IConnectionPointImpl SHDOCVW_ConnectionPoint = {&WBCP_Vtbl}; diff --git a/reactos/lib/shdocvw/factory.c b/reactos/lib/shdocvw/factory.c index c1f0be60ef8..df00714d93a 100644 --- a/reactos/lib/shdocvw/factory.c +++ b/reactos/lib/shdocvw/factory.c @@ -36,16 +36,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); static HRESULT WINAPI WBCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - - TRACE ("\n"); - - /* - * Perform a sanity check on the parameters. - */ - if ((This == NULL) || (ppobj == NULL) ) - return E_INVALIDARG; - + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); + + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } @@ -54,10 +48,9 @@ static HRESULT WINAPI WBCF_QueryInterface(LPCLASSFACTORY iface, */ static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } /************************************************************************ @@ -65,11 +58,9 @@ static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface) */ static ULONG WINAPI WBCF_Release(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } /************************************************************************ @@ -104,8 +95,13 @@ static HRESULT WINAPI WBCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter */ static HRESULT WINAPI WBCF_LockServer(LPCLASSFACTORY iface, BOOL dolock) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - FIXME("(%p)->(%d),stub!\n", This, dolock); + TRACE("(%d)\n", dolock); + + if (dolock) + SHDOCVW_LockModule(); + else + SHDOCVW_UnlockModule(); + return S_OK; } @@ -118,4 +114,4 @@ static IClassFactoryVtbl WBCF_Vtbl = WBCF_LockServer }; -IClassFactoryImpl SHDOCVW_ClassFactory = { &WBCF_Vtbl, 1 }; +IClassFactoryImpl SHDOCVW_ClassFactory = {&WBCF_Vtbl}; diff --git a/reactos/lib/shdocvw/misc.c b/reactos/lib/shdocvw/misc.c index a2f7af6d013..928f2a34def 100644 --- a/reactos/lib/shdocvw/misc.c +++ b/reactos/lib/shdocvw/misc.c @@ -32,27 +32,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); static HRESULT WINAPI WBQA_QueryInterface(LPQUICKACTIVATE iface, REFIID riid, LPVOID *ppobj) { - IQuickActivateImpl *This = (IQuickActivateImpl *)iface; + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); - FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI WBQA_AddRef(LPQUICKACTIVATE iface) { - IQuickActivateImpl *This = (IQuickActivateImpl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } static ULONG WINAPI WBQA_Release(LPQUICKACTIVATE iface) { - IQuickActivateImpl *This = (IQuickActivateImpl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } /* Alternative interface for quicker, easier activation of a control. */ @@ -90,4 +88,12 @@ static IQuickActivateVtbl WBQA_Vtbl = WBQA_GetContentExtent }; -IQuickActivateImpl SHDOCVW_QuickActivate = { &WBQA_Vtbl, 1 }; +IQuickActivateImpl SHDOCVW_QuickActivate = {&WBQA_Vtbl}; + +/********************************************************************** + * OpenURL (SHDOCVW.@) + */ +void WINAPI OpenURL(HWND hWnd, HINSTANCE hInst, LPCSTR lpcstrUrl, int nShowCmd) +{ + FIXME("%p %p %s %d\n", hWnd, hInst, debugstr_a(lpcstrUrl), nShowCmd); +} diff --git a/reactos/lib/shdocvw/oleobject.c b/reactos/lib/shdocvw/oleobject.c index c6b3d6cd197..6652b875da6 100644 --- a/reactos/lib/shdocvw/oleobject.c +++ b/reactos/lib/shdocvw/oleobject.c @@ -143,10 +143,9 @@ static HRESULT WINAPI WBOOBJ_QueryInterface(LPOLEOBJECT iface, */ static ULONG WINAPI WBOOBJ_AddRef(LPOLEOBJECT iface) { - IOleObjectImpl *This = (IOleObjectImpl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } /************************************************************************ @@ -154,11 +153,9 @@ static ULONG WINAPI WBOOBJ_AddRef(LPOLEOBJECT iface) */ static ULONG WINAPI WBOOBJ_Release(LPOLEOBJECT iface) { - IOleObjectImpl *This = (IOleObjectImpl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } /************************************************************************ @@ -438,7 +435,7 @@ static IOleObjectVtbl WBOOBJ_Vtbl = WBOOBJ_SetColorScheme }; -IOleObjectImpl SHDOCVW_OleObject = { &WBOOBJ_Vtbl, 1 }; +IOleObjectImpl SHDOCVW_OleObject = {&WBOOBJ_Vtbl}; /********************************************************************** @@ -448,27 +445,25 @@ IOleObjectImpl SHDOCVW_OleObject = { &WBOOBJ_Vtbl, 1 }; static HRESULT WINAPI WBOIPO_QueryInterface(LPOLEINPLACEOBJECT iface, REFIID riid, LPVOID *ppobj) { - IOleInPlaceObjectImpl *This = (IOleInPlaceObjectImpl *)iface; + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); - FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI WBOIPO_AddRef(LPOLEINPLACEOBJECT iface) { - IOleInPlaceObjectImpl *This = (IOleInPlaceObjectImpl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } static ULONG WINAPI WBOIPO_Release(LPOLEINPLACEOBJECT iface) { - IOleInPlaceObjectImpl *This = (IOleInPlaceObjectImpl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } static HRESULT WINAPI WBOIPO_GetWindow(LPOLEINPLACEOBJECT iface, HWND* phwnd) @@ -540,7 +535,7 @@ static IOleInPlaceObjectVtbl WBOIPO_Vtbl = WBOIPO_ReactivateAndUndo }; -IOleInPlaceObjectImpl SHDOCVW_OleInPlaceObject = { &WBOIPO_Vtbl, 1 }; +IOleInPlaceObjectImpl SHDOCVW_OleInPlaceObject = {&WBOIPO_Vtbl}; /********************************************************************** @@ -550,27 +545,25 @@ IOleInPlaceObjectImpl SHDOCVW_OleInPlaceObject = { &WBOIPO_Vtbl, 1 }; static HRESULT WINAPI WBOC_QueryInterface(LPOLECONTROL iface, REFIID riid, LPVOID *ppobj) { - IOleControlImpl *This = (IOleControlImpl *)iface; + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); - FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI WBOC_AddRef(LPOLECONTROL iface) { - IOleControlImpl *This = (IOleControlImpl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } static ULONG WINAPI WBOC_Release(LPOLECONTROL iface) { - IOleControlImpl *This = (IOleControlImpl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } static HRESULT WINAPI WBOC_GetControlInfo(LPOLECONTROL iface, LPCONTROLINFO pCI) @@ -612,4 +605,4 @@ static IOleControlVtbl WBOC_Vtbl = WBOC_FreezeEvents }; -IOleControlImpl SHDOCVW_OleControl = { &WBOC_Vtbl, 1 }; +IOleControlImpl SHDOCVW_OleControl = {&WBOC_Vtbl}; diff --git a/reactos/lib/shdocvw/persist.c b/reactos/lib/shdocvw/persist.c index f7868cbe792..53533e5617f 100644 --- a/reactos/lib/shdocvw/persist.c +++ b/reactos/lib/shdocvw/persist.c @@ -30,27 +30,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); static HRESULT WINAPI WBPS_QueryInterface(LPPERSISTSTORAGE iface, REFIID riid, LPVOID *ppobj) { - IPersistStorageImpl *This = (IPersistStorageImpl *)iface; + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); - FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI WBPS_AddRef(LPPERSISTSTORAGE iface) { - IPersistStorageImpl *This = (IPersistStorageImpl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } static ULONG WINAPI WBPS_Release(LPPERSISTSTORAGE iface) { - IPersistStorageImpl *This = (IPersistStorageImpl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } static HRESULT WINAPI WBPS_GetClassID(LPPERSISTSTORAGE iface, CLSID *pClassID) @@ -107,7 +105,7 @@ static IPersistStorageVtbl WBPS_Vtbl = WBPS_SaveCompleted }; -IPersistStorageImpl SHDOCVW_PersistStorage = { &WBPS_Vtbl, 1 }; +IPersistStorageImpl SHDOCVW_PersistStorage = {&WBPS_Vtbl}; /********************************************************************** @@ -117,27 +115,25 @@ IPersistStorageImpl SHDOCVW_PersistStorage = { &WBPS_Vtbl, 1 }; static HRESULT WINAPI WBPSI_QueryInterface(LPPERSISTSTREAMINIT iface, REFIID riid, LPVOID *ppobj) { - IPersistStreamInitImpl *This = (IPersistStreamInitImpl *)iface; + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); - FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI WBPSI_AddRef(LPPERSISTSTREAMINIT iface) { - IPersistStreamInitImpl *This = (IPersistStreamInitImpl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } static ULONG WINAPI WBPSI_Release(LPPERSISTSTREAMINIT iface) { - IPersistStreamInitImpl *This = (IPersistStreamInitImpl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } static HRESULT WINAPI WBPSI_GetClassID(LPPERSISTSTREAMINIT iface, CLSID *pClassID) @@ -195,4 +191,4 @@ static IPersistStreamInitVtbl WBPSI_Vtbl = WBPSI_InitNew }; -IPersistStreamInitImpl SHDOCVW_PersistStreamInit = { &WBPSI_Vtbl, 1 }; +IPersistStreamInitImpl SHDOCVW_PersistStreamInit = {&WBPSI_Vtbl}; diff --git a/reactos/lib/shdocvw/shdocvw.h b/reactos/lib/shdocvw/shdocvw.h index 14b4dfe1921..44ea589bdea 100644 --- a/reactos/lib/shdocvw/shdocvw.h +++ b/reactos/lib/shdocvw/shdocvw.h @@ -190,4 +190,11 @@ typedef struct extern IConnectionPointImpl SHDOCVW_ConnectionPoint; +/********************************************************************** + * Dll lifetime tracking declaration for shdocvw.dll + */ +extern LONG SHDOCVW_refCount; +static inline void SHDOCVW_LockModule() { InterlockedIncrement( &SHDOCVW_refCount ); } +static inline void SHDOCVW_UnlockModule() { InterlockedDecrement( &SHDOCVW_refCount ); } + #endif /* __WINE_SHDOCVW_H */ diff --git a/reactos/lib/shdocvw/shdocvw.spec b/reactos/lib/shdocvw/shdocvw.spec index b1d54cb4d36..c48373d5f02 100644 --- a/reactos/lib/shdocvw/shdocvw.spec +++ b/reactos/lib/shdocvw/shdocvw.spec @@ -121,7 +121,7 @@ @ stub ImportPrivacySettings @ stub InstallReg_RunDLL @ stub IEWriteErrorLog -@ stub OpenURL +@ stdcall OpenURL(long long str long) @ stub SHGetIDispatchForFolder @ stdcall SetQueryNetSessionCount(long) @ stub SoftwareUpdateMessageBox diff --git a/reactos/lib/shdocvw/shdocvw_main.c b/reactos/lib/shdocvw/shdocvw_main.c index 72a9b173cea..b5e16701615 100644 --- a/reactos/lib/shdocvw/shdocvw_main.c +++ b/reactos/lib/shdocvw/shdocvw_main.c @@ -47,6 +47,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); +LONG SHDOCVW_refCount = 0; + static const WCHAR szMozDlPath[] = { 'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\', 's','h','d','o','c','v','w',0 @@ -55,6 +57,7 @@ static const WCHAR szMozDlPath[] = { DEFINE_GUID( CLSID_MozillaBrowser, 0x1339B54C,0x3453,0x11D2,0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00); typedef HRESULT (WINAPI *fnGetClassObject)(REFCLSID rclsid, REFIID iid, LPVOID *ppv); +typedef HRESULT (WINAPI *fnCanUnloadNow)(void); HINSTANCE shdocvw_hinstance = 0; static HMODULE SHDOCVW_hshell32 = 0; @@ -127,7 +130,20 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad) */ HRESULT WINAPI SHDOCVW_DllCanUnloadNow(void) { - FIXME("(void): stub\n"); + HRESULT moz_can_unload = S_FALSE; + fnCanUnloadNow pCanUnloadNow; + + if (hMozCtl) + { + pCanUnloadNow = (fnCanUnloadNow) + GetProcAddress(hMozCtl, "DllCanUnloadNow"); + moz_can_unload = pCanUnloadNow(); + } + else + moz_can_unload = S_OK; + + if (moz_can_unload == S_OK && SHDOCVW_refCount == 0) + return S_OK; return S_FALSE; } @@ -145,6 +161,8 @@ typedef struct _IBindStatusCallbackImpl { static HRESULT WINAPI dlQueryInterface( IBindStatusCallback* This, REFIID riid, void** ppvObject ) { + if (ppvObject == NULL) return E_POINTER; + if( IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IBindStatusCallback)) { @@ -158,6 +176,9 @@ dlQueryInterface( IBindStatusCallback* This, REFIID riid, void** ppvObject ) static ULONG WINAPI dlAddRef( IBindStatusCallback* iface ) { IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface; + + SHDOCVW_LockModule(); + return InterlockedIncrement( &This->ref ); } @@ -165,11 +186,15 @@ static ULONG WINAPI dlRelease( IBindStatusCallback* iface ) { IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface; DWORD ref = InterlockedDecrement( &This->ref ); + if( !ref ) { DestroyWindow( This->hDialog ); HeapFree( GetProcessHeap(), 0, This ); } + + SHDOCVW_UnlockModule(); + return ref; } diff --git a/reactos/lib/shdocvw/webbrowser.c b/reactos/lib/shdocvw/webbrowser.c index 7c40dcd69a9..21bd351b649 100644 --- a/reactos/lib/shdocvw/webbrowser.c +++ b/reactos/lib/shdocvw/webbrowser.c @@ -29,27 +29,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); static HRESULT WINAPI WB_QueryInterface(IWebBrowser *iface, REFIID riid, LPVOID *ppobj) { - IWebBrowserImpl *This = (IWebBrowserImpl *)iface; + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); - FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI WB_AddRef(IWebBrowser *iface) { - IWebBrowserImpl *This = (IWebBrowserImpl *)iface; + SHDOCVW_LockModule(); - TRACE("\n"); - return ++(This->ref); + return 2; /* non-heap based object */ } static ULONG WINAPI WB_Release(IWebBrowser *iface) { - IWebBrowserImpl *This = (IWebBrowserImpl *)iface; + SHDOCVW_UnlockModule(); - /* static class, won't be freed */ - TRACE("\n"); - return --(This->ref); + return 1; /* non-heap based object */ } /* IDispatch methods */ @@ -277,4 +275,4 @@ static IWebBrowserVtbl WB_Vtbl = WB_get_Busy }; -IWebBrowserImpl SHDOCVW_WebBrowser = { &WB_Vtbl, 1 }; +IWebBrowserImpl SHDOCVW_WebBrowser = {&WB_Vtbl};