Commit 054049cf authored by Damien Fouilleul's avatar Damien Fouilleul

- all: fixed object interfaces queries and other fixes as reported by Jacob Lewallen

parent fb0991c4
...@@ -101,7 +101,7 @@ STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie) ...@@ -101,7 +101,7 @@ STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
pUnk->AddRef(); pUnk->AddRef();
cd.pUnk = pUnk; cd.pUnk = pUnk;
*pdwCookie = cd.dwCookie = _connections.size(); *pdwCookie = cd.dwCookie = _connections.size()+1;
_connections.push_back(cd); _connections.push_back(cd);
...@@ -110,9 +110,9 @@ STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie) ...@@ -110,9 +110,9 @@ STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
STDMETHODIMP VLCConnectionPoint::Unadvise(DWORD pdwCookie) STDMETHODIMP VLCConnectionPoint::Unadvise(DWORD pdwCookie)
{ {
if( pdwCookie < _connections.size() ) if( (0 < pdwCookie) && (pdwCookie <= _connections.size()) )
{ {
CONNECTDATA cd = _connections[pdwCookie]; CONNECTDATA cd = _connections[pdwCookie-1];
if( NULL != cd.pUnk ) if( NULL != cd.pUnk )
{ {
cd.pUnk->Release(); cd.pUnk->Release();
......
...@@ -39,9 +39,11 @@ public: ...@@ -39,9 +39,11 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( NULL == ppv ) return E_POINTER; if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid) if( (IID_IUnknown == riid)
&& (IID_IConnectionPoint == riid) ) { || (IID_IConnectionPoint == riid) )
{
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
return NOERROR; return NOERROR;
...@@ -95,9 +97,11 @@ public: ...@@ -95,9 +97,11 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv)
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IConnectionPointContainer == riid) ) { if( (IID_IUnknown == riid)
|| (IID_IConnectionPointContainer == riid) )
{
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
return NOERROR; return NOERROR;
......
...@@ -37,9 +37,10 @@ public: ...@@ -37,9 +37,10 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv)
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IDataObject == riid) ) { if( (IID_IUnknown == riid)
|| (IID_IDataObject == riid) ) {
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
return NOERROR; return NOERROR;
......
...@@ -67,9 +67,10 @@ public: ...@@ -67,9 +67,10 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv)
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IObjectSafety == riid) ) if( (IID_IUnknown == riid)
|| (IID_IObjectSafety == riid) )
{ {
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
......
...@@ -36,9 +36,10 @@ public: ...@@ -36,9 +36,10 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv )
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IOleControl == riid) ) if( (IID_IUnknown == riid)
|| (IID_IOleControl == riid) )
{ {
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
......
...@@ -36,10 +36,11 @@ public: ...@@ -36,10 +36,11 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv )
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IOleWindow == riid) if( (IID_IUnknown == riid)
&& (IID_IOleInPlaceActiveObject == riid) ) || (IID_IOleWindow == riid)
|| (IID_IOleInPlaceActiveObject == riid) )
{ {
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
......
...@@ -34,10 +34,11 @@ public: ...@@ -34,10 +34,11 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv )
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IOleWindow == riid) if( (IID_IUnknown == riid)
&& (IID_IOleInPlaceObject == riid) ) || (IID_IOleWindow == riid)
|| (IID_IOleInPlaceObject == riid) )
{ {
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
......
...@@ -34,9 +34,10 @@ public: ...@@ -34,9 +34,10 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv )
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IOleObject == riid) ) if( (IID_IUnknown == riid)
|| (IID_IOleObject == riid) )
{ {
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
......
...@@ -36,10 +36,12 @@ public: ...@@ -36,10 +36,12 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv )
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IPersist == riid) if( (IID_IUnknown == riid)
&& (IID_IPersistPropertyBag == riid) ) { || (IID_IPersist == riid)
|| (IID_IPersistPropertyBag == riid) )
{
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
return NOERROR; return NOERROR;
......
...@@ -36,10 +36,12 @@ public: ...@@ -36,10 +36,12 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv )
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IPersist == riid) if( (IID_IUnknown == riid)
&& (IID_IPersistStorage == riid) ) { || (IID_IPersist == riid)
|| (IID_IPersistStorage == riid) )
{
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
return NOERROR; return NOERROR;
......
...@@ -213,7 +213,7 @@ public: ...@@ -213,7 +213,7 @@ public:
if( NULL == ppv ) if( NULL == ppv )
return E_POINTER; return E_POINTER;
if( (IID_IUnknown == riid) if( (IID_IUnknown == riid)
&& (IID_IPropertyBag == riid) ) || (IID_IPropertyBag == riid) )
{ {
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
......
...@@ -36,10 +36,12 @@ public: ...@@ -36,10 +36,12 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv )
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IPersist == riid) if( (IID_IUnknown == riid)
&& (IID_IPersistStreamInit == riid) ) { || (IID_IPersist == riid)
|| (IID_IPersistStreamInit == riid) )
{
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
return NOERROR; return NOERROR;
......
...@@ -180,7 +180,8 @@ STDMETHODIMP VLCPluginClass::QueryInterface(REFIID riid, void **ppv) ...@@ -180,7 +180,8 @@ STDMETHODIMP VLCPluginClass::QueryInterface(REFIID riid, void **ppv)
if( NULL == ppv ) if( NULL == ppv )
return E_INVALIDARG; return E_INVALIDARG;
if( (IID_IUnknown == riid) || (IID_IClassFactory == riid) ) if( (IID_IUnknown == riid)
|| (IID_IClassFactory == riid) )
{ {
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
......
...@@ -36,10 +36,12 @@ public: ...@@ -36,10 +36,12 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv )
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IProvideClassInfo == riid) if( (IID_IUnknown == riid)
&& (IID_IProvideClassInfo2 == riid) ) { || (IID_IProvideClassInfo == riid)
|| (IID_IProvideClassInfo2 == riid) )
{
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
return NOERROR; return NOERROR;
......
...@@ -108,13 +108,16 @@ VLCEnum<T>& VLCEnum<T>::operator=(const VLCEnum<T> &e) ...@@ -108,13 +108,16 @@ VLCEnum<T>& VLCEnum<T>::operator=(const VLCEnum<T> &e)
template<class T> template<class T>
STDMETHODIMP VLCEnum<T>::QueryInterface(REFIID riid, void **ppv) STDMETHODIMP VLCEnum<T>::QueryInterface(REFIID riid, void **ppv)
{ {
if( NULL == ppv ) return E_POINTER; if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid) if( (IID_IUnknown == riid)
&& ( _riid == riid) ) { || (_riid == riid) )
{
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
return NOERROR; return NOERROR;
} }
// standalone object
return E_NOINTERFACE; return E_NOINTERFACE;
}; };
......
...@@ -37,11 +37,12 @@ public: ...@@ -37,11 +37,12 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv )
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IPersist == riid) if( (IID_IUnknown == riid)
&& (IID_IViewObject == riid) || (IID_IViewObject == riid)
&& (IID_IViewObject2 == riid) ) { || (IID_IViewObject2 == riid) )
{
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
return NOERROR; return NOERROR;
......
...@@ -37,10 +37,12 @@ public: ...@@ -37,10 +37,12 @@ public:
// IUnknown methods // IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( (NULL != ppv) if( NULL == ppv )
&& (IID_IUnknown == riid) return E_POINTER;
&& (IID_IDispatch == riid) if( (IID_IUnknown == riid)
&& (IID_IVLCControl == riid) ) { || (IID_IDispatch == riid)
|| (IID_IVLCControl == riid) )
{
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
return NOERROR; return NOERROR;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment