ReactOS 0.4.15-dev-7953-g1f49173
shlview.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wtypes.h"
#include "shellapi.h"
#include "shlguid.h"
#include "shlobj.h"
#include "shobjidl.h"
#include "shlwapi.h"
#include "ocidl.h"
#include "oleauto.h"
#include "initguid.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "msg.h"
Include dependency graph for shlview.c:

Go to the source code of this file.

Classes

struct  IDataObjectImpl
 implementation of IDataObject interface More...
 
struct  IShellBrowserImpl
 Implementation of IShellBrowser and ICommDlgBrowser interfaces for explorer child windows (see ShellBrowserChild) More...
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define LISTVIEW_SEQ_INDEX   0
 
#define NUM_MSG_SEQUENCES   1
 
#define verify_msgs_in(seq, msgs)    verify_msgs_in_(seq, msgs, __FILE__, __LINE__)
 

Functions

 DEFINE_GUID (IID_IPersistHistory, 0x91a565c1, 0xe38f, 0x11d0, 0x94, 0xbf, 0x00, 0xa0, 0xc9, 0x05, 0x5c, 0xbf)
 
static LRESULT WINAPI listview_subclass_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static HWND subclass_listview (HWND hwnd)
 
static UINT get_msg_count (struct msg_sequence **seq, int sequence_index, UINT message)
 
static void verify_msgs_in_ (struct msg_sequence *seq, const UINT *msgs, const char *file, int line)
 
static IDataObjectImplimpl_from_IDataObject (IDataObject *iface)
 
static IDataObjectIDataObjectImpl_Construct (void)
 
static HRESULT WINAPI IDataObjectImpl_QueryInterface (IDataObject *iface, REFIID riid, void **ppvObj)
 
static ULONG WINAPI IDataObjectImpl_AddRef (IDataObject *iface)
 
static ULONG WINAPI IDataObjectImpl_Release (IDataObject *iface)
 
static HRESULT WINAPI IDataObjectImpl_GetData (IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium)
 
static HRESULT WINAPI IDataObjectImpl_GetDataHere (IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium)
 
static HRESULT WINAPI IDataObjectImpl_QueryGetData (IDataObject *iface, FORMATETC *pformat)
 
static HRESULT WINAPI IDataObjectImpl_GetCanonicalFormatEtc (IDataObject *iface, FORMATETC *pformatIn, FORMATETC *pformatOut)
 
static HRESULT WINAPI IDataObjectImpl_SetData (IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium, BOOL release)
 
static HRESULT WINAPI IDataObjectImpl_EnumFormatEtc (IDataObject *iface, DWORD direction, IEnumFORMATETC **ppenumFormatEtc)
 
static HRESULT WINAPI IDataObjectImpl_DAdvise (IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pSink, DWORD *pConnection)
 
static HRESULT WINAPI IDataObjectImpl_DUnadvise (IDataObject *iface, DWORD connection)
 
