[URLMON_WINETEST]
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 28 Sep 2013 15:09:44 +0000 (15:09 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 28 Sep 2013 15:09:44 +0000 (15:09 +0000)
* Sync with Wine 1.7.1.
CORE-7469

svn path=/trunk/; revision=60417

rostests/winetests/urlmon/CMakeLists.txt
rostests/winetests/urlmon/generated.c
rostests/winetests/urlmon/misc.c
rostests/winetests/urlmon/protocol.c
rostests/winetests/urlmon/sec_mgr.c
rostests/winetests/urlmon/uri.c
rostests/winetests/urlmon/url.c

index 540a7c7..1e65176 100644 (file)
@@ -1,8 +1,4 @@
 
-remove_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502)
-
-add_definitions(-D__ROS_LONG64__)
-
 list(APPEND SOURCE
     generated.c
     misc.c
@@ -14,7 +10,7 @@ list(APPEND SOURCE
     testlist.c)
 
 add_executable(urlmon_winetest ${SOURCE})
-target_link_libraries(urlmon_winetest wine uuid)
+target_link_libraries(urlmon_winetest uuid)
 set_module_type(urlmon_winetest win32cui)
-add_importlibs(urlmon_winetest urlmon wininet ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll)
+add_importlibs(urlmon_winetest urlmon wininet ole32 oleaut32 user32 advapi32 msvcrt kernel32)
 add_cd_file(TARGET urlmon_winetest DESTINATION reactos/bin FOR all)
index 1389350..20594d9 100644 (file)
@@ -9,9 +9,11 @@
 #define _INC_WINDOWS
 #define COM_NO_WINDOWS_H
 
+#ifndef __REACTOS__
 #define WINVER 0x0501
 #define _WIN32_IE 0x0501
 #define _WIN32_WINNT 0x0501
+#endif
 
 #define WINE_NOWINSOCK
 
index 04a7de0..44483ed 100644 (file)
@@ -31,6 +31,7 @@
 //#include "windef.h"
 //#include "winbase.h"
 #include <winreg.h>
+#include <winnls.h>
 #include <ole2.h>
 //#include "urlmon.h"
 
@@ -85,6 +86,33 @@ static HRESULT (WINAPI *pCoInternetIsFeatureEnabled)(INTERNETFEATURELIST,DWORD);
 static HRESULT (WINAPI *pCoInternetSetFeatureEnabled)(INTERNETFEATURELIST,DWORD,BOOL);
 static HRESULT (WINAPI *pIEInstallScope)(DWORD*);
 
+static int strcmp_wa(const WCHAR *strw, const char *stra)
+{
+    WCHAR buf[512];
+    MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, sizeof(buf)/sizeof(WCHAR));
+    return lstrcmpW(strw, buf);
+}
+
+static void heap_free(void *mem)
+{
+    HeapFree(GetProcessHeap(), 0, mem);
+}
+
+static WCHAR *a2w(const char *str)
+{
+    WCHAR *ret;
+    int len;
+
+    if(!str)
+        return NULL;
+
+    len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
+    ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
+
+    return ret;
+}
+
 static void test_CreateFormatEnum(void)
 {
     IEnumFORMATETC *fenum = NULL, *fenum2 = NULL;
@@ -442,42 +470,14 @@ static void test_CoInternetQueryInfo(void)
     }
 }
 
