shell32: Add a travellog to the ExplorerBrowser control.
[wine.git] / dlls / shell32 / tests / ebrowser.c
blob809a7fc97edfcda6d2d55bbc03a6c5ef00f9a125
1 /*
2 * Unit tests for the Explorer Browser control
4 * Copyright 2010 David Hedberg
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdio.h>
23 #define COBJMACROS
25 #include "shlobj.h"
27 #include "wine/test.h"
29 static HWND hwnd;
31 static HRESULT (WINAPI *pSHCreateShellItem)(LPCITEMIDLIST,IShellFolder*,LPCITEMIDLIST,IShellItem**);
32 static HRESULT (WINAPI *pSHParseDisplayName)(LPCWSTR,IBindCtx*,LPITEMIDLIST*,SFGAOF,SFGAOF*);
34 static void init_function_pointers(void)
36 HMODULE hmod;
38 hmod = GetModuleHandleA("shell32.dll");
39 pSHCreateShellItem = (void*)GetProcAddress(hmod, "SHCreateShellItem");
40 pSHParseDisplayName = (void*)GetProcAddress(hmod, "SHParseDisplayName");
43 /*********************************************************************
44 * Some simple helpers
46 static HRESULT ebrowser_instantiate(IExplorerBrowser **peb)
48 return CoCreateInstance(&CLSID_ExplorerBrowser, NULL, CLSCTX_INPROC_SERVER,
49 &IID_IExplorerBrowser, (void**)peb);
52 static HRESULT ebrowser_initialize(IExplorerBrowser *peb)
54 RECT rc;
55 rc.top = rc.left = 0; rc.bottom = rc.right = 500;
56 return IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
59 static HRESULT ebrowser_browse_to_desktop(IExplorerBrowser *peb)
61 LPITEMIDLIST pidl_desktop;
62 SHGetSpecialFolderLocation (hwnd, CSIDL_DESKTOP, &pidl_desktop);
63 return IExplorerBrowser_BrowseToIDList(peb, pidl_desktop, 0);
66 /* Process some messages */
67 static void process_msgs(void)
69 MSG msg;
70 while(PeekMessage( &msg, NULL, 0, 0, PM_REMOVE))
72 TranslateMessage(&msg);
73 DispatchMessage(&msg);
77 /*********************************************************************
78 * IExplorerBrowserEvents implementation
80 typedef struct {
81 const IExplorerBrowserEventsVtbl *lpVtbl;
82 LONG ref;
83 UINT pending, created, completed, failed;
84 } IExplorerBrowserEventsImpl;
86 static IExplorerBrowserEventsImpl ebev;
88 static HRESULT WINAPI IExplorerBrowserEvents_fnQueryInterface(IExplorerBrowserEvents *iface,
89 REFIID riid, void **ppvObj)
91 ok(0, "Never called.\n");
92 return E_NOINTERFACE;
95 static ULONG WINAPI IExplorerBrowserEvents_fnAddRef(IExplorerBrowserEvents *iface)
97 IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface;
98 return InterlockedIncrement(&This->ref);
101 static ULONG WINAPI IExplorerBrowserEvents_fnRelease(IExplorerBrowserEvents *iface)
103 IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface;
104 return InterlockedDecrement(&This->ref);
107 static HRESULT WINAPI IExplorerBrowserEvents_fnOnNavigationPending(IExplorerBrowserEvents *iface,
108 PCIDLIST_ABSOLUTE pidlFolder)
110 IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface;
111 This->pending++;
112 return S_OK;
115 static HRESULT WINAPI IExplorerBrowserEvents_fnOnNavigationComplete(IExplorerBrowserEvents *iface,
116 PCIDLIST_ABSOLUTE pidlFolder)
118 IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface;
119 This->completed++;
120 return S_OK;
122 static HRESULT WINAPI IExplorerBrowserEvents_fnOnNavigationFailed(IExplorerBrowserEvents *iface,
123 PCIDLIST_ABSOLUTE pidlFolder)
125 IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface;
126 This->failed++;
127 return S_OK;
129 static HRESULT WINAPI IExplorerBrowserEvents_fnOnViewCreated(IExplorerBrowserEvents *iface,
130 IShellView *psv)
132 IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface;
133 This->created++;
134 return S_OK;
137 static const IExplorerBrowserEventsVtbl ebevents =
139 IExplorerBrowserEvents_fnQueryInterface,
140 IExplorerBrowserEvents_fnAddRef,
141 IExplorerBrowserEvents_fnRelease,
142 IExplorerBrowserEvents_fnOnNavigationPending,
143 IExplorerBrowserEvents_fnOnViewCreated,
144 IExplorerBrowserEvents_fnOnNavigationComplete,
145 IExplorerBrowserEvents_fnOnNavigationFailed
148 static void test_QueryInterface(void)
150 IExplorerBrowser *peb;
151 IUnknown *punk;
152 HRESULT hr;
153 LONG lres;
155 hr = ebrowser_instantiate(&peb);
156 ok(hr == S_OK, "Got 0x%08x\n", hr);
158 #define test_qinterface(iid, exp) \
159 do { \
160 hr = IExplorerBrowser_QueryInterface(peb, &iid, (void**)&punk); \
161 ok(hr == exp, "(%s:)Expected (0x%08x), got (0x%08x)\n", \
162 #iid, exp, hr); \
163 if(SUCCEEDED(hr)) IUnknown_Release(punk); \
164 } while(0)
166 test_qinterface(IID_IUnknown, S_OK);
167 test_qinterface(IID_IExplorerBrowser, S_OK);
168 test_qinterface(IID_IShellBrowser, S_OK);
169 todo_wine test_qinterface(IID_IOleWindow, S_OK);
170 todo_wine test_qinterface(IID_ICommDlgBrowser, S_OK);
171 todo_wine test_qinterface(IID_ICommDlgBrowser2, S_OK);
172 todo_wine test_qinterface(IID_ICommDlgBrowser3, S_OK);
173 todo_wine test_qinterface(IID_IServiceProvider, S_OK);
174 todo_wine test_qinterface(IID_IObjectWithSite, S_OK);
175 todo_wine test_qinterface(IID_IConnectionPointContainer, S_OK);
176 test_qinterface(IID_IOleObject, E_NOINTERFACE);
177 test_qinterface(IID_IViewObject, E_NOINTERFACE);
178 test_qinterface(IID_IViewObject2, E_NOINTERFACE);
179 test_qinterface(IID_IViewObjectEx, E_NOINTERFACE);
180 test_qinterface(IID_IConnectionPoint, E_NOINTERFACE);
181 test_qinterface(IID_IShellView, E_NOINTERFACE);
182 test_qinterface(IID_INameSpaceTreeControlEvents, E_NOINTERFACE);
184 #undef test_qinterface
186 lres = IExplorerBrowser_Release(peb);
187 ok(lres == 0, "Got %d\n", lres);
190 static void test_SB_misc(void)
192 IExplorerBrowser *peb;
193 IShellBrowser *psb;
194 IUnknown *punk;
195 HRESULT hr;
196 HWND retHwnd;
197 LRESULT lres;
198 LONG ref;
200 ebrowser_instantiate(&peb);
201 hr = IExplorerBrowser_QueryInterface(peb, &IID_IShellBrowser, (void**)&psb);
202 ok(hr == S_OK, "Got 0x%08x\n", hr);
203 if(FAILED(hr))
205 skip("Failed to get IShellBrowser interface.\n");
206 return;
209 /* Some unimplemented methods */
210 retHwnd = (HWND)0xDEADBEEF;
211 hr = IShellBrowser_GetControlWindow(psb, FCW_TOOLBAR, &retHwnd);
212 ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
213 ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n");
215 hr = IShellBrowser_GetControlWindow(psb, FCW_STATUS, &retHwnd);
216 ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
217 ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n");
219 hr = IShellBrowser_GetControlWindow(psb, FCW_TREE, &retHwnd);
220 ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
221 ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n");
223 hr = IShellBrowser_GetControlWindow(psb, FCW_PROGRESS, &retHwnd);
224 ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
225 ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n");
227 /* ::InsertMenuSB */
228 hr = IShellBrowser_InsertMenusSB(psb, NULL, NULL);
229 ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
231 /* ::RemoveMenusSB */
232 hr = IShellBrowser_RemoveMenusSB(psb, NULL);
233 ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
235 /* ::SetMenuSB */
236 hr = IShellBrowser_SetMenuSB(psb, NULL, NULL, NULL);
237 ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
239 /***** Before EB::Initialize *****/
241 /* ::GetWindow */
242 retHwnd = (HWND)0xDEADBEEF;
243 hr = IShellBrowser_GetWindow(psb, &retHwnd);
244 ok(hr == E_FAIL, "got (0x%08x)\n", hr);
245 ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n");
247 todo_wine
250 /* ::SendControlMsg */
251 lres = 0xDEADBEEF;
252 hr = IShellBrowser_SendControlMsg(psb, FCW_STATUS, 0, 0, 0, &lres);
253 ok(hr == S_OK, "got (0x%08x)\n", hr);
254 ok(lres == 0, "lres was %ld\n", lres);
256 lres = 0xDEADBEEF;
257 hr = IShellBrowser_SendControlMsg(psb, FCW_TOOLBAR, TB_CHECKBUTTON,
258 FCIDM_TB_SMALLICON, TRUE, &lres);
259 ok(hr == S_OK, "got (0x%08x)\n", hr);
260 ok(lres == 0, "lres was %ld\n", lres);
262 hr = IShellBrowser_SendControlMsg(psb, FCW_STATUS, 0, 0, 0, NULL);
263 ok(hr == S_OK, "got (0x%08x)\n", hr);
265 hr = IShellBrowser_SendControlMsg(psb, FCW_TREE, 0, 0, 0, NULL);
266 ok(hr == S_OK, "got (0x%08x)\n", hr);
268 hr = IShellBrowser_SendControlMsg(psb, FCW_PROGRESS, 0, 0, 0, NULL);
269 ok(hr == S_OK, "got (0x%08x)\n", hr);
272 /* ::QueryActiveShellView */
273 hr = IShellBrowser_QueryActiveShellView(psb, (IShellView**)&punk);
274 ok(hr == E_FAIL, "got (0x%08x)\n", hr);
276 /* Initialize ExplorerBrowser */
277 ebrowser_initialize(peb);
279 /***** After EB::Initialize *****/
281 /* ::GetWindow */
282 hr = IShellBrowser_GetWindow(psb, &retHwnd);
283 ok(hr == S_OK, "got (0x%08x)\n", hr);
284 ok(GetParent(retHwnd) == hwnd, "The HWND returned is not our child.\n");
286 todo_wine
288 /* ::SendControlMsg */
289 hr = IShellBrowser_SendControlMsg(psb, FCW_STATUS, 0, 0, 0, NULL);
290 ok(hr == S_OK, "got (0x%08x)\n", hr);
292 lres = 0xDEADBEEF;
293 hr = IShellBrowser_SendControlMsg(psb, FCW_TOOLBAR, 0, 0, 0, &lres);
294 ok(hr == S_OK, "got (0x%08x)\n", hr);
295 ok(lres == 0, "lres was %ld\n", lres);
297 lres = 0xDEADBEEF;
298 hr = IShellBrowser_SendControlMsg(psb, FCW_STATUS, 0, 0, 0, &lres);
299 ok(hr == S_OK, "got (0x%08x)\n", hr);
300 ok(lres == 0, "lres was %ld\n", lres);
302 lres = 0xDEADBEEF;
303 hr = IShellBrowser_SendControlMsg(psb, 1234, 0, 0, 0, &lres);
304 ok(hr == S_OK, "got (0x%08x)\n", hr);
305 ok(lres == 0, "lres was %ld\n", lres);
307 /* Returns S_OK */
308 hr = IShellBrowser_SetStatusTextSB(psb, NULL);
309 ok(hr == S_OK, "got (0x%08x)\n", hr);
311 hr = IShellBrowser_ContextSensitiveHelp(psb, FALSE);
312 ok(hr == S_OK, "got (0x%08x)\n", hr);
314 hr = IShellBrowser_EnableModelessSB(psb, TRUE);
315 ok(hr == S_OK, "got (0x%08x)\n", hr);
317 hr = IShellBrowser_SetToolbarItems(psb, NULL, 1, 1);
318 ok(hr == S_OK, "got (0x%08x)\n", hr);
321 hr = IShellBrowser_QueryActiveShellView(psb, (IShellView**)&punk);
322 ok(hr == E_FAIL, "got (0x%08x)\n", hr);
324 IShellBrowser_Release(psb);
325 IExplorerBrowser_Destroy(peb);
326 IExplorerBrowser_Release(peb);
328 /* Browse to the desktop. */
329 ebrowser_instantiate(&peb);
330 ebrowser_initialize(peb);
331 IExplorerBrowser_QueryInterface(peb, &IID_IShellBrowser, (void**)&psb);
333 process_msgs();
334 hr = ebrowser_browse_to_desktop(peb);
335 ok(hr == S_OK, "got (0x%08x)\n", hr);
336 process_msgs();
338 /****** After Browsing *****/
340 hr = IShellBrowser_QueryActiveShellView(psb, (IShellView**)&punk);
341 ok(hr == S_OK, "got (0x%08x)\n", hr);
342 if(SUCCEEDED(hr)) IUnknown_Release(punk);
344 IShellBrowser_Release(psb);
345 IExplorerBrowser_Destroy(peb);
346 ref = IExplorerBrowser_Release(peb);
347 ok(ref == 0, "Got %d\n", ref);
350 static void test_initialization(void)
352 IExplorerBrowser *peb;
353 IShellBrowser *psb;
354 HRESULT hr;
355 ULONG lres;
356 RECT rc;
358 ebrowser_instantiate(&peb);
360 if(0)
362 /* Crashes on Windows 7 */
363 hr = IExplorerBrowser_Initialize(peb, NULL, NULL, NULL);
364 hr = IExplorerBrowser_Initialize(peb, hwnd, NULL, NULL);
367 ZeroMemory(&rc, sizeof(RECT));
369 hr = IExplorerBrowser_Initialize(peb, NULL, &rc, NULL);
370 ok(hr == E_INVALIDARG, "got (0x%08x)\n", hr);
372 hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
373 ok(hr == S_OK, "got (0x%08x)\n", hr);
375 /* Initialize twice */
376 hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
377 ok(hr == E_UNEXPECTED, "got (0x%08x)\n", hr);
379 hr = IExplorerBrowser_Destroy(peb);
380 ok(hr == S_OK, "got (0x%08x)\n", hr);
382 /* Initialize again */
383 hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
384 ok(hr == E_UNEXPECTED, "got (0x%08x)\n", hr);
386 /* Destroy again */
387 hr = IExplorerBrowser_Destroy(peb);
388 ok(hr == S_OK, "got (0x%08x)\n", hr);
389 lres = IExplorerBrowser_Release(peb);
390 ok(lres == 0, "Got %d\n", lres);
392 /* Initialize with a few different rectangles */
393 peb = NULL;
394 ebrowser_instantiate(&peb);
395 rc.left = 50; rc.top = 20; rc.right = 100; rc.bottom = 80;
396 hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
397 ok(hr == S_OK, "got (0x%08x)\n", hr);
398 hr = IExplorerBrowser_QueryInterface(peb, &IID_IShellBrowser, (void**)&psb);
399 ok(hr == S_OK, "Got 0x%08x\n", hr);
400 if(SUCCEEDED(hr))
402 HWND eb_hwnd;
403 RECT eb_rc;
404 char buf[1024];
405 LONG style, expected_style;
406 static const RECT exp_rc = {0, 0, 48, 58};
408 hr = IShellBrowser_GetWindow(psb, &eb_hwnd);
409 ok(hr == S_OK, "Got 0x%08x\n", hr);
411 GetClientRect(eb_hwnd, &eb_rc);
412 ok(EqualRect(&eb_rc, &exp_rc), "Got client rect (%d, %d)-(%d, %d)\n",
413 eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom);
415 GetWindowRect(eb_hwnd, &eb_rc);
416 ok(eb_rc.right - eb_rc.left == 50, "Got window width %d\n", eb_rc.right - eb_rc.left);
417 ok(eb_rc.bottom - eb_rc.top == 60, "Got window height %d\n", eb_rc.bottom - eb_rc.top);
419 buf[0] = '\0';
420 GetClassNameA(eb_hwnd, buf, 1024);
421 ok(!lstrcmpA(buf, "ExplorerBrowserControl"), "Unexpected classname %s\n", buf);
423 expected_style = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_BORDER;
424 style = GetWindowLongPtrW(eb_hwnd, GWL_STYLE);
425 todo_wine ok(style == expected_style, "Got style 0x%08x, expected 0x%08x\n", style, expected_style);
427 expected_style = WS_EX_CONTROLPARENT;
428 style = GetWindowLongPtrW(eb_hwnd, GWL_EXSTYLE);
429 ok(style == expected_style, "Got exstyle 0x%08x, expected 0x%08x\n", style, expected_style);
431 ok(GetParent(eb_hwnd) == hwnd, "GetParent returns %p\n", GetParent(eb_hwnd));
433 /* ::Destroy() destroys the window. */
434 ok(IsWindow(eb_hwnd), "eb_hwnd invalid.\n");
435 IExplorerBrowser_Destroy(peb);
436 ok(!IsWindow(eb_hwnd), "eb_hwnd valid.\n");
438 IShellBrowser_Release(psb);
439 lres = IExplorerBrowser_Release(peb);
440 ok(lres == 0, "Got refcount %d\n", lres);
442 else
444 skip("Skipping some tests.\n");
446 IExplorerBrowser_Destroy(peb);
447 lres = IExplorerBrowser_Release(peb);
448 ok(lres == 0, "Got refcount %d\n", lres);
451 ebrowser_instantiate(&peb);
452 rc.left = 0; rc.top = 0; rc.right = 0; rc.bottom = 0;
453 hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
454 ok(hr == S_OK, "got (0x%08x)\n", hr);
455 IExplorerBrowser_Destroy(peb);
456 lres = IExplorerBrowser_Release(peb);
457 ok(lres == 0, "Got refcount %d\n", lres);
459 ebrowser_instantiate(&peb);
460 rc.left = -1; rc.top = -1; rc.right = 1; rc.bottom = 1;
461 hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
462 ok(hr == S_OK, "got (0x%08x)\n", hr);
463 IExplorerBrowser_Destroy(peb);
464 lres = IExplorerBrowser_Release(peb);
465 ok(lres == 0, "Got refcount %d\n", lres);
467 ebrowser_instantiate(&peb);
468 rc.left = 10; rc.top = 10; rc.right = 5; rc.bottom = 5;
469 hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
470 ok(hr == S_OK, "got (0x%08x)\n", hr);
471 IExplorerBrowser_Destroy(peb);
472 lres = IExplorerBrowser_Release(peb);
473 ok(lres == 0, "Got refcount %d\n", lres);
475 ebrowser_instantiate(&peb);
476 rc.left = 10; rc.top = 10; rc.right = 5; rc.bottom = 5;
477 hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
478 ok(hr == S_OK, "got (0x%08x)\n", hr);
479 IExplorerBrowser_Destroy(peb);
480 lres = IExplorerBrowser_Release(peb);
481 ok(lres == 0, "Got refcount %d\n", lres);
484 static void test_basics(void)
486 IExplorerBrowser *peb;
487 IShellBrowser *psb;
488 FOLDERSETTINGS fs;
489 ULONG lres;
490 DWORD flags;
491 HDWP hdwp;
492 RECT rc;
493 HRESULT hr;
495 ebrowser_instantiate(&peb);
496 ebrowser_initialize(peb);
498 /* SetRect */
499 rc.left = 0; rc.top = 0; rc.right = 0; rc.bottom = 0;
500 hr = IExplorerBrowser_SetRect(peb, NULL, rc);
501 ok(hr == S_OK, "got (0x%08x)\n", hr);
503 rc.left = 100; rc.top = 100; rc.right = 10; rc.bottom = 10;
504 hr = IExplorerBrowser_SetRect(peb, NULL, rc);
505 ok(hr == S_OK, "got (0x%08x)\n", hr);
507 /* SetRect with DeferWindowPos */
508 rc.left = rc.top = 0; rc.right = rc.bottom = 10;
509 hdwp = BeginDeferWindowPos(1);
510 hr = IExplorerBrowser_SetRect(peb, &hdwp, rc);
511 ok(hr == S_OK, "got (0x%08x)\n", hr);
512 lres = EndDeferWindowPos(hdwp);
513 ok(lres, "EndDeferWindowPos failed.\n");
515 hdwp = NULL;
516 hr = IExplorerBrowser_SetRect(peb, &hdwp, rc);
517 ok(hr == S_OK, "got (0x%08x)\n", hr);
518 ok(hdwp == NULL, "got %p\n", hdwp);
519 lres = EndDeferWindowPos(hdwp);
520 ok(!lres, "EndDeferWindowPos succeeded unexpectedly.\n");
522 /* Test positioning */
523 rc.left = 10; rc.top = 20; rc.right = 50; rc.bottom = 50;
524 hr = IExplorerBrowser_SetRect(peb, NULL, rc);
525 ok(hr == S_OK, "got (0x%08x)\n", hr);
526 hr = IExplorerBrowser_QueryInterface(peb, &IID_IShellBrowser, (void**)&psb);
527 ok(hr == S_OK, "Got 0x%08x\n", hr);
528 if(SUCCEEDED(hr))
530 HWND eb_hwnd;
531 RECT eb_rc;
532 static const RECT exp_rc = {11, 21, 49, 49};
534 hr = IShellBrowser_GetWindow(psb, &eb_hwnd);
535 ok(hr == S_OK, "Got 0x%08x\n", hr);
537 GetClientRect(eb_hwnd, &eb_rc);
538 MapWindowPoints(eb_hwnd, hwnd, (POINT*)&eb_rc, 2);
539 ok(EqualRect(&eb_rc, &exp_rc), "Got rect (%d, %d) - (%d, %d)\n",
540 eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom);
542 IShellBrowser_Release(psb);
545 IExplorerBrowser_Destroy(peb);
546 IExplorerBrowser_Release(peb);
548 /* GetOptions/SetOptions*/
549 ebrowser_instantiate(&peb);
551 if(0) {
552 /* Crashes on Windows 7 */
553 IExplorerBrowser_GetOptions(peb, NULL);
556 hr = IExplorerBrowser_GetOptions(peb, &flags);
557 ok(hr == S_OK, "got (0x%08x)\n", hr);
558 ok(flags == 0, "got (0x%08x)\n", flags);
560 /* Settings preserved through Initialize. */
561 hr = IExplorerBrowser_SetOptions(peb, 0xDEADBEEF);
562 ok(hr == S_OK, "got (0x%08x)\n", hr);
564 ebrowser_initialize(peb);
566 hr = IExplorerBrowser_GetOptions(peb, &flags);
567 ok(flags == 0xDEADBEEF, "got (0x%08x)\n", flags);
568 ok(hr == S_OK, "got (0x%08x)\n", hr);
570 IExplorerBrowser_Destroy(peb);
571 IExplorerBrowser_Release(peb);
573 ebrowser_instantiate(&peb);
574 ebrowser_initialize(peb);
576 /* SetFolderSettings */
577 hr = IExplorerBrowser_SetFolderSettings(peb, NULL);
578 ok(hr == E_INVALIDARG, "got (0x%08x)\n", hr);
579 fs.ViewMode = 0; fs.fFlags = 0;
580 hr = IExplorerBrowser_SetFolderSettings(peb, &fs);
581 todo_wine ok(hr == E_INVALIDARG, "got (0x%08x)\n", hr);
583 /* TODO: Test after browsing somewhere. */
585 IExplorerBrowser_Destroy(peb);
586 lres = IExplorerBrowser_Release(peb);
587 ok(lres == 0, "Got %d\n", lres);
590 static void test_Advise(void)
592 IExplorerBrowser *peb;
593 IExplorerBrowserEvents *pebe;
594 DWORD cookies[10];
595 HRESULT hr;
596 UINT i, ref;
598 /* Set up our IExplorerBrowserEvents implementation */
599 ebev.lpVtbl = &ebevents;
600 pebe = (IExplorerBrowserEvents*) &ebev;
602 ebrowser_instantiate(&peb);
604 if(0)
606 /* Crashes on Windows 7 */
607 IExplorerBrowser_Advise(peb, pebe, NULL);
608 IExplorerBrowser_Advise(peb, NULL, &cookies[0]);
611 /* Using Unadvise with a cookie that has yet to be given out
612 * results in E_INVALIDARG */
613 hr = IExplorerBrowser_Unadvise(peb, 11);
614 ok(hr == E_INVALIDARG, "got (0x%08x)\n", hr);
616 /* Add some before initialization */
617 for(i = 0; i < 5; i++)
619 hr = IExplorerBrowser_Advise(peb, pebe, &cookies[i]);
620 ok(hr == S_OK, "got (0x%08x)\n", hr);
623 ebrowser_initialize(peb);
625 /* Add some after initialization */
626 for(i = 5; i < 10; i++)
628 hr = IExplorerBrowser_Advise(peb, pebe, &cookies[i]);
629 ok(hr == S_OK, "got (0x%08x)\n", hr);
632 ok(ebev.ref == 10, "Got %d\n", ebev.ref);
634 ebev.completed = 0;
635 ebrowser_browse_to_desktop(peb);
636 process_msgs();
637 ok(ebev.completed == 10, "Got %d\n", ebev.completed);
639 /* Remove a bunch somewhere in the middle */
640 for(i = 4; i < 8; i++)
642 hr = IExplorerBrowser_Unadvise(peb, cookies[i]);
643 ok(hr == S_OK, "got (0x%08x)\n", hr);
646 ebev.completed = 0;
647 ebrowser_browse_to_desktop(peb);
648 process_msgs();
649 ok(ebev.completed == 6, "Got %d\n", ebev.completed);
651 if(0)
653 /* Using unadvise with a previously unadvised cookie results
654 * in a crash. */
655 hr = IExplorerBrowser_Unadvise(peb, cookies[5]);
658 /* Remove the rest. */
659 for(i = 0; i < 10; i++)
661 if(i<4||i>7)
663 hr = IExplorerBrowser_Unadvise(peb, cookies[i]);
664 ok(hr == S_OK, "%d: got (0x%08x)\n", i, hr);
668 ok(ebev.ref == 0, "Got %d\n", ebev.ref);
670 ebev.completed = 0;
671 ebrowser_browse_to_desktop(peb);
672 process_msgs();
673 ok(ebev.completed == 0, "Got %d\n", ebev.completed);
675 /* ::Destroy implies ::Unadvise. */
676 hr = IExplorerBrowser_Advise(peb, pebe, &cookies[0]);
677 ok(hr == S_OK, "Got 0x%08x\n", hr);
678 ok(ebev.ref == 1, "Got %d\n", ebev.ref);
680 hr = IExplorerBrowser_Destroy(peb);
681 ok(hr == S_OK, "Got 0x%08x\n", hr);
682 ok(ebev.ref == 0, "Got %d\n", ebev.ref);
684 ref = IExplorerBrowser_Release(peb);
685 ok(!ref, "Got %d", ref);
688 /* Based on PathAddBackslashW from dlls/shlwapi/path.c */
689 static LPWSTR myPathAddBackslashW( LPWSTR lpszPath )
691 size_t iLen;
693 if (!lpszPath || (iLen = lstrlenW(lpszPath)) >= MAX_PATH)
694 return NULL;
696 if (iLen)
698 lpszPath += iLen;
699 if (lpszPath[-1] != '\\')
701 *lpszPath++ = '\\';
702 *lpszPath = '\0';
705 return lpszPath;
708 static void test_browse_pidl_(IExplorerBrowser *peb, IExplorerBrowserEventsImpl *ebev,
709 LPITEMIDLIST pidl, UINT uFlags,
710 HRESULT hr_exp, UINT pending, UINT created, UINT failed, UINT completed,
711 const char *file, int line)
713 HRESULT hr;
714 ebev->completed = ebev->created = ebev->pending = ebev->failed = 0;
716 hr = IExplorerBrowser_BrowseToIDList(peb, pidl, uFlags);
717 ok_(file, line) (hr == hr_exp, "BrowseToIDList returned 0x%08x\n", hr);
718 process_msgs();
720 ok_(file, line)
721 (ebev->pending == pending && ebev->created == created &&
722 ebev->failed == failed && ebev->completed == completed,
723 "Events occurred: %d, %d, %d, %d\n",
724 ebev->pending, ebev->created, ebev->failed, ebev->completed);
726 #define test_browse_pidl(peb, ebev, pidl, uFlags, hr, p, cr, f, co) \
727 test_browse_pidl_(peb, ebev, pidl, uFlags, hr, p, cr, f, co, __FILE__, __LINE__)
729 static void test_browse_pidl_sb_(IExplorerBrowser *peb, IExplorerBrowserEventsImpl *ebev,
730 LPITEMIDLIST pidl, UINT uFlags,
731 HRESULT hr_exp, UINT pending, UINT created, UINT failed, UINT completed,
732 const char *file, int line)
734 IShellBrowser *psb;
735 HRESULT hr;
737 hr = IExplorerBrowser_QueryInterface(peb, &IID_IShellBrowser, (void**)&psb);
738 ok_(file, line) (hr == S_OK, "QueryInterface returned 0x%08x\n", hr);
739 if(SUCCEEDED(hr))
741 ebev->completed = ebev->created = ebev->pending = ebev->failed = 0;
743 hr = IShellBrowser_BrowseObject(psb, pidl, uFlags);
744 ok_(file, line) (hr == hr_exp, "BrowseObject returned 0x%08x\n", hr);
745 process_msgs();
747 ok_(file, line)
748 (ebev->pending == pending && ebev->created == created &&
749 ebev->failed == failed && ebev->completed == completed,
750 "Events occurred: %d, %d, %d, %d\n",
751 ebev->pending, ebev->created, ebev->failed, ebev->completed);
753 IShellBrowser_Release(psb);
756 #define test_browse_pidl_sb(peb, ebev, pidl, uFlags, hr, p, cr, f, co) \
757 test_browse_pidl_sb_(peb, ebev, pidl, uFlags, hr, p, cr, f, co, __FILE__, __LINE__)
759 static void test_navigation(void)
761 IExplorerBrowser *peb, *peb2;
762 IFolderView *pfv;
763 IShellItem *psi;
764 IShellFolder *psf;
765 LPITEMIDLIST pidl_current, pidl_child;
766 DWORD cookie, cookie2;
767 HRESULT hr;
768 LONG lres;
769 WCHAR current_path[MAX_PATH];
770 WCHAR child_path[MAX_PATH];
771 static const WCHAR testfolderW[] =
772 {'w','i','n','e','t','e','s','t','f','o','l','d','e','r','\0'};
774 ok(pSHParseDisplayName != NULL, "pSHParseDisplayName unexpectedly missing.\n");
775 ok(pSHCreateShellItem != NULL, "pSHCreateShellItem unexpectedly missing.\n");
777 GetCurrentDirectoryW(MAX_PATH, current_path);
778 if(!lstrlenW(current_path))
780 skip("Failed to create test-directory.\n");
781 return;
784 lstrcpyW(child_path, current_path);
785 myPathAddBackslashW(child_path);
786 lstrcatW(child_path, testfolderW);
788 CreateDirectoryW(child_path, NULL);
790 pSHParseDisplayName(current_path, NULL, &pidl_current, 0, NULL);
791 pSHParseDisplayName(child_path, NULL, &pidl_child, 0, NULL);
793 ebrowser_instantiate(&peb);
794 ebrowser_initialize(peb);
796 ebrowser_instantiate(&peb2);
797 ebrowser_initialize(peb2);
799 /* Set up our IExplorerBrowserEvents implementation */
800 ebev.lpVtbl = &ebevents;
802 IExplorerBrowser_Advise(peb, (IExplorerBrowserEvents*)&ebev, &cookie);
803 IExplorerBrowser_Advise(peb2, (IExplorerBrowserEvents*)&ebev, &cookie2);
805 /* These should all fail */
806 test_browse_pidl(peb, &ebev, 0, SBSP_ABSOLUTE | SBSP_RELATIVE, E_FAIL, 0, 0, 0, 0);
807 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_ABSOLUTE | SBSP_RELATIVE, E_FAIL, 0, 0, 0, 0);
808 test_browse_pidl(peb, &ebev, 0, SBSP_ABSOLUTE, E_INVALIDARG, 0, 0, 0, 0);
809 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_ABSOLUTE, E_INVALIDARG, 0, 0, 0, 0);
810 test_browse_pidl(peb, &ebev, 0, SBSP_RELATIVE, E_FAIL, 0, 0, 0, 0);
811 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_RELATIVE, E_FAIL, 0, 0, 0, 0);
812 test_browse_pidl(peb, &ebev, 0, SBSP_PARENT, E_FAIL, 0, 0, 0, 0);
813 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_PARENT, E_FAIL, 0, 0, 0, 0);
814 test_browse_pidl(peb, &ebev, 0, SBSP_NAVIGATEFORWARD, E_FAIL, 0, 0, 0, 0);
815 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_NAVIGATEFORWARD, E_FAIL, 0, 0, 0, 0);
816 test_browse_pidl(peb, &ebev, 0, SBSP_NAVIGATEBACK, E_FAIL, 0, 0, 0, 0);
817 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_NAVIGATEBACK, E_FAIL, 0, 0, 0, 0);
819 /* "The first browse is synchronous" */
820 test_browse_pidl(peb, &ebev, pidl_child, SBSP_ABSOLUTE, S_OK, 1, 1, 0, 1);
821 test_browse_pidl_sb(peb2, &ebev, pidl_child, SBSP_ABSOLUTE, S_OK, 1, 1, 0, 1);
823 /* Navigate empty history */
824 test_browse_pidl(peb, &ebev, 0, SBSP_NAVIGATEFORWARD, S_OK, 0, 0, 0, 0);
825 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_NAVIGATEFORWARD, S_OK, 0, 0, 0, 0);
826 test_browse_pidl(peb, &ebev, 0, SBSP_NAVIGATEBACK, S_OK, 0, 0, 0, 0);
827 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_NAVIGATEBACK, S_OK, 0, 0, 0, 0);
829 /* Navigate history */
830 test_browse_pidl(peb, &ebev, 0, SBSP_PARENT, S_OK, 1, 1, 0, 1);
831 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_PARENT, S_OK, 1, 1, 0, 1);
832 test_browse_pidl(peb, &ebev, 0, SBSP_NAVIGATEBACK, S_OK, 1, 1, 0, 1);
833 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_NAVIGATEBACK, S_OK, 1, 1, 0, 1);
834 test_browse_pidl(peb, &ebev, 0, SBSP_NAVIGATEFORWARD, S_OK, 1, 1, 0, 1);
835 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_NAVIGATEFORWARD, S_OK, 1, 1, 0, 1);
836 test_browse_pidl(peb, &ebev, 0, SBSP_ABSOLUTE, S_OK, 0, 0, 0, 0);
837 test_browse_pidl_sb(peb2, &ebev, 0, SBSP_ABSOLUTE, S_OK, 0, 0, 0, 0);
839 /* Relative navigation */
840 test_browse_pidl(peb, &ebev, pidl_current, SBSP_ABSOLUTE, S_OK, 1, 0, 0, 1);
841 test_browse_pidl_sb(peb2, &ebev, pidl_current, SBSP_ABSOLUTE, S_OK, 1, 0, 0, 1);
843 hr = IExplorerBrowser_GetCurrentView(peb, &IID_IFolderView, (void**)&pfv);
844 ok(hr == S_OK, "Got 0x%08x\n", hr);
845 if(SUCCEEDED(hr))
847 LPITEMIDLIST pidl_relative;
849 hr = IFolderView_GetFolder(pfv, &IID_IShellFolder, (void**)&psf);
850 ok(hr == S_OK, "Got 0x%08x\n", hr);
851 hr = IShellFolder_ParseDisplayName(psf, NULL, NULL, (LPWSTR)testfolderW,
852 NULL, &pidl_relative, NULL);
853 ok(hr == S_OK, "Got 0x%08x\n", hr);
855 /* Browsing to another location here before using the
856 * pidl_relative would make ExplorerBrowser in Windows 7 show a
857 * not-available dialog. Also, passing a relative pidl without
858 * specifying SBSP_RELATIVE makes it look for the pidl on the
859 * desktop
862 test_browse_pidl(peb, &ebev, pidl_relative, SBSP_RELATIVE, S_OK, 1, 1, 0, 1);
863 test_browse_pidl_sb(peb2, &ebev, pidl_relative, SBSP_RELATIVE, S_OK, 1, 1, 0, 1);
865 ILFree(pidl_relative);
866 /* IShellFolder_Release(psf); */
867 IFolderView_Release(pfv);
870 /* misc **/
871 test_browse_pidl(peb, &ebev, NULL, SBSP_ABSOLUTE, S_OK, 0, 0, 0, 0);
872 test_browse_pidl_sb(peb2, &ebev, NULL, SBSP_ABSOLUTE, S_OK, 0, 0, 0, 0);
873 test_browse_pidl(peb, &ebev, NULL, SBSP_DEFBROWSER, S_OK, 0, 0, 0, 0);
874 test_browse_pidl_sb(peb2, &ebev, NULL, SBSP_DEFBROWSER, S_OK, 0, 0, 0, 0);
875 test_browse_pidl(peb, &ebev, pidl_current, SBSP_SAMEBROWSER, S_OK, 1, 1, 0, 1);
876 test_browse_pidl_sb(peb2, &ebev, pidl_current, SBSP_SAMEBROWSER, S_OK, 1, 1, 0, 1);
877 test_browse_pidl(peb, &ebev, pidl_current, SBSP_SAMEBROWSER, S_OK, 1, 0, 0, 1);
878 test_browse_pidl_sb(peb2, &ebev, pidl_current, SBSP_SAMEBROWSER, S_OK, 1, 0, 0, 1);
880 test_browse_pidl(peb, &ebev, pidl_current, SBSP_EXPLOREMODE, E_INVALIDARG, 0, 0, 0, 0);
881 test_browse_pidl_sb(peb2, &ebev, pidl_current, SBSP_EXPLOREMODE, E_INVALIDARG, 0, 0, 0, 0);
882 test_browse_pidl(peb, &ebev, pidl_current, SBSP_OPENMODE, S_OK, 1, 0, 0, 1);
883 test_browse_pidl_sb(peb2, &ebev, pidl_current, SBSP_OPENMODE, S_OK, 1, 0, 0, 1);
885 /* SBSP_NEWBROWSER will return E_INVALIDARG, claims MSDN, but in
886 * reality it works as one would expect (Windows 7 only?).
888 if(0)
890 IExplorerBrowser_BrowseToIDList(peb, NULL, SBSP_NEWBROWSER);
893 hr = IExplorerBrowser_Unadvise(peb, cookie);
894 ok(hr == S_OK, "Got 0x%08x\n", hr);
895 IExplorerBrowser_Destroy(peb);
896 process_msgs();
897 hr = IExplorerBrowser_Unadvise(peb2, cookie2);
898 ok(hr == S_OK, "Got 0x%08x\n", hr);
899 IExplorerBrowser_Destroy(peb2);
900 process_msgs();
902 /* Attempt browsing after destroyed */
903 test_browse_pidl(peb, &ebev, pidl_child, SBSP_ABSOLUTE, HRESULT_FROM_WIN32(ERROR_BUSY), 0, 0, 0, 0);
904 test_browse_pidl_sb(peb2, &ebev, pidl_child, SBSP_ABSOLUTE, HRESULT_FROM_WIN32(ERROR_BUSY), 0, 0, 0, 0);
906 lres = IExplorerBrowser_Release(peb);
907 ok(lres == 0, "Got lres %d\n", lres);
908 lres = IExplorerBrowser_Release(peb2);
909 ok(lres == 0, "Got lres %d\n", lres);
911 /******************************************/
912 /* Test some options that affect browsing */
914 ebrowser_instantiate(&peb);
915 hr = IExplorerBrowser_Advise(peb, (IExplorerBrowserEvents*)&ebev, &cookie);
916 ok(hr == S_OK, "Got 0x%08x\n", hr);
917 hr = IExplorerBrowser_SetOptions(peb, EBO_NAVIGATEONCE);
918 ok(hr == S_OK, "got (0x%08x)\n", hr);
919 ebrowser_initialize(peb);
921 test_browse_pidl(peb, &ebev, pidl_current, 0, S_OK, 1, 1, 0, 1);
922 test_browse_pidl(peb, &ebev, pidl_current, 0, E_FAIL, 0, 0, 0, 0);
924 hr = IExplorerBrowser_SetOptions(peb, 0);
925 ok(hr == S_OK, "got (0x%08x)\n", hr);
927 test_browse_pidl(peb, &ebev, pidl_current, 0, S_OK, 1, 0, 0, 1);
928 test_browse_pidl(peb, &ebev, pidl_current, 0, S_OK, 1, 0, 0, 1);
930 /* Difference in behavior lies where? */
931 hr = IExplorerBrowser_SetOptions(peb, EBO_ALWAYSNAVIGATE);
932 ok(hr == S_OK, "got (0x%08x)\n", hr);
934 test_browse_pidl(peb, &ebev, pidl_current, 0, S_OK, 1, 0, 0, 1);
935 test_browse_pidl(peb, &ebev, pidl_current, 0, S_OK, 1, 0, 0, 1);
937 hr = IExplorerBrowser_Unadvise(peb, cookie);
938 ok(hr == S_OK, "Got 0x%08x\n", hr);
940 IExplorerBrowser_Destroy(peb);
941 lres = IExplorerBrowser_Release(peb);
942 ok(lres == 0, "Got lres %d\n", lres);
944 /* BrowseToObject tests */
945 ebrowser_instantiate(&peb);
946 ebrowser_initialize(peb);
948 /* Browse to the desktop by passing an IShellFolder */
949 hr = SHGetDesktopFolder(&psf);
950 ok(hr == S_OK, "Got 0x%08x\n", hr);
951 if(SUCCEEDED(hr))
953 hr = IExplorerBrowser_BrowseToObject(peb, (IUnknown*)psf, SBSP_DEFBROWSER);
954 ok(hr == S_OK, "got (0x%08x)\n", hr);
955 if(hr == S_OK) process_msgs();
957 IShellFolder_Release(psf);
960 /* Browse to the current directory by passing a ShellItem */
961 hr = pSHCreateShellItem(NULL, NULL, pidl_current, &psi);
962 ok(hr == S_OK, "Got 0x%08x\n", hr);
963 if(SUCCEEDED(hr))
965 hr = IExplorerBrowser_BrowseToObject(peb, (IUnknown*)psi, SBSP_DEFBROWSER);
966 ok(hr == S_OK, "got (0x%08x)\n", hr);
967 process_msgs();
969 IShellItem_Release(psi);
972 IExplorerBrowser_Destroy(peb);
973 lres = IExplorerBrowser_Release(peb);
974 ok(lres == 0, "Got lres %d\n", lres);
976 /* Cleanup */
977 RemoveDirectoryW(child_path);
978 ILFree(pidl_current);
979 ILFree(pidl_child);
982 static void test_GetCurrentView(void)
984 IExplorerBrowser *peb;
985 IUnknown *punk;
986 HRESULT hr;
988 /* GetCurrentView */
989 ebrowser_instantiate(&peb);
991 if(0)
993 /* Crashes under Windows 7 */
994 hr = IExplorerBrowser_GetCurrentView(peb, NULL, NULL);
996 hr = IExplorerBrowser_GetCurrentView(peb, NULL, (void**)&punk);
997 ok(hr == E_FAIL, "Got 0x%08x\n", hr);
999 #define test_gcv(iid, exp) \
1000 do { \
1001 hr = IExplorerBrowser_GetCurrentView(peb, &iid, (void**)&punk); \
1002 ok(hr == exp, "(%s:)Expected (0x%08x), got: (0x%08x)\n", \
1003 #iid ,exp, hr); \
1004 if(SUCCEEDED(hr)) IUnknown_Release(punk); \
1005 } while(0)
1007 test_gcv(IID_IUnknown, E_FAIL);
1008 test_gcv(IID_IUnknown, E_FAIL);
1009 test_gcv(IID_IShellView, E_FAIL);
1010 test_gcv(IID_IShellView2, E_FAIL);
1011 test_gcv(IID_IFolderView, E_FAIL);
1012 test_gcv(IID_IPersistFolder, E_FAIL);
1013 test_gcv(IID_IPersistFolder2, E_FAIL);
1014 test_gcv(IID_ICommDlgBrowser, E_FAIL);
1015 test_gcv(IID_ICommDlgBrowser2, E_FAIL);
1016 test_gcv(IID_ICommDlgBrowser3, E_FAIL);
1018 ebrowser_initialize(peb);
1019 ebrowser_browse_to_desktop(peb);
1021 test_gcv(IID_IUnknown, S_OK);
1022 test_gcv(IID_IUnknown, S_OK);
1023 test_gcv(IID_IShellView, S_OK);
1024 test_gcv(IID_IShellView2, S_OK);
1025 test_gcv(IID_IFolderView, S_OK);
1026 todo_wine test_gcv(IID_IPersistFolder, S_OK);
1027 test_gcv(IID_IPersistFolder2, E_NOINTERFACE);
1028 test_gcv(IID_ICommDlgBrowser, E_NOINTERFACE);
1029 test_gcv(IID_ICommDlgBrowser2, E_NOINTERFACE);
1030 test_gcv(IID_ICommDlgBrowser3, E_NOINTERFACE);
1032 #undef test_gcv
1034 IExplorerBrowser_Destroy(peb);
1035 IExplorerBrowser_Release(peb);
1038 static BOOL test_instantiate_control(void)
1040 IExplorerBrowser *peb;
1041 HRESULT hr;
1043 hr = ebrowser_instantiate(&peb);
1044 ok(hr == S_OK || hr == REGDB_E_CLASSNOTREG, "Got (0x%08x)\n", hr);
1045 if(FAILED(hr))
1046 return FALSE;
1048 IExplorerBrowser_Release(peb);
1049 return TRUE;
1052 static void setup_window(void)
1054 WNDCLASSW wc;
1055 static const WCHAR ebtestW[] = {'e','b','t','e','s','t',0};
1057 ZeroMemory(&wc, sizeof(WNDCLASSW));
1058 wc.lpfnWndProc = DefWindowProcW;
1059 wc.lpszClassName = ebtestW;
1060 RegisterClassW(&wc);
1061 hwnd = CreateWindowExW(0, ebtestW, NULL, 0,
1062 0, 0, 500, 500,
1063 NULL, 0, 0, NULL);
1064 ok(hwnd != NULL, "Failed to create window for tests.\n");
1067 START_TEST(ebrowser)
1069 OleInitialize(NULL);
1071 if(!test_instantiate_control())
1073 win_skip("No ExplorerBrowser control..\n");
1074 OleUninitialize();
1075 return;
1078 setup_window();
1079 init_function_pointers();
1081 test_QueryInterface();
1082 test_SB_misc();
1083 test_initialization();
1084 test_basics();
1085 test_Advise();
1086 test_navigation();
1087 test_GetCurrentView();
1089 DestroyWindow(hwnd);
1090 OleUninitialize();