static HRESULT WINAPI IDataObjectImpl_EnumDAdvise (IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
 
static IShellBrowserImplimpl_from_IShellBrowser (IShellBrowser *iface)
 
static IShellBrowserIShellBrowserImpl_Construct (void)
 
static HRESULT WINAPI IShellBrowserImpl_QueryInterface (IShellBrowser *iface, REFIID riid, LPVOID *ppvObj)
 
static ULONG WINAPI IShellBrowserImpl_AddRef (IShellBrowser *iface)
 
static ULONG WINAPI IShellBrowserImpl_Release (IShellBrowser *iface)
 
static HRESULT WINAPI IShellBrowserImpl_GetWindow (IShellBrowser *iface, HWND *phwnd)
 
static HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp (IShellBrowser *iface, BOOL fEnterMode)
 
static HRESULT WINAPI IShellBrowserImpl_BrowseObject (IShellBrowser *iface, LPCITEMIDLIST pidl, UINT wFlags)
 
static HRESULT WINAPI IShellBrowserImpl_EnableModelessSB (IShellBrowser *iface, BOOL fEnable)
 
static HRESULT WINAPI IShellBrowserImpl_GetControlWindow (IShellBrowser *iface, UINT id, HWND *lphwnd)
 
static HRESULT WINAPI IShellBrowserImpl_GetViewStateStream (IShellBrowser *iface, DWORD mode, LPSTREAM *pStrm)
 
static HRESULT WINAPI IShellBrowserImpl_InsertMenusSB (IShellBrowser *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
 
static HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive (IShellBrowser *iface, IShellView *ppshv)
 
static HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView (IShellBrowser *iface, IShellView **ppshv)
 
static HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB (IShellBrowser *iface, HMENU hmenuShared)
 
static HRESULT WINAPI IShellBrowserImpl_SendControlMsg (IShellBrowser *iface, UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
 
static HRESULT WINAPI IShellBrowserImpl_SetMenuSB (IShellBrowser *iface, HMENU hmenuShared, HOLEMENU holemenuReserved, HWND hwndActiveObject)
 
static HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB (IShellBrowser *iface, LPCOLESTR lpszStatusText)
 
static HRESULT WINAPI IShellBrowserImpl_SetToolbarItems (IShellBrowser *iface, LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags)
 
static HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB (IShellBrowser *iface, LPMSG lpmsg, WORD wID)
 
static HRESULT WINAPI shellbrowser_QueryInterface (IShellBrowser *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI shellbrowser_AddRef (IShellBrowser *iface)
 
static ULONG WINAPI shellbrowser_Release (IShellBrowser *iface)
 
static HRESULT WINAPI shellbrowser_GetWindow (IShellBrowser *iface, HWND *phwnd)
 
static HRESULT WINAPI shellbrowser_ContextSensitiveHelp (IShellBrowser *iface, BOOL mode)
 
static HRESULT WINAPI shellbrowser_InsertMenusSB (IShellBrowser *iface, HMENU hmenuShared, OLEMENUGROUPWIDTHS *menuwidths)
 
static HRESULT WINAPI shellbrowser_SetMenuSB (IShellBrowser *iface, HMENU hmenuShared, HOLEMENU holemenuReserved, HWND hwndActiveObject)
 
static HRESULT WINAPI shellbrowser_RemoveMenusSB (IShellBrowser *iface, HMENU hmenuShared)
 
static HRESULT WINAPI shellbrowser_SetStatusTextSB (IShellBrowser *iface, LPCOLESTR text)
 
static HRESULT WINAPI shellbrowser_EnableModelessSB (IShellBrowser *iface, BOOL enable)
 
static HRESULT WINAPI shellbrowser_TranslateAcceleratorSB (IShellBrowser *iface, MSG *pmsg, WORD wID)
 
static HRESULT WINAPI shellbrowser_BrowseObject (IShellBrowser *iface, LPCITEMIDLIST pidl, UINT flags)
 
static HRESULT WINAPI shellbrowser_GetViewStateStream (IShellBrowser *iface, DWORD mode, IStream **stream)
 
static HRESULT WINAPI shellbrowser_GetControlWindow (IShellBrowser *iface, UINT id, HWND *phwnd)
 
static HRESULT WINAPI shellbrowser_SendControlMsg (IShellBrowser *iface, UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
 
static HRESULT WINAPI shellbrowser_QueryActiveShellView (IShellBrowser *iface, IShellView **view)
 
static HRESULT WINAPI shellbrowser_OnViewWindowActive (IShellBrowser *iface, IShellView *view)
 
static HRESULT WINAPI shellbrowser_SetToolbarItems (IShellBrowser *iface, LPTBBUTTONSB buttons, UINT count, UINT flags)
 
static void test_CreateViewWindow (void)
 
static void test_IFolderView (void)
 
static void test_GetItemObject (void)
 
static void test_IShellFolderView (void)
 
static void test_IOleWindow (void)
 
static void test_GetSetCurrentViewMode (void)
 
static void test_IOleCommandTarget (void)
 
static void test_SHCreateShellFolderView (void)
 
static void test_SHCreateShellFolderViewEx (void)
 
static void test_newmenu (void)
 
 START_TEST (shlview)
 

Variables

static struct msg_sequencesequences [NUM_MSG_SEQUENCES]
 
static const IDataObjectVtbl IDataObjectImpl_Vtbl
 
static const IShellBrowserVtbl IShellBrowserImpl_Vtbl
 
static const struct message empty_seq []
 
static const struct message folderview_getspacing_seq []
 
static const struct message folderview_getselectionmarked_seq []
 
static const struct message folderview_getfocused_seq []
 
static const IShellBrowserVtbl shellbrowservtbl
 
static IShellBrowser test_shellbrowser = { &shellbrowservtbl }
 
static const struct message folderview_setcurrentviewmode1_2_prevista []
 
static const struct message folderview_setcurrentviewmode3_prevista []
 
static const struct message folderview_setcurrentviewmode4_prevista []
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file shlview.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 25 of file shlview.c.

◆ LISTVIEW_SEQ_INDEX

#define LISTVIEW_SEQ_INDEX   0

Definition at line 50 of file shlview.c.

◆ NUM_MSG_SEQUENCES

#define NUM_MSG_SEQUENCES   1

Definition at line 51 of file shlview.c.

◆ verify_msgs_in

#define verify_msgs_in (   seq,
  msgs 
)     verify_msgs_in_(seq, msgs, __FILE__, __LINE__)

Definition at line 137 of file shlview.c.

Function Documentation

◆ DEFINE_GUID()

DEFINE_GUID ( IID_IPersistHistory  ,
0x91a565c1  ,
0xe38f  ,
0x11d0  ,
0x94  ,
0xbf  ,
0x00  ,
0xa0  ,
0xc9  ,
0x05  ,
0x5c  ,
0xbf   
)

◆ get_msg_count()

static UINT get_msg_count ( struct msg_sequence **  seq,
int  sequence_index,
UINT  message 
)
static

Definition at line 102 of file shlview.c.

103{
104 struct msg_sequence *msg_seq = seq[sequence_index];
105 UINT i, count = 0;
106
107 for(i = 0; i < msg_seq->count ; i++)
108 if(msg_seq->sequence[i].message == message)
109 count++;
110
111 return count;
112}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
Definition: tftpd.h:60
struct message * sequence
Definition: msg.h:63
int count
Definition: msg.h:61

Referenced by test_GetSetCurrentViewMode().

◆ IDataObjectImpl_AddRef()

static ULONG WINAPI IDataObjectImpl_AddRef ( IDataObject iface)
static

Definition at line 183 of file shlview.c.

184{
186 return InterlockedIncrement(&This->ref);
187}
#define InterlockedIncrement
Definition: armddk.h:53
implementation of IDataObject interface
Definition: dragdropimpl.h:82
static IDataObjectImpl * impl_from_IDataObject(IDataObject *iface)
Definition: shlview.c:148

◆ IDataObjectImpl_Construct()

static IDataObject * IDataObjectImpl_Construct ( void  )
static

Definition at line 153 of file shlview.c.

154{
156
157 obj = heap_alloc(sizeof(*obj));
159 obj->ref = 1;
160
161 return &obj->IDataObject_iface;
162}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static const IDataObjectVtbl IDataObjectImpl_Vtbl
Definition: shlview.c:146
IDataObject IDataObject_iface
Definition: usrmarshal.c:1273

Referenced by test_IShellFolderView().

◆ IDataObjectImpl_DAdvise()

static HRESULT WINAPI IDataObjectImpl_DAdvise ( IDataObject iface,
FORMATETC *  pformatetc,
DWORD  advf,
IAdviseSink pSink,
DWORD pConnection 
)
static

Definition at line 233 of file shlview.c.

235{
236 return E_NOTIMPL;
237}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IDataObjectImpl_DUnadvise()

static HRESULT WINAPI IDataObjectImpl_DUnadvise ( IDataObject iface,
DWORD  connection 
)
static

Definition at line 239 of file shlview.c.

240{
241 return E_NOTIMPL;
242}

◆ IDataObjectImpl_EnumDAdvise()

static HRESULT WINAPI IDataObjectImpl_EnumDAdvise ( IDataObject iface,
IEnumSTATDATA **  ppenumAdvise 
)
static

Definition at line 244 of file shlview.c.

245{
246 return E_NOTIMPL;
247}

◆ IDataObjectImpl_EnumFormatEtc()

static HRESULT WINAPI IDataObjectImpl_EnumFormatEtc ( IDataObject iface,
DWORD  direction,
IEnumFORMATETC **  ppenumFormatEtc 
)
static

Definition at line 227 of file shlview.c.

229{
230 return E_NOTIMPL;
231}

◆ IDataObjectImpl_GetCanonicalFormatEtc()

static HRESULT WINAPI IDataObjectImpl_GetCanonicalFormatEtc ( IDataObject iface,
FORMATETC *  pformatIn,
FORMATETC *  pformatOut 
)
static

Definition at line 215 of file shlview.c.

217{
218 return E_NOTIMPL;
219}

◆ IDataObjectImpl_GetData()

static HRESULT WINAPI IDataObjectImpl_GetData ( IDataObject iface,
FORMATETC *  pformat,
STGMEDIUM *  pmedium 
)
static

Definition at line 200 of file shlview.c.

201{
202 return E_NOTIMPL;
203}

◆ IDataObjectImpl_GetDataHere()

static HRESULT WINAPI IDataObjectImpl_GetDataHere ( IDataObject iface,
FORMATETC *  pformat,
STGMEDIUM *  pmedium 
)
static

Definition at line 205 of file shlview.c.

206{
207 return E_NOTIMPL;
208}

◆ IDataObjectImpl_QueryGetData()

static HRESULT WINAPI IDataObjectImpl_QueryGetData ( IDataObject iface,
FORMATETC *  pformat 
)
static

Definition at line 210 of file shlview.c.

211{
212 return E_NOTIMPL;
213}

◆ IDataObjectImpl_QueryInterface()

static HRESULT WINAPI IDataObjectImpl_QueryInterface ( IDataObject iface,
REFIID  riid,
void **  ppvObj 
)
static

Definition at line 164 of file shlview.c.

165{
167
170 {
171 *ppvObj = &This->IDataObject_iface;
172 }
173
174 if(*ppvObj)
175 {
176 IDataObject_AddRef(iface);
177 return S_OK;
178 }
179
180 return E_NOINTERFACE;
181}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
const GUID IID_IDataObject
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ IDataObjectImpl_Release()

static ULONG WINAPI IDataObjectImpl_Release ( IDataObject iface)
static

Definition at line 189 of file shlview.c.

190{
193
194 if (!ref)
196
197 return ref;
198}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedDecrement
Definition: armddk.h:52
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ IDataObjectImpl_SetData()

static HRESULT WINAPI IDataObjectImpl_SetData ( IDataObject iface,
FORMATETC *  pformat,
STGMEDIUM *  pmedium,
BOOL  release 
)
static

Definition at line 221 of file shlview.c.

223{
224 return E_NOTIMPL;
225}

◆ impl_from_IDataObject()

static IDataObjectImpl * impl_from_IDataObject ( IDataObject iface)
inlinestatic

Definition at line 148 of file shlview.c.

149{
150 return CONTAINING_RECORD(iface, IDataObjectImpl, IDataObject_iface);
151}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by IDataObjectImpl_AddRef(), IDataObjectImpl_QueryInterface(), and IDataObjectImpl_Release().

◆ impl_from_IShellBrowser()

static IShellBrowserImpl * impl_from_IShellBrowser ( IShellBrowser iface)
inlinestatic

Definition at line 273 of file shlview.c.

274{
275 return CONTAINING_RECORD(iface, IShellBrowserImpl, IShellBrowser_iface);
276}
Implementation of IShellBrowser and ICommDlgBrowser interfaces for explorer child windows (see ShellB...

Referenced by IShellBrowserImpl_AddRef(), IShellBrowserImpl_QueryInterface(), and IShellBrowserImpl_Release().

◆ IShellBrowserImpl_AddRef()

static ULONG WINAPI IShellBrowserImpl_AddRef ( IShellBrowser iface)
static

Definition at line 313 of file shlview.c.

314{
316 return InterlockedIncrement(&This->ref);
317}
static IShellBrowserImpl * impl_from_IShellBrowser(IShellBrowser *iface)
Definition: shlview.c:273

◆ IShellBrowserImpl_BrowseObject()

static HRESULT WINAPI IShellBrowserImpl_BrowseObject ( IShellBrowser iface,
LPCITEMIDLIST  pidl,
UINT  wFlags 
)
static

Definition at line 343 of file shlview.c.

346{
347 return E_NOTIMPL;
348}

◆ IShellBrowserImpl_Construct()

static IShellBrowser * IShellBrowserImpl_Construct ( void  )
static

Definition at line 278 of file shlview.c.

279{
280 IShellBrowserImpl *browser;
281
282 browser = heap_alloc(sizeof(*browser));
284 browser->ref = 1;
285
286 return &browser->IShellBrowser_iface;
287}
static const IShellBrowserVtbl IShellBrowserImpl_Vtbl
Definition: shlview.c:271
IShellBrowser IShellBrowser_iface

Referenced by FILEDLG95_SHELL_Init(), test_GetSetCurrentViewMode(), and test_IFolderView().

◆ IShellBrowserImpl_ContextSensitiveHelp()

static HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp ( IShellBrowser iface,
BOOL  fEnterMode 
)
static

Definition at line 337 of file shlview.c.

339{
340 return E_NOTIMPL;
341}

◆ IShellBrowserImpl_EnableModelessSB()

static HRESULT WINAPI IShellBrowserImpl_EnableModelessSB ( IShellBrowser iface,
BOOL  fEnable 
)
static

Definition at line 350 of file shlview.c.

353{
354 return E_NOTIMPL;
355}

◆ IShellBrowserImpl_GetControlWindow()

static HRESULT WINAPI IShellBrowserImpl_GetControlWindow ( IShellBrowser iface,
UINT  id,
HWND lphwnd 
)
static

Definition at line 357 of file shlview.c.

361{
362 return E_NOTIMPL;
363}

◆ IShellBrowserImpl_GetViewStateStream()

static HRESULT WINAPI IShellBrowserImpl_GetViewStateStream ( IShellBrowser iface,
DWORD  mode,
LPSTREAM pStrm 
)
static

Definition at line 365 of file shlview.c.

369{
370 return E_NOTIMPL;
371}

◆ IShellBrowserImpl_GetWindow()

static HRESULT WINAPI IShellBrowserImpl_GetWindow ( IShellBrowser iface,
HWND phwnd 
)
static

Definition at line 330 of file shlview.c.

332{
333 if (phwnd) *phwnd = GetDesktopWindow();
334 return S_OK;
335}
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656

◆ IShellBrowserImpl_InsertMenusSB()

static HRESULT WINAPI IShellBrowserImpl_InsertMenusSB ( IShellBrowser iface,
HMENU  hmenuShared,
LPOLEMENUGROUPWIDTHS  lpMenuWidths 
)
static

Definition at line 373 of file shlview.c.

377{
378 return E_NOTIMPL;
379}

◆ IShellBrowserImpl_OnViewWindowActive()

static HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive ( IShellBrowser iface,
IShellView ppshv 
)
static

Definition at line 381 of file shlview.c.

384{
385 return E_NOTIMPL;
386}

◆ IShellBrowserImpl_QueryActiveShellView()

static HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView ( IShellBrowser iface,
IShellView **  ppshv 
)
static

Definition at line 388 of file shlview.c.

391{
392 return E_NOTIMPL;
393}

◆ IShellBrowserImpl_QueryInterface()

static HRESULT WINAPI IShellBrowserImpl_QueryInterface ( IShellBrowser iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 289 of file shlview.c.

292{
294
295 *ppvObj = NULL;
296
299 IsEqualIID(riid, &IID_IShellBrowser))
300 {
301 *ppvObj = &This->IShellBrowser_iface;
302 }
303
304 if(*ppvObj)
305 {
306 IShellBrowser_AddRef(iface);
307 return S_OK;
308 }
309
310 return E_NOINTERFACE;
311}
#define NULL
Definition: types.h:112
const GUID IID_IOleWindow

◆ IShellBrowserImpl_Release()

static ULONG WINAPI IShellBrowserImpl_Release ( IShellBrowser iface)
static

Definition at line 319 of file shlview.c.

320{
323
324 if (!ref)
326
327 return ref;
328}

◆ IShellBrowserImpl_RemoveMenusSB()

static HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB ( IShellBrowser iface,
HMENU  hmenuShared 
)
static

Definition at line 395 of file shlview.c.

398{
399 return E_NOTIMPL;
400}

◆ IShellBrowserImpl_SendControlMsg()

static HRESULT WINAPI IShellBrowserImpl_SendControlMsg ( IShellBrowser iface,
UINT  id,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT pret 
)
static

Definition at line 402 of file shlview.c.

409{
410 return E_NOTIMPL;
411}

◆ IShellBrowserImpl_SetMenuSB()

static HRESULT WINAPI IShellBrowserImpl_SetMenuSB ( IShellBrowser iface,
HMENU  hmenuShared,
HOLEMENU  holemenuReserved,
HWND  hwndActiveObject 
)
static

Definition at line 413 of file shlview.c.

418{
419 return E_NOTIMPL;
420}

◆ IShellBrowserImpl_SetStatusTextSB()

static HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB ( IShellBrowser iface,
LPCOLESTR  lpszStatusText 
)
static

Definition at line 422 of file shlview.c.

425{
426 return E_NOTIMPL;
427}

◆ IShellBrowserImpl_SetToolbarItems()

static HRESULT WINAPI IShellBrowserImpl_SetToolbarItems ( IShellBrowser iface,
LPTBBUTTON  lpButtons,
UINT  nButtons,
UINT  uFlags 
)
static

Definition at line 429 of file shlview.c.

434{
435 return E_NOTIMPL;
436}

◆ IShellBrowserImpl_TranslateAcceleratorSB()

static HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB ( IShellBrowser iface,
LPMSG  lpmsg,
WORD  wID 
)
static

Definition at line 438 of file shlview.c.

442{
443 return E_NOTIMPL;
444}

◆ listview_subclass_proc()

static LRESULT WINAPI listview_subclass_proc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 57 of file shlview.c.

58{
60 static LONG defwndproc_counter = 0;
61 struct message msg = { 0 };
63
64 msg.message = message;
65 msg.flags = sent|wparam|lparam;
66 if (defwndproc_counter) msg.flags |= defwinproc;
67 msg.wParam = wParam;
68 msg.lParam = lParam;
70
71 defwndproc_counter++;
73 defwndproc_counter--;
74 return ret;
75}
@ sent
Definition: SystemMenu.c:27
@ defwinproc
Definition: SystemMenu.c:32
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define add_message(msg)
Definition: SystemMenu.c:98
#define msg(x)
Definition: auth_time.c:54
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
long LONG
Definition: pedump.c:60
#define LISTVIEW_SEQ_INDEX
Definition: shlview.c:50
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: shlview.c:55
UINT message
Definition: SystemMenu.c:42
#define GWLP_USERDATA
Definition: treelist.c:63
int ret
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LRESULT
Definition: windef.h:209
#define GetWindowLongPtrA
Definition: winuser.h:4828
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by subclass_listview().

◆ shellbrowser_AddRef()

static ULONG WINAPI shellbrowser_AddRef ( IShellBrowser iface)
static

Definition at line 507 of file shlview.c.

508{
509 return 2;
510}

◆ shellbrowser_BrowseObject()

static HRESULT WINAPI shellbrowser_BrowseObject ( IShellBrowser iface,
LPCITEMIDLIST  pidl,
UINT  flags 
)
static

Definition at line 564 of file shlview.c.

565{
566 ok(0, "unexpected\n");
567 return E_NOTIMPL;
568}
#define ok(value,...)
Definition: atltest.h:57

◆ shellbrowser_ContextSensitiveHelp()

static HRESULT WINAPI shellbrowser_ContextSensitiveHelp ( IShellBrowser iface,
BOOL  mode 
)
static

Definition at line 523 of file shlview.c.

524{
525 ok(0, "unexpected\n");
526 return E_NOTIMPL;
527}

◆ shellbrowser_EnableModelessSB()

static HRESULT WINAPI shellbrowser_EnableModelessSB ( IShellBrowser iface,
BOOL  enable 
)
static

Definition at line 552 of file shlview.c.

553{
554 ok(0, "unexpected\n");
555 return E_NOTIMPL;
556}

◆ shellbrowser_GetControlWindow()

static HRESULT WINAPI shellbrowser_GetControlWindow ( IShellBrowser iface,
UINT  id,
HWND phwnd 
)
static

Definition at line 575 of file shlview.c.

576{
577 return E_NOTIMPL;
578}

◆ shellbrowser_GetViewStateStream()

static HRESULT WINAPI shellbrowser_GetViewStateStream ( IShellBrowser iface,
DWORD  mode,
IStream **  stream 
)
static

Definition at line 570 of file shlview.c.

571{
572 return E_NOTIMPL;
573}

◆ shellbrowser_GetWindow()

static HRESULT WINAPI shellbrowser_GetWindow ( IShellBrowser iface,
HWND phwnd 
)
static

Definition at line 517 of file shlview.c.

518{
519 *phwnd = GetDesktopWindow();
520 return S_OK;
521}

◆ shellbrowser_InsertMenusSB()

static HRESULT WINAPI shellbrowser_InsertMenusSB ( IShellBrowser iface,
HMENU  hmenuShared,
OLEMENUGROUPWIDTHS *  menuwidths 
)
static

Definition at line 529 of file shlview.c.

531{
532 return E_NOTIMPL;
533}

◆ shellbrowser_OnViewWindowActive()

static HRESULT WINAPI shellbrowser_OnViewWindowActive ( IShellBrowser iface,
IShellView view 
)
static

Definition at line 592 of file shlview.c.

593{
594 ok(0, "unexpected\n");
595 return E_NOTIMPL;
596}

◆ shellbrowser_QueryActiveShellView()

static HRESULT WINAPI shellbrowser_QueryActiveShellView ( IShellBrowser iface,
IShellView **  view 
)
static

Definition at line 586 of file shlview.c.

587{
588 ok(0, "unexpected\n");
589 return E_NOTIMPL;
590}

◆ shellbrowser_QueryInterface()

static HRESULT WINAPI shellbrowser_QueryInterface ( IShellBrowser iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 487 of file shlview.c.

488{
489 *ppv = NULL;
490
491 if (IsEqualGUID(&IID_IShellBrowser, riid) ||
494 {
495 *ppv = iface;
496 }
497
498 if (*ppv)
499 {
500 IUnknown_AddRef((IUnknown*)*ppv);
501 return S_OK;
502 }
503
504 return E_NOINTERFACE;
505}
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

◆ shellbrowser_Release()

static ULONG WINAPI shellbrowser_Release ( IShellBrowser iface)
static

Definition at line 512 of file shlview.c.

513{
514 return 1;
515}

◆ shellbrowser_RemoveMenusSB()

static HRESULT WINAPI shellbrowser_RemoveMenusSB ( IShellBrowser iface,
HMENU  hmenuShared 
)
static

Definition at line 541 of file shlview.c.

542{
543 return E_NOTIMPL;
544}

◆ shellbrowser_SendControlMsg()

static HRESULT WINAPI shellbrowser_SendControlMsg ( IShellBrowser iface,
UINT  id,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT pret 
)
static

Definition at line 580 of file shlview.c.

582{
583 return E_NOTIMPL;
584}

◆ shellbrowser_SetMenuSB()

static HRESULT WINAPI shellbrowser_SetMenuSB ( IShellBrowser iface,
HMENU  hmenuShared,
HOLEMENU  holemenuReserved,
HWND  hwndActiveObject 
)
static

Definition at line 535 of file shlview.c.

537{
538 return E_NOTIMPL;
539}

◆ shellbrowser_SetStatusTextSB()

static HRESULT WINAPI shellbrowser_SetStatusTextSB ( IShellBrowser iface,
LPCOLESTR  text 
)
static

Definition at line 546 of file shlview.c.

547{
548 ok(0, "unexpected\n");
549 return E_NOTIMPL;
550}

◆ shellbrowser_SetToolbarItems()

static HRESULT WINAPI shellbrowser_SetToolbarItems ( IShellBrowser iface,
LPTBBUTTONSB  buttons,
UINT  count,
UINT  flags 
)
static

Definition at line 598 of file shlview.c.

600{
601 return E_NOTIMPL;
602}

◆ shellbrowser_TranslateAcceleratorSB()

static HRESULT WINAPI shellbrowser_TranslateAcceleratorSB ( IShellBrowser iface,
MSG pmsg,
WORD  wID 
)
static

Definition at line 558 of file shlview.c.

559{
560 ok(0, "unexpected\n");
561 return E_NOTIMPL;
562}

◆ START_TEST()

START_TEST ( shlview  )

Definition at line 1516 of file shlview.c.

1517{
1519
1521
1531 test_newmenu();
1532
1534}
static void init_msg_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:391
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
static void test_SHCreateShellFolderView(void)
Definition: shlview.c:1339
static void test_IOleCommandTarget(void)
Definition: shlview.c:1296
#define NUM_MSG_SEQUENCES
Definition: shlview.c:51
static void test_IShellFolderView(void)
Definition: shlview.c:912
static void test_CreateViewWindow(void)
Definition: shlview.c:627
static void test_GetSetCurrentViewMode(void)
Definition: shlview.c:1079
static void test_IFolderView(void)
Definition: shlview.c:711
static void test_IOleWindow(void)
Definition: shlview.c:967
static void test_GetItemObject(void)
Definition: shlview.c:875
static void test_SHCreateShellFolderViewEx(void)
Definition: shlview.c:1419
static void test_newmenu(void)
Definition: shlview.c:1480

◆ subclass_listview()

static HWND subclass_listview ( HWND  hwnd)
static

Definition at line 77 of file shlview.c.

78{
79 WNDPROC oldproc;
80 HWND listview;
81
82 /* listview is a first child */
84 if(!listview)
85 {
86 /* .. except for some versions of Windows XP, where things
87 are slightly more complicated. */
88 HWND hwnd_tmp;
89 hwnd_tmp = FindWindowExA(hwnd, NULL, "DUIViewWndClassName", NULL);
90 hwnd_tmp = FindWindowExA(hwnd_tmp, NULL, "DirectUIHWND", NULL);
91 hwnd_tmp = FindWindowExA(hwnd_tmp, NULL, "CtrlNotifySink", NULL);
92 listview = FindWindowExA(hwnd_tmp, NULL, WC_LISTVIEWA, NULL);
93 }
94
95 oldproc = (WNDPROC)SetWindowLongPtrA(listview, GWLP_WNDPROC,
97 SetWindowLongPtrA(listview, GWLP_USERDATA, (LONG_PTR)oldproc);
98
99 return listview;
100}
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WC_LISTVIEWA
Definition: commctrl.h:2256
static LRESULT WINAPI listview_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: shlview.c:57
#define GWLP_WNDPROC
Definition: treelist.c:66
#define SetWindowLongPtrA
Definition: winuser.h:5345
HWND WINAPI FindWindowExA(_In_opt_ HWND, _In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR)

Referenced by test_GetSetCurrentViewMode(), and test_IFolderView().

◆ test_CreateViewWindow()

static void test_CreateViewWindow ( void  )
static

Definition at line 627 of file shlview.c.

628{
629 IShellFolder *desktop;
630 HWND hwnd_view, hwnd2;
633 IDropTarget *dt;
634 HRESULT hr;
635 RECT r = {0};
636 ULONG ref1, ref2;
637 IUnknown *unk;
638
639 hr = SHGetDesktopFolder(&desktop);
640 ok(hr == S_OK, "got (0x%08x)\n", hr);
641
642 hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
643 ok(hr == S_OK, "got (0x%08x)\n", hr);
644
645 hr = IShellView_QueryInterface(view, &IID_CDefView, (void **)&unk);
646 ok(hr == S_OK, "got (0x%08x)\n", hr);
647 ok(unk == (IUnknown *)view, "got %p\n", unk);
648 IUnknown_Release(unk);
649
650if (0)
651{
652 /* crashes on native */
653 IShellView_CreateViewWindow(view, NULL, &settings, NULL, NULL, NULL);
654}
655
656 settings.ViewMode = FVM_ICON;
657 settings.fFlags = 0;
658 hwnd_view = (HWND)0xdeadbeef;
659 hr = IShellView_CreateViewWindow(view, NULL, &settings, NULL, NULL, &hwnd_view);
660 ok(hr == E_UNEXPECTED, "got (0x%08x)\n", hr);
661 ok(hwnd_view == 0, "got %p\n", hwnd_view);
662
663 hwnd_view = (HWND)0xdeadbeef;
664 hr = IShellView_CreateViewWindow(view, NULL, &settings, NULL, &r, &hwnd_view);
665 ok(hr == E_UNEXPECTED, "got (0x%08x)\n", hr);
666 ok(hwnd_view == 0, "got %p\n", hwnd_view);
667
668 hwnd_view = NULL;
669 hr = IShellView_CreateViewWindow(view, NULL, &settings, &test_shellbrowser, &r, &hwnd_view);
670 ok(hr == S_OK || broken(hr == S_FALSE), "got (0x%08x)\n", hr);
671 ok(hwnd_view != 0, "got %p\n", hwnd_view);
672
673 hwnd2 = (HWND)0xdeadbeef;
674 hr = IShellView_CreateViewWindow(view, NULL, &settings, &test_shellbrowser, &r, &hwnd2);
675 ok(hr == E_UNEXPECTED, "got (0x%08x)\n", hr);
676 ok(hwnd2 == NULL, "got %p\n", hwnd2);
677
678 /* ::DragLeave without drag operation */
679 hr = IShellView_QueryInterface(view, &IID_IDropTarget, (void**)&dt);
680 ok(hr == S_OK, "got (0x%08x)\n", hr);
681 hr = IDropTarget_DragLeave(dt);
682 ok(hr == S_OK, "got (0x%08x)\n", hr);
683 IDropTarget_Release(dt);
684
685 IShellView_AddRef(view);
686 ref1 = IShellView_Release(view);
687 hr = IShellView_DestroyViewWindow(view);
688 ok(hr == S_OK, "got (0x%08x)\n", hr);
689 ok(!IsWindow(hwnd_view), "hwnd %p still valid\n", hwnd_view);
690 ref2 = IShellView_Release(view);
691 ok(ref1 > ref2, "expected %u > %u\n", ref1, ref2);
692 ref1 = ref2;
693
694 /* Show that releasing the shell view does not destroy the window */
695 hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
696 ok(hr == S_OK, "got (0x%08x)\n", hr);
697 hwnd_view = NULL;
698 hr = IShellView_CreateViewWindow(view, NULL, &settings, &test_shellbrowser, &r, &hwnd_view);
699 ok(hr == S_OK || broken(hr == S_FALSE), "got (0x%08x)\n", hr);
700 ok(hwnd_view != NULL, "got %p\n", hwnd_view);
701 ok(IsWindow(hwnd_view), "hwnd %p still valid\n", hwnd_view);
702 ref2 = IShellView_Release(view);
703 ok(ref2 != 0, "ref2 = %u\n", ref2);
704 ok(ref2 > ref1, "expected %u > %u\n", ref2, ref1);
705 ok(IsWindow(hwnd_view), "hwnd %p still valid\n", hwnd_view);
706 DestroyWindow(hwnd_view);
707
708 IShellFolder_Release(desktop);
709}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
struct mke2fs_defaults settings[]
#define broken(x)
Definition: _sntprintf.h:21
HANDLE HWND
Definition: compat.h:19
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
HRESULT hr
Definition: shlfolder.c:183
static IShellBrowser test_shellbrowser
Definition: shlview.c:625
@ FVM_ICON
Definition: shobjidl.idl:674
#define S_FALSE
Definition: winerror.h:2357
#define E_UNEXPECTED
Definition: winerror.h:2456
BOOL WINAPI IsWindow(_In_opt_ HWND)
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().

◆ test_GetItemObject()

static void test_GetItemObject ( void  )
static

Definition at line 875 of file shlview.c.

876{
877 IShellFolder *desktop;
879 IUnknown *unk;
880 HRESULT hr;
881
882 hr = SHGetDesktopFolder(&desktop);
883 ok(hr == S_OK, "got (0x%08x)\n", hr);
884
885 hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
886 ok(hr == S_OK, "got (0x%08x)\n", hr);
887
888 /* from documentation three interfaces are supported for SVGIO_BACKGROUND:
889 IContextMenu, IDispatch, IPersistHistory */
890 hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IContextMenu, (void**)&unk);
891 ok(hr == S_OK, "got (0x%08x)\n", hr);
892 IUnknown_Release(unk);
893
894 unk = NULL;
895 hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IDispatch, (void**)&unk);
896 ok(hr == S_OK || broken(hr == E_NOTIMPL) /* NT4 */, "got (0x%08x)\n", hr);
897 if (unk) IUnknown_Release(unk);
898
899 unk = NULL;
900 hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IPersistHistory, (void**)&unk);
901 todo_wine ok(hr == S_OK || broken(hr == E_NOTIMPL) /* W9x, NT4 */, "got (0x%08x)\n", hr);
902 if (unk) IUnknown_Release(unk);
903
904 /* example of unsupported interface, base for IPersistHistory */
905 hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IPersist, (void**)&unk);
906 ok(hr == E_NOINTERFACE || broken(hr == E_NOTIMPL) /* W2K */, "got (0x%08x)\n", hr);
907
908 IShellView_Release(view);
909 IShellFolder_Release(desktop);
910}
#define todo_wine
Definition: custom.c:79
const GUID IID_IDispatch
const GUID IID_IPersist
Definition: proxy.cpp:14

Referenced by START_TEST().

◆ test_GetSetCurrentViewMode()

static void test_GetSetCurrentViewMode ( void  )
static

Definition at line 1079 of file shlview.c.

1080{
1081 IShellFolder *desktop;
1082 IShellView *sview;
1083 IFolderView *fview;
1084 IShellBrowser *browser;
1086 UINT viewmode;
1087 HWND hwnd;
1088 RECT rc = {0, 0, 10, 10};
1089 HRESULT hr;
1090 UINT i;
1091 static const int winxp_res[11] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
1092 static const int win2k3_res[11] = {0, 1, 2, 3, 4, 5, 6, 5, 8, 0, 0};
1093 static const int vista_res[11] = {0, 1, 5, 3, 4, 5, 6, 7, 7, 0, 0};
1094 static const int win7_res[11] = {1, 1, 1, 3, 4, 1, 6, 1, 8, 8, 8};
1095
1096 hr = SHGetDesktopFolder(&desktop);
1097 ok(hr == S_OK, "got (0x%08x)\n", hr);
1098
1099 hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&sview);
1100 ok(hr == S_OK, "got (0x%08x)\n", hr);
1101
1102 fs.ViewMode = 1;
1103 fs.fFlags = 0;
1104 browser = IShellBrowserImpl_Construct();
1105 hr = IShellView_CreateViewWindow(sview, NULL, &fs, browser, &rc, &hwnd);
1106 ok(hr == S_OK || broken(hr == S_FALSE /*Win2k*/ ), "got (0x%08x)\n", hr);
1107
1108 hr = IShellView_QueryInterface(sview, &IID_IFolderView, (void**)&fview);
1109 ok(hr == S_OK || broken(hr == E_NOINTERFACE), "got (0x%08x)\n", hr);
1110 if(SUCCEEDED(hr))
1111 {
1112 HWND hwnd_lv;
1113 UINT count;
1114
1115 if (0)
1116 {
1117 /* Crashes under Win7/WinXP */
1118 IFolderView_GetCurrentViewMode(fview, NULL);
1119 }
1120
1121 hr = IFolderView_GetCurrentViewMode(fview, &viewmode);
1122 ok(hr == S_OK, "got (0x%08x)\n", hr);
1123 ok(viewmode == 1, "ViewMode was %d\n", viewmode);
1124
1125 hr = IFolderView_SetCurrentViewMode(fview, FVM_AUTO);
1126 ok(hr == S_OK, "got (0x%08x)\n", hr);
1127
1128 hr = IFolderView_SetCurrentViewMode(fview, 0);
1129 ok(hr == E_INVALIDARG || broken(hr == S_OK),
1130 "got (0x%08x)\n", hr);
1131
1132 hr = IFolderView_GetCurrentViewMode(fview, &viewmode);
1133 ok(hr == S_OK, "got (0x%08x)\n", hr);
1134
1135 for(i = 1; i < 9; i++)
1136 {
1137 hr = IFolderView_SetCurrentViewMode(fview, i);
1138 ok(hr == S_OK || (i == 8 && hr == E_INVALIDARG /*Vista*/),
1139 "(%d) got (0x%08x)\n", i, hr);
1140
1141 hr = IFolderView_GetCurrentViewMode(fview, &viewmode);
1142 ok(hr == S_OK, "(%d) got (0x%08x)\n", i, hr);
1143
1144 /* Wine currently behaves like winxp here. */
1145 ok((viewmode == win7_res[i]) || (viewmode == vista_res[i]) ||
1146 (viewmode == win2k3_res[i]) || (viewmode == winxp_res[i]),
1147 "(%d) got %d\n",i , viewmode);
1148 }
1149
1150 hr = IFolderView_SetCurrentViewMode(fview, 9);
1151 ok(hr == E_INVALIDARG || broken(hr == S_OK),
1152 "got (0x%08x)\n", hr);
1153
1154 /* Test messages */
1155 hwnd_lv = subclass_listview(hwnd);
1156 ok(hwnd_lv != NULL, "Failed to subclass listview\n");
1157 if(hwnd_lv)
1158 {
1159 /* Vista seems to set the viewmode by other means than
1160 sending messages. At least no related messages are
1161 captured by subclassing.
1162 */
1163 BOOL vista_plus = FALSE;
1164 static const UINT vista_plus_msgs[] = {
1165 WM_SETREDRAW, WM_NOTIFY, WM_NOTIFYFORMAT, WM_QUERYUISTATE,
1168
1170 hr = IFolderView_SetCurrentViewMode(fview, 1);
1171 ok(hr == S_OK, "got 0x%08x\n", hr);
1172
1173 /* WM_SETREDRAW is not sent in versions before Vista. */
1175 if(vista_plus)
1176 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1177 else
1179 "IFolderView::SetCurrentViewMode(1)", TRUE);
1180
1181 hr = IFolderView_SetCurrentViewMode(fview, 2);
1182 ok(hr == S_OK, "got 0x%08x\n", hr);
1183 if(vista_plus)
1184 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1185 else
1187 "IFolderView::SetCurrentViewMode(2)", TRUE);
1188
1189 hr = IFolderView_SetCurrentViewMode(fview, 3);
1190 ok(hr == S_OK, "got 0x%08x\n", hr);
1191 if(vista_plus)
1192 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1193 else
1195 "IFolderView::SetCurrentViewMode(3)", TRUE);
1196
1197 hr = IFolderView_SetCurrentViewMode(fview, 4);
1198 ok(hr == S_OK, "got 0x%08x\n", hr);
1199 if(vista_plus)
1200 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1201 else
1203 "IFolderView::SetCurrentViewMode(4)", TRUE);
1204
1205 hr = IFolderView_SetCurrentViewMode(fview, 5);
1206 ok(hr == S_OK, "got 0x%08x\n", hr);
1207 todo_wine
1208 {
1209 if(vista_plus)
1210 {
1211 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1212 }
1213 else
1214 {
1216 ok(count == 1, "LVM_SETVIEW sent %d times.\n", count);
1218 ok(count == 1 || count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count);
1220 }
1221 }
1222
1223 hr = IFolderView_SetCurrentViewMode(fview, 6);
1224 ok(hr == S_OK, "got 0x%08x\n", hr);
1225 todo_wine
1226 {
1227 if(vista_plus)
1228 {
1229 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1230 }
1231 else
1232 {
1234 ok(count == 1, "LVM_SETVIEW sent %d times.\n", count);
1236 ok(count == 1 || count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count);
1238 }
1239 }
1240
1241 hr = IFolderView_SetCurrentViewMode(fview, 7);
1242 ok(hr == S_OK, "got 0x%08x\n", hr);
1243 todo_wine
1244 {
1245 if(vista_plus)
1246 {
1247 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1248 }
1249 else
1250 {
1252 ok(count == 1, "LVM_SETVIEW sent %d times.\n", count);
1254 ok(count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count);
1256 }
1257 }
1258
1259 hr = IFolderView_SetCurrentViewMode(fview, 8);
1260 ok(hr == S_OK || broken(hr == E_INVALIDARG /* Vista */), "got 0x%08x\n", hr);
1261 todo_wine
1262 {
1263 if(vista_plus)
1264 {
1265 verify_msgs_in(sequences[LISTVIEW_SEQ_INDEX], vista_plus_msgs);
1266 }
1267 else
1268 {
1270 ok(count == 1, "LVM_SETVIEW sent %d times.\n", count);
1272 ok(count == 2, "LVM_SETEXTENDEDLISTVIEWSTYLE sent %d times.\n", count);
1274 }
1275 }
1276
1277 hr = IFolderView_GetCurrentViewMode(fview, &viewmode);
1278 ok(hr == S_OK, "Failed to get current viewmode.\n");
1280 "IFolderView::GetCurrentViewMode", FALSE);
1281 }
1282
1283 IFolderView_Release(fview);
1284 }
1285 else
1286 {
1287 skip("No IFolderView for the desktop folder.\n");
1288 }
1289
1290 IShellBrowser_Release(browser);
1291 IShellView_DestroyViewWindow(sview);
1292 IShellView_Release(sview);
1293 IShellFolder_Release(desktop);
1294}
#define ok_sequence(exp, contx, todo)
Definition: SystemMenu.c:275
#define skip(...)
Definition: atltest.h:64
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define fs
Definition: i386-dis.c:444
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define LVM_GETHEADER
Definition: commctrl.h:2650
#define LVM_SETVIEW
Definition: commctrl.h:2846
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2724
#define WM_NOTIFY
Definition: richedit.h:61
#define verify_msgs_in(seq, msgs)
Definition: shlview.c:137
static const struct message folderview_setcurrentviewmode3_prevista[]
Definition: shlview.c:1008
static HWND subclass_listview(HWND hwnd)
Definition: shlview.c:77
static const struct message folderview_setcurrentviewmode4_prevista[]
Definition: shlview.c:1021
static IShellBrowser * IShellBrowserImpl_Construct(void)
Definition: shlview.c:278
static const struct message folderview_setcurrentviewmode1_2_prevista[]
Definition: shlview.c:993
static UINT get_msg_count(struct msg_sequence **seq, int sequence_index, UINT message)
Definition: shlview.c:102
static const struct message empty_seq[]
Definition: shlview.c:468
@ FVM_AUTO
Definition: shobjidl.idl:673
Definition: ffs.h:70
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1661
#define WM_MENUCHAR
Definition: winuser.h:1748
#define WM_PARENTNOTIFY
Definition: winuser.h:1803
#define WM_NCCALCSIZE
Definition: winuser.h:1685
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1662
#define WM_SETREDRAW
Definition: winuser.h:1616

