Commit 8d18b893 authored by Qian Hong's avatar Qian Hong Committed by Alexandre Julliard

atl100: Fixed AtlAdvise and AtlUnadvise crashing with NULL pUnkCP.

parent af59b20c
...@@ -51,6 +51,9 @@ HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, DWORD ...@@ -51,6 +51,9 @@ HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, DWORD
TRACE("%p %p %p %p\n", pUnkCP, pUnk, iid, pdw); TRACE("%p %p %p %p\n", pUnkCP, pUnk, iid, pdw);
if(!pUnkCP)
return E_INVALIDARG;
hres = IUnknown_QueryInterface(pUnkCP, &IID_IConnectionPointContainer, (void**)&container); hres = IUnknown_QueryInterface(pUnkCP, &IID_IConnectionPointContainer, (void**)&container);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -76,6 +79,9 @@ HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID *iid, DWORD dw) ...@@ -76,6 +79,9 @@ HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID *iid, DWORD dw)
TRACE("%p %p %d\n", pUnkCP, iid, dw); TRACE("%p %p %d\n", pUnkCP, iid, dw);
if(!pUnkCP)
return E_INVALIDARG;
hres = IUnknown_QueryInterface(pUnkCP, &IID_IConnectionPointContainer, (void**)&container); hres = IUnknown_QueryInterface(pUnkCP, &IID_IConnectionPointContainer, (void**)&container);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -359,6 +359,12 @@ static void test_cp(void) ...@@ -359,6 +359,12 @@ static void test_cp(void)
DWORD cookie = 0; DWORD cookie = 0;
HRESULT hres; HRESULT hres;
hres = AtlAdvise(NULL, (IUnknown*)0xdeed0000, &CLSID_Test, &cookie);
ok(hres == E_INVALIDARG, "expect E_INVALIDARG, returned %08x\n", hres);
hres = AtlUnadvise(NULL, &CLSID_Test, 0xdeadbeef);
ok(hres == E_INVALIDARG, "expect E_INVALIDARG, returned %08x\n", hres);
hres = AtlAdvise((IUnknown*)&ConnectionPointContainer, (IUnknown*)0xdead0000, &CLSID_Test, &cookie); hres = AtlAdvise((IUnknown*)&ConnectionPointContainer, (IUnknown*)0xdead0000, &CLSID_Test, &cookie);
ok(hres == S_OK, "AtlAdvise failed: %08x\n", hres); ok(hres == S_OK, "AtlAdvise failed: %08x\n", hres);
ok(cookie == 0xdeadbeef, "cookie = %x\n", cookie); ok(cookie == 0xdeadbeef, "cookie = %x\n", cookie);
......
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