urlmon/tests: Fix test on win98.

This commit is contained in:
Paul Vriens 2008-09-05 11:14:59 +02:00 committed by Alexandre Julliard
parent b0f52410e9
commit f0bed78455
1 changed files with 13 additions and 13 deletions

View File

@ -76,6 +76,7 @@ DEFINE_EXPECT(OnStopBinding);
DEFINE_EXPECT(OnDataAvailable); DEFINE_EXPECT(OnDataAvailable);
DEFINE_EXPECT(GetBindInfo); DEFINE_EXPECT(GetBindInfo);
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 WCHAR INDEX_HTML[MAX_PATH]; static WCHAR INDEX_HTML[MAX_PATH];
static const char szHtmlDoc[] = "<HTML></HTML>"; static const char szHtmlDoc[] = "<HTML></HTML>";
@ -260,26 +261,22 @@ static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
static IBindStatusCallback BindStatusCallback = { &BindStatusCallbackVtbl }; static IBindStatusCallback BindStatusCallback = { &BindStatusCallbackVtbl };
static void set_file_url(void) static void set_file_url(char *path)
{ {
int len; char INDEX_HTML_A[MAX_PATH];
static const WCHAR wszFile[] = {'f','i','l','e',':','/','/'}; lstrcpyA(INDEX_HTML_A, "file:///");
lstrcatA(INDEX_HTML_A, path);
memcpy(INDEX_HTML, wszFile, sizeof(wszFile)); MultiByteToWideChar(CP_ACP, 0, INDEX_HTML_A, -1, INDEX_HTML, MAX_PATH);
len = sizeof(wszFile)/sizeof(WCHAR);
INDEX_HTML[len++] = '/';
len += GetCurrentDirectoryW(sizeof(INDEX_HTML)/sizeof(WCHAR)-len, INDEX_HTML+len);
INDEX_HTML[len++] = '\\';
memcpy(INDEX_HTML+len, wszIndexHtml, sizeof(wszIndexHtml));
} }
static void create_file(void) static void create_file(void)
{ {
HANDLE file; HANDLE file;
DWORD size; DWORD size;
CHAR path[MAX_PATH];
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)
@ -288,7 +285,10 @@ static void create_file(void)
WriteFile(file, szHtmlDoc, sizeof(szHtmlDoc)-1, &size, NULL); WriteFile(file, szHtmlDoc, sizeof(szHtmlDoc)-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_URLOpenBlockingStreamW(void) static void test_URLOpenBlockingStreamW(void)
@ -370,5 +370,5 @@ START_TEST(stream)
create_file(); create_file();
test_URLOpenBlockingStreamW(); test_URLOpenBlockingStreamW();
test_URLOpenStreamW(); test_URLOpenStreamW();
DeleteFileW(wszIndexHtml); DeleteFileA(wszIndexHtmlA);
} }