Referenced by START_TEST().

◆ test_IFolderView()

static void test_IFolderView ( void  )
static

Definition at line 711 of file shlview.c.

712{
713 IShellFolder *desktop, *folder;
716 IShellBrowser *browser;
717 IFolderView2 *fv2;
718 IFolderView *fv;
719 IUnknown *unk;
720 HWND hwnd_view, hwnd_list;
721 PITEMID_CHILD pidl;
722 HRESULT hr;
723 INT ret, count;
724 POINT pt;
725 RECT r;
726
727 hr = SHGetDesktopFolder(&desktop);
728 ok(hr == S_OK, "got (0x%08x)\n", hr);
729
730 hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
731 ok(hr == S_OK, "got (0x%08x)\n", hr);
732
733 hr = IShellView_QueryInterface(view, &IID_IFolderView, (void**)&fv);
734 if (hr != S_OK)
735 {
736 win_skip("IFolderView not supported by desktop folder\n");
737 IShellView_Release(view);
738 IShellFolder_Release(desktop);
739 return;
740 }
741
742 /* call methods before window creation */
743 hr = IFolderView_GetSpacing(fv, NULL);
744 ok(hr == S_FALSE || broken(hr == S_OK) /* win7 */, "got (0x%08x)\n", hr);
745
746 pidl = (void*)0xdeadbeef;
747 hr = IFolderView_Item(fv, 0, &pidl);
748 ok(hr == E_INVALIDARG || broken(hr == E_FAIL) /* < Vista */, "got (0x%08x)\n", hr);
749 ok(pidl == 0 || broken(pidl == (void*)0xdeadbeef) /* < Vista */, "got %p\n", pidl);
750
751if (0)
752{
753 /* crashes on Vista and Win2k8 - List not created yet case */
754 IFolderView_GetSpacing(fv, &pt);
755
756 /* crashes on XP */
757 IFolderView_GetSelectionMarkedItem(fv, NULL);
758 IFolderView_GetFocusedItem(fv, NULL);
759
760 /* crashes on Vista+ */
761 IFolderView_Item(fv, 0, NULL);
762}
763
764 browser = IShellBrowserImpl_Construct();
765
766 settings.ViewMode = FVM_ICON;
767 settings.fFlags = 0;
768 hwnd_view = (HWND)0xdeadbeef;
769 SetRect(&r, 0, 0, 100, 100);
770 hr = IShellView_CreateViewWindow(view, NULL, &settings, browser, &r, &hwnd_view);
771 ok(hr == S_OK, "got (0x%08x)\n", hr);
772 ok(IsWindow(hwnd_view), "got %p\n", hwnd_view);
773
774 hwnd_list = subclass_listview(hwnd_view);
775 if (!hwnd_list)
776 {
777 win_skip("Failed to subclass ListView control\n");
778 IShellBrowser_Release(browser);
779 IFolderView_Release(fv);
780 IShellView_Release(view);
781 IShellFolder_Release(desktop);
782 return;
783 }
784
785 /* IFolderView::GetSpacing */
787 hr = IFolderView_GetSpacing(fv, NULL);
788 ok(hr == S_OK, "got (0x%08x)\n", hr);
789 ok_sequence(sequences, LISTVIEW_SEQ_INDEX, empty_seq, "IFolderView::GetSpacing, empty", FALSE);
790
792 hr = IFolderView_GetSpacing(fv, &pt);
793 ok(hr == S_OK, "got (0x%08x)\n", hr);
794 /* fails with empty sequence on win7 for unknown reason */
796 {
798 ok(pt.x > 0, "got %d\n", pt.x);
799 ok(pt.y > 0, "got %d\n", pt.y);
800 ret = SendMessageA(hwnd_list, LVM_GETITEMSPACING, 0, 0);
801 ok(pt.x == LOWORD(ret) && pt.y == HIWORD(ret), "got (%d, %d)\n", LOWORD(ret), HIWORD(ret));
802 }
803
804 /* IFolderView::ItemCount */
805if (0)
806{
807 /* crashes on XP */
808 IFolderView_ItemCount(fv, SVGIO_ALLVIEW, NULL);
809}
810
812 IFolderView_ItemCount(fv, SVGIO_ALLVIEW, &count);
813
814 /* IFolderView::GetSelectionMarkedItem */
815if (0)
816{
817 /* crashes on XP */
818 IFolderView_GetSelectionMarkedItem(fv, NULL);
819}
820
822 hr = IFolderView_GetSelectionMarkedItem(fv, &ret);
823 if (count)
824 ok(hr == S_OK, "got (0x%08x)\n", hr);
825 else
826 ok(hr == S_FALSE, "got (0x%08x)\n", hr);
828 "IFolderView::GetSelectionMarkedItem", FALSE);
829
830 /* IFolderView::GetFocusedItem */
832 hr = IFolderView_GetFocusedItem(fv, &ret);
833 if (count)
834 ok(hr == S_OK, "got (0x%08x)\n", hr);
835 else
836 ok(hr == S_FALSE, "got (0x%08x)\n", hr);
838 "IFolderView::GetFocusedItem", FALSE);
839
840 /* IFolderView::GetFolder, just return pointer */
841if (0)
842{
843 /* crashes on XP */
844 IFolderView_GetFolder(fv, NULL, (void**)&folder);
845 IFolderView_GetFolder(fv, NULL, NULL);
846}
847
848 hr = IFolderView_GetFolder(fv, &IID_IShellFolder, NULL);
849 ok(hr == E_POINTER, "got (0x%08x)\n", hr);
850
851 hr = IFolderView_GetFolder(fv, &IID_IShellFolder, (void**)&folder);
852 ok(hr == S_OK, "got (0x%08x)\n", hr);
853 ok(desktop == folder, "\n");
854 if (folder) IShellFolder_Release(folder);
855
856 hr = IFolderView_GetFolder(fv, &IID_IUnknown, (void**)&unk);
857 ok(hr == S_OK, "got (0x%08x)\n", hr);
858 if (unk) IUnknown_Release(unk);
859
860 hr = IFolderView_QueryInterface(fv, &IID_IFolderView2, (void**)&fv2);
861 if (hr != S_OK)
862 win_skip("IFolderView2 is not supported.\n");
863 if (fv2) IFolderView2_Release(fv2);
864
865 hr = IShellView_DestroyViewWindow(view);
866 ok(hr == S_OK, "got (0x%08x)\n", hr);
867 ok(!IsWindow(hwnd_view), "hwnd %p still valid\n", hwnd_view);
868
869 IShellBrowser_Release(browser);
870 IFolderView_Release(fv);
871 IShellView_Release(view);
872 IShellFolder_Release(desktop);
873}
#define E_FAIL
Definition: ddrawi.h:102
#define pt(x, y)
Definition: drawing.c:79
#define LOWORD(l)
Definition: pedump.c:82
#define LVM_GETITEMSPACING
Definition: commctrl.h:2711
#define win_skip
Definition: test.h:160
static const struct message folderview_getspacing_seq[]
Definition: shlview.c:472
static const struct message folderview_getfocused_seq[]
Definition: shlview.c:482
static const struct message folderview_getselectionmarked_seq[]
Definition: shlview.c:477
Definition: fci.c:116
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define E_POINTER
Definition: winerror.h:2365
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by START_TEST().

