urlmon: Check some of the input parameters to URLOpenStreamA/W & URLOpenBlockingStreamA/W for NULL.
Add tests for these.
This commit is contained in:
parent
a5da813f5a
commit
086a91facf
|
@ -297,6 +297,11 @@ static void test_URLOpenBlockingStreamW(void)
|
|||
IStream *pStream;
|
||||
char buffer[256];
|
||||
|
||||
hr = URLOpenBlockingStreamW(NULL, NULL, &pStream, 0, &BindStatusCallback);
|
||||
ok(hr == E_INVALIDARG, "URLOpenBlockingStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
|
||||
hr = URLOpenBlockingStreamW(NULL, INDEX_HTML, NULL, 0, &BindStatusCallback);
|
||||
ok(hr == E_INVALIDARG, "URLOpenBlockingStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
|
||||
|
||||
SET_EXPECT(GetBindInfo);
|
||||
SET_EXPECT(QueryInterface_IServiceProvider);
|
||||
SET_EXPECT(OnStartBinding);
|
||||
|
@ -331,6 +336,9 @@ static void test_URLOpenStreamW(void)
|
|||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = URLOpenStreamW(NULL, NULL, 0, &BindStatusCallback);
|
||||
ok(hr == E_INVALIDARG, "URLOpenStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
|
||||
|
||||
SET_EXPECT(GetBindInfo);
|
||||
SET_EXPECT(QueryInterface_IServiceProvider);
|
||||
SET_EXPECT(OnStartBinding);
|
||||
|
|
|
@ -559,10 +559,16 @@ HRESULT WINAPI URLOpenBlockingStreamA(LPUNKNOWN pCaller, LPCSTR szURL,
|
|||
|
||||
TRACE("(%p, %s, %p, 0x%x, %p)\n", pCaller, szURL, ppStream, dwReserved, lpfnCB);
|
||||
|
||||
if (!szURL || !ppStream)
|
||||
return E_INVALIDARG;
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0);
|
||||
szURLW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
if (!szURLW)
|
||||
{
|
||||
*ppStream = NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
MultiByteToWideChar(CP_ACP, 0, szURL, -1, szURLW, len);
|
||||
|
||||
hr = URLOpenBlockingStreamW(pCaller, szURLW, ppStream, dwReserved, lpfnCB);
|
||||
|
@ -584,6 +590,9 @@ HRESULT WINAPI URLOpenBlockingStreamW(LPUNKNOWN pCaller, LPCWSTR szURL,
|
|||
TRACE("(%p, %s, %p, 0x%x, %p)\n", pCaller, debugstr_w(szURL), ppStream,
|
||||
dwReserved, lpfnCB);
|
||||
|
||||
if (!szURL || !ppStream)
|
||||
return E_INVALIDARG;
|
||||
|
||||
blocking_bsc.lpVtbl = &BlockingBindStatusCallbackVtbl;
|
||||
blocking_bsc.pBSC = lpfnCB;
|
||||
|
||||
|
@ -602,6 +611,9 @@ HRESULT WINAPI URLOpenStreamA(LPUNKNOWN pCaller, LPCSTR szURL, DWORD dwReserved,
|
|||
|
||||
TRACE("(%p, %s, 0x%x, %p)\n", pCaller, szURL, dwReserved, lpfnCB);
|
||||
|
||||
if (!szURL)
|
||||
return E_INVALIDARG;
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0);
|
||||
szURLW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
if (!szURLW)
|
||||
|
@ -628,6 +640,9 @@ HRESULT WINAPI URLOpenStreamW(LPUNKNOWN pCaller, LPCWSTR szURL, DWORD dwReserved
|
|||
TRACE("(%p, %s, 0x%x, %p)\n", pCaller, debugstr_w(szURL), dwReserved,
|
||||
lpfnCB);
|
||||
|
||||
if (!szURL)
|
||||
return E_INVALIDARG;
|
||||
|
||||
async_bsc.lpVtbl = &AsyncBindStatusCallbackVtbl;
|
||||
async_bsc.pBSC = lpfnCB;
|
||||
|
||||
|
|
Loading…
Reference in New Issue