-static const WCHAR mimeTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
-static const WCHAR mimeTextPlain[] = {'t','e','x','t','/','p','l','a','i','n',0};
-static const WCHAR mimeTextRichtext[] = {'t','e','x','t','/','r','i','c','h','t','e','x','t',0};
-static const WCHAR mimeTextXml[] = {'t','e','x','t','/','x','m','l',0};
-static const WCHAR mimeAppOctetStream[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
-    'o','c','t','e','t','-','s','t','r','e','a','m',0};
-static const WCHAR mimeImagePjpeg[] = {'i','m','a','g','e','/','p','j','p','e','g',0};
-static const WCHAR mimeImageGif[] = {'i','m','a','g','e','/','g','i','f',0};
-static const WCHAR mimeImageBmp[] = {'i','m','a','g','e','/','b','m','p',0};
-static const WCHAR mimeImageXPng[] = {'i','m','a','g','e','/','x','-','p','n','g',0};
-static const WCHAR mimeImageTiff[] = {'i','m','a','g','e','/','t','i','f','f',0};
-static const WCHAR mimeVideoAvi[] = {'v','i','d','e','o','/','a','v','i',0};
-static const WCHAR mimeVideoMpeg[] = {'v','i','d','e','o','/','m','p','e','g',0};
-static const WCHAR mimeAppPostscript[] =
-    {'a','p','p','l','i','c','a','t','i','o','n','/','p','o','s','t','s','c','r','i','p','t',0};
-static const WCHAR mimeAppXCompressed[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
-                                    'x','-','c','o','m','p','r','e','s','s','e','d',0};
-static const WCHAR mimeAppXZip[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
-                                    'x','-','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
-static const WCHAR mimeAppXGzip[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
-                                    'x','-','g','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
-static const WCHAR mimeAppJava[] = {'a','p','p','l','i','c','a','t','i','o','n','/','j','a','v','a',0};
-static const WCHAR mimeAppPdf[] = {'a','p','p','l','i','c','a','t','i','o','n','/','p','d','f',0};
-static const WCHAR mimeAppXMSDownload[] =
-    {'a','p','p','l','i','c','a','t','i','o','n','/','x','-','m','s','d','o','w','n','l','o','a','d',0};
-static const WCHAR mimeAudioWav[] = {'a','u','d','i','o','/','w','a','v',0};
-static const WCHAR mimeAudioBasic[] = {'a','u','d','i','o','/','b','a','s','i','c',0};
-
 static const struct {
-    LPCWSTR url;
-    LPCWSTR mime;
+    const WCHAR *url;
+    const char *mime;
     HRESULT hres;
 } mime_tests[] = {
-    {url1, mimeTextHtml, S_OK},
-    {url2, mimeTextHtml, S_OK},
-    {url3, mimeTextHtml, S_OK},
+    {url1, "text/html", S_OK},
+    {url2, "text/html", S_OK},
+    {url3, "text/html", S_OK},
     {url4, NULL, E_FAIL},
     {url5, NULL, __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)},
     {url6, NULL, E_FAIL},
@@ -584,119 +584,140 @@ static BYTE data96[] = {'<','?','x','m','l',' '};
 static const struct {
     BYTE *data;
     DWORD size;
-    LPCWSTR mime, mime_pjpeg, broken_mime;
+    const char *mime;
+    const char *mime_pjpeg;
+    const char *broken_mime;
+    const char *url;
+    const char *proposed_mime;
 } mime_tests2[] = {
-    {data1, sizeof(data1), mimeTextPlain, mimeTextPlain},
-    {data2, sizeof(data2), mimeAppOctetStream, mimeImagePjpeg},
-    {data3, sizeof(data3), mimeAppOctetStream, mimeImagePjpeg},
-    {data4, sizeof(data4), mimeAppOctetStream, mimeImagePjpeg},
-    {data5, sizeof(data5), mimeTextPlain, mimeTextPlain},
-    {data6, sizeof(data6), mimeTextPlain, mimeTextPlain},
-    {data7, sizeof(data7), mimeTextHtml, mimeTextPlain},
-    {data8, sizeof(data8), mimeTextHtml, mimeTextPlain},
-    {data9, sizeof(data9), mimeTextHtml, mimeImagePjpeg},
-    {data10, sizeof(data10), mimeTextHtml, mimeTextPlain},
-    {data11, sizeof(data11), mimeTextHtml, mimeTextPlain},
-    {data12, sizeof(data12), mimeTextHtml, mimeTextPlain},
-    {data13, sizeof(data13), mimeTextPlain, mimeTextPlain},
-    {data14, sizeof(data14), mimeTextPlain, mimeTextPlain},
-    {data15, sizeof(data15), mimeTextPlain, mimeTextPlain},
-    {data16, sizeof(data16), mimeImagePjpeg, mimeImagePjpeg},
-    {data17, sizeof(data17), mimeAppOctetStream, mimeImagePjpeg},
-    {data18, sizeof(data18), mimeTextHtml, mimeImagePjpeg},
-    {data19, sizeof(data19), mimeImageGif, mimeImageGif},
-    {data20, sizeof(data20), mimeImageGif, mimeImageGif},
-    {data21, sizeof(data21), mimeTextPlain, mimeTextPlain},
-    {data22, sizeof(data22), mimeImageGif, mimeImageGif},
-    {data23, sizeof(data23), mimeTextPlain, mimeTextPlain},
-    {data24, sizeof(data24), mimeImageGif, mimeImageGif},
-    {data25, sizeof(data25), mimeImageGif, mimeImageGif},
-    {data26, sizeof(data26), mimeTextHtml, mimeImageGif},
-    {data27, sizeof(data27), mimeTextPlain, mimeTextPlain},
-    {data28, sizeof(data28), mimeImageBmp, mimeImageBmp},
-    {data29, sizeof(data29), mimeImageBmp, mimeImageBmp},
-    {data30, sizeof(data30), mimeAppOctetStream, mimeImagePjpeg},
-    {data31, sizeof(data31), mimeTextHtml, mimeImageBmp},
-    {data32, sizeof(data32), mimeAppOctetStream, mimeImagePjpeg},
-    {data33, sizeof(data33), mimeAppOctetStream, mimeImagePjpeg},
-    {data34, sizeof(data34), mimeImageXPng, mimeImageXPng},
-    {data35, sizeof(data35), mimeImageXPng, mimeImageXPng},
-    {data36, sizeof(data36), mimeAppOctetStream, mimeImagePjpeg},
-    {data37, sizeof(data37), mimeTextHtml, mimeImageXPng},
-    {data38, sizeof(data38), mimeAppOctetStream, mimeImagePjpeg},
-    {data39, sizeof(data39), mimeImageTiff, mimeImageTiff},
-    {data40, sizeof(data40), mimeTextHtml, mimeImageTiff},
-    {data41, sizeof(data41), mimeTextPlain, mimeTextPlain, mimeImageTiff},
-    {data42, sizeof(data42), mimeTextPlain, mimeTextPlain},
-    {data43, sizeof(data43), mimeAppOctetStream, mimeImagePjpeg},
-    {data44, sizeof(data44), mimeVideoAvi, mimeVideoAvi},
-    {data45, sizeof(data45), mimeTextPlain, mimeTextPlain},
-    {data46, sizeof(data46), mimeTextPlain, mimeTextPlain},
-    {data47, sizeof(data47), mimeTextPlain, mimeTextPlain},
-    {data48, sizeof(data48), mimeTextHtml, mimeVideoAvi},
-    {data49, sizeof(data49), mimeVideoAvi, mimeVideoAvi},
-    {data50, sizeof(data50), mimeVideoMpeg, mimeVideoMpeg},
-    {data51, sizeof(data51), mimeVideoMpeg, mimeVideoMpeg},
-    {data52, sizeof(data52), mimeAppOctetStream, mimeImagePjpeg},
-    {data53, sizeof(data53), mimeAppOctetStream, mimeImagePjpeg},
-    {data54, sizeof(data54), mimeTextHtml, mimeVideoMpeg},
-    {data55, sizeof(data55), mimeAppXGzip, mimeAppXGzip},
-    {data56, sizeof(data56), mimeTextPlain, mimeTextPlain},
-    {data57, sizeof(data57), mimeTextHtml, mimeAppXGzip},
-    {data58, sizeof(data58), mimeAppOctetStream, mimeImagePjpeg},
-    {data59, sizeof(data59), mimeAppXZip, mimeAppXZip},
-    {data60, sizeof(data60), mimeTextPlain, mimeTextPlain},
-    {data61, sizeof(data61), mimeTextHtml, mimeAppXZip},
-    {data62, sizeof(data62), mimeAppJava, mimeAppJava},
-    {data63, sizeof(data63), mimeTextPlain, mimeTextPlain},
-    {data64, sizeof(data64), mimeTextHtml, mimeAppJava},
-    {data65, sizeof(data65), mimeAppPdf, mimeAppPdf},
-    {data66, sizeof(data66), mimeTextPlain, mimeTextPlain},
-    {data67, sizeof(data67), mimeTextHtml, mimeAppPdf},
-    {data68, sizeof(data68), mimeAppXMSDownload, mimeAppXMSDownload},
-    {data69, sizeof(data69), mimeTextPlain, mimeTextPlain},
-    {data70, sizeof(data70), mimeTextHtml, mimeAppXMSDownload},
-    {data71, sizeof(data71), mimeTextRichtext, mimeTextRichtext},
-    {data72, sizeof(data72), mimeTextPlain, mimeTextPlain},
-    {data73, sizeof(data73), mimeTextPlain, mimeTextPlain},
-    {data74, sizeof(data74), mimeTextHtml, mimeTextRichtext},
-    {data75, sizeof(data75), mimeAudioWav, mimeAudioWav},
-    {data76, sizeof(data76), mimeTextPlain, mimeTextPlain},
-    {data77, sizeof(data77), mimeTextPlain, mimeTextPlain},
-    {data78, sizeof(data78), mimeTextHtml, mimeTextPlain},
-    {data79, sizeof(data79), mimeAppPostscript, mimeAppPostscript},
-    {data80, sizeof(data80), mimeTextPlain, mimeTextPlain},
-    {data81, sizeof(data81), mimeTextHtml, mimeAppPostscript},
-    {data82, sizeof(data82), mimeAudioBasic, mimeAudioBasic},
-    {data83, sizeof(data83), mimeTextPlain, mimeTextPlain},
-    {data84, sizeof(data84), mimeTextHtml, mimeAudioBasic},
-    {data85, sizeof(data85), mimeTextPlain, mimeTextPlain},
-    {data86, sizeof(data86), mimeImageTiff, mimeImageTiff, mimeTextPlain},
-    {data87, sizeof(data87), mimeTextPlain, mimeTextPlain},
-    {data88, sizeof(data88), mimeTextHtml, mimeTextPlain},
-    {data89, sizeof(data89), mimeTextHtml, mimeTextPlain},
-    {data90, sizeof(data90), mimeTextHtml, mimeTextPlain},
-    {data91, sizeof(data91), mimeTextXml, mimeTextPlain},
-    {data92, sizeof(data92), mimeTextXml, mimeTextPlain},
-    {data93, sizeof(data93), mimeTextXml, mimeTextPlain},
-    {data94, sizeof(data94), mimeTextHtml, mimeTextPlain},
-    {data95, sizeof(data95), mimeTextXml, mimeTextRichtext},
-    {data96, sizeof(data96), mimeTextPlain, mimeTextPlain}
+    {data1, sizeof(data1), "text/plain"},
+    {data2, sizeof(data2), "application/octet-stream", "image/pjpeg"},
+    {data3, sizeof(data3), "application/octet-stream", "image/pjpeg"},
+    {data4, sizeof(data4), "application/octet-stream", "image/pjpeg"},
+    {data5, sizeof(data5), "text/plain"},
+    {data6, sizeof(data6), "text/plain"},
+    {data7, sizeof(data7), "text/html", "text/plain"},
+    {data8, sizeof(data8), "text/html", "text/plain"},
+    {data9, sizeof(data9), "text/html", "image/pjpeg"},
+    {data10, sizeof(data10), "text/html", "text/plain"},
+    {data11, sizeof(data11), "text/html", "text/plain"},
+    {data12, sizeof(data12), "text/html", "text/plain"},
+    {data13, sizeof(data13), "text/plain"},
+    {data14, sizeof(data14), "text/plain"},
+    {data15, sizeof(data15), "text/plain"},
+    {data16, sizeof(data16), "image/pjpeg"},
+    {data17, sizeof(data17), "application/octet-stream", "image/pjpeg"},
+    {data18, sizeof(data18), "text/html", "image/pjpeg"},
+    {data19, sizeof(data19), "image/gif"},
+    {data20, sizeof(data20), "image/gif"},
+    {data21, sizeof(data21), "text/plain"},
+    {data22, sizeof(data22), "image/gif"},
+    {data23, sizeof(data23), "text/plain"},
+    {data24, sizeof(data24), "image/gif"},
+    {data25, sizeof(data25), "image/gif"},
+    {data26, sizeof(data26), "text/html", "image/gif"},
+    {data27, sizeof(data27), "text/plain"},
+    {data28, sizeof(data28), "image/bmp"},
+    {data29, sizeof(data29), "image/bmp"},
+    {data30, sizeof(data30), "application/octet-stream", "image/pjpeg"},
+    {data31, sizeof(data31), "text/html", "image/bmp"},
+    {data32, sizeof(data32), "application/octet-stream", "image/pjpeg"},
+    {data33, sizeof(data33), "application/octet-stream", "image/pjpeg"},
+    {data34, sizeof(data34), "image/x-png"},
+    {data35, sizeof(data35), "image/x-png"},
+    {data36, sizeof(data36), "application/octet-stream", "image/pjpeg"},
+    {data37, sizeof(data37), "text/html", "image/x-png"},
+    {data38, sizeof(data38), "application/octet-stream", "image/pjpeg"},
+    {data39, sizeof(data39), "image/tiff"},
+    {data40, sizeof(data40), "text/html", "image/tiff"},
+    {data41, sizeof(data41), "text/plain", NULL, "image/tiff"},
+    {data42, sizeof(data42), "text/plain"},
+    {data43, sizeof(data43), "application/octet-stream", "image/pjpeg"},
+    {data44, sizeof(data44), "video/avi"},
+    {data45, sizeof(data45), "text/plain"},
+    {data46, sizeof(data46), "text/plain"},
+    {data47, sizeof(data47), "text/plain"},
+    {data48, sizeof(data48), "text/html", "video/avi"},
+    {data49, sizeof(data49), "video/avi"},
+    {data50, sizeof(data50), "video/mpeg"},
+    {data51, sizeof(data51), "video/mpeg"},
+    {data52, sizeof(data52), "application/octet-stream", "image/pjpeg"},
+    {data53, sizeof(data53), "application/octet-stream", "image/pjpeg"},
+    {data54, sizeof(data54), "text/html", "video/mpeg"},
+    {data55, sizeof(data55), "application/x-gzip-compressed"},
+    {data56, sizeof(data56), "text/plain"},
+    {data57, sizeof(data57), "text/html", "application/x-gzip-compressed"},
+    {data58, sizeof(data58), "application/octet-stream", "image/pjpeg"},
+    {data59, sizeof(data59), "application/x-zip-compressed"},
+    {data60, sizeof(data60), "text/plain"},
+    {data61, sizeof(data61), "text/html", "application/x-zip-compressed"},
+    {data62, sizeof(data62), "application/java"},
+    {data63, sizeof(data63), "text/plain"},
+    {data64, sizeof(data64), "text/html", "application/java"},
+    {data65, sizeof(data65), "application/pdf"},
+    {data66, sizeof(data66), "text/plain"},
+    {data67, sizeof(data67), "text/html", "application/pdf"},
+    {data68, sizeof(data68), "application/x-msdownload"},
+    {data69, sizeof(data69), "text/plain"},
+    {data70, sizeof(data70), "text/html", "application/x-msdownload"},
+    {data71, sizeof(data71), "text/richtext"},
+    {data72, sizeof(data72), "text/plain"},
+    {data73, sizeof(data73), "text/plain"},
+    {data74, sizeof(data74), "text/html", "text/richtext"},
+    {data75, sizeof(data75), "audio/wav"},
+    {data76, sizeof(data76), "text/plain"},
+    {data77, sizeof(data77), "text/plain"},
+    {data78, sizeof(data78), "text/html", "text/plain"},
+    {data79, sizeof(data79), "application/postscript"},
+    {data80, sizeof(data80), "text/plain"},
+    {data81, sizeof(data81), "text/html", "application/postscript"},
+    {data82, sizeof(data82), "audio/basic"},
+    {data83, sizeof(data83), "text/plain"},
+    {data84, sizeof(data84), "text/html", "audio/basic"},
+    {data85, sizeof(data85), "text/plain"},
+    {data86, sizeof(data86), "image/tiff", NULL, "text/plain"},
+    {data87, sizeof(data87), "text/plain"},
+    {data88, sizeof(data88), "text/html", "text/plain"},
+    {data89, sizeof(data89), "text/html", "text/plain"},
+    {data90, sizeof(data90), "text/html", "text/plain"},
+    {data91, sizeof(data91), "text/xml", "text/plain"},
+    {data92, sizeof(data92), "text/xml", "text/plain"},
+    {data93, sizeof(data93), "text/xml", "text/plain"},
+    {data94, sizeof(data94), "text/html", "text/plain"},
+    {data95, sizeof(data95), "text/xml", "text/richtext"},
+    {data96, sizeof(data96), "text/plain"},
+    {data1, sizeof(data1), "text/plain", NULL, NULL, "res://mshtml.dll/blank.htm"},
+    {NULL, 0, "text/html", NULL, NULL, "res://mshtml.dll/blank.htm"},
+    {data1, sizeof(data1), "text/plain", NULL, NULL, "res://mshtml.dll/blank.htm", "application/octet-stream"},
+    {data1, sizeof(data1), "text/plain", NULL, NULL, "file:some%20file%2ejpg", "application/octet-stream"},
+    {NULL, sizeof(data1), "text/html", NULL, NULL, "res://mshtml.dll/blank.htm"},
+    {data1, sizeof(data1), "text/css", NULL, NULL, "http://www.winehq.org/test.css"},
+    {data2, sizeof(data2), "text/css", NULL, NULL, "http://www.winehq.org/test.css"},
+    {data10, sizeof(data10), "text/html", NULL, NULL, "http://www.winehq.org/test.css"},
+    {data1, sizeof(data1), "text/css", NULL, NULL, "http://www.winehq.org/test.css", "text/plain"},
+    {data1, sizeof(data1), "text/css", NULL, NULL, "http://www.winehq.org/test.css", "application/octet-stream"},
+    {data1, sizeof(data1), "text/test", NULL, NULL, "http://www.winehq.org/test.css", "text/test"}
 };
 
 static void test_FindMimeFromData(void)
 {
+    WCHAR *mime, *proposed_mime, *url;
     HRESULT hres;
-    LPWSTR mime;
     BYTE b;
     int i;
 
+    static const WCHAR app_octet_streamW[] =
+        {'a','p','p','l','i','c','a','t','i','o','n','/','o','c','t','e','t','-','s','t','r','e','a','m',0};
+    static const WCHAR image_pjpegW[] = {'i','m','a','g','e','/','p','j','p','e','g',0};
+    static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0};
+    static const WCHAR text_plainW[] = {'t','e','x','t','/','p','l','a','i','n',0};
+
     for(i=0; i<sizeof(mime_tests)/sizeof(mime_tests[0]); i++) {
         mime = (LPWSTR)0xf0f0f0f0;
         hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, NULL, 0, &mime, 0);
         if(mime_tests[i].mime) {
             ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
-            ok(!lstrcmpW(mime, mime_tests[i].mime), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
+            ok(!strcmp_wa(mime, mime_tests[i].mime), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
             CoTaskMemFree(mime);
         }else {
             ok(hres == E_FAIL || hres == mime_tests[i].hres,
@@ -706,107 +727,72 @@ static void test_FindMimeFromData(void)
         }
 
         mime = (LPWSTR)0xf0f0f0f0;
-        hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, mimeTextPlain, 0, &mime, 0);
+        hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, text_plainW, 0, &mime, 0);
         ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
-        ok(!lstrcmpW(mime, mimeTextPlain), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
+        ok(!strcmp_wa(mime, "text/plain"), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
         CoTaskMemFree(mime);
 
         mime = (LPWSTR)0xf0f0f0f0;
-        hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, mimeAppOctetStream, 0, &mime, 0);
+        hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, app_octet_streamW, 0, &mime, 0);
         ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
-        ok(!lstrcmpW(mime, mimeAppOctetStream), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
+        ok(!strcmp_wa(mime, "application/octet-stream"), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
         CoTaskMemFree(mime);
     }
 
     for(i=0; i < sizeof(mime_tests2)/sizeof(mime_tests2[0]); i++) {
-        hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
-                NULL, 0, &mime, 0);
+        url = a2w(mime_tests2[i].url);
+        proposed_mime = a2w(mime_tests2[i].proposed_mime);
+        hres = pFindMimeFromData(NULL, url, mime_tests2[i].data, mime_tests2[i].size,
+                proposed_mime, 0, &mime, 0);
         ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
-        b = !lstrcmpW(mime, mime_tests2[i].mime);
-        ok(b || broken(mime_tests2[i].broken_mime && !lstrcmpW(mime, mime_tests2[i].broken_mime)),
+        b = !strcmp_wa(mime, mime_tests2[i].mime);
+        ok(b || broken(mime_tests2[i].broken_mime && !strcmp_wa(mime, mime_tests2[i].broken_mime)),
             "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
+        heap_free(proposed_mime);
+        heap_free(url);
         CoTaskMemFree(mime);
-        if(!b)
+        if(!b || url || proposed_mime)
             continue;
 
         hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
-                mimeAppOctetStream, 0, &mime, 0);
+                app_octet_streamW, 0, &mime, 0);
         ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
-        ok(!lstrcmpW(mime, mime_tests2[i].mime) || broken(mime_tests2[i].broken_mime
-                        && !lstrcmpW(mime, mime_tests2[i].broken_mime)),
+        ok(!strcmp_wa(mime, mime_tests2[i].mime) || broken(mime_tests2[i].broken_mime
+                        && !strcmp_wa(mime, mime_tests2[i].broken_mime)),
                     "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
         CoTaskMemFree(mime);
 
         hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
-                mimeTextPlain, 0, &mime, 0);
+                text_plainW, 0, &mime, 0);
         ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
-        ok(!lstrcmpW(mime, mime_tests2[i].mime) || broken(mime_tests2[i].broken_mime
-                    && !lstrcmpW(mime, mime_tests2[i].broken_mime)),
+        ok(!strcmp_wa(mime, mime_tests2[i].mime) || broken(mime_tests2[i].broken_mime
+                    && !strcmp_wa(mime, mime_tests2[i].broken_mime)),
                 "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
         CoTaskMemFree(mime);
 
         hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
-                mimeTextHtml, 0, &mime, 0);
+                text_htmlW, 0, &mime, 0);
         ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
-        if(!lstrcmpW(mimeAppOctetStream, mime_tests2[i].mime)
-           || !lstrcmpW(mimeTextPlain, mime_tests2[i].mime) || i==92)
-            ok(!lstrcmpW(mime, mimeTextHtml), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
+        if(!strcmp("application/octet-stream", mime_tests2[i].mime)
+           || !strcmp("text/plain", mime_tests2[i].mime) || i==92)
+            ok(!strcmp_wa(mime, "text/html"), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
         else
-            ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
+            ok(!strcmp_wa(mime, mime_tests2[i].mime), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
         CoTaskMemFree(mime);
 
         hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
-                mimeImagePjpeg, 0, &mime, 0);
+                image_pjpegW, 0, &mime, 0);
         ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
-        ok(!lstrcmpW(mime, mime_tests2[i].mime_pjpeg) || broken(!lstrcmpW(mime, mime_tests2[i].mime)),
-                "[%d] wrong mime, got %s\n", i, wine_dbgstr_w(mime));
+        ok(!strcmp_wa(mime, mime_tests2[i].mime_pjpeg ? mime_tests2[i].mime_pjpeg : mime_tests2[i].mime)
+           || broken(!strcmp_wa(mime, mime_tests2[i].mime)),
+           "[%d] wrong mime, got %s\n", i, wine_dbgstr_w(mime));
         CoTaskMemFree(mime);
     }
 
-    hres = pFindMimeFromData(NULL, url1, data1, sizeof(data1), NULL, 0, &mime, 0);
-    ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
-    ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime: %s\n", wine_dbgstr_w(mime));
-    CoTaskMemFree(mime);
-
-    hres = pFindMimeFromData(NULL, url1, data1, sizeof(data1), mimeAppOctetStream, 0, &mime, 0);
-    ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
-    ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime: %s\n", wine_dbgstr_w(mime));
-    CoTaskMemFree(mime);
-
-    hres = pFindMimeFromData(NULL, url4, data1, sizeof(data1), mimeAppOctetStream, 0, &mime, 0);
-    ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
-    ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime: %s\n", wine_dbgstr_w(mime));
-    CoTaskMemFree(mime);
-
-    hres = pFindMimeFromData(NULL, url1, NULL, 0, NULL, 0, &mime, 0);
-    ok(hres == S_OK, "FindMimeFromData failed: %08x, expected S_OK\n", hres);
-    ok(!lstrcmpW(mime, mimeTextHtml), "wrong mime: %s\n", wine_dbgstr_w(mime));
-    CoTaskMemFree(mime);
-
-    hres = pFindMimeFromData(NULL, url1, NULL, sizeof(data1), NULL, 0, &mime, 0);
-    ok(hres == S_OK, "FindMimeFromData failed: %08x, expected S_OK\n", hres);
-    ok(!lstrcmpW(mime, mimeTextHtml), "wrong mime: %s\n", wine_dbgstr_w(mime));
-    CoTaskMemFree(mime);
-
-    hres = pFindMimeFromData(NULL, url1, 0, 0, NULL, 0, &mime, 0);
-    ok(hres == S_OK, "FindMimeFromData failed: %08x, expected S_OK\n", hres);
-    ok(!lstrcmpW(mime, mimeTextHtml), "wrong mime: %s\n", wine_dbgstr_w(mime));
-    CoTaskMemFree(mime);
-
-    hres = pFindMimeFromData(NULL, url1, 0, sizeof(data1), NULL, 0, &mime, 0);
-    ok(hres == S_OK, "FindMimeFromData failed: %08x, expected S_OK\n", hres);
-    ok(!lstrcmpW(mime, mimeTextHtml), "wrong mime: %s\n", wine_dbgstr_w(mime));
-    CoTaskMemFree(mime);
-
-    hres = pFindMimeFromData(NULL, url1, data1, sizeof(data1), NULL, 0, &mime, 0);
-    ok(hres == S_OK, "FindMimeFromData failed: %08x, expected S_OK\n", hres);
-    ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime: %s\n", wine_dbgstr_w(mime));
-    CoTaskMemFree(mime);
-
     hres = pFindMimeFromData(NULL, NULL, NULL, 0, NULL, 0, &mime, 0);
     ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
 
-    hres = pFindMimeFromData(NULL, NULL, NULL, 0, mimeTextPlain, 0, &mime, 0);
+    hres = pFindMimeFromData(NULL, NULL, NULL, 0, text_plainW, 0, &mime, 0);
     ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
 
     hres = pFindMimeFromData(NULL, NULL, data1, 0, NULL, 0, &mime, 0);
@@ -815,12 +801,12 @@ static void test_FindMimeFromData(void)
     hres = pFindMimeFromData(NULL, url1, data1, 0, NULL, 0, &mime, 0);
     ok(hres == E_FAIL, "FindMimeFromData failed: %08x, expected E_FAIL\n", hres);
 
-    hres = pFindMimeFromData(NULL, NULL, data1, 0, mimeTextPlain, 0, &mime, 0);
+    hres = pFindMimeFromData(NULL, NULL, data1, 0, text_plainW, 0, &mime, 0);
     ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
-    ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime: %s\n", wine_dbgstr_w(mime));
+    ok(!strcmp_wa(mime, "text/plain"), "wrong mime: %s\n", wine_dbgstr_w(mime));
     CoTaskMemFree(mime);
 
-    hres = pFindMimeFromData(NULL, NULL, data1, 0, mimeTextPlain, 0, NULL, 0);
+    hres = pFindMimeFromData(NULL, NULL, data1, 0, text_plainW, 0, NULL, 0);
     ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
 }
 
index 6c22cbd..e7d7976 100644 (file)
@@ -3729,7 +3729,7 @@ START_TEST(protocol)
 
     if(!winetest_interactive)
     {
-        skip("protocol test skipped, bug 6381\n");
+        skip("protocol test skipped, ROSTESTS-38\n");
         return;
     }
 
index c82e91e..1b83d84 100644 (file)
@@ -27,6 +27,7 @@
 #define NONAMELESSUNION
 
 /* needed for IInternetZoneManagerEx2 */
+#undef _WIN32_IE
 #define _WIN32_IE 0x0700
 
 #include <wine/test.h>
index 856decb..4a90a15 100644 (file)
@@ -367,6 +367,31 @@ static const uri_properties uri_tests[] = {
             {URLZONE_INVALID,E_NOTIMPL,FALSE}
         }
     },
+    {   "file:///z:/test dir/README.txt", 0, S_OK, FALSE,
+        {
+            {"file:///z:/test%20dir/README.txt",S_OK},
+            {"",S_FALSE},
+            {"file:///z:/test%20dir/README.txt",S_OK},
+            {"",S_FALSE},
+            {".txt",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"/z:/test%20dir/README.txt",S_OK},
+            {"/z:/test%20dir/README.txt",S_OK},
+            {"",S_FALSE},
+            {"file:///z:/test dir/README.txt",S_OK},
+            {"file",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE}
+        },
+        {
+            {Uri_HOST_UNKNOWN,S_OK,FALSE},
+            {0,S_FALSE,FALSE},
+            {URL_SCHEME_FILE,S_OK,FALSE},
+            {URLZONE_INVALID,E_NOTIMPL,FALSE}
+        }
+    },
     {   "urn:nothing:should:happen here", 0, S_OK, FALSE,
         {
             {"urn:nothing:should:happen here",S_OK,FALSE},
@@ -4503,7 +4528,57 @@ static const uri_properties uri_tests[] = {
             {URL_SCHEME_UNKNOWN,S_OK},
             {URLZONE_INVALID,E_NOTIMPL}
         }
-    }
+    },
+    {   "mailto://", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
+        {
+            {"mailto:",S_OK},
+            {"",S_FALSE},
+            {"mailto:",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"mailto://",S_OK,FALSE,"mailto:"},
+            {"mailto",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE}
+        },
+        {
+            {Uri_HOST_UNKNOWN,S_OK},
+            {0,S_FALSE},
+            {URL_SCHEME_MAILTO,S_OK},
+            {URLZONE_INVALID,E_NOTIMPL}
+        }
+    },
+    {   "mailto://a@b.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
+        {
+            {"mailto:a@b.com",S_OK},
+            {"",S_FALSE},
+            {"mailto:a@b.com",S_OK},
+            {"",S_FALSE},
+            {".com",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"a@b.com",S_OK},
+            {"a@b.com",S_OK},
+            {"",S_FALSE},
+            {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
+            {"mailto",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE}
+        },
+        {
+            {Uri_HOST_UNKNOWN,S_OK},
+            {0,S_FALSE},
+            {URL_SCHEME_MAILTO,S_OK},
+            {URLZONE_INVALID,E_NOTIMPL}
+        }
+     }
 };
 
 typedef struct _invalid_uri {
@@ -6933,6 +7008,114 @@ static const uri_combine_test uri_combine_tests[] = {
             {URL_SCHEME_HTTP,S_OK},
             {URLZONE_INVALID,E_NOTIMPL}
         }
+    },
+    {   "http://google.com/test",0,
+        "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
+        0,S_OK,FALSE,
+        {
+            {"file:///c:/test/",S_OK},
+            {"",S_FALSE},
+            {"file:///c:/test/",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"/c:/test/",S_OK},
+            {"/c:/test/",S_OK},
+            {"",S_FALSE},
+            {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
+            {"file",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE}
+        },
+        {
+            {Uri_HOST_UNKNOWN,S_OK},
+            {0,S_FALSE},
+            {URL_SCHEME_FILE,S_OK},
+            {URLZONE_INVALID,E_NOTIMPL}
+        }
+    },
+    {   "http://google.com/test",0,
+        "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
+        0,S_OK,FALSE,
+        {
+            {"file:///c:/test/",S_OK},
+            {"",S_FALSE},
+            {"file:///c:/test/",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"/c:/test/",S_OK},
+            {"/c:/test/",S_OK},
+            {"",S_FALSE},
+            {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
+            {"file",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE}
+        },
+        {
+            {Uri_HOST_UNKNOWN,S_OK},
+            {0,S_FALSE},
+            {URL_SCHEME_FILE,S_OK},
+            {URLZONE_INVALID,E_NOTIMPL}
+        }
+    },
+    {   "http://winehq.org",0,
+        "mailto://",Uri_CREATE_NO_CANONICALIZE,
+        0,S_OK,FALSE,
+        {
+            {"mailto:",S_OK},
+            {"",S_FALSE},
+            {"mailto:",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"mailto://",S_OK,FALSE,"mailto:"},
+            {"mailto",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE}
+        },
+        {
+            {Uri_HOST_UNKNOWN,S_OK},
+            {0,S_FALSE},
+            {URL_SCHEME_MAILTO,S_OK},
+            {URLZONE_INVALID,E_NOTIMPL}
+        }
+    },
+    {   "http://winehq.org",0,
+        "mailto://a@b.com",Uri_CREATE_NO_CANONICALIZE,
+        0,S_OK,FALSE,
+        {
+            {"mailto:a@b.com",S_OK},
+            {"",S_FALSE},
+            {"mailto:a@b.com",S_OK},
+            {"",S_FALSE},
+            {".com",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"",S_FALSE},
+            {"a@b.com",S_OK},
+            {"a@b.com",S_OK},
+            {"",S_FALSE},
+            {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
+            {"mailto",S_OK},
+            {"",S_FALSE},
+            {"",S_FALSE}
+        },
+        {
+            {Uri_HOST_UNKNOWN,S_OK},
+            {0,S_FALSE},
+            {URL_SCHEME_MAILTO,S_OK},
+            {URLZONE_INVALID,E_NOTIMPL}
+        }
     }
 };
 
@@ -10244,7 +10427,7 @@ static void test_CoInternetCombineIUri(void) {
                             todo_wine {
                                 ok(!strcmp_aw(prop.value, received) ||
                                    broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
-                                    "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
+                                    "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
                                     prop.value, wine_dbgstr_w(received), i, j);
                             }
                         } else {
@@ -10253,7 +10436,7 @@ static void test_CoInternetCombineIUri(void) {
                                 hr, prop.expected, i, j);
                             ok(!strcmp_aw(prop.value, received) ||
                                broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
-                                "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
+                                "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
                                 prop.value, wine_dbgstr_w(received), i, j);
                         }
                         SysFreeString(received);
@@ -10561,7 +10744,7 @@ static void test_CoInternetCombineUrlEx(void) {
                         todo_wine {
                             ok(!strcmp_aw(value, received) ||
                                broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
-                                "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
+                                "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
                                 value, wine_dbgstr_w(received), i, j);
                         }
                     } else {
@@ -10570,7 +10753,7 @@ static void test_CoInternetCombineUrlEx(void) {
                             hr, prop.expected, i, j);
                         ok(!strcmp_aw(value, received) ||
                            broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
-                            "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
+                            "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
                             value, wine_dbgstr_w(received), i, j);
                     }
                     SysFreeString(received);
index 5a4a520..cc83b3f 100644 (file)
@@ -153,6 +153,7 @@ DEFINE_EXPECT(PutProperty_CLASSIDPROP);
 DEFINE_EXPECT(SetPriority);
 DEFINE_EXPECT(GetWindow_IHttpSecurity);
 DEFINE_EXPECT(GetWindow_IWindowForBindingUI);
+DEFINE_EXPECT(GetWindow_ICodeInstall);
 DEFINE_EXPECT(OnSecurityProblem);
 
 static const WCHAR winetest_data_urlW[] =
@@ -195,6 +196,7 @@ static BOOL invalid_cn_accepted = FALSE;
 static BOOL abort_start = FALSE;
 static BOOL abort_progress = FALSE;
 static BOOL async_switch = FALSE;
+static const char *test_file;
 
 static WCHAR file_url[INTERNET_MAX_URL_LENGTH], current_url[INTERNET_MAX_URL_LENGTH];
 
@@ -1358,6 +1360,8 @@ static HRESULT WINAPI HttpSecurity_GetWindow(IHttpSecurity *iface, REFGUID rguid
         CHECK_EXPECT(GetWindow_IHttpSecurity);
     else if(IsEqualGUID(rguidReason, &IID_IWindowForBindingUI))
         CHECK_EXPECT2(GetWindow_IWindowForBindingUI);
+    else if(IsEqualGUID(rguidReason, &IID_ICodeInstall))
+        CHECK_EXPECT(GetWindow_ICodeInstall);
     else
         ok(0, "Unexpected rguidReason: %s\n", debugstr_guid(rguidReason));
 
@@ -1892,7 +1896,7 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES
         ok(res == hresult, "res = %08x, expected %08x\n", res, binding_hres);
         ok(!res_str, "incorrect res_str = %s\n", wine_dbgstr_w(res_str));
 
-        if(hresult==S_OK || (abort_start && hresult!=S_FALSE)) {
+        if(hresult==S_OK || (abort_start && hresult!=S_FALSE) || hresult == REGDB_E_CLASSNOTREG) {
             ok(IsEqualCLSID(&clsid, &CLSID_NULL),
                     "incorrect protocol CLSID: %s, expected CLSID_NULL\n",
                     debugstr_guid(&clsid));
@@ -3205,7 +3209,7 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
     }
 }
 
-static void test_BindToObject(int protocol, DWORD flags)
+static void test_BindToObject(int protocol, DWORD flags, HRESULT exhres)
 {
     IMoniker *mon;
     HRESULT hres;
@@ -3217,6 +3221,7 @@ static void test_BindToObject(int protocol, DWORD flags)
     IBinding *bind;
 
     init_bind_test(protocol, BINDTEST_TOOBJECT|flags, TYMED_ISTREAM);
+    binding_hres = exhres;
 
     if(emulate_protocol)
         CoRegisterClassObject(&CLSID_HTMLDocument, (IUnknown *)&mime_cf,
@@ -3287,10 +3292,17 @@ static void test_BindToObject(int protocol, DWORD flags)
         if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
             SET_EXPECT(OnProgress_DOWNLOADINGDATA);
         SET_EXPECT(Obj_OnProgress_ENDDOWNLOADDATA);
-        SET_EXPECT(Obj_OnProgress_CLASSIDAVAILABLE);
+        if(SUCCEEDED(hres))
+            SET_EXPECT(Obj_OnProgress_CLASSIDAVAILABLE);
         SET_EXPECT(Obj_OnProgress_BEGINSYNCOPERATION);
+        if(exhres == REGDB_E_CLASSNOTREG) {
+            SET_EXPECT(QueryInterface_IWindowForBindingUI);
+            SET_EXPECT(QueryService_IWindowForBindingUI);
+            SET_EXPECT(GetWindow_ICodeInstall);
+        }
         SET_EXPECT(Obj_OnProgress_ENDSYNCOPERATION);
-        SET_EXPECT(OnObjectAvailable);
+        if(SUCCEEDED(hres))
+            SET_EXPECT(OnObjectAvailable);
         SET_EXPECT(Obj_OnStopBinding);
     }
 
@@ -3303,10 +3315,10 @@ static void test_BindToObject(int protocol, DWORD flags)
         return;
     }
 
-    /* no point testing the calls if binding didn't even work */
-    if (FAILED(hres)) return;
-
-    if(bindf & BINDF_ASYNCHRONOUS) {
+    if(FAILED(exhres)) {
+        ok(hres == exhres, "BindToObject failed:  %08x, expected %08x\n", hres, exhres);
+        ok(!unk, "unk = %p, expected NULL\n", unk);
+    }else if(bindf & BINDF_ASYNCHRONOUS) {
         ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToObject failed: %08x\n", hres);
         ok(unk == NULL, "istr should be NULL\n");
     }else {
@@ -3376,10 +3388,17 @@ static void test_BindToObject(int protocol, DWORD flags)
         if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
             CLEAR_CALLED(OnProgress_DOWNLOADINGDATA);
         CLEAR_CALLED(Obj_OnProgress_ENDDOWNLOADDATA);
-        CHECK_CALLED(Obj_OnProgress_CLASSIDAVAILABLE);
+        if(SUCCEEDED(hres))
+            CHECK_CALLED(Obj_OnProgress_CLASSIDAVAILABLE);
         CHECK_CALLED(Obj_OnProgress_BEGINSYNCOPERATION);
+        if(exhres == REGDB_E_CLASSNOTREG) {
+            todo_wine CHECK_CALLED(QueryInterface_IWindowForBindingUI);
+            todo_wine CHECK_CALLED(QueryService_IWindowForBindingUI);
+            todo_wine CHECK_CALLED(GetWindow_ICodeInstall);
+        }
         CHECK_CALLED(Obj_OnProgress_ENDSYNCOPERATION);
-        CHECK_CALLED(OnObjectAvailable);
+        if(SUCCEEDED(hres))
+            CHECK_CALLED(OnObjectAvailable);
         CHECK_CALLED(Obj_OnStopBinding);
     }
 
@@ -3614,29 +3633,35 @@ static void set_file_url(char *path)
     MultiByteToWideChar(CP_ACP, 0, file_urlA, -1, file_url, INTERNET_MAX_URL_LENGTH);
 }
 
-static void create_file(void)
+static void create_file(const char *file_name, const char *content)
 {
     HANDLE file;
     DWORD size;
     CHAR path[MAX_PATH];
 
-    static const char html_doc[] = "<HTML></HTML>";
-
-    file = CreateFileA(wszIndexHtmlA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+    file = CreateFileA(file_name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
             FILE_ATTRIBUTE_NORMAL, NULL);
     ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
     if(file == INVALID_HANDLE_VALUE)
         return;
 
-    WriteFile(file, html_doc, sizeof(html_doc)-1, &size, NULL);
+    if(test_file)
+        DeleteFileA(test_file);
+    test_file = file_name;
+    WriteFile(file, content, strlen(content), &size, NULL);
     CloseHandle(file);
 
     GetCurrentDirectoryA(MAX_PATH, path);
     lstrcatA(path, "\\");
-    lstrcatA(path, wszIndexHtmlA);
+    lstrcatA(path, file_name);
     set_file_url(path);
 }
 
+static void create_html_file(void)
+{
+    create_file(wszIndexHtmlA, "<HTML></HTML>");
+}
+
 static void create_cache_file(void)
 {
     char buf[6500], curdir[MAX_PATH];
@@ -3833,7 +3858,7 @@ START_TEST(url)
     complete_event = CreateEvent(NULL, FALSE, FALSE, NULL);
     complete_event2 = CreateEvent(NULL, FALSE, FALSE, NULL);
     thread_id = GetCurrentThreadId();
-    create_file();
+    create_html_file();
     create_cache_file();
     register_protocols();
 
@@ -3865,7 +3890,7 @@ START_TEST(url)
         test_BindToStorage(HTTP_TEST, BINDTEST_EMULATE, TYMED_FILE);
 
         trace("synchronous http test (to object)...\n");
-        test_BindToObject(HTTP_TEST, 0);
+        test_BindToObject(HTTP_TEST, 0, S_OK);
 
         trace("emulated synchronous http test (with cache)...\n");
         test_BindToStorage(HTTP_TEST, BINDTEST_EMULATE|BINDTEST_USE_CACHE, TYMED_ISTREAM);
@@ -3883,7 +3908,12 @@ START_TEST(url)
         test_BindToStorage(FILE_TEST, BINDTEST_EMULATE, TYMED_FILE);
 
         trace("synchronous file test (to object)...\n");
-        test_BindToObject(FILE_TEST, 0);
+        test_BindToObject(FILE_TEST, 0, S_OK);
+
+        trace("bind to an object of not registered MIME type...\n");
+        create_file("test.winetest", "\x01\x02\x03xxxxxxxxxxxxxxxxxxxxxxxxx");
+        test_BindToObject(FILE_TEST, 0, REGDB_E_CLASSNOTREG);
+        create_html_file();
 
         trace("file test (no callback)...\n");
         test_BindToStorage(FILE_TEST, BINDTEST_NO_CALLBACK, TYMED_ISTREAM);
@@ -3921,13 +3951,13 @@ START_TEST(url)
         test_BindToStorage(HTTP_TEST, 0, TYMED_FILE);
 
         trace("http test (to object)...\n");
-        test_BindToObject(HTTP_TEST, 0);
+        test_BindToObject(HTTP_TEST, 0, S_OK);
 
         trace("http test (short response)...\n");
         test_BindToStorage(HTTP_TEST, BINDTEST_HTTPRESPONSE, TYMED_ISTREAM);
 
         trace("http test (short response, to object)...\n");
-        test_BindToObject(HTTP_TEST, 0);
+        test_BindToObject(HTTP_TEST, 0, S_OK);
 
         trace("http test (abort start binding E_NOTIMPL)...\n");
         abort_hres = E_NOTIMPL;
@@ -3944,10 +3974,10 @@ START_TEST(url)
         test_BindToStorage(HTTP_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
 
         trace("emulated http test (to object)...\n");
-        test_BindToObject(HTTP_TEST, BINDTEST_EMULATE);
+        test_BindToObject(HTTP_TEST, BINDTEST_EMULATE, S_OK);
 
         trace("emulated http test (to object, redirect)...\n");
-        test_BindToObject(HTTP_TEST, BINDTEST_EMULATE|BINDTEST_REDIRECT);
+        test_BindToObject(HTTP_TEST, BINDTEST_EMULATE|BINDTEST_REDIRECT, S_OK);
 
         trace("emulated http test (to file)...\n");
         test_BindToStorage(HTTP_TEST, BINDTEST_EMULATE, TYMED_FILE);
@@ -3975,7 +4005,7 @@ START_TEST(url)
         test_BindToStorage(ABOUT_TEST, 0, TYMED_FILE);
 
         trace("about test (to object)...\n");
-        test_BindToObject(ABOUT_TEST, 0);
+        test_BindToObject(ABOUT_TEST, 0, S_OK);
 
         trace("emulated about test...\n");
         test_BindToStorage(ABOUT_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
@@ -3984,7 +4014,7 @@ START_TEST(url)
         test_BindToStorage(ABOUT_TEST, BINDTEST_EMULATE, TYMED_FILE);
 
         trace("emulated about test (to object)...\n");
-        test_BindToObject(ABOUT_TEST, BINDTEST_EMULATE);
+        test_BindToObject(ABOUT_TEST, BINDTEST_EMULATE, S_OK);
 
         trace("emulalated test reporting result in read...\n");
         test_BindToStorage(WINETEST_SYNC_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
@@ -3996,7 +4026,7 @@ START_TEST(url)
         test_BindToStorage(FILE_TEST, 0, TYMED_FILE);
 
         trace("file test (to object)...\n");
-        test_BindToObject(FILE_TEST, 0);
+        test_BindToObject(FILE_TEST, 0, S_OK);
 
         trace("emulated file test...\n");
         test_BindToStorage(FILE_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
@@ -4005,7 +4035,7 @@ START_TEST(url)
         test_BindToStorage(FILE_TEST, BINDTEST_EMULATE, TYMED_FILE);
 
         trace("emulated file test (to object)...\n");
-        test_BindToObject(FILE_TEST, BINDTEST_EMULATE);
+        test_BindToObject(FILE_TEST, BINDTEST_EMULATE, S_OK);
 
         trace("emulated its test...\n");
         test_BindToStorage(ITS_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
@@ -4046,7 +4076,7 @@ START_TEST(url)
         test_BindToStorage(HTTP_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
     }
 
-    DeleteFileA(wszIndexHtmlA);
+    DeleteFileA(test_file);
     DeleteFileA(test_txtA);
     CloseHandle(complete_event);
     CloseHandle(complete_event2);