◆ test_IOleCommandTarget()

static void test_IOleCommandTarget ( void  )
static

Definition at line 1296 of file shlview.c.

1297{
1298 IShellFolder *psf_desktop;
1299 IShellView *psv;
1300 IOleCommandTarget *poct;
1301 HRESULT hr;
1302
1303 hr = SHGetDesktopFolder(&psf_desktop);
1304 ok(hr == S_OK, "got (0x%08x)\n", hr);
1305
1306 hr = IShellFolder_CreateViewObject(psf_desktop, NULL, &IID_IShellView, (void**)&psv);
1307 ok(hr == S_OK, "got (0x%08x)\n", hr);
1308 if(SUCCEEDED(hr))
1309 {
1310 hr = IShellView_QueryInterface(psv, &IID_IOleCommandTarget, (void**)&poct);
1311 ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* Win95/NT4 */, "Got 0x%08x\n", hr);
1312 if(SUCCEEDED(hr))
1313 {
1314 OLECMD oc;
1315
1316 hr = IOleCommandTarget_QueryStatus(poct, NULL, 0, NULL, NULL);
1317 ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
1318
1319 oc.cmdID = 1;
1320 hr = IOleCommandTarget_QueryStatus(poct, NULL, 0, &oc, NULL);
1321 ok(hr == OLECMDERR_E_UNKNOWNGROUP, "Got 0x%08x\n", hr);
1322
1323 oc.cmdID = 1;
1324 hr = IOleCommandTarget_QueryStatus(poct, NULL, 1, &oc, NULL);
1325 ok(hr == OLECMDERR_E_UNKNOWNGROUP, "Got 0x%08x\n", hr);
1326
1327 hr = IOleCommandTarget_Exec(poct, NULL, 0, 0, NULL, NULL);
1328 ok(hr == OLECMDERR_E_UNKNOWNGROUP, "Got 0x%08x\n", hr);
1329
1330 IOleCommandTarget_Release(poct);
1331 }
1332
1333 IShellView_Release(psv);
1334 }
1335
1336 IShellFolder_Release(psf_desktop);
1337}

