Properly implement DllCanUnloadNow ref counting. Make sure the mozilla

control is ready to unload as well.
This commit is contained in:
James Hawkins 2005-01-27 10:43:53 +00:00 committed by Alexandre Julliard
parent c04ce10bdd
commit bdbadd9e10
9 changed files with 134 additions and 177 deletions

View file

@ -38,31 +38,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
static HRESULT WINAPI WBPCI_QueryInterface(LPPROVIDECLASSINFO iface, static HRESULT WINAPI WBPCI_QueryInterface(LPPROVIDECLASSINFO iface,
REFIID riid, LPVOID *ppobj) 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; return E_NOINTERFACE;
} }
static ULONG WINAPI WBPCI_AddRef(LPPROVIDECLASSINFO iface) static ULONG WINAPI WBPCI_AddRef(LPPROVIDECLASSINFO iface)
{ {
IProvideClassInfoImpl *This = (IProvideClassInfoImpl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
static ULONG WINAPI WBPCI_Release(LPPROVIDECLASSINFO iface) static ULONG WINAPI WBPCI_Release(LPPROVIDECLASSINFO iface)
{ {
IProvideClassInfoImpl *This = (IProvideClassInfoImpl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
/* Return an ITypeInfo interface to retrieve type library info about /* Return an ITypeInfo interface to retrieve type library info about
@ -86,7 +80,7 @@ static IProvideClassInfoVtbl WBPCI_Vtbl =
WBPCI_GetClassInfo WBPCI_GetClassInfo
}; };
IProvideClassInfoImpl SHDOCVW_ProvideClassInfo = { &WBPCI_Vtbl, 1 }; IProvideClassInfoImpl SHDOCVW_ProvideClassInfo = { &WBPCI_Vtbl};
/********************************************************************** /**********************************************************************
@ -97,31 +91,25 @@ IProvideClassInfoImpl SHDOCVW_ProvideClassInfo = { &WBPCI_Vtbl, 1 };
static HRESULT WINAPI WBPCI2_QueryInterface(LPPROVIDECLASSINFO2 iface, static HRESULT WINAPI WBPCI2_QueryInterface(LPPROVIDECLASSINFO2 iface,
REFIID riid, LPVOID *ppobj) 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; return E_NOINTERFACE;
} }
static ULONG WINAPI WBPCI2_AddRef(LPPROVIDECLASSINFO2 iface) static ULONG WINAPI WBPCI2_AddRef(LPPROVIDECLASSINFO2 iface)
{ {
IProvideClassInfo2Impl *This = (IProvideClassInfo2Impl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
static ULONG WINAPI WBPCI2_Release(LPPROVIDECLASSINFO2 iface) static ULONG WINAPI WBPCI2_Release(LPPROVIDECLASSINFO2 iface)
{ {
IProvideClassInfo2Impl *This = (IProvideClassInfo2Impl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
/* Return an ITypeInfo interface to retrieve type library info about /* Return an ITypeInfo interface to retrieve type library info about
@ -175,4 +163,4 @@ static IProvideClassInfo2Vtbl WBPCI2_Vtbl =
WBPCI2_GetGUID WBPCI2_GetGUID
}; };
IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2 = { &WBPCI2_Vtbl, 1 }; IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2 = { &WBPCI2_Vtbl};

View file

@ -38,31 +38,25 @@ static const GUID IID_INotifyDBEvents =
static HRESULT WINAPI WBCPC_QueryInterface(LPCONNECTIONPOINTCONTAINER iface, static HRESULT WINAPI WBCPC_QueryInterface(LPCONNECTIONPOINTCONTAINER iface,
REFIID riid, LPVOID *ppobj) 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; return E_NOINTERFACE;
} }
static ULONG WINAPI WBCPC_AddRef(LPCONNECTIONPOINTCONTAINER iface) static ULONG WINAPI WBCPC_AddRef(LPCONNECTIONPOINTCONTAINER iface)
{ {
IConnectionPointContainerImpl *This = (IConnectionPointContainerImpl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
static ULONG WINAPI WBCPC_Release(LPCONNECTIONPOINTCONTAINER iface) static ULONG WINAPI WBCPC_Release(LPCONNECTIONPOINTCONTAINER iface)
{ {
IConnectionPointContainerImpl *This = (IConnectionPointContainerImpl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
/* Get a list of connection points inside this container. */ /* Get a list of connection points inside this container. */
@ -116,7 +110,7 @@ static IConnectionPointContainerVtbl WBCPC_Vtbl =
WBCPC_FindConnectionPoint WBCPC_FindConnectionPoint
}; };
IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = { &WBCPC_Vtbl, 1 }; IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = {&WBCPC_Vtbl};
/********************************************************************** /**********************************************************************
@ -126,31 +120,25 @@ IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = { &WBCPC_Vtbl,
static HRESULT WINAPI WBCP_QueryInterface(LPCONNECTIONPOINT iface, static HRESULT WINAPI WBCP_QueryInterface(LPCONNECTIONPOINT iface,
REFIID riid, LPVOID *ppobj) 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; return E_NOINTERFACE;
} }
static ULONG WINAPI WBCP_AddRef(LPCONNECTIONPOINT iface) static ULONG WINAPI WBCP_AddRef(LPCONNECTIONPOINT iface)
{ {
IConnectionPointImpl *This = (IConnectionPointImpl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
static ULONG WINAPI WBCP_Release(LPCONNECTIONPOINT iface) static ULONG WINAPI WBCP_Release(LPCONNECTIONPOINT iface)
{ {
IConnectionPointImpl *This = (IConnectionPointImpl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
static HRESULT WINAPI WBCP_GetConnectionInterface(LPCONNECTIONPOINT iface, IID* pIId) static HRESULT WINAPI WBCP_GetConnectionInterface(LPCONNECTIONPOINT iface, IID* pIId)
@ -217,4 +205,4 @@ static IConnectionPointVtbl WBCP_Vtbl =
WBCP_EnumConnections WBCP_EnumConnections
}; };
IConnectionPointImpl SHDOCVW_ConnectionPoint = { &WBCP_Vtbl, 1 }; IConnectionPointImpl SHDOCVW_ConnectionPoint = {&WBCP_Vtbl};

View file

@ -36,16 +36,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
static HRESULT WINAPI WBCF_QueryInterface(LPCLASSFACTORY iface, static HRESULT WINAPI WBCF_QueryInterface(LPCLASSFACTORY iface,
REFIID riid, LPVOID *ppobj) REFIID riid, LPVOID *ppobj)
{ {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
TRACE ("\n"); if (ppobj == NULL) return E_POINTER;
/*
* Perform a sanity check on the parameters.
*/
if ((This == NULL) || (ppobj == NULL) )
return E_INVALIDARG;
return E_NOINTERFACE; return E_NOINTERFACE;
} }
@ -54,12 +48,9 @@ static HRESULT WINAPI WBCF_QueryInterface(LPCLASSFACTORY iface,
*/ */
static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface) static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface)
{ {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
/************************************************************************ /************************************************************************
@ -67,13 +58,9 @@ static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface)
*/ */
static ULONG WINAPI WBCF_Release(LPCLASSFACTORY iface) static ULONG WINAPI WBCF_Release(LPCLASSFACTORY iface)
{ {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
/************************************************************************ /************************************************************************
@ -108,8 +95,13 @@ static HRESULT WINAPI WBCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter
*/ */
static HRESULT WINAPI WBCF_LockServer(LPCLASSFACTORY iface, BOOL dolock) static HRESULT WINAPI WBCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
{ {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; TRACE("(%d)\n", dolock);
FIXME("(%p)->(%d),stub!\n", This, dolock);
if (dolock)
SHDOCVW_LockModule();
else
SHDOCVW_UnlockModule();
return S_OK; return S_OK;
} }
@ -122,4 +114,4 @@ static IClassFactoryVtbl WBCF_Vtbl =
WBCF_LockServer WBCF_LockServer
}; };
IClassFactoryImpl SHDOCVW_ClassFactory = { &WBCF_Vtbl, 1 }; IClassFactoryImpl SHDOCVW_ClassFactory = {&WBCF_Vtbl};

View file

@ -32,31 +32,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
static HRESULT WINAPI WBQA_QueryInterface(LPQUICKACTIVATE iface, static HRESULT WINAPI WBQA_QueryInterface(LPQUICKACTIVATE iface,
REFIID riid, LPVOID *ppobj) 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; return E_NOINTERFACE;
} }
static ULONG WINAPI WBQA_AddRef(LPQUICKACTIVATE iface) static ULONG WINAPI WBQA_AddRef(LPQUICKACTIVATE iface)
{ {
IQuickActivateImpl *This = (IQuickActivateImpl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
static ULONG WINAPI WBQA_Release(LPQUICKACTIVATE iface) static ULONG WINAPI WBQA_Release(LPQUICKACTIVATE iface)
{ {
IQuickActivateImpl *This = (IQuickActivateImpl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
/* Alternative interface for quicker, easier activation of a control. */ /* Alternative interface for quicker, easier activation of a control. */
@ -94,7 +88,7 @@ static IQuickActivateVtbl WBQA_Vtbl =
WBQA_GetContentExtent WBQA_GetContentExtent
}; };
IQuickActivateImpl SHDOCVW_QuickActivate = { &WBQA_Vtbl, 1 }; IQuickActivateImpl SHDOCVW_QuickActivate = {&WBQA_Vtbl};
/********************************************************************** /**********************************************************************
* OpenURL (SHDOCVW.@) * OpenURL (SHDOCVW.@)

View file

@ -143,12 +143,9 @@ static HRESULT WINAPI WBOOBJ_QueryInterface(LPOLEOBJECT iface,
*/ */
static ULONG WINAPI WBOOBJ_AddRef(LPOLEOBJECT iface) static ULONG WINAPI WBOOBJ_AddRef(LPOLEOBJECT iface)
{ {
IOleObjectImpl *This = (IOleObjectImpl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
/************************************************************************ /************************************************************************
@ -156,13 +153,9 @@ static ULONG WINAPI WBOOBJ_AddRef(LPOLEOBJECT iface)
*/ */
static ULONG WINAPI WBOOBJ_Release(LPOLEOBJECT iface) static ULONG WINAPI WBOOBJ_Release(LPOLEOBJECT iface)
{ {
IOleObjectImpl *This = (IOleObjectImpl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
/************************************************************************ /************************************************************************
@ -442,7 +435,7 @@ static IOleObjectVtbl WBOOBJ_Vtbl =
WBOOBJ_SetColorScheme WBOOBJ_SetColorScheme
}; };
IOleObjectImpl SHDOCVW_OleObject = { &WBOOBJ_Vtbl, 1 }; IOleObjectImpl SHDOCVW_OleObject = {&WBOOBJ_Vtbl};
/********************************************************************** /**********************************************************************
@ -452,31 +445,25 @@ IOleObjectImpl SHDOCVW_OleObject = { &WBOOBJ_Vtbl, 1 };
static HRESULT WINAPI WBOIPO_QueryInterface(LPOLEINPLACEOBJECT iface, static HRESULT WINAPI WBOIPO_QueryInterface(LPOLEINPLACEOBJECT iface,
REFIID riid, LPVOID *ppobj) 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; return E_NOINTERFACE;
} }
static ULONG WINAPI WBOIPO_AddRef(LPOLEINPLACEOBJECT iface) static ULONG WINAPI WBOIPO_AddRef(LPOLEINPLACEOBJECT iface)
{ {
IOleInPlaceObjectImpl *This = (IOleInPlaceObjectImpl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
static ULONG WINAPI WBOIPO_Release(LPOLEINPLACEOBJECT iface) static ULONG WINAPI WBOIPO_Release(LPOLEINPLACEOBJECT iface)
{ {
IOleInPlaceObjectImpl *This = (IOleInPlaceObjectImpl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
static HRESULT WINAPI WBOIPO_GetWindow(LPOLEINPLACEOBJECT iface, HWND* phwnd) static HRESULT WINAPI WBOIPO_GetWindow(LPOLEINPLACEOBJECT iface, HWND* phwnd)
@ -548,7 +535,7 @@ static IOleInPlaceObjectVtbl WBOIPO_Vtbl =
WBOIPO_ReactivateAndUndo WBOIPO_ReactivateAndUndo
}; };
IOleInPlaceObjectImpl SHDOCVW_OleInPlaceObject = { &WBOIPO_Vtbl, 1 }; IOleInPlaceObjectImpl SHDOCVW_OleInPlaceObject = {&WBOIPO_Vtbl};
/********************************************************************** /**********************************************************************
@ -558,31 +545,25 @@ IOleInPlaceObjectImpl SHDOCVW_OleInPlaceObject = { &WBOIPO_Vtbl, 1 };
static HRESULT WINAPI WBOC_QueryInterface(LPOLECONTROL iface, static HRESULT WINAPI WBOC_QueryInterface(LPOLECONTROL iface,
REFIID riid, LPVOID *ppobj) 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; return E_NOINTERFACE;
} }
static ULONG WINAPI WBOC_AddRef(LPOLECONTROL iface) static ULONG WINAPI WBOC_AddRef(LPOLECONTROL iface)
{ {
IOleControlImpl *This = (IOleControlImpl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
static ULONG WINAPI WBOC_Release(LPOLECONTROL iface) static ULONG WINAPI WBOC_Release(LPOLECONTROL iface)
{ {
IOleControlImpl *This = (IOleControlImpl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
static HRESULT WINAPI WBOC_GetControlInfo(LPOLECONTROL iface, LPCONTROLINFO pCI) static HRESULT WINAPI WBOC_GetControlInfo(LPOLECONTROL iface, LPCONTROLINFO pCI)
@ -624,4 +605,4 @@ static IOleControlVtbl WBOC_Vtbl =
WBOC_FreezeEvents WBOC_FreezeEvents
}; };
IOleControlImpl SHDOCVW_OleControl = { &WBOC_Vtbl, 1 }; IOleControlImpl SHDOCVW_OleControl = {&WBOC_Vtbl};

View file

@ -30,31 +30,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
static HRESULT WINAPI WBPS_QueryInterface(LPPERSISTSTORAGE iface, static HRESULT WINAPI WBPS_QueryInterface(LPPERSISTSTORAGE iface,
REFIID riid, LPVOID *ppobj) 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; return E_NOINTERFACE;
} }
static ULONG WINAPI WBPS_AddRef(LPPERSISTSTORAGE iface) static ULONG WINAPI WBPS_AddRef(LPPERSISTSTORAGE iface)
{ {
IPersistStorageImpl *This = (IPersistStorageImpl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
static ULONG WINAPI WBPS_Release(LPPERSISTSTORAGE iface) static ULONG WINAPI WBPS_Release(LPPERSISTSTORAGE iface)
{ {
IPersistStorageImpl *This = (IPersistStorageImpl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
static HRESULT WINAPI WBPS_GetClassID(LPPERSISTSTORAGE iface, CLSID *pClassID) static HRESULT WINAPI WBPS_GetClassID(LPPERSISTSTORAGE iface, CLSID *pClassID)
@ -111,7 +105,7 @@ static IPersistStorageVtbl WBPS_Vtbl =
WBPS_SaveCompleted WBPS_SaveCompleted
}; };
IPersistStorageImpl SHDOCVW_PersistStorage = { &WBPS_Vtbl, 1 }; IPersistStorageImpl SHDOCVW_PersistStorage = {&WBPS_Vtbl};
/********************************************************************** /**********************************************************************
@ -121,31 +115,25 @@ IPersistStorageImpl SHDOCVW_PersistStorage = { &WBPS_Vtbl, 1 };
static HRESULT WINAPI WBPSI_QueryInterface(LPPERSISTSTREAMINIT iface, static HRESULT WINAPI WBPSI_QueryInterface(LPPERSISTSTREAMINIT iface,
REFIID riid, LPVOID *ppobj) 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; return E_NOINTERFACE;
} }
static ULONG WINAPI WBPSI_AddRef(LPPERSISTSTREAMINIT iface) static ULONG WINAPI WBPSI_AddRef(LPPERSISTSTREAMINIT iface)
{ {
IPersistStreamInitImpl *This = (IPersistStreamInitImpl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
static ULONG WINAPI WBPSI_Release(LPPERSISTSTREAMINIT iface) static ULONG WINAPI WBPSI_Release(LPPERSISTSTREAMINIT iface)
{ {
IPersistStreamInitImpl *This = (IPersistStreamInitImpl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
static HRESULT WINAPI WBPSI_GetClassID(LPPERSISTSTREAMINIT iface, CLSID *pClassID) static HRESULT WINAPI WBPSI_GetClassID(LPPERSISTSTREAMINIT iface, CLSID *pClassID)
@ -203,4 +191,4 @@ static IPersistStreamInitVtbl WBPSI_Vtbl =
WBPSI_InitNew WBPSI_InitNew
}; };
IPersistStreamInitImpl SHDOCVW_PersistStreamInit = { &WBPSI_Vtbl, 1 }; IPersistStreamInitImpl SHDOCVW_PersistStreamInit = {&WBPSI_Vtbl};

View file

@ -190,4 +190,11 @@ typedef struct
extern IConnectionPointImpl SHDOCVW_ConnectionPoint; 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 */ #endif /* __WINE_SHDOCVW_H */

View file

@ -47,6 +47,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
LONG SHDOCVW_refCount = 0;
static const WCHAR szMozDlPath[] = { static const WCHAR szMozDlPath[] = {
'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\', 'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
's','h','d','o','c','v','w',0 '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); 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 *fnGetClassObject)(REFCLSID rclsid, REFIID iid, LPVOID *ppv);
typedef HRESULT (WINAPI *fnCanUnloadNow)(void);
HINSTANCE shdocvw_hinstance = 0; HINSTANCE shdocvw_hinstance = 0;
static HMODULE SHDOCVW_hshell32 = 0; static HMODULE SHDOCVW_hshell32 = 0;
@ -127,7 +130,20 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
*/ */
HRESULT WINAPI SHDOCVW_DllCanUnloadNow(void) 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; return S_FALSE;
} }
@ -145,6 +161,8 @@ typedef struct _IBindStatusCallbackImpl {
static HRESULT WINAPI static HRESULT WINAPI
dlQueryInterface( IBindStatusCallback* This, REFIID riid, void** ppvObject ) dlQueryInterface( IBindStatusCallback* This, REFIID riid, void** ppvObject )
{ {
if (ppvObject == NULL) return E_POINTER;
if( IsEqualIID(riid, &IID_IUnknown) || if( IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IBindStatusCallback)) IsEqualIID(riid, &IID_IBindStatusCallback))
{ {
@ -158,6 +176,9 @@ dlQueryInterface( IBindStatusCallback* This, REFIID riid, void** ppvObject )
static ULONG WINAPI dlAddRef( IBindStatusCallback* iface ) static ULONG WINAPI dlAddRef( IBindStatusCallback* iface )
{ {
IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface; IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
SHDOCVW_LockModule();
return InterlockedIncrement( &This->ref ); return InterlockedIncrement( &This->ref );
} }
@ -165,11 +186,15 @@ static ULONG WINAPI dlRelease( IBindStatusCallback* iface )
{ {
IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface; IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
DWORD ref = InterlockedDecrement( &This->ref ); DWORD ref = InterlockedDecrement( &This->ref );
if( !ref ) if( !ref )
{ {
DestroyWindow( This->hDialog ); DestroyWindow( This->hDialog );
HeapFree( GetProcessHeap(), 0, This ); HeapFree( GetProcessHeap(), 0, This );
} }
SHDOCVW_UnlockModule();
return ref; return ref;
} }

View file

@ -29,31 +29,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
static HRESULT WINAPI WB_QueryInterface(IWebBrowser *iface, REFIID riid, LPVOID *ppobj) 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; return E_NOINTERFACE;
} }
static ULONG WINAPI WB_AddRef(IWebBrowser *iface) static ULONG WINAPI WB_AddRef(IWebBrowser *iface)
{ {
IWebBrowserImpl *This = (IWebBrowserImpl *)iface; SHDOCVW_LockModule();
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); return 2; /* non-heap based object */
return refCount;
} }
static ULONG WINAPI WB_Release(IWebBrowser *iface) static ULONG WINAPI WB_Release(IWebBrowser *iface)
{ {
IWebBrowserImpl *This = (IWebBrowserImpl *)iface; SHDOCVW_UnlockModule();
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */ return 1; /* non-heap based object */
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
} }
/* IDispatch methods */ /* IDispatch methods */
@ -281,4 +275,4 @@ static IWebBrowserVtbl WB_Vtbl =
WB_get_Busy WB_get_Busy
}; };
IWebBrowserImpl SHDOCVW_WebBrowser = { &WB_Vtbl, 1 }; IWebBrowserImpl SHDOCVW_WebBrowser = {&WB_Vtbl};