sync urlmon winetest to wine 1.1.11

svn path=/trunk/; revision=38443
This commit is contained in:
Christoph von Wittich 2008-12-29 08:42:01 +00:00
parent da37905468
commit 00f0db8d9a
3 changed files with 125 additions and 78 deletions

View file

@ -350,7 +350,8 @@ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOL
CHECK_CALLED(ReportProgress_CONNECTING); CHECK_CALLED(ReportProgress_CONNECTING);
} else todo_wine { } else todo_wine {
CHECK_NOT_CALLED(ReportProgress_FINDINGRESOURCE); CHECK_NOT_CALLED(ReportProgress_FINDINGRESOURCE);
CHECK_NOT_CALLED(ReportProgress_CONNECTING); /* IE7 does call this */
CLEAR_CALLED(ReportProgress_CONNECTING);
} }
CHECK_CALLED(ReportProgress_SENDINGREQUEST); CHECK_CALLED(ReportProgress_SENDINGREQUEST);
SET_EXPECT(OnResponse); SET_EXPECT(OnResponse);
@ -754,6 +755,12 @@ static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID r
return S_OK; return S_OK;
} }
if(IsEqualGUID(&IID_IInternetProtocolEx, riid)) {
trace("IID_IInternetProtocolEx not supported\n");
*ppv = NULL;
return E_NOINTERFACE;
}
if(IsEqualGUID(&IID_IInternetPriority, riid)) { if(IsEqualGUID(&IID_IInternetPriority, riid)) {
*ppv = &InternetPriority; *ppv = &InternetPriority;
return S_OK; return S_OK;
@ -871,6 +878,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
LPWSTR additional_headers = NULL; LPWSTR additional_headers = NULL;
BYTE sec_id[100]; BYTE sec_id[100];
DWORD fetched = 0, size = 100; DWORD fetched = 0, size = 100;
DWORD tid;
SET_EXPECT(GetBindString_USER_AGENT); SET_EXPECT(GetBindString_USER_AGENT);
hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_USER_AGENT, hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_USER_AGENT,
@ -927,7 +935,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
IServiceProvider_Release(service_provider); IServiceProvider_Release(service_provider);
CreateThread(NULL, 0, thread_proc, NULL, 0, NULL); CreateThread(NULL, 0, thread_proc, NULL, 0, &tid);
return S_OK; return S_OK;
} }
@ -1192,7 +1200,7 @@ static void test_priority(IInternetProtocol *protocol)
IInternetPriority_Release(priority); IInternetPriority_Release(priority);
} }
static void file_protocol_start(IInternetProtocol *protocol, LPCWSTR url, BOOL is_first) static BOOL file_protocol_start(IInternetProtocol *protocol, LPCWSTR url, BOOL is_first)
{ {
HRESULT hres; HRESULT hres;
@ -1214,6 +1222,10 @@ static void file_protocol_start(IInternetProtocol *protocol, LPCWSTR url, BOOL i
expect_hrResult = S_OK; expect_hrResult = S_OK;
hres = IInternetProtocol_Start(protocol, url, &protocol_sink, &bind_info, 0, 0); hres = IInternetProtocol_Start(protocol, url, &protocol_sink, &bind_info, 0, 0);
if(hres == INET_E_RESOURCE_NOT_FOUND) {
win_skip("Start failed\n");
return FALSE;
}
ok(hres == S_OK, "Start failed: %08x\n", hres); ok(hres == S_OK, "Start failed: %08x\n", hres);
CHECK_CALLED(GetBindInfo); CHECK_CALLED(GetBindInfo);
@ -1230,6 +1242,8 @@ static void file_protocol_start(IInternetProtocol *protocol, LPCWSTR url, BOOL i
CHECK_CALLED(ReportData); CHECK_CALLED(ReportData);
if(is_first) if(is_first)
CHECK_CALLED(ReportResult); CHECK_CALLED(ReportResult);
return TRUE;
} }
static void test_file_protocol_url(LPCWSTR url) static void test_file_protocol_url(LPCWSTR url)
@ -1242,7 +1256,7 @@ static void test_file_protocol_url(LPCWSTR url)
hres = CoGetClassObject(&CLSID_FileProtocol, CLSCTX_INPROC_SERVER, NULL, hres = CoGetClassObject(&CLSID_FileProtocol, CLSCTX_INPROC_SERVER, NULL,
&IID_IUnknown, (void**)&unk); &IID_IUnknown, (void**)&unk);
ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres); ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
if(!SUCCEEDED(hres)) if(FAILED(hres))
return; return;
hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info); hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
@ -1259,25 +1273,27 @@ static void test_file_protocol_url(LPCWSTR url)
ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres); ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
file_protocol_start(protocol, url, TRUE); if(file_protocol_start(protocol, url, TRUE)) {
hres = IInternetProtocol_Read(protocol, buf, 2, &cb); hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
ok(hres == S_OK, "Read failed: %08x\n", hres); ok(hres == S_OK, "Read failed: %08x\n", hres);
ok(cb == 2, "cb=%u expected 2\n", cb); ok(cb == 2, "cb=%u expected 2\n", cb);
hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb); hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
ok(hres == S_FALSE, "Read failed: %08x\n", hres); ok(hres == S_FALSE, "Read failed: %08x\n", hres);
hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb); hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
ok(hres == S_FALSE, "Read failed: %08x expected S_FALSE\n", hres); ok(hres == S_FALSE, "Read failed: %08x expected S_FALSE\n", hres);
ok(cb == 0, "cb=%u expected 0\n", cb); ok(cb == 0, "cb=%u expected 0\n", cb);
hres = IInternetProtocol_UnlockRequest(protocol); hres = IInternetProtocol_UnlockRequest(protocol);
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
}
file_protocol_start(protocol, url, FALSE); if(file_protocol_start(protocol, url, FALSE)) {
hres = IInternetProtocol_Read(protocol, buf, 2, &cb); hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
ok(hres == S_FALSE, "Read failed: %08x\n", hres); ok(hres == S_FALSE, "Read failed: %08x\n", hres);
hres = IInternetProtocol_LockRequest(protocol, 0); hres = IInternetProtocol_LockRequest(protocol, 0);
ok(hres == S_OK, "LockRequest failed: %08x\n", hres); ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
hres = IInternetProtocol_UnlockRequest(protocol); hres = IInternetProtocol_UnlockRequest(protocol);
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
}
IInternetProtocol_Release(protocol); IInternetProtocol_Release(protocol);
} }
@ -1286,19 +1302,20 @@ static void test_file_protocol_url(LPCWSTR url)
ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres); ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
file_protocol_start(protocol, url, TRUE); if(file_protocol_start(protocol, url, TRUE)) {
hres = IInternetProtocol_LockRequest(protocol, 0); hres = IInternetProtocol_LockRequest(protocol, 0);
ok(hres == S_OK, "LockRequest failed: %08x\n", hres); ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
hres = IInternetProtocol_Terminate(protocol, 0); hres = IInternetProtocol_Terminate(protocol, 0);
ok(hres == S_OK, "Terminate failed: %08x\n", hres); ok(hres == S_OK, "Terminate failed: %08x\n", hres);
hres = IInternetProtocol_Read(protocol, buf, 2, &cb); hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
ok(hres == S_OK, "Read failed: %08x\n\n", hres); ok(hres == S_OK, "Read failed: %08x\n\n", hres);
hres = IInternetProtocol_UnlockRequest(protocol); hres = IInternetProtocol_UnlockRequest(protocol);
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
hres = IInternetProtocol_Read(protocol, buf, 2, &cb); hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
ok(hres == S_OK, "Read failed: %08x\n", hres); ok(hres == S_OK, "Read failed: %08x\n", hres);
hres = IInternetProtocol_Terminate(protocol, 0); hres = IInternetProtocol_Terminate(protocol, 0);
ok(hres == S_OK, "Terminate failed: %08x\n", hres); ok(hres == S_OK, "Terminate failed: %08x\n", hres);
}
IInternetProtocol_Release(protocol); IInternetProtocol_Release(protocol);
} }
@ -1307,12 +1324,13 @@ static void test_file_protocol_url(LPCWSTR url)
ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres); ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
file_protocol_start(protocol, url, TRUE); if(file_protocol_start(protocol, url, TRUE)) {
hres = IInternetProtocol_Terminate(protocol, 0); hres = IInternetProtocol_Terminate(protocol, 0);
ok(hres == S_OK, "Terminate failed: %08x\n", hres); ok(hres == S_OK, "Terminate failed: %08x\n", hres);
hres = IInternetProtocol_Read(protocol, buf, 2, &cb); hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
ok(hres == S_OK, "Read failed: %08x\n", hres); ok(hres == S_OK, "Read failed: %08x\n", hres);
ok(cb == 2, "cb=%u expected 2\n", cb); ok(cb == 2, "cb=%u expected 2\n", cb);
}
IInternetProtocol_Release(protocol); IInternetProtocol_Release(protocol);
} }
@ -1411,8 +1429,14 @@ static void test_file_protocol(void) {
trace("Testing file protocol...\n"); trace("Testing file protocol...\n");
tested_protocol = FILE_TEST; tested_protocol = FILE_TEST;
SetLastError(0xdeadbeef);
file = CreateFileW(wszIndexHtml, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, file = CreateFileW(wszIndexHtml, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL); FILE_ATTRIBUTE_NORMAL, NULL);
if(!file && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("Detected Win9x or WinMe\n");
return;
}
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n"); ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
if(file == INVALID_HANDLE_VALUE) if(file == INVALID_HANDLE_VALUE)
return; return;
@ -1535,7 +1559,7 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
hres = CoGetClassObject(&CLSID_HttpProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk); hres = CoGetClassObject(&CLSID_HttpProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres); ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
if(!SUCCEEDED(hres)) if(FAILED(hres))
return; return;
hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info); hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
@ -1555,7 +1579,6 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
BYTE buf[3600]; BYTE buf[3600];
DWORD cb; DWORD cb;
int *called = (bindf & BINDF_FROMURLMON) ? &called_Switch : &called_ReportData;
test_priority(http_protocol); test_priority(http_protocol);
@ -1577,8 +1600,8 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
expect_hrResult = S_OK; expect_hrResult = S_OK;
hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb); hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
ok((!*called && hres == E_PENDING && cb==0) || ok((hres == E_PENDING && cb==0) ||
(*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb); (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE); WaitForSingleObject(event_complete, INFINITE);
if(bindf & BINDF_FROMURLMON) if(bindf & BINDF_FROMURLMON)
@ -1594,8 +1617,8 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
hres = IInternetProtocol_Read(http_protocol, buf, sizeof(buf), &cb); hres = IInternetProtocol_Read(http_protocol, buf, sizeof(buf), &cb);
if(hres == E_PENDING) { if(hres == E_PENDING) {
hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb); hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
ok((!*called && hres == E_PENDING && cb==0) || ok((hres == E_PENDING && cb==0) ||
(*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb); (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE); WaitForSingleObject(event_complete, INFINITE);
if(bindf & BINDF_FROMURLMON) if(bindf & BINDF_FROMURLMON)
CHECK_CALLED(Switch); CHECK_CALLED(Switch);

View file

@ -6,8 +6,18 @@
#define STANDALONE #define STANDALONE
#include "wine/test.h" #include "wine/test.h"
extern void func_generated(void);
extern void func_misc(void);
extern void func_protocol(void);
extern void func_stream(void);
extern void func_url(void);
const struct test winetest_testlist[] = const struct test winetest_testlist[] =
{ {
{ "generated", func_generated },
{ "misc", func_misc },
{ "protocol", func_protocol },
{ "stream", func_stream },
{ "url", func_url },
{ 0, 0 } { 0, 0 }
}; };

View file

@ -147,8 +147,10 @@ static const WCHAR wszWineHQSite[] =
{'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}; {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
static const WCHAR wszWineHQIP[] = static const WCHAR wszWineHQIP[] =
{'2','0','9','.','3','2','.','1','4','1','.','3',0}; {'2','0','9','.','3','2','.','1','4','1','.','3',0};
static const CHAR wszIndexHtmlA[] = "index.html";
static const WCHAR wszIndexHtml[] = {'i','n','d','e','x','.','h','t','m','l',0}; static const WCHAR wszIndexHtml[] = {'i','n','d','e','x','.','h','t','m','l',0};
static const WCHAR cache_fileW[] = {'c',':','\\','c','a','c','h','e','.','h','t','m',0}; static const WCHAR cache_fileW[] = {'c',':','\\','c','a','c','h','e','.','h','t','m',0};
static const CHAR dwl_htmlA[] = "dwl.html";
static const WCHAR dwl_htmlW[] = {'d','w','l','.','h','t','m','l',0}; static const WCHAR dwl_htmlW[] = {'d','w','l','.','h','t','m','l',0};
static const WCHAR emptyW[] = {0}; static const WCHAR emptyW[] = {0};
@ -159,6 +161,7 @@ static CHAR mime_type[512];
static IInternetProtocolSink *protocol_sink = NULL; static IInternetProtocolSink *protocol_sink = NULL;
static HANDLE complete_event, complete_event2; static HANDLE complete_event, complete_event2;
static HRESULT binding_hres; static HRESULT binding_hres;
static BOOL have_IHttpNegotiate2;
static LPCWSTR urls[] = { static LPCWSTR urls[] = {
WINE_ABOUT_URL, WINE_ABOUT_URL,
@ -1824,6 +1827,7 @@ static void test_bscholder(IBindStatusCallback *holder)
hres = IBindStatusCallback_QueryInterface(holder, &IID_IHttpNegotiate2, (void**)&http_negotiate2); hres = IBindStatusCallback_QueryInterface(holder, &IID_IHttpNegotiate2, (void**)&http_negotiate2);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
have_IHttpNegotiate2 = TRUE;
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, (void*)0xdeadbeef, (void*)0xdeadbeef, 0); hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, (void*)0xdeadbeef, (void*)0xdeadbeef, 0);
ok(hres == E_FAIL, "GetRootSecurityId failed: %08x\n", hres); ok(hres == E_FAIL, "GetRootSecurityId failed: %08x\n", hres);
@ -2113,16 +2117,18 @@ static void test_BindToStorage(int protocol, BOOL emul, DWORD t)
CLEAR_CALLED(QueryService_IInternetBindInfo); CLEAR_CALLED(QueryService_IInternetBindInfo);
CHECK_CALLED(QueryInterface_IHttpNegotiate); CHECK_CALLED(QueryInterface_IHttpNegotiate);
CHECK_CALLED(BeginningTransaction); CHECK_CALLED(BeginningTransaction);
/* QueryInterface_IHttpNegotiate2 and GetRootSecurityId if (have_IHttpNegotiate2)
* called on WinXP but not on Win98 */ {
CLEAR_CALLED(QueryInterface_IHttpNegotiate2); CHECK_CALLED(QueryInterface_IHttpNegotiate2);
CLEAR_CALLED(GetRootSecurityId); CHECK_CALLED(GetRootSecurityId);
}
if(http_is_first) { if(http_is_first) {
CHECK_CALLED(OnProgress_FINDINGRESOURCE); CHECK_CALLED(OnProgress_FINDINGRESOURCE);
CHECK_CALLED(OnProgress_CONNECTING); CHECK_CALLED(OnProgress_CONNECTING);
}else todo_wine { }else todo_wine {
CHECK_NOT_CALLED(OnProgress_FINDINGRESOURCE); CHECK_NOT_CALLED(OnProgress_FINDINGRESOURCE);
CHECK_NOT_CALLED(OnProgress_CONNECTING); /* IE7 does call this */
CLEAR_CALLED(OnProgress_CONNECTING);
} }
} }
if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST) if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST)
@ -2272,16 +2278,18 @@ static void test_BindToObject(int protocol, BOOL emul)
if(test_protocol == HTTP_TEST) { if(test_protocol == HTTP_TEST) {
CHECK_CALLED(QueryInterface_IHttpNegotiate); CHECK_CALLED(QueryInterface_IHttpNegotiate);
CHECK_CALLED(BeginningTransaction); CHECK_CALLED(BeginningTransaction);
/* QueryInterface_IHttpNegotiate2 and GetRootSecurityId if (have_IHttpNegotiate2)
* called on WinXP but not on Win98 */ {
CLEAR_CALLED(QueryInterface_IHttpNegotiate2); CHECK_CALLED(QueryInterface_IHttpNegotiate2);
CLEAR_CALLED(GetRootSecurityId); CHECK_CALLED(GetRootSecurityId);
}
if(http_is_first) { if(http_is_first) {
CHECK_CALLED(Obj_OnProgress_FINDINGRESOURCE); CHECK_CALLED(Obj_OnProgress_FINDINGRESOURCE);
CHECK_CALLED(Obj_OnProgress_CONNECTING); CHECK_CALLED(Obj_OnProgress_CONNECTING);
}else todo_wine { }else todo_wine {
CHECK_NOT_CALLED(Obj_OnProgress_FINDINGRESOURCE); CHECK_NOT_CALLED(Obj_OnProgress_FINDINGRESOURCE);
CHECK_NOT_CALLED(Obj_OnProgress_CONNECTING); /* IE7 does call this */
CLEAR_CALLED(Obj_OnProgress_CONNECTING);
} }
} }
if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST) { if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST) {
@ -2313,7 +2321,7 @@ static void test_BindToObject(int protocol, BOOL emul)
todo_wine ok(IMoniker_Release(mon) == 0, "mon should be destroyed here\n"); todo_wine ok(IMoniker_Release(mon) == 0, "mon should be destroyed here\n");
if(bindf & BINDF_ASYNCHRONOUS) if(bindf & BINDF_ASYNCHRONOUS)
ok(IBindCtx_Release(bctx) != 0, "bctx should not be destroyed here\n"); IBindCtx_Release(bctx);
else else
todo_wine ok(IBindCtx_Release(bctx) == 0, "bctx should be destroyed here\n"); todo_wine ok(IBindCtx_Release(bctx) == 0, "bctx should be destroyed here\n");
} }
@ -2380,11 +2388,16 @@ static void test_URLDownloadToFile(DWORD prot, BOOL emul)
if(test_protocol == HTTP_TEST) { if(test_protocol == HTTP_TEST) {
CHECK_CALLED(QueryInterface_IHttpNegotiate); CHECK_CALLED(QueryInterface_IHttpNegotiate);
CHECK_CALLED(BeginningTransaction); CHECK_CALLED(BeginningTransaction);
CHECK_CALLED(QueryInterface_IHttpNegotiate2); if (have_IHttpNegotiate2)
CHECK_CALLED(GetRootSecurityId); {
CHECK_CALLED(QueryInterface_IHttpNegotiate2);
CHECK_CALLED(GetRootSecurityId);
}
} }
if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST) if(test_protocol == FILE_TEST)
CHECK_CALLED(OnProgress_SENDINGREQUEST); CHECK_CALLED(OnProgress_SENDINGREQUEST);
else if(test_protocol == HTTP_TEST)
CLEAR_CALLED(OnProgress_SENDINGREQUEST); /* not called by IE7 */
if(test_protocol == HTTP_TEST) if(test_protocol == HTTP_TEST)
CHECK_CALLED(OnResponse); CHECK_CALLED(OnResponse);
CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE); CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
@ -2397,7 +2410,7 @@ static void test_URLDownloadToFile(DWORD prot, BOOL emul)
CHECK_CALLED(OnStopBinding); CHECK_CALLED(OnStopBinding);
} }
res = DeleteFileW(dwl_htmlW); res = DeleteFileA(dwl_htmlA);
ok(res, "DeleteFile failed: %u\n", GetLastError()); ok(res, "DeleteFile failed: %u\n", GetLastError());
if(prot != FILE_TEST || emul) if(prot != FILE_TEST || emul)
@ -2406,35 +2419,33 @@ static void test_URLDownloadToFile(DWORD prot, BOOL emul)
hres = URLDownloadToFileW(NULL, urls[test_protocol], dwl_htmlW, 0, NULL); hres = URLDownloadToFileW(NULL, urls[test_protocol], dwl_htmlW, 0, NULL);
ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres); ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres);
res = DeleteFileW(dwl_htmlW); res = DeleteFileA(dwl_htmlA);
ok(res, "DeleteFile failed: %u\n", GetLastError()); ok(res, "DeleteFile failed: %u\n", GetLastError());
} }
static void set_file_url(void) static void set_file_url(char *path)
{ {
int len; CHAR file_urlA[INTERNET_MAX_URL_LENGTH];
CHAR INDEX_HTMLA[MAX_PATH];
static const WCHAR wszFile[] = {'f','i','l','e',':','/','/'}; lstrcpyA(file_urlA, "file:///");
lstrcatA(file_urlA, path);
MultiByteToWideChar(CP_ACP, 0, file_urlA, -1, file_url, INTERNET_MAX_URL_LENGTH);
memcpy(file_url, wszFile, sizeof(wszFile)); lstrcpyA(INDEX_HTMLA, "file://");
len = sizeof(wszFile)/sizeof(WCHAR); lstrcatA(INDEX_HTMLA, path);
file_url[len++] = '/'; MultiByteToWideChar(CP_ACP, 0, INDEX_HTMLA, -1, INDEX_HTML, MAX_PATH);
len += GetCurrentDirectoryW(sizeof(file_url)/sizeof(WCHAR)-len, file_url+len);
file_url[len++] = '\\';
memcpy(file_url+len, wszIndexHtml, sizeof(wszIndexHtml));
memcpy(INDEX_HTML, wszFile, sizeof(wszIndexHtml));
memmove(INDEX_HTML+7, file_url+8, (lstrlenW(file_url+8)+1)*sizeof(WCHAR));
} }
static void create_file(void) static void create_file(void)
{ {
HANDLE file; HANDLE file;
DWORD size; DWORD size;
CHAR path[MAX_PATH];
static const char html_doc[] = "<HTML></HTML>"; static const char html_doc[] = "<HTML></HTML>";
file = CreateFileW(wszIndexHtml, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, file = CreateFileA(wszIndexHtmlA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL); FILE_ATTRIBUTE_NORMAL, NULL);
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n"); ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
if(file == INVALID_HANDLE_VALUE) if(file == INVALID_HANDLE_VALUE)
@ -2443,7 +2454,10 @@ static void create_file(void)
WriteFile(file, html_doc, sizeof(html_doc)-1, &size, NULL); WriteFile(file, html_doc, sizeof(html_doc)-1, &size, NULL);
CloseHandle(file); CloseHandle(file);
set_file_url(); GetCurrentDirectoryA(MAX_PATH, path);
lstrcatA(path, "\\");
lstrcatA(path, wszIndexHtmlA);
set_file_url(path);
} }
static void test_ReportResult(HRESULT exhres) static void test_ReportResult(HRESULT exhres)
@ -2661,7 +2675,7 @@ START_TEST(url)
trace("test failures...\n"); trace("test failures...\n");
test_BindToStorage_fail(); test_BindToStorage_fail();
DeleteFileW(wszIndexHtml); DeleteFileA(wszIndexHtmlA);
CloseHandle(complete_event); CloseHandle(complete_event);
CloseHandle(complete_event2); CloseHandle(complete_event2);
CoUninitialize(); CoUninitialize();