Referenced by START_TEST().

◆ test_IOleWindow()

static void test_IOleWindow ( void  )
static

Definition at line 967 of file shlview.c.

968{
969 IShellFolder *desktop;
971 IOleWindow *wnd;
972 HRESULT hr;
973
974 hr = SHGetDesktopFolder(&desktop);
975 ok(hr == S_OK, "got (0x%08x)\n", hr);
976
977 hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
978 ok(hr == S_OK, "got (0x%08x)\n", hr);
979
980 hr = IShellView_QueryInterface(view, &IID_IOleWindow, (void**)&wnd);
981 ok(hr == E_NOINTERFACE, "got (0x%08x)\n", hr);
982
983 /* IShellView::ContextSensitiveHelp */
984 hr = IShellView_ContextSensitiveHelp(view, TRUE);
985 ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
986 hr = IShellView_ContextSensitiveHelp(view, FALSE);
987 ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
988
989 IShellView_Release(view);
990 IShellFolder_Release(desktop);
991}

Referenced by START_TEST().

◆ test_IShellFolderView()

static void test_IShellFolderView ( void  )
static

Definition at line 912 of file shlview.c.

913{
914 IShellFolderView *folderview;
915 IShellFolder *desktop;
918 UINT i;
919 HRESULT hr;
920
921 hr = SHGetDesktopFolder(&desktop);
922 ok(hr == S_OK, "got (0x%08x)\n", hr);
923
924 hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
925 ok(hr == S_OK, "got (0x%08x)\n", hr);
926
927 hr = IShellView_QueryInterface(view, &IID_IShellFolderView, (void**)&folderview);
928 if (hr != S_OK)
929 {
930 win_skip("IShellView doesn't provide IShellFolderView on this platform\n");
931 IShellView_Release(view);
932 IShellFolder_Release(desktop);
933 return;
934 }
935
936 /* ::MoveIcons */
938 hr = IShellFolderView_MoveIcons(folderview, obj);
939 ok(hr == E_NOTIMPL || broken(hr == S_OK) /* W98 */, "got (0x%08x)\n", hr);
940 IDataObject_Release(obj);
941
942 /* ::SetRedraw without list created */
943 hr = IShellFolderView_SetRedraw(folderview, TRUE);
944 ok(hr == S_OK, "got (0x%08x)\n", hr);
945
946 /* ::QuerySupport */
948 ok(hr == S_OK, "got (0x%08x)\n", hr);
949 i = 0xdeadbeef;
950 hr = IShellFolderView_QuerySupport(folderview, &i);
951 ok(hr == S_OK, "got (0x%08x)\n", hr);
952 ok(i == 0xdeadbeef, "got %d\n", i);
953
954 /* ::RemoveObject */
955 i = 0xdeadbeef;
956 hr = IShellFolderView_RemoveObject(folderview, NULL, &i);
957 ok(hr == S_OK || hr == E_FAIL, "got (0x%08x)\n", hr);
958 if (hr == S_OK) ok(i == 0 || broken(i == 0xdeadbeef) /* Vista, 2k8 */,
959 "got %d\n", i);
960
961 IShellFolderView_Release(folderview);
962
963 IShellView_Release(view);
964 IShellFolder_Release(desktop);
965}
#define IShellFolderView_Release(p)
Definition: shlobj.h:924
#define IShellFolderView_MoveIcons(p, a)
Definition: shlobj.h:944
#define IShellFolderView_QuerySupport(p, a)
Definition: shlobj.h:952
#define IShellFolderView_RemoveObject(p, a, b)
Definition: shlobj.h:933
#define IShellFolderView_SetRedraw(p, a)
Definition: shlobj.h:938
static IDataObject * IDataObjectImpl_Construct(void)
Definition: shlview.c:153

