mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
Autosyncing with Wine HEAD
svn path=/trunk/; revision=32915
This commit is contained in:
parent
0c246f48f0
commit
75ad879ac1
7 changed files with 7105 additions and 0 deletions
1565
rostests/winetests/mshtml/dom.c
Normal file
1565
rostests/winetests/mshtml/dom.c
Normal file
File diff suppressed because it is too large
Load diff
4061
rostests/winetests/mshtml/htmldoc.c
Normal file
4061
rostests/winetests/mshtml/htmldoc.c
Normal file
File diff suppressed because it is too large
Load diff
117
rostests/winetests/mshtml/misc.c
Normal file
117
rostests/winetests/mshtml/misc.c
Normal file
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Copyright 2006 Jacek Caban for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include <wine/test.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "ole2.h"
|
||||
#include "optary.h"
|
||||
|
||||
#include "initguid.h"
|
||||
|
||||
static void test_HTMLLoadOptions(void)
|
||||
{
|
||||
IHtmlLoadOptions *loadopts;
|
||||
BYTE buf[100];
|
||||
DWORD size, i, data = 0xdeadbeef;
|
||||
HRESULT hres;
|
||||
|
||||
hres = CoCreateInstance(&CLSID_HTMLLoadOptions, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IHtmlLoadOptions, (void**)&loadopts);
|
||||
ok(hres == S_OK, "creating HTMLLoadOptions failed: %08x\n", hres);
|
||||
if(FAILED(hres))
|
||||
return;
|
||||
|
||||
for(i=0; i <= HTMLLOADOPTION_FRAMELOAD+3; i++) {
|
||||
size = 0xdeadbeef;
|
||||
memset(buf, 0xdd, sizeof(buf));
|
||||
hres = IHtmlLoadOptions_QueryOption(loadopts, i, NULL, &size);
|
||||
ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
|
||||
ok(size == 0, "size = %d\n", size);
|
||||
ok(buf[0] == 0xdd, "buf changed\n");
|
||||
}
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IHtmlLoadOptions_QueryOption(loadopts, HTMLLOADOPTION_CODEPAGE, NULL, &size);
|
||||
ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
|
||||
ok(size == 0, "size = %d\n", size);
|
||||
|
||||
hres = IHtmlLoadOptions_SetOption(loadopts, HTMLLOADOPTION_CODEPAGE, &data, sizeof(data));
|
||||
ok(hres == S_OK, "SetOption failed: %08x\n", hres);
|
||||
|
||||
size = sizeof(data);
|
||||
memset(buf, 0xdd, sizeof(buf));
|
||||
hres = IHtmlLoadOptions_QueryOption(loadopts, HTMLLOADOPTION_CODEPAGE, buf, &size);
|
||||
ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
|
||||
ok(size == sizeof(data), "size = %d\n", size);
|
||||
ok(*(DWORD*)buf == data, "unexpected buf\n");
|
||||
|
||||
size = sizeof(data)-1;
|
||||
memset(buf, 0xdd, sizeof(buf));
|
||||
hres = IHtmlLoadOptions_QueryOption(loadopts, HTMLLOADOPTION_CODEPAGE, buf, &size);
|
||||
ok(hres == E_FAIL, "QueryOption failed: %08x\n", hres);
|
||||
ok(size == sizeof(data) || !size, "size = %d\n", size);
|
||||
ok(buf[0] == 0xdd, "buf changed\n");
|
||||
|
||||
data = 100;
|
||||
hres = IHtmlLoadOptions_SetOption(loadopts, HTMLLOADOPTION_CODEPAGE, &data, 0);
|
||||
ok(hres == S_OK, "SetOption failed: %08x\n", hres);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
memset(buf, 0xdd, sizeof(buf));
|
||||
hres = IHtmlLoadOptions_QueryOption(loadopts, HTMLLOADOPTION_CODEPAGE, buf, &size);
|
||||
ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
|
||||
ok(size == 0, "size = %d\n", size);
|
||||
ok(buf[0] == 0xdd, "buf changed\n");
|
||||
|
||||
hres = IHtmlLoadOptions_SetOption(loadopts, HTMLLOADOPTION_CODEPAGE, NULL, 0);
|
||||
ok(hres == S_OK, "SetOption failed: %08x\n", hres);
|
||||
|
||||
hres = IHtmlLoadOptions_SetOption(loadopts, 1000, &data, sizeof(data));
|
||||
ok(hres == S_OK, "SetOption failed: %08x\n", hres);
|
||||
|
||||
size = sizeof(data);
|
||||
memset(buf, 0xdd, sizeof(buf));
|
||||
hres = IHtmlLoadOptions_QueryOption(loadopts, 1000, buf, &size);
|
||||
ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
|
||||
ok(size == sizeof(data), "size = %d\n", size);
|
||||
ok(*(DWORD*)buf == data, "unexpected buf\n");
|
||||
|
||||
hres = IHtmlLoadOptions_SetOption(loadopts, 1000, buf, sizeof(buf));
|
||||
ok(hres == S_OK, "SetOption failed: %08x\n", hres);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IHtmlLoadOptions_QueryOption(loadopts, 1000, buf, &size);
|
||||
ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
|
||||
ok(size == sizeof(buf), "size = %d\n", size);
|
||||
|
||||
IHtmlLoadOptions_Release(loadopts);
|
||||
}
|
||||
|
||||
START_TEST(misc)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
test_HTMLLoadOptions();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
24
rostests/winetests/mshtml/mshtml.rbuild
Normal file
24
rostests/winetests/mshtml/mshtml.rbuild
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<group>
|
||||
<module name="mshtml_winetest" type="win32cui" installbase="bin" installname="mshtml_winetest.exe" allowwarnings="true" entrypoint="0">
|
||||
<include base="mshtml_winetest">.</include>
|
||||
<define name="WINVER">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x600</define>
|
||||
<file>dom.c</file>
|
||||
<file>htmldoc.c</file>
|
||||
<file>misc.c</file>
|
||||
<file>protocol.c</file>
|
||||
<file>script.c</file>
|
||||
<file>testlist.c</file>
|
||||
<library>wine</library>
|
||||
<library>ole32</library>
|
||||
<library>oleaut32</library>
|
||||
<library>user32</library>
|
||||
<library>urlmon</library>
|
||||
<library>advapi32</library>
|
||||
<library>kernel32</library>
|
||||
<library>uuid</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
||||
</group>
|
779
rostests/winetests/mshtml/protocol.c
Normal file
779
rostests/winetests/mshtml/protocol.c
Normal file
|
@ -0,0 +1,779 @@
|
|||
/*
|
||||
* Copyright 2005 Jacek Caban
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include <wine/test.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "ole2.h"
|
||||
#include "urlmon.h"
|
||||
#include "shlwapi.h"
|
||||
|
||||
#include "initguid.h"
|
||||
|
||||
#define DEFINE_EXPECT(func) \
|
||||
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
|
||||
|
||||
#define SET_EXPECT(func) \
|
||||
expect_ ## func = TRUE
|
||||
|
||||
#define CHECK_EXPECT(func) \
|
||||
do { \
|
||||
ok(expect_ ##func, "unexpected call " #func "\n"); \
|
||||
expect_ ## func = FALSE; \
|
||||
called_ ## func = TRUE; \
|
||||
}while(0)
|
||||
|
||||
#define CHECK_EXPECT2(func) \
|
||||
do { \
|
||||
ok(expect_ ##func, "unexpected call " #func "\n"); \
|
||||
called_ ## func = TRUE; \
|
||||
}while(0)
|
||||
|
||||
#define CHECK_CALLED(func) \
|
||||
do { \
|
||||
ok(called_ ## func, "expected " #func "\n"); \
|
||||
expect_ ## func = called_ ## func = FALSE; \
|
||||
}while(0)
|
||||
|
||||
DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
|
||||
DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
|
||||
|
||||
DEFINE_EXPECT(GetBindInfo);
|
||||
DEFINE_EXPECT(ReportProgress);
|
||||
DEFINE_EXPECT(ReportData);
|
||||
DEFINE_EXPECT(ReportResult);
|
||||
|
||||
static HRESULT expect_hrResult;
|
||||
static BOOL expect_hr_win32err = FALSE;
|
||||
static DWORD bindf;
|
||||
|
||||
static const WCHAR about_blank_url[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
|
||||
static const WCHAR about_test_url[] = {'a','b','o','u','t',':','t','e','s','t',0};
|
||||
static const WCHAR about_res_url[] = {'r','e','s',':','b','l','a','n','k',0};
|
||||
|
||||
static const char *debugstr_w(LPCWSTR str)
|
||||
{
|
||||
static char buf[1024];
|
||||
WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
|
||||
return buf;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
|
||||
*ppv = iface;
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ProtocolSink_AddRef(IInternetProtocolSink *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ProtocolSink_Release(IInternetProtocolSink *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode,
|
||||
LPCWSTR szStatusText)
|
||||
{
|
||||
static const WCHAR text_html[] = {'t','e','x','t','/','h','t','m','l',0};
|
||||
|
||||
CHECK_EXPECT(ReportProgress);
|
||||
|
||||
ok(ulStatusCode == BINDSTATUS_MIMETYPEAVAILABLE
|
||||
|| ulStatusCode == BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE,
|
||||
"ulStatusCode=%d\n", ulStatusCode);
|
||||
ok(!lstrcmpW(szStatusText, text_html), "szStatusText != text/html\n");
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress,
|
||||
ULONG ulProgressMax)
|
||||
{
|
||||
CHECK_EXPECT(ReportData);
|
||||
|
||||
ok(ulProgress == ulProgressMax, "ulProgress != ulProgressMax\n");
|
||||
ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE),
|
||||
"grcf = %08x\n", grfBSCF);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError,
|
||||
LPCWSTR szResult)
|
||||
{
|
||||
CHECK_EXPECT(ReportResult);
|
||||
|
||||
if(expect_hr_win32err)
|
||||
ok((hrResult&0xffff0000) == ((FACILITY_WIN32 << 16)|0x80000000) || expect_hrResult,
|
||||
"expected win32 err or %08x got: %08x\n", expect_hrResult, hrResult);
|
||||
else
|
||||
ok(hrResult == expect_hrResult || ((expect_hrResult == E_INVALIDARG ||
|
||||
expect_hrResult == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND)) &&
|
||||
hrResult == MK_E_SYNTAX), "expected: %08x got: %08x\n", expect_hrResult, hrResult);
|
||||
ok(dwError == 0, "dwError = %d\n", dwError);
|
||||
ok(!szResult, "szResult != NULL\n");
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static IInternetProtocolSinkVtbl protocol_sink_vtbl = {
|
||||
ProtocolSink_QueryInterface,
|
||||
ProtocolSink_AddRef,
|
||||
ProtocolSink_Release,
|
||||
ProtocolSink_Switch,
|
||||
ProtocolSink_ReportProgress,
|
||||
ProtocolSink_ReportData,
|
||||
ProtocolSink_ReportResult
|
||||
};
|
||||
|
||||
static IInternetProtocolSink protocol_sink = {
|
||||
&protocol_sink_vtbl
|
||||
};
|
||||
|
||||
static HRESULT WINAPI BindInfo_QueryInterface(IInternetBindInfo *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetBindInfo, riid)) {
|
||||
*ppv = iface;
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BindInfo_AddRef(IInternetBindInfo *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BindInfo_Release(IInternetBindInfo *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
|
||||
{
|
||||
CHECK_EXPECT(GetBindInfo);
|
||||
|
||||
ok(grfBINDF != NULL, "grfBINDF == NULL\n");
|
||||
ok(pbindinfo != NULL, "pbindinfo == NULL\n");
|
||||
ok(pbindinfo->cbSize == sizeof(BINDINFO), "wrong size of pbindinfo: %d\n", pbindinfo->cbSize);
|
||||
|
||||
*grfBINDF = bindf;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulStringType, LPOLESTR *ppwzStr,
|
||||
ULONG cEl, ULONG *pcElFetched)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static IInternetBindInfoVtbl bind_info_vtbl = {
|
||||
BindInfo_QueryInterface,
|
||||
BindInfo_AddRef,
|
||||
BindInfo_Release,
|
||||
BindInfo_GetBindInfo,
|
||||
BindInfo_GetBindString
|
||||
};
|
||||
|
||||
static IInternetBindInfo bind_info = {
|
||||
&bind_info_vtbl
|
||||
};
|
||||
|
||||
static void test_protocol_fail(IInternetProtocol *protocol, LPCWSTR url, HRESULT expected_hres,
|
||||
BOOL expect_win32err)
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
SET_EXPECT(GetBindInfo);
|
||||
SET_EXPECT(ReportResult);
|
||||
|
||||
expect_hrResult = expected_hres;
|
||||
expect_hr_win32err = expect_win32err;
|
||||
hres = IInternetProtocol_Start(protocol, url, &protocol_sink, &bind_info, 0, 0);
|
||||
if(expect_win32err)
|
||||
ok((hres&0xffff0000) == ((FACILITY_WIN32 << 16)|0x80000000) || hres == expect_hrResult,
|
||||
"expected win32 err or %08x got: %08x\n", expected_hres, hres);
|
||||
else
|
||||
ok(hres == expected_hres || ((expected_hres == E_INVALIDARG ||
|
||||
expected_hres == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND)) && hres == MK_E_SYNTAX),
|
||||
"expected: %08x got: %08x\n", expected_hres, hres);
|
||||
|
||||
CHECK_CALLED(GetBindInfo);
|
||||
CHECK_CALLED(ReportResult);
|
||||
}
|
||||
|
||||
static void protocol_start(IInternetProtocol *protocol, LPCWSTR url)
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
SET_EXPECT(GetBindInfo);
|
||||
SET_EXPECT(ReportResult);
|
||||
SET_EXPECT(ReportProgress);
|
||||
SET_EXPECT(ReportData);
|
||||
expect_hrResult = S_OK;
|
||||
expect_hr_win32err = FALSE;
|
||||
|
||||
hres = IInternetProtocol_Start(protocol, url, &protocol_sink, &bind_info, 0, 0);
|
||||
ok(hres == S_OK, "Start failed: %08x\n", hres);
|
||||
|
||||
CHECK_CALLED(GetBindInfo);
|
||||
CHECK_CALLED(ReportProgress);
|
||||
CHECK_CALLED(ReportData);
|
||||
CHECK_CALLED(ReportResult);
|
||||
}
|
||||
|
||||
static void res_sec_url_cmp(LPCWSTR url, DWORD size, LPCWSTR file)
|
||||
{
|
||||
WCHAR buf[MAX_PATH];
|
||||
DWORD len;
|
||||
|
||||
static const WCHAR fileW[] = {'f','i','l','e',':','/','/'};
|
||||
|
||||
if(size < sizeof(fileW)/sizeof(WCHAR) || memcmp(url, fileW, sizeof(fileW))) {
|
||||
ok(0, "wrong URL protocol\n");
|
||||
return;
|
||||
}
|
||||
|
||||
len = SearchPathW(NULL, file, NULL, sizeof(buf)/sizeof(WCHAR), buf, NULL);
|
||||
if(!len) {
|
||||
ok(0, "SearchPath failed: %u\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
len += sizeof(fileW)/sizeof(WCHAR)+1;
|
||||
ok(len == size, "wrong size %u, expected %u\n", size, len);
|
||||
ok(!lstrcmpW(url + sizeof(fileW)/sizeof(WCHAR), buf), "wrong file part %s\n", debugstr_w(url));
|
||||
}
|
||||
|
||||
static void test_res_protocol(void)
|
||||
{
|
||||
IInternetProtocolInfo *protocol_info;
|
||||
IUnknown *unk;
|
||||
IClassFactory *factory;
|
||||
HRESULT hres;
|
||||
|
||||
static const WCHAR blank_url[] =
|
||||
{'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l','/','b','l','a','n','k','.','h','t','m',0};
|
||||
static const WCHAR test_part_url[] = {'r','e','s',':','/','/','C','S','S','/','t','e','s','t',0};
|
||||
static const WCHAR wrong_url1[] =
|
||||
{'m','s','h','t','m','l','.','d','l','l','/','b','l','a','n','k','.','m','t','h',0};
|
||||
static const WCHAR wrong_url2[] =
|
||||
{'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l',0};
|
||||
static const WCHAR wrong_url3[] =
|
||||
{'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l','/','x','x','.','h','t','m',0};
|
||||
static const WCHAR wrong_url4[] =
|
||||
{'r','e','s',':','/','/','x','x','.','d','l','l','/','b','l','a','n','k','.','h','t','m',0};
|
||||
static const WCHAR wrong_url5[] =
|
||||
{'r','e','s',':','/','/','s','h','t','m','l','.','d','l','l','/','b','l','a','n','k','.','h','t','m',0};
|
||||
static const WCHAR mshtml_dllW[] = {'m','s','h','t','m','l','.','d','l','l',0};
|
||||
|
||||
hres = CoGetClassObject(&CLSID_ResProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
|
||||
ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
|
||||
if(!SUCCEEDED(hres))
|
||||
return;
|
||||
|
||||
hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
|
||||
ok(hres == S_OK, "Could not get IInternetProtocolInfo interface: %08x\n", hres);
|
||||
if(SUCCEEDED(hres)) {
|
||||
WCHAR buf[128];
|
||||
DWORD size;
|
||||
int i;
|
||||
|
||||
for(i = PARSE_CANONICALIZE; i <= PARSE_UNESCAPE; i++) {
|
||||
if(i != PARSE_SECURITY_URL && i != PARSE_DOMAIN) {
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, i, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == INET_E_DEFAULT_ACTION,
|
||||
"[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n", i, hres);
|
||||
}
|
||||
}
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
|
||||
res_sec_url_cmp(buf, size, mshtml_dllW);
|
||||
|
||||
size = 0;
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_SECURITY_URL, 0, buf,
|
||||
3, &size, 0);
|
||||
ok(hres == S_FALSE, "ParseUrl failed: %08x, expected S_FALSE\n", hres);
|
||||
ok(size, "size=0\n");
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url1, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == MK_E_SYNTAX || hres == E_INVALIDARG,
|
||||
"ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url5, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == MK_E_SYNTAX, "ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
ok(size == sizeof(blank_url)/sizeof(WCHAR), "size=%d\n", size);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url1, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
ok(size == sizeof(wrong_url1)/sizeof(WCHAR), "size=%d\n", size);
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* Crashes on win9x */
|
||||
size = 0xdeadbeef;
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
ok(size == 1, "size=%u, ezpected 1\n", size);
|
||||
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), NULL, 0);
|
||||
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), NULL, 0);
|
||||
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
}
|
||||
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_UNESCAPE+1, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == INET_E_DEFAULT_ACTION,
|
||||
"ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, blank_url, test_part_url,
|
||||
0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, blank_url, test_part_url,
|
||||
URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, NULL, NULL,
|
||||
URL_FILE_USE_PATHURL, NULL, 0xdeadbeef, NULL, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
hres = IInternetProtocolInfo_CompareUrl(protocol_info, blank_url, blank_url, 0);
|
||||
ok(hres == E_NOTIMPL, "CompareUrl failed: %08x\n", hres);
|
||||
|
||||
hres = IInternetProtocolInfo_CompareUrl(protocol_info, NULL, NULL, 0xdeadbeef);
|
||||
ok(hres == E_NOTIMPL, "CompareUrl failed: %08x\n", hres);
|
||||
|
||||
for(i=0; i<30; i++) {
|
||||
if(i == QUERY_USES_NETWORK || i == QUERY_IS_SECURE || i == QUERY_IS_SAFE)
|
||||
continue;
|
||||
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, i, 0,
|
||||
buf, sizeof(buf), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER,
|
||||
"QueryInfo(%d) returned: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER\n", i, hres);
|
||||
}
|
||||
|
||||
size = 0xdeadbeef;
|
||||
memset(buf, '?', sizeof(buf));
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, QUERY_USES_NETWORK, 0,
|
||||
buf, sizeof(buf), &size, 0);
|
||||
ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
|
||||
ok(size == sizeof(DWORD), "size=%d\n", size);
|
||||
ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
|
||||
|
||||
memset(buf, '?', sizeof(buf));
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, QUERY_USES_NETWORK, 0,
|
||||
buf, sizeof(buf), NULL, 0);
|
||||
ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
|
||||
ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
|
||||
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, QUERY_USES_NETWORK, 0,
|
||||
buf, 3, &size, 0);
|
||||
ok(hres == E_FAIL, "QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL\n", hres);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
memset(buf, '?', sizeof(buf));
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, NULL, QUERY_USES_NETWORK, 0,
|
||||
buf, sizeof(buf), &size, 0);
|
||||
ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL\n", hres);
|
||||
ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
|
||||
ok(size == sizeof(DWORD), "size=%d\n", size);
|
||||
ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
|
||||
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, QUERY_USES_NETWORK, 0,
|
||||
NULL, sizeof(buf), &size, 0);
|
||||
ok(hres == E_FAIL, "QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL\n", hres);
|
||||
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, 60, 0,
|
||||
NULL, sizeof(buf), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER,
|
||||
"QueryInfo failed: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER\n", hres);
|
||||
|
||||
IInternetProtocolInfo_Release(protocol_info);
|
||||
}
|
||||
|
||||
hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
|
||||
ok(hres == S_OK, "Could not get IClassFactory interface\n");
|
||||
if(SUCCEEDED(hres)) {
|
||||
IInternetProtocol *protocol;
|
||||
BYTE buf[512];
|
||||
ULONG cb;
|
||||
hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
|
||||
ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
|
||||
|
||||
if(SUCCEEDED(hres)) {
|
||||
IInternetPriority *priority;
|
||||
|
||||
hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority);
|
||||
ok(hres == E_NOINTERFACE,
|
||||
"QueryInterface(IInternetPriority) returned %08x, expected E_NOINTEFACE\n", hres);
|
||||
|
||||
test_protocol_fail(protocol, wrong_url1, E_INVALIDARG, FALSE);
|
||||
test_protocol_fail(protocol, wrong_url2,
|
||||
HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), FALSE);
|
||||
test_protocol_fail(protocol, wrong_url3, E_FAIL, TRUE);
|
||||
test_protocol_fail(protocol, wrong_url4, E_FAIL, TRUE);
|
||||
|
||||
cb = 0xdeadbeef;
|
||||
hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
|
||||
ok(hres == E_FAIL, "Read returned %08x expected E_FAIL\n", hres);
|
||||
ok(cb == 0xdeadbeef, "cb=%u expected 0xdeadbeef\n", cb);
|
||||
|
||||
protocol_start(protocol, blank_url);
|
||||
hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n", hres);
|
||||
ok(cb == 2, "cb=%u expected 2\n", cb);
|
||||
hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
|
||||
ok(hres == S_FALSE, "Read failed: %08x expected S_FALSE\n", hres);
|
||||
ok(cb == 0, "cb=%u expected 0\n", cb);
|
||||
hres = IInternetProtocol_UnlockRequest(protocol);
|
||||
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
|
||||
|
||||
protocol_start(protocol, blank_url);
|
||||
hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_LockRequest(protocol, 0);
|
||||
ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_UnlockRequest(protocol);
|
||||
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n", hres);
|
||||
|
||||
protocol_start(protocol, blank_url);
|
||||
hres = IInternetProtocol_LockRequest(protocol, 0);
|
||||
ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Terminate(protocol, 0);
|
||||
ok(hres == S_OK, "Terminate failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n\n", hres);
|
||||
hres = IInternetProtocol_UnlockRequest(protocol);
|
||||
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Terminate(protocol, 0);
|
||||
ok(hres == S_OK, "Terminate failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n", hres);
|
||||
ok(cb == 2, "cb=%u expected 2\n", cb);
|
||||
|
||||
protocol_start(protocol, blank_url);
|
||||
hres = IInternetProtocol_LockRequest(protocol, 0);
|
||||
ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n", hres);
|
||||
protocol_start(protocol, blank_url);
|
||||
hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Terminate(protocol, 0);
|
||||
ok(hres == S_OK, "Terminate failed: %08x\n", hres);
|
||||
|
||||
IInternetProtocol_Release(protocol);
|
||||
}
|
||||
|
||||
IClassFactory_Release(factory);
|
||||
}
|
||||
|
||||
IUnknown_Release(unk);
|
||||
}
|
||||
|
||||
static void do_test_about_protocol(IClassFactory *factory, DWORD bf)
|
||||
{
|
||||
IInternetProtocol *protocol;
|
||||
IInternetPriority *priority;
|
||||
BYTE buf[512];
|
||||
ULONG cb;
|
||||
HRESULT hres;
|
||||
|
||||
static const WCHAR blank_html[] = {0xfeff,'<','H','T','M','L','>','<','/','H','T','M','L','>',0};
|
||||
static const WCHAR test_html[] =
|
||||
{0xfeff,'<','H','T','M','L','>','t','e','s','t','<','/','H','T','M','L','>',0};
|
||||
|
||||
bindf = bf;
|
||||
|
||||
hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
|
||||
ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
|
||||
if(FAILED(hres))
|
||||
return;
|
||||
|
||||
hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority);
|
||||
ok(hres == E_NOINTERFACE,
|
||||
"QueryInterface(IInternetPriority) returned %08x, expected E_NOINTEFACE\n", hres);
|
||||
|
||||
protocol_start(protocol, about_blank_url);
|
||||
hres = IInternetProtocol_LockRequest(protocol, 0);
|
||||
ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n", hres);
|
||||
ok(cb == sizeof(blank_html), "cb=%d\n", cb);
|
||||
ok(!memcmp(buf, blank_html, cb), "Readed wrong data\n");
|
||||
hres = IInternetProtocol_UnlockRequest(protocol);
|
||||
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
|
||||
|
||||
protocol_start(protocol, about_test_url);
|
||||
hres = IInternetProtocol_LockRequest(protocol, 0);
|
||||
ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n", hres);
|
||||
ok(cb == sizeof(test_html), "cb=%d\n", cb);
|
||||
ok(!memcmp(buf, test_html, cb), "Readed wrong data\n");
|
||||
hres = IInternetProtocol_UnlockRequest(protocol);
|
||||
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
|
||||
|
||||
protocol_start(protocol, about_res_url);
|
||||
hres = IInternetProtocol_LockRequest(protocol, 0);
|
||||
ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
|
||||
hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
|
||||
ok(hres == S_OK, "Read failed: %08x\n", hres);
|
||||
ok(cb == sizeof(blank_html), "cb=%d\n", cb);
|
||||
ok(!memcmp(buf, blank_html, cb), "Readed wrong data\n");
|
||||
hres = IInternetProtocol_UnlockRequest(protocol);
|
||||
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
|
||||
|
||||
IInternetProtocol_Release(protocol);
|
||||
}
|
||||
|
||||
static void test_about_protocol(void)
|
||||
{
|
||||
IInternetProtocolInfo *protocol_info;
|
||||
IUnknown *unk;
|
||||
IClassFactory *factory;
|
||||
HRESULT hres;
|
||||
|
||||
hres = CoGetClassObject(&CLSID_AboutProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
|
||||
ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
|
||||
if(!SUCCEEDED(hres))
|
||||
return;
|
||||
|
||||
hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
|
||||
ok(hres == S_OK, "Could not get IInternetProtocolInfo interface: %08x\n", hres);
|
||||
if(SUCCEEDED(hres)) {
|
||||
WCHAR buf[128];
|
||||
DWORD size;
|
||||
int i;
|
||||
|
||||
for(i = PARSE_CANONICALIZE; i <= PARSE_UNESCAPE; i++) {
|
||||
if(i != PARSE_SECURITY_URL && i != PARSE_DOMAIN) {
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, i, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == INET_E_DEFAULT_ACTION,
|
||||
"[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n", i, hres);
|
||||
}
|
||||
}
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
|
||||
ok(!lstrcmpW(about_blank_url, buf), "buf != blank_url\n");
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_SECURITY_URL, 0, buf,
|
||||
3, &size, 0);
|
||||
ok(hres == S_FALSE, "ParseUrl failed: %08x, expected S_FALSE\n", hres);
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_test_url, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
|
||||
ok(!lstrcmpW(about_test_url, buf), "buf != test_url\n");
|
||||
|
||||
size = 0xdeadbeef;
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
ok(size == sizeof(about_blank_url)/sizeof(WCHAR), "size=%d\n", size);
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* Crashes on win9x */
|
||||
size = 0xdeadbeef;
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
ok(size == 1, "size=%u, ezpected 1\n", size);
|
||||
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), NULL, 0);
|
||||
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), NULL, 0);
|
||||
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
}
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_UNESCAPE+1, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == INET_E_DEFAULT_ACTION,
|
||||
"ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION\n", hres);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, about_blank_url, about_test_url,
|
||||
0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, about_blank_url, about_test_url,
|
||||
URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, NULL, NULL,
|
||||
URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
hres = IInternetProtocolInfo_CompareUrl(protocol_info, about_blank_url, about_blank_url, 0);
|
||||
ok(hres == E_NOTIMPL, "CompareUrl failed: %08x\n", hres);
|
||||
|
||||
hres = IInternetProtocolInfo_CompareUrl(protocol_info, NULL, NULL, 0xdeadbeef);
|
||||
ok(hres == E_NOTIMPL, "CompareUrl failed: %08x\n", hres);
|
||||
|
||||
for(i=0; i<30; i++) {
|
||||
switch(i) {
|
||||
case QUERY_CAN_NAVIGATE:
|
||||
case QUERY_USES_NETWORK:
|
||||
case QUERY_IS_CACHED:
|
||||
case QUERY_IS_INSTALLEDENTRY:
|
||||
case QUERY_IS_CACHED_OR_MAPPED:
|
||||
case QUERY_IS_SECURE:
|
||||
case QUERY_IS_SAFE:
|
||||
break;
|
||||
default:
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, i, 0,
|
||||
buf, sizeof(buf), &size, 0);
|
||||
ok(hres == E_FAIL, "QueryInfo(%d) returned: %08x, expected E_FAIL\n", i, hres);
|
||||
}
|
||||
}
|
||||
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, QUERY_CAN_NAVIGATE, 0,
|
||||
buf, sizeof(buf), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER,
|
||||
"QueryInfo returned: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER\n", hres);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
memset(buf, '?', sizeof(buf));
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, QUERY_USES_NETWORK, 0,
|
||||
buf, sizeof(buf), &size, 0);
|
||||
ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
|
||||
ok(size == sizeof(DWORD), "size=%d\n", size);
|
||||
ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
|
||||
|
||||
memset(buf, '?', sizeof(buf));
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, QUERY_USES_NETWORK, 0,
|
||||
buf, sizeof(buf), NULL, 0);
|
||||
ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
|
||||
ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
|
||||
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, QUERY_USES_NETWORK, 0,
|
||||
buf, 3, &size, 0);
|
||||
ok(hres == E_FAIL, "QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL\n", hres);
|
||||
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, QUERY_USES_NETWORK, 0,
|
||||
NULL, sizeof(buf), &size, 0);
|
||||
ok(hres == E_FAIL, "QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL\n", hres);
|
||||
|
||||
hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, 60, 0,
|
||||
NULL, sizeof(buf), &size, 0);
|
||||
ok(hres == E_FAIL, "QueryInfo failed: %08x, expected E_FAIL\n", hres);
|
||||
|
||||
IInternetProtocolInfo_Release(protocol_info);
|
||||
}
|
||||
|
||||
hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
|
||||
ok(hres == S_OK, "Could not get IClassFactory interface\n");
|
||||
if(SUCCEEDED(hres)) {
|
||||
do_test_about_protocol(factory, 0);
|
||||
do_test_about_protocol(factory,
|
||||
BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NEEDFILE);
|
||||
|
||||
IClassFactory_Release(factory);
|
||||
}
|
||||
|
||||
IUnknown_Release(unk);
|
||||
}
|
||||
|
||||
START_TEST(protocol)
|
||||
{
|
||||
OleInitialize(NULL);
|
||||
|
||||
test_res_protocol();
|
||||
test_about_protocol();
|
||||
|
||||
OleUninitialize();
|
||||
}
|
536
rostests/winetests/mshtml/script.c
Normal file
536
rostests/winetests/mshtml/script.c
Normal file
|
@ -0,0 +1,536 @@
|
|||
/*
|
||||
* Copyright 2008 Jacek Caban for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
#define CONST_VTABLE
|
||||
|
||||
#include <wine/test.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "ole2.h"
|
||||
#include "mshtml.h"
|
||||
#include "activscp.h"
|
||||
|
||||
#define DEFINE_EXPECT(func) \
|
||||
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
|
||||
|
||||
#define SET_EXPECT(func) \
|
||||
do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)
|
||||
|
||||
#define CHECK_EXPECT2(func) \
|
||||
do { \
|
||||
ok(expect_ ##func, "unexpected call " #func "\n"); \
|
||||
called_ ## func = TRUE; \
|
||||
}while(0)
|
||||
|
||||
#define CHECK_EXPECT(func) \
|
||||
do { \
|
||||
CHECK_EXPECT2(func); \
|
||||
expect_ ## func = FALSE; \
|
||||
}while(0)
|
||||
|
||||
#define CHECK_CALLED(func) \
|
||||
do { \
|
||||
ok(called_ ## func, "expected " #func "\n"); \
|
||||
expect_ ## func = called_ ## func = FALSE; \
|
||||
}while(0)
|
||||
|
||||
#define CHECK_NOT_CALLED(func) \
|
||||
do { \
|
||||
ok(!called_ ## func, "unexpected " #func "\n"); \
|
||||
expect_ ## func = called_ ## func = FALSE; \
|
||||
}while(0)
|
||||
|
||||
#define CLEAR_CALLED(func) \
|
||||
expect_ ## func = called_ ## func = FALSE
|
||||
|
||||
|
||||
DEFINE_EXPECT(CreateInstance);
|
||||
|
||||
|
||||
#define TESTSCRIPT_CLSID "{178fc163-f585-4e24-9c13-4bb7faf80746}"
|
||||
|
||||
static const GUID CLSID_TestScript =
|
||||
{0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x07,0x46}};
|
||||
|
||||
static IHTMLDocument2 *notif_doc;
|
||||
static BOOL doc_complete;
|
||||
|
||||
static const char *debugstr_guid(REFIID riid)
|
||||
{
|
||||
static char buf[50];
|
||||
|
||||
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]);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
|
||||
REFIID riid, void**ppv)
|
||||
{
|
||||
if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
|
||||
*ppv = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
|
||||
{
|
||||
if(dispID == DISPID_READYSTATE){
|
||||
BSTR state;
|
||||
HRESULT hres;
|
||||
|
||||
static const WCHAR completeW[] = {'c','o','m','p','l','e','t','e',0};
|
||||
|
||||
hres = IHTMLDocument2_get_readyState(notif_doc, &state);
|
||||
ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
|
||||
|
||||
if(!lstrcmpW(state, completeW))
|
||||
doc_complete = TRUE;
|
||||
|
||||
SysFreeString(state);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
|
||||
PropertyNotifySink_QueryInterface,
|
||||
PropertyNotifySink_AddRef,
|
||||
PropertyNotifySink_Release,
|
||||
PropertyNotifySink_OnChanged,
|
||||
PropertyNotifySink_OnRequestEdit
|
||||
};
|
||||
|
||||
static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
|
||||
|
||||
static IHTMLDocument2 *create_document(void)
|
||||
{
|
||||
IHTMLDocument2 *doc;
|
||||
HRESULT hres;
|
||||
|
||||
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IHTMLDocument2, (void**)&doc);
|
||||
ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
static IHTMLDocument2 *create_doc_with_string(const char *str)
|
||||
{
|
||||
IPersistStreamInit *init;
|
||||
IStream *stream;
|
||||
IHTMLDocument2 *doc;
|
||||
HGLOBAL mem;
|
||||
SIZE_T len;
|
||||
|
||||
notif_doc = doc = create_document();
|
||||
if(!doc)
|
||||
return NULL;
|
||||
|
||||
doc_complete = FALSE;
|
||||
len = strlen(str);
|
||||
mem = GlobalAlloc(0, len);
|
||||
memcpy(mem, str, len);
|
||||
CreateStreamOnHGlobal(mem, TRUE, &stream);
|
||||
|
||||
IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
|
||||
|
||||
IPersistStreamInit_Load(init, stream);
|
||||
IPersistStreamInit_Release(init);
|
||||
IStream_Release(stream);
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
|
||||
{
|
||||
IConnectionPointContainer *container;
|
||||
IConnectionPoint *cp;
|
||||
DWORD cookie;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
|
||||
ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
|
||||
|
||||
hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
|
||||
IConnectionPointContainer_Release(container);
|
||||
ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
|
||||
|
||||
hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
|
||||
IConnectionPoint_Release(cp);
|
||||
ok(hres == S_OK, "Advise failed: %08x\n", hres);
|
||||
}
|
||||
|
||||
typedef void (*domtest_t)(IHTMLDocument2*);
|
||||
|
||||
static IHTMLDocument2 *create_and_load_doc(const char *str)
|
||||
{
|
||||
IHTMLDocument2 *doc;
|
||||
IHTMLElement *body = NULL;
|
||||
ULONG ref;
|
||||
MSG msg;
|
||||
HRESULT hres;
|
||||
|
||||
doc = create_doc_with_string(str);
|
||||
do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
|
||||
|
||||
while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
hres = IHTMLDocument2_get_body(doc, &body);
|
||||
ok(hres == S_OK, "get_body failed: %08x\n", hres);
|
||||
|
||||
if(!body) {
|
||||
skip("Could not get document body. Assuming no Gecko installed.\n");
|
||||
ref = IHTMLDocument2_Release(doc);
|
||||
ok(!ref, "ref = %d\n", ref);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IHTMLElement_Release(body);
|
||||
return doc;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_QueryInterface(IActiveScript *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
|
||||
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IActiveScript, riid)) {
|
||||
*ppv = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if(IsEqualGUID(&IID_IActiveScriptParse, riid)) {
|
||||
/* TODO */
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ok(0, "unexpected riid %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ActiveScript_AddRef(IActiveScript *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ActiveScript_Release(IActiveScript *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_SetScriptSite(IActiveScript *iface, IActiveScriptSite *pass)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_GetScriptSite(IActiveScript *iface, REFIID riid,
|
||||
void **ppvObject)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE ss)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_GetScriptState(IActiveScript *iface, SCRIPTSTATE *pssState)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_Close(IActiveScript *iface)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_AddNamedItem(IActiveScript *iface,
|
||||
LPCOLESTR pstrName, DWORD dwFlags)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_AddTypeLib(IActiveScript *iface, REFGUID rguidTypeLib,
|
||||
DWORD dwMajor, DWORD dwMinor, DWORD dwFlags)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR pstrItemName,
|
||||
IDispatch **ppdisp)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_GetCurrentScriptThreadID(IActiveScript *iface,
|
||||
SCRIPTTHREADID *pstridThread)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_GetScriptThreadID(IActiveScript *iface,
|
||||
DWORD dwWin32ThreadId, SCRIPTTHREADID *pstidThread)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_GetScriptThreadState(IActiveScript *iface,
|
||||
SCRIPTTHREADID stidThread, SCRIPTTHREADSTATE *pstsState)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_InterruptScriptThread(IActiveScript *iface,
|
||||
SCRIPTTHREADID stidThread, const EXCEPINFO *pexcepinfo, DWORD dwFlags)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ActiveScript_Clone(IActiveScript *iface, IActiveScript **ppscript)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IActiveScriptVtbl ActiveScriptVtbl = {
|
||||
ActiveScript_QueryInterface,
|
||||
ActiveScript_AddRef,
|
||||
ActiveScript_Release,
|
||||
ActiveScript_SetScriptSite,
|
||||
ActiveScript_GetScriptSite,
|
||||
ActiveScript_SetScriptState,
|
||||
ActiveScript_GetScriptState,
|
||||
ActiveScript_Close,
|
||||
ActiveScript_AddNamedItem,
|
||||
ActiveScript_AddTypeLib,
|
||||
ActiveScript_GetScriptDispatch,
|
||||
ActiveScript_GetCurrentScriptThreadID,
|
||||
ActiveScript_GetScriptThreadID,
|
||||
ActiveScript_GetScriptThreadState,
|
||||
ActiveScript_InterruptScriptThread,
|
||||
ActiveScript_Clone
|
||||
};
|
||||
|
||||
static IActiveScript ActiveScript = { &ActiveScriptVtbl };
|
||||
|
||||
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
|
||||
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid)) {
|
||||
*ppv = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if(IsEqualGUID(&IID_IMarshal, riid))
|
||||
return E_NOINTERFACE;
|
||||
if(IsEqualGUID(&CLSID_IdentityUnmarshal, riid))
|
||||
return E_NOINTERFACE;
|
||||
|
||||
ok(0, "unexpected riid %s\n", debugstr_guid(riid));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
|
||||
{
|
||||
CHECK_EXPECT(CreateInstance);
|
||||
|
||||
ok(!outer, "outer = %p\n", outer);
|
||||
ok(IsEqualGUID(&IID_IActiveScript, riid), "unexpected riid %s\n", debugstr_guid(riid));
|
||||
*ppv = &ActiveScript;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IClassFactoryVtbl ClassFactoryVtbl = {
|
||||
ClassFactory_QueryInterface,
|
||||
ClassFactory_AddRef,
|
||||
ClassFactory_Release,
|
||||
ClassFactory_CreateInstance,
|
||||
ClassFactory_LockServer
|
||||
};
|
||||
|
||||
static IClassFactory script_cf = { &ClassFactoryVtbl };
|
||||
|
||||
static const char simple_script_str[] =
|
||||
"<html><head></head><body>"
|
||||
"<script language=\"TestScript\">simple script</script>"
|
||||
"</body></html>";
|
||||
|
||||
static void test_simple_script(void)
|
||||
{
|
||||
IHTMLDocument2 *doc;
|
||||
|
||||
SET_EXPECT(CreateInstance);
|
||||
|
||||
doc = create_and_load_doc(simple_script_str);
|
||||
if(!doc) return;
|
||||
|
||||
CHECK_CALLED(CreateInstance);
|
||||
|
||||
IHTMLDocument2_Release(doc);
|
||||
}
|
||||
|
||||
static BOOL init_key(const char *key_name, const char *def_value, BOOL init)
|
||||
{
|
||||
HKEY hkey;
|
||||
DWORD res;
|
||||
|
||||
if(!init) {
|
||||
RegDeleteKey(HKEY_CLASSES_ROOT, key_name);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
res = RegCreateKeyA(HKEY_CLASSES_ROOT, key_name, &hkey);
|
||||
if(res != ERROR_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
if(def_value)
|
||||
res = RegSetValueA(hkey, NULL, REG_SZ, def_value, strlen(def_value));
|
||||
|
||||
RegCloseKey(hkey);
|
||||
|
||||
return res == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static BOOL init_registry(BOOL init)
|
||||
{
|
||||
return init_key("TestScript\\CLSID", TESTSCRIPT_CLSID, init)
|
||||
&& init_key("CLSID\\"TESTSCRIPT_CLSID"\\Implemented Categories\\{F0B7A1A1-9847-11CF-8F20-00805F2CD064}",
|
||||
NULL, init)
|
||||
&& init_key("CLSID\\"TESTSCRIPT_CLSID"\\Implemented Categories\\{F0B7A1A2-9847-11CF-8F20-00805F2CD064}",
|
||||
NULL, init);
|
||||
}
|
||||
|
||||
static BOOL register_script_engine(void)
|
||||
{
|
||||
DWORD regid;
|
||||
HRESULT hres;
|
||||
|
||||
if(!init_registry(TRUE)) {
|
||||
init_registry(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hres = CoRegisterClassObject(&CLSID_TestScript, (IUnknown *)&script_cf,
|
||||
CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, ®id);
|
||||
ok(hres == S_OK, "Could not register screipt engine: %08x\n", hres);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void gecko_installer_workaround(BOOL disable)
|
||||
{
|
||||
HKEY hkey;
|
||||
DWORD res;
|
||||
|
||||
static BOOL has_url = FALSE;
|
||||
static char url[2048];
|
||||
|
||||
if(!disable && !has_url)
|
||||
return;
|
||||
|
||||
res = RegOpenKey(HKEY_CURRENT_USER, "Software\\Wine\\MSHTML", &hkey);
|
||||
if(res != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
if(disable) {
|
||||
DWORD type, size = sizeof(url);
|
||||
|
||||
res = RegQueryValueEx(hkey, "GeckoUrl", NULL, &type, (PVOID)url, &size);
|
||||
if(res == ERROR_SUCCESS && type == REG_SZ)
|
||||
has_url = TRUE;
|
||||
|
||||
RegDeleteValue(hkey, "GeckoUrl");
|
||||
}else {
|
||||
RegSetValueEx(hkey, "GeckoUrl", 0, REG_SZ, (PVOID)url, lstrlenA(url)+1);
|
||||
}
|
||||
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
START_TEST(script)
|
||||
{
|
||||
gecko_installer_workaround(TRUE);
|
||||
CoInitialize(NULL);
|
||||
|
||||
if(register_script_engine()) {
|
||||
test_simple_script();
|
||||
init_registry(FALSE);
|
||||
}else {
|
||||
skip("Could not register TestScript engine\n");
|
||||
}
|
||||
|
||||
CoUninitialize();
|
||||
gecko_installer_workaround(FALSE);
|
||||
}
|
23
rostests/winetests/mshtml/testlist.c
Normal file
23
rostests/winetests/mshtml/testlist.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_dom(void);
|
||||
extern void func_htmldoc(void);
|
||||
extern void func_misc(void);
|
||||
extern void func_protocol(void);
|
||||
extern void func_script(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "dom", func_dom },
|
||||
{ "htmldoc", func_htmldoc },
|
||||
{ "misc", func_misc },
|
||||
{ "protocol", func_protocol },
|
||||
{ "script", func_script },
|
||||
{ 0, 0 }
|
||||
};
|
Loading…
Reference in a new issue