ffa22343980035de96195422598babbfd7e45a81
[reactos.git] / rostests / winetests / mshtml / htmldoc.c
1 /*
2 * Copyright 2005-2009 Jacek Caban for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 #define COBJMACROS
20 #define CONST_VTABLE
21
22 #include <wine/test.h>
23 //#include <stdarg.h>
24 #include <stdio.h>
25
26 //#include "windef.h"
27 //#include "winbase.h"
28 #include <initguid.h>
29 //#include "ole2.h"
30 #include <mshtml.h>
31 //#include "docobj.h"
32 #include <docobjectservice.h>
33 #include <wininet.h>
34 #include <mshtmhst.h>
35 #include <mshtmdid.h>
36 #include <mshtmcid.h>
37 //#include "hlink.h"
38 //#include "dispex.h"
39 #include <idispids.h>
40 #include <shlguid.h>
41 #include <shdeprecated.h>
42 #include <perhist.h>
43 //#include "shobjidl.h"
44 #include <htiface.h>
45 #include <tlogstg.h>
46 #include <exdispid.h>
47 #include "mshtml_test.h"
48
49 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
50 DEFINE_GUID(IID_IProxyManager,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
51 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
52 DEFINE_GUID(SID_SContainerDispatch,0xb722be00,0x4e68,0x101b,0xa2,0xbc,0x00,0xaa,0x00,0x40,0x47,0x70);
53
54 #define DEFINE_EXPECT(func) \
55 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
56
57 #define SET_EXPECT(func) \
58 expect_ ## func = TRUE
59
60 #define SET_CALLED(func) \
61 called_ ## func = TRUE
62
63 #define CHECK_EXPECT2(func) \
64 do { \
65 ok(expect_ ##func, "unexpected call " #func "\n"); \
66 called_ ## func = TRUE; \
67 }while(0)
68
69 #define CHECK_EXPECT(func) \
70 do { \
71 CHECK_EXPECT2(func); \
72 expect_ ## func = FALSE; \
73 }while(0)
74
75 #define CHECK_CALLED(func) \
76 do { \
77 ok(called_ ## func, "expected " #func "\n"); \
78 expect_ ## func = called_ ## func = FALSE; \
79 }while(0)
80
81 #define CHECK_NOT_CALLED(func) \
82 do { \
83 ok(!called_ ## func, "unexpected " #func "\n"); \
84 expect_ ## func = called_ ## func = FALSE; \
85 }while(0)
86
87 #define CHECK_CALLED_BROKEN(func) \
88 do { \
89 ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
90 expect_ ## func = called_ ## func = FALSE; \
91 }while(0)
92
93 #define CLEAR_CALLED(func) \
94 expect_ ## func = called_ ## func = FALSE
95
96
97 static IOleDocumentView *view = NULL;
98 static HWND container_hwnd = NULL, doc_hwnd = NULL, last_hwnd = NULL;
99
100 DEFINE_EXPECT(LockContainer);
101 DEFINE_EXPECT(SetActiveObject);
102 DEFINE_EXPECT(SetActiveObject_null);
103 DEFINE_EXPECT(GetWindow);
104 DEFINE_EXPECT(CanInPlaceActivate);
105 DEFINE_EXPECT(OnInPlaceActivate);
106 DEFINE_EXPECT(OnInPlaceActivateEx);
107 DEFINE_EXPECT(OnUIActivate);
108 DEFINE_EXPECT(GetWindowContext);
109 DEFINE_EXPECT(OnUIDeactivate);
110 DEFINE_EXPECT(OnInPlaceDeactivate);
111 DEFINE_EXPECT(OnInPlaceDeactivateEx);
112 DEFINE_EXPECT(GetContainer);
113 DEFINE_EXPECT(ShowUI);
114 DEFINE_EXPECT(ActivateMe);
115 DEFINE_EXPECT(GetHostInfo);
116 DEFINE_EXPECT(HideUI);
117 DEFINE_EXPECT(GetOptionKeyPath);
118 DEFINE_EXPECT(GetOverrideKeyPath);
119 DEFINE_EXPECT(SetStatusText);
120 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
121 DEFINE_EXPECT(QueryStatus_OPEN);
122 DEFINE_EXPECT(QueryStatus_NEW);
123 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
124 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
125 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE);
126 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
127 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
128 DEFINE_EXPECT(Exec_ShellDocView_37);
129 DEFINE_EXPECT(Exec_ShellDocView_62);
130 DEFINE_EXPECT(Exec_ShellDocView_63);
131 DEFINE_EXPECT(Exec_ShellDocView_67);
132 DEFINE_EXPECT(Exec_ShellDocView_84);
133 DEFINE_EXPECT(Exec_ShellDocView_103);
134 DEFINE_EXPECT(Exec_ShellDocView_105);
135 DEFINE_EXPECT(Exec_ShellDocView_138);
136 DEFINE_EXPECT(Exec_ShellDocView_140);
137 DEFINE_EXPECT(Exec_DocHostCommandHandler_2300);
138 DEFINE_EXPECT(Exec_UPDATECOMMANDS);
139 DEFINE_EXPECT(Exec_SETTITLE);
140 DEFINE_EXPECT(Exec_HTTPEQUIV);
141 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE);
142 DEFINE_EXPECT(Exec_Explorer_38);
143 DEFINE_EXPECT(Exec_Explorer_69);
144 DEFINE_EXPECT(Exec_DOCCANNAVIGATE);
145 DEFINE_EXPECT(Exec_DOCCANNAVIGATE_NULL);
146 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE);
147 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL);
148 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
149 DEFINE_EXPECT(Invoke_AMBIENT_SILENT);
150 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT);
151 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE);
152 DEFINE_EXPECT(Invoke_OnReadyStateChange_Interactive);
153 DEFINE_EXPECT(Invoke_OnReadyStateChange_Loading);
154 DEFINE_EXPECT(Invoke_OnReadyStateChange_Complete);
155 DEFINE_EXPECT(GetDropTarget);
156 DEFINE_EXPECT(UpdateUI);
157 DEFINE_EXPECT(Navigate);
158 DEFINE_EXPECT(OnFrameWindowActivate);
159 DEFINE_EXPECT(OnChanged_READYSTATE);
160 DEFINE_EXPECT(OnChanged_1005);
161 DEFINE_EXPECT(OnChanged_1012);
162 DEFINE_EXPECT(OnChanged_1014);
163 DEFINE_EXPECT(GetDisplayName);
164 DEFINE_EXPECT(BindToStorage);
165 DEFINE_EXPECT(IsSystemMoniker);
166 DEFINE_EXPECT(GetBindResult);
167 DEFINE_EXPECT(GetClassID);
168 DEFINE_EXPECT(Abort);
169 DEFINE_EXPECT(Read);
170 DEFINE_EXPECT(CreateInstance);
171 DEFINE_EXPECT(Start);
172 DEFINE_EXPECT(Terminate);
173 DEFINE_EXPECT(Protocol_Read);
174 DEFINE_EXPECT(LockRequest);
175 DEFINE_EXPECT(UnlockRequest);
176 DEFINE_EXPECT(OnFocus_TRUE);
177 DEFINE_EXPECT(OnFocus_FALSE);
178 DEFINE_EXPECT(RequestUIActivate);
179 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace);
180 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject);
181 DEFINE_EXPECT(GetExternal);
182 DEFINE_EXPECT(EnableModeless_TRUE);
183 DEFINE_EXPECT(EnableModeless_FALSE);
184 DEFINE_EXPECT(Frame_EnableModeless_TRUE);
185 DEFINE_EXPECT(Frame_EnableModeless_FALSE);
186 DEFINE_EXPECT(Frame_GetWindow);
187 DEFINE_EXPECT(TranslateUrl);
188 DEFINE_EXPECT(Advise_Close);
189 DEFINE_EXPECT(OnViewChange);
190 DEFINE_EXPECT(EvaluateNewWindow);
191 DEFINE_EXPECT(GetTravelLog);
192 DEFINE_EXPECT(UpdateBackForwardState);
193 DEFINE_EXPECT(FireBeforeNavigate2);
194 DEFINE_EXPECT(FireNavigateComplete2);
195 DEFINE_EXPECT(FireDocumentComplete);
196 DEFINE_EXPECT(GetPendingUrl);
197 DEFINE_EXPECT(ActiveElementChanged);
198 DEFINE_EXPECT(IsErrorUrl);
199 DEFINE_EXPECT(get_LocationURL);
200 DEFINE_EXPECT(CountEntries);
201 DEFINE_EXPECT(FindConnectionPoint);
202 DEFINE_EXPECT(EnumConnections);
203 DEFINE_EXPECT(EnumConnections_Next);
204 DEFINE_EXPECT(WindowClosing);
205 DEFINE_EXPECT(NavigateWithBindCtx);
206
207 static BOOL is_ie9plus;
208 static IUnknown *doc_unk;
209 static IMoniker *doc_mon;
210 static BOOL expect_LockContainer_fLock;
211 static BOOL expect_InPlaceUIWindow_SetActiveObject_active = TRUE;
212 static BOOL ipsex, ipsw;
213 static BOOL set_clientsite, container_locked;
214 static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
215 static BOOL editmode = FALSE, ignore_external_qi;
216 static BOOL inplace_deactivated, open_call;
217 static BOOL complete, loading_js, loading_hash, is_refresh;
218 static DWORD status_code = HTTP_STATUS_OK;
219 static BOOL asynchronous_binding = FALSE;
220 static BOOL support_wbapp, allow_new_window, no_travellog;
221 static BOOL report_mime;
222 static BOOL testing_submit;
223 static BOOL resetting_document;
224 static int stream_read, protocol_read;
225 static IStream *history_stream;
226 static enum load_state_t {
227 LD_DOLOAD,
228 LD_LOADING,
229 LD_LOADED,
230 LD_INTERACTIVE,
231 LD_COMPLETE,
232 LD_NO
233 } load_state;
234
235 static LPCOLESTR expect_status_text = NULL;
236 static const char *nav_url, *nav_serv_url, *prev_url;
237
238 static const char html_page[] =
239 "<html>"
240 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
241 "<body><div>test</div></body>"
242 "</html>";
243
244 static const char css_data[] = "body {color: red; margin: 0}";
245
246 static const WCHAR http_urlW[] =
247 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/','t','e','s','t','s','/','w','i','n','e','h','q','_','s','n','a','p','s','h','o','t','/',0};
248
249 static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
250
251 #define DOCHOST_DOCCANNAVIGATE 0
252 #define WM_CONTINUE_BINDING (WM_APP+1)
253
254 static HRESULT QueryInterface(REFIID riid, void **ppv);
255 static void test_MSHTML_QueryStatus(IHTMLDocument2*,DWORD);
256
257 #define test_readyState(u) _test_readyState(__LINE__,u)
258 static void _test_readyState(unsigned,IUnknown*);
259
260 static const WCHAR wszTimesNewRoman[] =
261 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
262 static const WCHAR wszArial[] =
263 {'A','r','i','a','l',0};
264
265 static int strcmp_wa(LPCWSTR strw, const char *stra)
266 {
267 CHAR buf[512];
268 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
269 return lstrcmpA(stra, buf);
270 }
271
272 static BOOL wstr_contains(const WCHAR *strw, const char *stra)
273 {
274 CHAR buf[512];
275 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
276 return strstr(buf, stra) != NULL;
277 }
278
279 static const WCHAR *strstrW( const WCHAR *str, const WCHAR *sub )
280 {
281 while (*str)
282 {
283 const WCHAR *p1 = str, *p2 = sub;
284 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
285 if (!*p2) return str;
286 str++;
287 }
288 return NULL;
289 }
290
291 static BSTR a2bstr(const char *str)
292 {
293 BSTR ret;
294 int len;
295
296 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
297 ret = SysAllocStringLen(NULL, len);
298 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
299
300 return ret;
301 }
302
303 /* Returns true if the user interface is in English. Note that this does not
304 * presume of the formatting of dates, numbers, etc.
305 */
306 static BOOL is_lang_english(void)
307 {
308 static HMODULE hkernel32 = NULL;
309 static LANGID (WINAPI *pGetThreadUILanguage)(void) = NULL;
310 static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
311
312 if (!hkernel32)
313 {
314 hkernel32 = GetModuleHandleA("kernel32.dll");
315 pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
316 pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
317 }
318 if (pGetThreadUILanguage)
319 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH;
320 if (pGetUserDefaultUILanguage)
321 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
322
323 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
324 }
325
326 static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
327 {
328 IUnknown *unk1, *unk2;
329
330 if(iface1 == iface2)
331 return TRUE;
332
333 IUnknown_QueryInterface(iface1, &IID_IUnknown, (void**)&unk1);
334 IUnknown_Release(unk1);
335 IUnknown_QueryInterface(iface2, &IID_IUnknown, (void**)&unk2);
336 IUnknown_Release(unk2);
337
338 return unk1 == unk2;
339 }
340
341 #define EXPECT_UPDATEUI 1
342 #define EXPECT_SETTITLE 2
343
344 static void test_timer(DWORD flags)
345 {
346 BOOL *b = &called_Exec_SETTITLE;
347 MSG msg;
348
349 if(flags & EXPECT_UPDATEUI) {
350 SET_EXPECT(UpdateUI);
351 SET_EXPECT(Exec_UPDATECOMMANDS);
352 b = &called_UpdateUI;
353 }
354 if(flags & EXPECT_SETTITLE)
355 SET_EXPECT(Exec_SETTITLE);
356
357 while(!*b && GetMessageA(&msg, doc_hwnd, 0, 0)) {
358 TranslateMessage(&msg);
359 DispatchMessageA(&msg);
360 }
361
362 if(flags & EXPECT_UPDATEUI) {
363 CHECK_CALLED(UpdateUI);
364 CHECK_CALLED(Exec_UPDATECOMMANDS);
365 }
366 if(flags & EXPECT_SETTITLE)
367 CHECK_CALLED(Exec_SETTITLE);
368 }
369
370 static IMoniker Moniker;
371
372 #define test_GetCurMoniker(u,m,v,t) _test_GetCurMoniker(__LINE__,u,m,v,t)
373 static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, const char *exurl, BOOL is_todo)
374 {
375 IHTMLDocument2 *doc;
376 IPersistMoniker *permon;
377 IMoniker *mon = (void*)0xdeadbeef;
378 BSTR doc_url = (void*)0xdeadbeef;
379 const WCHAR *ptr;
380 HRESULT hres;
381
382 if(open_call)
383 return; /* FIXME */
384
385 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
386 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
387 if(FAILED(hres))
388 return;
389
390 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
391 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
392
393 hres = IHTMLDocument2_get_URL(doc, &doc_url);
394 ok(hres == S_OK, "get_URL failed: %08x\n", hres);
395 for(ptr = doc_url; *ptr && *ptr != '#'; ptr++);
396
397 hres = IPersistMoniker_GetCurMoniker(permon, &mon);
398 IPersistMoniker_Release(permon);
399
400 if(exmon) {
401 LPOLESTR url;
402 BOOL exb = expect_GetDisplayName;
403 BOOL clb = called_GetDisplayName;
404
405 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
406 ok_(__FILE__,line)(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon);
407
408 if(mon == &Moniker)
409 SET_EXPECT(GetDisplayName);
410 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
411 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
412 if(mon == &Moniker)
413 CHECK_CALLED(GetDisplayName);
414 expect_GetDisplayName = exb;
415 called_GetDisplayName = clb;
416
417 if(!*ptr)
418 ok(!lstrcmpW(url, doc_url), "url %s != doc_url %s\n", wine_dbgstr_w(url), wine_dbgstr_w(doc_url));
419 else
420 ok(!strcmp_wa(url, nav_serv_url), "url = %s, expected %s\n", wine_dbgstr_w(url), nav_serv_url);
421 CoTaskMemFree(url);
422 }else if(exurl) {
423 LPOLESTR url;
424
425 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
426
427 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
428 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
429
430 if(is_todo)
431 todo_wine ok_(__FILE__,line)(!strcmp_wa(url, exurl), "unexpected url %s\n", wine_dbgstr_w(url));
432 else
433 ok_(__FILE__,line)(!strcmp_wa(url, exurl), "unexpected url %s\n", wine_dbgstr_w(url));
434 if(!*ptr)
435 ok_(__FILE__,line)(!lstrcmpW(url, doc_url), "url %s != doc_url %s\n", wine_dbgstr_w(url), wine_dbgstr_w(doc_url));
436
437 CoTaskMemFree(url);
438 }else {
439 ok_(__FILE__,line)(hres == E_UNEXPECTED,
440 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres);
441 ok_(__FILE__,line)(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon);
442 ok_(__FILE__,line)(!strcmp_wa(doc_url, "about:blank"), "doc_url is not about:blank\n");
443 }
444
445 SysFreeString(doc_url);
446 IHTMLDocument2_Release(doc);
447 if(mon && mon != (void*)0xdeadbeef)
448 IMoniker_Release(mon);
449 }
450
451 #define test_current_url(a,b) _test_current_url(__LINE__,a,b)
452 static void _test_current_url(unsigned line, IUnknown *unk, const char *exurl)
453 {
454 IHTMLDocument2 *doc;
455 BSTR url;
456 HRESULT hres;
457
458 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
459 ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
460
461 hres = IHTMLDocument2_get_URL(doc, &url);
462 ok_(__FILE__,line)(hres == S_OK, "get_URL failed: %08x\n", hres);
463 ok_(__FILE__,line)(!strcmp_wa(url, exurl), "Unexpected URL %s, expected %s\n", wine_dbgstr_w(url), exurl);
464 SysFreeString(url);
465
466 IHTMLDocument2_Release(doc);
467 }
468
469 DEFINE_GUID(IID_External_unk,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
470
471 static HRESULT WINAPI External_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
472 {
473 *ppv = NULL;
474
475 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
476 *ppv = iface;
477 return S_OK;
478 }
479
480 if(IsEqualGUID(&IID_IProxyManager, riid))
481 return E_NOINTERFACE; /* TODO */
482 if(IsEqualGUID(&IID_IDispatchEx, riid))
483 return E_NOINTERFACE; /* TODO */
484 if(IsEqualGUID(&IID_External_unk, riid))
485 return E_NOINTERFACE; /* TODO */
486
487 if(!ignore_external_qi)
488 ok(0, "unexpected riid: %s\n", wine_dbgstr_guid(riid));
489 return E_NOINTERFACE;
490 }
491
492 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
493 {
494 return 2;
495 }
496
497 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
498 {
499 return 1;
500 }
501
502 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
503 {
504 ok(0, "unexpected call\n");
505 return E_NOTIMPL;
506 }
507
508 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
509 ITypeInfo **ppTInfo)
510 {
511 ok(0, "unexpected call\n");
512 return E_NOTIMPL;
513 }
514
515 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
516 UINT cNames, LCID lcid, DISPID *rgDispId)
517 {
518 ok(0, "unexpected call\n");
519 return E_NOTIMPL;
520 }
521
522 static HRESULT WINAPI External_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
523 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
524 EXCEPINFO *pExcepInfo, UINT *puArgErr)
525 {
526 ok(0, "unexpected call\n");
527 return E_NOTIMPL;
528 }
529
530 static const IDispatchVtbl ExternalVtbl = {
531 External_QueryInterface,
532 Dispatch_AddRef,
533 Dispatch_Release,
534 Dispatch_GetTypeInfoCount,
535 Dispatch_GetTypeInfo,
536 Dispatch_GetIDsOfNames,
537 External_Invoke
538 };
539
540 static IDispatch External = { &ExternalVtbl };
541
542 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
543 {
544 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
545 *ppv = iface;
546 return S_OK;
547 }
548
549 *ppv = NULL;
550 return E_NOINTERFACE;
551 }
552
553 static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
554 {
555 return 2;
556 }
557
558 static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
559 {
560 return 1;
561 }
562
563 static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
564 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
565 DWORD grfPI, HANDLE_PTR dwReserved)
566 {
567 BINDINFO bindinfo;
568 DWORD bindf = 0;
569 HRESULT hres;
570
571 static const WCHAR wszTextCss[] = {'t','e','x','t','/','c','s','s',0};
572 static const WCHAR empty_str = {0};
573
574 CHECK_EXPECT(Start);
575
576 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
577 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
578 ok(!grfPI, "grfPI = %x\n", grfPI);
579 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
580
581 memset(&bindinfo, 0, sizeof(bindinfo));
582 bindinfo.cbSize = sizeof(bindinfo);
583 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
584 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
585 if(!testing_submit)
586 ok(bindf == (BINDF_FROMURLMON|BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
587 "bindf = %x\n", bindf);
588 else
589 ok(bindf == (BINDF_FROMURLMON|BINDF_FORMS_SUBMIT|BINDF_PRAGMA_NO_CACHE|BINDF_HYPERLINK
590 |BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_GETNEWESTVERSION|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
591 "bindf = %x\n", bindf);
592
593 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
594 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
595 /* TODO: test stgmedData */
596 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
597 if(!testing_submit) {
598 ok(bindinfo.dwBindVerb == BINDVERB_GET, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
599 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
600 ok(bindinfo.stgmedData.tymed == TYMED_NULL, "bindinfo.stgmedData.tymed=%d\n", bindinfo.stgmedData.tymed);
601 }else {
602 ok(bindinfo.dwBindVerb == BINDVERB_POST, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
603 ok(bindinfo.cbstgmedData == 8, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
604 ok(bindinfo.stgmedData.tymed == TYMED_HGLOBAL, "bindinfo.stgmedData.tymed=%d\n", bindinfo.stgmedData.tymed);
605 ok(!memcmp(U(bindinfo.stgmedData).hGlobal, "cmd=TEST", 8), "unexpected hGlobal\n");
606 }
607 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
608 ok(bindinfo.dwOptions == 0x80000 ||
609 bindinfo.dwOptions == 0x4080000, /* win2k3 */
610 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
611 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
612 /* TODO: test dwCodePage */
613 /* TODO: test securityAttributes */
614 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
615 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
616 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
617
618 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
619 BINDSTATUS_CACHEFILENAMEAVAILABLE, &empty_str);
620 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
621
622 if(report_mime) {
623 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
624 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextCss);
625 ok(hres == S_OK,
626 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
627 }
628
629 hres = IInternetProtocolSink_ReportData(pOIProtSink,
630 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
631 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
632
633 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
634 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
635
636 return S_OK;
637 }
638
639 static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
640 PROTOCOLDATA *pProtocolData)
641 {
642 ok(0, "unexpected call\n");
643 return E_NOTIMPL;
644 }
645
646 static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
647 DWORD dwOptions)
648 {
649 ok(0, "unexpected call\n");
650 return E_NOTIMPL;
651 }
652
653 static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
654 {
655 CHECK_EXPECT(Terminate);
656 return S_OK;
657 }
658
659 static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
660 {
661 ok(0, "unexpected call\n");
662 return E_NOTIMPL;
663 }
664
665 static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
666 {
667 ok(0, "unexpected call\n");
668 return E_NOTIMPL;
669 }
670
671 static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
672 ULONG cb, ULONG *pcbRead)
673 {
674 CHECK_EXPECT2(Protocol_Read);
675
676 ok(pv != NULL, "pv == NULL\n");
677 ok(cb > sizeof(css_data), "cb < sizeof(css_data)\n");
678 ok(pcbRead != NULL, "pcbRead == NULL\n");
679 ok(!*pcbRead || *pcbRead==sizeof(css_data)-1, "*pcbRead=%d\n", *pcbRead);
680
681 if(protocol_read)
682 return S_FALSE;
683
684 protocol_read += *pcbRead = sizeof(css_data)-1;
685 memcpy(pv, css_data, sizeof(css_data)-1);
686
687 return S_OK;
688 }
689
690 static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
691 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
692 {
693 ok(0, "unexpected call\n");
694 return E_NOTIMPL;
695 }
696
697 static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
698 {
699 CHECK_EXPECT(LockRequest);
700 return S_OK;
701 }
702
703 static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
704 {
705 CHECK_EXPECT(UnlockRequest);
706 return S_OK;
707 }
708
709 static const IInternetProtocolVtbl ProtocolVtbl = {
710 Protocol_QueryInterface,
711 Protocol_AddRef,
712 Protocol_Release,
713 Protocol_Start,
714 Protocol_Continue,
715 Protocol_Abort,
716 Protocol_Terminate,
717 Protocol_Suspend,
718 Protocol_Resume,
719 Protocol_Read,
720 Protocol_Seek,
721 Protocol_LockRequest,
722 Protocol_UnlockRequest
723 };
724
725 static IInternetProtocol Protocol = { &ProtocolVtbl };
726
727 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
728 {
729 if(!IsEqualGUID(&IID_IInternetProtocolInfo, riid))
730 ok(0, "unexpected call\n");
731 return E_NOINTERFACE;
732 }
733
734 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
735 {
736 return 2;
737 }
738
739 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
740 {
741 return 1;
742 }
743
744 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
745 REFIID riid, void **ppv)
746 {
747 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
748 return E_NOINTERFACE;
749
750 CHECK_EXPECT(CreateInstance);
751 ok(ppv != NULL, "ppv == NULL\n");
752
753 *ppv = &Protocol;
754 return S_OK;
755 }
756
757 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
758 {
759 ok(0, "unexpected call\n");
760 return S_OK;
761 }
762
763 static const IClassFactoryVtbl ClassFactoryVtbl = {
764 ClassFactory_QueryInterface,
765 ClassFactory_AddRef,
766 ClassFactory_Release,
767 ClassFactory_CreateInstance,
768 ClassFactory_LockServer
769 };
770
771 static IClassFactory ClassFactory = { &ClassFactoryVtbl };
772
773 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
774 {
775 ok(0, "unexpected call\n");
776 return E_NOTIMPL;
777 }
778
779 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
780 {
781 return 2;
782 }
783
784 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
785 {
786 return 1;
787 }
788
789 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
790 IHlinkBrowseContext *pihlbc)
791 {
792 ok(0, "unexpected call\n");
793 return E_NOTIMPL;
794 }
795
796 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
797 IHlinkBrowseContext **ppihlbc)
798 {
799 ok(0, "unexpected call\n");
800 return E_NOTIMPL;
801 }
802
803 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
804 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
805 {
806 HRESULT hres;
807
808 CHECK_EXPECT(Navigate);
809
810 ok(grfHLNF == 0, "grfHLNF=%d, expected 0\n", grfHLNF);
811 ok(pbc != NULL, "pbc == NULL\n");
812 ok(pibsc != NULL, "pubsc == NULL\n");
813 ok(pihlNavigate != NULL, "puhlNavigate == NULL\n");
814
815 if(pihlNavigate) {
816 LPWSTR frame_name = (LPWSTR)0xdeadbeef;
817 LPWSTR location = (LPWSTR)0xdeadbeef;
818 IHlinkSite *site;
819 IMoniker *mon = NULL;
820 DWORD site_data = 0xdeadbeef;
821
822 hres = IHlink_GetTargetFrameName(pihlNavigate, &frame_name);
823 ok(hres == S_FALSE, "GetTargetFrameName failed: %08x\n", hres);
824 ok(frame_name == NULL, "frame_name = %p\n", frame_name);
825
826 hres = IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
827 ok(hres == S_OK, "GetMonikerReference failed: %08x\n", hres);
828 ok(location == NULL, "location = %p\n", location);
829 ok(mon != NULL, "mon == NULL\n");
830
831 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &location);
832 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
833 ok(!strcmp_wa(location, nav_url), "unexpected display name %s, expected %s\n", wine_dbgstr_w(location), nav_url);
834 CoTaskMemFree(location);
835 IMoniker_Release(mon);
836
837 hres = IHlink_GetHlinkSite(pihlNavigate, &site, &site_data);
838 ok(hres == S_OK, "GetHlinkSite failed: %08x\n", hres);
839 ok(site == NULL, "site = %p\n, expected NULL\n", site);
840 ok(site_data == 0xdeadbeef, "site_data = %x\n", site_data);
841 }
842
843 return S_OK;
844 }
845
846 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
847 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
848 {
849 ok(0, "unexpected call\n");
850 return E_NOTIMPL;
851 }
852
853 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
854 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
855 {
856 ok(0, "unexpected call\n");
857 return E_NOTIMPL;
858 }
859
860 static const IHlinkFrameVtbl HlinkFrameVtbl = {
861 HlinkFrame_QueryInterface,
862 HlinkFrame_AddRef,
863 HlinkFrame_Release,
864 HlinkFrame_SetBrowseContext,
865 HlinkFrame_GetBrowseContext,
866 HlinkFrame_Navigate,
867 HlinkFrame_OnNavigate,
868 HlinkFrame_UpdateHlink
869 };
870
871 static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
872
873 static HRESULT WINAPI NewWindowManager_QueryInterface(INewWindowManager *iface, REFIID riid, void **ppv)
874 {
875 ok(0, "unexpected call\n");
876 return E_NOINTERFACE;
877 }
878
879 static ULONG WINAPI NewWindowManager_AddRef(INewWindowManager *iface)
880 {
881 return 2;
882 }
883
884 static ULONG WINAPI NewWindowManager_Release(INewWindowManager *iface)
885 {
886 return 1;
887 }
888
889 static HRESULT WINAPI NewWindowManager_EvaluateNewWindow(INewWindowManager *iface, LPCWSTR pszUrl,
890 LPCWSTR pszName, LPCWSTR pszUrlContext, LPCWSTR pszFeatures, BOOL fReplace, DWORD dwFlags,
891 DWORD dwUserActionTime)
892 {
893 CHECK_EXPECT(EvaluateNewWindow);
894
895 ok(!strcmp_wa(pszUrl, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl));
896 ok(!strcmp_wa(pszName, "test"), "pszName = %s\n", wine_dbgstr_w(pszName));
897 ok(!strcmp_wa(pszUrlContext, prev_url), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext));
898 ok(!pszFeatures, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures));
899 ok(!fReplace, "fReplace = %x\n", fReplace);
900 ok(dwFlags == (allow_new_window ? 0 : NWMF_FIRST), "dwFlags = %x\n", dwFlags);
901 ok(!dwUserActionTime, "dwUserActionime = %d\n", dwUserActionTime);
902
903 return allow_new_window ? S_OK : E_FAIL;
904 }
905
906 static const INewWindowManagerVtbl NewWindowManagerVtbl = {
907 NewWindowManager_QueryInterface,
908 NewWindowManager_AddRef,
909 NewWindowManager_Release,
910 NewWindowManager_EvaluateNewWindow
911 };
912
913 static INewWindowManager NewWindowManager = { &NewWindowManagerVtbl };
914
915 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
916 REFIID riid, void**ppv)
917 {
918 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
919 *ppv = iface;
920 return S_OK;
921 }
922
923 ok(0, "unexpected call\n");
924 return E_NOINTERFACE;
925 }
926
927 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
928 {
929 return 2;
930 }
931
932 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
933 {
934 return 1;
935 }
936
937 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
938 {
939 if(resetting_document)
940 return S_OK;
941
942 switch(dispID) {
943 case DISPID_READYSTATE:
944 CHECK_EXPECT2(OnChanged_READYSTATE);
945
946 if(!readystate_set_interactive)
947 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
948 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
949 ? OLECMDF_ENABLED : 0));
950
951 if(readystate_set_loading) {
952 readystate_set_loading = FALSE;
953 load_state = LD_LOADING;
954 }
955 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
956 test_readyState(NULL);
957 return S_OK;
958 case 1005:
959 CHECK_EXPECT2(OnChanged_1005);
960 if(!editmode)
961 test_readyState(NULL);
962 readystate_set_interactive = (load_state != LD_INTERACTIVE);
963 return S_OK;
964 case 1012:
965 CHECK_EXPECT2(OnChanged_1012);
966 return S_OK;
967 case 1014:
968 CHECK_EXPECT2(OnChanged_1014);
969 return S_OK;
970 case 1030:
971 case 3000022:
972 case 3000023:
973 case 3000024:
974 case 3000025:
975 case 3000026:
976 case 3000027:
977 case 3000028:
978 case 3000029:
979 case 3000030:
980 case 3000031:
981 /* TODO */
982 return S_OK;
983 }
984
985 ok(0, "unexpected id %d\n", dispID);
986 return E_NOTIMPL;
987 }
988
989 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
990 {
991 ok(0, "unexpected call\n");
992 return E_NOTIMPL;
993 }
994
995 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
996 PropertyNotifySink_QueryInterface,
997 PropertyNotifySink_AddRef,
998 PropertyNotifySink_Release,
999 PropertyNotifySink_OnChanged,
1000 PropertyNotifySink_OnRequestEdit
1001 };
1002
1003 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
1004
1005 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
1006 {
1007 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ISequentialStream, riid) || IsEqualGUID(&IID_IStream, riid)) {
1008 *ppv = iface;
1009 return S_OK;
1010 }
1011
1012 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
1013 *ppv = NULL;
1014 return E_NOINTERFACE;
1015 }
1016
1017 static ULONG WINAPI Stream_AddRef(IStream *iface)
1018 {
1019 return 2;
1020 }
1021
1022 static ULONG WINAPI Stream_Release(IStream *iface)
1023 {
1024 return 1;
1025 }
1026
1027 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
1028 ULONG cb, ULONG *pcbRead)
1029 {
1030 CHECK_EXPECT2(Read);
1031 ok(pv != NULL, "pv == NULL\n");
1032 ok(cb > sizeof(html_page), "cb = %d\n", cb);
1033 ok(pcbRead != NULL, "pcbRead == NULL\n");
1034 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
1035
1036 if(stream_read)
1037 return S_FALSE;
1038
1039 memcpy(pv, html_page, sizeof(html_page)-1);
1040 stream_read += *pcbRead = sizeof(html_page)-1;
1041 return S_OK;
1042 }
1043
1044 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
1045 ULONG cb, ULONG *pcbWritten)
1046 {
1047 ok(0, "unexpected call\n");
1048 return E_NOTIMPL;
1049 }
1050
1051 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
1052 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
1053 {
1054 ok(0, "unexpected call\n");
1055 return E_NOTIMPL;
1056 }
1057
1058 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
1059 {
1060 ok(0, "unexpected call\n");
1061 return E_NOTIMPL;
1062 }
1063
1064 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
1065 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
1066 {
1067 ok(0, "unexpected call\n");
1068 return E_NOTIMPL;
1069 }
1070
1071 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
1072 {
1073 ok(0, "unexpected call\n");
1074 return E_NOTIMPL;
1075 }
1076
1077 static HRESULT WINAPI Stream_Revert(IStream *iface)
1078 {
1079 ok(0, "unexpected call\n");
1080 return E_NOTIMPL;
1081 }
1082
1083 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
1084 ULARGE_INTEGER cb, DWORD dwLockType)
1085 {
1086 ok(0, "unexpected call\n");
1087 return E_NOTIMPL;
1088 }
1089
1090 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
1091 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
1092 {
1093 ok(0, "unexpected call\n");
1094 return E_NOTIMPL;
1095 }
1096
1097 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
1098 DWORD dwStatFlag)
1099 {
1100 ok(0, "unexpected call\n");
1101 return E_NOTIMPL;
1102 }
1103
1104 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
1105 {
1106 ok(0, "unexpected call\n");
1107 return E_NOTIMPL;
1108 }
1109
1110 static const IStreamVtbl StreamVtbl = {
1111 Stream_QueryInterface,
1112 Stream_AddRef,
1113 Stream_Release,
1114 Stream_Read,
1115 Stream_Write,
1116 Stream_Seek,
1117 Stream_SetSize,
1118 Stream_CopyTo,
1119 Stream_Commit,
1120 Stream_Revert,
1121 Stream_LockRegion,
1122 Stream_UnlockRegion,
1123 Stream_Stat,
1124 Stream_Clone
1125 };
1126
1127 static IStream Stream = { &StreamVtbl };
1128
1129 static HRESULT WINAPI WinInetHttpInfo_QueryInterface(
1130 IWinInetHttpInfo* This,
1131 REFIID riid,
1132 void **ppvObject)
1133 {
1134 *ppvObject = NULL;
1135
1136 if(IsEqualGUID(&IID_IGetBindHandle, riid))
1137 return E_NOINTERFACE;
1138
1139 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
1140 return E_NOINTERFACE;
1141 }
1142
1143 static ULONG WINAPI WinInetHttpInfo_AddRef(
1144 IWinInetHttpInfo* This)
1145 {
1146 return 2;
1147 }
1148
1149 static ULONG WINAPI WinInetHttpInfo_Release(
1150 IWinInetHttpInfo* This)
1151 {
1152 return 1;
1153 }
1154
1155 static HRESULT WINAPI WinInetHttpInfo_QueryOption(
1156 IWinInetHttpInfo* This,
1157 DWORD dwOption,
1158 LPVOID pBuffer,
1159 DWORD *pcbBuf)
1160 {
1161 return E_NOTIMPL; /* TODO */
1162 }
1163
1164 static HRESULT WINAPI WinInetHttpInfo_QueryInfo(
1165 IWinInetHttpInfo* This,
1166 DWORD dwOption,
1167 LPVOID pBuffer,
1168 DWORD *pcbBuf,
1169 DWORD *pdwFlags,
1170 DWORD *pdwReserved)
1171 {
1172 ok(pdwReserved == NULL, "pdwReserved != NULL\n");
1173
1174 if(dwOption == (HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER)) {
1175 ok(pBuffer != NULL, "pBuffer == NULL\n");
1176 ok(*pcbBuf == sizeof(DWORD), "*pcbBuf = %d\n", *pcbBuf);
1177 ok(pdwFlags == NULL, "*pdwFlags != NULL\n");
1178 *((DWORD*)pBuffer) = status_code;
1179 return S_OK;
1180 }
1181
1182 return E_NOTIMPL; /* TODO */
1183 }
1184
1185 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = {
1186 WinInetHttpInfo_QueryInterface,
1187 WinInetHttpInfo_AddRef,
1188 WinInetHttpInfo_Release,
1189 WinInetHttpInfo_QueryOption,
1190 WinInetHttpInfo_QueryInfo
1191 };
1192
1193 static IWinInetHttpInfo WinInetHttpInfo = { &WinInetHttpInfoVtbl };
1194
1195 DEFINE_GUID(IID_unk_binding, 0xf3d8f080,0xa5eb,0x476f,0x9d,0x19,0xa5,0xef,0x24,0xe5,0xc2,0xe6);
1196
1197 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
1198 {
1199 if(IsEqualGUID(&IID_IUnknown, riid)) {
1200 *ppv = iface;
1201 return S_OK;
1202 }
1203
1204 if(IsEqualGUID(&IID_IWinInetInfo, riid) || IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
1205 *ppv = &WinInetHttpInfo;
1206 return S_OK;
1207 }
1208
1209 if(IsEqualGUID(&IID_unk_binding, riid)) {
1210 *ppv = NULL;
1211 return E_NOINTERFACE;
1212 }
1213
1214 trace("Binding::QI(%s)\n", wine_dbgstr_guid(riid));
1215 *ppv = NULL;
1216 return E_NOINTERFACE;
1217 }
1218
1219 static ULONG WINAPI Binding_AddRef(IBinding *iface)
1220 {
1221 return 2;
1222 }
1223
1224 static ULONG WINAPI Binding_Release(IBinding *iface)
1225 {
1226 return 1;
1227 }
1228
1229 static HRESULT WINAPI Binding_Abort(IBinding *iface)
1230 {
1231 CHECK_EXPECT(Abort);
1232 if(asynchronous_binding)
1233 PeekMessageA(NULL, container_hwnd, WM_CONTINUE_BINDING, WM_CONTINUE_BINDING, PM_REMOVE);
1234 return S_OK;
1235 }
1236
1237 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
1238 {
1239 ok(0, "unexpected call\n");
1240 return E_NOTIMPL;
1241 }
1242
1243 static HRESULT WINAPI Binding_Resume(IBinding *iface)
1244 {
1245 ok(0, "unexpected call\n");
1246 return E_NOTIMPL;
1247 }
1248
1249 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
1250 {
1251 ok(0, "unexpected call\n");
1252 return E_NOTIMPL;
1253 }
1254
1255 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
1256 {
1257 ok(0, "unexpected call\n");
1258 return E_NOTIMPL;
1259 }
1260
1261 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
1262 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
1263 {
1264 CHECK_EXPECT(GetBindResult);
1265 return E_NOTIMPL;
1266 }
1267
1268 static const IBindingVtbl BindingVtbl = {
1269 Binding_QueryInterface,
1270 Binding_AddRef,
1271 Binding_Release,
1272 Binding_Abort,
1273 Binding_Suspend,
1274 Binding_Resume,
1275 Binding_SetPriority,
1276 Binding_GetPriority,
1277 Binding_GetBindResult
1278 };
1279
1280 static IBinding Binding = { &BindingVtbl };
1281
1282 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1283 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1284
1285 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
1286 {
1287 *ppv = NULL;
1288
1289 if(IsEqualGUID(&IID_IMoniker_unk, riid))
1290 return E_NOINTERFACE; /* TODO */
1291 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
1292 return E_NOINTERFACE; /* TODO */
1293
1294 ok(0, "unexpected riid: %s\n", wine_dbgstr_guid(riid));
1295 return E_NOINTERFACE;
1296 }
1297
1298 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1299 {
1300 return 2;
1301 }
1302
1303 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1304 {
1305 return 1;
1306 }
1307
1308 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1309 {
1310 CHECK_EXPECT(GetClassID);
1311 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", wine_dbgstr_guid(pClassID));
1312 return E_FAIL;
1313 }
1314
1315 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1316 {
1317 ok(0, "unexpected call\n");
1318 return E_NOTIMPL;
1319 }
1320
1321 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1322 {
1323 ok(0, "unexpected call\n");
1324 return E_NOTIMPL;
1325 }
1326
1327 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1328 {
1329 ok(0, "unexpected call\n");
1330 return E_NOTIMPL;
1331 }
1332
1333 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1334 {
1335 ok(0, "unexpected call\n");
1336 return E_NOTIMPL;
1337 }
1338
1339 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1340 REFIID riidResult, void **ppvResult)
1341 {
1342 ok(0, "unexpected call\n");
1343 return E_NOTIMPL;
1344 }
1345
1346 static void test_binding_ui(IUnknown *unk)
1347 {
1348 IWindowForBindingUI *binding_ui;
1349 IServiceProvider *serv_prov;
1350 HWND binding_hwnd;
1351 HRESULT hres;
1352
1353 hres = IUnknown_QueryInterface(unk, &IID_IServiceProvider, (void**)&serv_prov);
1354 ok(hres == S_OK, "Could not get IServiceProvider: %08x\n", hres);
1355
1356 hres = IServiceProvider_QueryService(serv_prov, &IID_IWindowForBindingUI, &IID_IWindowForBindingUI,
1357 (void**)&binding_ui);
1358 ok(hres == S_OK, "Could not get IWindowForBindingUI: %08x\n", hres);
1359
1360 hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IHttpSecurity, &binding_hwnd);
1361 ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
1362 if(doc_hwnd)
1363 ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
1364 else
1365 todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
1366
1367 hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IAuthenticate, &binding_hwnd);
1368 ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
1369 if(doc_hwnd)
1370 ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
1371 else
1372 todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
1373
1374 hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IWindowForBindingUI, &binding_hwnd);
1375 ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
1376 if(doc_hwnd)
1377 ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
1378 else
1379 todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
1380
1381 IWindowForBindingUI_Release(binding_ui);
1382 IServiceProvider_Release(serv_prov);
1383 }
1384
1385 static void continue_binding(IBindStatusCallback *callback)
1386 {
1387 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1388 STGMEDIUM stgmedium;
1389 HRESULT hres;
1390
1391 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1392
1393 test_binding_ui((IUnknown*)callback);
1394
1395 if(report_mime) {
1396 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1397 wszTextHtml);
1398 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1399 }
1400
1401 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1402 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1403 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1404 if(status_code != HTTP_STATUS_OK) {
1405 CHECK_CALLED_BROKEN(IsErrorUrl);
1406 SET_EXPECT(IsErrorUrl);
1407 }
1408
1409 SET_EXPECT(Read);
1410 stgmedium.tymed = TYMED_ISTREAM;
1411 U(stgmedium).pstm = &Stream;
1412 stgmedium.pUnkForRelease = (IUnknown*)&Moniker;
1413 hres = IBindStatusCallback_OnDataAvailable(callback,
1414 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1415 sizeof(html_page)-1, &formatetc, &stgmedium);
1416 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1417 CHECK_CALLED(Read);
1418
1419 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1420 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1421 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1422
1423 SET_EXPECT(GetBindResult);
1424 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1425 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1426 CLEAR_CALLED(GetBindResult); /* IE7 */
1427
1428 IBindStatusCallback_Release(callback);
1429 }
1430
1431 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1432 REFIID riid, void **ppv)
1433 {
1434 IBindStatusCallback *callback = NULL;
1435 BINDINFO bindinfo;
1436 DWORD bindf;
1437 HRESULT hres;
1438
1439 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1440
1441 CHECK_EXPECT(BindToStorage);
1442
1443 load_state = LD_LOADING;
1444
1445 ok(pbc != NULL, "pbc == NULL\n");
1446 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1447 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1448 ok(ppv != NULL, "ppv == NULL\n");
1449 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1450
1451 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1452 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1453 ok(callback != NULL, "callback == NULL\n");
1454
1455 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1456 bindinfo.cbSize = sizeof(bindinfo);
1457
1458 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1459 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1460 ok((bindf & ~BINDF_HYPERLINK /* IE9 */) == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1461 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1462 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1463 /* TODO: test stgmedData */
1464 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1465 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1466 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1467 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1468 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1469 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1470 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1471 /* TODO: test dwCodePage */
1472 /* TODO: test securityAttributes */
1473 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1474 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1475 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1476
1477 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1478 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1479
1480 if(asynchronous_binding) {
1481 PostMessageW(container_hwnd, WM_CONTINUE_BINDING, (WPARAM)callback, 0);
1482 return MK_S_ASYNCHRONOUS;
1483 }
1484
1485 continue_binding(callback);
1486 return S_OK;
1487 }
1488
1489 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1490 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1491 {
1492 ok(0, "unexpected call\n");
1493 return E_NOTIMPL;
1494 }
1495
1496 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1497 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1498 {
1499 ok(0, "unexpected call\n");
1500 return E_NOTIMPL;
1501 }
1502
1503 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1504 {
1505 ok(0, "unexpected call\n");
1506 return E_NOTIMPL;
1507 }
1508
1509 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1510 {
1511 ok(0, "unexpected call\n");
1512 return E_NOTIMPL;
1513 }
1514
1515 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1516 {
1517 ok(0, "unexpected call\n");
1518 return E_NOTIMPL;
1519 }
1520
1521 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1522 IMoniker *pmkNewlyRunning)
1523 {
1524 ok(0, "unexpected call\n");
1525 return E_NOTIMPL;
1526 }
1527
1528 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1529 IMoniker *pmkToLeft, FILETIME *pFileTime)
1530 {
1531 ok(0, "unexpected call\n");
1532 return E_NOTIMPL;
1533 }
1534
1535 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1536 {
1537 ok(0, "unexpected call\n");
1538 return E_NOTIMPL;
1539 }
1540
1541 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1542 IMoniker **ppmkPrefix)
1543 {
1544 ok(0, "unexpected call\n");
1545 return E_NOTIMPL;
1546 }
1547
1548 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1549 IMoniker **pmkRelPath)
1550 {
1551 ok(0, "unexpected call\n");
1552 return E_NOTIMPL;
1553 }
1554
1555 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1556 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1557 {
1558 CHECK_EXPECT2(GetDisplayName);
1559
1560 /* ok(pbc != NULL, "pbc == NULL\n"); */
1561 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1562 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1563
1564 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1565 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1566
1567 return S_OK;
1568 }
1569
1570 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1571 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1572 {
1573 ok(0, "unexpected call\n");
1574 return E_NOTIMPL;
1575 }
1576
1577 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1578 {
1579 CHECK_EXPECT(IsSystemMoniker);
1580 return E_NOTIMPL;
1581 }
1582
1583 static const IMonikerVtbl MonikerVtbl = {
1584 Moniker_QueryInterface,
1585 Moniker_AddRef,
1586 Moniker_Release,
1587 Moniker_GetClassID,
1588 Moniker_IsDirty,
1589 Moniker_Load,
1590 Moniker_Save,
1591 Moniker_GetSizeMax,
1592 Moniker_BindToObject,
1593 Moniker_BindToStorage,
1594 Moniker_Reduce,
1595 Moniker_ComposeWith,
1596 Moniker_Enum,
1597 Moniker_IsEqual,
1598 Moniker_Hash,
1599 Moniker_IsRunning,
1600 Moniker_GetTimeOfLastChange,
1601 Moniker_Inverse,
1602 Moniker_CommonPrefixWith,
1603 Moniker_RelativePathTo,
1604 Moniker_GetDisplayName,
1605 Moniker_ParseDisplayName,
1606 Moniker_IsSystemMoniker
1607 };
1608
1609 static IMoniker Moniker = { &MonikerVtbl };
1610
1611 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1612 {
1613 return QueryInterface(riid, ppv);
1614 }
1615
1616 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1617 {
1618 return 2;
1619 }
1620
1621 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1622 {
1623 return 1;
1624 }
1625
1626 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1627 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1628 {
1629 ok(0, "unexpected call\n");
1630 return E_NOTIMPL;
1631 }
1632
1633 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1634 IEnumUnknown **ppenum)
1635 {
1636 ok(0, "unexpected call\n");
1637 return E_NOTIMPL;
1638 }
1639
1640 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1641 {
1642 CHECK_EXPECT(LockContainer);
1643 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1644 return S_OK;
1645 }
1646
1647 static const IOleContainerVtbl OleContainerVtbl = {
1648 OleContainer_QueryInterface,
1649 OleContainer_AddRef,
1650 OleContainer_Release,
1651 OleContainer_ParseDisplayName,
1652 OleContainer_EnumObjects,
1653 OleContainer_LockContainer
1654 };
1655
1656 static IOleContainer OleContainer = { &OleContainerVtbl };
1657
1658 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1659 {
1660 return QueryInterface(riid, ppv);
1661 }
1662
1663 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1664 {
1665 return 2;
1666 }
1667
1668 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1669 {
1670 return 1;
1671 }
1672
1673 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1674 {
1675 ok(0, "unexpected call\n");
1676 return E_NOTIMPL;
1677 }
1678
1679 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1680 IMoniker **ppmon)
1681 {
1682 ok(0, "unexpected call\n");
1683 return E_NOTIMPL;
1684 }
1685
1686 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1687 {
1688 CHECK_EXPECT(GetContainer);
1689 ok(ppContainer != NULL, "ppContainer = NULL\n");
1690 *ppContainer = &OleContainer;
1691 return S_OK;
1692 }
1693
1694 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1695 {
1696 ok(0, "unexpected call\n");
1697 return E_NOTIMPL;
1698 }
1699
1700 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1701 {
1702 ok(0, "unexpected call\n");
1703 return E_NOTIMPL;
1704 }
1705
1706 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1707 {
1708 ok(0, "unexpected call\n");
1709 return E_NOTIMPL;
1710 }
1711
1712 static const IOleClientSiteVtbl ClientSiteVtbl = {
1713 ClientSite_QueryInterface,
1714 ClientSite_AddRef,
1715 ClientSite_Release,
1716 ClientSite_SaveObject,
1717 ClientSite_GetMoniker,
1718 ClientSite_GetContainer,
1719 ClientSite_ShowObject,
1720 ClientSite_OnShowWindow,
1721 ClientSite_RequestNewObjectLayout
1722 };
1723
1724 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1725
1726 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1727 {
1728 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1729
1730 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1731 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
1732
1733 *ppv = NULL;
1734 return E_NOINTERFACE;
1735 }
1736
1737 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1738 {
1739 return 2;
1740 }
1741
1742 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1743 {
1744 return 1;
1745 }
1746
1747 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1748 {
1749 CHECK_EXPECT(Frame_GetWindow);
1750 return E_NOTIMPL;
1751 }
1752
1753 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1754 {
1755 ok(0, "unexpected call\n");
1756 return E_NOTIMPL;
1757 }
1758
1759 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1760 {
1761 ok(0, "unexpected call\n");
1762 return E_NOTIMPL;
1763 }
1764
1765 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1766 LPCBORDERWIDTHS pborderwidths)
1767 {
1768 ok(0, "unexpected call\n");
1769 return E_NOTIMPL;
1770 }
1771
1772 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1773 LPCBORDERWIDTHS pborderwidths)
1774 {
1775 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1776 return S_OK;
1777 }
1778
1779 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1780 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1781 {
1782 static const WCHAR wszHTML_Document[] =
1783 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1784
1785 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1786
1787 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1788 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1789 if(pActiveObject && is_lang_english())
1790 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1791 }
1792 else {
1793 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1794 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1795 }
1796 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1797 return S_OK;
1798 }
1799
1800 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1801 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1802 {
1803 static const WCHAR wszHTML_Document[] =
1804 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1805
1806 if(pActiveObject) {
1807 CHECK_EXPECT2(SetActiveObject);
1808
1809 if(pActiveObject && is_lang_english())
1810 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1811 }else {
1812 CHECK_EXPECT(SetActiveObject_null);
1813
1814 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1815 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1816 }
1817
1818 return S_OK;
1819 }
1820
1821 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1822 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1823 {
1824 ok(0, "unexpected call\n");
1825 return E_NOTIMPL;
1826 }
1827
1828 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1829 HOLEMENU holemenu, HWND hwndActiveObject)
1830 {
1831 ok(0, "unexpected call\n");
1832 return E_NOTIMPL;
1833 }
1834
1835 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1836 {
1837 ok(0, "unexpected call\n");
1838 return E_NOTIMPL;
1839 }
1840
1841 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1842 {
1843 if(!resetting_document)
1844 CHECK_EXPECT2(SetStatusText);
1845 if(!expect_status_text)
1846 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1847 return S_OK;
1848 }
1849
1850 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1851 {
1852 if(fEnable)
1853 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1854 else
1855 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1856 return E_NOTIMPL;
1857 }
1858
1859 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1860 {
1861 ok(0, "unexpected call\n");
1862 return E_NOTIMPL;
1863 }
1864
1865 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1866 InPlaceFrame_QueryInterface,
1867 InPlaceFrame_AddRef,
1868 InPlaceFrame_Release,
1869 InPlaceFrame_GetWindow,
1870 InPlaceFrame_ContextSensitiveHelp,
1871 InPlaceFrame_GetBorder,
1872 InPlaceFrame_RequestBorderSpace,
1873 InPlaceFrame_SetBorderSpace,
1874 InPlaceFrame_SetActiveObject,
1875 InPlaceFrame_InsertMenus,
1876 InPlaceFrame_SetMenu,
1877 InPlaceFrame_RemoveMenus,
1878 InPlaceFrame_SetStatusText,
1879 InPlaceFrame_EnableModeless,
1880 InPlaceFrame_TranslateAccelerator
1881 };
1882
1883 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1884
1885 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1886 InPlaceFrame_QueryInterface,
1887 InPlaceFrame_AddRef,
1888 InPlaceFrame_Release,
1889 InPlaceFrame_GetWindow,
1890 InPlaceFrame_ContextSensitiveHelp,
1891 InPlaceFrame_GetBorder,
1892 InPlaceFrame_RequestBorderSpace,
1893 InPlaceFrame_SetBorderSpace,
1894 InPlaceUIWindow_SetActiveObject,
1895 };
1896
1897 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1898
1899 static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
1900 {
1901 return QueryInterface(riid, ppv);
1902 }
1903
1904 static ULONG WINAPI InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
1905 {
1906 return 2;
1907 }
1908
1909 static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
1910 {
1911 return 1;
1912 }
1913
1914 static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(
1915 IOleInPlaceSiteWindowless *iface, HWND *phwnd)
1916 {
1917 IOleClientSite *client_site;
1918 IOleObject *ole_obj;
1919 HRESULT hres;
1920
1921 CHECK_EXPECT2(GetWindow);
1922 ok(phwnd != NULL, "phwnd = NULL\n");
1923 *phwnd = container_hwnd;
1924
1925 hres = IUnknown_QueryInterface(doc_unk, &IID_IOleObject, (void**)&ole_obj);
1926 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
1927
1928 hres = IOleObject_GetClientSite(ole_obj, &client_site);
1929 IOleObject_Release(ole_obj);
1930 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
1931 ok(client_site == &ClientSite, "client_site != ClientSite\n");
1932 IOleClientSite_Release(client_site);
1933
1934 return S_OK;
1935 }
1936
1937 static HRESULT WINAPI InPlaceSiteWindowless_ContextSensitiveHelp(
1938 IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
1939 {
1940 ok(0, "unexpected call\n");
1941 return E_NOTIMPL;
1942 }
1943
1944 static HRESULT WINAPI InPlaceSiteWindowless_CanInPlaceActivate(
1945 IOleInPlaceSiteWindowless *iface)
1946 {
1947 CHECK_EXPECT(CanInPlaceActivate);
1948 return S_OK;
1949 }
1950
1951 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivate(
1952 IOleInPlaceSiteWindowless *iface)
1953 {
1954 CHECK_EXPECT(OnInPlaceActivate);
1955 inplace_deactivated = FALSE;
1956 return S_OK;
1957 }
1958
1959 static HRESULT WINAPI InPlaceSiteWindowless_OnUIActivate(
1960 IOleInPlaceSiteWindowless *iface)
1961 {
1962 CHECK_EXPECT(OnUIActivate);
1963 return S_OK;
1964 }
1965
1966 static HRESULT WINAPI InPlaceSiteWindowless_GetWindowContext(
1967 IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **ppFrame,
1968 IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1969 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1970 {
1971 static const RECT rect = {0,0,500,500};
1972
1973 CHECK_EXPECT(GetWindowContext);
1974
1975 ok(ppFrame != NULL, "ppFrame = NULL\n");
1976 if(ppFrame)
1977 *ppFrame = &InPlaceFrame;
1978 ok(ppDoc != NULL, "ppDoc = NULL\n");
1979 if(ppDoc)
1980 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1981 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1982 if(lprcPosRect)
1983 memcpy(lprcPosRect, &rect, sizeof(RECT));
1984 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1985 if(lprcClipRect)
1986 memcpy(lprcClipRect, &rect, sizeof(RECT));
1987 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
1988 if(lpFrameInfo) {
1989 ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
1990 lpFrameInfo->fMDIApp = FALSE;
1991 lpFrameInfo->hwndFrame = container_hwnd;
1992 lpFrameInfo->haccel = NULL;
1993 lpFrameInfo->cAccelEntries = 0;
1994 }
1995
1996 return S_OK;
1997 }
1998
1999 static HRESULT WINAPI InPlaceSiteWindowless_Scroll(
2000 IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
2001 {
2002 ok(0, "unexpected call\n");
2003 return E_NOTIMPL;
2004 }
2005
2006 static HRESULT WINAPI InPlaceSiteWindowless_OnUIDeactivate(
2007 IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
2008 {
2009 CHECK_EXPECT(OnUIDeactivate);
2010 ok(!fUndoable, "fUndoable = TRUE\n");
2011 return S_OK;
2012 }
2013
2014 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivate(
2015 IOleInPlaceSiteWindowless *iface)
2016 {
2017 CHECK_EXPECT(OnInPlaceDeactivate);
2018 inplace_deactivated = TRUE;
2019 return S_OK;
2020 }
2021
2022 static HRESULT WINAPI InPlaceSiteWindowless_DiscardUndoState(
2023 IOleInPlaceSiteWindowless *iface)
2024 {
2025 ok(0, "unexpected call\n");
2026 return E_NOTIMPL;
2027 }
2028
2029 static HRESULT WINAPI InPlaceSiteWindowless_DeactivateAndUndo(
2030 IOleInPlaceSiteWindowless *iface)
2031 {
2032 ok(0, "unexpected call\n");
2033 return E_NOTIMPL;
2034 }
2035
2036 static HRESULT WINAPI InPlaceSiteWindowless_OnPosRectChange(
2037 IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
2038 {
2039 ok(0, "unexpected call\n");
2040 return E_NOTIMPL;
2041 }
2042
2043 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivateEx(
2044 IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
2045 {
2046 CHECK_EXPECT(OnInPlaceActivateEx);
2047
2048 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
2049 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
2050 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
2051
2052 return S_OK;
2053 }
2054
2055 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivateEx(
2056 IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
2057 {
2058 CHECK_EXPECT(OnInPlaceDeactivateEx);
2059
2060 ok(fNoRedraw, "fNoRedraw == FALSE\n");
2061
2062 return S_OK;
2063 }
2064
2065 static HRESULT WINAPI InPlaceSiteWindowless_RequestUIActivate(
2066 IOleInPlaceSiteWindowless *iface)
2067 {
2068 CHECK_EXPECT2(RequestUIActivate);
2069 return S_OK;
2070 }
2071
2072 static HRESULT WINAPI InPlaceSiteWindowless_CanWindowlessActivate(
2073 IOleInPlaceSiteWindowless *iface)
2074 {
2075 ok(0, "unexpected call\n");
2076 return E_NOTIMPL;
2077 }
2078
2079 static HRESULT WINAPI InPlaceSiteWindowless_GetCapture(
2080 IOleInPlaceSiteWindowless *iface)
2081 {
2082 ok(0, "unexpected call\n");
2083 return E_NOTIMPL;
2084 }
2085
2086 static HRESULT WINAPI InPlaceSiteWindowless_SetCapture(
2087 IOleInPlaceSiteWindowless *iface, BOOL fCapture)
2088 {
2089 ok(0, "unexpected call\n");
2090 return E_NOTIMPL;
2091 }
2092
2093 static HRESULT WINAPI InPlaceSiteWindowless_GetFocus(
2094 IOleInPlaceSiteWindowless *iface)
2095 {
2096 ok(0, "unexpected call\n");
2097 return E_NOTIMPL;
2098 }
2099
2100 static HRESULT WINAPI InPlaceSiteWindowless_SetFocus(
2101 IOleInPlaceSiteWindowless *iface, BOOL fFocus)
2102 {
2103 ok(0, "unexpected call\n");
2104 return E_NOTIMPL;
2105 }
2106
2107 static HRESULT WINAPI InPlaceSiteWindowless_GetDC(
2108 IOleInPlaceSiteWindowless *iface, LPCRECT pRect,
2109 DWORD grfFlags, HDC *phDC)
2110 {
2111 ok(0, "unexpected call\n");
2112 return E_NOTIMPL;
2113 }
2114
2115 static HRESULT WINAPI InPlaceSiteWindowless_ReleaseDC(
2116 IOleInPlaceSiteWindowless *iface, HDC hDC)
2117 {
2118 ok(0, "unexpected call\n");
2119 return E_NOTIMPL;
2120 }
2121
2122 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRect(
2123 IOleInPlaceSiteWindowless *iface, LPCRECT pRect, BOOL fErase)
2124 {
2125 ok(0, "unexpected call\n");
2126 return E_NOTIMPL;
2127 }
2128
2129 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRgn(
2130 IOleInPlaceSiteWindowless *iface, HRGN hRGN, BOOL fErase)
2131 {
2132 ok(0, "unexpected call\n");
2133 return E_NOTIMPL;
2134 }
2135
2136 static HRESULT WINAPI InPlaceSiteWindowless_ScrollRect(
2137 IOleInPlaceSiteWindowless *iface, INT dx, INT dy,
2138 LPCRECT pRectScroll, LPCRECT pRectClip)
2139 {
2140 ok(0, "unexpected call\n");
2141 return E_NOTIMPL;
2142 }
2143
2144 static HRESULT WINAPI InPlaceSiteWindowless_AdjustRect(
2145 IOleInPlaceSiteWindowless *iface, LPRECT prc)
2146 {
2147 ok(0, "unexpected call\n");
2148 return E_NOTIMPL;
2149 }
2150
2151 static HRESULT WINAPI InPlaceSiteWindowless_OnDefWindowMessage(
2152 IOleInPlaceSiteWindowless *iface, UINT msg,
2153 WPARAM wParam, LPARAM lParam, LRESULT *plResult)
2154 {
2155 ok(0, "unexpected call\n");
2156 return E_NOTIMPL;
2157 }
2158
2159 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl = {
2160 InPlaceSiteWindowless_QueryInterface,
2161 InPlaceSiteWindowless_AddRef,
2162 InPlaceSiteWindowless_Release,
2163 InPlaceSiteWindowless_GetWindow,
2164 InPlaceSiteWindowless_ContextSensitiveHelp,
2165 InPlaceSiteWindowless_CanInPlaceActivate,
2166 InPlaceSiteWindowless_OnInPlaceActivate,
2167 InPlaceSiteWindowless_OnUIActivate,
2168 InPlaceSiteWindowless_GetWindowContext,
2169 InPlaceSiteWindowless_Scroll,
2170 InPlaceSiteWindowless_OnUIDeactivate,
2171 InPlaceSiteWindowless_OnInPlaceDeactivate,
2172 InPlaceSiteWindowless_DiscardUndoState,
2173 InPlaceSiteWindowless_DeactivateAndUndo,
2174 InPlaceSiteWindowless_OnPosRectChange,
2175 InPlaceSiteWindowless_OnInPlaceActivateEx,
2176 InPlaceSiteWindowless_OnInPlaceDeactivateEx,
2177 InPlaceSiteWindowless_RequestUIActivate,
2178 InPlaceSiteWindowless_CanWindowlessActivate,
2179 InPlaceSiteWindowless_GetCapture,
2180 InPlaceSiteWindowless_SetCapture,
2181 InPlaceSiteWindowless_GetFocus,
2182 InPlaceSiteWindowless_SetFocus,
2183 InPlaceSiteWindowless_GetDC,
2184 InPlaceSiteWindowless_ReleaseDC,
2185 InPlaceSiteWindowless_InvalidateRect,
2186 InPlaceSiteWindowless_InvalidateRgn,
2187 InPlaceSiteWindowless_ScrollRect,
2188 InPlaceSiteWindowless_AdjustRect,
2189 InPlaceSiteWindowless_OnDefWindowMessage
2190 };
2191
2192 static IOleInPlaceSiteWindowless InPlaceSiteWindowless = { &InPlaceSiteWindowlessVtbl };
2193
2194 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
2195 {
2196 return QueryInterface(riid, ppv);
2197 }
2198
2199 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
2200 {
2201 return 2;
2202 }
2203
2204 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
2205 {
2206 return 1;
2207 }
2208
2209 typedef enum
2210 {
2211 CallUIActivate_None,
2212 CallUIActivate_ActivateMe,
2213 CallUIActivate_AfterShow,
2214 } CallUIActivate;
2215
2216 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
2217 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
2218 {
2219 IOleDocument *document;
2220 HRESULT hres;
2221
2222 CHECK_EXPECT(ActivateMe);
2223 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
2224
2225 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
2226 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
2227
2228 if(SUCCEEDED(hres)) {
2229 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteWindowless, NULL, 0, &view);
2230 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
2231
2232 if(SUCCEEDED(hres)) {
2233 IOleInPlaceActiveObject *activeobj = NULL;
2234 IOleInPlaceSite *inplacesite = NULL;
2235 HWND tmp_hwnd = NULL;
2236 static RECT rect = {0,0,400,500};
2237
2238 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2239 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2240 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2241 inplacesite, &InPlaceSiteWindowless);
2242
2243 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteWindowless);
2244 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
2245
2246 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2247 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2248 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2249 inplacesite, &InPlaceSiteWindowless);
2250
2251 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
2252 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
2253
2254 if(activeobj) {
2255 HWND hwnd = (void*)0xdeadbeef;
2256 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2257 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
2258 ok(hwnd == NULL, "hwnd=%p, expected NULL\n", hwnd);
2259 }
2260
2261 if(call_UIActivate == CallUIActivate_ActivateMe) {
2262 SET_EXPECT(CanInPlaceActivate);
2263 SET_EXPECT(GetWindowContext);
2264 SET_EXPECT(GetWindow);
2265 if(ipsex)
2266 SET_EXPECT(OnInPlaceActivateEx);
2267 else
2268 SET_EXPECT(OnInPlaceActivate);
2269 SET_EXPECT(SetStatusText);
2270 SET_EXPECT(Exec_SETPROGRESSMAX);
2271 SET_EXPECT(Exec_SETPROGRESSPOS);
2272 SET_EXPECT(OnUIActivate);
2273 SET_EXPECT(SetActiveObject);
2274 SET_EXPECT(ShowUI);
2275 expect_status_text = NULL;
2276
2277 hres = IOleDocumentView_UIActivate(view, TRUE);
2278 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2279
2280 CHECK_CALLED(CanInPlaceActivate);
2281 CHECK_CALLED(GetWindowContext);
2282 CHECK_CALLED(GetWindow);
2283 if(ipsex)
2284 CHECK_CALLED(OnInPlaceActivateEx);
2285 else
2286 CHECK_CALLED(OnInPlaceActivate);
2287 CHECK_CALLED(SetStatusText);
2288 CHECK_CALLED(Exec_SETPROGRESSMAX);
2289 CHECK_CALLED(Exec_SETPROGRESSPOS);
2290 CHECK_CALLED(OnUIActivate);
2291 CHECK_CALLED(SetActiveObject);
2292 CHECK_CALLED(ShowUI);
2293
2294 if(activeobj) {
2295 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
2296 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2297 ok(doc_hwnd != NULL, "hwnd == NULL\n");
2298 if(last_hwnd)
2299 ok(doc_hwnd == last_hwnd, "hwnd != last_hwnd\n");
2300 }
2301
2302 hres = IOleDocumentView_UIActivate(view, TRUE);
2303 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2304
2305 if(activeobj) {
2306 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
2307 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2308 ok(tmp_hwnd == doc_hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, doc_hwnd);
2309 }
2310 }
2311
2312 hres = IOleDocumentView_SetRect(view, &rect);
2313 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
2314
2315 if(call_UIActivate == CallUIActivate_ActivateMe) {
2316 hres = IOleDocumentView_Show(view, TRUE);
2317 ok(hres == S_OK, "Show failed: %08x\n", hres);
2318 }else {
2319 SET_EXPECT(CanInPlaceActivate);
2320 SET_EXPECT(GetWindowContext);
2321 SET_EXPECT(GetWindow);
2322 if(ipsex)
2323 SET_EXPECT(OnInPlaceActivateEx);
2324 else
2325 SET_EXPECT(OnInPlaceActivate);
2326 SET_EXPECT(SetStatusText);
2327 SET_EXPECT(Exec_SETPROGRESSMAX);
2328 SET_EXPECT(Exec_SETPROGRESSPOS);
2329 SET_EXPECT(OnUIActivate);
2330 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
2331
2332 hres = IOleDocumentView_Show(view, TRUE);
2333 ok(hres == S_OK, "Show failed: %08x\n", hres);
2334
2335 CHECK_CALLED(CanInPlaceActivate);
2336 CHECK_CALLED(GetWindowContext);
2337 CHECK_CALLED(GetWindow);
2338 if(ipsex)
2339 CHECK_CALLED(OnInPlaceActivateEx);
2340 else
2341 CHECK_CALLED(OnInPlaceActivate);
2342 CHECK_CALLED(SetStatusText);
2343 CHECK_CALLED(Exec_SETPROGRESSMAX);
2344 CHECK_CALLED(Exec_SETPROGRESSPOS);
2345
2346 if(activeobj) {
2347 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
2348 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2349 ok(doc_hwnd != NULL, "doc_hwnd == NULL\n");
2350 if(last_hwnd)
2351 ok(doc_hwnd == last_hwnd, "doc_hwnd != last_hwnd\n");
2352 }
2353 }
2354
2355 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
2356
2357 if(activeobj)
2358 IOleInPlaceActiveObject_Release(activeobj);
2359 }
2360
2361 IOleDocument_Release(document);
2362 }
2363
2364 return S_OK;
2365 }
2366
2367 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
2368 DocumentSite_QueryInterface,
2369 DocumentSite_AddRef,
2370 DocumentSite_Release,
2371 DocumentSite_ActivateMe
2372 };
2373
2374 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
2375
2376 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
2377 {
2378 return QueryInterface(riid, ppv);
2379 }
2380
2381 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
2382 {
2383 return 2;
2384 }
2385
2386 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
2387 {
2388 return 1;
2389 }
2390
2391 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
2392 {
2393 ok(0, "unexpected call\n");
2394 return E_NOTIMPL;
2395 }
2396
2397 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
2398 {
2399 ok(0, "unexpected call\n");
2400 return E_NOTIMPL;
2401 }
2402
2403 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
2404 {
2405 ok(0, "unexpected call\n");
2406 return E_NOTIMPL;
2407 }
2408
2409 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
2410 POINTF *pPtfContainer, DWORD dwFlags)
2411 {
2412 ok(0, "unexpected call\n");
2413 return E_NOTIMPL;
2414 }
2415
2416 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
2417 MSG *pMsg, DWORD grfModifiers)
2418 {
2419 ok(0, "unexpected call\n");
2420 return E_NOTIMPL;
2421 }
2422
2423 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
2424 {
2425 if(fGotFocus)
2426 CHECK_EXPECT(OnFocus_TRUE);
2427 else
2428 CHECK_EXPECT2(OnFocus_FALSE);
2429 return S_OK;
2430 }
2431
2432 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
2433 {
2434 ok(0, "unexpected call\n");
2435 return E_NOTIMPL;
2436 }
2437
2438 static const IOleControlSiteVtbl OleControlSiteVtbl = {
2439 OleControlSite_QueryInterface,
2440 OleControlSite_AddRef,
2441 OleControlSite_Release,
2442 OleControlSite_OnControlInfoChanged,
2443 OleControlSite_LockInPlaceActive,
2444 OleControlSite_GetExtendedControl,
2445 OleControlSite_TransformCoords,
2446 OleControlSite_TranslateAccelerator,
2447 OleControlSite_OnFocus,
2448 OleControlSite_ShowPropertyFrame
2449 };
2450
2451 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
2452
2453 static IDocHostUIHandler2 *expect_uihandler_iface;
2454
2455 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2456 {
2457 return QueryInterface(riid, ppv);
2458 }
2459
2460 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
2461 {
2462 return 2;
2463 }
2464
2465 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
2466 {
2467 return 1;
2468 }
2469
2470 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
2471 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
2472 {
2473 ok(0, "unexpected call\n");
2474 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2475 return E_NOTIMPL;
2476 }
2477
2478 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
2479 {
2480 if(!resetting_document)
2481 CHECK_EXPECT(GetHostInfo);
2482 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2483 ok(pInfo != NULL, "pInfo=NULL\n");
2484 if(pInfo) {
2485 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2486 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2487 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2488 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2489 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2490 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2491 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2492 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2493 }
2494 return S_OK;
2495 }
2496
2497 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2498 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2499 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2500 {
2501 CHECK_EXPECT(ShowUI);
2502 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2503
2504 if (editmode)
2505 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2506 else
2507 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2508 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2509 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2510 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2511 if (expect_InPlaceUIWindow_SetActiveObject_active)
2512 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2513 else
2514 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2515
2516 return S_OK;
2517 }
2518
2519 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2520 {
2521 CHECK_EXPECT(HideUI);
2522 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2523 return S_OK;
2524 }
2525
2526 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2527 {
2528 CHECK_EXPECT(UpdateUI);
2529 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2530 return S_OK;
2531 }
2532
2533 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2534 {
2535 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2536 if(fEnable)
2537 CHECK_EXPECT2(EnableModeless_TRUE);
2538 else
2539 CHECK_EXPECT2(EnableModeless_FALSE);
2540 return E_NOTIMPL;
2541 }
2542
2543 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2544 {
2545 ok(0, "unexpected call\n");
2546 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2547 return E_NOTIMPL;
2548 }
2549
2550 static BOOL expect_OnFrameWindowActivate_fActivate;
2551 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2552 {
2553 CHECK_EXPECT2(OnFrameWindowActivate);
2554 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2555 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2556 return S_OK;
2557 }
2558
2559 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2560 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2561 {
2562 ok(0, "unexpected call\n");
2563 return E_NOTIMPL;
2564 }
2565
2566 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2567 const GUID *pguidCmdGroup, DWORD nCmdID)
2568 {
2569 ok(0, "unexpected call\n");
2570 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2571 return E_NOTIMPL;
2572 }
2573
2574 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2575 LPOLESTR *pchKey, DWORD dw)
2576 {
2577 CHECK_EXPECT(GetOptionKeyPath);
2578 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2579 ok(pchKey != NULL, "pchKey = NULL\n");
2580 ok(!dw, "dw=%d, expected 0\n", dw);
2581 if(pchKey)
2582 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2583 return S_OK;
2584 }
2585
2586 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2587 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2588 {
2589 CHECK_EXPECT(GetDropTarget);
2590 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2591 /* TODO */
2592 return E_NOTIMPL;
2593 }
2594
2595 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2596 {
2597 CHECK_EXPECT(GetExternal);
2598 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2599 *ppDispatch = &External;
2600 return S_FALSE;
2601 }
2602
2603 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2604 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2605 {
2606 CHECK_EXPECT(TranslateUrl);
2607 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2608 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2609 if(!loading_hash)
2610 ok(!strcmp_wa(pchURLIn, nav_serv_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_serv_url);
2611 else
2612 todo_wine ok(!strcmp_wa(pchURLIn, nav_serv_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_serv_url);
2613 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2614 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2615
2616 return S_FALSE;
2617 }
2618
2619 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2620 IDataObject **ppPORet)
2621 {
2622 ok(0, "unexpected call\n");
2623 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2624 return E_NOTIMPL;
2625 }
2626
2627 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2628 LPOLESTR *pchKey, DWORD dw)
2629 {
2630 CHECK_EXPECT(GetOverrideKeyPath);
2631 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2632 ok(pchKey != NULL, "pchKey = NULL\n");
2633 if(pchKey)
2634 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2635 ok(!dw, "dw=%d, xepected 0\n", dw);
2636 return S_OK;
2637 }
2638
2639 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2640 DocHostUIHandler_QueryInterface,
2641 DocHostUIHandler_AddRef,
2642 DocHostUIHandler_Release,
2643 DocHostUIHandler_ShowContextMenu,
2644 DocHostUIHandler_GetHostInfo,
2645 DocHostUIHandler_ShowUI,
2646 DocHostUIHandler_HideUI,
2647 DocHostUIHandler_UpdateUI,
2648 DocHostUIHandler_EnableModeless,
2649 DocHostUIHandler_OnDocWindowActivate,
2650 DocHostUIHandler_OnFrameWindowActivate,
2651 DocHostUIHandler_ResizeBorder,
2652 DocHostUIHandler_TranslateAccelerator,
2653 DocHostUIHandler_GetOptionKeyPath,
2654 DocHostUIHandler_GetDropTarget,
2655 DocHostUIHandler_GetExternal,
2656 DocHostUIHandler_TranslateUrl,
2657 DocHostUIHandler_FilterDataObject,
2658 DocHostUIHandler_GetOverrideKeyPath
2659 };
2660
2661 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2662
2663 static HRESULT WINAPI CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2664 {
2665 if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
2666 *ppv = iface;
2667 return S_OK;
2668 }
2669
2670 *ppv = NULL;
2671
2672 if(IsEqualGUID(&IID_IOleCommandTarget, riid))
2673 return E_NOINTERFACE;
2674
2675 if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2676 return E_NOINTERFACE; /* TODO */
2677
2678 trace("CustomDocHostUIHandler::QI(%s)\n", wine_dbgstr_guid(riid));
2679 return E_NOINTERFACE;
2680 }
2681
2682 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl = {
2683 CustomDocHostUIHandler_QueryInterface,
2684 DocHostUIHandler_AddRef,
2685 DocHostUIHandler_Release,
2686 DocHostUIHandler_ShowContextMenu,
2687 DocHostUIHandler_GetHostInfo,
2688 DocHostUIHandler_ShowUI,
2689 DocHostUIHandler_HideUI,
2690 DocHostUIHandler_UpdateUI,
2691 DocHostUIHandler_EnableModeless,
2692 DocHostUIHandler_OnDocWindowActivate,
2693 DocHostUIHandler_OnFrameWindowActivate,
2694 DocHostUIHandler_ResizeBorder,
2695 DocHostUIHandler_TranslateAccelerator,
2696 DocHostUIHandler_GetOptionKeyPath,
2697 DocHostUIHandler_GetDropTarget,
2698 DocHostUIHandler_GetExternal,
2699 DocHostUIHandler_TranslateUrl,
2700 DocHostUIHandler_FilterDataObject,
2701 DocHostUIHandler_GetOverrideKeyPath
2702 };
2703
2704 static IDocHostUIHandler2 CustomDocHostUIHandler = { &CustomDocHostUIHandlerVtbl };
2705
2706 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2707 REFIID riid, void **ppv)
2708 {
2709 return QueryInterface(riid, ppv);
2710 }
2711
2712 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2713 {
2714 return 2;
2715 }
2716
2717 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2718 {
2719 return 1;
2720 }
2721
2722 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2723 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2724 {
2725 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2726 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2727 ok(!pCmdText, "pCmdText != NULL\n");
2728
2729 switch(prgCmds[0].cmdID) {
2730 case OLECMDID_SETPROGRESSTEXT:
2731 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2732 prgCmds[0].cmdf = OLECMDF_ENABLED;
2733 return S_OK;
2734 case OLECMDID_OPEN:
2735 CHECK_EXPECT(QueryStatus_OPEN);
2736 prgCmds[0].cmdf = 0;
2737 return S_OK;
2738 case OLECMDID_NEW:
2739 CHECK_EXPECT(QueryStatus_NEW);
2740 prgCmds[0].cmdf = 0;
2741 return S_OK;
2742 default:
2743 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2744 };
2745
2746 return E_FAIL;
2747 }
2748
2749 static void test_save_history(IUnknown *unk)
2750 {
2751 IPersistHistory *per_hist;
2752 LARGE_INTEGER li;
2753 IStream *stream;
2754 HRESULT hres;
2755
2756 hres = IUnknown_QueryInterface(unk, &IID_IPersistHistory, (void**)&per_hist);
2757 ok(hres == S_OK, "Could not get IPersistHistory iface: %08x\n", hres);
2758
2759 hres = CreateStreamOnHGlobal(NULL, TRUE, &stream);
2760 ok(hres == S_OK, "CreateStreamOnHGlobal failed: %08x\n", hres);
2761
2762 hres = IPersistHistory_SaveHistory(per_hist, stream);
2763 ok(hres == S_OK, "SaveHistory failed: %08x\n", hres);
2764 IPersistHistory_Release(per_hist);
2765
2766 li.QuadPart = 0;
2767 hres = IStream_Seek(stream, li, STREAM_SEEK_SET, NULL);
2768 ok(hres == S_OK, "Stat failed: %08x\n", hres);
2769 history_stream = stream;
2770 }
2771
2772 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2773 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2774 {
2775 if(resetting_document)
2776 return E_FAIL;
2777
2778 if(!pguidCmdGroup) {
2779 test_readyState(NULL);
2780
2781 switch(nCmdID) {
2782 case OLECMDID_SETPROGRESSMAX:
2783 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2784 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2785 ok(pvaIn != NULL, "pvaIn == NULL\n");
2786 if(pvaIn) {
2787 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2788 if(load_state == LD_NO)
2789 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2790 }
2791 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2792 return S_OK;
2793 case OLECMDID_SETPROGRESSPOS:
2794 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2795 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2796 ok(pvaIn != NULL, "pvaIn == NULL\n");
2797 if(pvaIn) {
2798 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2799 if(load_state == LD_NO)
2800 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2801 }
2802 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2803 return S_OK;
2804 case OLECMDID_HTTPEQUIV_DONE:
2805 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2806 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2807 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2808 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2809 readystate_set_loading = FALSE;
2810 readystate_set_interactive = FALSE;
2811 load_state = LD_COMPLETE;
2812 return S_OK;
2813 case OLECMDID_SETDOWNLOADSTATE:
2814 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2815 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2816 ok(pvaIn != NULL, "pvaIn == NULL\n");
2817 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2818
2819 switch(V_I4(pvaIn)) {
2820 case 0:
2821 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2822 if(!loading_js)
2823 load_state = LD_INTERACTIVE;
2824 break;
2825 case 1:
2826 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2827 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2828 break;
2829 default:
2830 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2831 }
2832
2833 return S_OK;
2834 case OLECMDID_UPDATECOMMANDS:
2835 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2836 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2837 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2838 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2839 return S_OK;
2840 case OLECMDID_SETTITLE:
2841 CHECK_EXPECT2(Exec_SETTITLE);
2842 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2843 ok(pvaIn != NULL, "pvaIn == NULL\n");
2844 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2845 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2846 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2847 return S_OK;
2848 case OLECMDID_HTTPEQUIV:
2849 CHECK_EXPECT2(Exec_HTTPEQUIV);
2850 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2851 ok(pvaIn != NULL, "pvaIn == NULL\n");
2852 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2853 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2854 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2855 test_readyState(NULL);
2856 return S_OK;
2857 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY:
2858 case 6058:
2859 return E_FAIL; /* FIXME */
2860 default:
2861 ok(0, "unexpected command %d\n", nCmdID);
2862 return E_FAIL;
2863 };
2864 }
2865
2866 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2867 if(nCmdID != 63 && (!is_refresh || nCmdID != 37))
2868 test_readyState(NULL);
2869 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2870
2871 switch(nCmdID) {
2872 case 37:
2873 CHECK_EXPECT2(Exec_ShellDocView_37);
2874
2875 if(is_refresh && load_state == LD_COMPLETE) {
2876 load_state = LD_DOLOAD;
2877 test_readyState(NULL);
2878 }else if(is_refresh && load_state == LD_DOLOAD) {
2879 test_readyState(NULL);
2880 load_state = LD_LOADING;
2881 }else {
2882 if(nav_url)
2883 test_GetCurMoniker(doc_unk, NULL, nav_serv_url, FALSE);
2884 else if(load_from_stream)
2885 test_GetCurMoniker(doc_unk, NULL, "about:blank", FALSE);
2886 else if(!editmode)
2887 test_GetCurMoniker(doc_unk, doc_mon, NULL, FALSE);
2888 }
2889
2890 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2891 ok(pvaIn != NULL, "pvaIn == NULL\n");
2892 if(pvaIn) {
2893 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2894 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2895 }
2896 return S_OK;
2897
2898 case 62:
2899 CHECK_EXPECT(Exec_ShellDocView_62);
2900 ok(!pvaIn, "pvaIn != NULL\n");
2901 ok(!pvaOut, "pvaOut != NULL\n");
2902 return S_OK;
2903
2904 case 63: {
2905 IHTMLPrivateWindow *priv_window;
2906 HRESULT hres;
2907
2908 CHECK_EXPECT(Exec_ShellDocView_63);
2909 ok(pvaIn != NULL, "pvaIn == NULL\n");
2910 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2911 ok(V_UNKNOWN(pvaIn) != NULL, "VPUNKNOWN(pvaIn) = NULL\n");
2912 ok(pvaOut != NULL, "pvaOut == NULL\n");
2913 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2914
2915 hres = IUnknown_QueryInterface(V_UNKNOWN(pvaIn), &IID_IHTMLPrivateWindow, (void**)&priv_window);
2916 ok(hres == S_OK, "Could not get IHTMLPrivateWindow: %08x\n", hres);
2917 if(SUCCEEDED(hres))
2918 IHTMLPrivateWindow_Release(priv_window);
2919
2920 load_state = loading_js ? LD_COMPLETE : LD_LOADING;
2921 return S_OK; /* TODO */
2922 }
2923
2924 case 67:
2925 CHECK_EXPECT(Exec_ShellDocView_67);
2926 ok(pvaIn != NULL, "pvaIn == NULL\n");
2927 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2928 ok(!strcmp_wa(V_BSTR(pvaIn), nav_serv_url), "V_BSTR(pvaIn) = %s, expected \"%s\"\n",
2929 wine_dbgstr_w(V_BSTR(pvaIn)), nav_serv_url);
2930 ok(pvaOut != NULL, "pvaOut == NULL\n");
2931 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2932 ok(V_BOOL(pvaOut) == VARIANT_TRUE, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut));
2933 if(!loading_hash)
2934 load_state = LD_DOLOAD;
2935 return S_OK;
2936
2937 case 84:
2938 CHECK_EXPECT2(Exec_ShellDocView_84);
2939
2940 ok(pvaIn == NULL, "pvaIn != NULL\n");
2941 ok(pvaOut != NULL, "pvaOut == NULL\n");
2942 if(pvaIn)
2943 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2944
2945 return E_NOTIMPL;
2946
2947 case 103:
2948 CHECK_EXPECT2(Exec_ShellDocView_103);
2949
2950 ok(pvaIn == NULL, "pvaIn != NULL\n");
2951 ok(pvaOut == NULL, "pvaOut != NULL\n");
2952
2953 return E_NOTIMPL;
2954
2955 case 105:
2956 CHECK_EXPECT2(Exec_ShellDocView_105);
2957
2958 ok(pvaIn != NULL, "pvaIn == NULL\n");
2959 ok(pvaOut == NULL, "pvaOut != NULL\n");
2960
2961 return E_NOTIMPL;
2962
2963 case 138:
2964 CHECK_EXPECT2(Exec_ShellDocView_138);
2965 ok(!pvaIn, "pvaIn != NULL\n");
2966 ok(!pvaOut, "pvaOut != NULL\n");
2967 return S_OK;
2968
2969 case 140:
2970 CHECK_EXPECT2(Exec_ShellDocView_140);
2971
2972 ok(pvaIn == NULL, "pvaIn != NULL\n");
2973 ok(pvaOut == NULL, "pvaOut != NULL\n");
2974
2975 return E_NOTIMPL;
2976
2977 case 83:
2978 case 102:
2979 case 134: /* TODO */
2980 case 135:
2981 case 136: /* TODO */
2982 case 139: /* TODO */
2983 case 143: /* TODO */
2984 case 144: /* TODO */
2985 case 178:
2986 return E_NOTIMPL;
2987
2988 default:
2989 ok(0, "unexpected command %d\n", nCmdID);
2990 return E_FAIL;
2991 };
2992 }
2993
2994 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
2995 test_readyState(NULL);
2996 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2997
2998 switch(nCmdID) {
2999 case IDM_PARSECOMPLETE:
3000 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
3001 ok(pvaIn == NULL, "pvaIn != NULL\n");
3002 ok(pvaOut == NULL, "pvaOut != NULL\n");
3003 return S_OK;
3004 default:
3005 ok(0, "unexpected command %d\n", nCmdID);
3006 };
3007 }
3008
3009 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup)) {
3010 switch(nCmdID) {
3011 case DOCHOST_DOCCANNAVIGATE:
3012 if(pvaIn) {
3013 CHECK_EXPECT(Exec_DOCCANNAVIGATE);
3014 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) != VT_UNKNOWN\n");
3015 /* FIXME: test V_UNKNOWN(pvaIn) == window */
3016 }else {
3017 CHECK_EXPECT(Exec_DOCCANNAVIGATE_NULL);
3018 }
3019
3020 test_readyState(NULL);
3021 ok(pvaOut == NULL, "pvaOut != NULL\n");
3022 return S_OK;
3023 case 1: {
3024 SAFEARRAY *sa;
3025 UINT dim;
3026 LONG ind=0;
3027 VARIANT var;
3028 HRESULT hres;
3029
3030 test_readyState(NULL);
3031
3032 ok(pvaIn != NULL, "pvaIn == NULL\n");
3033 ok(pvaOut != NULL || broken(!pvaOut), "pvaOut != NULL\n");
3034 ok(V_VT(pvaIn) == VT_ARRAY, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
3035 if(pvaOut)
3036 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
3037 sa = V_ARRAY(pvaIn);
3038
3039 dim = SafeArrayGetDim(sa);
3040 ok(dim == 1, "dim = %d\n", dim);
3041 hres = SafeArrayGetLBound(sa, 1, &ind);
3042 ok(hres == S_OK, "SafeArrayGetLBound failed: %x\n", hres);
3043 ok(ind == 0, "Lower bound = %d\n", ind);
3044 hres = SafeArrayGetUBound(sa, 1, &ind);
3045 ok(hres == S_OK, "SafeArrayGetUBound failed: %x\n", hres);
3046 ok(ind == 7 || ind == 8 /* IE11 */ ||broken(ind == 5), "Upper bound = %d\n", ind);
3047
3048 ind = 0;
3049 SafeArrayGetElement(sa, &ind, &var);
3050 ok(V_VT(&var) == VT_I4, "Incorrect data type: %d\n", V_VT(&var));
3051 ok(V_I4(&var) == status_code, "Incorrect error code: %d\n", V_I4(&var));
3052 VariantClear(&var);
3053 ind = 1;
3054 SafeArrayGetElement(sa, &ind, &var);
3055 ok(V_VT(&var) == VT_BSTR, "Incorrect data type: %d\n", V_VT(&var));
3056 ok(!strcmp_wa(V_BSTR(&var), "winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var)));
3057 VariantClear(&var);
3058 ind = 2;
3059 SafeArrayGetElement(sa, &ind, &var);
3060 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
3061 VariantClear(&var);
3062 ind = 3;
3063 SafeArrayGetElement(sa, &ind, &var);
3064 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
3065 VariantClear(&var);
3066 ind = 4;
3067 SafeArrayGetElement(sa, &ind, &var);
3068 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
3069 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
3070 VariantClear(&var);
3071 ind = 5;
3072 SafeArrayGetElement(sa, &ind, &var);
3073 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
3074 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
3075 VariantClear(&var);
3076 }
3077 default:
3078 return E_FAIL; /* TODO */
3079 }
3080 }
3081
3082 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
3083 test_readyState(NULL);
3084 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
3085
3086 switch(nCmdID) {
3087 case 38:
3088 CHECK_EXPECT2(Exec_Explorer_38);
3089 ok(pvaIn != NULL, "pvaIn == NULL\n");
3090 ok(V_VT(pvaIn) == VT_I4 , "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
3091 ok(!V_I4(pvaIn), "V_I4(pvaIn) = %d\n", V_I4(pvaIn));
3092 ok(!pvaOut, "pvaOut != NULL\n");
3093
3094 test_current_url(doc_unk, prev_url);
3095 if(!history_stream)
3096 test_save_history(doc_unk);
3097
3098 return S_OK;
3099 case 69:
3100 CHECK_EXPECT2(Exec_Explorer_69);
3101 ok(pvaIn == NULL, "pvaIn != NULL\n");
3102 ok(pvaOut != NULL, "pvaOut == NULL\n");
3103 return E_NOTIMPL;
3104 case 109: /* TODO */
3105 return E_NOTIMPL;
3106 default:
3107 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
3108 }
3109 return E_NOTIMPL;
3110 }
3111
3112 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
3113 test_readyState(NULL);
3114
3115 switch (nCmdID) {
3116 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
3117 SET_EXPECT(SetStatusText);
3118 ok(pvaIn == NULL, "pvaIn != NULL\n");
3119 ok(pvaOut == NULL, "pvaOut != NULL\n");
3120 return S_OK;
3121 case OLECMDID_SHOWSCRIPTERROR:
3122 /* TODO */
3123 return S_OK;
3124 case 2300:
3125 CHECK_EXPECT(Exec_DocHostCommandHandler_2300);
3126 return E_NOTIMPL;
3127 default:
3128 ok(0, "unexpected command %d\n", nCmdID);
3129 return E_FAIL;
3130 }
3131 }
3132
3133 ok(0, "unexpected pguidCmdGroup: %s\n", wine_dbgstr_guid(pguidCmdGroup));
3134 return E_NOTIMPL;
3135 }
3136
3137 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
3138 OleCommandTarget_QueryInterface,
3139 OleCommandTarget_AddRef,
3140 OleCommandTarget_Release,
3141 OleCommandTarget_QueryStatus,
3142 OleCommandTarget_Exec
3143 };
3144
3145 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
3146
3147 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
3148 {
3149 return QueryInterface(riid, ppv);
3150 }
3151
3152 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
3153 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3154 EXCEPINFO *pExcepInfo, UINT *puArgErr)
3155 {
3156 if(resetting_document)
3157 return E_FAIL;
3158
3159 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
3160 ok(pDispParams != NULL, "pDispParams == NULL\n");
3161 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
3162 ok(puArgErr != NULL, "puArgErr == NULL\n");
3163 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
3164 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
3165 test_readyState(NULL);
3166
3167 switch(dispIdMember) {
3168 case DISPID_AMBIENT_USERMODE:
3169 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
3170 V_VT(pVarResult) = VT_BOOL;
3171 V_BOOL(pVarResult) = VARIANT_TRUE;
3172 return S_OK;
3173 case DISPID_AMBIENT_DLCONTROL:
3174 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
3175 return E_FAIL;
3176 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
3177 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3178 return E_FAIL;
3179 case DISPID_AMBIENT_SILENT:
3180 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
3181 V_VT(pVarResult) = VT_BOOL;
3182 V_BOOL(pVarResult) = VARIANT_FALSE;
3183 return S_OK;
3184 case DISPID_AMBIENT_USERAGENT:
3185 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
3186 return E_FAIL;
3187 case DISPID_AMBIENT_PALETTE:
3188 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
3189 return E_FAIL;
3190 };
3191
3192 ok(0, "unexpected dispid %d\n", dispIdMember);
3193 return E_FAIL;
3194 }
3195
3196 static const IDispatchVtbl DispatchVtbl = {
3197 Dispatch_QueryInterface,
3198 Dispatch_AddRef,
3199 Dispatch_Release,
3200 Dispatch_GetTypeInfoCount,
3201 Dispatch_GetTypeInfo,
3202 Dispatch_GetIDsOfNames,
3203 Dispatch_Invoke
3204 };
3205
3206 static IDispatch Dispatch = { &DispatchVtbl };
3207
3208 static HRESULT WINAPI EventDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
3209 {
3210 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
3211 *ppv = iface;
3212 return S_OK;
3213 }
3214
3215 ok(0, "Unexpected call\n");
3216 return E_NOINTERFACE;
3217 }
3218
3219 static HRESULT WINAPI EventDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
3220 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3221 EXCEPINFO *pExcepInfo, UINT *puArgErr)
3222 {
3223 HRESULT hres;
3224 IHTMLDocument2 *doc;
3225 BSTR state;
3226
3227 if(resetting_document)
3228 return E_FAIL;
3229
3230 ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
3231 ok(pDispParams != NULL, "pDispParams == NULL\n");
3232 ok(pExcepInfo != NULL, "pExcepInfo == NULL\n");
3233 ok(puArgErr != NULL, "puArgErr == NULL\n");
3234 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
3235 ok(wFlags == DISPATCH_METHOD, "wFlags = %d, expected DISPATCH_METHOD\n", wFlags);
3236
3237 hres = IUnknown_QueryInterface(doc_unk, &IID_IHTMLDocument2, (void**)&doc);
3238 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
3239
3240 switch(dispIdMember) {
3241 case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE:
3242 hres = IHTMLDocument2_get_readyState(doc, &state);
3243 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3244
3245 if(!strcmp_wa(state, "interactive"))
3246 CHECK_EXPECT(Invoke_OnReadyStateChange_Interactive);
3247 else if(!strcmp_wa(state, "loading"))
3248 CHECK_EXPECT(Invoke_OnReadyStateChange_Loading);
3249 else if(!strcmp_wa(state, "complete")) {
3250 CHECK_EXPECT(Invoke_OnReadyStateChange_Complete);
3251 complete = TRUE;
3252 } else
3253 ok(0, "Unexpected readyState: %s\n", wine_dbgstr_w(state));
3254
3255 SysFreeString(state);
3256 break;
3257 case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE:
3258 case 1026:
3259 case 1027:
3260 case 1034:
3261 case 1035:
3262 case 1037:
3263 case 1047:
3264 case 1045:
3265 case 1044:
3266 case 1048:
3267 case 1049:
3268 break; /* FIXME: Handle these events. */
3269 default:
3270 ok(0, "Unexpected DISPID: %d\n", dispIdMember);
3271 }
3272
3273 IHTMLDocument2_Release(doc);
3274 return S_OK;
3275 }
3276
3277 static const IDispatchVtbl EventDispatchVtbl = {
3278 EventDispatch_QueryInterface,
3279 Dispatch_AddRef,
3280 Dispatch_Release,
3281 Dispatch_GetTypeInfoCount,
3282 Dispatch_GetTypeInfo,
3283 Dispatch_GetIDsOfNames,
3284 EventDispatch_Invoke
3285 };
3286
3287 static IDispatch EventDispatch = { &EventDispatchVtbl };
3288
3289 static HRESULT WINAPI TravelLog_QueryInterface(ITravelLog *iface, REFIID riid, void **ppv)
3290 {
3291 static const IID IID_IIETravelLog2 = {0xb67cefd2,0xe3f1,0x478a,{0x9b,0xfa,0xd8,0x93,0x70,0x37,0x5e,0x94}};
3292 static const IID IID_unk_travellog = {0x6afc8b7f,0xbc17,0x4a95,{0x90,0x2f,0x6f,0x5c,0xb5,0x54,0xc3,0xd8}};
3293
3294 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ITravelLog, riid)) {
3295 *ppv = iface;
3296 return S_OK;
3297 }
3298
3299 if(!IsEqualGUID(&IID_IIETravelLog2, riid) && !IsEqualGUID(&IID_unk_travellog, riid))
3300 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
3301
3302 *ppv = NULL;
3303 return E_NOINTERFACE;
3304 }
3305
3306 static ULONG WINAPI TravelLog_AddRef(ITravelLog *iface)
3307 {
3308 return 2;
3309 }
3310
3311 static ULONG WINAPI TravelLog_Release(ITravelLog *iface)
3312 {
3313 return 1;
3314 }
3315
3316 static HRESULT WINAPI TravelLog_AddEntry(ITravelLog *iface, IUnknown *punk, BOOL fIsLocalAnchor)
3317 {
3318 ok(0, "unexpected call\n");
3319 return E_NOTIMPL;
3320 }
3321
3322 static HRESULT WINAPI TravelLog_UpdateEntry(ITravelLog *iface, IUnknown *punk, BOOL fIsLocalAnchor)
3323 {
3324 ok(0, "unexpected call\n");
3325 return E_NOTIMPL;
3326 }
3327
3328 static HRESULT WINAPI TravelLog_UpdateExternal(ITravelLog *iface, IUnknown *punk, IUnknown *punkHLBrowseContext)
3329 {
3330 ok(0, "unexpected call\n");
3331 return E_NOTIMPL;
3332 }
3333
3334 static HRESULT WINAPI TravelLog_Travel(ITravelLog *iface, IUnknown *punk, int iOffset)
3335 {
3336 ok(0, "unexpected call\n");
3337 return E_NOTIMPL;
3338 }
3339
3340 static HRESULT WINAPI TravelLog_GetTravelEntry(ITravelLog *iface, IUnknown *punk, int iOffset, ITravelEntry **ppte)
3341 {
3342 ok(0, "unexpected call\n");
3343 return E_NOTIMPL;
3344 }
3345
3346 static HRESULT WINAPI TravelLog_FindTravelEntry(ITravelLog *iface, IUnknown *punk, LPCITEMIDLIST pidl, ITravelEntry **ppte)
3347 {
3348 ok(0, "unexpected call\n");
3349 return E_NOTIMPL;
3350 }
3351
3352 static HRESULT WINAPI TravelLog_GetTooltipText(ITravelLog *iface, IUnknown *punk, int iOffset, int idsTemplate,
3353 LPWSTR pwzText, DWORD cchText)
3354 {
3355 ok(0, "unexpected call\n");
3356 return E_NOTIMPL;
3357 }
3358
3359 static HRESULT WINAPI TravelLog_InsertMenuEntries(ITravelLog *iface, IUnknown *punk, HMENU hmenu, int nPos,
3360 int idFirst, int idLast, DWORD dwFlags)
3361 {
3362 ok(0, "unexpected call\n");
3363 return E_NOTIMPL;
3364 }
3365
3366 static HRESULT WINAPI TravelLog_Clone(ITravelLog *iface, ITravelLog **pptl)
3367 {
3368 ok(0, "unexpected call\n");
3369 return E_NOTIMPL;
3370 }
3371
3372 static IBrowserService BrowserService;
3373 static DWORD WINAPI TravelLog_CountEntries(ITravelLog *iface, IUnknown *punk)
3374 {
3375 CHECK_EXPECT(CountEntries);
3376
3377 ok(punk == (IUnknown*)&BrowserService, "punk != &BrowserService (%p)\n", punk);
3378 return 0;
3379 }
3380
3381 static HRESULT WINAPI TravelLog_Revert(ITravelLog *iface)
3382 {
3383 ok(0, "unexpected call\n");
3384 return E_NOTIMPL;
3385 }
3386
3387 static const ITravelLogVtbl TravelLogVtbl = {
3388 TravelLog_QueryInterface,
3389 TravelLog_AddRef,
3390 TravelLog_Release,
3391 TravelLog_AddEntry,
3392 TravelLog_UpdateEntry,
3393 TravelLog_UpdateExternal,
3394 TravelLog_Travel,
3395 TravelLog_GetTravelEntry,
3396 TravelLog_FindTravelEntry,
3397 TravelLog_GetTooltipText,
3398 TravelLog_InsertMenuEntries,
3399 TravelLog_Clone,
3400 TravelLog_CountEntries,
3401 TravelLog_Revert
3402 };
3403
3404 static ITravelLog TravelLog = { &TravelLogVtbl };
3405
3406 static HRESULT browserservice_qi(REFIID,void**);
3407
3408 static HRESULT WINAPI DocObjectService_QueryInterface(IDocObjectService* This, REFIID riid, void **ppv)
3409 {
3410 return browserservice_qi(riid, ppv);
3411 }
3412
3413 static ULONG WINAPI DocObjectService_AddRef(
3414 IDocObjectService* This)
3415 {
3416 return 2;
3417 }
3418
3419 static ULONG WINAPI DocObjectService_Release(
3420 IDocObjectService* This)
3421 {
3422 return 1;
3423 }
3424
3425 static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(IDocObjectService *iface, IDispatch *pDispatch,
3426 LPCWSTR lpszUrl, DWORD dwFlags, LPCWSTR lpszFrameName, BYTE *pPostData, DWORD cbPostData,
3427 LPCWSTR lpszHeaders, BOOL fPlayNavSound, BOOL *pfCancel)
3428 {
3429 CHECK_EXPECT(FireBeforeNavigate2);
3430
3431 ok(!pDispatch, "pDispatch = %p\n", pDispatch);
3432 ok(!strcmp_wa(lpszUrl, nav_url), "lpszUrl = %s, expected %s\n", wine_dbgstr_w(lpszUrl), nav_url);
3433 ok(dwFlags == 0x40 || !dwFlags || dwFlags == 0x50, "dwFlags = %x\n", dwFlags);
3434 ok(!lpszFrameName, "lpszFrameName = %s\n", wine_dbgstr_w(lpszFrameName));
3435 if(!testing_submit) {
3436 ok(!pPostData, "pPostData = %p\n", pPostData);
3437 ok(!cbPostData, "cbPostData = %d\n", cbPostData);
3438 ok(!lpszHeaders, "lpszHeaders = %s\n", wine_dbgstr_w(lpszHeaders));
3439 }else {
3440 ok(cbPostData == 9, "cbPostData = %d\n", cbPostData);
3441 ok(!memcmp(pPostData, "cmd=TEST", cbPostData), "pPostData = %p\n", pPostData);
3442 ok(wstr_contains(lpszHeaders, "Content-Type: application/x-www-form-urlencoded\r\n"),
3443 "lpszHeaders = %s\n", wine_dbgstr_w(lpszHeaders));
3444