Referenced by START_TEST().

◆ test_newmenu()

static void test_newmenu ( void  )
static

Definition at line 1480 of file shlview.c.

1481{
1482 IUnknown *unk, *unk2;
1483 HRESULT hr;
1484
1485 hr = CoCreateInstance(&CLSID_NewMenu, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
1486 ok(hr == S_OK, "Failed to create NewMenu object, hr %#x.\n", hr);
1487 if (hr != S_OK)
1488 {
1489 skip("NewMenu is not supported.\n");
1490 return;
1491 }
1492
1493 hr = IUnknown_QueryInterface(unk, &IID_IShellExtInit, (void **)&unk2);
1494 ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr);
1495 IUnknown_Release(unk2);
1496
1497 hr = IUnknown_QueryInterface(unk, &IID_IContextMenu, (void **)&unk2);
1498 ok(hr == S_OK, "Failed to get IContextMenu, hr %#x.\n", hr);
1499 IUnknown_Release(unk2);
1500
1501 hr = IUnknown_QueryInterface(unk, &IID_IContextMenu2, (void **)&unk2);
1502 ok(hr == S_OK, "Failed to get IContextMenu2, hr %#x.\n", hr);
1503 IUnknown_Release(unk2);
1504
1505 hr = IUnknown_QueryInterface(unk, &IID_IContextMenu3, (void **)&unk2);
1506 ok(hr == S_OK, "Failed to get IContextMenu3, hr %#x.\n", hr);
1507 IUnknown_Release(unk2);
1508
1509 hr = IUnknown_QueryInterface(unk, &IID_IObjectWithSite, (void **)&unk2);
1510 ok(hr == S_OK, "Failed to get IObjectWithSite, hr %#x.\n", hr);
1511 IUnknown_Release(unk2);
1512
1513 IUnknown_Release(unk);
1514}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
const IID IID_IObjectWithSite

