shell32/tests: Use proper method macros.
[wine] / dlls / shell32 / tests / shlview.c
1 /*
2  * Unit test of the IShellView
3  *
4  * Copyright 2010 Nikolay Sivov for CodeWeavers
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25 #define CONST_VTABLE
26
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wtypes.h"
30 #include "shellapi.h"
31
32 #include "shlguid.h"
33 #include "shlobj.h"
34 #include "shobjidl.h"
35 #include "shlwapi.h"
36 #include "ocidl.h"
37 #include "oleauto.h"
38
39 #include "initguid.h"
40
41 #include "wine/test.h"
42
43 #include "msg.h"
44
45 #define LISTVIEW_SEQ_INDEX  0
46 #define NUM_MSG_SEQUENCES   1
47
48 DEFINE_GUID(IID_IPersistHistory, 0x91a565c1, 0xe38f, 0x11d0, 0x94, 0xbf, 0x00, 0xa0, 0xc9, 0x05, 0x5c, 0xbf);
49
50 static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
51
52 static LRESULT WINAPI listview_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
53 {
54     WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
55     static LONG defwndproc_counter = 0;
56     LRESULT ret;
57     struct message msg;
58
59     trace("listview: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
60
61     msg.message = message;
62     msg.flags = sent|wparam|lparam;
63     if (defwndproc_counter) msg.flags |= defwinproc;
64     msg.wParam = wParam;
65     msg.lParam = lParam;
66     add_message(sequences, LISTVIEW_SEQ_INDEX, &msg);
67
68     defwndproc_counter++;
69     ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
70     defwndproc_counter--;
71     return ret;
72 }
73
74 static HWND subclass_listview(HWND hwnd)
75 {
76     WNDPROC oldproc;
77     HWND listview;
78
79     /* listview is a first child */
80     listview = FindWindowExA(hwnd, NULL, WC_LISTVIEWA, NULL);
81     if(!listview)
82     {
83         /* .. except for some versions of Windows XP, where things
84            are slightly more complicated. */
85         HWND hwnd_tmp;
86         hwnd_tmp = FindWindowExA(hwnd, NULL, "DUIViewWndClassName", NULL);
87         hwnd_tmp = FindWindowExA(hwnd_tmp, NULL, "DirectUIHWND", NULL);
88         hwnd_tmp = FindWindowExA(hwnd_tmp, NULL, "CtrlNotifySink", NULL);
89         listview = FindWindowExA(hwnd_tmp, NULL, WC_LISTVIEWA, NULL);
90     }
91
92     oldproc = (WNDPROC)SetWindowLongPtrA(listview, GWLP_WNDPROC,
93                                         (LONG_PTR)listview_subclass_proc);
94     SetWindowLongPtrA(listview, GWLP_USERDATA, (LONG_PTR)oldproc);
95
96     return listview;
97 }
98
99 static UINT get_msg_count(struct msg_sequence **seq, int sequence_index, UINT message)
100 {
101     struct msg_sequence *msg_seq = seq[sequence_index];
102     UINT i, count = 0;
103
104     for(i = 0; i < msg_seq->count ; i++)
105         if(msg_seq->sequence[i].message == message)
106             count++;
107
108     return count;
109 }
110
111 /* Checks that every message in the sequence seq is also present in
112  * the UINT array msgs */
113 static void verify_msgs_in_(struct msg_sequence *seq, const UINT *msgs,
114                            const char *file, int line)
115 {
116     UINT i, j, msg, failcount = 0;
117     for(i = 0; i < seq->count; i++)
118     {
119         BOOL found = FALSE;
120         msg = seq->sequence[i].message;
121         for(j = 0; msgs[j] != 0; j++)
122             if(msgs[j] == msg) found = TRUE;
123
124         if(!found)
125         {
126             failcount++;
127             trace("Unexpected message %d\n", msg);
128         }
129     }
130     ok_(file, line) (!failcount, "%d failures.\n", failcount);
131     flush_sequences(sequences, NUM_MSG_SEQUENCES);
132 }
133
134 #define verify_msgs_in(seq, msgs)               \
135     verify_msgs_in_(seq, msgs, __FILE__, __LINE__)
136
137 /* dummy IDataObject implementation */
138 typedef struct {
139     IDataObject IDataObject_iface;
140     LONG ref;
141 } IDataObjectImpl;
142
143 static const IDataObjectVtbl IDataObjectImpl_Vtbl;
144
145 static inline IDataObjectImpl *impl_from_IDataObject(IDataObject *iface)
146 {
147     return CONTAINING_RECORD(iface, IDataObjectImpl, IDataObject_iface);
148 }
149
150 static IDataObject* IDataObjectImpl_Construct(void)
151 {
152     IDataObjectImpl *obj;
153
154     obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*obj));
155     obj->IDataObject_iface.lpVtbl = &IDataObjectImpl_Vtbl;
156     obj->ref = 1;
157
158     return &obj->IDataObject_iface;
159 }
160
161 static HRESULT WINAPI IDataObjectImpl_QueryInterface(IDataObject *iface, REFIID riid, void **ppvObj)
162 {
163     IDataObjectImpl *This = impl_from_IDataObject(iface);
164
165     if (IsEqualIID(riid, &IID_IUnknown) ||
166         IsEqualIID(riid, &IID_IDataObject))
167     {
168         *ppvObj = This;
169     }
170
171     if(*ppvObj)
172     {
173         IDataObject_AddRef(iface);
174         return S_OK;
175     }
176
177     return E_NOINTERFACE;
178 }
179
180 static ULONG WINAPI IDataObjectImpl_AddRef(IDataObject * iface)
181 {
182     IDataObjectImpl *This = impl_from_IDataObject(iface);
183     return InterlockedIncrement(&This->ref);
184 }
185
186 static ULONG WINAPI IDataObjectImpl_Release(IDataObject * iface)
187 {
188     IDataObjectImpl *This = impl_from_IDataObject(iface);
189     ULONG ref = InterlockedDecrement(&This->ref);
190
191     if (!ref)
192     {
193         HeapFree(GetProcessHeap(), 0, This);
194         return 0;
195     }
196     return ref;
197 }
198
199 static HRESULT WINAPI IDataObjectImpl_GetData(IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium)
200 {
201     return E_NOTIMPL;
202 }
203
204 static HRESULT WINAPI IDataObjectImpl_GetDataHere(IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium)
205 {
206     return E_NOTIMPL;
207 }
208
209 static HRESULT WINAPI IDataObjectImpl_QueryGetData(IDataObject *iface, FORMATETC *pformat)
210 {
211     return E_NOTIMPL;
212 }
213
214 static HRESULT WINAPI IDataObjectImpl_GetCanonicalFormatEtc(
215     IDataObject *iface, FORMATETC *pformatIn, FORMATETC *pformatOut)
216 {
217     return E_NOTIMPL;
218 }
219
220 static HRESULT WINAPI IDataObjectImpl_SetData(
221     IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium, BOOL release)
222 {
223     return E_NOTIMPL;
224 }
225
226 static HRESULT WINAPI IDataObjectImpl_EnumFormatEtc(
227     IDataObject *iface, DWORD direction, IEnumFORMATETC **ppenumFormatEtc)
228 {
229     return E_NOTIMPL;
230 }
231
232 static HRESULT WINAPI IDataObjectImpl_DAdvise(
233     IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pSink, DWORD *pConnection)
234 {
235     return E_NOTIMPL;
236 }
237
238 static HRESULT WINAPI IDataObjectImpl_DUnadvise(IDataObject *iface, DWORD connection)
239 {
240     return E_NOTIMPL;
241 }
242
243 static HRESULT WINAPI IDataObjectImpl_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
244 {
245     return E_NOTIMPL;
246 }
247
248 static const IDataObjectVtbl IDataObjectImpl_Vtbl =
249 {
250     IDataObjectImpl_QueryInterface,
251     IDataObjectImpl_AddRef,
252     IDataObjectImpl_Release,
253     IDataObjectImpl_GetData,
254     IDataObjectImpl_GetDataHere,
255     IDataObjectImpl_QueryGetData,
256     IDataObjectImpl_GetCanonicalFormatEtc,
257     IDataObjectImpl_SetData,
258     IDataObjectImpl_EnumFormatEtc,
259     IDataObjectImpl_DAdvise,
260     IDataObjectImpl_DUnadvise,
261     IDataObjectImpl_EnumDAdvise
262 };
263
264 /* dummy IShellBrowser implementation */
265 typedef struct {
266     IShellBrowser IShellBrowser_iface;
267     LONG ref;
268 } IShellBrowserImpl;
269
270 static const IShellBrowserVtbl IShellBrowserImpl_Vtbl;
271
272 static inline IShellBrowserImpl *impl_from_IShellBrowser(IShellBrowser *iface)
273 {
274     return CONTAINING_RECORD(iface, IShellBrowserImpl, IShellBrowser_iface);
275 }
276
277 static IShellBrowser* IShellBrowserImpl_Construct(void)
278 {
279     IShellBrowserImpl *browser;
280
281     browser = HeapAlloc(GetProcessHeap(), 0, sizeof(*browser));
282     browser->IShellBrowser_iface.lpVtbl = &IShellBrowserImpl_Vtbl;
283     browser->ref = 1;
284
285     return &browser->IShellBrowser_iface;
286 }
287
288 static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
289                                             REFIID riid,
290                                             LPVOID *ppvObj)
291 {
292     IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
293
294     *ppvObj = NULL;
295
296     if(IsEqualIID(riid, &IID_IUnknown)   ||
297        IsEqualIID(riid, &IID_IOleWindow) ||
298        IsEqualIID(riid, &IID_IShellBrowser))
299     {
300         *ppvObj = This;
301     }
302
303     if(*ppvObj)
304     {
305         IShellBrowser_AddRef(iface);
306         return S_OK;
307     }
308
309     return E_NOINTERFACE;
310 }
311
312 static ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface)
313 {
314     IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
315     return InterlockedIncrement(&This->ref);
316 }
317
318 static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
319 {
320     IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
321     ULONG ref = InterlockedDecrement(&This->ref);
322
323     if (!ref)
324     {
325         HeapFree(GetProcessHeap(), 0, This);
326         return 0;
327     }
328     return ref;
329 }
330
331 static HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser *iface,
332                                            HWND *phwnd)
333 {
334     if (phwnd) *phwnd = GetDesktopWindow();
335     return S_OK;
336 }
337
338 static HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser *iface,
339                                                       BOOL fEnterMode)
340 {
341     return E_NOTIMPL;
342 }
343
344 static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
345                                               LPCITEMIDLIST pidl,
346                                               UINT wFlags)
347 {
348     return E_NOTIMPL;
349 }
350
351 static HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
352                                               BOOL fEnable)
353
354 {
355     return E_NOTIMPL;
356 }
357
358 static HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
359                                               UINT id,
360                                               HWND *lphwnd)
361
362 {
363     return E_NOTIMPL;
364 }
365
366 static HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
367                                                 DWORD mode,
368                                                 LPSTREAM *pStrm)
369
370 {
371     return E_NOTIMPL;
372 }
373
374 static HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
375                                            HMENU hmenuShared,
376                                            LPOLEMENUGROUPWIDTHS lpMenuWidths)
377
378 {
379     return E_NOTIMPL;
380 }
381
382 static HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
383                                                 IShellView *ppshv)
384
385 {
386     return E_NOTIMPL;
387 }
388
389 static HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
390                                                   IShellView **ppshv)
391
392 {
393     return E_NOTIMPL;
394 }
395
396 static HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
397                                            HMENU hmenuShared)
398
399 {
400     return E_NOTIMPL;
401 }
402
403 static HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
404                                             UINT id,
405                                             UINT uMsg,
406                                             WPARAM wParam,
407                                             LPARAM lParam,
408                                             LRESULT *pret)
409
410 {
411     return E_NOTIMPL;
412 }
413
414 static HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
415                                        HMENU hmenuShared,
416                                        HOLEMENU holemenuReserved,
417                                        HWND hwndActiveObject)
418
419 {
420     return E_NOTIMPL;
421 }
422
423 static HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
424                                              LPCOLESTR lpszStatusText)
425
426 {
427     return E_NOTIMPL;
428 }
429
430 static HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
431                                              LPTBBUTTON lpButtons,
432                                              UINT nButtons,
433                                              UINT uFlags)
434
435 {
436     return E_NOTIMPL;
437 }
438
439 static HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
440                                                     LPMSG lpmsg,
441                                                     WORD wID)
442
443 {
444     return E_NOTIMPL;
445 }
446
447 static const IShellBrowserVtbl IShellBrowserImpl_Vtbl =
448 {
449     IShellBrowserImpl_QueryInterface,
450     IShellBrowserImpl_AddRef,
451     IShellBrowserImpl_Release,
452     IShellBrowserImpl_GetWindow,
453     IShellBrowserImpl_ContextSensitiveHelp,
454     IShellBrowserImpl_InsertMenusSB,
455     IShellBrowserImpl_SetMenuSB,
456     IShellBrowserImpl_RemoveMenusSB,
457     IShellBrowserImpl_SetStatusTextSB,
458     IShellBrowserImpl_EnableModelessSB,
459     IShellBrowserImpl_TranslateAcceleratorSB,
460     IShellBrowserImpl_BrowseObject,
461     IShellBrowserImpl_GetViewStateStream,
462     IShellBrowserImpl_GetControlWindow,
463     IShellBrowserImpl_SendControlMsg,
464     IShellBrowserImpl_QueryActiveShellView,
465     IShellBrowserImpl_OnViewWindowActive,
466     IShellBrowserImpl_SetToolbarItems
467 };
468
469 static const struct message empty_seq[] = {
470     { 0 }
471 };
472
473 static const struct message folderview_getspacing_seq[] = {
474     { LVM_GETITEMSPACING, wparam|sent, FALSE },
475     { 0 }
476 };
477
478 static const struct message folderview_getselectionmarked_seq[] = {
479     { LVM_GETSELECTIONMARK, sent },
480     { 0 }
481 };
482
483 static const struct message folderview_getfocused_seq[] = {
484     { LVM_GETNEXTITEM, sent|wparam|lparam|optional, -1, LVNI_FOCUSED },
485     { 0 }
486 };
487
488 static const struct message folderview_itemcount_seq[] = {
489     { LVM_GETITEMCOUNT, sent },
490     { 0 }
491 };
492
493 static void test_IShellView_CreateViewWindow(void)
494 {
495     IShellFolder *desktop;
496     FOLDERSETTINGS settings;
497     IShellView *view;
498     IDropTarget *dt;
499     HWND hwnd_view;
500     HRESULT hr;
501     RECT r = {0};
502
503     hr = SHGetDesktopFolder(&desktop);
504     ok(hr == S_OK, "got (0x%08x)\n", hr);
505
506     hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
507     ok(hr == S_OK, "got (0x%08x)\n", hr);
508
509 if (0)
510 {
511     /* crashes on native */
512     IShellView_CreateViewWindow(view, NULL, &settings, NULL, NULL, NULL);
513 }
514
515     settings.ViewMode = FVM_ICON;
516     settings.fFlags = 0;
517     hwnd_view = (HWND)0xdeadbeef;
518     hr = IShellView_CreateViewWindow(view, NULL, &settings, NULL, NULL, &hwnd_view);
519     ok(hr == E_UNEXPECTED, "got (0x%08x)\n", hr);
520     ok(hwnd_view == 0, "got %p\n", hwnd_view);
521
522     hwnd_view = (HWND)0xdeadbeef;
523     hr = IShellView_CreateViewWindow(view, NULL, &settings, NULL, &r, &hwnd_view);
524     ok(hr == E_UNEXPECTED, "got (0x%08x)\n", hr);
525     ok(hwnd_view == 0, "got %p\n", hwnd_view);
526
527     /* ::DragLeave without drag operation */
528     hr = IShellView_QueryInterface(view, &IID_IDropTarget, (void**)&dt);
529     ok(hr == S_OK, "got (0x%08x)\n", hr);
530     hr = IDropTarget_DragLeave(dt);
531     ok(hr == S_OK, "got (0x%08x)\n", hr);
532     IDropTarget_Release(dt);
533
534     IShellView_Release(view);
535     IShellFolder_Release(desktop);
536 }
537
538 static void test_IFolderView(void)
539 {
540     IShellFolder *desktop, *folder;
541     FOLDERSETTINGS settings;
542     IShellView *view;
543     IShellBrowser *browser;
544     IFolderView *fv;
545     HWND hwnd_view, hwnd_list;
546     PITEMID_CHILD pidl;
547     HRESULT hr;
548     INT ret, count;
549     POINT pt;
550     LONG ref1, ref2;
551     RECT r;
552
553     hr = SHGetDesktopFolder(&desktop);
554     ok(hr == S_OK, "got (0x%08x)\n", hr);
555
556     hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
557     ok(hr == S_OK, "got (0x%08x)\n", hr);
558
559     hr = IShellView_QueryInterface(view, &IID_IFolderView, (void**)&fv);
560     if (hr != S_OK)
561     {
562         win_skip("IFolderView not supported by desktop folder\n");
563         IShellView_Release(view);
564         IShellFolder_Release(desktop);
565         return;
566     }
567
568     /* call methods before window creation */
569     hr = IFolderView_GetSpacing(fv, NULL);
570     ok(hr == S_FALSE || broken(hr == S_OK) /* win7 */, "got (0x%08x)\n", hr);
571
572     pidl = (void*)0xdeadbeef;
573     hr = IFolderView_Item(fv, 0, &pidl);
574     ok(hr == E_INVALIDARG || broken(hr == E_FAIL) /* < Vista */, "got (0x%08x)\n", hr);
575     ok(pidl == 0 || broken(pidl == (void*)0xdeadbeef) /* < Vista */, "got %p\n", pidl);
576
577 if (0)
578 {
579     /* crashes on Vista and Win2k8 - List not created yet case */
580     IFolderView_GetSpacing(fv, &pt);
581
582     /* crashes on XP */
583     IFolderView_GetSelectionMarkedItem(fv, NULL);
584     IFolderView_GetFocusedItem(fv, NULL);
585
586     /* crashes on Vista+ */
587     IFolderView_Item(fv, 0, NULL);
588 }
589
590     browser = IShellBrowserImpl_Construct();
591
592     settings.ViewMode = FVM_ICON;
593     settings.fFlags = 0;
594     hwnd_view = (HWND)0xdeadbeef;
595     r.left = r.top = 0;
596     r.right = r.bottom = 100;
597     hr = IShellView_CreateViewWindow(view, NULL, &settings, browser, &r, &hwnd_view);
598     ok(hr == S_OK, "got (0x%08x)\n", hr);
599     ok(IsWindow(hwnd_view), "got %p\n", hwnd_view);
600
601     hwnd_list = subclass_listview(hwnd_view);
602     if (!hwnd_list)
603     {
604         win_skip("Failed to subclass ListView control\n");
605         IShellBrowser_Release(browser);
606         IFolderView_Release(fv);
607         IShellView_Release(view);
608         IShellFolder_Release(desktop);
609         return;
610     }
611
612     /* IFolderView::GetSpacing */
613     flush_sequences(sequences, NUM_MSG_SEQUENCES);
614     hr = IFolderView_GetSpacing(fv, NULL);
615     ok(hr == S_OK, "got (0x%08x)\n", hr);
616     ok_sequence(sequences, LISTVIEW_SEQ_INDEX, empty_seq, "IFolderView::GetSpacing, empty", FALSE);
617
618     flush_sequences(sequences, NUM_MSG_SEQUENCES);
619     hr = IFolderView_GetSpacing(fv, &pt);
620     ok(hr == S_OK, "got (0x%08x)\n", hr);
621     /* fails with empty sequence on win7 for unknown reason */
622     if (sequences[LISTVIEW_SEQ_INDEX]->count)
623     {
624         ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getspacing_seq, "IFolderView::GetSpacing", FALSE);
625         ok(pt.x > 0, "got %d\n", pt.x);
626         ok(pt.y > 0, "got %d\n", pt.y);
627         ret = SendMessageA(hwnd_list, LVM_GETITEMSPACING, 0, 0);
628         ok(pt.x == LOWORD(ret) && pt.y == HIWORD(ret), "got (%d, %d)\n", LOWORD(ret), HIWORD(ret));
629     }
630
631     /* IFolderView::ItemCount */
632 if (0)
633 {
634     /* crashes on XP */
635     IFolderView_ItemCount(fv, SVGIO_ALLVIEW, NULL);
636 }
637
638     flush_sequences(sequences, NUM_MSG_SEQUENCES);
639     IFolderView_ItemCount(fv, SVGIO_ALLVIEW, &count);
640
641     /* IFolderView::GetSelectionMarkedItem */
642 if (0)
643 {
644     /* crashes on XP */
645     IFolderView_GetSelectionMarkedItem(fv, NULL);
646 }
647
648     flush_sequences(sequences, NUM_MSG_SEQUENCES);
649     hr = IFolderView_GetSelectionMarkedItem(fv, &ret);
650     if (count)
651         ok(hr == S_OK, "got (0x%08x)\n", hr);
652     else
653         ok(hr == S_FALSE, "got (0x%08x)\n", hr);
654     ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getselectionmarked_seq,
655                 "IFolderView::GetSelectionMarkedItem", FALSE);
656
657     /* IFolderView::GetFocusedItem */
658     flush_sequences(sequences, NUM_MSG_SEQUENCES);
659     hr = IFolderView_GetFocusedItem(fv, &ret);
660     if (count)
661         ok(hr == S_OK, "got (0x%08x)\n", hr);
662     else
663         ok(hr == S_FALSE, "got (0x%08x)\n", hr);
664     ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getfocused_seq,
665                 "IFolderView::GetFocusedItem", FALSE);
666
667     /* IFolderView::GetFolder, just return pointer */
668 if (0)
669 {
670     /* crashes on XP */
671     IFolderView_GetFolder(fv, NULL, (void**)&folder);
672     IFolderView_GetFolder(fv, NULL, NULL);
673 }
674
675     hr = IFolderView_GetFolder(fv, &IID_IShellFolder, NULL);
676     ok(hr == E_POINTER, "got (0x%08x)\n", hr);
677
678     ref1 = IShellFolder_AddRef(desktop);
679     IShellFolder_Release(desktop);
680     hr = IFolderView_GetFolder(fv, &IID_IShellFolder, (void**)&folder);
681     ok(hr == S_OK, "got (0x%08x)\n", hr);
682     ref2 = IShellFolder_AddRef(desktop);
683     IShellFolder_Release(desktop);
684     ok(ref1 == ref2 || ref1 + 1 == ref2, /* >= vista */
685        "expected same refcount, got %d\n", ref2);
686     ok(desktop == folder, "\n");
687
688     IShellBrowser_Release(browser);
689     IFolderView_Release(fv);
690     IShellView_Release(view);
691     IShellFolder_Release(desktop);
692 }
693
694 static void test_GetItemObject(void)
695 {
696     IShellFolder *desktop;
697     IShellView *view;
698     IUnknown *unk;
699     HRESULT hr;
700
701     hr = SHGetDesktopFolder(&desktop);
702     ok(hr == S_OK, "got (0x%08x)\n", hr);
703
704     hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
705     ok(hr == S_OK, "got (0x%08x)\n", hr);
706
707     /* from documentation three interfaces are supported for SVGIO_BACKGROUND:
708        IContextMenu, IDispatch, IPersistHistory */
709     hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IContextMenu, (void**)&unk);
710     ok(hr == S_OK, "got (0x%08x)\n", hr);
711     IUnknown_Release(unk);
712
713     unk = NULL;
714     hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IDispatch, (void**)&unk);
715     todo_wine ok(hr == S_OK || broken(hr == E_NOTIMPL) /* NT4 */, "got (0x%08x)\n", hr);
716     if (unk) IUnknown_Release(unk);
717
718     unk = NULL;
719     hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IPersistHistory, (void**)&unk);
720     todo_wine ok(hr == S_OK || broken(hr == E_NOTIMPL) /* W9x, NT4 */, "got (0x%08x)\n", hr);
721     if (unk) IUnknown_Release(unk);
722
723     /* example of unsupported interface, base for IPersistHistory */
724     hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IPersist, (void**)&unk);
725     ok(hr == E_NOINTERFACE || broken(hr == E_NOTIMPL) /* W2K */, "got (0x%08x)\n", hr);
726
727     IShellView_Release(view);
728     IShellFolder_Release(desktop);
729 }
730
731 static void test_IShellFolderView(void)
732 {
733     IShellFolderView *folderview;
734     IShellFolder *desktop;
735     IShellView *view;
736     IDataObject *obj;
737     UINT i;
738     HRESULT hr;
739
740     hr = SHGetDesktopFolder(&desktop);
741     ok(hr == S_OK, "got (0x%08x)\n", hr);
742
743     hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
744     ok(hr == S_OK, "got (0x%08x)\n", hr);
745
746     hr = IShellView_QueryInterface(view, &IID_IShellFolderView, (void**)&folderview);
747     if (hr != S_OK)
748     {
749         win_skip("IShellView doesn't provide IShellFolderView on this platform\n");
750         IShellView_Release(view);
751         IShellFolder_Release(desktop);
752         return;
753     }
754
755     /* ::MoveIcons */
756     obj = IDataObjectImpl_Construct();
757     hr = IShellFolderView_MoveIcons(folderview, obj);
758     ok(hr == E_NOTIMPL || broken(hr == S_OK) /* W98 */, "got (0x%08x)\n", hr);
759     IDataObject_Release(obj);
760
761     /* ::SetRedraw without list created */
762     hr = IShellFolderView_SetRedraw(folderview, TRUE);
763     ok(hr == S_OK, "got (0x%08x)\n", hr);
764
765     /* ::QuerySupport */
766     hr = IShellFolderView_QuerySupport(folderview, NULL);
767     ok(hr == S_OK, "got (0x%08x)\n", hr);
768     i = 0xdeadbeef;
769     hr = IShellFolderView_QuerySupport(folderview, &i);
770     ok(hr == S_OK, "got (0x%08x)\n", hr);
771     ok(i == 0xdeadbeef, "got %d\n", i);
772
773     /* ::RemoveObject */
774     i = 0xdeadbeef;
775     hr = IShellFolderView_RemoveObject(folderview, NULL, &i);
776     ok(hr == S_OK || hr == E_FAIL, "got (0x%08x)\n", hr);
777     if (hr == S_OK) ok(i == 0 || broken(i == 0xdeadbeef) /* Vista, 2k8 */,
778                        "got %d\n", i);
779
780     IShellFolderView_Release(folderview);
781
782     IShellView_Release(view);
783     IShellFolder_Release(desktop);
784 }
785
786 static void test_IOleWindow(void)
787 {
788     IShellFolder *desktop;
789     IShellView *view;
790     HRESULT hr;
791
792     hr = SHGetDesktopFolder(&desktop);
793     ok(hr == S_OK, "got (0x%08x)\n", hr);
794
795     hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
796     ok(hr == S_OK, "got (0x%08x)\n", hr);
797
798     /* IShellView::ContextSensitiveHelp */
799     hr = IShellView_ContextSensitiveHelp(view, TRUE);
800     ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
801     hr = IShellView_ContextSensitiveHelp(view, FALSE);
802     ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
803
804     IShellView_Release(view);
805     IShellFolder_Release(desktop);
806 }
807
808 static const struct message folderview_setcurrentviewmode1_2_prevista[] = {
809     { LVM_SETVIEW, sent|wparam, LV_VIEW_ICON},
810     { LVM_SETIMAGELIST, sent|wparam, 0},
811     { LVM_SETIMAGELIST, sent|wparam, 1},
812     { 0x105a, sent},
813     { LVM_SETBKIMAGEW, sent|optional},    /* w2k3 */
814     { LVM_GETBKCOLOR, sent|optional},     /* w2k3 */
815     { LVM_GETTEXTBKCOLOR, sent|optional}, /* w2k3 */
816     { LVM_GETTEXTCOLOR, sent|optional},   /* w2k3 */
817     { LVM_SETEXTENDEDLISTVIEWSTYLE, sent|optional|wparam, 0xc8}, /* w2k3 */
818     { LVM_ARRANGE, sent },
819     { LVM_ARRANGE, sent|optional },       /* WinXP */
820     { 0 }
821 };
822
823 static const struct message folderview_setcurrentviewmode3_prevista[] = {
824     { LVM_SETVIEW, sent|wparam, LV_VIEW_LIST},
825     { LVM_SETIMAGELIST, sent|wparam, 0},
826     { LVM_SETIMAGELIST, sent|wparam, 1},
827     { 0x105a, sent},
828     { LVM_SETBKIMAGEW, sent|optional},    /* w2k3 */
829     { LVM_GETBKCOLOR, sent|optional},     /* w2k3 */
830     { LVM_GETTEXTBKCOLOR, sent|optional}, /* w2k3 */
831     { LVM_GETTEXTCOLOR, sent|optional},   /* w2k3 */
832     { LVM_SETEXTENDEDLISTVIEWSTYLE, sent|optional|wparam, 0xc8}, /* w2k3 */
833     { 0 }
834 };
835
836 static const struct message folderview_setcurrentviewmode4_prevista[] = {
837     { LVM_GETHEADER, sent},
838     { LVM_GETITEMCOUNT, sent|optional },
839     { LVM_SETSELECTEDCOLUMN, sent},
840     { WM_NOTIFY, sent },
841     { WM_NOTIFY, sent },
842     { WM_NOTIFY, sent },
843     { WM_NOTIFY, sent },
844     { LVM_SETVIEW, sent|wparam, LV_VIEW_DETAILS},
845     { LVM_SETIMAGELIST, sent|wparam, 0},
846     { LVM_SETIMAGELIST, sent|wparam, 1},
847     { 0x105a, sent},
848     { LVM_SETBKIMAGEW, sent|optional},    /* w2k3 */
849     { LVM_GETBKCOLOR, sent|optional},     /* w2k3 */
850     { LVM_GETTEXTBKCOLOR, sent|optional}, /* w2k3 */
851     { LVM_GETTEXTCOLOR, sent|optional},   /* w2k3 */
852     { LVM_SETEXTENDEDLISTVIEWSTYLE, sent|optional|wparam, 0xc8}, /* w2k3 */
853     { 0 }
854 };
855
856 /* XP, SetCurrentViewMode(5)
857    108e - LVM_SETVIEW (LV_VIEW_ICON);
858    1036 - LVM_SETEXTEDEDLISTVIEWSTYLE (0x8000, 0)
859    100c/104c repeated X times
860    1003 - LVM_SETIMAGELIST
861    1035 - LVM_SETICONSPACING
862    1004 - LVM_GETITEMCOUNT
863    105a - ?
864    1016 - LVM_ARRANGE
865    1016 - LVM_ARRANGE
866 */
867
868 /* XP, SetCurrentViewMode(6)
869    1036 - LVM_SETEXTENDEDLISTVIEWSTYLE (0x8000, 0)
870    1035 - LVM_SETICONSPACING
871    1003 - LVM_SETIMAGELIST
872    1003 - LVM_SETIMAGELIST
873    100c/104c repeated X times
874    10a2 - LVM_SETTILEVIEWINFO
875    108e - LVM_SETVIEW (LV_VIEW_TILE)
876    1003 - LVM_SETIMAGELIST
877    105a - ?
878    1016 - LVM_ARRANGE
879    1016 - LVM_ARRANGE
880 */
881
882 /* XP, SetCurrentViewMode (7)
883    10a2 - LVM_SETTILEVIEWINFO
884    108e - LVM_SETVIEW (LV_VIEW_ICON)
885    1004/10a4 (LVM_GETITEMCOUNT/LVM_SETTILEINFO) X times
886    1016 - LVM_ARRANGE
887    1016 - LVM_ARRANGE
888    ...
889    LVM_SETEXTENDEDLISTVIEWSTYLE (0x40000, 0x40000)
890    ...
891    LVM_SETEXTENDEDLISTVIEWSTYLE (0x8000, 0x8000)
892 */
893
894 static void test_GetSetCurrentViewMode(void)
895 {
896     IShellFolder *desktop;
897     IShellView *sview;
898     IFolderView *fview;
899     IShellBrowser *browser;
900     FOLDERSETTINGS fs;
901     UINT viewmode;
902     HWND hwnd;
903     RECT rc = {0, 0, 10, 10};
904     HRESULT hr;
905     UINT i;
906     static const int winxp_res[11] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
907     static const int win2k3_res[11] = {0, 1, 2, 3, 4, 5, 6, 5, 8, 0, 0};
908     static const int vista_res[11] = {0, 1, 5, 3, 4, 5, 6, 7, 7, 0, 0};
909     static const int win7_res[11] = {1, 1, 1, 3, 4, 1, 6, 1, 8, 8, 8};
910
911     hr = SHGetDesktopFolder(&desktop);
912     ok(hr == S_OK, "got (0x%08x)\n", hr);
913
914     hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&sview);
915     ok(hr == S_OK, "got (0x%08x)\n", hr);
916
917     fs.ViewMode = 1;
918     fs.fFlags = 0;
919     browser = IShellBrowserImpl_Construct();
920     hr = IShellView_CreateViewWindow(sview, NULL, &fs, browser, &rc, &hwnd);
921     ok(hr == S_OK || broken(hr == S_FALSE /*Win2k*/ ), "got (0x%08x)\n", hr);
922
923     hr = IShellView_QueryInterface(sview, &IID_IFolderView, (void**)&fview);
924     ok(hr == S_OK || broken(hr == E_NOINTERFACE), "got (0x%08x)\n", hr);
925     if(SUCCEEDED(hr))
926     {
927         HWND hwnd_lv;
928         UINT count;
929
930         if (0)
931         {
932             /* Crashes under Win7/WinXP */
933             IFolderView_GetCurrentViewMode(fview, NULL);
934         }
935
936         hr = IFolderView_GetCurrentViewMode(fview, &viewmode);
937         ok(hr == S_OK, "got (0x%08x)\n", hr);
938         ok(viewmode == 1, "ViewMode was %d\n", viewmode);
939
940         hr = IFolderView_SetCurrentViewMode(fview, FVM_AUTO);
941         ok(hr == S_OK, "got (0x%08x)\n", hr);
942
943         hr = IFolderView_SetCurrentViewMode(fview, 0);
944         ok(hr == E_INVALIDARG || broken(hr == S_OK),
945            "got (0x%08x)\n", hr);
946
947         hr = IFolderView_GetCurrentViewMode(fview, &viewmode);
948         ok(hr == S_OK, "got (0x%08x)\n", hr);
949
950         for(i = 1; i < 9; i++)
951         {
952             hr = IFolderView_SetCurrentViewMode(fview, i);
953             ok(hr == S_OK || (i == 8 && hr == E_INVALIDARG /*Vista*/),
954                "(%d) got (0x%08x)\n", i, hr);
955
956             hr = IFolderView_GetCurrentViewMode(fview, &viewmode);
957             ok(hr == S_OK, "(%d) got (0x%08x)\n", i, hr);
958
959             /* Wine currently behaves like winxp here. */
960             ok((viewmode == win7_res[i]) || (viewmode == vista_res[i]) ||
961                (viewmode == win2k3_res[i]) || (viewmode == winxp_res[i]),
962                "(%d) got %d\n",i , viewmode);
963         }
964
965         hr = IFolderView_SetCurrentViewMode(fview, 9);
966         ok(hr == E_INVALIDARG || broken(hr == S_OK),
967            "got (0x%08x)\n", hr);
968
969         /* Test messages */
970         hwnd_lv = subclass_listview(hwnd);
971         ok(hwnd_lv != NULL, "Failed to subclass listview\n");
972         if(hwnd_lv)
973         {
974             /* Vista seems to set the viewmode by other means than
975                sending messages. At least no related messages are
976                captured by subclassing.
977             */
978             BOOL vista_plus = FALSE;
979             static const UINT vista_plus_msgs[] = {
980                 WM_SETREDRAW, WM_NOTIFY, WM_NOTIFYFORMAT, WM_QUERYUISTATE,
981                 WM_MENUCHAR, WM_WINDOWPOSCHANGING, WM_NCCALCSIZE, WM_WINDOWPOSCHANGED,
982                 WM_PARENTNOTIFY, LVM_GETHEADER, 0 };
983
984             flush_sequences(sequences, NUM_MSG_SEQUENCES);
985             hr = IFolderView_SetCurrentViewMode(fview, 1);
986             ok(hr == S_OK, "got 0x%08x\n", hr);
987
988             /* WM_SETREDRAW is not sent in versions before Vista. */
989             vista_plus = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, WM_SETREDRAW);
990             if(vista_plus)
991                 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
992             else
993                 ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_setcurrentviewmode1_2_prevista,
994                             "IFolderView::SetCurrentViewMode(1)", TRUE);
995
996             hr = IFolderView_SetCurrentViewMode(fview, 2);
997             ok(hr == S_OK, "got 0x%08x\n", hr);
998             if(vista_plus)
999                 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1000             else
1001                 ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_setcurrentviewmode1_2_prevista,
1002                             "IFolderView::SetCurrentViewMode(2)", TRUE);
1003
1004             hr = IFolderView_SetCurrentViewMode(fview, 3);
1005             ok(hr == S_OK, "got 0x%08x\n", hr);
1006             if(vista_plus)
1007                 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1008             else
1009                 ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_setcurrentviewmode3_prevista,
1010                             "IFolderView::SetCurrentViewMode(3)", TRUE);
1011
1012             hr = IFolderView_SetCurrentViewMode(fview, 4);
1013             ok(hr == S_OK, "got 0x%08x\n", hr);
1014             if(vista_plus)
1015                 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1016             else
1017                 ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_setcurrentviewmode4_prevista,
1018                             "IFolderView::SetCurrentViewMode(4)", TRUE);
1019
1020             hr = IFolderView_SetCurrentViewMode(fview, 5);
1021             ok(hr == S_OK, "got 0x%08x\n", hr);
1022             todo_wine
1023             {
1024                 if(vista_plus)
1025                 {
1026                     verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1027                 }
1028                 else
1029                 {
1030                     count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETVIEW);
1031                     ok(count == 1, "LVM_SETVIEW sent %d times.\n", count);
1032                     count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETEXTENDEDLISTVIEWSTYLE);
1033                     ok(count == 1 || count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count);
1034                     flush_sequences(sequences, NUM_MSG_SEQUENCES);
1035                 }
1036             }
1037
1038             hr = IFolderView_SetCurrentViewMode(fview, 6);
1039             ok(hr == S_OK, "got 0x%08x\n", hr);
1040             todo_wine
1041             {
1042                 if(vista_plus)
1043                 {
1044                     verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1045                 }
1046                 else
1047                 {
1048                     count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETVIEW);
1049                     ok(count == 1, "LVM_SETVIEW sent %d times.\n", count);
1050                     count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETEXTENDEDLISTVIEWSTYLE);
1051                     ok(count == 1 || count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count);
1052                     flush_sequences(sequences, NUM_MSG_SEQUENCES);
1053                 }
1054             }
1055
1056             hr = IFolderView_SetCurrentViewMode(fview, 7);
1057             ok(hr == S_OK, "got 0x%08x\n", hr);
1058             todo_wine
1059             {
1060                 if(vista_plus)
1061                 {
1062                     verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1063                 }
1064                 else
1065                 {
1066                     count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETVIEW);
1067                     ok(count == 1, "LVM_SETVIEW sent %d times.\n", count);
1068                     count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETEXTENDEDLISTVIEWSTYLE);
1069                     ok(count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count);
1070                     flush_sequences(sequences, NUM_MSG_SEQUENCES);
1071                 }
1072             }
1073
1074             hr = IFolderView_SetCurrentViewMode(fview, 8);
1075             ok(hr == S_OK || broken(hr == E_INVALIDARG /* Vista */), "got 0x%08x\n", hr);
1076             todo_wine
1077             {
1078                 if(vista_plus)
1079                 {
1080                     verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1081                 }
1082                 else
1083                 {
1084                     count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETVIEW);
1085                     ok(count == 1, "LVM_SETVIEW sent %d times.\n", count);
1086                     count = get_msg_count(sequences, LISTVIEW_SEQ_INDEX, LVM_SETEXTENDEDLISTVIEWSTYLE);
1087                     ok(count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count);
1088                     flush_sequences(sequences, NUM_MSG_SEQUENCES);
1089                 }
1090             }
1091
1092             hr = IFolderView_GetCurrentViewMode(fview, &viewmode);
1093             ok(hr == S_OK, "Failed to get current viewmode.\n");
1094             ok_sequence(sequences, LISTVIEW_SEQ_INDEX, empty_seq,
1095                         "IFolderView::GetCurrentViewMode", FALSE);
1096         }
1097
1098         IFolderView_Release(fview);
1099     }
1100     else
1101     {
1102         skip("No IFolderView for the desktop folder.\n");
1103     }
1104
1105     IShellBrowser_Release(browser);
1106     IShellView_DestroyViewWindow(sview);
1107     IShellView_Release(sview);
1108     IShellFolder_Release(desktop);
1109 }
1110
1111 static void test_IOleCommandTarget(void)
1112 {
1113     IShellFolder *psf_desktop;
1114     IShellView *psv;
1115     IOleCommandTarget *poct;
1116     HRESULT hr;
1117
1118     hr = SHGetDesktopFolder(&psf_desktop);
1119     ok(hr == S_OK, "got (0x%08x)\n", hr);
1120
1121     hr = IShellFolder_CreateViewObject(psf_desktop, NULL, &IID_IShellView, (void**)&psv);
1122     ok(hr == S_OK, "got (0x%08x)\n", hr);
1123     if(SUCCEEDED(hr))
1124     {
1125         hr = IShellView_QueryInterface(psv, &IID_IOleCommandTarget, (void**)&poct);
1126         ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* Win95/NT4 */, "Got 0x%08x\n", hr);
1127         if(SUCCEEDED(hr))
1128         {
1129             OLECMD oc;
1130
1131             hr = IOleCommandTarget_QueryStatus(poct, NULL, 0, NULL, NULL);
1132             ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
1133
1134             oc.cmdID = 1;
1135             hr = IOleCommandTarget_QueryStatus(poct, NULL, 0, &oc, NULL);
1136             ok(hr == OLECMDERR_E_UNKNOWNGROUP, "Got 0x%08x\n", hr);
1137
1138             oc.cmdID = 1;
1139             hr = IOleCommandTarget_QueryStatus(poct, NULL, 1, &oc, NULL);
1140             ok(hr == OLECMDERR_E_UNKNOWNGROUP, "Got 0x%08x\n", hr);
1141
1142             hr = IOleCommandTarget_Exec(poct, NULL, 0, 0, NULL, NULL);
1143             ok(hr == OLECMDERR_E_UNKNOWNGROUP, "Got 0x%08x\n", hr);
1144
1145             IOleCommandTarget_Release(poct);
1146         }
1147
1148         IShellView_Release(psv);
1149     }
1150
1151     IShellFolder_Release(psf_desktop);
1152 }
1153
1154 START_TEST(shlview)
1155 {
1156     OleInitialize(NULL);
1157
1158     init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
1159
1160     test_IShellView_CreateViewWindow();
1161     test_IFolderView();
1162     test_GetItemObject();
1163     test_IShellFolderView();
1164     test_IOleWindow();
1165     test_GetSetCurrentViewMode();
1166     test_IOleCommandTarget();
1167
1168     OleUninitialize();
1169 }