34 #define DEFINE_EXPECT(func) \ 35 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE 37 #define SET_EXPECT(func) \ 38 expect_ ## func = TRUE 40 #define CHECK_EXPECT(func) \ 42 ok(expect_ ##func, "unexpected call " #func "\n"); \ 43 expect_ ## func = FALSE; \ 44 called_ ## func = TRUE; \ 47 #define SET_CALLED(func) \ 48 expect_ ## func = called_ ## func = FALSE 50 #define CHECK_CALLED(func) \ 52 ok(called_ ## func, "expected " #func "\n"); \ 56 DEFINE_GUID(CLSID_ITSProtocol,0x9d148291,0xb9c8,0x11d0,0xa4,0xcc,0x00,0x00,0xf8,0x01,0x49,0xf6);
73 't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'/',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
75 't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'/',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
76 static const WCHAR blank_url3[] = {
'm',
'k',
':',
'@',
'M',
'S',
'I',
'T',
'S',
't',
'o',
'r',
'e',
':',
77 't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'/',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
79 't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
81 't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'\\',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
83 't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'/',
'%',
'6',
'2',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
84 static const WCHAR blank_url7[] = {
'm',
'k',
':',
'@',
'M',
'S',
'I',
'T',
'S',
't',
'o',
'r',
'e',
':',
85 't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'\\',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
86 static const WCHAR blank_url8[] = {
'm',
'k',
':',
'@',
'M',
'S',
'I',
'T',
'S',
't',
'o',
'r',
'e',
':',
87 't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'/',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',
'/',0};
89 't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'/',
'd',
'i',
'r',
'/',
'.',
'.',
'/',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
97 {
't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'/',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
99 {
't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'\\',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
101 {
't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'/',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',
'/',0};
143 ok(0,
"unexpected call\n");
150 static const WCHAR blank_html[] = {
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
151 static const WCHAR text_html[] = {
't',
'e',
'x',
't',
'/',
'h',
't',
'm',
'l',0};
153 switch(ulStatusCode) {
154 case BINDSTATUS_BEGINDOWNLOADDATA:
156 ok(!szStatusText,
"szStatusText != NULL\n");
158 case BINDSTATUS_SENDINGREQUEST:
161 ok(!
lstrcmpW(szStatusText, blank_html),
"unexpected szStatusText\n");
163 ok(szStatusText ==
NULL,
"szStatusText != NULL\n");
165 case BINDSTATUS_MIMETYPEAVAILABLE:
167 ok(!
lstrcmpW(szStatusText, text_html),
"unexpected szStatusText\n");
169 case BINDSTATUS_CACHEFILENAMEAVAILABLE:
173 case BINDSTATUS_DIRECTBIND:
175 ok(!szStatusText,
"szStatusText != NULL\n");
178 ok(0,
"unexpected ulStatusCode %d\n", ulStatusCode);
190 ok(ulProgress == ulProgressMax,
"ulProgress != ulProgressMax\n");
192 ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE),
"grcf = %08x\n", grfBSCF);
194 ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION),
"grcf = %08x\n", grfBSCF);
203 ok(
cb == 13,
"cb=%u expected 13\n",
cb);
204 ok(!
memcmp(
buf,
"<html></html>", 13),
"unexpected data\n");
216 ok(dwError == 0,
"dwError = %d\n", dwError);
217 ok(!szResult,
"szResult != NULL\n");
259 ok(grfBINDF !=
NULL,
"grfBINDF == NULL\n");
261 ok(!*grfBINDF,
"*grfBINDF != 0\n");
262 ok(pbindinfo !=
NULL,
"pbindinfo == NULL\n");
263 ok(pbindinfo->cbSize ==
sizeof(BINDINFO),
"wrong size of pbindinfo: %d\n", pbindinfo->cbSize);
272 ok(0,
"unexpected call\n");
297 ok(
hres == expected_hres,
"expected: %08x got: %08x\n", expected_hres,
hres);
303 #define protocol_start(p,u,e) _protocol_start(__LINE__,p,u,e) 315 SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
332 SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
345 SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
363 ok(
hres ==
S_OK,
"Could not get IInternetProtocol: %08x\n",
hres);
369 IInternetProtocol_Release(
protocol);
375 ok(
cb == 13,
"cb=%u expected 13\n",
cb);
376 ok(!
memcmp(
buf,
"<html></html>", 13),
"unexpected data\n");
381 ok(
hres ==
S_OK,
"Could not get IInternetProtocol: %08x\n",
hres);
388 "Read returned %08x\n",
hres);
389 ok(
cb == 0xdeadbeef,
"cb=%u expected 0xdeadbeef\n",
cb);
394 ok(
cb == 2,
"cb=%u expected 2\n",
cb);
397 ok(
cb == 11,
"cb=%u, expected 11\n",
cb);
400 ok(
cb == 0,
"cb=%u expected 0\n",
cb);
407 ok(
hres ==
S_OK,
"Could not get IInternetProtocol: %08x\n",
hres);
420 ok(
cb == 11,
"cb=%u, expected 11\n",
cb);
425 ok(
hres ==
S_OK,
"Could not get IInternetProtocol: %08x\n",
hres);
436 ok(
cb == 2,
"cb=%u, expected 2\n",
cb);
441 ok(
cb == 2,
"cb=%u, expected 2\n",
cb);
446 ok(
cb == 2,
"cb=%u expected 2\n",
cb);
451 ok(
hres ==
S_OK,
"Could not get IInternetProtocol: %08x\n",
hres);
461 static const struct {
470 {
"its:test.chm::/blank.html",
"test.html", 0,
S_OK,
"its:test.chm::/test.html"},
472 {
"its:test.chm::/blank.html",
"/test.html", 0,
S_OK,
"its:test.chm::/test.html"},
475 {
"its:test.chm::/blank.html",
"dir/test.html", 0,
S_OK,
"its:test.chm::/dir/test.html"},
476 {
"test.html",
"test.chm::/test.html", 0, 0x80041001,
NULL},
477 {
"its:test:.chm::/blank.html",
"test.html", 0,
S_OK,
"its:test:.chm::/test.html"},
478 {
"its:test.chm::/dir/blank.html",
"test.html", 0,
S_OK,
"its:test.chm::/dir/test.html"},
479 {
"its:test.chm::blank.html",
"test.html", 0,
S_OK,
"its:test.chm::blank.htmltest.html"},
480 {
"ms-its:test.chm::/dir/blank.html",
"test.html", 0,
S_OK,
"ms-its:test.chm::/dir/test.html"},
481 {
"mk:@MSITStore:test.chm::/dir/blank.html",
"test.html", 0,
S_OK,
"mk:@MSITStore:test.chm::/dir/test.html"},
482 {
"xxx:test.chm::/dir/blank.html",
"test.html", 0, INET_E_USE_DEFAULT_PROTOCOLHANDLER,
NULL},
483 {
"its:test.chm::/dir/blank.html",
"/test.html", 0,
S_OK,
"its:test.chm::/test.html"},
484 {
"its:test.chm::/blank.html",
"#frag", 0,
S_OK,
"its:test.chm::/blank.html#frag"},
485 {
"its:test.chm::/blank.html#hash",
"#frag", 0,
S_OK,
"its:test.chm::/blank.html#hash#frag"},
486 {
"its:test.chm::/blank.html",
"test.html#frag", 0,
S_OK,
"its:test.chm::/test.html#frag"},
487 {
"its:test.chm::/blank.html",
"/test.html#frag", 0,
S_OK,
"its:test.chm::/test.html#frag"},
488 {
"its:test.chm::/blank.html",
"?query", 0,
S_OK,
"its:test.chm::/?query"},
489 {
"its:test.chm::/blank.html#frag/blank",
"test.html", 0,
S_OK,
"its:test.chm::/blank.html#frag/test.html"},
499 hres = IInternetProtocol_QueryInterface(
protocol, &IID_IInternetProtocolInfo, (
void**)&
info);
500 ok(
hres ==
S_OK,
"Could not get IInternetProtocolInfo interface: %08x\n",
hres);
504 for(
i = PARSE_CANONICALIZE;
i <= PARSE_UNESCAPE;
i++) {
505 if(
i != PARSE_CANONICALIZE &&
i != PARSE_SECURITY_URL) {
508 ok(
hres == INET_E_DEFAULT_ACTION,
509 "[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n",
i,
hres);
522 : 0xdeadbeef),
"[%d] unexpected size=%d\n",
i,
size);
526 ok(
buf[0] == 0xfefe,
"buf changed\n");
531 hres = IInternetProtocolInfo_CombineUrl(
info,
a2w(
"its:test.chm::/blank.html"),
a2w(
"test.html"), 0,
buf,
535 ok(
buf[0] == 0xfefe,
"buf changed\n");
537 IInternetProtocolInfo_Release(
info);
548 static const WCHAR wrong_url1[] =
549 {
'i',
't',
's',
':',
't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'/',
'b',
'l',
'a',
'n',
'.',
'h',
't',
'm',
'l',0};
550 static const WCHAR wrong_url2[] =
551 {
'i',
't',
's',
':',
't',
'e',
's',
'.',
'c',
'h',
'm',
':',
':',
'b',
'/',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
552 static const WCHAR wrong_url3[] =
553 {
'i',
't',
's',
':',
't',
'e',
's',
't',
'.',
'c',
'h',
'm',
'/',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
554 static const WCHAR wrong_url4[] = {
'm',
'k',
':',
'@',
'M',
'S',
'I',
'T',
'S',
't',
'o',
'r',
':',
555 't',
'e',
's',
't',
'.',
'c',
'h',
'm',
':',
':',
'/',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
556 static const WCHAR wrong_url5[] = {
'f',
'i',
'l',
'e',
':',
557 't',
'e',
's',
'.',
'c',
'h',
'm',
':',
':',
'/',
'b',
'l',
'a',
'n',
'k',
'.',
'h',
't',
'm',
'l',0};
564 "CoGetClassObject failed: %08x\n",
hres);
568 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (
void**)&
info);
572 ok(
hres ==
S_OK,
"Could not get IClassFactory interface\n");
577 ok(
hres ==
S_OK,
"Could not get IInternetProtocol: %08x\n",
hres);
586 ok(
hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER,
587 "Start failed: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER\n",
hres);
590 ok(
hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER,
591 "Start failed: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER\n",
hres);
604 bindf = BINDF_FROMURLMON | BINDF_NEEDFILE;
608 IClassFactory_Release(
factory);
611 IUnknown_Release(unk);
625 "CoGetClassObject failed: %08x\n",
hres);
636 IClassFactory_Release(
cf);
667 static const IID outer_test_iid = {0xabcabc00,0,0,{0,0,0,0,0,0,0,0x66}};
709 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocol, (
void**)&unk2);
710 ok(
hres ==
S_OK,
"Could not get IInternetProtocol iface: %08x\n",
hres);
715 ok(
hres ==
S_OK,
"Could not get IInternetProtocol iface: %08x\n",
hres);
716 ok(unk3 == (
IUnknown*)0xdeadbeef,
"unexpected unk2\n");
718 IUnknown_Release(unk2);
719 IUnknown_Release(unk);
721 unk = (
void*)0xdeadbeef;
722 hres = IClassFactory_CreateInstance(
class_factory, &outer, &IID_IInternetProtocol, (
void**)&unk);
724 ok(!unk,
"unk = %p\n", unk);
static void test_mk_protocol(void)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
static HRESULT WINAPI ProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
static ULONG WINAPI ProtocolSink_AddRef(IInternetProtocolSink *iface)
static const WCHAR blank_url5[]
#define STG_E_INVALIDNAME
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
static HRESULT WINAPI ProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
static const WCHAR cache_file1[]
ACPI_SIZE strlen(const char *String)
static ULONG WINAPI ProtocolSink_Release(IInternetProtocolSink *iface)
static ULONG WINAPI BindInfo_Release(IInternetBindInfo *iface)
#define CHECK_CALLED(func)
char * wine_dbgstr_w(const wchar_t *wstr)
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
#define CHECK_EXPECT(func)
const char * wine_dbgstr_guid(const GUID *guid)
#define INVALID_HANDLE_VALUE
DWORD WINAPI GetLastError(VOID)
static const IUnknownVtbl outer_vtbl
#define MAKEINTRESOURCEA(i)
static IInternetProtocol * read_protocol
static BOOL create_chm(void)
static void test_its_protocol(void)
static const WCHAR blank_url6[]
static IInternetProtocolSink protocol_sink
static void delete_chm(void)
static const WCHAR cache_file2[]
GLenum GLuint GLenum GLsizei const GLchar * buf
static const WCHAR blank_url9[]
static const WCHAR blank_url2[]
static const WCHAR blank_url3[]
static struct _test_info info[]
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
static const WCHAR * cache_file
#define protocol_start(p, u, e)
static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
static IInternetBindInfo bind_info
static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText)
static const struct @1628 combine_tests[]
static enum @1627 test_protocol
static const WCHAR blank_url1[]
static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
static HRESULT _protocol_start(unsigned line, IInternetProtocol *protocol, LPCWSTR url, BOOL expect_mime)
static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
static int strcmp_wa(const WCHAR *str1, const char *str2)
static const WCHAR blank_url4[]
static const WCHAR blank_url7[]
#define STG_E_FILENOTFOUND
static IInternetBindInfoVtbl bind_info_vtbl
#define FILE_ATTRIBUTE_NORMAL
#define CLASS_E_NOAGGREGATION
static const IID outer_test_iid
static HRESULT WINAPI BindInfo_QueryInterface(IInternetBindInfo *iface, REFIID riid, void **ppv)
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
static const WCHAR * a2w(const char *str)
#define REGDB_E_CLASSNOTREG
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static HRESULT expect_hrResult
static const WCHAR cache_file3[]
DEFINE_GUID(CLSID_ITSProtocol, 0x9d148291, 0xb9c8, 0x11d0, 0xa4, 0xcc, 0x00, 0x00, 0xf8, 0x01, 0x49, 0xf6)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
static void test_protocol_url(IClassFactory *factory, LPCWSTR url, BOOL expect_mime)
const char * combined_url
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
#define MultiByteToWideChar
static IInternetProtocolSinkVtbl protocol_sink_vtbl
static HMODULE MODULEINFO DWORD cb
static void test_com_aggregation(const CLSID *clsid)
static ClassFactoryImpl factory
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
static void test_protocol_fail(IInternetProtocol *protocol, LPCWSTR url, HRESULT expected_hres)
static const WCHAR blank_url8[]
#define URL_ESCAPE_SPACES_ONLY
#define CreateFileA(a, b, c, d, e, f, g)
static ULONG WINAPI outer_Release(IUnknown *iface)
static void test_its_protocol_info(IInternetProtocol *protocol)
const GUID IID_IClassFactory
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
static ULONG WINAPI BindInfo_AddRef(IInternetBindInfo *iface)
#define DEFINE_EXPECT(func)
static ULONG WINAPI outer_AddRef(IUnknown *iface)
#define URL_DONT_ESCAPE_EXTRA_INFO