[URLMON_WINETEST]

* Sync with Wine 1.5.26.

svn path=/trunk/; revision=58570
This commit is contained in:
Amine Khaldi 2013-03-22 14:29:24 +00:00
parent 1516b0c82d
commit 65c73ec5ba
9 changed files with 2841 additions and 454 deletions

View file

@ -1,9 +1,7 @@
remove_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502)
add_definitions(
-D__ROS_LONG64__
-D_DLL -D__USE_CRTIMP)
add_definitions(-D__ROS_LONG64__)
list(APPEND SOURCE
generated.c
@ -18,5 +16,5 @@ list(APPEND SOURCE
add_executable(urlmon_winetest ${SOURCE})
target_link_libraries(urlmon_winetest wine uuid)
set_module_type(urlmon_winetest win32cui)
add_importlibs(urlmon_winetest urlmon ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll)
add_importlibs(urlmon_winetest urlmon wininet ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll)
add_cd_file(TARGET urlmon_winetest DESTINATION reactos/bin FOR all)

View file

@ -5,6 +5,10 @@
* Unit tests for data structure packing
*/
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define WINVER 0x0501
#define _WIN32_IE 0x0501
#define _WIN32_WINNT 0x0501
@ -12,11 +16,12 @@
#define WINE_NOWINSOCK
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "urlmon.h"
#include <windef.h>
#include <winbase.h>
#include <objbase.h>
#include <urlmon.h>
#include "wine/test.h"
#include <wine/test.h>
/***********************************************************************
* Compatibility macros

View file

@ -16,20 +16,25 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define COBJMACROS
#define CONST_VTABLE
#define NONAMELESSUNION
#include <wine/test.h>
#include <stdarg.h>
#include <stddef.h>
//#include <stdarg.h>
//#include <stddef.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "urlmon.h"
//#include "windef.h"
//#include "winbase.h"
#include <winreg.h>
#include <ole2.h>
//#include "urlmon.h"
#include "initguid.h"
#include <initguid.h>
DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
@ -69,6 +74,7 @@ static HRESULT (WINAPI *pCoInternetGetSession)(DWORD, IInternetSession **, DWORD
static HRESULT (WINAPI *pCoInternetParseUrl)(LPCWSTR, PARSEACTION, DWORD, LPWSTR, DWORD, DWORD *, DWORD);
static HRESULT (WINAPI *pCoInternetQueryInfo)(LPCWSTR, QUERYOPTION, DWORD, LPVOID, DWORD, DWORD *, DWORD);
static HRESULT (WINAPI *pCopyStgMedium)(const STGMEDIUM *, STGMEDIUM *);
static HRESULT (WINAPI *pCopyBindInfo)(const BINDINFO *, BINDINFO *);
static HRESULT (WINAPI *pFindMimeFromData)(LPBC, LPCWSTR, LPVOID, DWORD, LPCWSTR,
DWORD, LPWSTR*, DWORD);
static HRESULT (WINAPI *pObtainUserAgentString)(DWORD, LPSTR, DWORD*);
@ -439,6 +445,7 @@ 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};
@ -515,7 +522,7 @@ static BYTE data35[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x','x','x','x',0};
static BYTE data36[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,'x','x'};
static BYTE data37[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'<','h','t','m','l','>'};
static BYTE data38[] = {0x00,0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x'};
static BYTE data39[] = {0x4d,0x4d,0x00,0x2a};
static BYTE data39[] = {0x4d,0x4d,0x00,0x2a,0xff};
static BYTE data40[] = {0x4d,0x4d,0x00,0x2a,'<','h','t','m','l','>',0};
static BYTE data41[] = {0x4d,0x4d,0xff};
static BYTE data42[] = {0x4d,0x4d};
@ -562,103 +569,126 @@ static BYTE data82[] = {'.','s','n','d',0};
static BYTE data83[] = {'.','s','n','d'};
static BYTE data84[] = {'.','s','n','d',0,'<','h','t','m','l','>',1,1};
static BYTE data85[] = {'.','S','N','D',0};
static BYTE data86[] = {0x49,0x49,0x2a,0xff};
static BYTE data87[] = {' ','<','h','e','a','d'};
static BYTE data88[] = {' ','<','h','e','a','d','>'};
static BYTE data89[] = {'\t','\r','<','h','e','a','d','>'};
static BYTE data90[] = {'<','H','e','A','d',' '};
static BYTE data91[] = {'<','?','x','m','l',' ',0};
static BYTE data92[] = {'a','b','c','<','?','x','m','l',' ',' '};
static BYTE data93[] = {'<','?','x','m','l',' ',' ','<','h','t','m','l','>'};
static BYTE data94[] = {'<','h','t','m','l','>','<','?','x','m','l',' ',' '};
static BYTE data95[] = {'{','\\','r','t','f','<','?','x','m','l',' ',' '};
static BYTE data96[] = {'<','?','x','m','l',' '};
static const struct {
BYTE *data;
DWORD size;
LPCWSTR mime, mime_alt;
LPCWSTR mime, mime_pjpeg, broken_mime;
} mime_tests2[] = {
{data1, sizeof(data1), mimeTextPlain},
{data2, sizeof(data2), mimeAppOctetStream},
{data3, sizeof(data3), mimeAppOctetStream},
{data4, sizeof(data4), mimeAppOctetStream},
{data5, sizeof(data5), mimeTextPlain},
{data6, sizeof(data6), mimeTextPlain},
{data7, sizeof(data7), mimeTextHtml, mimeTextPlain /* IE8 */},
{data8, sizeof(data8), mimeTextHtml, mimeTextPlain /* IE8 */},
{data9, sizeof(data9), mimeTextHtml, mimeImagePjpeg /* IE8 */},
{data10, sizeof(data10), mimeTextHtml, mimeTextPlain /* IE8 */},
{data11, sizeof(data11), mimeTextHtml, mimeTextPlain /* IE8 */},
{data12, sizeof(data12), mimeTextHtml, mimeTextPlain /* IE8 */},
{data13, sizeof(data13), mimeTextPlain},
{data14, sizeof(data14), mimeTextPlain},
{data15, sizeof(data15), mimeTextPlain},
{data16, sizeof(data16), mimeImagePjpeg},
{data17, sizeof(data17), mimeAppOctetStream},
{data18, sizeof(data18), mimeTextHtml},
{data19, sizeof(data19), mimeImageGif},
{data20, sizeof(data20), mimeImageGif},
{data21, sizeof(data21), mimeTextPlain},
{data22, sizeof(data22), mimeImageGif},
{data23, sizeof(data23), mimeTextPlain},
{data24, sizeof(data24), mimeImageGif},
{data25, sizeof(data25), mimeImageGif},
{data26, sizeof(data26), mimeTextHtml, mimeImageGif /* IE8 */},
{data27, sizeof(data27), mimeTextPlain},
{data28, sizeof(data28), mimeImageBmp},
{data29, sizeof(data29), mimeImageBmp},
{data30, sizeof(data30), mimeAppOctetStream},
{data31, sizeof(data31), mimeTextHtml, mimeImageBmp /* IE8 */},
{data32, sizeof(data32), mimeAppOctetStream},
{data33, sizeof(data33), mimeAppOctetStream},
{data34, sizeof(data34), mimeImageXPng},
{data35, sizeof(data35), mimeImageXPng},
{data36, sizeof(data36), mimeAppOctetStream},
{data37, sizeof(data37), mimeTextHtml, mimeImageXPng /* IE8 */},
{data38, sizeof(data38), mimeAppOctetStream},
{data39, sizeof(data39), mimeImageTiff},
{data40, sizeof(data40), mimeTextHtml, mimeImageTiff /* IE8 */},
{data41, sizeof(data41), mimeImageTiff},
{data42, sizeof(data42), mimeTextPlain},
{data43, sizeof(data43), mimeAppOctetStream},
{data44, sizeof(data44), mimeVideoAvi},
{data45, sizeof(data45), mimeTextPlain},
{data46, sizeof(data46), mimeTextPlain},
{data47, sizeof(data47), mimeTextPlain},
{data48, sizeof(data48), mimeTextHtml, mimeVideoAvi /* IE8 */},
{data49, sizeof(data49), mimeVideoAvi},
{data50, sizeof(data50), mimeVideoMpeg},
{data51, sizeof(data51), mimeVideoMpeg},
{data52, sizeof(data52), mimeAppOctetStream},
{data53, sizeof(data53), mimeAppOctetStream},
{data54, sizeof(data54), mimeTextHtml, mimeVideoMpeg /* IE8 */},
{data55, sizeof(data55), mimeAppXGzip},
{data56, sizeof(data56), mimeTextPlain},
{data57, sizeof(data57), mimeTextHtml, mimeAppXGzip /* IE8 */},
{data58, sizeof(data58), mimeAppOctetStream},
{data59, sizeof(data59), mimeAppXZip},
{data60, sizeof(data60), mimeTextPlain},
{data61, sizeof(data61), mimeTextHtml, mimeAppXZip /* IE8 */},
{data62, sizeof(data62), mimeAppJava},
{data63, sizeof(data63), mimeTextPlain},
{data64, sizeof(data64), mimeTextHtml, mimeAppJava /* IE8 */},
{data65, sizeof(data65), mimeAppPdf},
{data66, sizeof(data66), mimeTextPlain},
{data67, sizeof(data67), mimeTextHtml, mimeAppPdf /* IE8 */},
{data68, sizeof(data68), mimeAppXMSDownload},
{data69, sizeof(data69), mimeTextPlain},
{data70, sizeof(data70), mimeTextHtml, mimeAppXMSDownload /* IE8 */},
{data71, sizeof(data71), mimeTextRichtext},
{data72, sizeof(data72), mimeTextPlain},
{data73, sizeof(data73), mimeTextPlain},
{data74, sizeof(data74), mimeTextHtml, mimeTextRichtext /* IE8 */},
{data75, sizeof(data75), mimeAudioWav},
{data76, sizeof(data76), mimeTextPlain},
{data77, sizeof(data77), mimeTextPlain},
{data78, sizeof(data78), mimeTextHtml, mimeTextPlain /* IE8 */},
{data79, sizeof(data79), mimeAppPostscript},
{data80, sizeof(data80), mimeTextPlain},
{data81, sizeof(data81), mimeTextHtml, mimeAppPostscript /* IE8 */},
{data82, sizeof(data82), mimeAudioBasic},
{data83, sizeof(data83), mimeTextPlain},
{data84, sizeof(data84), mimeTextHtml, mimeAudioBasic /* IE8 */},
{data85, sizeof(data85), mimeTextPlain}
{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}
};
static void test_FindMimeFromData(void)
{
HRESULT hres;
LPWSTR mime;
BYTE b;
int i;
for(i=0; i<sizeof(mime_tests)/sizeof(mime_tests[0]); i++) {
@ -666,7 +696,7 @@ static void test_FindMimeFromData(void)
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\n", i);
ok(!lstrcmpW(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,
@ -678,13 +708,13 @@ static void test_FindMimeFromData(void)
mime = (LPWSTR)0xf0f0f0f0;
hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, mimeTextPlain, 0, &mime, 0);
ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
ok(!lstrcmpW(mime, mimeTextPlain), "[%d] wrong mime\n", i);
ok(!lstrcmpW(mime, mimeTextPlain), "[%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);
ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
ok(!lstrcmpW(mime, mimeAppOctetStream), "[%d] wrong mime\n", i);
ok(!lstrcmpW(mime, mimeAppOctetStream), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
CoTaskMemFree(mime);
}
@ -692,49 +722,89 @@ static void test_FindMimeFromData(void)
hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
NULL, 0, &mime, 0);
ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
b = !lstrcmpW(mime, mime_tests2[i].mime);
ok(b || broken(mime_tests2[i].broken_mime && !lstrcmpW(mime, mime_tests2[i].broken_mime)),
"[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
CoTaskMemFree(mime);
if(!b)
continue;
hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
mimeAppOctetStream, 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)),
"[%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);
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)),
"[%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);
ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
if(!lstrcmpW(mimeAppOctetStream, mime_tests2[i].mime)
|| !lstrcmpW(mimeTextPlain, mime_tests2[i].mime))
ok(!lstrcmpW(mime, mimeTextHtml), "[%d] wrong mime\n", i);
|| !lstrcmpW(mimeTextPlain, mime_tests2[i].mime) || i==92)
ok(!lstrcmpW(mime, mimeTextHtml), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
else
ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime\n", i);
ok(!lstrcmpW(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);
ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
if(!lstrcmpW(mimeAppOctetStream, mime_tests2[i].mime) || i == 17)
ok(!lstrcmpW(mime, mimeImagePjpeg), "[%d] wrong mime\n", i);
else
ok(!lstrcmpW(mime, mime_tests2[i].mime) ||
(mime_tests2[i].mime_alt && !lstrcmpW(mime, mime_tests2[i].mime_alt)),
"[%d] wrong mime, got %s\n", i, wine_dbgstr_w(mime));
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));
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\n");
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\n");
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\n");
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, excepted E_INVALIDARG\n", hres);
ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
hres = pFindMimeFromData(NULL, NULL, NULL, 0, mimeTextPlain, 0, &mime, 0);
ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
@ -747,7 +817,7 @@ static void test_FindMimeFromData(void)
hres = pFindMimeFromData(NULL, NULL, data1, 0, mimeTextPlain, 0, &mime, 0);
ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime\n");
ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime: %s\n", wine_dbgstr_w(mime));
CoTaskMemFree(mime);
hres = pFindMimeFromData(NULL, NULL, data1, 0, mimeTextPlain, 0, NULL, 0);
@ -769,7 +839,7 @@ static void register_protocols(void)
hres = CoGetClassObject(&CLSID_AboutProtocol, CLSCTX_INPROC_SERVER, NULL,
&IID_IClassFactory, (void**)&factory);
ok(hres == S_OK, "Coud not get AboutProtocol factory: %08x\n", hres);
ok(hres == S_OK, "Could not get AboutProtocol factory: %08x\n", hres);
if(FAILED(hres))
return;
@ -1154,8 +1224,10 @@ static void test_ReleaseBindInfo(void)
static void test_CopyStgMedium(void)
{
STGMEDIUM src, dst;
HGLOBAL empty;
HGLOBAL empty, hg;
char *ptr1, *ptr2;
HRESULT hres;
int size;
static WCHAR fileW[] = {'f','i','l','e',0};
@ -1192,12 +1264,152 @@ static void test_CopyStgMedium(void)
ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
ReleaseStgMedium(&dst);
/* TYMED_HGLOBAL */
hg = GlobalAlloc(GMEM_MOVEABLE, 10);
ptr1 = GlobalLock(hg);
memset(ptr1, 0xfa, 10);
memset(&dst, 0xe0, sizeof(dst));
src.tymed = TYMED_HGLOBAL;
src.u.hGlobal = hg;
hres = pCopyStgMedium(&src, &dst);
ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
ok(dst.tymed == TYMED_HGLOBAL, "tymed=%d\n", dst.tymed);
ok(dst.u.hGlobal != hg, "got %p, %p\n", dst.u.hGlobal, hg);
size = GlobalSize(dst.u.hGlobal);
ok(size == 10, "got size %d\n", size);
/* compare contents */
ptr2 = GlobalLock(dst.u.hGlobal);
ok(!memcmp(ptr1, ptr2, 10), "got wrong data\n");
GlobalUnlock(ptr2);
GlobalUnlock(ptr1);
ok(GlobalFlags(dst.u.hGlobal) == 0, "got 0x%08x\n", GlobalFlags(dst.u.hGlobal));
GlobalFree(hg);
ReleaseStgMedium(&dst);
memset(&dst, 0xe0, sizeof(dst));
src.tymed = TYMED_HGLOBAL;
src.u.hGlobal = NULL;
hres = pCopyStgMedium(&src, &dst);
ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
ok(dst.u.hGlobal == NULL, "got %p\n", dst.u.hGlobal);
hres = pCopyStgMedium(&src, NULL);
ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
hres = pCopyStgMedium(NULL, &dst);
ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
}
static void test_CopyBindInfo(void)
{
BINDINFO src[2], dest[2];
SECURITY_DESCRIPTOR sec_desc;
HRESULT hres;
int i;
hres = pCopyBindInfo(NULL, NULL);
ok(hres == E_POINTER, "CopyBindInfo returned %08x, expected E_POINTER\n", hres);
memset(src, 0, sizeof(BINDINFO[2]));
memset(dest, 0xde, sizeof(BINDINFO[2]));
hres = pCopyBindInfo(src, dest);
ok(hres == E_INVALIDARG, "CopyBindInfo retuned: %08x, expected E_INVALIDARG\n", hres);
memset(src, 0, sizeof(BINDINFO[2]));
memset(dest, 0xde, sizeof(BINDINFO[2]));
src[0].cbSize = sizeof(BINDINFO);
dest[0].cbSize = 0;
hres = pCopyBindInfo(src, dest);
ok(hres == E_INVALIDARG, "CopyBindInfo retuned: %08x, expected E_INVALIDARG\n", hres);
memset(src, 0, sizeof(BINDINFO[2]));
memset(dest, 0xde, sizeof(BINDINFO[2]));
src[0].cbSize = 1;
dest[0].cbSize = sizeof(BINDINFO)+sizeof(DWORD);
hres = pCopyBindInfo(src, dest);
ok(hres == S_OK, "CopyBindInfo failed: %08x\n", hres);
ok(dest[0].cbSize == sizeof(BINDINFO)+sizeof(DWORD), "incorrect cbSize: %d\n", dest[0].cbSize);
for(i=1; i<dest[0].cbSize/sizeof(int); i++)
ok(((int*)dest)[i] == 0, "unset values should be set to 0, got %d on %d\n", ((int*)dest)[i], i);
memset(src, 0, sizeof(BINDINFO[2]));
memset(dest, 0xde, sizeof(BINDINFO[2]));
src[0].cbSize = sizeof(BINDINFO)+2*sizeof(DWORD);
dest[0].cbSize = sizeof(BINDINFO)+sizeof(DWORD);
hres = pCopyBindInfo(src, dest);
ok(hres == S_OK, "CopyBindInfo failed: %08x\n", hres);
ok(dest[1].cbSize == src[1].cbSize, "additional data should be copied\n");
ok(dest[1].szExtraInfo != src[1].szExtraInfo,
"data not fitting in destination buffer should not be copied\n");
memset(src, 0xf0, sizeof(BINDINFO[2]));
memset(dest, 0xde, sizeof(BINDINFO[2]));
src[0].cbSize = sizeof(BINDINFO);
src[0].szExtraInfo = CoTaskMemAlloc(sizeof(WCHAR));
src[0].szExtraInfo[0] = 0;
src[0].szCustomVerb = NULL;
src[0].pUnk = NULL;
src[0].stgmedData.tymed = TYMED_NULL;
src[0].stgmedData.pUnkForRelease = NULL;
dest[0].cbSize = sizeof(BINDINFO);
hres = pCopyBindInfo(src, dest);
ok(hres == S_OK, "CopyBindInfo failed: %08x\n", hres);
ok(dest[0].cbSize == sizeof(BINDINFO), "incorrect cbSize: %d\n", dest[0].cbSize);
ok(dest[0].szExtraInfo && !dest[0].szExtraInfo[0] && dest[0].szExtraInfo!=src[0].szExtraInfo,
"incorrect szExtraInfo: (%p!=%p) %d\n", dest[0].szExtraInfo,
src[0].szExtraInfo, dest[0].szExtraInfo[0]);
ok(!memcmp(&dest[0].stgmedData, &src[0].stgmedData, sizeof(STGMEDIUM)),
"incorrect stgmedData value\n");
ok(src[0].grfBindInfoF == dest[0].grfBindInfoF, "grfBindInfoF = %x, expected %x\n",
dest[0].grfBindInfoF, src[0].grfBindInfoF);
ok(src[0].dwBindVerb == dest[0].dwBindVerb, "dwBindVerb = %x, expected %x\n",
dest[0].dwBindVerb, src[0].dwBindVerb);
ok(!dest[0].szCustomVerb, "szCustmoVerb != NULL\n");
ok(src[0].cbstgmedData == dest[0].cbstgmedData, "cbstgmedData = %x, expected %x\n",
dest[0].cbstgmedData, src[0].cbstgmedData);
ok(src[0].dwOptions == dest[0].dwOptions, "dwOptions = %x, expected %x\n",
dest[0].dwOptions, src[0].dwOptions);
ok(src[0].dwOptionsFlags == dest[0].dwOptionsFlags, "dwOptionsFlags = %x, expected %x\n",
dest[0].dwOptionsFlags, src[0].dwOptionsFlags);
ok(src[0].dwCodePage == dest[0].dwCodePage, "dwCodePage = %x, expected %x\n",
dest[0].dwCodePage, src[0].dwCodePage);
ok(!dest[0].securityAttributes.nLength,
"unexpected securityAttributes.nLength value: %d\n",
dest[0].securityAttributes.nLength);
ok(!dest[0].securityAttributes.lpSecurityDescriptor,
"unexpected securityAttributes.lpSecurityDescriptor value: %p\n",
dest[0].securityAttributes.lpSecurityDescriptor);
ok(!dest[0].securityAttributes.bInheritHandle,
"unexpected securityAttributes.bInheritHandle value: %d\n",
dest[0].securityAttributes.bInheritHandle);
ok(!memcmp(&dest[0].iid, &src[0].iid, sizeof(IID)),
"incorrect iid value\n");
ok(!dest[0].pUnk, "pUnk != NULL\n");
ok(src[0].dwReserved == dest[0].dwReserved, "dwReserved = %x, expected %x\n",
dest[0].dwReserved, src[0].dwReserved);
CoTaskMemFree(src[0].szExtraInfo);
CoTaskMemFree(dest[0].szExtraInfo);
src[0].szExtraInfo = NULL;
src[0].securityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
ok(InitializeSecurityDescriptor(&sec_desc, SECURITY_DESCRIPTOR_REVISION),
"InitializeSecurityDescriptor failed\n");
src[0].securityAttributes.lpSecurityDescriptor = (void*)&sec_desc;
src[0].securityAttributes.bInheritHandle = TRUE;
hres = pCopyBindInfo(src, dest);
ok(hres == S_OK, "CopyBindInfo failed: %08x\n", hres);
ok(!dest[0].securityAttributes.nLength,
"unexpected securityAttributes.nLength value: %d\n",
dest[0].securityAttributes.nLength);
ok(!dest[0].securityAttributes.lpSecurityDescriptor,
"unexpected securityAttributes.lpSecurityDescriptor value: %p\n",
dest[0].securityAttributes.lpSecurityDescriptor);
ok(!dest[0].securityAttributes.bInheritHandle,
"unexpected securityAttributes.bInheritHandle value: %d\n",
dest[0].securityAttributes.bInheritHandle);
}
static void test_UrlMkGetSessionOption(void)
{
DWORD encoding, size;
@ -1545,7 +1757,7 @@ static void test_internet_features_registry(void) {
char *name;
HKEY feature_control;
HKEY feature;
DWORD value;
DWORD value, skip_zone;
BOOL delete_feature_key = TRUE;
BOOL delete_feature_control_key = FALSE;
@ -1615,21 +1827,32 @@ static void test_internet_features_registry(void) {
value = 1;
res = RegSetValueExA(feature, "*", 0, REG_DWORD, (BYTE*)&value, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %d\n", res);
hres = pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION, GET_FEATURE_FROM_PROCESS);
ok(hres == S_OK, "CoInternetIsFeatureEnabled returned %08x, expected S_OK\n", hres);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not allowed to modify zone elevation\n");
skip_zone = 1;
}
else
{
skip_zone = 0;
ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %d\n", res);
hres = pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION, GET_FEATURE_FROM_PROCESS);
ok(hres == S_OK, "CoInternetIsFeatureEnabled returned %08x, expected S_OK\n", hres);
}
RegDeleteValueA(feature, "*");
RegCloseKey(feature);
RegCloseKey(feature_control);
/* Value is still cached from last time. */
hres = pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION, GET_FEATURE_FROM_PROCESS);
ok(hres == S_OK, "CoInternetIsFeatureEnabled returned %08x, expected S_OK\n", hres);
if (!skip_zone)
{
hres = pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION, GET_FEATURE_FROM_PROCESS);
ok(hres == S_OK, "CoInternetIsFeatureEnabled returned %08x, expected S_OK\n", hres);
hres = pCoInternetSetFeatureEnabled(FEATURE_ZONE_ELEVATION, SET_FEATURE_ON_PROCESS, FALSE);
ok(hres == S_OK, "CoInternetSetFeatureEnabled failed: %08x\n", hres);
hres = pCoInternetSetFeatureEnabled(FEATURE_ZONE_ELEVATION, SET_FEATURE_ON_PROCESS, FALSE);
ok(hres == S_OK, "CoInternetSetFeatureEnabled failed: %08x\n", hres);
}
test_internet_feature_defaults();
}
@ -1709,6 +1932,7 @@ START_TEST(misc)
pCoInternetParseUrl = (void*) GetProcAddress(hurlmon, "CoInternetParseUrl");
pCoInternetQueryInfo = (void*) GetProcAddress(hurlmon, "CoInternetQueryInfo");
pCopyStgMedium = (void*) GetProcAddress(hurlmon, "CopyStgMedium");
pCopyBindInfo = (void*) GetProcAddress(hurlmon, "CopyBindInfo");
pFindMimeFromData = (void*) GetProcAddress(hurlmon, "FindMimeFromData");
pObtainUserAgentString = (void*) GetProcAddress(hurlmon, "ObtainUserAgentString");
pReleaseBindInfo = (void*) GetProcAddress(hurlmon, "ReleaseBindInfo");
@ -1738,6 +1962,7 @@ START_TEST(misc)
test_MimeFilter();
test_ReleaseBindInfo();
test_CopyStgMedium();
test_CopyBindInfo();
test_UrlMkGetSessionOption();
test_user_agent();
test_MkParseDisplayNameEx();

