3768ae5a4758015389b60ac5e2b1f23544c2baa0
[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 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(riid, &IID_INewWindowManager)) {
876 *ppv = iface;
877 return S_OK;
878 }
879
880 trace("NewWindowManager_QueryInterface %s\n", wine_dbgstr_guid(riid));
881 *ppv = NULL;
882 return E_NOINTERFACE;
883 }
884
885 static ULONG WINAPI NewWindowManager_AddRef(INewWindowManager *iface)
886 {
887 return 2;
888 }
889
890 static ULONG WINAPI NewWindowManager_Release(INewWindowManager *iface)
891 {
892 return 1;
893 }
894
895 static HRESULT WINAPI NewWindowManager_EvaluateNewWindow(INewWindowManager *iface, LPCWSTR pszUrl,
896 LPCWSTR pszName, LPCWSTR pszUrlContext, LPCWSTR pszFeatures, BOOL fReplace, DWORD dwFlags,
897 DWORD dwUserActionTime)
898 {
899 CHECK_EXPECT(EvaluateNewWindow);
900
901 ok(!strcmp_wa(pszUrl, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl));
902 ok(!strcmp_wa(pszName, "test"), "pszName = %s\n", wine_dbgstr_w(pszName));
903 ok(!strcmp_wa(pszUrlContext, prev_url), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext));
904 ok(!pszFeatures, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures));
905 ok(!fReplace, "fReplace = %x\n", fReplace);
906 ok(dwFlags == (allow_new_window ? 0 : NWMF_FIRST), "dwFlags = %x\n", dwFlags);
907 ok(!dwUserActionTime, "dwUserActionime = %d\n", dwUserActionTime);
908
909 return allow_new_window ? S_OK : E_FAIL;
910 }
911
912 static const INewWindowManagerVtbl NewWindowManagerVtbl = {
913 NewWindowManager_QueryInterface,
914 NewWindowManager_AddRef,
915 NewWindowManager_Release,
916 NewWindowManager_EvaluateNewWindow
917 };
918
919 static INewWindowManager NewWindowManager = { &NewWindowManagerVtbl };
920
921 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
922 REFIID riid, void**ppv)
923 {
924 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
925 *ppv = iface;
926 return S_OK;
927 }
928
929 ok(0, "unexpected call\n");
930 return E_NOINTERFACE;
931 }
932
933 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
934 {
935 return 2;
936 }
937
938 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
939 {
940 return 1;
941 }
942
943 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
944 {
945 if(resetting_document)
946 return S_OK;
947
948 switch(dispID) {
949 case DISPID_READYSTATE:
950 CHECK_EXPECT2(OnChanged_READYSTATE);
951
952 if(!readystate_set_interactive)
953 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
954 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
955 ? OLECMDF_ENABLED : 0));
956
957 if(readystate_set_loading) {
958 readystate_set_loading = FALSE;
959 load_state = LD_LOADING;
960 }
961 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
962 test_readyState(NULL);
963 return S_OK;
964 case 1005:
965 CHECK_EXPECT2(OnChanged_1005);
966 if(!editmode)
967 test_readyState(NULL);
968 readystate_set_interactive = (load_state != LD_INTERACTIVE);
969 return S_OK;
970 case 1012:
971 CHECK_EXPECT2(OnChanged_1012);
972 return S_OK;
973 case 1014:
974 CHECK_EXPECT2(OnChanged_1014);
975 return S_OK;
976 case 1030:
977 case 3000022:
978 case 3000023:
979 case 3000024:
980 case 3000025:
981 case 3000026:
982 case 3000027:
983 case 3000028:
984 case 3000029:
985 case 3000030:
986 case 3000031:
987 case 3000032:
988 /* TODO */
989 return S_OK;
990 }
991
992 ok(0, "unexpected id %d\n", dispID);
993 return E_NOTIMPL;
994 }
995
996 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
997 {
998 ok(0, "unexpected call\n");
999 return E_NOTIMPL;
1000 }
1001
1002 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
1003 PropertyNotifySink_QueryInterface,
1004 PropertyNotifySink_AddRef,
1005 PropertyNotifySink_Release,
1006 PropertyNotifySink_OnChanged,
1007 PropertyNotifySink_OnRequestEdit
1008 };
1009
1010 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
1011
1012 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
1013 {
1014 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ISequentialStream, riid) || IsEqualGUID(&IID_IStream, riid)) {
1015 *ppv = iface;
1016 return S_OK;
1017 }
1018
1019 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
1020 *ppv = NULL;
1021 return E_NOINTERFACE;
1022 }
1023
1024 static ULONG WINAPI Stream_AddRef(IStream *iface)
1025 {
1026 return 2;
1027 }
1028
1029 static ULONG WINAPI Stream_Release(IStream *iface)
1030 {
1031 return 1;
1032 }
1033
1034 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
1035 ULONG cb, ULONG *pcbRead)
1036 {
1037 CHECK_EXPECT2(Read);
1038 ok(pv != NULL, "pv == NULL\n");
1039 ok(cb > sizeof(html_page), "cb = %d\n", cb);
1040 ok(pcbRead != NULL, "pcbRead == NULL\n");
1041 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
1042
1043 if(stream_read)
1044 return S_FALSE;
1045
1046 memcpy(pv, html_page, sizeof(html_page)-1);
1047 stream_read += *pcbRead = sizeof(html_page)-1;
1048 return S_OK;
1049 }
1050
1051 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
1052 ULONG cb, ULONG *pcbWritten)
1053 {
1054 ok(0, "unexpected call\n");
1055 return E_NOTIMPL;
1056 }
1057
1058 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
1059 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
1060 {
1061 ok(0, "unexpected call\n");
1062 return E_NOTIMPL;
1063 }
1064
1065 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
1066 {
1067 ok(0, "unexpected call\n");
1068 return E_NOTIMPL;
1069 }
1070
1071 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
1072 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
1073 {
1074 ok(0, "unexpected call\n");
1075 return E_NOTIMPL;
1076 }
1077
1078 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
1079 {
1080 ok(0, "unexpected call\n");
1081 return E_NOTIMPL;
1082 }
1083
1084 static HRESULT WINAPI Stream_Revert(IStream *iface)
1085 {
1086 ok(0, "unexpected call\n");
1087 return E_NOTIMPL;
1088 }
1089
1090 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
1091 ULARGE_INTEGER cb, DWORD dwLockType)
1092 {
1093 ok(0, "unexpected call\n");
1094 return E_NOTIMPL;
1095 }
1096
1097 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
1098 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
1099 {
1100 ok(0, "unexpected call\n");
1101 return E_NOTIMPL;
1102 }
1103
1104 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
1105 DWORD dwStatFlag)
1106 {
1107 ok(0, "unexpected call\n");
1108 return E_NOTIMPL;
1109 }
1110
1111 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
1112 {
1113 ok(0, "unexpected call\n");
1114 return E_NOTIMPL;
1115 }
1116
1117 static const IStreamVtbl StreamVtbl = {
1118 Stream_QueryInterface,
1119 Stream_AddRef,
1120 Stream_Release,
1121 Stream_Read,
1122 Stream_Write,
1123 Stream_Seek,
1124 Stream_SetSize,
1125 Stream_CopyTo,
1126 Stream_Commit,
1127 Stream_Revert,
1128 Stream_LockRegion,
1129 Stream_UnlockRegion,
1130 Stream_Stat,
1131 Stream_Clone
1132 };
1133
1134 static IStream Stream = { &StreamVtbl };
1135
1136 static HRESULT WINAPI WinInetHttpInfo_QueryInterface(
1137 IWinInetHttpInfo* This,
1138 REFIID riid,
1139 void **ppvObject)
1140 {
1141 *ppvObject = NULL;
1142
1143 if(IsEqualGUID(&IID_IGetBindHandle, riid))
1144 return E_NOINTERFACE;
1145
1146 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
1147 return E_NOINTERFACE;
1148 }
1149
1150 static ULONG WINAPI WinInetHttpInfo_AddRef(
1151 IWinInetHttpInfo* This)
1152 {
1153 return 2;
1154 }
1155
1156 static ULONG WINAPI WinInetHttpInfo_Release(
1157 IWinInetHttpInfo* This)
1158 {
1159 return 1;
1160 }
1161
1162 static HRESULT WINAPI WinInetHttpInfo_QueryOption(
1163 IWinInetHttpInfo* This,
1164 DWORD dwOption,
1165 LPVOID pBuffer,
1166 DWORD *pcbBuf)
1167 {
1168 return E_NOTIMPL; /* TODO */
1169 }
1170
1171 static HRESULT WINAPI WinInetHttpInfo_QueryInfo(
1172 IWinInetHttpInfo* This,
1173 DWORD dwOption,
1174 LPVOID pBuffer,
1175 DWORD *pcbBuf,
1176 DWORD *pdwFlags,
1177 DWORD *pdwReserved)
1178 {
1179 ok(pdwReserved == NULL, "pdwReserved != NULL\n");
1180
1181 if(dwOption == (HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER)) {
1182 ok(pBuffer != NULL, "pBuffer == NULL\n");
1183 ok(*pcbBuf == sizeof(DWORD), "*pcbBuf = %d\n", *pcbBuf);
1184 ok(pdwFlags == NULL, "*pdwFlags != NULL\n");
1185 *((DWORD*)pBuffer) = status_code;
1186 return S_OK;
1187 }
1188
1189 return E_NOTIMPL; /* TODO */
1190 }
1191
1192 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = {
1193 WinInetHttpInfo_QueryInterface,
1194 WinInetHttpInfo_AddRef,
1195 WinInetHttpInfo_Release,
1196 WinInetHttpInfo_QueryOption,
1197 WinInetHttpInfo_QueryInfo
1198 };
1199
1200 static IWinInetHttpInfo WinInetHttpInfo = { &WinInetHttpInfoVtbl };
1201
1202 DEFINE_GUID(IID_unk_binding, 0xf3d8f080,0xa5eb,0x476f,0x9d,0x19,0xa5,0xef,0x24,0xe5,0xc2,0xe6);
1203
1204 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
1205 {
1206 if(IsEqualGUID(&IID_IUnknown, riid)) {
1207 *ppv = iface;
1208 return S_OK;
1209 }
1210
1211 if(IsEqualGUID(&IID_IWinInetInfo, riid) || IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
1212 *ppv = &WinInetHttpInfo;
1213 return S_OK;
1214 }
1215
1216 if(IsEqualGUID(&IID_unk_binding, riid)) {
1217 *ppv = NULL;
1218 return E_NOINTERFACE;
1219 }
1220
1221 trace("Binding::QI(%s)\n", wine_dbgstr_guid(riid));
1222 *ppv = NULL;
1223 return E_NOINTERFACE;
1224 }
1225
1226 static ULONG WINAPI Binding_AddRef(IBinding *iface)
1227 {
1228 return 2;
1229 }
1230
1231 static ULONG WINAPI Binding_Release(IBinding *iface)
1232 {
1233 return 1;
1234 }
1235
1236 static HRESULT WINAPI Binding_Abort(IBinding *iface)
1237 {
1238 CHECK_EXPECT(Abort);
1239 if(asynchronous_binding)
1240 PeekMessageA(NULL, container_hwnd, WM_CONTINUE_BINDING, WM_CONTINUE_BINDING, PM_REMOVE);
1241 return S_OK;
1242 }
1243
1244 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
1245 {
1246 ok(0, "unexpected call\n");
1247 return E_NOTIMPL;
1248 }
1249
1250 static HRESULT WINAPI Binding_Resume(IBinding *iface)
1251 {
1252 ok(0, "unexpected call\n");
1253 return E_NOTIMPL;
1254 }
1255
1256 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
1257 {
1258 ok(0, "unexpected call\n");
1259 return E_NOTIMPL;
1260 }
1261
1262 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
1263 {
1264 ok(0, "unexpected call\n");
1265 return E_NOTIMPL;
1266 }
1267
1268 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
1269 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
1270 {
1271 CHECK_EXPECT(GetBindResult);
1272 return E_NOTIMPL;
1273 }
1274
1275 static const IBindingVtbl BindingVtbl = {
1276 Binding_QueryInterface,
1277 Binding_AddRef,
1278 Binding_Release,
1279 Binding_Abort,
1280 Binding_Suspend,
1281 Binding_Resume,
1282 Binding_SetPriority,
1283 Binding_GetPriority,
1284 Binding_GetBindResult
1285 };
1286
1287 static IBinding Binding = { &BindingVtbl };
1288
1289 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1290 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1291
1292 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
1293 {
1294 *ppv = NULL;
1295
1296 if(IsEqualGUID(&IID_IMoniker_unk, riid))
1297 return E_NOINTERFACE; /* TODO */
1298 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
1299 return E_NOINTERFACE; /* TODO */
1300
1301 ok(0, "unexpected riid: %s\n", wine_dbgstr_guid(riid));
1302 return E_NOINTERFACE;
1303 }
1304
1305 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1306 {
1307 return 2;
1308 }
1309
1310 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1311 {
1312 return 1;
1313 }
1314
1315 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1316 {
1317 CHECK_EXPECT(GetClassID);
1318 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", wine_dbgstr_guid(pClassID));
1319 return E_FAIL;
1320 }
1321
1322 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1323 {
1324 ok(0, "unexpected call\n");
1325 return E_NOTIMPL;
1326 }
1327
1328 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1329 {
1330 ok(0, "unexpected call\n");
1331 return E_NOTIMPL;
1332 }
1333
1334 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1335 {
1336 ok(0, "unexpected call\n");
1337 return E_NOTIMPL;
1338 }
1339
1340 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1341 {
1342 ok(0, "unexpected call\n");
1343 return E_NOTIMPL;
1344 }
1345
1346 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1347 REFIID riidResult, void **ppvResult)
1348 {
1349 ok(0, "unexpected call\n");
1350 return E_NOTIMPL;
1351 }
1352
1353 static void test_binding_ui(IUnknown *unk)
1354 {
1355 IWindowForBindingUI *binding_ui;
1356 IServiceProvider *serv_prov;
1357 HWND binding_hwnd;
1358 HRESULT hres;
1359
1360 hres = IUnknown_QueryInterface(unk, &IID_IServiceProvider, (void**)&serv_prov);
1361 ok(hres == S_OK, "Could not get IServiceProvider: %08x\n", hres);
1362
1363 hres = IServiceProvider_QueryService(serv_prov, &IID_IWindowForBindingUI, &IID_IWindowForBindingUI,
1364 (void**)&binding_ui);
1365 ok(hres == S_OK, "Could not get IWindowForBindingUI: %08x\n", hres);
1366
1367 hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IHttpSecurity, &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_IAuthenticate, &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 hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IWindowForBindingUI, &binding_hwnd);
1382 ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
1383 if(doc_hwnd)
1384 ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
1385 else
1386 todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
1387
1388 IWindowForBindingUI_Release(binding_ui);
1389 IServiceProvider_Release(serv_prov);
1390 }
1391
1392 static void continue_binding(IBindStatusCallback *callback)
1393 {
1394 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1395 STGMEDIUM stgmedium;
1396 HRESULT hres;
1397
1398 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1399
1400 test_binding_ui((IUnknown*)callback);
1401
1402 if(report_mime) {
1403 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1404 wszTextHtml);
1405 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1406 }
1407
1408 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1409 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1410 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1411 if(status_code != HTTP_STATUS_OK) {
1412 CHECK_CALLED_BROKEN(IsErrorUrl);
1413 SET_EXPECT(IsErrorUrl);
1414 }
1415
1416 SET_EXPECT(Read);
1417 stgmedium.tymed = TYMED_ISTREAM;
1418 U(stgmedium).pstm = &Stream;
1419 stgmedium.pUnkForRelease = (IUnknown*)&Moniker;
1420 hres = IBindStatusCallback_OnDataAvailable(callback,
1421 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1422 sizeof(html_page)-1, &formatetc, &stgmedium);
1423 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1424 CHECK_CALLED(Read);
1425
1426 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1427 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1428 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1429
1430 SET_EXPECT(GetBindResult);
1431 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1432 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1433 CLEAR_CALLED(GetBindResult); /* IE7 */
1434
1435 IBindStatusCallback_Release(callback);
1436 }
1437
1438 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1439 REFIID riid, void **ppv)
1440 {
1441 IBindStatusCallback *callback = NULL;
1442 BINDINFO bindinfo;
1443 DWORD bindf;
1444 HRESULT hres;
1445
1446 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1447
1448 CHECK_EXPECT(BindToStorage);
1449
1450 load_state = LD_LOADING;
1451
1452 ok(pbc != NULL, "pbc == NULL\n");
1453 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1454 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1455 ok(ppv != NULL, "ppv == NULL\n");
1456 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1457
1458 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1459 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1460 ok(callback != NULL, "callback == NULL\n");
1461
1462 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1463 bindinfo.cbSize = sizeof(bindinfo);
1464
1465 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1466 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1467 ok((bindf & ~BINDF_HYPERLINK /* IE9 */) == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1468 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1469 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1470 /* TODO: test stgmedData */
1471 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1472 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1473 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1474 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1475 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1476 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1477 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1478 /* TODO: test dwCodePage */
1479 /* TODO: test securityAttributes */
1480 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1481 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1482 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1483
1484 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1485 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1486
1487 if(asynchronous_binding) {
1488 PostMessageW(container_hwnd, WM_CONTINUE_BINDING, (WPARAM)callback, 0);
1489 return MK_S_ASYNCHRONOUS;
1490 }
1491
1492 continue_binding(callback);
1493 return S_OK;
1494 }
1495
1496 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1497 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1498 {
1499 ok(0, "unexpected call\n");
1500 return E_NOTIMPL;
1501 }
1502
1503 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1504 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1505 {
1506 ok(0, "unexpected call\n");
1507 return E_NOTIMPL;
1508 }
1509
1510 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1511 {
1512 ok(0, "unexpected call\n");
1513 return E_NOTIMPL;
1514 }
1515
1516 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1517 {
1518 ok(0, "unexpected call\n");
1519 return E_NOTIMPL;
1520 }
1521
1522 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1523 {
1524 ok(0, "unexpected call\n");
1525 return E_NOTIMPL;
1526 }
1527
1528 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1529 IMoniker *pmkNewlyRunning)
1530 {
1531 ok(0, "unexpected call\n");
1532 return E_NOTIMPL;
1533 }
1534
1535 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1536 IMoniker *pmkToLeft, FILETIME *pFileTime)
1537 {
1538 ok(0, "unexpected call\n");
1539 return E_NOTIMPL;
1540 }
1541
1542 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1543 {
1544 ok(0, "unexpected call\n");
1545 return E_NOTIMPL;
1546 }
1547
1548 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1549 IMoniker **ppmkPrefix)
1550 {
1551 ok(0, "unexpected call\n");
1552 return E_NOTIMPL;
1553 }
1554
1555 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1556 IMoniker **pmkRelPath)
1557 {
1558 ok(0, "unexpected call\n");
1559 return E_NOTIMPL;
1560 }
1561
1562 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1563 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1564 {
1565 CHECK_EXPECT2(GetDisplayName);
1566
1567 /* ok(pbc != NULL, "pbc == NULL\n"); */
1568 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1569 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1570
1571 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1572 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1573
1574 return S_OK;
1575 }
1576
1577 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1578 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1579 {
1580 ok(0, "unexpected call\n");
1581 return E_NOTIMPL;
1582 }
1583
1584 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1585 {
1586 CHECK_EXPECT(IsSystemMoniker);
1587 return E_NOTIMPL;
1588 }
1589
1590 static const IMonikerVtbl MonikerVtbl = {
1591 Moniker_QueryInterface,
1592 Moniker_AddRef,
1593 Moniker_Release,
1594 Moniker_GetClassID,
1595 Moniker_IsDirty,
1596 Moniker_Load,
1597 Moniker_Save,
1598 Moniker_GetSizeMax,
1599 Moniker_BindToObject,
1600 Moniker_BindToStorage,
1601 Moniker_Reduce,
1602 Moniker_ComposeWith,
1603 Moniker_Enum,
1604 Moniker_IsEqual,
1605 Moniker_Hash,
1606 Moniker_IsRunning,
1607 Moniker_GetTimeOfLastChange,
1608 Moniker_Inverse,
1609 Moniker_CommonPrefixWith,
1610 Moniker_RelativePathTo,
1611 Moniker_GetDisplayName,
1612 Moniker_ParseDisplayName,
1613 Moniker_IsSystemMoniker
1614 };
1615
1616 static IMoniker Moniker = { &MonikerVtbl };
1617
1618 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1619 {
1620 return QueryInterface(riid, ppv);
1621 }
1622
1623 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1624 {
1625 return 2;
1626 }
1627
1628 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1629 {
1630 return 1;
1631 }
1632
1633 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1634 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1635 {
1636 ok(0, "unexpected call\n");
1637 return E_NOTIMPL;
1638 }
1639
1640 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1641 IEnumUnknown **ppenum)
1642 {
1643 ok(0, "unexpected call\n");
1644 return E_NOTIMPL;
1645 }
1646
1647 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1648 {
1649 CHECK_EXPECT(LockContainer);
1650 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1651 return S_OK;
1652 }
1653
1654 static const IOleContainerVtbl OleContainerVtbl = {
1655 OleContainer_QueryInterface,
1656 OleContainer_AddRef,
1657 OleContainer_Release,
1658 OleContainer_ParseDisplayName,
1659 OleContainer_EnumObjects,
1660 OleContainer_LockContainer
1661 };
1662
1663 static IOleContainer OleContainer = { &OleContainerVtbl };
1664
1665 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1666 {
1667 return QueryInterface(riid, ppv);
1668 }
1669
1670 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1671 {
1672 return 2;
1673 }
1674
1675 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1676 {
1677 return 1;
1678 }
1679
1680 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1681 {
1682 ok(0, "unexpected call\n");
1683 return E_NOTIMPL;
1684 }
1685
1686 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1687 IMoniker **ppmon)
1688 {
1689 ok(0, "unexpected call\n");
1690 return E_NOTIMPL;
1691 }
1692
1693 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1694 {
1695 CHECK_EXPECT(GetContainer);
1696 ok(ppContainer != NULL, "ppContainer = NULL\n");
1697 *ppContainer = &OleContainer;
1698 return S_OK;
1699 }
1700
1701 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1702 {
1703 ok(0, "unexpected call\n");
1704 return E_NOTIMPL;
1705 }
1706
1707 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1708 {
1709 ok(0, "unexpected call\n");
1710 return E_NOTIMPL;
1711 }
1712
1713 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1714 {
1715 ok(0, "unexpected call\n");
1716 return E_NOTIMPL;
1717 }
1718
1719 static const IOleClientSiteVtbl ClientSiteVtbl = {
1720 ClientSite_QueryInterface,
1721 ClientSite_AddRef,
1722 ClientSite_Release,
1723 ClientSite_SaveObject,
1724 ClientSite_GetMoniker,
1725 ClientSite_GetContainer,
1726 ClientSite_ShowObject,
1727 ClientSite_OnShowWindow,
1728 ClientSite_RequestNewObjectLayout
1729 };
1730
1731 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1732
1733 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1734 {
1735 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1736
1737 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1738 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
1739
1740 *ppv = NULL;
1741 return E_NOINTERFACE;
1742 }
1743
1744 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1745 {
1746 return 2;
1747 }
1748
1749 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1750 {
1751 return 1;
1752 }
1753
1754 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1755 {
1756 CHECK_EXPECT(Frame_GetWindow);
1757 return E_NOTIMPL;
1758 }
1759
1760 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1761 {
1762 ok(0, "unexpected call\n");
1763 return E_NOTIMPL;
1764 }
1765
1766 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1767 {
1768 ok(0, "unexpected call\n");
1769 return E_NOTIMPL;
1770 }
1771
1772 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1773 LPCBORDERWIDTHS pborderwidths)
1774 {
1775 ok(0, "unexpected call\n");
1776 return E_NOTIMPL;
1777 }
1778
1779 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1780 LPCBORDERWIDTHS pborderwidths)
1781 {
1782 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1783 return S_OK;
1784 }
1785
1786 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1787 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1788 {
1789 static const WCHAR wszHTML_Document[] =
1790 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1791
1792 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1793
1794 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1795 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1796 if(pActiveObject && is_lang_english())
1797 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1798 }
1799 else {
1800 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1801 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1802 }
1803 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1804 return S_OK;
1805 }
1806
1807 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1808 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1809 {
1810 static const WCHAR wszHTML_Document[] =
1811 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1812
1813 if(pActiveObject) {
1814 CHECK_EXPECT2(SetActiveObject);
1815
1816 if(pActiveObject && is_lang_english())
1817 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1818 }else {
1819 CHECK_EXPECT(SetActiveObject_null);
1820
1821 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1822 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1823 }
1824
1825 return S_OK;
1826 }
1827
1828 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1829 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1830 {
1831 ok(0, "unexpected call\n");
1832 return E_NOTIMPL;
1833 }
1834
1835 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1836 HOLEMENU holemenu, HWND hwndActiveObject)
1837 {
1838 ok(0, "unexpected call\n");
1839 return E_NOTIMPL;
1840 }
1841
1842 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1843 {
1844 ok(0, "unexpected call\n");
1845 return E_NOTIMPL;
1846 }
1847
1848 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1849 {
1850 if(!resetting_document)
1851 CHECK_EXPECT2(SetStatusText);
1852 if(!expect_status_text)
1853 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1854 return S_OK;
1855 }
1856
1857 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1858 {
1859 if(fEnable)
1860 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1861 else
1862 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1863 return E_NOTIMPL;
1864 }
1865
1866 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1867 {
1868 ok(0, "unexpected call\n");
1869 return E_NOTIMPL;
1870 }
1871
1872 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1873 InPlaceFrame_QueryInterface,
1874 InPlaceFrame_AddRef,
1875 InPlaceFrame_Release,
1876 InPlaceFrame_GetWindow,
1877 InPlaceFrame_ContextSensitiveHelp,
1878 InPlaceFrame_GetBorder,
1879 InPlaceFrame_RequestBorderSpace,
1880 InPlaceFrame_SetBorderSpace,
1881 InPlaceFrame_SetActiveObject,
1882 InPlaceFrame_InsertMenus,
1883 InPlaceFrame_SetMenu,
1884 InPlaceFrame_RemoveMenus,
1885 InPlaceFrame_SetStatusText,
1886 InPlaceFrame_EnableModeless,
1887 InPlaceFrame_TranslateAccelerator
1888 };
1889
1890 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1891
1892 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1893 InPlaceFrame_QueryInterface,
1894 InPlaceFrame_AddRef,
1895 InPlaceFrame_Release,
1896 InPlaceFrame_GetWindow,
1897 InPlaceFrame_ContextSensitiveHelp,
1898 InPlaceFrame_GetBorder,
1899 InPlaceFrame_RequestBorderSpace,
1900 InPlaceFrame_SetBorderSpace,
1901 InPlaceUIWindow_SetActiveObject,
1902 };
1903
1904 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1905
1906 static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
1907 {
1908 return QueryInterface(riid, ppv);
1909 }
1910
1911 static ULONG WINAPI InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
1912 {
1913 return 2;
1914 }
1915
1916 static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
1917 {
1918 return 1;
1919 }
1920
1921 static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(
1922 IOleInPlaceSiteWindowless *iface, HWND *phwnd)
1923 {
1924 IOleClientSite *client_site;
1925 IOleObject *ole_obj;
1926 HRESULT hres;
1927
1928 CHECK_EXPECT2(GetWindow);
1929 ok(phwnd != NULL, "phwnd = NULL\n");
1930 *phwnd = container_hwnd;
1931
1932 hres = IUnknown_QueryInterface(doc_unk, &IID_IOleObject, (void**)&ole_obj);
1933 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
1934
1935 hres = IOleObject_GetClientSite(ole_obj, &client_site);
1936 IOleObject_Release(ole_obj);
1937 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
1938 ok(client_site == &ClientSite, "client_site != ClientSite\n");
1939 IOleClientSite_Release(client_site);
1940
1941 return S_OK;
1942 }
1943
1944 static HRESULT WINAPI InPlaceSiteWindowless_ContextSensitiveHelp(
1945 IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
1946 {
1947 ok(0, "unexpected call\n");
1948 return E_NOTIMPL;
1949 }
1950
1951 static HRESULT WINAPI InPlaceSiteWindowless_CanInPlaceActivate(
1952 IOleInPlaceSiteWindowless *iface)
1953 {
1954 CHECK_EXPECT(CanInPlaceActivate);
1955 return S_OK;
1956 }
1957
1958 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivate(
1959 IOleInPlaceSiteWindowless *iface)
1960 {
1961 CHECK_EXPECT(OnInPlaceActivate);
1962 inplace_deactivated = FALSE;
1963 return S_OK;
1964 }
1965
1966 static HRESULT WINAPI InPlaceSiteWindowless_OnUIActivate(
1967 IOleInPlaceSiteWindowless *iface)
1968 {
1969 CHECK_EXPECT(OnUIActivate);
1970 return S_OK;
1971 }
1972
1973 static HRESULT WINAPI InPlaceSiteWindowless_GetWindowContext(
1974 IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **ppFrame,
1975 IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1976 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1977 {
1978 static const RECT rect = {0,0,500,500};
1979
1980 CHECK_EXPECT(GetWindowContext);
1981
1982 ok(ppFrame != NULL, "ppFrame = NULL\n");
1983 if(ppFrame)
1984 *ppFrame = &InPlaceFrame;
1985 ok(ppDoc != NULL, "ppDoc = NULL\n");
1986 if(ppDoc)
1987 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1988 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1989 if(lprcPosRect)
1990 memcpy(lprcPosRect, &rect, sizeof(RECT));
1991 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1992 if(lprcClipRect)
1993 memcpy(lprcClipRect, &rect, sizeof(RECT));
1994 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
1995 if(lpFrameInfo) {
1996 ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
1997 lpFrameInfo->fMDIApp = FALSE;
1998 lpFrameInfo->hwndFrame = container_hwnd;
1999 lpFrameInfo->haccel = NULL;
2000 lpFrameInfo->cAccelEntries = 0;
2001 }
2002
2003 return S_OK;
2004 }
2005
2006 static HRESULT WINAPI InPlaceSiteWindowless_Scroll(
2007 IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
2008 {
2009 ok(0, "unexpected call\n");
2010 return E_NOTIMPL;
2011 }
2012
2013 static HRESULT WINAPI InPlaceSiteWindowless_OnUIDeactivate(
2014 IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
2015 {
2016 CHECK_EXPECT(OnUIDeactivate);
2017 ok(!fUndoable, "fUndoable = TRUE\n");
2018 return S_OK;
2019 }
2020
2021 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivate(
2022 IOleInPlaceSiteWindowless *iface)
2023 {
2024 CHECK_EXPECT(OnInPlaceDeactivate);
2025 inplace_deactivated = TRUE;
2026 return S_OK;
2027 }
2028
2029 static HRESULT WINAPI InPlaceSiteWindowless_DiscardUndoState(
2030 IOleInPlaceSiteWindowless *iface)
2031 {
2032 ok(0, "unexpected call\n");
2033 return E_NOTIMPL;
2034 }
2035
2036 static HRESULT WINAPI InPlaceSiteWindowless_DeactivateAndUndo(
2037 IOleInPlaceSiteWindowless *iface)
2038 {
2039 ok(0, "unexpected call\n");
2040 return E_NOTIMPL;
2041 }
2042
2043 static HRESULT WINAPI InPlaceSiteWindowless_OnPosRectChange(
2044 IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
2045 {
2046 ok(0, "unexpected call\n");
2047 return E_NOTIMPL;
2048 }
2049
2050 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivateEx(
2051 IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
2052 {
2053 CHECK_EXPECT(OnInPlaceActivateEx);
2054
2055 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
2056 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
2057 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
2058
2059 return S_OK;
2060 }
2061
2062 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivateEx(
2063 IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
2064 {
2065 CHECK_EXPECT(OnInPlaceDeactivateEx);
2066
2067 ok(fNoRedraw, "fNoRedraw == FALSE\n");
2068
2069 return S_OK;
2070 }
2071
2072 static HRESULT WINAPI InPlaceSiteWindowless_RequestUIActivate(
2073 IOleInPlaceSiteWindowless *iface)
2074 {
2075 CHECK_EXPECT2(RequestUIActivate);
2076 return S_OK;
2077 }
2078
2079 static HRESULT WINAPI InPlaceSiteWindowless_CanWindowlessActivate(
2080 IOleInPlaceSiteWindowless *iface)
2081 {
2082 ok(0, "unexpected call\n");
2083 return E_NOTIMPL;
2084 }
2085
2086 static HRESULT WINAPI InPlaceSiteWindowless_GetCapture(
2087 IOleInPlaceSiteWindowless *iface)
2088 {
2089 ok(0, "unexpected call\n");
2090 return E_NOTIMPL;
2091 }
2092
2093 static HRESULT WINAPI InPlaceSiteWindowless_SetCapture(
2094 IOleInPlaceSiteWindowless *iface, BOOL fCapture)
2095 {
2096 ok(0, "unexpected call\n");
2097 return E_NOTIMPL;
2098 }
2099
2100 static HRESULT WINAPI InPlaceSiteWindowless_GetFocus(
2101 IOleInPlaceSiteWindowless *iface)
2102 {
2103 ok(0, "unexpected call\n");
2104 return E_NOTIMPL;
2105 }
2106
2107 static HRESULT WINAPI InPlaceSiteWindowless_SetFocus(
2108 IOleInPlaceSiteWindowless *iface, BOOL fFocus)
2109 {
2110 ok(0, "unexpected call\n");
2111 return E_NOTIMPL;
2112 }
2113
2114 static HRESULT WINAPI InPlaceSiteWindowless_GetDC(
2115 IOleInPlaceSiteWindowless *iface, LPCRECT pRect,
2116 DWORD grfFlags, HDC *phDC)
2117 {
2118 ok(0, "unexpected call\n");
2119 return E_NOTIMPL;
2120 }
2121
2122 static HRESULT WINAPI InPlaceSiteWindowless_ReleaseDC(
2123 IOleInPlaceSiteWindowless *iface, HDC hDC)
2124 {
2125 ok(0, "unexpected call\n");
2126 return E_NOTIMPL;
2127 }
2128
2129 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRect(
2130 IOleInPlaceSiteWindowless *iface, LPCRECT pRect, BOOL fErase)
2131 {
2132 ok(0, "unexpected call\n");
2133 return E_NOTIMPL;
2134 }
2135
2136 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRgn(
2137 IOleInPlaceSiteWindowless *iface, HRGN hRGN, BOOL fErase)
2138 {
2139 ok(0, "unexpected call\n");
2140 return E_NOTIMPL;
2141 }
2142
2143 static HRESULT WINAPI InPlaceSiteWindowless_ScrollRect(
2144 IOleInPlaceSiteWindowless *iface, INT dx, INT dy,
2145 LPCRECT pRectScroll, LPCRECT pRectClip)
2146 {
2147 ok(0, "unexpected call\n");
2148 return E_NOTIMPL;
2149 }
2150
2151 static HRESULT WINAPI InPlaceSiteWindowless_AdjustRect(
2152 IOleInPlaceSiteWindowless *iface, LPRECT prc)
2153 {
2154 ok(0, "unexpected call\n");
2155 return E_NOTIMPL;
2156 }
2157
2158 static HRESULT WINAPI InPlaceSiteWindowless_OnDefWindowMessage(
2159 IOleInPlaceSiteWindowless *iface, UINT msg,
2160 WPARAM wParam, LPARAM lParam, LRESULT *plResult)
2161 {
2162 ok(0, "unexpected call\n");
2163 return E_NOTIMPL;
2164 }
2165
2166 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl = {
2167 InPlaceSiteWindowless_QueryInterface,
2168 InPlaceSiteWindowless_AddRef,
2169 InPlaceSiteWindowless_Release,
2170 InPlaceSiteWindowless_GetWindow,
2171 InPlaceSiteWindowless_ContextSensitiveHelp,
2172 InPlaceSiteWindowless_CanInPlaceActivate,
2173 InPlaceSiteWindowless_OnInPlaceActivate,
2174 InPlaceSiteWindowless_OnUIActivate,
2175 InPlaceSiteWindowless_GetWindowContext,
2176 InPlaceSiteWindowless_Scroll,
2177 InPlaceSiteWindowless_OnUIDeactivate,
2178 InPlaceSiteWindowless_OnInPlaceDeactivate,
2179 InPlaceSiteWindowless_DiscardUndoState,
2180 InPlaceSiteWindowless_DeactivateAndUndo,
2181 InPlaceSiteWindowless_OnPosRectChange,
2182 InPlaceSiteWindowless_OnInPlaceActivateEx,
2183 InPlaceSiteWindowless_OnInPlaceDeactivateEx,
2184 InPlaceSiteWindowless_RequestUIActivate,
2185 InPlaceSiteWindowless_CanWindowlessActivate,
2186 InPlaceSiteWindowless_GetCapture,
2187 InPlaceSiteWindowless_SetCapture,
2188 InPlaceSiteWindowless_GetFocus,
2189 InPlaceSiteWindowless_SetFocus,
2190 InPlaceSiteWindowless_GetDC,
2191 InPlaceSiteWindowless_ReleaseDC,
2192 InPlaceSiteWindowless_InvalidateRect,
2193 InPlaceSiteWindowless_InvalidateRgn,
2194 InPlaceSiteWindowless_ScrollRect,
2195 InPlaceSiteWindowless_AdjustRect,
2196 InPlaceSiteWindowless_OnDefWindowMessage
2197 };
2198
2199 static IOleInPlaceSiteWindowless InPlaceSiteWindowless = { &InPlaceSiteWindowlessVtbl };
2200
2201 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
2202 {
2203 return QueryInterface(riid, ppv);
2204 }
2205
2206 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
2207 {
2208 return 2;
2209 }
2210
2211 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
2212 {
2213 return 1;
2214 }
2215
2216 typedef enum
2217 {
2218 CallUIActivate_None,
2219 CallUIActivate_ActivateMe,
2220 CallUIActivate_AfterShow,
2221 } CallUIActivate;
2222
2223 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
2224 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
2225 {
2226 IOleDocument *document;
2227 HRESULT hres;
2228
2229 CHECK_EXPECT(ActivateMe);
2230 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
2231
2232 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
2233 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
2234
2235 if(SUCCEEDED(hres)) {
2236 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteWindowless, NULL, 0, &view);
2237 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
2238
2239 if(SUCCEEDED(hres)) {
2240 IOleInPlaceActiveObject *activeobj = NULL;
2241 IOleInPlaceSite *inplacesite = NULL;
2242 HWND tmp_hwnd = NULL;
2243 static RECT rect = {0,0,400,500};
2244
2245 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2246 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2247 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2248 inplacesite, &InPlaceSiteWindowless);
2249
2250 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteWindowless);
2251 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
2252
2253 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2254 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2255 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2256 inplacesite, &InPlaceSiteWindowless);
2257
2258 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
2259 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
2260
2261 if(activeobj) {
2262 HWND hwnd = (void*)0xdeadbeef;
2263 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2264 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
2265 ok(hwnd == NULL, "hwnd=%p, expected NULL\n", hwnd);
2266 }
2267
2268 if(call_UIActivate == CallUIActivate_ActivateMe) {
2269 SET_EXPECT(CanInPlaceActivate);
2270 SET_EXPECT(GetWindowContext);
2271 SET_EXPECT(GetWindow);
2272 if(ipsex)
2273 SET_EXPECT(OnInPlaceActivateEx);
2274 else
2275 SET_EXPECT(OnInPlaceActivate);
2276 SET_EXPECT(SetStatusText);
2277 SET_EXPECT(Exec_SETPROGRESSMAX);
2278 SET_EXPECT(Exec_SETPROGRESSPOS);
2279 SET_EXPECT(OnUIActivate);
2280 SET_EXPECT(SetActiveObject);
2281 SET_EXPECT(ShowUI);
2282 expect_status_text = NULL;
2283
2284 hres = IOleDocumentView_UIActivate(view, TRUE);
2285 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2286
2287 CHECK_CALLED(CanInPlaceActivate);
2288 CHECK_CALLED(GetWindowContext);
2289 CHECK_CALLED(GetWindow);
2290 if(ipsex)
2291 CHECK_CALLED(OnInPlaceActivateEx);
2292 else
2293 CHECK_CALLED(OnInPlaceActivate);
2294 CHECK_CALLED(SetStatusText);
2295 CHECK_CALLED(Exec_SETPROGRESSMAX);
2296 CHECK_CALLED(Exec_SETPROGRESSPOS);
2297 CHECK_CALLED(OnUIActivate);
2298 CHECK_CALLED(SetActiveObject);
2299 CHECK_CALLED(ShowUI);
2300
2301 if(activeobj) {
2302 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
2303 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2304 ok(doc_hwnd != NULL, "hwnd == NULL\n");
2305 if(last_hwnd)
2306 ok(doc_hwnd == last_hwnd, "hwnd != last_hwnd\n");
2307 }
2308
2309 hres = IOleDocumentView_UIActivate(view, TRUE);
2310 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2311
2312 if(activeobj) {
2313 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
2314 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2315 ok(tmp_hwnd == doc_hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, doc_hwnd);
2316 }
2317 }
2318
2319 hres = IOleDocumentView_SetRect(view, &rect);
2320 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
2321
2322 if(call_UIActivate == CallUIActivate_ActivateMe) {
2323 hres = IOleDocumentView_Show(view, TRUE);
2324 ok(hres == S_OK, "Show failed: %08x\n", hres);
2325 }else {
2326 SET_EXPECT(CanInPlaceActivate);
2327 SET_EXPECT(GetWindowContext);
2328 SET_EXPECT(GetWindow);
2329 if(ipsex)
2330 SET_EXPECT(OnInPlaceActivateEx);
2331 else
2332 SET_EXPECT(OnInPlaceActivate);
2333 SET_EXPECT(SetStatusText);
2334 SET_EXPECT(Exec_SETPROGRESSMAX);
2335 SET_EXPECT(Exec_SETPROGRESSPOS);
2336 SET_EXPECT(OnUIActivate);
2337 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
2338
2339 hres = IOleDocumentView_Show(view, TRUE);
2340 ok(hres == S_OK, "Show failed: %08x\n", hres);
2341
2342 CHECK_CALLED(CanInPlaceActivate);
2343 CHECK_CALLED(GetWindowContext);
2344 CHECK_CALLED(GetWindow);
2345 if(ipsex)
2346 CHECK_CALLED(OnInPlaceActivateEx);
2347 else
2348 CHECK_CALLED(OnInPlaceActivate);
2349 CHECK_CALLED(SetStatusText);
2350 CHECK_CALLED(Exec_SETPROGRESSMAX);
2351 CHECK_CALLED(Exec_SETPROGRESSPOS);
2352
2353 if(activeobj) {
2354 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
2355 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2356 ok(doc_hwnd != NULL, "doc_hwnd == NULL\n");
2357 if(last_hwnd)
2358 ok(doc_hwnd == last_hwnd, "doc_hwnd != last_hwnd\n");
2359 }
2360 }
2361
2362 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
2363
2364 if(activeobj)
2365 IOleInPlaceActiveObject_Release(activeobj);
2366 }
2367
2368 IOleDocument_Release(document);
2369 }
2370
2371 return S_OK;
2372 }
2373
2374 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
2375 DocumentSite_QueryInterface,
2376 DocumentSite_AddRef,
2377 DocumentSite_Release,
2378 DocumentSite_ActivateMe
2379 };
2380
2381 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
2382
2383 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
2384 {
2385 return QueryInterface(riid, ppv);
2386 }
2387
2388 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
2389 {
2390 return 2;
2391 }
2392
2393 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
2394 {
2395 return 1;
2396 }
2397
2398 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
2399 {
2400 ok(0, "unexpected call\n");
2401 return E_NOTIMPL;
2402 }
2403
2404 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
2405 {
2406 ok(0, "unexpected call\n");
2407 return E_NOTIMPL;
2408 }
2409
2410 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
2411 {
2412 ok(0, "unexpected call\n");
2413 return E_NOTIMPL;
2414 }
2415
2416 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
2417 POINTF *pPtfContainer, DWORD dwFlags)
2418 {
2419 ok(0, "unexpected call\n");
2420 return E_NOTIMPL;
2421 }
2422
2423 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
2424 MSG *pMsg, DWORD grfModifiers)
2425 {
2426 ok(0, "unexpected call\n");
2427 return E_NOTIMPL;
2428 }
2429
2430 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
2431 {
2432 if(fGotFocus)
2433 CHECK_EXPECT(OnFocus_TRUE);
2434 else
2435 CHECK_EXPECT2(OnFocus_FALSE);
2436 return S_OK;
2437 }
2438
2439 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
2440 {
2441 ok(0, "unexpected call\n");
2442 return E_NOTIMPL;
2443 }
2444
2445 static const IOleControlSiteVtbl OleControlSiteVtbl = {
2446 OleControlSite_QueryInterface,
2447 OleControlSite_AddRef,
2448 OleControlSite_Release,
2449 OleControlSite_OnControlInfoChanged,
2450 OleControlSite_LockInPlaceActive,
2451 OleControlSite_GetExtendedControl,
2452 OleControlSite_TransformCoords,
2453 OleControlSite_TranslateAccelerator,
2454 OleControlSite_OnFocus,
2455 OleControlSite_ShowPropertyFrame
2456 };
2457
2458 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
2459
2460 static IDocHostUIHandler2 *expect_uihandler_iface;
2461
2462 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2463 {
2464 return QueryInterface(riid, ppv);
2465 }
2466
2467 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
2468 {
2469 return 2;
2470 }
2471
2472 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
2473 {
2474 return 1;
2475 }
2476
2477 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
2478 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
2479 {
2480 ok(0, "unexpected call\n");
2481 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2482 return E_NOTIMPL;
2483 }
2484
2485 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
2486 {
2487 if(!resetting_document)
2488 CHECK_EXPECT(GetHostInfo);
2489 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2490 ok(pInfo != NULL, "pInfo=NULL\n");
2491 if(pInfo) {
2492 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2493 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2494 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2495 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2496 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2497 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2498 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2499 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2500 }
2501 return S_OK;
2502 }
2503
2504 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2505 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2506 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2507 {
2508 CHECK_EXPECT(ShowUI);
2509 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2510
2511 if (editmode)
2512 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2513 else
2514 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2515 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2516 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2517 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2518 if (expect_InPlaceUIWindow_SetActiveObject_active)
2519 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2520 else
2521 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2522
2523 return S_OK;
2524 }
2525
2526 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2527 {
2528 CHECK_EXPECT(HideUI);
2529 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2530 return S_OK;
2531 }
2532
2533 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2534 {
2535 CHECK_EXPECT(UpdateUI);
2536 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2537 return S_OK;
2538 }
2539
2540 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2541 {
2542 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2543 if(fEnable)
2544 CHECK_EXPECT2(EnableModeless_TRUE);
2545 else
2546 CHECK_EXPECT2(EnableModeless_FALSE);
2547 return E_NOTIMPL;
2548 }
2549
2550 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2551 {
2552 ok(0, "unexpected call\n");
2553 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2554 return E_NOTIMPL;
2555 }
2556
2557 static BOOL expect_OnFrameWindowActivate_fActivate;
2558 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2559 {
2560 CHECK_EXPECT2(OnFrameWindowActivate);
2561 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2562 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2563 return S_OK;
2564 }
2565
2566 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2567 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2568 {
2569 ok(0, "unexpected call\n");
2570 return E_NOTIMPL;
2571 }
2572
2573 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2574 const GUID *pguidCmdGroup, DWORD nCmdID)
2575 {
2576 ok(0, "unexpected call\n");
2577 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2578 return E_NOTIMPL;
2579 }
2580
2581 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2582 LPOLESTR *pchKey, DWORD dw)
2583 {
2584 CHECK_EXPECT(GetOptionKeyPath);
2585 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2586 ok(pchKey != NULL, "pchKey = NULL\n");
2587 ok(!dw, "dw=%d, expected 0\n", dw);
2588 if(pchKey)
2589 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2590 return S_OK;
2591 }
2592
2593 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2594 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2595 {
2596 CHECK_EXPECT(GetDropTarget);
2597 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2598 /* TODO */
2599 return E_NOTIMPL;
2600 }
2601
2602 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2603 {
2604 CHECK_EXPECT(GetExternal);
2605 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2606 *ppDispatch = &External;
2607 return S_FALSE;
2608 }
2609
2610 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2611 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2612 {
2613 CHECK_EXPECT(TranslateUrl);
2614 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2615 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2616 if(!loading_hash)
2617 ok(!strcmp_wa(pchURLIn, nav_serv_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_serv_url);
2618 else
2619 todo_wine ok(!strcmp_wa(pchURLIn, nav_serv_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_serv_url);
2620 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2621 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2622
2623 /* Not related to hash navigation, just return NULL and S_OK in some cases. */
2624 if(loading_hash) {
2625 *ppchURLOut = NULL;
2626 return S_OK;
2627 }
2628
2629 return S_FALSE;
2630 }
2631
2632 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2633 IDataObject **ppPORet)
2634 {
2635 ok(0, "unexpected call\n");
2636 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2637 return E_NOTIMPL;
2638 }
2639
2640 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2641 LPOLESTR *pchKey, DWORD dw)
2642 {
2643 CHECK_EXPECT(GetOverrideKeyPath);
2644 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2645 ok(pchKey != NULL, "pchKey = NULL\n");
2646 if(pchKey)
2647 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2648 ok(!dw, "dw=%d, expected 0\n", dw);
2649 return S_OK;
2650 }
2651
2652 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2653 DocHostUIHandler_QueryInterface,
2654 DocHostUIHandler_AddRef,
2655 DocHostUIHandler_Release,
2656 DocHostUIHandler_ShowContextMenu,
2657 DocHostUIHandler_GetHostInfo,
2658 DocHostUIHandler_ShowUI,
2659 DocHostUIHandler_HideUI,
2660 DocHostUIHandler_UpdateUI,
2661 DocHostUIHandler_EnableModeless,
2662 DocHostUIHandler_OnDocWindowActivate,
2663 DocHostUIHandler_OnFrameWindowActivate,
2664 DocHostUIHandler_ResizeBorder,
2665 DocHostUIHandler_TranslateAccelerator,
2666 DocHostUIHandler_GetOptionKeyPath,
2667 DocHostUIHandler_GetDropTarget,
2668 DocHostUIHandler_GetExternal,
2669 DocHostUIHandler_TranslateUrl,
2670 DocHostUIHandler_FilterDataObject,
2671 DocHostUIHandler_GetOverrideKeyPath
2672 };
2673
2674 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2675
2676 static HRESULT WINAPI CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2677 {
2678 if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
2679 *ppv = iface;
2680 return S_OK;
2681 }
2682
2683 *ppv = NULL;
2684
2685 if(IsEqualGUID(&IID_IOleCommandTarget, riid))
2686 return E_NOINTERFACE;
2687
2688 if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2689 return E_NOINTERFACE; /* TODO */
2690
2691 trace("CustomDocHostUIHandler::QI(%s)\n", wine_dbgstr_guid(riid));
2692 return E_NOINTERFACE;
2693 }
2694
2695 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl = {
2696 CustomDocHostUIHandler_QueryInterface,
2697 DocHostUIHandler_AddRef,
2698 DocHostUIHandler_Release,
2699 DocHostUIHandler_ShowContextMenu,
2700 DocHostUIHandler_GetHostInfo,
2701 DocHostUIHandler_ShowUI,
2702 DocHostUIHandler_HideUI,
2703 DocHostUIHandler_UpdateUI,
2704 DocHostUIHandler_EnableModeless,
2705 DocHostUIHandler_OnDocWindowActivate,
2706 DocHostUIHandler_OnFrameWindowActivate,
2707 DocHostUIHandler_ResizeBorder,
2708 DocHostUIHandler_TranslateAccelerator,
2709 DocHostUIHandler_GetOptionKeyPath,
2710 DocHostUIHandler_GetDropTarget,
2711 DocHostUIHandler_GetExternal,
2712 DocHostUIHandler_TranslateUrl,
2713 DocHostUIHandler_FilterDataObject,
2714 DocHostUIHandler_GetOverrideKeyPath
2715 };
2716
2717 static IDocHostUIHandler2 CustomDocHostUIHandler = { &CustomDocHostUIHandlerVtbl };
2718
2719 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2720 REFIID riid, void **ppv)
2721 {
2722 return QueryInterface(riid, ppv);
2723 }
2724
2725 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2726 {
2727 return 2;
2728 }
2729
2730 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2731 {
2732 return 1;
2733 }
2734
2735 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2736 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2737 {
2738 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2739 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2740 ok(!pCmdText, "pCmdText != NULL\n");
2741
2742 switch(prgCmds[0].cmdID) {
2743 case OLECMDID_SETPROGRESSTEXT:
2744 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2745 prgCmds[0].cmdf = OLECMDF_ENABLED;
2746 return S_OK;
2747 case OLECMDID_OPEN:
2748 CHECK_EXPECT(QueryStatus_OPEN);
2749 prgCmds[0].cmdf = 0;
2750 return S_OK;
2751 case OLECMDID_NEW:
2752 CHECK_EXPECT(QueryStatus_NEW);
2753 prgCmds[0].cmdf = 0;
2754 return S_OK;
2755 default:
2756 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2757 };
2758
2759 return E_FAIL;
2760 }
2761
2762 static void test_save_history(IUnknown *unk)
2763 {
2764 IPersistHistory *per_hist;
2765 LARGE_INTEGER li;
2766 IStream *stream;
2767 HRESULT hres;
2768
2769 hres = IUnknown_QueryInterface(unk, &IID_IPersistHistory, (void**)&per_hist);
2770 ok(hres == S_OK, "Could not get IPersistHistory iface: %08x\n", hres);
2771
2772 hres = CreateStreamOnHGlobal(NULL, TRUE, &stream);
2773 ok(hres == S_OK, "CreateStreamOnHGlobal failed: %08x\n", hres);
2774
2775 hres = IPersistHistory_SaveHistory(per_hist, stream);
2776 ok(hres == S_OK, "SaveHistory failed: %08x\n", hres);
2777 IPersistHistory_Release(per_hist);
2778
2779 li.QuadPart = 0;
2780 hres = IStream_Seek(stream, li, STREAM_SEEK_SET, NULL);
2781 ok(hres == S_OK, "Stat failed: %08x\n", hres);
2782 history_stream = stream;
2783 }
2784
2785 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2786 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2787 {
2788 if(resetting_document)
2789 return E_FAIL;
2790
2791 if(!pguidCmdGroup) {
2792 test_readyState(NULL);
2793
2794 switch(nCmdID) {
2795 case OLECMDID_SETPROGRESSMAX:
2796 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2797 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2798 ok(pvaIn != NULL, "pvaIn == NULL\n");
2799 if(pvaIn) {
2800 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2801 if(load_state == LD_NO)
2802 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2803 }
2804 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2805 return S_OK;
2806 case OLECMDID_SETPROGRESSPOS:
2807 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2808 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2809 ok(pvaIn != NULL, "pvaIn == NULL\n");
2810 if(pvaIn) {
2811 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2812 if(load_state == LD_NO)
2813 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2814 }
2815 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2816 return S_OK;
2817 case OLECMDID_HTTPEQUIV_DONE:
2818 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2819 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2820 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2821 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2822 readystate_set_loading = FALSE;
2823 readystate_set_interactive = FALSE;
2824 load_state = LD_COMPLETE;
2825 return S_OK;
2826 case OLECMDID_SETDOWNLOADSTATE:
2827 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2828 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2829 ok(pvaIn != NULL, "pvaIn == NULL\n");
2830 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2831
2832 switch(V_I4(pvaIn)) {
2833 case 0:
2834 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2835 if(!loading_js)
2836 load_state = LD_INTERACTIVE;
2837 break;
2838 case 1:
2839 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2840 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2841 break;
2842 default:
2843 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2844 }
2845
2846 return S_OK;
2847 case OLECMDID_UPDATECOMMANDS:
2848 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2849 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2850 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2851 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2852 return S_OK;
2853 case OLECMDID_SETTITLE:
2854 CHECK_EXPECT2(Exec_SETTITLE);
2855 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2856 ok(pvaIn != NULL, "pvaIn == NULL\n");
2857 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2858 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2859 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2860 return S_OK;
2861 case OLECMDID_HTTPEQUIV:
2862 CHECK_EXPECT2(Exec_HTTPEQUIV);
2863 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2864 ok(pvaIn != NULL, "pvaIn == NULL\n");
2865 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2866 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2867 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2868 test_readyState(NULL);
2869 return S_OK;
2870 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY:
2871 case OLECMDID_PAGEAVAILABLE:
2872 case 6058:
2873 return E_FAIL; /* FIXME */
2874 default:
2875 ok(0, "unexpected command %d\n", nCmdID);
2876 return E_FAIL;
2877 };
2878 }
2879
2880 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2881 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2882
2883 switch(nCmdID) {
2884 case 37:
2885 CHECK_EXPECT2(Exec_ShellDocView_37);
2886
2887 if(is_refresh && load_state == LD_COMPLETE) {
2888 load_state = LD_DOLOAD;
2889 test_readyState(NULL);
2890 }else if(is_refresh && load_state == LD_DOLOAD) {
2891 test_readyState(NULL);
2892 load_state = LD_LOADING;
2893 }else {
2894 if(!is_refresh)
2895 test_readyState(NULL);
2896 if(nav_url)
2897 test_GetCurMoniker(doc_unk, NULL, nav_serv_url, FALSE);
2898 else if(load_from_stream)
2899 test_GetCurMoniker(doc_unk, NULL, "about:blank", FALSE);
2900 else if(!editmode)
2901 test_GetCurMoniker(doc_unk, doc_mon, NULL, FALSE);
2902 }
2903
2904 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2905 ok(pvaIn != NULL, "pvaIn == NULL\n");
2906 if(pvaIn) {
2907 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2908 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2909 }
2910 return S_OK;
2911
2912 case 62:
2913 CHECK_EXPECT(Exec_ShellDocView_62);
2914 ok(!pvaIn, "pvaIn != NULL\n");
2915 ok(!pvaOut, "pvaOut != NULL\n");
2916 return S_OK;
2917
2918 case 63: {
2919 IHTMLPrivateWindow *priv_window;
2920 HRESULT hres;
2921
2922 CHECK_EXPECT(Exec_ShellDocView_63);
2923 ok(pvaIn != NULL, "pvaIn == NULL\n");
2924 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2925 ok(V_UNKNOWN(pvaIn) != NULL, "VPUNKNOWN(pvaIn) = NULL\n");
2926 ok(pvaOut != NULL, "pvaOut == NULL\n");
2927 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2928
2929 hres = IUnknown_QueryInterface(V_UNKNOWN(pvaIn), &IID_IHTMLPrivateWindow, (void**)&priv_window);
2930 ok(hres == S_OK, "Could not get IHTMLPrivateWindow: %08x\n", hres);
2931 if(SUCCEEDED(hres))
2932 IHTMLPrivateWindow_Release(priv_window);
2933
2934 load_state = loading_js ? LD_COMPLETE : LD_LOADING;
2935 return S_OK; /* TODO */
2936 }
2937
2938 case 67:
2939 CHECK_EXPECT(Exec_ShellDocView_67);
2940 ok(pvaIn != NULL, "pvaIn == NULL\n");
2941 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2942 ok(!strcmp_wa(V_BSTR(pvaIn), nav_serv_url), "V_BSTR(pvaIn) = %s, expected \"%s\"\n",
2943 wine_dbgstr_w(V_BSTR(pvaIn)), nav_serv_url);
2944 ok(pvaOut != NULL, "pvaOut == NULL\n");
2945 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2946 ok(V_BOOL(pvaOut) == VARIANT_TRUE, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut));
2947 if(!loading_hash)
2948 load_state = LD_DOLOAD;
2949 return S_OK;
2950
2951 case 84:
2952 CHECK_EXPECT2(Exec_ShellDocView_84);
2953
2954 ok(pvaIn == NULL, "pvaIn != NULL\n");
2955 ok(pvaOut != NULL, "pvaOut == NULL\n");
2956 if(pvaIn)
2957 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2958
2959 test_readyState(NULL);
2960 return E_NOTIMPL;
2961
2962 case 103:
2963 CHECK_EXPECT2(Exec_ShellDocView_103);
2964
2965 ok(pvaIn == NULL, "pvaIn != NULL\n");
2966 ok(pvaOut == NULL, "pvaOut != NULL\n");
2967
2968 test_readyState(NULL);
2969 return E_NOTIMPL;
2970
2971 case 105:
2972 CHECK_EXPECT2(Exec_ShellDocView_105);
2973
2974 ok(pvaIn != NULL, "pvaIn == NULL\n");
2975 ok(pvaOut == NULL, "pvaOut != NULL\n");
2976
2977 test_readyState(NULL);
2978 return E_NOTIMPL;
2979
2980 case 138:
2981 CHECK_EXPECT2(Exec_ShellDocView_138);
2982 ok(!pvaIn, "pvaIn != NULL\n");
2983 ok(!pvaOut, "pvaOut != NULL\n");
2984 test_readyState(NULL);
2985 return S_OK;
2986
2987 case 140:
2988 CHECK_EXPECT2(Exec_ShellDocView_140);
2989
2990 ok(pvaIn == NULL, "pvaIn != NULL\n");
2991 ok(pvaOut == NULL, "pvaOut != NULL\n");
2992
2993 test_readyState(NULL);
2994 return E_NOTIMPL;
2995
2996 case 83:
2997 case 101:
2998 case 102:
2999 case 132:
3000 case 133:
3001 case 134: /* TODO */
3002 case 135:
3003 case 136: /* TODO */
3004 case 137:
3005 case 139: /* TODO */
3006 case 143: /* TODO */
3007 case 144: /* TODO */
3008 case 178:
3009 case 179:
3010 case 180:
3011 case 181:
3012 case 182:
3013 case 183:
3014 return E_NOTIMPL;
3015
3016 default:
3017 ok(0, "unexpected command %d\n", nCmdID);
3018 return E_FAIL;
3019 };
3020 }
3021
3022 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
3023 test_readyState(NULL);
3024 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
3025
3026 switch(nCmdID) {
3027 case IDM_PARSECOMPLETE:
3028 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
3029 ok(pvaIn == NULL, "pvaIn != NULL\n");
3030 ok(pvaOut == NULL, "pvaOut != NULL\n");
3031 return S_OK;
3032 default:
3033 ok(0, "unexpected command %d\n", nCmdID);
3034 };
3035 }
3036
3037 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup)) {
3038 switch(nCmdID) {
3039 case DOCHOST_DOCCANNAVIGATE:
3040 if(pvaIn) {
3041 CHECK_EXPECT(Exec_DOCCANNAVIGATE);
3042 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) != VT_UNKNOWN\n");
3043 /* FIXME: test V_UNKNOWN(pvaIn) == window */
3044 }else {
3045 CHECK_EXPECT(Exec_DOCCANNAVIGATE_NULL);
3046 }
3047
3048 test_readyState(NULL);
3049 ok(pvaOut == NULL, "pvaOut != NULL\n");
3050 return S_OK;
3051 case 1: {
3052 SAFEARRAY *sa;
3053 UINT dim;
3054 LONG ind=0;
3055 VARIANT var;
3056 HRESULT hres;
3057
3058 test_readyState(NULL);
3059
3060 ok(pvaIn != NULL, "pvaIn == NULL\n");
3061 ok(pvaOut != NULL || broken(!pvaOut), "pvaOut != NULL\n");
3062 ok(V_VT(pvaIn) == VT_ARRAY, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
3063 if(pvaOut)
3064 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
3065 sa = V_ARRAY(pvaIn);
3066
3067 dim = SafeArrayGetDim(sa);
3068 ok(dim == 1, "dim = %d\n", dim);
3069 hres = SafeArrayGetLBound(sa, 1, &ind);
3070 ok(hres == S_OK, "SafeArrayGetLBound failed: %x\n", hres);
3071 ok(ind == 0, "Lower bound = %d\n", ind);
3072 hres = SafeArrayGetUBound(sa, 1, &ind);
3073 ok(hres == S_OK, "SafeArrayGetUBound failed: %x\n", hres);
3074 ok(ind == 7 || ind == 8 /* IE11 */ ||broken(ind == 5), "Upper bound = %d\n", ind);
3075
3076 ind = 0;
3077 SafeArrayGetElement(sa, &ind, &var);
3078 ok(V_VT(&var) == VT_I4, "Incorrect data type: %d\n", V_VT(&var));
3079 ok(V_I4(&var) == status_code, "Incorrect error code: %d\n", V_I4(&var));
3080 VariantClear(&var);
3081 ind = 1;
3082 SafeArrayGetElement(sa, &ind, &var);
3083 ok(V_VT(&var) == VT_BSTR, "Incorrect data type: %d\n", V_VT(&var));
3084 ok(!strcmp_wa(V_BSTR(&var), "winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var)));
3085 VariantClear(&var);
3086 ind = 2;
3087 SafeArrayGetElement(sa, &ind, &var);
3088 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
3089 VariantClear(&var);
3090 ind = 3;
3091 SafeArrayGetElement(sa, &ind, &var);
3092 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
3093 VariantClear(&var);
3094 ind = 4;
3095 SafeArrayGetElement(sa, &ind, &var);
3096 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
3097 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
3098 VariantClear(&var);
3099 ind = 5;
3100 SafeArrayGetElement(sa, &ind, &var);
3101 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
3102 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
3103 VariantClear(&var);
3104 }
3105 default:
3106 return E_FAIL; /* TODO */
3107 }
3108 }
3109
3110 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
3111 test_readyState(NULL);
3112 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
3113
3114 switch(nCmdID) {
3115 case 38:
3116 CHECK_EXPECT2(Exec_Explorer_38);
3117 ok(pvaIn != NULL, "pvaIn == NULL\n");
3118 ok(V_VT(pvaIn) == VT_I4 , "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
3119 ok(!V_I4(pvaIn), "V_I4(pvaIn) = %d\n", V_I4(pvaIn));
3120 ok(!pvaOut, "pvaOut != NULL\n");
3121
3122 test_current_url(doc_unk, prev_url);
3123 if(!history_stream)
3124 test_save_history(doc_unk);
3125
3126 return S_OK;
3127 case 69:
3128 CHECK_EXPECT2(Exec_Explorer_69);
3129 ok(pvaIn == NULL, "pvaIn != NULL\n");
3130 ok(pvaOut != NULL, "pvaOut == NULL\n");
3131 return E_NOTIMPL;
3132 case 109: /* TODO */
3133 return E_NOTIMPL;
3134 default:
3135 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
3136 }
3137 return E_NOTIMPL;
3138 }
3139
3140 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
3141 test_readyState(NULL);
3142
3143 switch (nCmdID) {
3144 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
3145 SET_EXPECT(SetStatusText);
3146 ok(pvaIn == NULL, "pvaIn != NULL\n");
3147 ok(pvaOut == NULL, "pvaOut != NULL\n");
3148 return S_OK;
3149 case OLECMDID_SHOWSCRIPTERROR:
3150 /* TODO */
3151 return S_OK;
3152 case 2300:
3153 CHECK_EXPECT(Exec_DocHostCommandHandler_2300);
3154 return E_NOTIMPL;
3155 default:
3156 ok(0, "unexpected command %d\n", nCmdID);
3157 return E_FAIL;
3158 }
3159 }
3160
3161 ok(0, "unexpected pguidCmdGroup: %s\n", wine_dbgstr_guid(pguidCmdGroup));
3162 return E_NOTIMPL;
3163 }
3164
3165 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
3166 OleCommandTarget_QueryInterface,
3167 OleCommandTarget_AddRef,
3168 OleCommandTarget_Release,
3169 OleCommandTarget_QueryStatus,
3170 OleCommandTarget_Exec
3171 };
3172
3173 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
3174
3175 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
3176 {
3177 return QueryInterface(riid, ppv);
3178 }
3179
3180 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
3181 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3182 EXCEPINFO *pExcepInfo, UINT *puArgErr)
3183 {
3184 if(resetting_document)
3185 return E_FAIL;
3186
3187 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
3188 ok(pDispParams != NULL, "pDispParams == NULL\n");
3189 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
3190 ok(puArgErr != NULL, "puArgErr == NULL\n");
3191 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
3192 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
3193
3194 if(dispIdMember != DISPID_AMBIENT_SILENT && dispIdMember != DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)
3195 test_readyState(NULL);
3196
3197 switch(dispIdMember) {
3198 case DISPID_AMBIENT_USERMODE:
3199 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
3200 V_VT(pVarResult) = VT_BOOL;
3201 V_BOOL(pVarResult) = VARIANT_TRUE;
3202 return S_OK;
3203 case DISPID_AMBIENT_DLCONTROL:
3204 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
3205 return E_FAIL;
3206 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
3207 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3208 return E_FAIL;
3209 case DISPID_AMBIENT_SILENT:
3210 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
3211 V_VT(pVarResult) = VT_BOOL;
3212 V_BOOL(pVarResult) = VARIANT_FALSE;
3213 return S_OK;
3214 case DISPID_AMBIENT_USERAGENT:
3215 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
3216 return E_FAIL;
3217 case DISPID_AMBIENT_PALETTE:
3218 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
3219 return E_FAIL;
3220 };
3221
3222 ok(0, "unexpected dispid %d\n", dispIdMember);
3223 return E_FAIL;
3224 }
3225
3226 static const IDispatchVtbl DispatchVtbl = {
3227 Dispatch_QueryInterface,
3228 Dispatch_AddRef,
3229 Dispatch_Release,
3230 Dispatch_GetTypeInfoCount,
3231 Dispatch_GetTypeInfo,
3232 Dispatch_GetIDsOfNames,
3233 Dispatch_Invoke
3234 };
3235
3236 static IDispatch Dispatch = { &DispatchVtbl };
3237
3238 static HRESULT WINAPI EventDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
3239 {
3240 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
3241 *ppv = iface;
3242 return S_OK;
3243 }
3244
3245 ok(0, "Unexpected call\n");
3246 return E_NOINTERFACE;
3247 }
3248
3249 static HRESULT WINAPI EventDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
3250 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3251 EXCEPINFO *pExcepInfo, UINT *puArgErr)
3252 {
3253 HRESULT hres;
3254 IHTMLDocument2 *doc;
3255 BSTR state;
3256
3257 if(resetting_document)
3258 return E_FAIL;
3259
3260 ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
3261 ok(pDispParams != NULL, "pDispParams == NULL\n");
3262 ok(pExcepInfo != NULL, "pExcepInfo == NULL\n");
3263 ok(puArgErr != NULL, "puArgErr == NULL\n");
3264 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
3265 ok(wFlags == DISPATCH_METHOD, "wFlags = %d, expected DISPATCH_METHOD\n", wFlags);
3266
3267 hres = IUnknown_QueryInterface(doc_unk, &IID_IHTMLDocument2, (void**)&doc);
3268 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
3269
3270 switch(dispIdMember) {
3271 case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE:
3272 hres = IHTMLDocument2_get_readyState(doc, &state);
3273 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3274
3275 if(!strcmp_wa(state, "interactive"))
3276 CHECK_EXPECT(Invoke_OnReadyStateChange_Interactive);
3277 else if(!strcmp_wa(state, "loading"))
3278 CHECK_EXPECT(Invoke_OnReadyStateChange_Loading);
3279 else if(!strcmp_wa(state, "complete")) {
3280 CHECK_EXPECT(Invoke_OnReadyStateChange_Complete);
3281 complete = TRUE;
3282 } else
3283 ok(0, "Unexpected readyState: %s\n", wine_dbgstr_w(state));
3284
3285 SysFreeString(state);
3286 break;
3287 case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE:
3288 case 1026:
3289 case 1027:
3290 case 1034:
3291 case 1035:
3292 case 1037:
3293 case 1047:
3294 case 1045:
3295 case 1044:
3296 case 1048:
3297 case 1049:
3298 break; /* FIXME: Handle these events. */
3299 default:
3300 ok(0, "Unexpected DISPID: %d\n", dispIdMember);
3301 }
3302
3303 IHTMLDocument2_Release(doc);
3304 return S_OK;
3305 }
3306
3307 static const IDispatchVtbl EventDispatchVtbl = {
3308 EventDispatch_QueryInterface,
3309 Dispatch_AddRef,
3310 Dispatch_Release,
3311 Dispatch_GetTypeInfoCount,
3312 Dispatch_GetTypeInfo,
3313 Dispatch_GetIDsOfNames,
3314 EventDispatch_Invoke
3315 };
3316
3317 static IDispatch EventDispatch = { &EventDispatchVtbl };
3318
3319 static HRESULT WINAPI TravelLog_QueryInterface(ITravelLog *iface, REFIID riid, void **ppv)
3320 {
3321 static const IID IID_IIETravelLog2 = {0xb67cefd2,0xe3f1,0x478a,{0x9b,0xfa,0xd8,0x93,0x70,0x37,0x5e,0x94}};
3322 static const IID IID_unk_travellog = {0x6afc8b7f,0xbc17,0x4a95,{0x90,0x2f,0x6f,0x5c,0xb5,0x54,0xc3,0xd8}};
3323 static const IID IID_unk_travellog2 = {0xf6d02767,0x9c80,0x428d,{0xb9,0x74,0x3f,0x17,0x29,0x45,0x3f,0xdb}};
3324
3325 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ITravelLog, riid)) {
3326 *ppv = iface;
3327 return S_OK;
3328 }
3329
3330 if(!IsEqualGUID(&IID_IIETravelLog2, riid) && !IsEqualGUID(&IID_unk_travellog, riid)
3331 && !IsEqualGUID(&IID_unk_travellog2, riid))
3332 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
3333
3334 *ppv = NULL;
3335 return E_NOINTERFACE;
3336 }
3337
3338 static ULONG WINAPI TravelLog_AddRef(ITravelLog *iface)
3339 {
3340 return 2;
3341 }
3342
3343 static ULONG WINAPI TravelLog_Release(ITravelLog *iface)
3344 {
3345 return 1;
3346 }
3347
3348 static HRESULT WINAPI TravelLog_AddEntry(ITravelLog *iface, IUnknown *punk, BOOL fIsLocalAnchor)
3349 {
3350 ok(0, "unexpected call\n");
3351 return E_NOTIMPL;
3352 }
3353
3354 static HRESULT WINAPI TravelLog_UpdateEntry(ITravelLog *iface, IUnknown *punk, BOOL fIsLocalAnchor)
3355 {
3356 ok(0, "unexpected call\n");
3357 return E_NOTIMPL;
3358 }
3359
3360 static HRESULT WINAPI TravelLog_UpdateExternal(ITravelLog *iface, IUnknown *punk, IUnknown *punkHLBrowseContext)
3361 {
3362 ok(0, "unexpected call\n");
3363 return E_NOTIMPL;
3364 }
3365
3366 static HRESULT WINAPI TravelLog_Travel(ITravelLog *iface, IUnknown *punk, int iOffset)
3367 {
3368 ok(0, "unexpected call\n");
3369 return E_NOTIMPL;
3370 }
3371
3372 static HRESULT WINAPI TravelLog_GetTravelEntry(ITravelLog *iface, IUnknown *punk, int iOffset, ITravelEntry **ppte)
3373 {
3374 ok(0, "unexpected call\n");
3375 return E_NOTIMPL;
3376 }
3377
3378 static HRESULT WINAPI TravelLog_FindTravelEntry(ITravelLog *iface, IUnknown *punk, LPCITEMIDLIST pidl, ITravelEntry **ppte)
3379 {
3380 ok(0, "unexpected call\n");
3381 return E_NOTIMPL;
3382 }
3383
3384 static HRESULT WINAPI TravelLog_GetTooltipText(ITravelLog *iface, IUnknown *punk, int iOffset, int idsTemplate,
3385 LPWSTR pwzText, DWORD cchText)
3386 {
3387 ok(0, "unexpected call\n");
3388 return E_NOTIMPL;
3389 }
3390
3391 static HRESULT WINAPI TravelLog_InsertMenuEntries(ITravelLog *iface, IUnknown *punk, HMENU hmenu, int nPos,
3392 int idFirst, int idLast, DWORD dwFlags)
3393 {
3394 ok(0, "unexpected call\n");
3395 return E_NOTIMPL;
3396 }
3397
3398 static HRESULT WINAPI TravelLog_Clone(ITravelLog *iface, ITravelLog **pptl)
3399 {
3400 ok(0, "unexpected call\n");
3401 return E_NOTIMPL;
3402 }
3403
3404 static IBrowserService BrowserService;
3405 static DWORD WINAPI TravelLog_CountEntries(ITravelLog *iface, IUnknown *punk)
3406 {
3407 CHECK_EXPECT(CountEntries);
3408
3409 ok(punk == (IUnknown*)&BrowserService, "punk != &BrowserService (%p)\n", punk);
3410 return 0;
3411 }
3412
3413 static HRESULT WINAPI TravelLog_Revert(ITravelLog *iface)
3414 {
3415 ok(0, "unexpected call\n");
3416 return E_NOTIMPL;
3417 }
3418
3419 static const ITravelLogVtbl TravelLogVtbl = {
3420 TravelLog_QueryInterface,
3421 TravelLog_AddRef,
3422 TravelLog_Release,
3423 TravelLog_AddEntry,
3424 TravelLog_UpdateEntry,
3425 TravelLog_UpdateExternal,
3426 TravelLog_Travel,
3427 TravelLog_GetTravelEntry,
3428 TravelLog_FindTravelEntry,
3429 TravelLog_GetTooltipText,
3430 TravelLog_InsertMenuEntries,
3431 TravelLog_Clone,
3432 TravelLog_CountEntries,
3433 TravelLog_Revert
3434 };
3435
3436 static ITravelLog TravelLog = { &TravelLogVtbl };
3437
3438 static HRESULT browserservice_qi(REFIID,void**);
3439
3440 static HRESULT WINAPI DocObjectService_QueryInterface(IDocObjectService* This, REFIID riid, void **ppv)
3441 {
3442 return browserservice_qi(riid, ppv);
3443 }
3444
3445 static ULONG WINAPI DocObjectService_AddRef(
3446 IDocObjectService* This)
3447 {
3448 return 2;
3449 }
3450
3451 static ULONG WINAPI DocObjectService_Release(
3452 IDocObjectService* This