urlmon: Fix FindMimeFromData tests on IE7.
This commit is contained in:
parent
748032e0fb
commit
74d49757c7
|
@ -367,14 +367,15 @@ static const WCHAR mimeAppXMSDownload[] =
|
||||||
static const struct {
|
static const struct {
|
||||||
LPCWSTR url;
|
LPCWSTR url;
|
||||||
LPCWSTR mime;
|
LPCWSTR mime;
|
||||||
|
HRESULT hres;
|
||||||
} mime_tests[] = {
|
} mime_tests[] = {
|
||||||
{url1, mimeTextHtml},
|
{url1, mimeTextHtml, S_OK},
|
||||||
{url2, mimeTextHtml},
|
{url2, mimeTextHtml, S_OK},
|
||||||
{url3, mimeTextHtml},
|
{url3, mimeTextHtml, S_OK},
|
||||||
{url4, NULL},
|
{url4, NULL, E_FAIL},
|
||||||
{url5, NULL},
|
{url5, NULL, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)},
|
||||||
{url6, NULL},
|
{url6, NULL, E_FAIL},
|
||||||
{url7, NULL}
|
{url7, NULL, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)}
|
||||||
};
|
};
|
||||||
|
|
||||||
static BYTE data1[] = "test data\n";
|
static BYTE data1[] = "test data\n";
|
||||||
|
@ -539,7 +540,9 @@ static void test_FindMimeFromData(void)
|
||||||
ok(!lstrcmpW(mime, mime_tests[i].mime), "[%d] wrong mime\n", i);
|
ok(!lstrcmpW(mime, mime_tests[i].mime), "[%d] wrong mime\n", i);
|
||||||
CoTaskMemFree(mime);
|
CoTaskMemFree(mime);
|
||||||
}else {
|
}else {
|
||||||
ok(hres == E_FAIL, "[%d] FindMimeFromData failed: %08x, expected E_FAIL\n", i, hres);
|
ok(hres == E_FAIL || hres == mime_tests[i].hres,
|
||||||
|
"[%d] FindMimeFromData failed: %08x, expected %08x\n",
|
||||||
|
i, hres, mime_tests[i].hres);
|
||||||
ok(mime == (LPWSTR)0xf0f0f0f0, "[%d] mime != 0xf0f0f0f0\n", i);
|
ok(mime == (LPWSTR)0xf0f0f0f0, "[%d] mime != 0xf0f0f0f0\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -647,13 +647,13 @@ HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer,
|
||||||
|
|
||||||
res = RegOpenKeyW(HKEY_CLASSES_ROOT, ptr, &hkey);
|
res = RegOpenKeyW(HKEY_CLASSES_ROOT, ptr, &hkey);
|
||||||
if(res != ERROR_SUCCESS)
|
if(res != ERROR_SUCCESS)
|
||||||
return E_FAIL;
|
return HRESULT_FROM_WIN32(res);
|
||||||
|
|
||||||
size = sizeof(mime);
|
size = sizeof(mime);
|
||||||
res = RegQueryValueExW(hkey, wszContentType, NULL, NULL, (LPBYTE)mime, &size);
|
res = RegQueryValueExW(hkey, wszContentType, NULL, NULL, (LPBYTE)mime, &size);
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
if(res != ERROR_SUCCESS)
|
if(res != ERROR_SUCCESS)
|
||||||
return E_FAIL;
|
return HRESULT_FROM_WIN32(res);
|
||||||
|
|
||||||
*ppwzMimeOut = CoTaskMemAlloc(size);
|
*ppwzMimeOut = CoTaskMemAlloc(size);
|
||||||
memcpy(*ppwzMimeOut, mime, size);
|
memcpy(*ppwzMimeOut, mime, size);
|
||||||
|
|
Loading…
Reference in New Issue