From 528ebe204e39d026a3a5478c550643b46328f73b Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 20 Sep 2013 10:54:23 +0000 Subject: [PATCH] [ITSS_WINETEST] * Sync with Wine 1.7.1. CORE-7469 svn path=/trunk/; revision=60245 --- rostests/winetests/itss/CMakeLists.txt | 4 +- rostests/winetests/itss/protocol.c | 113 ++++++++++++------------- rostests/winetests/itss/testlist.c | 5 +- 3 files changed, 54 insertions(+), 68 deletions(-) diff --git a/rostests/winetests/itss/CMakeLists.txt b/rostests/winetests/itss/CMakeLists.txt index 12f29f1fd9d..3fb46188ea9 100644 --- a/rostests/winetests/itss/CMakeLists.txt +++ b/rostests/winetests/itss/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions(-D__ROS_LONG64__) add_executable(itss_winetest protocol.c testlist.c rsrc.rc) -target_link_libraries(itss_winetest wine) set_module_type(itss_winetest win32cui) -add_importlibs(itss_winetest ole32 msvcrt kernel32 ntdll) +add_importlibs(itss_winetest ole32 msvcrt kernel32) add_cd_file(TARGET itss_winetest DESTINATION reactos/bin FOR all) diff --git a/rostests/winetests/itss/protocol.c b/rostests/winetests/itss/protocol.c index b7185025d65..6fd3431c6f5 100644 --- a/rostests/winetests/itss/protocol.c +++ b/rostests/winetests/itss/protocol.c @@ -87,6 +87,8 @@ static const WCHAR blank_url7[] = {'m','k',':','@','M','S','I','T','S','t','o',' 't','e','s','t','.','c','h','m',':',':','\\','b','l','a','n','k','.','h','t','m','l',0}; static const WCHAR blank_url8[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':', 't','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l','/',0}; +static const WCHAR blank_url9[] = {'i','t','s',':', + 't','e','s','t','.','c','h','m',':',':','/','d','i','r','/','.','.','/','b','l','a','n','k','.','h','t','m','l',0}; static enum { ITS_PROTOCOL, @@ -101,6 +103,24 @@ static const WCHAR cache_file3[] = {'t','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l','/',0}; static const WCHAR *cache_file = cache_file1; +static const WCHAR *a2w(const char *str) +{ + static WCHAR bufs[8][128]; + static int i; + + if(!str) + return NULL; + + i = (i+1) % 8; + MultiByteToWideChar(CP_ACP, 0, str, -1, bufs[i], 128); + return bufs[i]; +} + +static int strcmp_wa(const WCHAR *str1, const char *str2) +{ + return lstrcmpW(str1, a2w(str2)); +} + static HRESULT WINAPI ProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv) { if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocolSink, riid)) { @@ -440,65 +460,35 @@ static void test_protocol_url(IClassFactory *factory, LPCWSTR url, BOOL expect_m read_protocol = NULL; } -static const WCHAR rel_url1[] = - {'t','e','s','t','.','h','t','m','l',0}; -static const WCHAR rel_url2[] = - {'t','e','s','t','.','c','h','m',':',':','/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR rel_url3[] = - {'/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR rel_url4[] = - {'t','e',':','t','.','h','t','m','l',0}; -static const WCHAR rel_url5[] = - {'d','i','r','/','t','e','s','t','.','h','t','m','l',0}; - -static const WCHAR base_url1[] = {'i','t','s',':', - 't','e','s','t',':','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0}; -static const WCHAR base_url2[] = {'i','t','s',':','t','e','s','t','.','c','h','m', - ':',':','/','d','i','r','/','b','l','a','n','k','.','h','t','m','l',0}; -static const WCHAR base_url3[] = {'m','s','-','i','t','s',':','t','e','s','t','.','c','h','m', - ':',':','/','d','i','r','/','b','l','a','n','k','.','h','t','m','l',0}; -static const WCHAR base_url4[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':', - 't','e','s','t','.','c','h','m',':',':','/','d','i','r','/', - 'b','l','a','n','k','.','h','t','m','l',0}; -static const WCHAR base_url5[] = {'x','x','x',':','t','e','s','t','.','c','h','m', - ':',':','/','d','i','r','/','b','l','a','n','k','.','h','t','m','l',0}; - -static const WCHAR combined_url1[] = {'i','t','s',':', - 't','e','s','t','.','c','h','m',':',':','/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR combined_url2[] = {'i','t','s',':', - 't','e','s','t','.','c','h','m',':',':','/','d','i','r','/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR combined_url3[] = {'i','t','s',':', - 't','e','s','t',':','.','c','h','m',':',':','/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR combined_url4[] = {'i','t','s',':','t','e','s','t','.','c','h','m', - ':',':','b','l','a','n','k','.','h','t','m','l','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR combined_url5[] = {'m','s','-','i','t','s',':', - 't','e','s','t','.','c','h','m',':',':','/','d','i','r','/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR combined_url6[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':', - 't','e','s','t','.','c','h','m',':',':','/','d','i','r','/','t','e','s','t','.','h','t','m','l',0}; - static const struct { - LPCWSTR base_url; - LPCWSTR rel_url; + const char *base_url; + const char *rel_url; DWORD flags; HRESULT hres; - LPCWSTR combined_url; + const char *combined_url; } combine_tests[] = { - {blank_url1, blank_url1, 0, STG_E_INVALIDNAME, NULL}, - {blank_url2, blank_url2, 0, STG_E_INVALIDNAME, NULL}, - {blank_url1, rel_url1, 0, S_OK, combined_url1}, - {blank_url1, rel_url2, 0, STG_E_INVALIDNAME, NULL}, - {blank_url1, rel_url3, 0, S_OK, combined_url1}, - {blank_url1, rel_url4, 0, STG_E_INVALIDNAME, NULL}, - {blank_url1, rel_url3, URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO, S_OK, combined_url1}, - {blank_url1, rel_url5, 0, S_OK, combined_url2}, - {rel_url1, rel_url2, 0, 0x80041001, NULL}, - {base_url1, rel_url1, 0, S_OK, combined_url3}, - {base_url2, rel_url1, 0, S_OK, combined_url2}, - {blank_url4, rel_url1, 0, S_OK, combined_url4}, - {base_url3, rel_url1, 0, S_OK, combined_url5}, - {base_url4, rel_url1, 0, S_OK, combined_url6}, - {base_url5, rel_url1, 0, INET_E_USE_DEFAULT_PROTOCOLHANDLER, NULL}, - {base_url2, rel_url3, 0, S_OK, combined_url1}, + {"its:test.chm::/blank.html", "its:test.chm::/blank.html", 0, STG_E_INVALIDNAME, NULL}, + {"mS-iTs:test.chm::/blank.html", "mS-iTs:test.chm::/blank.html", 0, STG_E_INVALIDNAME, NULL}, + {"its:test.chm::/blank.html", "test.html", 0, S_OK, "its:test.chm::/test.html"}, + {"its:test.chm::/blank.html", "test.chm::/test.html", 0, STG_E_INVALIDNAME, NULL}, + {"its:test.chm::/blank.html", "/test.html", 0, S_OK, "its:test.chm::/test.html"}, + {"its:test.chm::/blank.html", "te:t.html", 0, STG_E_INVALIDNAME, NULL}, + {"its:test.chm::/blank.html", "/test.html", URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO, S_OK, "its:test.chm::/test.html"}, + {"its:test.chm::/blank.html", "dir/test.html", 0, S_OK, "its:test.chm::/dir/test.html"}, + {"test.html", "test.chm::/test.html", 0, 0x80041001, NULL}, + {"its:test:.chm::/blank.html", "test.html", 0, S_OK, "its:test:.chm::/test.html"}, + {"its:test.chm::/dir/blank.html", "test.html", 0, S_OK, "its:test.chm::/dir/test.html"}, + {"its:test.chm::blank.html", "test.html", 0, S_OK, "its:test.chm::blank.htmltest.html"}, + {"ms-its:test.chm::/dir/blank.html", "test.html", 0, S_OK, "ms-its:test.chm::/dir/test.html"}, + {"mk:@MSITStore:test.chm::/dir/blank.html", "test.html", 0, S_OK, "mk:@MSITStore:test.chm::/dir/test.html"}, + {"xxx:test.chm::/dir/blank.html", "test.html", 0, INET_E_USE_DEFAULT_PROTOCOLHANDLER, NULL}, + {"its:test.chm::/dir/blank.html", "/test.html", 0, S_OK, "its:test.chm::/test.html"}, + {"its:test.chm::/blank.html", "#frag", 0, S_OK, "its:test.chm::/blank.html#frag"}, + {"its:test.chm::/blank.html#hash", "#frag", 0, S_OK, "its:test.chm::/blank.html#hash#frag"}, + {"its:test.chm::/blank.html", "test.html#frag", 0, S_OK, "its:test.chm::/test.html#frag"}, + {"its:test.chm::/blank.html", "/test.html#frag", 0, S_OK, "its:test.chm::/test.html#frag"}, + {"its:test.chm::/blank.html", "?query", 0, S_OK, "its:test.chm::/?query"}, + {"its:test.chm::/blank.html#frag/blank", "test.html", 0, S_OK, "its:test.chm::/blank.html#frag/test.html"}, }; static void test_its_protocol_info(IInternetProtocol *protocol) @@ -525,25 +515,25 @@ static void test_its_protocol_info(IInternetProtocol *protocol) for(i=0; i < sizeof(combine_tests)/sizeof(combine_tests[0]); i++) { size = 0xdeadbeef; memset(buf, 0xfe, sizeof(buf)); - hres = IInternetProtocolInfo_CombineUrl(info, combine_tests[i].base_url, - combine_tests[i].rel_url, combine_tests[i].flags, buf, + hres = IInternetProtocolInfo_CombineUrl(info, a2w(combine_tests[i].base_url), + a2w(combine_tests[i].rel_url), combine_tests[i].flags, buf, sizeof(buf)/sizeof(WCHAR), &size, 0); ok(hres == combine_tests[i].hres, "[%d] CombineUrl returned %08x, expected %08x\n", i, hres, combine_tests[i].hres); - ok(size == (combine_tests[i].combined_url ? lstrlenW(combine_tests[i].combined_url)+1 + ok(size == (combine_tests[i].combined_url ? strlen(combine_tests[i].combined_url)+1 : 0xdeadbeef), "[%d] unexpected size=%d\n", i, size); if(combine_tests[i].combined_url) - ok(!lstrcmpW(combine_tests[i].combined_url, buf), "[%d] unexpected result\n", i); + ok(!strcmp_wa(buf, combine_tests[i].combined_url), "[%d] unexpected result: %s\n", i, wine_dbgstr_w(buf)); else ok(buf[0] == 0xfefe, "buf changed\n"); } size = 0xdeadbeef; memset(buf, 0xfe, sizeof(buf)); - hres = IInternetProtocolInfo_CombineUrl(info, blank_url1, rel_url1, 0, buf, + hres = IInternetProtocolInfo_CombineUrl(info, a2w("its:test.chm::/blank.html"), a2w("test.html"), 0, buf, 1, &size, 0); ok(hres == E_OUTOFMEMORY, "CombineUrl failed: %08x\n", hres); - ok(size == sizeof(combined_url1)/sizeof(WCHAR), "size=%d\n", size); + ok(size == 25, "size=%d\n", size); ok(buf[0] == 0xfefe, "buf changed\n"); IInternetProtocolInfo_Release(info); @@ -612,6 +602,7 @@ static void test_its_protocol(void) test_protocol_url(factory, blank_url5, TRUE); test_protocol_url(factory, blank_url6, TRUE); test_protocol_url(factory, blank_url8, TRUE); + test_protocol_url(factory, blank_url9, TRUE); bindf = BINDF_FROMURLMON | BINDF_NEEDFILE; test_protocol_url(factory, blank_url1, TRUE); } diff --git a/rostests/winetests/itss/testlist.c b/rostests/winetests/itss/testlist.c index 8794b7ca517..871c9834943 100644 --- a/rostests/winetests/itss/testlist.c +++ b/rostests/winetests/itss/testlist.c @@ -1,10 +1,7 @@ /* Automatically generated file; DO NOT EDIT!! */ -#define WIN32_LEAN_AND_MEAN -#include - #define STANDALONE -#include "wine/test.h" +#include extern void func_protocol(void);