Referenced by START_TEST().

◆ test_SHCreateShellFolderView()

static void test_SHCreateShellFolderView ( void  )
static

Definition at line 1339 of file shlview.c.

1340{
1341 IShellFolder *desktop;
1342 IShellView *psv;
1343 SFV_CREATE sfvc;
1344 ULONG refCount;
1345 IUnknown *unk;
1346 HRESULT hr;
1347
1348 hr = SHGetDesktopFolder(&desktop);
1349 ok(hr == S_OK, "got (0x%08x)\n", hr);
1350
1351 if (0)
1352 {
1353 /* crash on win7 */
1355 }
1356
1357 psv = (void *)0xdeadbeef;
1359 ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
1360 ok(psv == NULL, "psv = %p\n", psv);
1361
1362 memset(&sfvc, 0, sizeof(sfvc));
1363 psv = (void *)0xdeadbeef;
1364 hr = SHCreateShellFolderView(&sfvc, &psv);
1365 ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
1366 ok(psv == NULL, "psv = %p\n", psv);
1367
1368 memset(&sfvc, 0, sizeof(sfvc));
1369 sfvc.cbSize = sizeof(sfvc) - 1;
1370 psv = (void *)0xdeadbeef;
1371 hr = SHCreateShellFolderView(&sfvc, &psv);
1372 ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
1373 ok(psv == NULL, "psv = %p\n", psv);
1374
1375 memset(&sfvc, 0, sizeof(sfvc));
1376 sfvc.cbSize = sizeof(sfvc) + 1;
1377 psv = (void *)0xdeadbeef;
1378 hr = SHCreateShellFolderView(&sfvc, &psv);
1379 ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
1380 ok(psv == NULL, "psv = %p\n", psv);
1381
1382if (0)
1383{
1384 /* Crashes on NULL 'pshf' on XP/2k3 */
1385 memset(&sfvc, 0, sizeof(sfvc));
1386 sfvc.cbSize = sizeof(sfvc);
1387 psv = (void *)0xdeadbeef;
1388 hr = SHCreateShellFolderView(&sfvc, &psv);
1389 ok(hr == E_UNEXPECTED, "Got 0x%08x\n", hr);
1390 ok(psv == NULL, "psv = %p\n", psv);
1391}
1392 memset(&sfvc, 0, sizeof(sfvc));
1393 sfvc.cbSize = sizeof(sfvc) - 1;
1394 sfvc.pshf = desktop;
1395 psv = (void *)0xdeadbeef;
1396 hr = SHCreateShellFolderView(&sfvc, &psv);
1397 ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
1398 ok(psv == NULL, "psv = %p\n", psv);
1399
1400 memset(&sfvc, 0, sizeof(sfvc));
1401 sfvc.cbSize = sizeof(sfvc);
1402 sfvc.pshf = desktop;
1403 psv = NULL;
1404 hr = SHCreateShellFolderView(&sfvc, &psv);
1405 ok(hr == S_OK, "Got 0x%08x\n", hr);
1406 ok(psv != NULL, "psv = %p\n", psv);
1407
1408 hr = IShellView_QueryInterface(psv, &IID_CDefView, (void **)&unk);
1409 ok(hr == S_OK, "got (0x%08x)\n", hr);
1410 ok(unk == (IUnknown *)psv, "got %p\n", unk);
1411 IUnknown_Release(unk);
1412
1413 refCount = IShellView_Release(psv);
1414 ok(refCount == 0, "refCount = %u\n", refCount);
1415
1416 IShellFolder_Release(desktop);
1417}
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3857
#define memset(x, y, z)
Definition: compat.h:39
UINT cbSize
Definition: shlobj.h:1348
IShellFolder * pshf
Definition: shlobj.h:1349

Referenced by START_TEST().

◆ test_SHCreateShellFolderViewEx()

static void test_SHCreateShellFolderViewEx ( void  )
static

Definition at line 1419 of file shlview.c.

1420{
1421 IShellFolder *desktop;
1422 IShellView *psv;
1423 ULONG refCount;
1424 IUnknown *unk;
1425 HRESULT hr;
1426 CSFV csfv;
1427
1428 hr = SHGetDesktopFolder(&desktop);
1429 ok(hr == S_OK, "got (0x%08x)\n", hr);
1430
1431 if (0)
1432 {
1433 /* crash on win7 */
1437 }
1438
1439 memset(&csfv, 0, sizeof(csfv));
1440 csfv.pshf = desktop;
1441 psv = NULL;
1442 hr = SHCreateShellFolderViewEx(&csfv, &psv);
1443 ok(hr == S_OK, "Got 0x%08x\n", hr);
1444 ok(psv != NULL, "psv = %p\n", psv);
1445
1446 hr = IShellView_QueryInterface(psv, &IID_CDefView, (void **)&unk);
1447 ok(hr == S_OK, "got (0x%08x)\n", hr);
1448 ok(unk == (IUnknown *)psv, "got %p\n", unk);
1449 IUnknown_Release(unk);
1450
1451 refCount = IShellView_Release(psv);
1452 ok(refCount == 0, "refCount = %u\n", refCount);
1453
1454if (0)
1455{
1456 /* Crashes on null shellfolder, on XP/2k3 */
1457 memset(&csfv, 0, sizeof(csfv));
1458 csfv.pshf = NULL;
1459 psv = (void *)0xdeadbeef;
1460 hr = SHCreateShellFolderViewEx(&csfv, &psv);
1461 ok(hr == E_UNEXPECTED, "Got 0x%08x\n", hr);
1462 ok(psv == NULL, "psv = %p\n", psv);
1463}
1464 memset(&csfv, 0, sizeof(csfv));
1465 csfv.cbSize = sizeof(csfv);
1466 csfv.pshf = desktop;
1467 psv = NULL;
1468 hr = SHCreateShellFolderViewEx(&csfv, &psv);
1469 ok(hr == S_OK, "Got 0x%08x\n", hr);
1470 ok(psv != NULL, "psv = %p\n", psv);
1471 if (psv)
1472 {
1473 refCount = IShellView_Release(psv);
1474 ok(refCount == 0, "refCount = %u\n", refCount);
1475 }
1476
1477 IShellFolder_Release(desktop);
1478}
HRESULT WINAPI SHCreateShellFolderViewEx(LPCSFV psvcbi, IShellView **ppsv)
Definition: CDefView.cpp:3837
Definition: shlobj.h:1268
UINT cbSize
Definition: shlobj.h:1269
IShellFolder * pshf
Definition: shlobj.h:1270