View file

@ -16,18 +16,23 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define COBJMACROS
#define CONST_VTABLE
#include <wine/test.h>
#include <stdarg.h>
//#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "urlmon.h"
#include "wininet.h"
//#include "windef.h"
//#include "winbase.h"
#include <winnls.h>
#include <ole2.h>
//#include "urlmon.h"
#include <wininet.h>
static HRESULT (WINAPI *pCoInternetGetSession)(DWORD, IInternetSession **, DWORD);
static HRESULT (WINAPI *pReleaseBindInfo)(BINDINFO*);
@ -112,7 +117,6 @@ DEFINE_EXPECT(UnlockRequest);
DEFINE_EXPECT(Abort);
DEFINE_EXPECT(MimeFilter_CreateInstance);
DEFINE_EXPECT(MimeFilter_Start);
DEFINE_EXPECT(MimeFilter_ReportProgress);
DEFINE_EXPECT(MimeFilter_ReportData);
DEFINE_EXPECT(MimeFilter_ReportResult);
DEFINE_EXPECT(MimeFilter_Terminate);
@ -134,7 +138,8 @@ static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0};
static const WCHAR hostW[] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
static const WCHAR winehq_ipW[] = {'2','0','9','.','4','6','.','2','5','.','1','3','4',0};
static const WCHAR emptyW[] = {0};
static const WCHAR gzipW[] = {'g','z','i','p',0};
static const WCHAR pjpegW[] = {'i','m','a','g','e','/','p','j','p','e','g',0};
static const WCHAR gifW[] = {'i','m','a','g','e','/','g','i','f',0};
static HRESULT expect_hrResult;
static LPCWSTR file_name, http_url, expect_wsz;
@ -149,9 +154,10 @@ static void *expect_pv;
static HANDLE event_complete, event_complete2, event_continue, event_continue_done;
static BOOL binding_test;
static PROTOCOLDATA protocoldata, *pdata, continue_protdata;
static DWORD prot_read, pi, filter_state, http_post_test, thread_id;
static DWORD prot_read, filter_state, http_post_test, thread_id;
static BOOL security_problem, test_async_req, impl_protex;
static BOOL async_read_pending, mimefilter_test, direct_read, wait_for_switch, emulate_prot, short_read, test_abort;
static BOOL empty_file, no_mime, bind_from_cache;
enum {
STATE_CONNECTING,
@ -200,7 +206,7 @@ static const char *debugstr_guid(REFIID riid)
{
static char buf[50];
sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
riid->Data4[5], riid->Data4[6], riid->Data4[7]);
@ -215,6 +221,13 @@ static int strcmp_wa(LPCWSTR strw, const char *stra)
return lstrcmpA(stra, buf);
}
static const char *w2a(LPCWSTR str)
{
static char buf[INTERNET_MAX_URL_LENGTH];
WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
return buf;
}
static HRESULT WINAPI HttpSecurity_QueryInterface(IHttpSecurity *iface, REFIID riid, void **ppv)
{
if(IsEqualGUID(&IID_IUnknown, riid)
@ -567,8 +580,6 @@ static void call_continue(PROTOCOLDATA *protocol_data)
HRESULT hres;
if(state == STATE_CONNECTING) {
if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST)
CLEAR_CALLED(ReportProgress_COOKIE_SENT);
if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST || tested_protocol == FTP_TEST) {
if (http_is_first){
CLEAR_CALLED(ReportProgress_FINDINGRESOURCE);
@ -593,8 +604,9 @@ static void call_continue(PROTOCOLDATA *protocol_data)
case STATE_STARTDOWNLOADING:
if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST) {
SET_EXPECT(OnResponse);
if(tested_protocol == HTTPS_TEST || test_redirect || test_abort)
if(tested_protocol == HTTPS_TEST || test_redirect || test_abort || empty_file)
SET_EXPECT(ReportProgress_ACCEPTRANGES);
SET_EXPECT(ReportProgress_ENCODING);
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
if(bindf & BINDF_NEEDFILE)
SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
@ -624,10 +636,11 @@ static void call_continue(PROTOCOLDATA *protocol_data)
state = STATE_DOWNLOADING;
if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST) {
CHECK_CALLED(OnResponse);
if(tested_protocol == HTTPS_TEST)
if(tested_protocol == HTTPS_TEST || empty_file)
CHECK_CALLED(ReportProgress_ACCEPTRANGES);
else if(test_redirect)
else if(test_redirect || test_abort)
CLEAR_CALLED(ReportProgress_ACCEPTRANGES);
CLEAR_CALLED(ReportProgress_ENCODING);
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
if(bindf & BINDF_NEEDFILE)
CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
@ -667,12 +680,12 @@ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOL
if(binding_test) {
SetEvent(event_complete);
WaitForSingleObject(event_complete2, INFINITE);
ok( WaitForSingleObject(event_complete2, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
return S_OK;
}if(direct_read) {
continue_protdata = *pProtocolData;
SetEvent(event_continue);
WaitForSingleObject(event_continue_done, INFINITE);
ok( WaitForSingleObject(event_continue_done, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
}else {
call_continue(pProtocolData);
SetEvent(event_complete);
@ -681,6 +694,63 @@ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOL
return S_OK;
}
static const char *status_names[] =
{
"0",
"FINDINGRESOURCE",
"CONNECTING",
"REDIRECTING",
"BEGINDOWNLOADDATA",
"DOWNLOADINGDATA",
"ENDDOWNLOADDATA",
"BEGINDOWNLOADCOMPONENTS",
"INSTALLINGCOMPONENTS",
"ENDDOWNLOADCOMPONENTS",
"USINGCACHEDCOPY",
"SENDINGREQUEST",
"CLASSIDAVAILABLE",
"MIMETYPEAVAILABLE",
"CACHEFILENAMEAVAILABLE",
"BEGINSYNCOPERATION",
"ENDSYNCOPERATION",
"BEGINUPLOADDATA",
"UPLOADINGDATA",
"ENDUPLOADINGDATA",
"PROTOCOLCLASSID",
"ENCODING",
"VERIFIEDMIMETYPEAVAILABLE",
"CLASSINSTALLLOCATION",
"DECODING",
"LOADINGMIMEHANDLER",
"CONTENTDISPOSITIONATTACH",
"FILTERREPORTMIMETYPE",
"CLSIDCANINSTANTIATE",
"IUNKNOWNAVAILABLE",
"DIRECTBIND",
"RAWMIMETYPE",
"PROXYDETECTING",
"ACCEPTRANGES",
"COOKIE_SENT",
"COMPACT_POLICY_RECEIVED",
"COOKIE_SUPPRESSED",
"COOKIE_STATE_UNKNOWN",
"COOKIE_STATE_ACCEPT",
"COOKIE_STATE_REJECT",
"COOKIE_STATE_PROMPT",
"COOKIE_STATE_LEASH",
"COOKIE_STATE_DOWNGRADE",
"POLICY_HREF",
"P3P_HEADER",
"SESSION_COOKIE_RECEIVED",
"PERSISTENT_COOKIE_RECEIVED",
"SESSION_COOKIES_ALLOWED",
"CACHECONTROL",
"CONTENTDISPOSITIONFILENAME",
"MIMETEXTPLAINMISMATCH",
"PUBLISHERAVAILABLE",
"DISPLAYNAMEAVAILABLE"
};
static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode,
LPCWSTR szStatusText)
{
@ -688,9 +758,14 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
'0','0','0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0','0','}',0};
static const WCHAR text_plain[] = {'t','e','x','t','/','p','l','a','i','n',0};
if (ulStatusCode < sizeof(status_names)/sizeof(status_names[0]))
trace( "progress: %s %s\n", status_names[ulStatusCode], wine_dbgstr_w(szStatusText) );
else
trace( "progress: %u %s\n", ulStatusCode, wine_dbgstr_w(szStatusText) );
switch(ulStatusCode) {
case BINDSTATUS_MIMETYPEAVAILABLE:
CHECK_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
CHECK_EXPECT2(ReportProgress_MIMETYPEAVAILABLE);
if(tested_protocol != FILE_TEST && tested_protocol != ITS_TEST && !mimefilter_test && (pi & PI_MIMEVERIFICATION)) {
if(!short_read || !direct_read)
CHECK_CALLED(Read); /* set in Continue */
@ -700,11 +775,18 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText) {
if(tested_protocol == BIND_TEST)
ok(szStatusText == expect_wsz, "unexpected szStatusText\n");
ok(!lstrcmpW(szStatusText, expect_wsz), "unexpected szStatusText %s\n", wine_dbgstr_w(szStatusText));
else if (http_post_test)
ok(lstrlenW(text_plain) <= lstrlenW(szStatusText) &&
!memcmp(szStatusText, text_plain, lstrlenW(text_plain)*sizeof(WCHAR)),
"szStatusText != text/plain\n");
else if(empty_file)
ok(!strcmp_wa(szStatusText, "application/javascript"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
else if((pi & PI_MIMEVERIFICATION) && emulate_prot && !mimefilter_test
&& tested_protocol==HTTP_TEST && !short_read)
ok(lstrlenW(gifW) <= lstrlenW(szStatusText) &&
!memcmp(szStatusText, gifW, lstrlenW(gifW)*sizeof(WCHAR)),
"szStatusText != image/gif\n");
else if(!mimefilter_test)
ok(lstrlenW(text_htmlW) <= lstrlenW(szStatusText) &&
!memcmp(szStatusText, text_htmlW, lstrlenW(text_htmlW)*sizeof(WCHAR)),
@ -755,7 +837,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
CHECK_EXPECT(ReportProgress_VERIFIEDMIMETYPEAVAILABLE);
ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText)
ok(!lstrcmpW(szStatusText, text_htmlW), "szStatusText != text/html\n");
ok(!strcmp_wa(szStatusText, "text/html"), "szStatusText != text/html\n");
break;
case BINDSTATUS_PROTOCOLCLASSID:
CHECK_EXPECT(ReportProgress_PROTOCOLCLASSID);
@ -763,7 +845,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
ok(!lstrcmpW(szStatusText, null_guid), "unexpected classid %s\n", wine_dbgstr_w(szStatusText));
break;
case BINDSTATUS_COOKIE_SENT:
CHECK_EXPECT(ReportProgress_COOKIE_SENT);
CHECK_EXPECT2(ReportProgress_COOKIE_SENT);
ok(szStatusText == NULL, "szStatusText != NULL\n");
break;
case BINDSTATUS_REDIRECTING:
@ -782,8 +864,9 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break;
case BINDSTATUS_PROXYDETECTING:
CHECK_EXPECT(ReportProgress_PROXYDETECTING);
SET_EXPECT(ReportProgress_CONNECTING);
if(!called_ReportProgress_PROXYDETECTING)
SET_EXPECT(ReportProgress_CONNECTING);
CHECK_EXPECT2(ReportProgress_PROXYDETECTING);
ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break;
case BINDSTATUS_LOADINGMIMEHANDLER:
@ -792,7 +875,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
break;
case BINDSTATUS_DECODING:
CHECK_EXPECT(ReportProgress_DECODING);
ok(!lstrcmpW(szStatusText, gzipW), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
ok(!lstrcmpW(szStatusText, pjpegW), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break;
default:
ok(0, "Unexpected status %d\n", ulStatusCode);
@ -822,6 +905,12 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
"grcfBSCF = %08x\n", grfBSCF);
else
ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE), "grcfBSCF = %08x\n", grfBSCF);
}else if(bind_from_cache) {
CHECK_EXPECT(ReportData);
ok(grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE), "grcfBSCF = %08x\n", grfBSCF);
ok(ulProgress == 1000, "ulProgress = %u\n", ulProgress);
ok(!ulProgressMax, "ulProgressMax = %u\n", ulProgressMax);
}else if(direct_read) {
BYTE buf[14096];
ULONG read;
@ -870,7 +959,6 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
if(!emulate_prot)
CHECK_CALLED(ReportData2);
CHECK_CALLED(ReportResult);
ok(hres == S_OK, "Read failed: %08x\n", hres);
reported_all_data = TRUE;
}else {
if(!emulate_prot)
@ -896,14 +984,25 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
}
}else if(!binding_test && (tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST
|| tested_protocol == FTP_TEST)) {
if(!(grfBSCF & BSCF_LASTDATANOTIFICATION) || (grfBSCF & BSCF_DATAFULLYAVAILABLE))
if(empty_file)
CHECK_EXPECT2(ReportData);
else if(!(grfBSCF & BSCF_LASTDATANOTIFICATION) || (grfBSCF & BSCF_DATAFULLYAVAILABLE))
CHECK_EXPECT(ReportData);
else if (http_post_test)
ok(ulProgress == 13, "Read %u bytes instead of 13\n", ulProgress);
ok(ulProgress, "ulProgress == 0\n");
if(empty_file) {
ok(!ulProgress, "ulProgress = %d\n", ulProgress);
ok(!ulProgressMax, "ulProgressMax = %d\n", ulProgressMax);
}else {
ok(ulProgress, "ulProgress == 0\n");
}
if(first_data_notif) {
if(empty_file) {
ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION),
"grcfBSCF = %08x\n", grfBSCF);
first_data_notif = FALSE;
}else if(first_data_notif) {
ok(grfBSCF == BSCF_FIRSTDATANOTIFICATION
|| grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE),
"grcfBSCF = %08x\n", grfBSCF);
@ -1028,7 +1127,20 @@ static HRESULT WINAPI MimeProtocolSink_Switch(IInternetProtocolSink *iface, PROT
static HRESULT WINAPI MimeProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode,
LPCWSTR szStatusText)
{
CHECK_EXPECT(MimeFilter_ReportProgress);
switch(ulStatusCode) {
case BINDSTATUS_LOADINGMIMEHANDLER:
/*
* IE9 for some reason (bug?) calls this on mime handler's protocol sink instead of the
* main protocol sink. We check ReportProgress_LOADINGMIMEHANDLER both here and in
* ProtocolSink_ReportProgress to workaround it.
*/
CHECK_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break;
default:
ok(0, "Unexpected status code %d\n", ulStatusCode);
}
return S_OK;
}
@ -1038,10 +1150,11 @@ static HRESULT WINAPI MimeProtocolSink_ReportData(IInternetProtocolSink *iface,
DWORD read = 0;
BYTE buf[8192];
HRESULT hres;
BOOL report_mime = FALSE;
CHECK_EXPECT(MimeFilter_ReportData);
if(!filter_state) {
if(!filter_state && !no_mime) {
SET_EXPECT(Read);
hres = IInternetProtocol_Read(filtered_protocol, buf, sizeof(buf), &read);
if(tested_protocol == HTTP_TEST)
@ -1055,15 +1168,34 @@ static HRESULT WINAPI MimeProtocolSink_ReportData(IInternetProtocolSink *iface,
ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_MIMETYPEAVAILABLE, text_htmlW);
ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
/* FIXME: test BINDSTATUS_CACHEFILENAMEAVAILABLE */
}
if(!read_report_data)
if(no_mime && prot_read<200) {
SET_EXPECT(Read);
}else if(no_mime && prot_read<300) {
report_mime = TRUE;
SET_EXPECT(Read);
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
SET_EXPECT(ReportData);
}else if(!read_report_data) {
SET_EXPECT(ReportData);
}
hres = IInternetProtocolSink_ReportData(filtered_sink, grfBSCF, ulProgress, ulProgressMax);
ok(hres == S_OK, "ReportData failed: %08x\n", hres);
if(!read_report_data)
if(no_mime && prot_read<=200) {
CHECK_CALLED(Read);
}else if(report_mime) {
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(ReportData);
}else if(!read_report_data) {
CHECK_CALLED(ReportData);
}
if(!filter_state)
filter_state = 1;
@ -1352,6 +1484,8 @@ static HRESULT WINAPI Protocol_Seek(IInternetProtocolEx *iface,
static HRESULT WINAPI ProtocolEmul_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
{
static const IID unknown_iid = {0x7daf9908,0x8415,0x4005,{0x95,0xae, 0xbd,0x27,0xf6,0xe3,0xdc,0x00}};
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
*ppv = iface;
return S_OK;
@ -1383,7 +1517,8 @@ static HRESULT WINAPI ProtocolEmul_QueryInterface(IInternetProtocolEx *iface, RE
return E_NOINTERFACE;
}
ok(0, "unexpected riid %s\n", debugstr_guid(riid));
if(!IsEqualGUID(riid, &unknown_iid)) /* IE10 */
ok(0, "unexpected riid %s\n", debugstr_guid(riid));
*ppv = NULL;
return E_NOINTERFACE;
}
@ -1583,14 +1718,14 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
}
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE,
mimefilter_test ? gzipW : (expect_wsz = text_htmlW));
mimefilter_test ? pjpegW : (expect_wsz = text_htmlW));
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
if(mimefilter_test) {
CHECK_CALLED(MimeFilter_CreateInstance);
CHECK_CALLED(MimeFilter_Start);
CHECK_CALLED(ReportProgress_LOADINGMIMEHANDLER);
todo_wine CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
}else {
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
}
@ -1698,7 +1833,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface,
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
}
hres = IInternetProtocolSink_ReportProgress(binding_sink,
BINDSTATUS_MIMETYPEAVAILABLE, mimefilter_test ? gzipW : text_htmlW);
BINDSTATUS_MIMETYPEAVAILABLE, mimefilter_test ? pjpegW : text_htmlW);
if(mimefilter_test) {
CHECK_CALLED(MimeFilter_CreateInstance);
CHECK_CALLED(MimeFilter_Start);
@ -1719,14 +1854,15 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface,
}
pr = prot_read;
if(mimefilter_test) {
if(mimefilter_test)
SET_EXPECT(MimeFilter_ReportData);
}else if(pi & PI_MIMEVERIFICATION) {
if((!mimefilter_test || no_mime) && (pi & PI_MIMEVERIFICATION)) {
if(pr < 200)
SET_EXPECT(Read); /* checked in ReportData for short_read */
if(pr == 200) {
if(!mimefilter_test)
SET_EXPECT(Read); /* checked in BINDSTATUS_MIMETYPEAVAILABLE or ReportData */
SET_EXPECT(GetBindInfo);
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
}
if(pr >= 200)
@ -1744,6 +1880,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface,
if(!short_read && pr < 200)
CHECK_CALLED(Read);
if(pr == 200) {
CLEAR_CALLED(GetBindInfo); /* IE9 */
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
}
}else {
@ -1801,6 +1938,7 @@ static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv,
prot_state = 4;
if(short_read) {
SET_EXPECT(Read2); /* checked in BINDSTATUS_MIMETYPEAVAILABLE */
SET_EXPECT(GetBindInfo);
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
}
if(mimefilter_test)
@ -1812,8 +1950,10 @@ static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv,
BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION, 0, 0);
read_report_data--;
ok(hres == S_OK, "ReportData failed: %08x\n", hres);
if(short_read)
if(short_read) {
CLEAR_CALLED(GetBindInfo); /* IE9 */
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
}
if(mimefilter_test)
CHECK_CALLED(MimeFilter_ReportData);
else if(direct_read)
@ -1830,8 +1970,12 @@ static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv,
else
CHECK_CALLED(ReportResult);
memset(pv, 'x', 100);
prot_read += *pcbRead = 100;
if(cb > 100)
cb = 100;
memset(pv, 'x', cb);
if(cb>6)
memcpy(pv, "gif87a", 6);
prot_read += *pcbRead = cb;
return S_OK;
}if(prot_state == 4) {
*pcbRead = 0;
@ -1843,8 +1987,12 @@ static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv,
return tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST ? E_PENDING : S_FALSE;
}
memset(pv, 'x', 100);
prot_read += *pcbRead = 100;
if(cb > 100)
cb = 100;
memset(pv, 'x', cb);
if(cb>6)
memcpy(pv, "gif87a", 6);
prot_read += *pcbRead = cb;
return S_OK;
}
@ -1920,7 +2068,7 @@ static HRESULT WINAPI MimeProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU
CHECK_EXPECT(MimeFilter_Start);
ok(!lstrcmpW(szUrl, gzipW), "wrong url %s\n", wine_dbgstr_w(szUrl));
ok(!lstrcmpW(szUrl, pjpegW), "wrong url %s\n", wine_dbgstr_w(szUrl));
ok(grfPI == (PI_FILTER_MODE|PI_FORCE_ASYNC), "grfPI=%x, expected PI_FILTER_MODE|PI_FORCE_ASYNC\n", grfPI);
ok(dwReserved, "dwReserved == 0\n");
ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
@ -1964,7 +2112,7 @@ static HRESULT WINAPI MimeProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU
filtered_sink = pOIProtSink;
SET_EXPECT(ReportProgress_DECODING);
hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_DECODING, gzipW);
hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_DECODING, pjpegW);
ok(hres == S_OK, "ReportProgress(BINDSTATUS_DECODING) failed: %08x\n", hres);
CHECK_CALLED(ReportProgress_DECODING);
@ -2169,22 +2317,27 @@ static IClassFactory mimefilter_cf = { &MimeFilterCFVtbl };
#define TEST_ASYNCREQ 0x0200
#define TEST_USEIURI 0x0400
#define TEST_IMPLPROTEX 0x0800
#define TEST_EMPTY 0x1000
#define TEST_NOMIME 0x2000
#define TEST_FROMCACHE 0x4000
static void register_filter(BOOL do_register)
{
IInternetSession *session;
HRESULT hres;
static const WCHAR gzipW[] = {'g','z','i','p',0};
hres = pCoInternetGetSession(0, &session, 0);
ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
if(do_register) {
hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, gzipW);
hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, pjpegW);
ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, gifW);
ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
}else {
hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, gzipW);
hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, pjpegW);
ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, gifW);
ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
}
@ -2200,6 +2353,7 @@ static void init_test(int prot, DWORD flags)
prot_state = 0;
async_read_pending = TRUE;
mimefilter_test = (flags & TEST_FILTER) != 0;
no_mime = (flags & TEST_NOMIME) != 0;
filter_state = 0;
post_stream_read = 0;
ResetEvent(event_complete);
@ -2220,6 +2374,8 @@ static void init_test(int prot, DWORD flags)
test_redirect = (flags & TEST_REDIRECT) != 0;
test_abort = (flags & TEST_ABORT) != 0;
impl_protex = (flags & TEST_IMPLPROTEX) != 0;
empty_file = (flags & TEST_EMPTY) != 0;
bind_from_cache = (flags & TEST_FROMCACHE) != 0;
register_filter(mimefilter_test);
}
@ -2304,7 +2460,7 @@ static BOOL file_protocol_start(IInternetProtocol *protocol, LPCWSTR url,
CHECK_CALLED(GetBindInfo);
if(!(bindf & BINDF_FROMURLMON))
CHECK_CALLED(ReportProgress_DIRECTBIND);
CLEAR_CALLED(ReportProgress_DIRECTBIND); /* Not called by IE10 */
if(is_first) {
CHECK_CALLED(ReportProgress_SENDINGREQUEST);
CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
@ -2431,6 +2587,24 @@ static void test_file_protocol_url(LPCWSTR url)
IUri_Release(uri);
IInternetProtocolEx_Release(protocolex);
hres = pCreateUri(url, 0, 0, &uri);
ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocolEx, (void**)&protocolex);
ok(hres == S_OK, "Could not get IInternetProtocolEx: %08x\n", hres);
if(file_protocol_start(NULL, NULL, protocolex, uri, TRUE)) {
hres = IInternetProtocolEx_Read(protocolex, buf, 2, &cb);
ok(hres == S_OK, "Read failed: %08x\n", hres);
hres = IInternetProtocolEx_LockRequest(protocolex, 0);
ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
hres = IInternetProtocolEx_UnlockRequest(protocolex);
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
}
IUri_Release(uri);
IInternetProtocolEx_Release(protocolex);
}else {
win_skip("Skipping file protocol StartEx tests\n");
}
@ -2604,6 +2778,51 @@ static void test_file_protocol(void) {
test_file_protocol_fail();
}
static void create_cache_entry(const WCHAR *urlw)
{
FILETIME now, tomorrow, yesterday;
char file_path[MAX_PATH];
BYTE content[1000];
ULARGE_INTEGER li;
const char *url;
HANDLE file;
DWORD size;
unsigned i;
BOOL res;
BYTE cache_headers[] = "HTTP/1.1 200 OK\r\n\r\n";
trace("Testing cache read...\n");
url = w2a(urlw);
for(i = 0; i < sizeof(content); i++)
content[i] = '0' + (i%10);
GetSystemTimeAsFileTime(&now);
li.u.HighPart = now.dwHighDateTime;
li.u.LowPart = now.dwLowDateTime;
li.QuadPart += (LONGLONG)10000000 * 3600 * 24;
tomorrow.dwHighDateTime = li.u.HighPart;
tomorrow.dwLowDateTime = li.u.LowPart;
li.QuadPart -= (LONGLONG)10000000 * 3600 * 24 * 2;
yesterday.dwHighDateTime = li.u.HighPart;
yesterday.dwLowDateTime = li.u.LowPart;
res = CreateUrlCacheEntryA(url, sizeof(content), "", file_path, 0);
ok(res, "CreateUrlCacheEntryA failed: %u\n", GetLastError());
file = CreateFileA(file_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
WriteFile(file, content, sizeof(content), &size, NULL);
CloseHandle(file);
res = CommitUrlCacheEntryA(url, file_path, tomorrow, yesterday, NORMAL_CACHE_ENTRY,
cache_headers, sizeof(cache_headers)-1, "", 0);
ok(res, "CommitUrlCacheEntryA failed: %u\n", GetLastError());
}
static BOOL http_protocol_start(LPCWSTR url, BOOL use_iuri)
{
static BOOL got_user_agent = FALSE;
@ -2629,6 +2848,11 @@ static BOOL http_protocol_start(LPCWSTR url, BOOL use_iuri)
if(http_post_test == TYMED_ISTREAM)
SET_EXPECT(Stream_Seek);
}
if(bind_from_cache) {
SET_EXPECT(OnResponse);
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
SET_EXPECT(ReportData);
}
if(uri) {
IInternetProtocolEx *protocolex;
@ -2666,6 +2890,11 @@ static BOOL http_protocol_start(LPCWSTR url, BOOL use_iuri)
if(http_post_test == TYMED_ISTREAM)
CHECK_CALLED(Stream_Seek);
}
if(bind_from_cache) {
CHECK_CALLED(OnResponse);
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(ReportData);
}
return TRUE;
}
@ -2725,6 +2954,9 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
http_url = url;
http_post_test = tymed;
if(flags & TEST_FROMCACHE)
create_cache_entry(url);
hres = CoGetClassObject(prot == HTTPS_TEST ? &CLSID_HttpSProtocol : &CLSID_HttpProtocol,
CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
@ -2774,27 +3006,43 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
SET_EXPECT(Switch);
}
if(!http_protocol_start(url, (flags & TEST_USEIURI) != 0))
if(!http_protocol_start(url, (flags & TEST_USEIURI) != 0)) {
IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
IInternetProtocol_Release(async_protocol);
return;
}
if(!direct_read && !test_abort)
if(!direct_read && !test_abort && !bind_from_cache)
SET_EXPECT(ReportResult);
expect_hrResult = test_abort ? E_ABORT : S_OK;
if(direct_read) {
SET_EXPECT(Switch);
while(wait_for_switch) {
WaitForSingleObject(event_continue, INFINITE);
ok( WaitForSingleObject(event_continue, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
CHECK_CALLED(Switch); /* Set in ReportData */
call_continue(&continue_protdata);
SetEvent(event_continue_done);
}
}else if(bind_from_cache) {
BYTE buf[1500];
hres = IInternetProtocol_Read(async_protocol, buf, 100, &cb);
ok(hres == S_OK && cb == 100, "Read failed: %08x (%d bytes)\n", hres, cb);
SET_EXPECT(ReportResult);
hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
ok(hres == S_OK && cb == 900, "Read failed: %08x (%d bytes)\n", hres, cb);
CHECK_CALLED(ReportResult);
hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
ok(hres == S_FALSE && !cb, "Read failed: %08x (%d bytes)\n", hres, cb);
}else {
hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
ok((hres == E_PENDING && cb==0) ||
(hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE);
ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bindf & BINDF_FROMURLMON)
CHECK_CALLED(Switch);
else
@ -2812,7 +3060,7 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
ok((hres == E_PENDING && cb==0) ||
(hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE);
ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bindf & BINDF_FROMURLMON)
CHECK_CALLED(Switch);
else
@ -2846,6 +3094,9 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
if(prot == HTTPS_TEST)
CLEAR_CALLED(ReportProgress_SENDINGREQUEST);
if (prot == HTTP_TEST || prot == HTTPS_TEST)
CLEAR_CALLED(ReportProgress_COOKIE_SENT);
hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
ok(hres == INET_E_RESULT_DISPATCHED, "Abort failed: %08x\n", hres);
@ -2859,6 +3110,13 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
}
IClassFactory_Release(factory);
if(flags & TEST_FROMCACHE) {
BOOL res;
res = DeleteUrlCacheEntryW(url);
ok(res, "DeleteUrlCacheEntryA failed: %u\n", GetLastError());
}
}
static void test_http_protocol(void)
@ -2872,6 +3130,13 @@ static void test_http_protocol(void)
static const WCHAR winetest_url[] =
{'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
't','e','s','t','s','/','d','a','t','a','.','p','h','p',0};
static const WCHAR empty_url[] =
{'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
't','e','s','t','s','/','e','m','p','t','y','.','j','s',0};
static const WCHAR cache_only_url[] =
{'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
't','e','s','t','s','/','c','a','c','h','e','-','o','n','l','y',0};
trace("Testing http protocol (not from urlmon)...\n");
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
@ -2897,10 +3162,26 @@ static void test_http_protocol(void)
test_http_protocol_url(winetest_url, HTTP_TEST, TEST_DIRECT_READ|TEST_USEIURI, TYMED_NULL);
trace("Testing http protocol (redirected)...\n");
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
test_http_protocol_url(redirect_url, HTTP_TEST, TEST_REDIRECT, TYMED_NULL);
trace("Testing http protocol empty file...\n");
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
test_http_protocol_url(empty_url, HTTP_TEST, TEST_EMPTY, TYMED_NULL);
/* This is a bit ugly. We unconditionally disable this test on Wine. This won't work until we have
* support for reading from cache via HTTP layer in wininet. Until then, Wine will fail badly, affecting
* other, unrelated, tests. Working around it is not worth the trouble, we may simply make sure those
* tests work on Windows and have them around for the future.
*/
if(broken(1)) {
trace("Testing http protocol (from cache)...\n");
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
test_http_protocol_url(cache_only_url, HTTP_TEST, TEST_FROMCACHE, TYMED_NULL);
}
trace("Testing http protocol abort...\n");
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
test_http_protocol_url(winetest_url, HTTP_TEST, TEST_ABORT, TYMED_NULL);
test_early_abort(&CLSID_HttpProtocol);
@ -2935,10 +3216,10 @@ static void test_ftp_protocol(void)
trace("Testing ftp protocol...\n");
init_test(FTP_TEST, 0);
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
state = STATE_STARTDOWNLOADING;
tested_protocol = FTP_TEST;
first_data_notif = TRUE;
expect_hrResult = E_PENDING;
hres = CoGetClassObject(&CLSID_FtpProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
@ -2979,12 +3260,16 @@ static void test_ftp_protocol(void)
ok((hres == E_PENDING && cb==0) ||
(hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE);
ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
while(1) {
hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
if(hres == E_PENDING)
WaitForSingleObject(event_complete, INFINITE);
{
DWORD ret = WaitForSingleObject(event_complete, 90000);
ok( ret == WAIT_OBJECT_0, "wait timed out\n" );
if (ret != WAIT_OBJECT_0) break;
}
else
if(cb == 0) break;
}
@ -3362,7 +3647,7 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
if(prot == HTTP_TEST || prot == HTTPS_TEST) {
while(prot_state < 4) {
WaitForSingleObject(event_complete, INFINITE);
ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(mimefilter_test && filtered_protocol) {
SET_EXPECT(Continue);
IInternetProtocol_Continue(filtered_protocol, pdata);
@ -3387,7 +3672,7 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
}
if(direct_read)
CHECK_CALLED(ReportData); /* Set in ReportResult */
WaitForSingleObject(event_complete, INFINITE);
ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
}else {
if(mimefilter_test)
SET_EXPECT(MimeFilter_LockRequest);
@ -3471,7 +3756,10 @@ START_TEST(protocol)
test_file_protocol();
test_http_protocol();
test_https_protocol();
if(pCreateUri)
test_https_protocol();
else
win_skip("Skipping https tests on too old platform\n");
test_ftp_protocol();
test_gopher_protocol();
test_mk_protocol();
@ -3490,6 +3778,8 @@ START_TEST(protocol)
test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER);
trace("Testing http binding (mime verification, emulate prot, mime filter)...\n");
test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER);
trace("Testing http binding (mime verification, emulate prot, mime filter, no mime)...\n");
test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER|TEST_NOMIME);
trace("Testing http binding (mime verification, emulate prot, direct read)...\n");
test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_DIRECT_READ);
trace("Testing http binding (mime verification, emulate prot, abort)...\n");

View file

@ -18,6 +18,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define COBJMACROS
#define CONST_VTABLE
#define NONAMELESSUNION
@ -26,16 +30,18 @@
#define _WIN32_IE 0x0700
#include <wine/test.h>
#include <stdarg.h>
#include <stddef.h>
//#include <stdarg.h>
//#include <stddef.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "urlmon.h"
//#include "windef.h"
//#include "winbase.h"
#include <winreg.h>
#include <winnls.h>
#include <ole2.h>
//#include "urlmon.h"
#include "initguid.h"
//#include "initguid.h"
#define URLZONE_CUSTOM URLZONE_USER_MIN+1
#define URLZONE_CUSTOM2 URLZONE_CUSTOM+1
@ -70,6 +76,7 @@ DEFINE_EXPECT(ParseUrl_SECURITY_URL_input2);
DEFINE_EXPECT(ParseUrl_SECURITY_URL_expected);
DEFINE_EXPECT(ParseUrl_SECURITY_URL_http);
DEFINE_EXPECT(ParseUrl_SECURITY_DOMAIN_expected);
DEFINE_EXPECT(ProcessUrlAction);
static HRESULT (WINAPI *pCoInternetCreateSecurityManager)(IServiceProvider *, IInternetSecurityManager**, DWORD);
static HRESULT (WINAPI *pCoInternetCreateZoneManager)(IServiceProvider *, IInternetZoneManager**, DWORD);
@ -77,6 +84,9 @@ static HRESULT (WINAPI *pCoInternetGetSecurityUrl)(LPCWSTR, LPWSTR*, PSUACTION,
static HRESULT (WINAPI *pCoInternetGetSecurityUrlEx)(IUri*, IUri**, PSUACTION, DWORD_PTR);
static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
static HRESULT (WINAPI *pCoInternetGetSession)(DWORD, IInternetSession**, DWORD);
static HRESULT (WINAPI *pCoInternetIsFeatureEnabled)(INTERNETFEATURELIST, DWORD);
static HRESULT (WINAPI *pCoInternetIsFeatureEnabledForUrl)(INTERNETFEATURELIST, DWORD, LPCWSTR, IInternetSecurityManager*);
static HRESULT (WINAPI *pCoInternetIsFeatureZoneElevationEnabled)(LPCWSTR, LPCWSTR, IInternetSecurityManager*, DWORD);
static const WCHAR url1[] = {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l',
'/','b','l','a','n','k','.','h','t','m',0};
@ -94,6 +104,14 @@ static const WCHAR url9[] = {'h','t','t','p',':','/','/','w','w','w','.','z','o'
'.','w','i','n','e','t','e','s','t', '/','s','i','t','e','/','a','b','o','u','t',0};
static const WCHAR url10[] = {'f','i','l','e',':','/','/','s','o','m','e','%','2','0','f','i','l','e',
'.','j','p','g',0};
static const WCHAR url11[] = {'f','i','l','e',':','/','/','c',':','/','I','n','d','e','x','.','h','t','m',0};
static const WCHAR url12[] = {'f','i','l','e',':','/','/','/','c',':','/','I','n','d','e','x','.','h','t','m',0};
static const WCHAR url13[] = {'h','t','t','p',':','g','o','o','g','l','e','.','c','o','m',0};
static const WCHAR url14[] = {'z','i','p',':','t','e','s','t','i','n','g','.','c','o','m','/','t','e','s','t','i','n','g',0};
static const WCHAR url15[] = {'h','t','t','p',':','/','/','g','o','o','g','l','e','.','c','o','m','.','u','k',0};
static const WCHAR url16[] = {'f','i','l','e',':','/','/','/','c',':',0};
static const WCHAR url17[] = {'f','i','l','e',':','/','/','/','c',':','c','\\',0};
static const WCHAR url18[] = {'c',':','\\','t','e','s','t','.','h','t','m',0};
static const WCHAR url4e[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e',
'.','j','p','g',0};
@ -108,6 +126,7 @@ static const char *szZoneMapDomainsKey = "Software\\Microsoft\\Windows\\CurrentV
static const char *szInternetSettingsKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
static const BYTE secid1[] = {'f','i','l','e',':',0,0,0,0};
static const BYTE secid2[] = {'*',':','i','n','d','e','x','.','h','t','m',3,0,0,0};
static const BYTE secid5[] = {'h','t','t','p',':','w','w','w','.','z','o','n','e','3',
'.','w','i','n','e','t','e','s','t',3,0,0,0};
static const BYTE secid6[] = {'a','b','o','u','t',':','b','l','a','n','k',3,0,0,0};
@ -115,8 +134,12 @@ static const BYTE secid7[] = {'f','t','p',':','z','o','n','e','3',
'.','w','i','n','e','t','e','s','t',3,0,0,0};
static const BYTE secid10[] =
{'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e','.','j','p','g',3,0,0,0};
static const BYTE secid14[] =
{'z','i','p',':','t','e','s','t','i','n','g','.','c','o','m','/','t','e','s','t','i','n','g',3,0,0,0};
static const BYTE secid10_2[] =
{'f','i','l','e',':','s','o','m','e',' ','f','i','l','e','.','j','p','g',3,0,0,0};
static const BYTE secid13[] = {'h','t','t','p',':','c','o','m','.','u','k',3,0,0,0};
static const BYTE secid13_2[] = {'h','t','t','p',':','g','o','o','g','l','e','.','c','o','m','.','u','k',3,0,0,0};
static const GUID CLSID_TestActiveX =
{0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x06,0x46}};
@ -126,6 +149,7 @@ const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY =
{0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}};
static int called_securl_http;
static DWORD ProcessUrlAction_policy;
static struct secmgr_test {
LPCWSTR url;
@ -140,7 +164,12 @@ static struct secmgr_test {
{url3, 0, S_OK, sizeof(secid1), secid1, S_OK},
{url5, 3, S_OK, sizeof(secid5), secid5, S_OK},
{url6, 3, S_OK, sizeof(secid6), secid6, S_OK},
{url7, 3, S_OK, sizeof(secid7), secid7, S_OK}
{url7, 3, S_OK, sizeof(secid7), secid7, S_OK},
{url11,0, S_OK, sizeof(secid1), secid1, S_OK},
{url12,0, S_OK, sizeof(secid1), secid1, S_OK},
{url16,0, S_OK, sizeof(secid1), secid1, S_OK},
{url17,0, S_OK, sizeof(secid1), secid1, S_OK},
{url18,0, S_OK, sizeof(secid1), secid1, S_OK}
};
static int strcmp_w(const WCHAR *str1, const WCHAR *str2)
@ -244,6 +273,103 @@ cleanup:
return ret;
}
static HRESULT WINAPI SecurityManager_QueryInterface(IInternetSecurityManager* This,
REFIID riid, void **ppvObject)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static ULONG WINAPI SecurityManager_AddRef(IInternetSecurityManager* This)
{
return 2;
}
static ULONG WINAPI SecurityManager_Release(IInternetSecurityManager* This)
{
return 1;
}
static HRESULT WINAPI SecurityManager_SetSecuritySite(IInternetSecurityManager* This,
IInternetSecurityMgrSite *pSite)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI SecurityManager_GetSecuritySite(IInternetSecurityManager* This,
IInternetSecurityMgrSite **ppSite)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI SecurityManager_MapUrlToZone(IInternetSecurityManager* This,
LPCWSTR pwszUrl, DWORD *pdwZone, DWORD dwFlags)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI SecurityManager_GetSecurityId(IInternetSecurityManager* This,
LPCWSTR pwszUrl, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI SecurityManager_ProcessUrlAction(IInternetSecurityManager* This,
LPCWSTR pwszUrl, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy,
BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
{
CHECK_EXPECT(ProcessUrlAction);
ok(dwAction == URLACTION_FEATURE_ZONE_ELEVATION, "dwAction = %x\n", dwAction);
ok(cbPolicy == sizeof(DWORD), "cbPolicy = %d\n", cbPolicy);
ok(!pContext, "pContext != NULL\n");
ok(dwFlags == PUAF_NOUI, "dwFlags = %x\n", dwFlags);
ok(dwReserved == 0, "dwReserved = %x\n", dwReserved);
*pPolicy = ProcessUrlAction_policy;
return ProcessUrlAction_policy==URLPOLICY_ALLOW ? S_OK : S_FALSE;
}
static HRESULT WINAPI SecurityManager_QueryCustomPolicy(IInternetSecurityManager* This,
LPCWSTR pwszUrl, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy,
BYTE *pContext, DWORD cbContext, DWORD dwReserved)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI SecurityManager_SetZoneMapping(IInternetSecurityManager* This,
DWORD dwZone, LPCWSTR lpszPattern, DWORD dwFlags)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI SecurityManager_GetZoneMappings(IInternetSecurityManager* This,
DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static const IInternetSecurityManagerVtbl SecurityManagerVtbl = {
SecurityManager_QueryInterface,
SecurityManager_AddRef,
SecurityManager_Release,
SecurityManager_SetSecuritySite,
SecurityManager_GetSecuritySite,
SecurityManager_MapUrlToZone,
SecurityManager_GetSecurityId,
SecurityManager_ProcessUrlAction,
SecurityManager_QueryCustomPolicy,
SecurityManager_SetZoneMapping,
SecurityManager_GetZoneMappings
};
static IInternetSecurityManager security_manager = { &SecurityManagerVtbl };
static void test_SecurityManager(void)
{
@ -305,10 +431,32 @@ static void test_SecurityManager(void)
ok(size == sizeof(secid10) ||
size == sizeof(secid10_2), /* win2k3 */
"size=%d\n", size);
ok(!memcmp(buf, secid10, size) ||
!memcmp(buf, secid10_2, size), /* win2k3 */
ok(!memcmp(buf, secid10, sizeof(secid10)) ||
!memcmp(buf, secid10_2, sizeof(secid10_2)), /* win2k3 */
"wrong secid\n");
zone = 100;
hres = IInternetSecurityManager_MapUrlToZone(secmgr, url13, &zone, 0);
ok(hres == S_OK, "MapUrlToZone failed: %08x\n", hres);
ok(zone == URLZONE_INVALID || broken(zone == URLZONE_INTERNET), "zone=%d\n", zone);
size = sizeof(buf);
memset(buf, 0xf0, sizeof(buf));
hres = IInternetSecurityManager_GetSecurityId(secmgr, url13, buf, &size, 0);
ok(hres == E_INVALIDARG || broken(hres == S_OK), "GetSecurityId failed: %08x\n", hres);
zone = 100;
hres = IInternetSecurityManager_MapUrlToZone(secmgr, url14, &zone, 0);
ok(hres == S_OK, "MapUrlToZone failed: %08x, expected S_OK\n", hres);
ok(zone == URLZONE_INTERNET, "zone=%d\n", zone);
size = sizeof(buf);
memset(buf, 0xf0, sizeof(buf));
hres = IInternetSecurityManager_GetSecurityId(secmgr, url14, buf, &size, 0);
ok(hres == S_OK, "GetSecurityId failed: %08x, expected S_OK\n", hres);
ok(size == sizeof(secid14), "size=%d\n", size);
ok(!memcmp(buf, secid14, size), "wrong secid\n");
zone = 100;
hres = IInternetSecurityManager_MapUrlToZone(secmgr, NULL, &zone, 0);
ok(hres == E_INVALIDARG, "MapUrlToZone failed: %08x, expected E_INVALIDARG\n", hres);
@ -600,7 +748,8 @@ static const zone_domain_mapping zone_domain_mappings[] = {
{"www.testing.com",NULL,"http",URLZONE_CUSTOM},
{"www.testing.com","testing","http",URLZONE_CUSTOM2},
{"org",NULL,"http",URLZONE_CUSTOM},
{"org","testing","http",URLZONE_CUSTOM2}
{"org","testing","http",URLZONE_CUSTOM2},
{"wine.testing",NULL,"*",URLZONE_CUSTOM2}
};
static void register_zone_domains(void)
@ -747,7 +896,10 @@ static const zone_mapping_test zone_mapping_tests[] = {
/* Tests for "org" zone mappings. */
{"http://google.org/",URLZONE_INTERNET,FALSE,URLZONE_CUSTOM},
{"http://org/",URLZONE_CUSTOM},
{"http://testing.org/",URLZONE_CUSTOM2}
{"http://testing.org/",URLZONE_CUSTOM2},
/* Tests for "wine.testing" mapping */
{"*:wine.testing/test",URLZONE_CUSTOM2},
{"http://wine.testing/testing",URLZONE_CUSTOM2}
};
static void test_zone_domain_mappings(void)
@ -1135,7 +1287,7 @@ static void test_SetZoneAttributes(void)
/* The key for the zone must be present, when calling SetZoneAttributes */
myRegDeleteTreeA(HKEY_CURRENT_USER, regpath);
/* E_FAIL is returned from IE6 here, which is resonable.
/* E_FAIL is returned from IE6 here, which is reasonable.
All newer IE return S_OK without saving the zone attributes to the registry.
This is a Windows bug, but we have to accept that as standard */
hr = IInternetZoneManager_SetZoneAttributes(zonemgr, URLZONE_CUSTOM, pZA);
@ -1553,7 +1705,7 @@ static void test_InternetGetSecurityUrlEx_Pluggable(void)
HRESULT hr;
IUri *uri = NULL, *result;
trace("testing CoInternetGetSecurityUrlEx for plugable protocols...\n");
trace("testing CoInternetGetSecurityUrlEx for pluggable protocols...\n");
hr = pCreateUri(security_urlW, 0, 0, &uri);
ok(hr == S_OK, "CreateUri returned 0x%08x\n", hr);
@ -1609,6 +1761,236 @@ static void test_InternetGetSecurityUrlEx_Pluggable(void)
if(uri) IUri_Release(uri);
}
static const BYTE secidex2_1[] = {'z','i','p',':','/','/','t','e','s','t','i','n','g','.','c','o','m','/',3,0,0,0};
static const BYTE secidex2_2[] = {'z','i','p',':','t','e','s','t','i','n','g','.','c','o','m',3,0,0,0};
static const BYTE secidex2_3[] = {'*',':','t','e','s','t','i','n','g','.','c','o','m',3,0,0,0};
static const struct {
const char *uri;
DWORD create_flags;
HRESULT map_hres;
DWORD zone;
BOOL map_todo;
const BYTE *secid;
DWORD secid_size;
HRESULT secid_hres;
BOOL secid_todo;
} sec_mgr_ex2_tests[] = {
{"res://mshtml.dll/blank.htm",0,S_OK,URLZONE_LOCAL_MACHINE,FALSE,secid1,sizeof(secid1),S_OK},
{"index.htm",Uri_CREATE_ALLOW_RELATIVE,0,URLZONE_INTERNET,FALSE,secid2,sizeof(secid2),S_OK},
{"file://c:\\Index.html",0,0,URLZONE_LOCAL_MACHINE,FALSE,secid1,sizeof(secid1),S_OK},
{"http://www.zone3.winetest/",0,0,URLZONE_INTERNET,FALSE,secid5,sizeof(secid5),S_OK},
{"about:blank",0,0,URLZONE_INTERNET,FALSE,secid6,sizeof(secid6),S_OK},
{"ftp://zone3.winetest/file.test",0,0,URLZONE_INTERNET,FALSE,secid7,sizeof(secid7),S_OK},
{"/file/testing/test.test",Uri_CREATE_ALLOW_RELATIVE,0,URLZONE_INTERNET,FALSE,NULL,0,E_INVALIDARG},
{"zip://testing.com/",0,0,URLZONE_INTERNET,FALSE,secidex2_1,sizeof(secidex2_1),S_OK},
{"zip:testing.com",0,0,URLZONE_INTERNET,FALSE,secidex2_2,sizeof(secidex2_2),S_OK},
{"http:google.com",0,S_OK,URLZONE_INVALID,FALSE,NULL,0,E_INVALIDARG},
{"http:/google.com",0,S_OK,URLZONE_INVALID,FALSE,NULL,0,E_INVALIDARG},
{"*:/testing",0,S_OK,URLZONE_INTERNET,FALSE,NULL,0,E_INVALIDARG},
{"*://testing.com",0,S_OK,URLZONE_INTERNET,FALSE,secidex2_3,sizeof(secidex2_3),S_OK}
};
static void test_SecurityManagerEx2(void)
{
HRESULT hres;
DWORD i, zone;
BYTE buf[512];
DWORD buf_size = sizeof(buf);
IInternetSecurityManager *sec_mgr;
IInternetSecurityManagerEx2 *sec_mgr2;
IUri *uri = NULL;
static const WCHAR domainW[] = {'c','o','m','.','u','k',0};
if(!pCreateUri) {
win_skip("Skipping SecurityManagerEx2, IE is too old\n");
return;
}
trace("Testing SecurityManagerEx2...\n");
hres = pCoInternetCreateSecurityManager(NULL, &sec_mgr, 0);
ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
hres = IInternetSecurityManager_QueryInterface(sec_mgr, &IID_IInternetSecurityManagerEx2, (void**)&sec_mgr2);
ok(hres == S_OK, "QueryInterface(IID_IInternetSecurityManagerEx2) failed: %08x\n", hres);
zone = 0xdeadbeef;
hres = IInternetSecurityManagerEx2_MapUrlToZoneEx2(sec_mgr2, NULL, &zone, 0, NULL, NULL);
ok(hres == E_INVALIDARG, "MapUrlToZoneEx2 returned %08x, expected E_INVALIDARG\n", hres);
ok(zone == URLZONE_INVALID, "zone was %d\n", zone);
hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, NULL, buf, &buf_size, 0);
ok(hres == E_INVALIDARG, "GetSecurityIdEx2 returned %08x, expected E_INVALIDARG\n", hres);
ok(buf_size == sizeof(buf), "buf_size was %d\n", buf_size);
hres = pCreateUri(url5, 0, 0, &uri);
ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
hres = IInternetSecurityManagerEx2_MapUrlToZoneEx2(sec_mgr2, uri, NULL, 0, NULL, NULL);
ok(hres == E_INVALIDARG, "MapToUrlZoneEx2 returned %08x, expected E_INVALIDARG\n", hres);
buf_size = sizeof(buf);
hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, uri, NULL, &buf_size, 0);
ok(hres == E_INVALIDARG || broken(hres == S_OK), "GetSecurityIdEx2 failed: %08x\n", hres);
ok(buf_size == sizeof(buf), "bug_size was %d\n", buf_size);
hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, uri, buf, NULL, 0);
ok(hres == E_INVALIDARG, "GetSecurityIdEx2 returned %08x, expected E_INVALIDARG\n", hres);
IUri_Release(uri);
for(i = 0; i < sizeof(sec_mgr_ex2_tests)/sizeof(sec_mgr_ex2_tests[0]); ++i) {
LPWSTR uriW = a2w(sec_mgr_ex2_tests[i].uri);
uri = NULL;
zone = URLZONE_INVALID;
hres = pCreateUri(uriW, sec_mgr_ex2_tests[i].create_flags, 0, &uri);
ok(hres == S_OK, "CreateUri returned %08x for '%s'\n", hres, sec_mgr_ex2_tests[i].uri);
hres = IInternetSecurityManagerEx2_MapUrlToZoneEx2(sec_mgr2, uri, &zone, 0, NULL, NULL);
if(sec_mgr_ex2_tests[i].map_todo) {
todo_wine
ok(hres == sec_mgr_ex2_tests[i].map_hres, "MapUrlZoneToEx2 returned %08x, expected %08x for '%s'\n",
hres, sec_mgr_ex2_tests[i].map_hres, sec_mgr_ex2_tests[i].uri);
todo_wine
ok(zone == sec_mgr_ex2_tests[i].zone, "Expected zone %d, but got %d for '%s'\n", sec_mgr_ex2_tests[i].zone,
zone, sec_mgr_ex2_tests[i].uri);
} else {
ok(hres == sec_mgr_ex2_tests[i].map_hres, "MapUrlToZoneEx2 returned %08x, expected %08x for '%s'\n",
hres, sec_mgr_ex2_tests[i].map_hres, sec_mgr_ex2_tests[i].uri);
ok(zone == sec_mgr_ex2_tests[i].zone, "Expected zone %d, but got %d for '%s'\n", sec_mgr_ex2_tests[i].zone,
zone, sec_mgr_ex2_tests[i].uri);
}
buf_size = sizeof(buf);
memset(buf, 0xf0, buf_size);
hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, uri, buf, &buf_size, 0);
if(sec_mgr_ex2_tests[i].secid_todo) {
todo_wine
ok(hres == sec_mgr_ex2_tests[i].secid_hres, "GetSecurityIdEx2 returned %08x, expected %08x on test '%s'\n",
hres, sec_mgr_ex2_tests[i].secid_hres, sec_mgr_ex2_tests[i].uri);
if(sec_mgr_ex2_tests[i].secid) {
todo_wine {
ok(buf_size == sec_mgr_ex2_tests[i].secid_size, "Got wrong security id size=%d, expected %d on test '%s'\n",
buf_size, sec_mgr_ex2_tests[i].secid_size, sec_mgr_ex2_tests[i].uri);
ok(!memcmp(buf, sec_mgr_ex2_tests[i].secid, sec_mgr_ex2_tests[i].secid_size), "Got wrong security id on test '%s'\n",
sec_mgr_ex2_tests[i].uri);
}
}
} else {
ok(hres == sec_mgr_ex2_tests[i].secid_hres, "GetSecurityIdEx2 returned %08x, expected %08x on test '%s'\n",
hres, sec_mgr_ex2_tests[i].secid_hres, sec_mgr_ex2_tests[i].uri);
if(sec_mgr_ex2_tests[i].secid) {
ok(buf_size == sec_mgr_ex2_tests[i].secid_size, "Got wrong security id size=%d, expected %d on test '%s'\n",
buf_size, sec_mgr_ex2_tests[i].secid_size, sec_mgr_ex2_tests[i].uri);
ok(!memcmp(buf, sec_mgr_ex2_tests[i].secid, sec_mgr_ex2_tests[i].secid_size), "Got wrong security id on test '%s'\n",
sec_mgr_ex2_tests[i].uri);
}
}
heap_free(uriW);
IUri_Release(uri);
}
hres = pCreateUri(url15, 0, 0, &uri);
ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
buf_size = sizeof(buf);
memset(buf, 0xf0, buf_size);
hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, uri, buf, &buf_size, (DWORD_PTR)domainW);
ok(hres == S_OK, "GetSecurityIdEx2 failed: %08x\n", hres);
todo_wine ok(buf_size == sizeof(secid13), "buf_size was %d\n", buf_size);
todo_wine ok(!memcmp(buf, secid13, sizeof(secid13)), "Got wrong secid\n");
buf_size = sizeof(buf);
memset(buf, 0xf0, buf_size);
hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, uri, buf, &buf_size, 0);
ok(hres == S_OK, "GetSecurityIdEx2 failed: %08x\n", hres);
ok(buf_size == sizeof(secid13_2), "buf_size was %d\n", buf_size);
ok(!memcmp(buf, secid13_2, sizeof(secid13_2)), "Got wrong secid\n");
IUri_Release(uri);
IInternetSecurityManagerEx2_Release(sec_mgr2);
IInternetSecurityManager_Release(sec_mgr);
}
static void test_CoInternetIsFeatureZoneElevationEnabled(void)
{
struct {
const char *url_from;
const char *url_to;
DWORD flags;
HRESULT hres;
DWORD policy_flags;
} testcases[] = {
/* 0 */ { "http://www.winehq.org", "http://www.winehq.org", 0, S_FALSE, URLPOLICY_ALLOW },
/* 1 */ { "http://www.winehq.org", "http://www.winehq.org", 0, S_OK, URLPOLICY_DISALLOW },
/* 2 */ { "http://www.winehq.org", "http://www.codeweavers.com", 0, S_FALSE, URLPOLICY_ALLOW },
/* 3 */ { "http://www.winehq.org", "http://www.codeweavers.com", 0, S_OK, URLPOLICY_DISALLOW },
/* 4 */ { "http://www.winehq.org", "http://www.winehq.org", GET_FEATURE_FROM_PROCESS, S_FALSE, -1 },
/* 5 */ { "http://www.winehq.org", "http://www.winehq.org/dir", GET_FEATURE_FROM_PROCESS, S_FALSE, -1 },
/* 6 */ { "http://www.winehq.org", "http://www.codeweavers.com", GET_FEATURE_FROM_PROCESS, S_FALSE, -1 },
/* 7 */ { "http://www.winehq.org", "ftp://winehq.org", GET_FEATURE_FROM_PROCESS, S_FALSE, -1 },
/* 8 */ { "http://www.winehq.org", "ftp://winehq.org", GET_FEATURE_FROM_PROCESS|0x100, S_FALSE, URLPOLICY_ALLOW },
/* 9 */ { "http://www.winehq.org", "ftp://winehq.org", GET_FEATURE_FROM_REGISTRY, S_FALSE, URLPOLICY_ALLOW },
};
WCHAR *url_from, *url_to;
int i;
HRESULT hres;
if(!pCoInternetIsFeatureZoneElevationEnabled || !pCoInternetIsFeatureEnabled
|| !pCoInternetIsFeatureEnabledForUrl) {
win_skip("Skipping CoInternetIsFeatureZoneElevationEnabled tests\n");
return;
}
hres = pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION, GET_FEATURE_FROM_PROCESS);
ok(SUCCEEDED(hres), "CoInternetIsFeatureEnabled returned %x\n", hres);
trace("Testing CoInternetIsFeatureZoneElevationEnabled... (%x)\n", hres);
for(i=0; i<sizeof(testcases)/sizeof(testcases[0]); i++) {
if(hres==S_OK && testcases[i].flags == GET_FEATURE_FROM_PROCESS)
testcases[i].policy_flags = URLPOLICY_ALLOW;
}
for(i=0; i<sizeof(testcases)/sizeof(testcases[0]); i++) {
url_from = a2w(testcases[i].url_from);
url_to = a2w(testcases[i].url_to);
if(testcases[i].policy_flags != -1) {
ProcessUrlAction_policy = testcases[i].policy_flags;
SET_EXPECT(ProcessUrlAction);
}
hres = pCoInternetIsFeatureZoneElevationEnabled(url_from, url_to,
&security_manager, testcases[i].flags);
ok(hres == testcases[i].hres, "%d) CoInternetIsFeatureZoneElevationEnabled returned %x\n", i, hres);
if(testcases[i].policy_flags != -1)
CHECK_CALLED(ProcessUrlAction);
if(testcases[i].policy_flags != -1)
SET_EXPECT(ProcessUrlAction);
hres = pCoInternetIsFeatureEnabledForUrl(FEATURE_ZONE_ELEVATION,
testcases[i].flags, url_to, &security_manager);
ok(hres == testcases[i].hres, "%d) CoInternetIsFeatureEnabledForUrl returned %x\n", i, hres);
if(testcases[i].policy_flags != -1)
CHECK_CALLED(ProcessUrlAction);
heap_free(url_from);
heap_free(url_to);
}
}
START_TEST(sec_mgr)
{
HMODULE hurlmon;
@ -1622,6 +2004,9 @@ START_TEST(sec_mgr)
pCoInternetGetSecurityUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetGetSecurityUrlEx");
pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
pCoInternetIsFeatureEnabled = (void*) GetProcAddress(hurlmon, "CoInternetIsFeatureEnabled");
pCoInternetIsFeatureEnabledForUrl = (void*) GetProcAddress(hurlmon, "CoInternetIsFeatureEnabledForUrl");
pCoInternetIsFeatureZoneElevationEnabled = (void*) GetProcAddress(hurlmon, "CoInternetIsFeatureZoneElevationEnabled");
if (!pCoInternetCreateSecurityManager || !pCoInternetCreateZoneManager ||
!pCoInternetGetSecurityUrl) {
@ -1648,6 +2033,7 @@ START_TEST(sec_mgr)
}
test_SecurityManager();
test_SecurityManagerEx2();
test_polices();
test_zone_domains();
test_CoInternetCreateZoneManager();
@ -1657,6 +2043,7 @@ START_TEST(sec_mgr)
test_GetZoneAttributes();
test_SetZoneAttributes();
test_InternetSecurityMarshalling();
test_CoInternetIsFeatureZoneElevationEnabled();
unregister_protocols();
OleUninitialize();

View file

@ -16,18 +16,23 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define COBJMACROS
#define CONST_VTABLE
#include <wine/test.h>
#include <stdarg.h>
#include <stddef.h>
//#include <stdarg.h>
//#include <stddef.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "urlmon.h"
#include "wininet.h"
//#include "windef.h"
//#include "winbase.h"
#include <winnls.h>
#include <ole2.h>
//#include "urlmon.h"
#include <wininet.h>
#define DEFINE_EXPECT(func) \
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE

View file

@ -1,10 +1,7 @@
/* Automatically generated file; DO NOT EDIT!! */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define STANDALONE
#include "wine/test.h"
#include <wine/test.h>
extern void func_generated(void);
extern void func_misc(void);

File diff suppressed because it is too large Load diff

View file

@ -19,21 +19,29 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include <stdarg.h>
#include <stdio.h>
#define COBJMACROS
#define NONAMELESSUNION
#define CONST_VTABLE
#include "windef.h"
#include "winbase.h"
#include "initguid.h"
#include "urlmon.h"
#include "wininet.h"
#include "mshtml.h"
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <winreg.h>
#include <wingdi.h>
#include <objbase.h>
//#include "initguid.h"
//#include "urlmon.h"
#include <wininet.h>
#include <mshtml.h>
#include "wine/test.h"
#include <wine/test.h>
static HRESULT (WINAPI *pCreateAsyncBindCtxEx)(IBindCtx *, DWORD,
IBindStatusCallback *, IEnumFORMATETC *, IBindCtx **, DWORD);
@ -42,6 +50,7 @@ static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
DEFINE_GUID(CLSID_IdentityUnmarshal,0x0000001b,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
DEFINE_GUID(IID_IBindStatusCallbackHolder,0x79eac9cc,0xbaf9,0x11ce,0x8c,0x82,0x00,0xaa,0x00,0x4b,0xa9,0x0b);
extern CLSID CLSID_AboutProtocol;
#define DEFINE_EXPECT(func) \
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
@ -149,29 +158,7 @@ DEFINE_EXPECT(OnSecurityProblem);
static const WCHAR winetest_data_urlW[] =
{'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
't','e','s','t','s','/','d','a','t','a','.','p','h','p',0};
static const WCHAR TEST_PART_URL_1[] = {'/','t','e','s','t','s','/','d','a','t','a','.','p','h','p','\0'};
static const WCHAR winetest_post_urlW[] =
{'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
't','e','s','t','s','/','p','o','s','t','.','p','h','p',0};
static const WCHAR ABOUT_BLANK[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
static WCHAR INDEX_HTML[MAX_PATH];
static const WCHAR ITS_URL[] =
{'i','t','s',':','t','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0};
static const WCHAR MK_URL[] = {'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 https_urlW[] =
{'h','t','t','p','s',':','/','/','w','w','w','.','c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',
'/','t','e','s','t','.','h','t','m','l',0};
static const WCHAR https_invalid_cn_urlW[] =
{'h','t','t','p','s',':','/','/','2','0','9','.','4','6','.','2','5','.','1','3','2',
'/','t','e','s','t','.','h','t','m','l',0};
static const WCHAR ftp_urlW[] = {'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g',
'/','p','u','b','/','o','t','h','e','r','/',
'w','i','n','e','l','o','g','o','.','x','c','f','.','t','a','r','.','b','z','2',0};
static const WCHAR winetest_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
@ -190,8 +177,9 @@ static const CHAR test_txtA[] = "test.txt";
static const WCHAR emptyW[] = {0};
static BOOL stopped_binding = FALSE, stopped_obj_binding = FALSE, emulate_protocol = FALSE,
data_available = FALSE, http_is_first = TRUE, bind_to_object = FALSE, filedwl_api;
data_available = FALSE, http_is_first = TRUE, bind_to_object = FALSE, filedwl_api, post_test;
static DWORD read = 0, bindf = 0, prot_state = 0, thread_id, tymed, security_problem;
static const WCHAR *reported_url;
static CHAR mime_type[512];
static IInternetProtocolSink *protocol_sink = NULL;
static IBinding *current_binding;
@ -206,19 +194,9 @@ static BOOL only_check_prot_args = FALSE;
static BOOL invalid_cn_accepted = FALSE;
static BOOL abort_start = FALSE;
static BOOL abort_progress = FALSE;
static BOOL async_switch = FALSE;
static LPCWSTR urls[] = {
winetest_data_urlW,
ABOUT_BLANK,
INDEX_HTML,
ITS_URL,
MK_URL,
https_urlW,
ftp_urlW,
winetest_urlW
};
static WCHAR file_url[INTERNET_MAX_URL_LENGTH];
static WCHAR file_url[INTERNET_MAX_URL_LENGTH], current_url[INTERNET_MAX_URL_LENGTH];
static enum {
HTTP_TEST,
@ -228,7 +206,8 @@ static enum {
MK_TEST,
HTTPS_TEST,
FTP_TEST,
WINETEST_TEST
WINETEST_TEST,
WINETEST_SYNC_TEST
} test_protocol;
static enum {
@ -317,6 +296,8 @@ static void test_create(void)
IBindCtx *bctx;
HRESULT hr;
static const WCHAR TEST_PART_URL_1[] = {'/','t','e','s','t','s','/','d','a','t','a','.','p','h','p',0};
test_CreateURLMoniker(winetest_data_urlW, TEST_PART_URL_1);
mon = (void*)0xdeadbeef;
@ -324,6 +305,7 @@ static void test_create(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = CreateBindCtx(0, &bctx);
ok(hr == S_OK, "got 0x%08x\n", hr);
stream = (void*)0xdeadbeef;
hr = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, (void**)&stream);
@ -434,7 +416,7 @@ static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
static void test_switch_fail(void)
{
IInternetProtocolSink *binding_sink;
PROTOCOLDATA protocoldata;
PROTOCOLDATA protocoldata = {0};
HRESULT hres;
static BOOL tested_switch_fail;
@ -455,7 +437,7 @@ static void test_switch_fail(void)
static DWORD WINAPI thread_proc(PVOID arg)
{
PROTOCOLDATA protocoldata;
PROTOCOLDATA protocoldata = {0};
HRESULT hres;
if(!no_callback) {
@ -468,7 +450,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
BINDSTATUS_FINDINGRESOURCE, wszWineHQSite);
ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
if(!no_callback) {
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bind_to_object)
CHECK_CALLED(Obj_OnProgress_FINDINGRESOURCE);
else
@ -485,7 +467,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
BINDSTATUS_CONNECTING, wszWineHQIP);
ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
if(!no_callback) {
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bind_to_object)
CHECK_CALLED(Obj_OnProgress_CONNECTING);
else
@ -502,7 +484,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
BINDSTATUS_SENDINGREQUEST, NULL);
ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
if(!no_callback) {
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bind_to_object)
CHECK_CALLED(Obj_OnProgress_SENDINGREQUEST);
else
@ -516,7 +498,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
SET_EXPECT(OnProgress_REDIRECTING);
hres = IInternetProtocolSink_ReportProgress(protocol_sink, BINDSTATUS_REDIRECTING, winetest_data_urlW);
ok(hres == S_OK, "ReportProgress(BINDSTATUS_REFIRECTING) failed: %08x\n", hres);
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bind_to_object)
CHECK_CALLED(Obj_OnProgress_REDIRECTING);
else
@ -529,7 +511,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
prot_state = 1;
hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
CHECK_CALLED(Continue);
CHECK_CALLED(Read);
@ -557,7 +539,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
prot_state = 2;
hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
CHECK_CALLED(Continue);
if(test_abort) {
CHECK_CALLED(OnProgress_DOWNLOADINGDATA);
@ -576,7 +558,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
prot_state = 2;
hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
CHECK_CALLED(Continue);
CHECK_CALLED(Read);
if(!no_callback) {
@ -588,7 +570,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
prot_state = 3;
hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
CHECK_CALLED(Continue);
CHECK_CALLED(Read);
if(!no_callback) {
@ -618,8 +600,9 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
read = 0;
reported_url = szUrl;
if(!filedwl_api) /* FIXME */
ok(szUrl && !lstrcmpW(szUrl, urls[test_protocol]), "wrong url %s\n", wine_dbgstr_w(szUrl));
ok(szUrl && !lstrcmpW(szUrl, current_url), "wrong url %s\n", wine_dbgstr_w(szUrl));
ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
ok(grfPI == 0, "grfPI=%d, expected 0\n", grfPI);
@ -636,6 +619,11 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
return S_OK;
}
memset(&bindinfo, 0, sizeof(bindinfo));
bindinfo.cbSize = 0;
hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bind_info, &bindinfo);
ok(hres == E_INVALIDARG, "GetBindInfo returned: %08x, expected E_INVALIDARG\n", hres);
memset(&bindinfo, 0, sizeof(bindinfo));
bindinfo.cbSize = sizeof(bindinfo);
hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bind_info, &bindinfo);
@ -695,6 +683,9 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
CHECK_CALLED(Obj_OnProgress_SENDINGREQUEST);
else
CHECK_CALLED(OnProgress_SENDINGREQUEST);
case WINETEST_SYNC_TEST:
IInternetProtocolSink_AddRef(pOIProtSink);
protocol_sink = pOIProtSink;
default:
break;
}
@ -756,7 +747,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
SET_EXPECT(BeginningTransaction);
SET_EXPECT(QueryInterface_IHttpNegotiate);
}
hres = IHttpNegotiate_BeginningTransaction(http_negotiate, urls[test_protocol],
hres = IHttpNegotiate_BeginningTransaction(http_negotiate, current_url,
NULL, 0, &additional_headers);
if(!no_callback) {
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate);
@ -802,14 +793,27 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
IInternetProtocolSink_AddRef(pOIProtSink);
protocol_sink = pOIProtSink;
CreateThread(NULL, 0, thread_proc, NULL, 0, &tid);
return S_OK;
if(async_switch) {
PROTOCOLDATA data;
memset(&data, 0, sizeof(data));
data.grfFlags = PI_FORCE_ASYNC;
prot_state = 0;
hres = IInternetProtocolSink_Switch(pOIProtSink, &data);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
SET_EXPECT(Continue);
SetEvent(complete_event2);
return E_PENDING;
} else {
CreateThread(NULL, 0, thread_proc, NULL, 0, &tid);
return S_OK;
}
}
if(test_protocol == FILE_TEST) {
hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
BINDSTATUS_CACHEFILENAMEAVAILABLE, file_url+8);
BINDSTATUS_CACHEFILENAMEAVAILABLE, file_url+7);
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
@ -825,9 +829,14 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
CHECK_CALLED(Obj_OnProgress_MIMETYPEAVAILABLE);
else
CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
}else if(test_protocol == WINETEST_SYNC_TEST) {
SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextHtml);
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
}else {
hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
BINDSTATUS_MIMETYPEAVAILABLE, wszTextHtml);
hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_MIMETYPEAVAILABLE, wszTextHtml);
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
}
@ -839,7 +848,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
SET_EXPECT(Read);
if(bind_to_object) {
if(test_protocol != FILE_TEST && test_protocol != MK_TEST)
if(test_protocol != FILE_TEST && test_protocol != MK_TEST && test_protocol != WINETEST_SYNC_TEST)
SET_EXPECT(Obj_OnProgress_MIMETYPEAVAILABLE);
SET_EXPECT(Obj_OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
@ -864,7 +873,8 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
SET_EXPECT(LockRequest);
if(!filedwl_api)
SET_EXPECT(OnDataAvailable);
SET_EXPECT(OnStopBinding);
if(test_protocol != WINETEST_SYNC_TEST) /* Set in Read after ReportResult call */
SET_EXPECT(OnStopBinding);
}
hres = IInternetProtocolSink_ReportData(pOIProtSink, bscf, 13, 13);
@ -888,7 +898,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
CHECK_CALLED(OnObjectAvailable);
CHECK_CALLED(Obj_OnStopBinding);
}else {
if(test_protocol != FILE_TEST && test_protocol != MK_TEST)
if(test_protocol != FILE_TEST && test_protocol != MK_TEST && test_protocol != WINETEST_SYNC_TEST)
CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
@ -905,17 +915,19 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_BEGINDOWNLOADDATA, NULL);
ok(hres == S_OK, "ReportProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
CHECK_CALLED(Read);
}else if(!bind_to_object && test_protocol == ABOUT_TEST) {
}else if(!bind_to_object && test_protocol == FILE_TEST) {
SET_EXPECT(Read);
hres = IInternetProtocolSink_ReportData(pOIProtSink, bscf, 13, 13);
ok(hres == S_OK, "ReportData failed: %08x\n", hres);
CHECK_CALLED(Read);
}
SET_EXPECT(Terminate);
hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
CHECK_CALLED(Terminate);
if(test_protocol != WINETEST_SYNC_TEST) {
SET_EXPECT(Terminate);
hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
CHECK_CALLED(Terminate);
}
return S_OK;
}
@ -930,11 +942,26 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
if(!bind_to_object)
ok(reported_url && !lstrcmpW(reported_url, current_url), "wrong url %s\n", wine_dbgstr_w(reported_url));
ok(pProtocolData != NULL, "pProtocolData == NULL\n");
if(!pProtocolData)
return S_OK;
switch(prot_state) {
case 0:
hres = IInternetProtocolSink_ReportProgress(protocol_sink,
BINDSTATUS_SENDINGREQUEST, NULL);
ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
hres = IInternetProtocolSink_ReportProgress(protocol_sink,
BINDSTATUS_MIMETYPEAVAILABLE, wszTextHtml);
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
bscf |= BSCF_FIRSTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION;
break;
case 1: {
IServiceProvider *service_provider;
IHttpNegotiate *http_negotiate;
@ -989,6 +1016,15 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
if(prot_state != 2 || !test_abort)
SET_EXPECT(Read);
switch(prot_state) {
case 0:
hres = IInternetProtocolSink_ReportResult(protocol_sink, S_OK, 0, NULL);
ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
SET_EXPECT(OnProgress_SENDINGREQUEST);
SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
SET_EXPECT(LockRequest);
SET_EXPECT(OnStopBinding);
break;
case 1:
if(bind_to_object) {
SET_EXPECT(Obj_OnProgress_MIMETYPEAVAILABLE);
@ -1074,6 +1110,8 @@ static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
ULONG cb, ULONG *pcbRead)
{
HRESULT hres;
static const char data[] = "<HTML></HTML>";
CHECK_EXPECT2(Read);
@ -1082,9 +1120,18 @@ static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
ok(cb != 0, "cb == 0\n");
ok(pcbRead != NULL, "pcbRead == NULL\n");
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST) {
HRESULT hres;
if(async_switch) {
if(prot_state++ > 1) {
*pcbRead = 0;
return S_FALSE;
} else {
memset(pv, '?', cb);
*pcbRead = cb;
return S_OK;
}
}
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST) {
static int pending = TRUE;
pending = !pending;
@ -1128,6 +1175,13 @@ static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
return S_FALSE;
}
if(test_protocol == WINETEST_SYNC_TEST) {
hres = IInternetProtocolSink_ReportResult(protocol_sink, S_OK, 0, NULL);
ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
SET_EXPECT(OnStopBinding);
}
ok(*pcbRead == 0, "*pcbRead=%d, expected 0\n", *pcbRead);
read += *pcbRead = sizeof(data)-1;
memcpy(pv, data, sizeof(data));
@ -1206,7 +1260,7 @@ static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate2 *iface,
ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
ok(!lstrcmpW(szURL, urls[test_protocol]), "szURL != urls[test_protocol]\n");
ok(!lstrcmpW(szURL, current_url), "szURL != current_url\n");
ok(!dwReserved, "dwReserved=%d, expected 0\n", dwReserved);
ok(pszAdditionalHeaders != NULL, "pszAdditionalHeaders == NULL\n");
if(pszAdditionalHeaders)
@ -1419,12 +1473,13 @@ static void test_WinInetHttpInfo(IWinInetHttpInfo *http_info, DWORD progress)
size = sizeof(DWORD);
hres = IWinInetHttpInfo_QueryInfo(http_info, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER,
&status, &size, NULL, NULL);
ok(hres == expect, "hres = %x, expected %x\n", hres, expect);
ok(hres == expect || ((progress == BINDSTATUS_COOKIE_SENT || progress == BINDSTATUS_PROXYDETECTING) && hres == S_FALSE),
"progress %u: hres = %x, expected %x\n", progress, hres, expect);
if(hres == S_OK) {
if(download_state==BEFORE_DOWNLOAD && progress!=BINDSTATUS_MIMETYPEAVAILABLE)
ok(status == 0, "status = %d\n", status);
if(download_state == BEFORE_DOWNLOAD && progress != BINDSTATUS_MIMETYPEAVAILABLE && progress != BINDSTATUS_DECODING)
ok(status == 0, "progress %u: status = %d\n", progress, status);
else
ok(status == HTTP_STATUS_OK, "status = %d\n", status);
ok(status == HTTP_STATUS_OK, "progress %u: status = %d\n", progress, status);
ok(size == sizeof(DWORD), "size = %d\n", size);
}
@ -1538,6 +1593,9 @@ static HRESULT WINAPI statusclb_OnStartBinding(IBindStatusCallbackEx *iface, DWO
IWinInetHttpInfo *http_info;
HRESULT hres;
IMoniker *mon;
DWORD res;
CLSID clsid;
LPOLESTR res_str;
if(iface == &objbsc)
CHECK_EXPECT(Obj_OnStartBinding);
@ -1562,6 +1620,23 @@ static HRESULT WINAPI statusclb_OnStartBinding(IBindStatusCallbackEx *iface, DWO
hres = IBinding_QueryInterface(pib, &IID_IWinInetHttpInfo, (void**)&http_info);
ok(hres == E_NOINTERFACE, "Could not get IID_IWinInetHttpInfo: %08x\n", hres);
if(0) { /* crashes with native urlmon */
hres = IBinding_GetBindResult(pib, NULL, &res, &res_str, NULL);
ok(hres == E_INVALIDARG, "GetBindResult failed: %08x\n", hres);
}
hres = IBinding_GetBindResult(pib, &clsid, NULL, &res_str, NULL);
ok(hres == E_INVALIDARG, "GetBindResult failed: %08x\n", hres);
hres = IBinding_GetBindResult(pib, &clsid, &res, NULL, NULL);
ok(hres == E_INVALIDARG, "GetBindResult failed: %08x\n", hres);
hres = IBinding_GetBindResult(pib, &clsid, &res, &res_str, (void*)0xdeadbeef);
ok(hres == E_INVALIDARG, "GetBindResult failed: %08x\n", hres);
hres = IBinding_GetBindResult(pib, &clsid, &res, &res_str, NULL);
ok(hres == S_OK, "GetBindResult failed: %08x, expected S_OK\n", hres);
ok(IsEqualCLSID(&clsid, &CLSID_NULL), "incorrect clsid: %s\n", debugstr_guid(&clsid));
ok(!res, "incorrect res: %x\n", res);
ok(!res_str, "incorrect res_str: %s\n", wine_dbgstr_w(res_str));
if(abort_start) {
binding_hres = abort_hres;
return abort_hres;
@ -1658,7 +1733,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
if(filedwl_api) {
/* FIXME */
}else {
ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
ok(!lstrcmpW(szStatusText, current_url), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
}
}
if(!bind_to_object)
@ -1695,7 +1770,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
if(filedwl_api) {
/* FIXME */
}else {
ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
ok(!lstrcmpW(szStatusText, current_url), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
}
}
ok(download_state == DOWNLOADING, "Download state was %d, expected DOWNLOADING\n",
@ -1715,7 +1790,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText && test_protocol == FILE_TEST)
ok(!lstrcmpW(file_url+8, szStatusText), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
ok(!lstrcmpW(file_url+7, szStatusText), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
break;
case BINDSTATUS_CLASSIDAVAILABLE:
{
@ -1749,6 +1824,9 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
case BINDSTATUS_COOKIE_SENT:
trace("BINDSTATUS_COOKIE_SENT\n");
break;
case BINDSTATUS_DECODING:
trace("BINDSTATUS_DECODING\n");
break;
default:
ok(0, "unexpected code %d\n", ulStatusCode);
};
@ -1803,10 +1881,54 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES
ok(hresult == binding_hres, "binding failed: %08x, expected %08x\n", hresult, binding_hres);
ok(szError == NULL, "szError should be NULL\n");
if(current_binding) {
CLSID clsid;
DWORD res;
LPOLESTR res_str;
HRESULT hres;
hres = IBinding_GetBindResult(current_binding, &clsid, &res, &res_str, NULL);
ok(hres == S_OK, "GetBindResult failed: %08x, expected S_OK\n", 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)) {
ok(IsEqualCLSID(&clsid, &CLSID_NULL),
"incorrect protocol CLSID: %s, expected CLSID_NULL\n",
debugstr_guid(&clsid));
}else if(emulate_protocol) {
todo_wine ok(IsEqualCLSID(&clsid, &CLSID_FtpProtocol),
"incorrect protocol CLSID: %s, expected CLSID_FtpProtocol\n",
debugstr_guid(&clsid));
}else if(test_protocol == FTP_TEST) {
ok(IsEqualCLSID(&clsid, &CLSID_FtpProtocol),
"incorrect protocol CLSID: %s, expected CLSID_FtpProtocol\n",
debugstr_guid(&clsid));
}else if(test_protocol == FILE_TEST) {
ok(IsEqualCLSID(&clsid, &CLSID_FileProtocol),
"incorrect protocol CLSID: %s, expected CLSID_FileProtocol\n",
debugstr_guid(&clsid));
}else if(test_protocol == HTTP_TEST) {
ok(IsEqualCLSID(&clsid, &CLSID_HttpProtocol),
"incorrect protocol CLSID: %s, expected CLSID_HttpProtocol\n",
debugstr_guid(&clsid));
}else if(test_protocol == HTTPS_TEST) {
ok(IsEqualCLSID(&clsid, &CLSID_HttpSProtocol),
"incorrect protocol CLSID: %s, expected CLSID_HttpSProtocol\n",
debugstr_guid(&clsid));
}else if(test_protocol == ABOUT_TEST) {
ok(IsEqualCLSID(&clsid, &CLSID_AboutProtocol),
"incorrect protocol CLSID: %s, expected CLSID_AboutProtocol\n",
debugstr_guid(&clsid));
}else {
ok(0, "unexpected (%d)\n", test_protocol);
}
}
if((test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST) && emulate_protocol) {
SetEvent(complete_event);
if(iface != &objbsc)
WaitForSingleObject(complete_event2, INFINITE);
ok( WaitForSingleObject(complete_event2, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
}
return S_OK;
@ -1929,7 +2051,7 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DW
case TYMED_FILE:
if(test_protocol == FILE_TEST)
ok(!lstrcmpW(pstgmed->u.lpszFileName, INDEX_HTML+7),
ok(!lstrcmpW(pstgmed->u.lpszFileName, file_url+7),
"unexpected file name %s\n", wine_dbgstr_w(pstgmed->u.lpszFileName));
else if(emulate_protocol)
ok(!lstrcmpW(pstgmed->u.lpszFileName, cache_fileW),
@ -2084,9 +2206,9 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
ok(!fFullyAvailable, "fFulyAvailable = %x\n", fFullyAvailable);
ok(!fFullyAvailable, "fFullyAvailable = %x\n", fFullyAvailable);
else
ok(fFullyAvailable, "fFulyAvailable = %x\n", fFullyAvailable);
ok(fFullyAvailable, "fFullyAvailable = %x\n", fFullyAvailable);
ok(pimkName != NULL, "pimkName == NULL\n");
ok(pibc != NULL, "pibc == NULL\n");
ok(grfMode == 0x12, "grfMode = %x\n", grfMode);
@ -2485,7 +2607,7 @@ static BOOL test_bscholder(IBindStatusCallback *holder)
wstr = (void*)0xdeadbeef;
SET_EXPECT(QueryInterface_IHttpNegotiate);
SET_EXPECT(BeginningTransaction);
hres = IHttpNegotiate_BeginningTransaction(http_negotiate_serv, urls[test_protocol], emptyW, 0, &wstr);
hres = IHttpNegotiate_BeginningTransaction(http_negotiate_serv, current_url, emptyW, 0, &wstr);
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate); /* IE8 */
CHECK_CALLED(BeginningTransaction);
ok(hres == S_OK, "BeginningTransaction failed: %08x\n", hres);
@ -2517,8 +2639,8 @@ static BOOL test_bscholder(IBindStatusCallback *holder)
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate2); /* IE8 */
CHECK_CALLED(GetRootSecurityId);
IHttpNegotiate_Release(http_negotiate2_serv);
IHttpNegotiate_Release(http_negotiate2);
IHttpNegotiate2_Release(http_negotiate2_serv);
IHttpNegotiate2_Release(http_negotiate2);
}else {
skip("Could not get IHttpNegotiate2\n");
ret = FALSE;
@ -2686,9 +2808,12 @@ static BOOL test_RegisterBindStatusCallback(void)
#define BINDTEST_INVALID_CN 0x0200
#define BINDTEST_ABORT_START 0x0400
#define BINDTEST_ABORT_PROGRESS 0x0800
#define BINDTEST_ASYNC_SWITCH 0x1000
static void init_bind_test(int protocol, DWORD flags, DWORD t)
{
const char *url_a = NULL;
test_protocol = protocol;
emulate_protocol = (flags & BINDTEST_EMULATE) != 0;
download_state = BEFORE_DOWNLOAD;
@ -2700,14 +2825,40 @@ static void init_bind_test(int protocol, DWORD flags, DWORD t)
bind_to_object = (flags & BINDTEST_TOOBJECT) != 0;
tymed = t;
filedwl_api = (flags & BINDTEST_FILEDWLAPI) != 0;
if(flags & BINDTEST_HTTPRESPONSE)
urls[HTTP_TEST] = winetest_post_urlW;
else
urls[HTTP_TEST] = winetest_data_urlW;
if(flags & BINDTEST_INVALID_CN)
urls[HTTPS_TEST] = https_invalid_cn_urlW;
else
urls[HTTPS_TEST] = https_urlW;
post_test = (flags & BINDTEST_HTTPRESPONSE) != 0;
switch(protocol) {
case HTTP_TEST:
if(post_test)
url_a = "http://test.winehq.org/tests/post.php";
else
lstrcpyW(current_url, winetest_data_urlW);
break;
case ABOUT_TEST:
url_a = "about:blank";
break;
case FILE_TEST:
lstrcpyW(current_url, file_url);
break;
case MK_TEST:
url_a = "mk:@MSITStore:test.chm::/blank.html";
break;
case ITS_TEST:
url_a = "its:test.chm::/blank.html";
break;
case HTTPS_TEST:
url_a = (flags & BINDTEST_INVALID_CN) ? "https://209.46.25.132/test.html" : "https://www.codeweavers.com/test.html";
break;
case FTP_TEST:
url_a = "ftp://ftp.winehq.org/pub/other/winelogo.xcf.tar.bz2";
break;
default:
url_a = "winetest:test";
}
if(url_a)
MultiByteToWideChar(CP_ACP, 0, url_a, -1, current_url, sizeof(current_url)/sizeof(*current_url));
test_redirect = (flags & BINDTEST_REDIRECT) != 0;
use_cache_file = (flags & BINDTEST_USE_CACHE) != 0;
callback_read = !(flags & BINDTEST_NO_CALLBACK_READ);
@ -2715,7 +2866,12 @@ static void init_bind_test(int protocol, DWORD flags, DWORD t)
test_abort = (flags & BINDTEST_ABORT) != 0;
abort_start = (flags & BINDTEST_ABORT_START) != 0;
abort_progress = (flags & BINDTEST_ABORT_PROGRESS) != 0;
async_switch = (flags & BINDTEST_ASYNC_SWITCH) != 0;
is_async_prot = protocol == HTTP_TEST || protocol == HTTPS_TEST || protocol == FTP_TEST || protocol == WINETEST_TEST;
prot_state = 0;
ResetEvent(complete_event);
trace("URL: %s\n", wine_dbgstr_w(current_url));
}
static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
@ -2751,7 +2907,7 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
IBindStatusCallback_Release(previousclb);
}
hres = CreateURLMoniker(NULL, test_protocol == FILE_TEST ? file_url : urls[test_protocol], &mon);
hres = CreateURLMoniker(NULL, current_url, &mon);
ok(hres == S_OK, "failed to create moniker: %08x\n", hres);
if(FAILED(hres))
return;
@ -2763,8 +2919,8 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
hres = IMoniker_GetDisplayName(mon, bctx, NULL, &display_name);
ok(hres == S_OK, "GetDisplayName failed %08x\n", hres);
ok(!lstrcmpW(display_name, urls[test_protocol]),
"GetDisplayName got wrong name %s\n", wine_dbgstr_w(display_name));
ok(!lstrcmpW(display_name, current_url), "GetDisplayName got wrong name %s, expected %s\n",
wine_dbgstr_w(display_name), wine_dbgstr_w(current_url));
CoTaskMemFree(display_name);
if(tymed == TYMED_FILE && (test_protocol == ABOUT_TEST || test_protocol == ITS_TEST))
@ -2792,7 +2948,8 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
if(is_urlmon_protocol(test_protocol))
SET_EXPECT(SetPriority);
SET_EXPECT(Start);
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST)
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST
|| test_protocol == WINETEST_SYNC_TEST)
SET_EXPECT(Terminate);
if(tymed != TYMED_FILE || (test_protocol != ABOUT_TEST && test_protocol != ITS_TEST))
SET_EXPECT(UnlockRequest);
@ -2862,7 +3019,7 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08x\n", hres);
else if(no_callback) {
if(emulate_protocol)
WaitForSingleObject(complete_event2, INFINITE);
ok( WaitForSingleObject(complete_event2, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
ok(unk != NULL, "unk == NULL\n");
}else if(!(bindf & BINDF_ASYNCHRONOUS) && tymed == TYMED_FILE) {
@ -2906,6 +3063,13 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
}
}
if(async_switch) {
CHECK_CALLED(OnProgress_SENDINGREQUEST);
CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
CHECK_CALLED(LockRequest);
CHECK_CALLED(OnStopBinding);
}
if(!no_callback) {
CLEAR_CALLED(QueryInterface_IBindStatusCallbackEx); /* IE 8 */
CHECK_CALLED(GetBindInfo);
@ -2925,7 +3089,8 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
if(is_urlmon_protocol(test_protocol))
CHECK_CALLED(SetPriority);
CHECK_CALLED(Start);
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST) {
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST
|| test_protocol == WINETEST_SYNC_TEST) {
if(tymed == TYMED_FILE)
CLEAR_CALLED(Read);
CHECK_CALLED(Terminate);
@ -3064,7 +3229,7 @@ static void test_BindToObject(int protocol, DWORD flags)
if(FAILED(hres))
return;
hres = CreateURLMoniker(NULL, test_protocol == FILE_TEST ? file_url : urls[test_protocol], &mon);
hres = CreateURLMoniker(NULL, current_url, &mon);
ok(hres == S_OK, "failed to create moniker: %08x\n", hres);
if(FAILED(hres)) {
IBindCtx_Release(bctx);
@ -3078,7 +3243,7 @@ static void test_BindToObject(int protocol, DWORD flags)
hres = IMoniker_GetDisplayName(mon, bctx, NULL, &display_name);
ok(hres == S_OK, "GetDisplayName failed %08x\n", hres);
ok(!lstrcmpW(display_name, urls[test_protocol]), "GetDisplayName got wrong name\n");
ok(!lstrcmpW(display_name, current_url), "GetDisplayName got wrong name\n");
CoTaskMemFree(display_name);
SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
@ -3195,7 +3360,7 @@ static void test_BindToObject(int protocol, DWORD flags)
CLEAR_CALLED(GetWindow_IWindowForBindingUI);
}
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == FILE_TEST) {
if(urls[test_protocol] == winetest_post_urlW)
if(post_test)
CLEAR_CALLED(Obj_OnProgress_SENDINGREQUEST);
else
CHECK_CALLED(Obj_OnProgress_SENDINGREQUEST);
@ -3275,8 +3440,7 @@ static void test_URLDownloadToFile(DWORD prot, BOOL emul)
SET_EXPECT(OnStopBinding);
}
hres = URLDownloadToFileW(NULL, test_protocol == FILE_TEST ? file_url : urls[test_protocol],
dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
hres = URLDownloadToFileW(NULL, current_url, dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres);
CHECK_CALLED(GetBindInfo);
@ -3327,7 +3491,7 @@ static void test_URLDownloadToFile(DWORD prot, BOOL emul)
if(prot != FILE_TEST || emul)
return;
hres = URLDownloadToFileW(NULL, urls[test_protocol], dwl_htmlW, 0, NULL);
hres = URLDownloadToFileW(NULL, current_url, dwl_htmlW, 0, NULL);
ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres);
res = DeleteFileA(dwl_htmlA);
@ -3354,7 +3518,7 @@ static void test_URLDownloadToFile_abort(void)
SET_EXPECT(OnProgress_SENDINGREQUEST);
SET_EXPECT(OnStopBinding);
hres = URLDownloadToFileW(NULL, urls[HTTP_TEST], dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
hres = URLDownloadToFileW(NULL, current_url, dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
ok(hres == E_ABORT, "URLDownloadToFile failed: %08x, expected E_ABORT\n", hres);
CHECK_CALLED(GetBindInfo);
@ -3381,7 +3545,7 @@ static void test_URLDownloadToFile_abort(void)
SET_EXPECT(OnStopBinding);
abort_hres = E_ABORT;
hres = URLDownloadToFileW(NULL, urls[HTTP_TEST], dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
hres = URLDownloadToFileW(NULL, current_url, dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
ok(hres == E_ABORT, "URLDownloadToFile failed: %08x, expected E_ABORT\n", hres);
CHECK_CALLED(GetBindInfo);
@ -3416,7 +3580,7 @@ static void test_URLDownloadToFile_abort(void)
* IBindStatusCallback's OnStartBinding function.
*/
abort_hres = E_NOTIMPL;
hres = URLDownloadToFileW(NULL, urls[HTTP_TEST], dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
hres = URLDownloadToFileW(NULL, current_url, dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres);
CHECK_CALLED(GetBindInfo);
@ -3444,15 +3608,10 @@ static void test_URLDownloadToFile_abort(void)
static void set_file_url(char *path)
{
CHAR file_urlA[INTERNET_MAX_URL_LENGTH];
CHAR INDEX_HTMLA[MAX_PATH];
lstrcpyA(file_urlA, "file:///");
lstrcpyA(file_urlA, "file://");
lstrcatA(file_urlA, path);
MultiByteToWideChar(CP_ACP, 0, file_urlA, -1, file_url, INTERNET_MAX_URL_LENGTH);
lstrcpyA(INDEX_HTMLA, "file://");
lstrcatA(INDEX_HTMLA, path);
MultiByteToWideChar(CP_ACP, 0, INDEX_HTMLA, -1, INDEX_HTML, MAX_PATH);
}
static void create_file(void)
@ -3512,7 +3671,7 @@ static void test_ReportResult(HRESULT exhres)
init_bind_test(ABOUT_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
binding_hres = exhres;
hres = CreateURLMoniker(NULL, ABOUT_BLANK, &mon);
hres = CreateURLMoniker(NULL, about_blankW, &mon);
ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
SET_EXPECT(QueryInterface_IServiceProvider);
@ -3556,7 +3715,7 @@ static void test_BindToStorage_fail(void)
IUnknown *unk;
HRESULT hres;
hres = CreateURLMoniker(NULL, ABOUT_BLANK, &mon);
hres = CreateURLMoniker(NULL, about_blankW, &mon);
ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
if(FAILED(hres))
return;
@ -3582,6 +3741,8 @@ static void test_StdURLMoniker(void)
{
IMoniker *mon, *async_mon;
LPOLESTR display_name;
IBindCtx *bctx;
IUnknown *unk;
HRESULT hres;
hres = CoCreateInstance(&IID_IInternet, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
@ -3603,7 +3764,7 @@ static void test_StdURLMoniker(void)
IUri *uri;
hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
ok(hres == S_OK, "Coud not get IUriMoniker iface: %08x\n", hres);
ok(hres == S_OK, "Could not get IUriMoniker iface: %08x\n", hres);
uri = (void*)0xdeadbeef;
@ -3614,6 +3775,23 @@ static void test_StdURLMoniker(void)
IUriContainer_Release(uri_container);
}
SET_EXPECT(QueryInterface_IServiceProvider);
hres = CreateAsyncBindCtx(0, (IBindStatusCallback*)&bsc, NULL, &bctx);
ok(hres == S_OK, "CreateAsyncBindCtx failed: %08x\n\n", hres);
CHECK_CALLED(QueryInterface_IServiceProvider);
if(pCreateUri) { /* Skip these tests on old IEs */
unk = (void*)0xdeadbeef;
hres = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, (void**)&unk);
ok(hres == MK_E_SYNTAX, "BindToStorage failed: %08x, expected MK_E_SYNTAX\n", hres);
ok(!unk, "unk = %p\n", unk);
unk = (void*)0xdeadbeef;
hres = IMoniker_BindToObject(mon, bctx, NULL, &IID_IUnknown, (void**)&unk);
ok(hres == MK_E_SYNTAX, "BindToStorage failed: %08x, expected MK_E_SYNTAX\n", hres);
ok(!unk, "unk = %p\n", unk);
}
IMoniker_Release(mon);
}
@ -3730,6 +3908,9 @@ START_TEST(url)
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
trace("winetest test (async switch)...\n");
test_BindToStorage(WINETEST_TEST, BINDTEST_EMULATE|BINDTEST_ASYNC_SWITCH, TYMED_ISTREAM);
trace("about test (no read)...\n");
test_BindToStorage(ABOUT_TEST, BINDTEST_NO_CALLBACK_READ, TYMED_ISTREAM);
@ -3805,6 +3986,9 @@ START_TEST(url)
trace("emulated about test (to object)...\n");
test_BindToObject(ABOUT_TEST, BINDTEST_EMULATE);
trace("emulalated test reporting result in read...\n");
test_BindToStorage(WINETEST_SYNC_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
trace("file test...\n");
test_BindToStorage(FILE_TEST, 0, TYMED_ISTREAM);