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