Referenced by START_TEST().

◆ verify_msgs_in_()

static void verify_msgs_in_ ( struct msg_sequence seq,
const UINT msgs,
const char file,
int  line 
)
static

Definition at line 116 of file shlview.c.

118{
119 UINT i, j, msg, failcount = 0;
120 for(i = 0; i < seq->count; i++)
121 {
122 BOOL found = FALSE;
123 msg = seq->sequence[i].message;
124 for(j = 0; msgs[j] != 0; j++)
125 if(msgs[j] == msg) found = TRUE;
126
127 if(!found)
128 {
129 failcount++;
130 trace("Unexpected message %d\n", msg);
131 }
132 }
133 ok_(file, line) (!failcount, "%d failures.\n", failcount);
135}
#define trace
Definition: atltest.h:70
#define ok_(x1, x2)
Definition: atltest.h:61
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
Definition: fci.c:127
Definition: parser.c:49

Variable Documentation

◆ empty_seq

const struct message empty_seq[]
static
Initial value:
= {
{ 0 }
}

Definition at line 468 of file shlview.c.

Referenced by test_GetSetCurrentViewMode(), and test_IFolderView().

◆ folderview_getfocused_seq

const struct message folderview_getfocused_seq[]
static
Initial value:
= {
{ 0 }
}
@ optional
Definition: SystemMenu.c:34
#define LVNI_FOCUSED
Definition: commctrl.h:2423
#define LVM_GETNEXTITEM
Definition: commctrl.h:2433

Definition at line 482 of file shlview.c.

Referenced by test_IFolderView().

◆ folderview_getselectionmarked_seq

const struct message folderview_getselectionmarked_seq[]
static
Initial value:
= {
{ 0 }
}
#define LVM_GETSELECTIONMARK
Definition: commctrl.h:2788

Definition at line 477 of file shlview.c.

Referenced by test_IFolderView().

◆ folderview_getspacing_seq

const struct message folderview_getspacing_seq[]
static
Initial value:
= {
{ 0 }
}

Definition at line 472 of file shlview.c.

Referenced by test_IFolderView().

◆ folderview_setcurrentviewmode1_2_prevista

const struct message folderview_setcurrentviewmode1_2_prevista[]
static
Initial value:
= {
{ 0x105a, sent},
{ 0 }
}
#define LVM_ARRANGE
Definition: commctrl.h:2532
#define LVM_SETIMAGELIST
Definition: commctrl.h:2303
#define LVM_SETBKIMAGEW
Definition: commctrl.h:2832
#define LVM_GETBKCOLOR
Definition: commctrl.h:2291
#define LVM_GETTEXTCOLOR
Definition: commctrl.h:2656
#define LV_VIEW_ICON
Definition: commctrl.h:2840
#define LVM_GETTEXTBKCOLOR
Definition: commctrl.h:2660

Definition at line 993 of file shlview.c.

Referenced by test_GetSetCurrentViewMode().

◆ folderview_setcurrentviewmode3_prevista

const struct message folderview_setcurrentviewmode3_prevista[]
static

◆ folderview_setcurrentviewmode4_prevista

const struct message folderview_setcurrentviewmode4_prevista[]
static

◆ IDataObjectImpl_Vtbl

static const IDataObjectVtbl IDataObjectImpl_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IDataObjectImpl_EnumFormatEtc(IDataObject *iface, DWORD direction, IEnumFORMATETC **ppenumFormatEtc)
Definition: shlview.c:227
static HRESULT WINAPI IDataObjectImpl_DUnadvise(IDataObject *iface, DWORD connection)
Definition: shlview.c:239
static HRESULT WINAPI IDataObjectImpl_GetCanonicalFormatEtc(IDataObject *iface, FORMATETC *pformatIn, FORMATETC *pformatOut)
Definition: shlview.c:215
static HRESULT WINAPI IDataObjectImpl_DAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pSink, DWORD *pConnection)
Definition: shlview.c:233
static HRESULT WINAPI IDataObjectImpl_GetData(IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium)
Definition: shlview.c:200
static ULONG WINAPI IDataObjectImpl_Release(IDataObject *iface)
Definition: shlview.c:189
static HRESULT WINAPI IDataObjectImpl_GetDataHere(IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium)
Definition: shlview.c:205
static HRESULT WINAPI IDataObjectImpl_SetData(IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium, BOOL release)
Definition: shlview.c:221
static HRESULT WINAPI IDataObjectImpl_QueryInterface(IDataObject *iface, REFIID riid, void **ppvObj)
Definition: shlview.c:164
static HRESULT WINAPI IDataObjectImpl_QueryGetData(IDataObject *iface, FORMATETC *pformat)
Definition: shlview.c:210
static HRESULT WINAPI IDataObjectImpl_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
Definition: shlview.c:244
static ULONG WINAPI IDataObjectImpl_AddRef(IDataObject *iface)
Definition: shlview.c:183

Definition at line 146 of file shlview.c.

Referenced by IDataObjectImpl_Construct().

◆ IShellBrowserImpl_Vtbl

static const IShellBrowserVtbl IShellBrowserImpl_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface, LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags)
Definition: shlview.c:429
static HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface, DWORD mode, LPSTREAM *pStrm)
Definition: shlview.c:365
static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, REFIID riid, LPVOID *ppvObj)
Definition: shlview.c:289
static HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface, UINT id, HWND *lphwnd)
Definition: shlview.c:357
static ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser *iface)
Definition: shlview.c:313
static HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface, UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
Definition: shlview.c:402
static HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser *iface, BOOL fEnterMode)
Definition: shlview.c:337
static HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface, BOOL fEnable)
Definition: shlview.c:350
static HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface, HMENU hmenuShared)
Definition: shlview.c:395
static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, LPCITEMIDLIST pidl, UINT wFlags)
Definition: shlview.c:343
static HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
Definition: shlview.c:373
static HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface, HMENU hmenuShared, HOLEMENU holemenuReserved, HWND hwndActiveObject)
Definition: shlview.c:413
static HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface, IShellView *ppshv)
Definition: shlview.c:381
static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser *iface)
Definition: shlview.c:319
static HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface, LPCOLESTR lpszStatusText)
Definition: shlview.c:422
static HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface, IShellView **ppshv)
Definition: shlview.c:388
static HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser *iface, HWND *phwnd)
Definition: shlview.c:330
static HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface, LPMSG lpmsg, WORD wID)
Definition: shlview.c:438

Definition at line 271 of file shlview.c.

Referenced by IShellBrowserImpl_Construct().

◆ sequences

◆ shellbrowservtbl

const IShellBrowserVtbl shellbrowservtbl
static
Initial value:
= {
}
static HRESULT WINAPI shellbrowser_OnViewWindowActive(IShellBrowser *iface, IShellView *view)
Definition: shlview.c:592
static HRESULT WINAPI shellbrowser_SendControlMsg(IShellBrowser *iface, UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
Definition: shlview.c:580
static HRESULT WINAPI shellbrowser_GetControlWindow(IShellBrowser *iface, UINT id, HWND *phwnd)
Definition: shlview.c:575
static HRESULT WINAPI shellbrowser_QueryActiveShellView(IShellBrowser *iface, IShellView **view)
Definition: shlview.c:586
static HRESULT WINAPI shellbrowser_InsertMenusSB(IShellBrowser *iface, HMENU hmenuShared, OLEMENUGROUPWIDTHS *menuwidths)
Definition: shlview.c:529
static HRESULT WINAPI shellbrowser_RemoveMenusSB(IShellBrowser *iface, HMENU hmenuShared)
Definition: shlview.c:541
static HRESULT WINAPI shellbrowser_SetStatusTextSB(IShellBrowser *iface, LPCOLESTR text)
Definition: shlview.c:546
static ULONG WINAPI shellbrowser_Release(IShellBrowser *iface)
Definition: shlview.c:512
static HRESULT WINAPI shellbrowser_SetMenuSB(IShellBrowser *iface, HMENU hmenuShared, HOLEMENU holemenuReserved, HWND hwndActiveObject)
Definition: shlview.c:535
static HRESULT WINAPI shellbrowser_SetToolbarItems(IShellBrowser *iface, LPTBBUTTONSB buttons, UINT count, UINT flags)
Definition: shlview.c:598
static HRESULT WINAPI shellbrowser_ContextSensitiveHelp(IShellBrowser *iface, BOOL mode)
Definition: shlview.c:523
static HRESULT WINAPI shellbrowser_QueryInterface(IShellBrowser *iface, REFIID riid, void **ppv)
Definition: shlview.c:487
static HRESULT WINAPI shellbrowser_BrowseObject(IShellBrowser *iface, LPCITEMIDLIST pidl, UINT flags)
Definition: shlview.c:564
static HRESULT WINAPI shellbrowser_TranslateAcceleratorSB(IShellBrowser *iface, MSG *pmsg, WORD wID)
Definition: shlview.c:558
static ULONG WINAPI shellbrowser_AddRef(IShellBrowser *iface)
Definition: shlview.c:507
static HRESULT WINAPI shellbrowser_GetViewStateStream(IShellBrowser *iface, DWORD mode, IStream **stream)
Definition: shlview.c:570
static HRESULT WINAPI shellbrowser_GetWindow(IShellBrowser *iface, HWND *phwnd)
Definition: shlview.c:517
static HRESULT WINAPI shellbrowser_EnableModelessSB(IShellBrowser *iface, BOOL enable)
Definition: shlview.c:552

Definition at line 604 of file shlview.c.

◆ test_shellbrowser

IShellBrowser test_shellbrowser = { &shellbrowservtbl }
static

Definition at line 625 of file shlview.c.

Referenced by test_CreateViewWindow().