ReactOS 0.4.17-dev-966-gf06eace
itemdlg.c File Reference
#include "shlobj.h"
#include "wine/test.h"
#include <initguid.h>
Include dependency graph for itemdlg.c:

Go to the source code of this file.

Classes

struct  fw_arg
 
struct  IFileDialogEventsImpl
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define IDT_CHANGEFILETYPE   500
 
#define IDT_CLOSEDIALOG   501
 
#define IDT_SHOWDIALOG   502
 
#define MAKEFUNC(f)   (p##f = (void*)GetProcAddress(hmod, #f))
 
#define ensure_zero_events(impl)   ensure_zero_events_(__FILE__, __LINE__, impl)
 
#define test_filename_savedlg(set_filename, set_filename2, defext, filterspec, fs_count, ft_index, exp_filename)    test_filename_savedlg_(set_filename, set_filename2, defext, filterspec, fs_count, ft_index, exp_filename, __FILE__, __LINE__)
 
#define test_filename_opendlg(set_filename, set_filename2, psi, defext, filterspec, fs_count, ft_index, exp_filename)    test_filename_opendlg_(set_filename, set_filename2, psi, defext, filterspec, fs_count, ft_index, exp_filename, __FILE__, __LINE__)
 

Enumerations

enum  FileDialogEventsTest {
  IFDEVENT_TEST_NONE = 0 , IFDEVENT_TEST1 = 0x1 , IFDEVENT_TEST2 = 0x2 , IFDEVENT_TEST3 = 0x3 ,
  IFDEVENT_TEST4 = 0x4
}
 

Functions

static HRESULT (WINAPI *pSHCreateShellItem)(LPCITEMIDLIST
 
static IShellFolder IShellItem **static PIDLIST_ABSOLUTE *static IBindCtx void **static void init_function_pointers (void)
 
 DEFINE_GUID (IID_IFileDialogCustomizeAlt, 0x8016B7B3, 0x3D49, 0x4504, 0xA0, 0xAA, 0x2A, 0x37, 0x49, 0x4E, 0x60, 0x6F)
 
static BOOL CALLBACK find_window_callback (HWND hwnd, LPARAM lparam)
 
static HWND find_window (HWND parent, LPCWSTR class, LPCWSTR text)
 
static HWND get_hwnd_from_ifiledialog (IFileDialog *pfd)
 
static void test_customize_onfolderchange (IFileDialog *pfd)
 
static void filedialog_change_filetype (IFileDialog *pfd, HWND dlg_hwnd)
 
static IFileDialogEventsImpl * impl_from_IFileDialogEvents (IFileDialogEvents *iface)
 
static HRESULT WINAPI IFileDialogEvents_fnQueryInterface (IFileDialogEvents *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI IFileDialogEvents_fnAddRef (IFileDialogEvents *iface)
 
static ULONG WINAPI IFileDialogEvents_fnRelease (IFileDialogEvents *iface)
 
static HRESULT WINAPI IFileDialogEvents_fnOnFileOk (IFileDialogEvents *iface, IFileDialog *pfd)
 
static HRESULT WINAPI IFileDialogEvents_fnOnFolderChanging (IFileDialogEvents *iface, IFileDialog *pfd, IShellItem *psiFolder)
 
static LRESULT CALLBACK test_customize_dlgproc (HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
 
static HRESULT WINAPI IFileDialogEvents_fnOnFolderChange (IFileDialogEvents *iface, IFileDialog *pfd)
 
static HRESULT WINAPI IFileDialogEvents_fnOnSelectionChange (IFileDialogEvents *iface, IFileDialog *pfd)
 
static HRESULT WINAPI IFileDialogEvents_fnOnShareViolation (IFileDialogEvents *iface, IFileDialog *pfd, IShellItem *psi, FDE_SHAREVIOLATION_RESPONSE *pResponse)
 
static HRESULT WINAPI IFileDialogEvents_fnOnTypeChange (IFileDialogEvents *iface, IFileDialog *pfd)
 
static HRESULT WINAPI IFileDialogEvents_fnOnOverwrite (IFileDialogEvents *iface, IFileDialog *pfd, IShellItem *psi, FDE_OVERWRITE_RESPONSE *pResponse)
 
static IFileDialogEvents * IFileDialogEvents_Constructor (void)
 
static BOOL test_instantiation (void)
 
static void test_basics (void)
 
static void ensure_zero_events_ (const char *file, int line, IFileDialogEventsImpl *impl)
 
static void test_advise_helper (IFileDialog *pfd)
 
static void test_advise (void)
 
static void test_events (void)
 
static void touch_file (LPCWSTR filename)
 
static void test_filename_savedlg_ (LPCWSTR set_filename, LPCWSTR set_filename2, LPCWSTR defext, const COMDLG_FILTERSPEC *filterspec, UINT fs_count, UINT ft_index, LPCWSTR exp_filename, const char *file, int line)
 
static void test_filename_opendlg_ (LPCWSTR set_filename, LPCWSTR set_filename2, IShellItem *psi_current, LPCWSTR defext, const COMDLG_FILTERSPEC *filterspec, UINT fs_count, UINT ft_index, LPCWSTR exp_filename, const char *file, int line)
 
static void test_filename (void)
 
static void test_customize (void)
 
static void test_persistent_state (void)
 
static void test_overwrite (void)
 
static void test_customize_remove_from_empty_combobox (void)
 
static void test_double_show (void)
 
 START_TEST (itemdlg)
 

Variables

static IShellFolder LPCITEMIDLIST
 
static IShellFolder IShellItem **static PIDLIST_ABSOLUTE *static IBindCtx REFIID
 
static const IFileDialogEventsVtbl vt_IFileDialogEvents
 
static const WCHAR label [] = {'l','a','b','e','l',0}
 
static const WCHAR label2 [] = {'t','e','s','t',0}
 
static const WCHAR menuW [] = {'m','e','n','u','_','i','t','e','m',0}
 
static const WCHAR pushbutton1W [] = {'p','u','s','h','b','u','t','t','o','n','_','i','t','e','m',0}
 
static const WCHAR pushbutton2W [] = {'p','u','s','h','b','u','t','t','o','n','2','_','i','t','e','m',0}
 
static const WCHAR comboboxitem1W [] = {'c','o','m','b','o','b','o','x','1','_','i','t','e','m',0}
 
static const WCHAR comboboxitem2W [] = {'c','o','m','b','o','b','o','x','2','_','i','t','e','m',0}
 
static const WCHAR radiobutton1W [] = {'r','a','d','i','o','b','u','t','t','o','n','1','_','i','t','e','m',0}
 
static const WCHAR radiobutton2W [] = {'r','a','d','i','o','b','u','t','t','o','n','2','_','i','t','e','m',0}
 
static const WCHAR checkbutton1W [] = {'c','h','e','c','k','b','u','t','t','o','n','1','_','i','t','e','m',0}
 
static const WCHAR checkbutton2W [] = {'c','h','e','c','k','b','u','t','t','o','n','2','_','i','t','e','m',0}
 
static const WCHAR editbox1W [] = {'e','d','i','t','b','o','x','W','1','_','i','t','e','m',0}
 
static const WCHAR editbox2W [] = {'e','d','i','t','b','o','x','W','2','_','i','t','e','m',0}
 
static const WCHAR textW [] = {'t','e','x','t','_','i','t','e','m',0}
 
static const WCHAR text2W [] = {'t','e','x','t','2','_','i','t','e','m',0}
 
static const WCHAR separatorW [] = {'s','e','p','a','r','a','t','o','r','_','i','t','e','m',0}
 
static const WCHAR visualgroup1W [] = {'v','i','s','u','a','l','g','r','o','u','p','1',0}
 
static const WCHAR visualgroup2W [] = {'v','i','s','u','a','l','g','r','o','u','p','2',0}
 
static const WCHAR floatnotifysinkW [] = {'F','l','o','a','t','N','o','t','i','f','y','S','i','n','k',0}
 
static const WCHAR RadioButtonListW [] = {'R','a','d','i','o','B','u','t','t','o','n','L','i','s','t',0}
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file itemdlg.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 23 of file itemdlg.c.

◆ ensure_zero_events

#define ensure_zero_events (   impl)    ensure_zero_events_(__FILE__, __LINE__, impl)

Definition at line 1057 of file itemdlg.c.

◆ IDT_CHANGEFILETYPE

#define IDT_CHANGEFILETYPE   500

Definition at line 28 of file itemdlg.c.

◆ IDT_CLOSEDIALOG

#define IDT_CLOSEDIALOG   501

Definition at line 29 of file itemdlg.c.

◆ IDT_SHOWDIALOG

#define IDT_SHOWDIALOG   502

Definition at line 30 of file itemdlg.c.

◆ MAKEFUNC

#define MAKEFUNC (   f)    (p##f = (void*)GetProcAddress(hmod, #f))

◆ test_filename_opendlg

#define test_filename_opendlg (   set_filename,
  set_filename2,
  psi,
  defext,
  filterspec,
  fs_count,
  ft_index,
  exp_filename 
)     test_filename_opendlg_(set_filename, set_filename2, psi, defext, filterspec, fs_count, ft_index, exp_filename, __FILE__, __LINE__)

Definition at line 1509 of file itemdlg.c.

◆ test_filename_savedlg

#define test_filename_savedlg (   set_filename,
  set_filename2,
  defext,
  filterspec,
  fs_count,
  ft_index,
  exp_filename 
)     test_filename_savedlg_(set_filename, set_filename2, defext, filterspec, fs_count, ft_index, exp_filename, __FILE__, __LINE__)

Definition at line 1403 of file itemdlg.c.

Enumeration Type Documentation

◆ FileDialogEventsTest

Enumerator
IFDEVENT_TEST_NONE 
IFDEVENT_TEST1 
IFDEVENT_TEST2 
IFDEVENT_TEST3 
IFDEVENT_TEST4 

Definition at line 32 of file itemdlg.c.

32 {
34 IFDEVENT_TEST1 = 0x1,
35 IFDEVENT_TEST2 = 0x2,
36 IFDEVENT_TEST3 = 0x3,
37 IFDEVENT_TEST4 = 0x4,
FileDialogEventsTest
Definition: itemdlg.c:32
@ IFDEVENT_TEST1
Definition: itemdlg.c:34
@ IFDEVENT_TEST3
Definition: itemdlg.c:36
@ IFDEVENT_TEST_NONE
Definition: itemdlg.c:33
@ IFDEVENT_TEST2
Definition: itemdlg.c:35
@ IFDEVENT_TEST4
Definition: itemdlg.c:37

Function Documentation

◆ DEFINE_GUID()

DEFINE_GUID ( IID_IFileDialogCustomizeAlt  ,
0x8016B7B3  ,
0x3D49  ,
0x4504  ,
0xA0  ,
0xAA  ,
0x2A  ,
0x37  ,
0x49  ,
0x4E  ,
0x60  ,
0x6F   
)

◆ ensure_zero_events_()

static void ensure_zero_events_ ( const char *  file,
int  line,
IFileDialogEventsImpl *  impl 
)
static

Definition at line 1044 of file itemdlg.c.

1045{
1046 ok_(file, line)(!impl->OnFileOk, "OnFileOk: %ld\n", impl->OnFileOk);
1047 ok_(file, line)(!impl->OnFolderChanging, "OnFolderChanging: %ld\n", impl->OnFolderChanging);
1048 ok_(file, line)(!impl->OnFolderChange, "OnFolderChange: %ld\n", impl->OnFolderChange);
1049 ok_(file, line)(!impl->OnSelectionChange, "OnSelectionChange: %ld\n", impl->OnSelectionChange);
1050 ok_(file, line)(!impl->OnShareViolation, "OnShareViolation: %ld\n", impl->OnShareViolation);
1051 ok_(file, line)(!impl->OnTypeChange, "OnTypeChange: %ld\n", impl->OnTypeChange);
1052 ok_(file, line)(!impl->OnOverwrite, "OnOverwrite: %ld\n", impl->OnOverwrite);
1053 impl->OnFileOk = impl->OnFolderChanging = impl->OnFolderChange = 0;
1054 impl->OnSelectionChange = impl->OnShareViolation = impl->OnTypeChange = 0;
1055 impl->OnOverwrite = 0;
1056}
#define ok_(x1, x2)
Definition: atltest.h:61
Definition: fci.c:123
Definition: parser.c:49

◆ filedialog_change_filetype()

static void filedialog_change_filetype ( IFileDialog *  pfd,
HWND  dlg_hwnd 
)
static

Definition at line 1161 of file itemdlg.c.

1162{
1163 HWND cb_filetype;
1164 const WCHAR filetype1[] = {'f','n','a','m','e','1',0};
1165 const WCHAR filetype1_broken[] = {'f','n','a','m','e','1',' ', '(','*','.','t','x','t',')',0};
1166
1167 cb_filetype = find_window(dlg_hwnd, NULL, filetype1);
1168 ok(cb_filetype != NULL || broken(cb_filetype == NULL), "Could not find combobox on first attempt\n");
1169
1170 if(!cb_filetype)
1171 {
1172 /* Not sure when this happens. Some specific version?
1173 * Seen on 32-bit English Vista */
1174 trace("Didn't find combobox on first attempt, trying broken string..\n");
1175 cb_filetype = find_window(dlg_hwnd, NULL, filetype1_broken);
1176 ok(broken(cb_filetype != NULL), "Failed to find combobox on second attempt\n");
1177 if(!cb_filetype)
1178 return;
1179 }
1180
1181 /* Making the combobox send a CBN_SELCHANGE */
1182 SendMessageW( cb_filetype, CB_SHOWDROPDOWN, 1, 0 );
1183 SendMessageW( cb_filetype, CB_SETCURSEL, 1, 0 );
1184 SendMessageW( cb_filetype, WM_LBUTTONDOWN, 0, -1 );
1185 SendMessageW( cb_filetype, WM_LBUTTONUP, 0, -1 );
1186}
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define NULL
Definition: types.h:112
short WCHAR
Definition: pedump.c:58
#define CB_SHOWDROPDOWN
Definition: winuser.h:1999
#define CB_SETCURSEL
Definition: winuser.h:1990
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
#define WM_LBUTTONUP
Definition: winuser.h:1805
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HWND find_window()
Definition: wclickat.c:251

Referenced by test_customize_dlgproc().

◆ find_window()

static HWND find_window ( HWND  parent,
LPCWSTR  class,
LPCWSTR  text 
)
static

Definition at line 86 of file itemdlg.c.

87{
88 struct fw_arg arg = {class, text, NULL};
89
91 return arg.hwnd_res;
92}
const WCHAR * text
Definition: package.c:1826
r parent
Definition: btrfs.c:3010
LONG_PTR LPARAM
Definition: minwindef.h:175
static BOOL CALLBACK find_window_callback(HWND hwnd, LPARAM lparam)
Definition: itemdlg.c:63
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
Definition: itemdlg.c:58

◆ find_window_callback()

static BOOL CALLBACK find_window_callback ( HWND  hwnd,
LPARAM  lparam 
)
static

Definition at line 63 of file itemdlg.c.

64{
65 struct fw_arg *arg = (struct fw_arg*)lparam;
66 WCHAR buf[1024];
67
68 if(arg->class)
69 {
70 GetClassNameW(hwnd, buf, 1024);
71 if(lstrcmpW(buf, arg->class))
72 return TRUE;
73 }
74
75 if(arg->text)
76 {
77 GetWindowTextW(hwnd, buf, 1024);
78 if(lstrcmpW(buf, arg->text))
79 return TRUE;
80 }
81
82 arg->hwnd_res = hwnd;
83 return FALSE;
84}
@ lparam
Definition: SystemMenu.c:31
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by find_window().

◆ get_hwnd_from_ifiledialog()

static HWND get_hwnd_from_ifiledialog ( IFileDialog *  pfd)
static

Definition at line 94 of file itemdlg.c.

95{
97 HWND dlg_hwnd;
98 HRESULT hr;
99
100 hr = IFileDialog_QueryInterface(pfd, &IID_IOleWindow, (void**)&pow);
101 ok(hr == S_OK, "Got 0x%08lx\n", hr);
102
103 hr = IOleWindow_GetWindow(pow, &dlg_hwnd);
104 ok(hr == S_OK, "Got 0x%08lx\n", hr);
105
106 IOleWindow_Release(pow);
107
108 return dlg_hwnd;
109}
HRESULT hr
Definition: delayimp.cpp:582
double pow(double x, double y)
Definition: freeldr.c:179
#define S_OK
Definition: intsafe.h:52
const GUID IID_IOleWindow
static PIXELFORMATDESCRIPTOR pfd
Definition: ssstars.c:67

Referenced by IFileDialogEvents_fnOnFolderChange(), and test_customize_onfolderchange().

◆ HRESULT()

static HRESULT ( WINAPI *  pSHCreateShellItem)
static

◆ IFileDialogEvents_Constructor()

static IFileDialogEvents * IFileDialogEvents_Constructor ( void  )
static

Definition at line 324 of file itemdlg.c.

325{
327
328 This = calloc(1, sizeof(IFileDialogEventsImpl));
329 This->IFileDialogEvents_iface.lpVtbl = &vt_IFileDialogEvents;
330 This->ref = 1;
331
332 return &This->IFileDialogEvents_iface;
333}
static const IFileDialogEventsVtbl vt_IFileDialogEvents
Definition: itemdlg.c:311
#define calloc
Definition: rosglue.h:14

Referenced by test_advise_helper(), test_customize(), test_double_show(), test_events(), test_filename_opendlg_(), test_filename_savedlg_(), and test_overwrite().

◆ IFileDialogEvents_fnAddRef()

static ULONG WINAPI IFileDialogEvents_fnAddRef ( IFileDialogEvents *  iface)
static

Definition at line 141 of file itemdlg.c.

142{
144 return InterlockedIncrement(&This->ref);
145}
#define InterlockedIncrement
Definition: armddk.h:53
static IFileDialogEventsImpl * impl_from_IFileDialogEvents(IFileDialogEvents *iface)
Definition: itemdlg.c:129

◆ IFileDialogEvents_fnOnFileOk()

static HRESULT WINAPI IFileDialogEvents_fnOnFileOk ( IFileDialogEvents *  iface,
IFileDialog *  pfd 
)
static

Definition at line 158 of file itemdlg.c.

159{
161 This->OnFileOk++;
162 return S_OK;
163}

◆ IFileDialogEvents_fnOnFolderChange()

static HRESULT WINAPI IFileDialogEvents_fnOnFolderChange ( IFileDialogEvents *  iface,
IFileDialog *  pfd 
)
static

Definition at line 213 of file itemdlg.c.

214{
216 HWND dlg_hwnd;
217 HRESULT hr;
218 BOOL br;
219 This->OnFolderChange++;
220
221 if(This->set_filename)
222 {
223 dlg_hwnd = get_hwnd_from_ifiledialog(pfd);
224 ok(dlg_hwnd != NULL, "Got NULL.\n");
225
226 hr = IFileDialog_SetFileName(pfd, This->set_filename);
227 ok(hr == S_OK, "Got 0x%08lx\n", hr);
228
229 if(!This->set_filename_tried)
230 {
231 br = PostMessageW(dlg_hwnd, WM_COMMAND, IDOK, 0);
232 ok(br, "Failed\n");
233 This->set_filename_tried = TRUE;
234 }
235 }
236
237 if(This->events_test)
238 {
239 WNDPROC oldwndproc;
240
241 dlg_hwnd = get_hwnd_from_ifiledialog(pfd);
242
243 /* On Vista, the custom control area of the dialog is not
244 * fully set up when the first OnFolderChange event is
245 * issued. */
246 oldwndproc = (WNDPROC)GetWindowLongPtrW(dlg_hwnd, GWLP_WNDPROC);
247 SetPropA(dlg_hwnd, "WT_OLDWC", (HANDLE)oldwndproc);
248 SetPropA(dlg_hwnd, "WT_PFD", (HANDLE)pfd);
250
251 switch(This->events_test)
252 {
253 case IFDEVENT_TEST1:
254 br = PostMessageW(dlg_hwnd, WM_USER+0x1234, 0, 0);
255 ok(br, "Failed\n");
256 break;
257 case IFDEVENT_TEST2:
258 SetTimer(dlg_hwnd, IDT_CLOSEDIALOG, 100, 0);
259 break;
260 case IFDEVENT_TEST3:
261 SetTimer(dlg_hwnd, IDT_CHANGEFILETYPE, 100, 0);
262 break;
263 case IFDEVENT_TEST4:
264 SetTimer(dlg_hwnd, IDT_SHOWDIALOG, 100, 0);
265 break;
266 default:
267 ok(FALSE, "Should not happen (%d)\n", This->events_test);
268 }
269 }
270
271 return S_OK;
272}
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDT_CHANGEFILETYPE
Definition: itemdlg.c:28
#define IDT_CLOSEDIALOG
Definition: itemdlg.c:29
static HWND get_hwnd_from_ifiledialog(IFileDialog *pfd)
Definition: itemdlg.c:94
static LRESULT CALLBACK test_customize_dlgproc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: itemdlg.c:174
#define IDT_SHOWDIALOG
Definition: itemdlg.c:30
#define GetWindowLongPtrW
Definition: winuser.h:4983
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_COMMAND
Definition: winuser.h:1768
#define IDOK
Definition: winuser.h:841
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_USER
Definition: winuser.h:1923
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
#define SetWindowLongPtrW
Definition: winuser.h:5512
#define GWLP_WNDPROC
Definition: treelist.c:66

◆ IFileDialogEvents_fnOnFolderChanging()

static HRESULT WINAPI IFileDialogEvents_fnOnFolderChanging ( IFileDialogEvents *  iface,
IFileDialog *  pfd,
IShellItem *  psiFolder 
)
static

Definition at line 165 of file itemdlg.c.

168{
170 This->OnFolderChanging++;
171 return S_OK;
172}

◆ IFileDialogEvents_fnOnOverwrite()

static HRESULT WINAPI IFileDialogEvents_fnOnOverwrite ( IFileDialogEvents *  iface,
IFileDialog *  pfd,
IShellItem *  psi,
FDE_OVERWRITE_RESPONSE *  pResponse 
)
static

Definition at line 298 of file itemdlg.c.

302{
304 This->OnOverwrite++;
305 ok(*pResponse == FDEOR_DEFAULT, "overwrite response %u\n", *pResponse);
306 *pResponse = FDEOR_ACCEPT;
307 ok(!This->OnFileOk, "OnFileOk already called %lu times\n", This->OnFileOk);
308 return S_OK;
309}
@ FDEOR_DEFAULT
Definition: shobjidl.idl:3578
@ FDEOR_ACCEPT
Definition: shobjidl.idl:3579

◆ IFileDialogEvents_fnOnSelectionChange()

static HRESULT WINAPI IFileDialogEvents_fnOnSelectionChange ( IFileDialogEvents *  iface,
IFileDialog *  pfd 
)
static

Definition at line 274 of file itemdlg.c.

275{
277 This->OnSelectionChange++;
278 return S_OK;
279}

◆ IFileDialogEvents_fnOnShareViolation()

static HRESULT WINAPI IFileDialogEvents_fnOnShareViolation ( IFileDialogEvents *  iface,
IFileDialog *  pfd,
IShellItem *  psi,
FDE_SHAREVIOLATION_RESPONSE *  pResponse 
)
static

Definition at line 281 of file itemdlg.c.

285{
287 This->OnShareViolation++;
288 return S_OK;
289}

◆ IFileDialogEvents_fnOnTypeChange()

static HRESULT WINAPI IFileDialogEvents_fnOnTypeChange ( IFileDialogEvents *  iface,
IFileDialog *  pfd 
)
static

Definition at line 291 of file itemdlg.c.

292{
294 This->OnTypeChange++;
295 return S_OK;
296}

◆ IFileDialogEvents_fnQueryInterface()

static HRESULT WINAPI IFileDialogEvents_fnQueryInterface ( IFileDialogEvents *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 134 of file itemdlg.c.

135{
136 /* Not called. */
137 ok(0, "Unexpectedly called.\n");
138 return E_NOINTERFACE;
139}
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ IFileDialogEvents_fnRelease()

static ULONG WINAPI IFileDialogEvents_fnRelease ( IFileDialogEvents *  iface)
static

Definition at line 147 of file itemdlg.c.

148{
151
152 if(!ref)
153 free(This);
154
155 return ref;
156}
#define InterlockedDecrement
Definition: armddk.h:52
#define free
Definition: debug_ros.c:5
long LONG
Definition: pedump.c:60
Definition: send.c:48

◆ impl_from_IFileDialogEvents()

◆ init_function_pointers()

static IShellFolder IShellItem **static PIDLIST_ABSOLUTE *static IBindCtx void **static void init_function_pointers ( void  )
static

Definition at line 44 of file itemdlg.c.

45{
46 HMODULE hmod = GetModuleHandleA("shell32.dll");
47
48#define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hmod, #f))
52#undef MAKEFUNC
53}
EXTERN_C HRESULT WINAPI SHCreateItemFromParsingName(_In_ PCWSTR pszPath, _In_opt_ IBindCtx *pbc, _In_ REFIID riid, _Out_ void **ppv)
Definition: CShellItem.cpp:365
HRESULT WINAPI SHCreateShellItem(PCIDLIST_ABSOLUTE pidlParent, IShellFolder *psfParent, PCUITEMID_CHILD pidl, IShellItem **ppsi)
Definition: CShellItem.cpp:261
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static NTSTATUS *static PWSTR CURDIR *static HMODULE hmod
Definition: security.c:104
#define MAKEFUNC(f)
HRESULT WINAPI SHGetIDListFromObject(IUnknown *punk, PIDLIST_ABSOLUTE *ppidl)
Definition: pidl.c:1682

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( itemdlg  )

Definition at line 2588 of file itemdlg.c.

2589{
2592
2593 if(test_instantiation())
2594 {
2595 DWORD result_tmpdir;
2596 BOOL result_set_dir;
2598
2599 /* Windows refuses to open a dialog for C:\Users\Public\Documents, so change to tmp */
2600 result_tmpdir = GetTempPathW(MAX_PATH, tmpdir);
2601 ok(result_tmpdir != 0, "got %ld\n", result_tmpdir);
2602 result_set_dir = SetCurrentDirectoryW(tmpdir);
2603 ok(result_set_dir, "failed to set dir\n");
2604
2605 test_basics();
2606 test_advise();
2607 test_events();
2608 test_filename();
2614 }
2615 else
2616 skip("Skipping all Item Dialog tests.\n");
2617
2619}
#define skip(...)
Definition: atltest.h:64
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2098
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2267
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:218
unsigned long DWORD
Definition: ntddk_ex.h:95
static void test_overwrite(void)
Definition: itemdlg.c:2365
static void test_double_show(void)
Definition: itemdlg.c:2559
static void test_filename(void)
Definition: itemdlg.c:1512
static IShellFolder IShellItem **static PIDLIST_ABSOLUTE *static IBindCtx void **static void init_function_pointers(void)
Definition: itemdlg.c:44
static BOOL test_instantiation(void)
Definition: itemdlg.c:335
static void test_customize_remove_from_empty_combobox(void)
Definition: itemdlg.c:2523
static void test_customize(void)
Definition: itemdlg.c:1689
static void test_events(void)
Definition: itemdlg.c:1188
static void test_advise(void)
Definition: itemdlg.c:1138
static void test_persistent_state(void)
Definition: itemdlg.c:2341
static void test_basics(void)
Definition: itemdlg.c:531
static char tmpdir[MAX_PATH]
Definition: shlexec.c:52

◆ test_advise()

static void test_advise ( void  )
static

Definition at line 1138 of file itemdlg.c.

1139{
1141 HRESULT hr;
1142 LONG ref;
1143
1144 trace("Testing FileOpenDialog (advise)\n");
1145 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
1146 &IID_IFileDialog, (void**)&pfd);
1147 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1149 ref = IFileDialog_Release(pfd);
1150 ok(!ref, "Got refcount %ld, should have been released.\n", ref);
1151
1152 trace("Testing FileSaveDialog (advise)\n");
1153 hr = CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER,
1154 &IID_IFileDialog, (void**)&pfd);
1155 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1157 ref = IFileDialog_Release(pfd);
1158 ok(!ref, "Got refcount %ld, should have been released.\n", ref);
1159}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
static void test_advise_helper(IFileDialog *pfd)
Definition: itemdlg.c:1059

Referenced by START_TEST().

◆ test_advise_helper()

static void test_advise_helper ( IFileDialog *  pfd)
static

Definition at line 1059 of file itemdlg.c.

1060{
1061 IFileDialogEventsImpl *pfdeimpl;
1062 IFileDialogEvents *pfde;
1063 DWORD cookie[10];
1064 UINT i;
1065 HRESULT hr;
1066
1068 pfdeimpl = impl_from_IFileDialogEvents(pfde);
1069
1070 /* Null pointer tests crash on Windows 10 16299 or newer */
1071 if (0)
1072 {
1073 hr = IFileDialog_Advise(pfd, NULL, NULL);
1074 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
1075 hr = IFileDialog_Advise(pfd, pfde, NULL);
1076 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
1077 }
1078 hr = IFileDialog_Advise(pfd, NULL, &cookie[0]);
1079 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
1080 ok(pfdeimpl->ref == 1, "got ref %ld\n", pfdeimpl->ref);
1081 ensure_zero_events(pfdeimpl);
1082
1083 hr = IFileDialog_Unadvise(pfd, 0);
1084 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
1085 for(i = 0; i < 10; i++) {
1086 hr = IFileDialog_Advise(pfd, pfde, &cookie[i]);
1087 ok(hr == S_OK, "got 0x%08lx\n", hr);
1088 ok(cookie[i] == i+cookie[0], "Got cookie: %ld\n", cookie[i]);
1089 }
1090 ok(pfdeimpl->ref == 10+1, "got ref %ld\n", pfdeimpl->ref);
1091 ensure_zero_events(pfdeimpl);
1092
1093 for(i = 3; i < 7; i++) {
1094 hr = IFileDialog_Unadvise(pfd, cookie[i]);
1095 ok(hr == S_OK, "got 0x%08lx\n", hr);
1096 }
1097 ok(pfdeimpl->ref == 6+1, "got ref %ld\n", pfdeimpl->ref);
1098 ensure_zero_events(pfdeimpl);
1099
1100 for(i = 0; i < 3; i++) {
1101 hr = IFileDialog_Unadvise(pfd, cookie[i]);
1102 ok(hr == S_OK, "got 0x%08lx\n", hr);
1103 }
1104 ok(pfdeimpl->ref == 3+1, "got ref %ld\n", pfdeimpl->ref);
1105 ensure_zero_events(pfdeimpl);
1106
1107 for(i = 7; i < 10; i++) {
1108 hr = IFileDialog_Unadvise(pfd, cookie[i]);
1109 ok(hr == S_OK, "got 0x%08lx\n", hr);
1110 }
1111 ok(pfdeimpl->ref == 1, "got ref %ld\n", pfdeimpl->ref);
1112 ensure_zero_events(pfdeimpl);
1113
1114 hr = IFileDialog_Unadvise(pfd, cookie[9]+1);
1115 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
1116 ok(pfdeimpl->ref == 1, "got ref %ld\n", pfdeimpl->ref);
1117 ensure_zero_events(pfdeimpl);
1118
1119 hr = IFileDialog_Advise(pfd, pfde, &cookie[0]);
1120 ok(hr == S_OK, "got 0x%08lx\n", hr);
1121 ok(cookie[0] >= 1, "got cookie: %ld\n", cookie[0]);
1122 ok(pfdeimpl->ref == 1+1, "got ref %ld\n", pfdeimpl->ref);
1123 ensure_zero_events(pfdeimpl);
1124
1125 hr = IFileDialog_Unadvise(pfd, cookie[0]);
1126
1127 if(0)
1128 {
1129 /* Unadvising already unadvised cookies crashes on
1130 Windows 7. */
1131 IFileDialog_Unadvise(pfd, cookie[0]);
1132 }
1133
1134
1135 IFileDialogEvents_Release(pfde);
1136}
#define E_INVALIDARG
Definition: ddrawi.h:101
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: sysinfo.c:13
#define ensure_zero_events(impl)
Definition: itemdlg.c:1057
static IFileDialogEvents * IFileDialogEvents_Constructor(void)
Definition: itemdlg.c:324
Definition: cookie.c:34

Referenced by test_advise().

◆ test_basics()

static void test_basics ( void  )
static

IFileOpenDialog specific

IFileSaveDialog specific

IFileDialog2

Definition at line 531 of file itemdlg.c.

532{
533 IFileOpenDialog *pfod;
534 IFileSaveDialog *pfsd;
535 IFileDialog2 *pfd2;
536 FILEOPENDIALOGOPTIONS fdoptions;
537 IShellFolder *psfdesktop;
538 IShellItem *psi, *psidesktop, *psi_original;
539 IShellItemArray *psia;
540 IPropertyStore *pps;
541 LPITEMIDLIST pidl;
544 LONG ref;
545 HRESULT hr;
546 const WCHAR txt[] = {'t','x','t', 0};
547 const WCHAR null[] = {0};
548 const WCHAR fname1[] = {'f','n','a','m','e','1', 0};
549 const WCHAR fspec1[] = {'*','.','t','x','t',0};
550 const WCHAR fname2[] = {'f','n','a','m','e','2', 0};
551 const WCHAR fspec2[] = {'*','.','e','x','e',0};
552 COMDLG_FILTERSPEC filterspec[2] = {{fname1, fspec1}, {fname2, fspec2}};
553 const DWORD invalid_fos[] = {0x1, 0x10, 0x400, 0x80000, 0x400000, 0x800000, 0x1000000, 0x4000000, 0x8000000};
554 INT i;
555
556 /* This should work on every platform with IFileDialog */
557 SHGetDesktopFolder(&psfdesktop);
558 hr = pSHGetIDListFromObject((IUnknown*)psfdesktop, &pidl);
559 if(SUCCEEDED(hr))
560 {
561 hr = pSHCreateShellItem(NULL, NULL, pidl, &psidesktop);
562 ILFree(pidl);
563 }
564 IShellFolder_Release(psfdesktop);
565 if(FAILED(hr))
566 {
567 skip("Failed to get ShellItem from DesktopFolder, skipping tests.\n");
568 return;
569 }
570
571
572 /* Instantiate FileOpenDialog and FileSaveDialog */
573 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
574 &IID_IFileOpenDialog, (void**)&pfod);
575 ok(hr == S_OK, "got 0x%08lx.\n", hr);
576 hr = CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER,
577 &IID_IFileSaveDialog, (void**)&pfsd);
578 ok(hr == S_OK, "got 0x%08lx.\n", hr);
579
580 /* ClearClientData */
582 {
583 hr = IFileOpenDialog_ClearClientData(pfod);
584 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
585 hr = IFileSaveDialog_ClearClientData(pfsd);
586 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
587 }
588
589 /* GetOptions */
590 hr = IFileOpenDialog_GetOptions(pfod, NULL);
591 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
592 hr = IFileSaveDialog_GetOptions(pfsd, NULL);
593 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
594
595 /* Check default options */
596 hr = IFileOpenDialog_GetOptions(pfod, &fdoptions);
597 ok(hr == S_OK, "got 0x%08lx.\n", hr);
598 ok(fdoptions == (FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST | FOS_NOCHANGEDIR),
599 "Unexpected default options: 0x%08lx\n", fdoptions);
600 hr = IFileSaveDialog_GetOptions(pfsd, &fdoptions);
601 ok(hr == S_OK, "got 0x%08lx.\n", hr);
602 ok(fdoptions == (FOS_OVERWRITEPROMPT | FOS_NOREADONLYRETURN | FOS_PATHMUSTEXIST | FOS_NOCHANGEDIR),
603 "Unexpected default options: 0x%08lx\n", fdoptions);
604
605 /* Check SetOptions invalid options handling */
606 for (i = 0; i < ARRAY_SIZE(invalid_fos); i++)
607 {
608 hr = IFileOpenDialog_SetOptions(pfod, invalid_fos[i]);
609 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
610 hr = IFileOpenDialog_GetOptions(pfod, &fdoptions);
611 ok(hr == S_OK, "got 0x%08lx.\n", hr);
612 ok(fdoptions == (FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST | FOS_NOCHANGEDIR), "got %08lx\n", fdoptions);
613
614 hr = IFileSaveDialog_SetOptions(pfsd, invalid_fos[i]);
615 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
616 hr = IFileSaveDialog_GetOptions(pfsd, &fdoptions);
617 ok(hr == S_OK, "got 0x%08lx.\n", hr);
618 ok(fdoptions == (FOS_OVERWRITEPROMPT | FOS_NOREADONLYRETURN | FOS_PATHMUSTEXIST | FOS_NOCHANGEDIR),
619 "got %08lx\n", fdoptions);
620 }
621
622 /* GetResult */
623 hr = IFileOpenDialog_GetResult(pfod, NULL);
624 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
625 hr = IFileSaveDialog_GetResult(pfsd, NULL);
626 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
627
628 psi = (void*)0xdeadbeef;
629 hr = IFileOpenDialog_GetResult(pfod, &psi);
630 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
631 ok(psi == (void*)0xdeadbeef, "got %p.\n", psi);
632 psi = (void*)0xdeadbeef;
633 hr = IFileSaveDialog_GetResult(pfsd, &psi);
634 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
635 ok(psi == (void*)0xdeadbeef, "got %p.\n", psi);
636
637 /* GetCurrentSelection */
638 if(0) {
639 /* Crashes on Vista/W2K8. Tests below passes on Windows 7 */
640 hr = IFileOpenDialog_GetCurrentSelection(pfod, NULL);
641 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
642 hr = IFileSaveDialog_GetCurrentSelection(pfsd, NULL);
643 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
644 hr = IFileOpenDialog_GetCurrentSelection(pfod, &psi);
645 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
646 hr = IFileSaveDialog_GetCurrentSelection(pfsd, &psi);
647 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
648 }
649
650 /* GetFileName */
651 hr = IFileOpenDialog_GetFileName(pfod, NULL);
652 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
653 filename = (void*)0xdeadbeef;
654 hr = IFileOpenDialog_GetFileName(pfod, &filename);
655 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
656 ok(filename == NULL, "got %p\n", filename);
657 hr = IFileSaveDialog_GetFileName(pfsd, NULL);
658 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
659 filename = (void*)0xdeadbeef;
660 hr = IFileSaveDialog_GetFileName(pfsd, &filename);
661 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
662 ok(filename == NULL, "got %p\n", filename);
663
664 /* GetFileTypeIndex */
665 hr = IFileOpenDialog_GetFileTypeIndex(pfod, NULL);
666 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
667 filetype = 0x12345;
668 hr = IFileOpenDialog_GetFileTypeIndex(pfod, &filetype);
669 ok(hr == S_OK, "got 0x%08lx.\n", hr);
670 ok(filetype == 0, "got %d.\n", filetype);
671 hr = IFileSaveDialog_GetFileTypeIndex(pfsd, NULL);
672 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
673 filetype = 0x12345;
674 hr = IFileSaveDialog_GetFileTypeIndex(pfsd, &filetype);
675 ok(hr == S_OK, "got 0x%08lx.\n", hr);
676 ok(filetype == 0, "got %d.\n", filetype);
677
678 /* SetFileTypes / SetFileTypeIndex */
679 hr = IFileOpenDialog_SetFileTypes(pfod, 0, NULL);
680 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
681 hr = IFileOpenDialog_SetFileTypes(pfod, 0, filterspec);
682 ok(hr == S_OK, "got 0x%08lx.\n", hr);
683
684 hr = IFileOpenDialog_SetFileTypeIndex(pfod, 0);
685 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
686 hr = IFileOpenDialog_SetFileTypeIndex(pfod, 1);
687 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
688 hr = IFileOpenDialog_SetFileTypes(pfod, 1, filterspec);
689 ok(hr == S_OK, "got 0x%08lx.\n", hr);
690 hr = IFileOpenDialog_SetFileTypes(pfod, 0, filterspec);
691 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
692 hr = IFileOpenDialog_SetFileTypes(pfod, 0, NULL);
693 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
694 hr = IFileOpenDialog_SetFileTypeIndex(pfod, 0);
695 ok(hr == S_OK, "got 0x%08lx.\n", hr);
696 hr = IFileOpenDialog_GetFileTypeIndex(pfod, &filetype);
697 ok(hr == S_OK, "got 0x%08lx.\n", hr);
698 ok(filetype == 1, "got %d\n", filetype);
699 hr = IFileOpenDialog_SetFileTypeIndex(pfod, 100);
700 ok(hr == S_OK, "got 0x%08lx.\n", hr);
701 hr = IFileOpenDialog_GetFileTypeIndex(pfod, &filetype);
702 ok(hr == S_OK, "got 0x%08lx.\n", hr);
703 ok(filetype == 1, "got %d\n", filetype);
704 hr = IFileOpenDialog_SetFileTypes(pfod, 1, filterspec);
705 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
706 hr = IFileOpenDialog_SetFileTypes(pfod, 1, &filterspec[1]);
707 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
708
709 hr = IFileSaveDialog_SetFileTypeIndex(pfsd, 0);
710 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
711 hr = IFileSaveDialog_SetFileTypeIndex(pfsd, 1);
712 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
713 hr = IFileSaveDialog_SetFileTypes(pfsd, 2, filterspec);
714 ok(hr == S_OK, "got 0x%08lx.\n", hr);
715 hr = IFileSaveDialog_GetFileTypeIndex(pfsd, &filetype);
716 ok(hr == S_OK, "got 0x%08lx.\n", hr);
717 /* I hope no one relies on this one */
718 todo_wine ok(filetype == 0, "got %d\n", filetype);
719 hr = IFileSaveDialog_SetFileTypeIndex(pfsd, 0);
720 ok(hr == S_OK, "got 0x%08lx.\n", hr);
721 hr = IFileSaveDialog_GetFileTypeIndex(pfsd, &filetype);
722 ok(hr == S_OK, "got 0x%08lx.\n", hr);
723 ok(filetype == 1, "got %d\n", filetype);
724 hr = IFileSaveDialog_SetFileTypeIndex(pfsd, 100);
725 ok(hr == S_OK, "got 0x%08lx.\n", hr);
726 hr = IFileSaveDialog_GetFileTypeIndex(pfsd, &filetype);
727 ok(hr == S_OK, "got 0x%08lx.\n", hr);
728 ok(filetype == 2, "got %d\n", filetype);
729 hr = IFileSaveDialog_SetFileTypes(pfsd, 1, filterspec);
730 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
731 hr = IFileSaveDialog_SetFileTypes(pfsd, 1, &filterspec[1]);
732 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
733
734 /* SetFilter */
736 {
737 hr = IFileOpenDialog_SetFilter(pfod, NULL);
738 ok(hr == S_OK, "got 0x%08lx.\n", hr);
739 hr = IFileSaveDialog_SetFilter(pfsd, NULL);
740 ok(hr == S_OK, "got 0x%08lx.\n", hr);
741 }
742
743 /* SetFolder */
744 hr = IFileOpenDialog_SetFolder(pfod, NULL);
745 ok(hr == S_OK, "got 0x%08lx.\n", hr);
746 hr = IFileSaveDialog_SetFolder(pfsd, NULL);
747 ok(hr == S_OK, "got 0x%08lx.\n", hr);
748
749 /* SetDefaultExtension */
750 hr = IFileOpenDialog_SetDefaultExtension(pfod, NULL);
751 ok(hr == S_OK, "got 0x%08lx.\n", hr);
752 hr = IFileOpenDialog_SetDefaultExtension(pfod, txt);
753 ok(hr == S_OK, "got 0x%08lx.\n", hr);
754 hr = IFileOpenDialog_SetDefaultExtension(pfod, null);
755 ok(hr == S_OK, "got 0x%08lx.\n", hr);
756
757 hr = IFileSaveDialog_SetDefaultExtension(pfsd, NULL);
758 ok(hr == S_OK, "got 0x%08lx.\n", hr);
759 hr = IFileSaveDialog_SetDefaultExtension(pfsd, txt);
760 ok(hr == S_OK, "got 0x%08lx.\n", hr);
761 hr = IFileSaveDialog_SetDefaultExtension(pfsd, null);
762 ok(hr == S_OK, "got 0x%08lx.\n", hr);
763
764 /* SetDefaultFolder */
765 hr = IFileOpenDialog_SetDefaultFolder(pfod, NULL);
766 ok(hr == S_OK, "got 0x%08lx\n", hr);
767 hr = IFileSaveDialog_SetDefaultFolder(pfsd, NULL);
768 ok(hr == S_OK, "got 0x%08lx\n", hr);
769
770 hr = IFileOpenDialog_SetDefaultFolder(pfod, psidesktop);
771 ok(hr == S_OK, "got 0x%08lx\n", hr);
772 hr = IFileSaveDialog_SetDefaultFolder(pfsd, psidesktop);
773 ok(hr == S_OK, "got 0x%08lx\n", hr);
774
775 if(0)
776 {
777 /* Crashes under Windows 7 */
778 IFileOpenDialog_SetDefaultFolder(pfod, (void*)0x1234);
779 IFileSaveDialog_SetDefaultFolder(pfsd, (void*)0x1234);
780 }
781
782 /* GetFolder / SetFolder */
783 hr = IFileOpenDialog_GetFolder(pfod, NULL);
784 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
785
786 hr = IFileOpenDialog_GetFolder(pfod, &psi_original);
787 ok(hr == S_OK, "got 0x%08lx.\n", hr);
788 if(SUCCEEDED(hr))
789 {
790 hr = IFileOpenDialog_SetFolder(pfod, psidesktop);
791 ok(hr == S_OK, "got 0x%08lx.\n", hr);
792 hr = IFileOpenDialog_SetFolder(pfod, psi_original);
793 ok(hr == S_OK, "got 0x%08lx.\n", hr);
794 IShellItem_Release(psi_original);
795 }
796
797 hr = IFileSaveDialog_GetFolder(pfsd, &psi_original);
798 ok(hr == S_OK, "got 0x%08lx.\n", hr);
799 if(SUCCEEDED(hr))
800 {
801 hr = IFileSaveDialog_SetFolder(pfsd, psidesktop);
802 ok(hr == S_OK, "got 0x%08lx.\n", hr);
803 hr = IFileSaveDialog_SetFolder(pfsd, psi_original);
804 ok(hr == S_OK, "got 0x%08lx.\n", hr);
805 IShellItem_Release(psi_original);
806 }
807
808 /* AddPlace */
809 if(0)
810 {
811 /* Crashes under Windows 7 */
812 IFileOpenDialog_AddPlace(pfod, NULL, 0);
813 IFileSaveDialog_AddPlace(pfsd, NULL, 0);
814 }
815
816 hr = IFileOpenDialog_AddPlace(pfod, psidesktop, FDAP_TOP + 1);
817 todo_wine ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
818 hr = IFileOpenDialog_AddPlace(pfod, psidesktop, FDAP_BOTTOM);
819 ok(hr == S_OK, "got 0x%08lx\n", hr);
820 hr = IFileOpenDialog_AddPlace(pfod, psidesktop, FDAP_TOP);
821 ok(hr == S_OK, "got 0x%08lx\n", hr);
822
823 hr = IFileSaveDialog_AddPlace(pfsd, psidesktop, FDAP_TOP + 1);
824 todo_wine ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
825 hr = IFileSaveDialog_AddPlace(pfsd, psidesktop, FDAP_BOTTOM);
826 ok(hr == S_OK, "got 0x%08lx\n", hr);
827 hr = IFileSaveDialog_AddPlace(pfsd, psidesktop, FDAP_TOP);
828 ok(hr == S_OK, "got 0x%08lx\n", hr);
829
830 /* SetFileName */
831 hr = IFileOpenDialog_SetFileName(pfod, NULL);
832 ok(hr == S_OK, "got 0x%08lx\n", hr);
833 hr = IFileOpenDialog_SetFileName(pfod, null);
834 ok(hr == S_OK, "got 0x%08lx\n", hr);
835
836 filename = NULL;
837 hr = IFileOpenDialog_GetFileName(pfod, &filename);
838 ok(hr == S_OK, "Got 0x%08lx\n", hr);
839 ok(!lstrcmpW(filename, null), "Strings do not match.\n");
841
842 hr = IFileOpenDialog_SetFileName(pfod, NULL);
843 ok(hr == S_OK, "got 0x%08lx\n", hr);
844
845 filename = (void*)0xdeadbeef;
846 hr = IFileOpenDialog_GetFileName(pfod, &filename);
847 ok(hr == E_FAIL, "Got 0x%08lx\n", hr);
848 ok(filename == NULL, "got %p.\n", filename);
849
850 hr = IFileOpenDialog_SetFileName(pfod, txt);
851 ok(hr == S_OK, "got 0x%08lx\n", hr);
852 hr = IFileOpenDialog_GetFileName(pfod, &filename);
853 ok(hr == S_OK, "Got 0x%08lx\n", hr);
854 ok(!lstrcmpW(filename, txt), "Strings do not match.\n");
856
857 hr = IFileSaveDialog_SetFileName(pfsd, NULL);
858 ok(hr == S_OK, "got 0x%08lx\n", hr);
859 hr = IFileSaveDialog_SetFileName(pfsd, null);
860 ok(hr == S_OK, "got 0x%08lx\n", hr);
861 hr = IFileSaveDialog_SetFileName(pfsd, txt);
862 ok(hr == S_OK, "got 0x%08lx\n", hr);
863 hr = IFileSaveDialog_GetFileName(pfsd, &filename);
864 ok(hr == S_OK, "Got 0x%08lx\n", hr);
865 ok(!lstrcmpW(filename, txt), "Strings do not match.\n");
867
868 /* SetFileNameLabel */
869 hr = IFileOpenDialog_SetFileNameLabel(pfod, NULL);
870 ok(hr == S_OK, "got 0x%08lx\n", hr);
871 hr = IFileOpenDialog_SetFileNameLabel(pfod, null);
872 ok(hr == S_OK, "got 0x%08lx\n", hr);
873 hr = IFileOpenDialog_SetFileNameLabel(pfod, txt);
874 ok(hr == S_OK, "got 0x%08lx\n", hr);
875
876 hr = IFileSaveDialog_SetFileNameLabel(pfsd, NULL);
877 ok(hr == S_OK, "got 0x%08lx\n", hr);
878 hr = IFileSaveDialog_SetFileNameLabel(pfsd, null);
879 ok(hr == S_OK, "got 0x%08lx\n", hr);
880 hr = IFileSaveDialog_SetFileNameLabel(pfsd, txt);
881 ok(hr == S_OK, "got 0x%08lx\n", hr);
882
883 /* Close */
884 hr = IFileOpenDialog_Close(pfod, S_FALSE);
885 ok(hr == S_OK, "got 0x%08lx\n", hr);
886 hr = IFileSaveDialog_Close(pfsd, S_FALSE);
887 ok(hr == S_OK, "got 0x%08lx\n", hr);
888
889 /* SetOkButtonLabel */
890 hr = IFileOpenDialog_SetOkButtonLabel(pfod, NULL);
891 ok(hr == S_OK, "got 0x%08lx\n", hr);
892 hr = IFileOpenDialog_SetOkButtonLabel(pfod, null);
893 ok(hr == S_OK, "got 0x%08lx\n", hr);
894 hr = IFileOpenDialog_SetOkButtonLabel(pfod, txt);
895 ok(hr == S_OK, "got 0x%08lx\n", hr);
896 hr = IFileSaveDialog_SetOkButtonLabel(pfsd, NULL);
897 ok(hr == S_OK, "got 0x%08lx\n", hr);
898 hr = IFileSaveDialog_SetOkButtonLabel(pfsd, null);
899 ok(hr == S_OK, "got 0x%08lx\n", hr);
900 hr = IFileSaveDialog_SetOkButtonLabel(pfsd, txt);
901 ok(hr == S_OK, "got 0x%08lx\n", hr);
902
903 /* SetTitle */
904 hr = IFileOpenDialog_SetTitle(pfod, NULL);
905 ok(hr == S_OK, "got 0x%08lx\n", hr);
906 hr = IFileOpenDialog_SetTitle(pfod, null);
907 ok(hr == S_OK, "got 0x%08lx\n", hr);
908 hr = IFileOpenDialog_SetTitle(pfod, txt);
909 ok(hr == S_OK, "got 0x%08lx\n", hr);
910 hr = IFileSaveDialog_SetTitle(pfsd, NULL);
911 ok(hr == S_OK, "got 0x%08lx\n", hr);
912 hr = IFileSaveDialog_SetTitle(pfsd, null);
913 ok(hr == S_OK, "got 0x%08lx\n", hr);
914 hr = IFileSaveDialog_SetTitle(pfsd, txt);
915 ok(hr == S_OK, "got 0x%08lx\n", hr);
916
919 /* GetResults */
920 if(0)
921 {
922 /* Crashes under Windows 7 */
923 IFileOpenDialog_GetResults(pfod, NULL);
924 }
925 psia = (void*)0xdeadbeef;
926 hr = IFileOpenDialog_GetResults(pfod, &psia);
927 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
928 ok(psia == NULL, "got %p.\n", psia);
929
930 /* GetSelectedItems */
931 if(0)
932 {
933 /* Crashes under W2K8 */
934 hr = IFileOpenDialog_GetSelectedItems(pfod, NULL);
935 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
936 psia = (void*)0xdeadbeef;
937 hr = IFileOpenDialog_GetSelectedItems(pfod, &psia);
938 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
939 ok(psia == (void*)0xdeadbeef, "got %p.\n", psia);
940 }
941
944 /* ApplyProperties */
945 if(0)
946 {
947 /* Crashes under windows 7 */
948 IFileSaveDialog_ApplyProperties(pfsd, NULL, NULL, NULL, NULL);
949 IFileSaveDialog_ApplyProperties(pfsd, psidesktop, NULL, NULL, NULL);
950 }
951
952 /* GetProperties */
953 hr = IFileSaveDialog_GetProperties(pfsd, NULL);
954 todo_wine ok(hr == E_UNEXPECTED, "got 0x%08lx\n", hr);
955 pps = (void*)0xdeadbeef;
956 hr = IFileSaveDialog_GetProperties(pfsd, &pps);
957 todo_wine ok(hr == E_UNEXPECTED, "got 0x%08lx\n", hr);
958 ok(pps == (void*)0xdeadbeef, "got %p\n", pps);
959
960 /* SetProperties */
961 if(0)
962 {
963 /* Crashes under W2K8 */
964 hr = IFileSaveDialog_SetProperties(pfsd, NULL);
965 ok(hr == S_OK, "got 0x%08lx\n", hr);
966 }
967
968 /* SetCollectedProperties */
970 {
971 hr = IFileSaveDialog_SetCollectedProperties(pfsd, NULL, TRUE);
972 ok(hr == S_OK, "got 0x%08lx\n", hr);
973 hr = IFileSaveDialog_SetCollectedProperties(pfsd, NULL, FALSE);
974 ok(hr == S_OK, "got 0x%08lx\n", hr);
975 }
976
977 /* SetSaveAsItem */
979 {
980 hr = IFileSaveDialog_SetSaveAsItem(pfsd, NULL);
981 ok(hr == S_OK, "got 0x%08lx\n", hr);
982 hr = IFileSaveDialog_SetSaveAsItem(pfsd, psidesktop);
983 ok(hr == MK_E_NOOBJECT, "got 0x%08lx\n", hr);
984 }
985
988 hr = IFileOpenDialog_QueryInterface(pfod, &IID_IFileDialog2, (void**)&pfd2);
989 ok((hr == S_OK) || broken(hr == E_NOINTERFACE), "got 0x%08lx\n", hr);
990 if(SUCCEEDED(hr))
991 {
992 /* SetCancelButtonLabel */
993 hr = IFileDialog2_SetOkButtonLabel(pfd2, NULL);
994 ok(hr == S_OK, "got 0x%08lx\n", hr);
995 hr = IFileDialog2_SetOkButtonLabel(pfd2, null);
996 ok(hr == S_OK, "got 0x%08lx\n", hr);
997 hr = IFileDialog2_SetOkButtonLabel(pfd2, txt);
998 ok(hr == S_OK, "got 0x%08lx\n", hr);
999
1000 /* SetNavigationRoot */
1001 todo_wine
1002 {
1003 hr = IFileDialog2_SetNavigationRoot(pfd2, NULL);
1004 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
1005 hr = IFileDialog2_SetNavigationRoot(pfd2, psidesktop);
1006 ok(hr == S_OK, "got 0x%08lx\n", hr);
1007 }
1008
1009 IFileDialog2_Release(pfd2);
1010 }
1011
1012 hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IFileDialog2, (void**)&pfd2);
1013 ok((hr == S_OK) || broken(hr == E_NOINTERFACE), "got 0x%08lx\n", hr);
1014 if(SUCCEEDED(hr))
1015 {
1016 /* SetCancelButtonLabel */
1017 hr = IFileDialog2_SetOkButtonLabel(pfd2, NULL);
1018 ok(hr == S_OK, "got 0x%08lx\n", hr);
1019 hr = IFileDialog2_SetOkButtonLabel(pfd2, null);
1020 ok(hr == S_OK, "got 0x%08lx\n", hr);
1021 hr = IFileDialog2_SetOkButtonLabel(pfd2, txt);
1022 ok(hr == S_OK, "got 0x%08lx\n", hr);
1023
1024 /* SetNavigationRoot */
1025 todo_wine
1026 {
1027 hr = IFileDialog2_SetNavigationRoot(pfd2, NULL);
1028 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
1029 hr = IFileDialog2_SetNavigationRoot(pfd2, psidesktop);
1030 ok(hr == S_OK, "got 0x%08lx\n", hr);
1031 }
1032
1033 IFileDialog2_Release(pfd2);
1034 }
1035
1036 /* Cleanup */
1037 IShellItem_Release(psidesktop);
1038 ref = IFileOpenDialog_Release(pfod);
1039 ok(!ref, "Got refcount %ld, should have been released.\n", ref);
1040 ref = IFileSaveDialog_Release(pfsd);
1041 ok(!ref, "Got refcount %ld, should have been released.\n", ref);
1042}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
int null(void)
Definition: ftp.c:1794
#define ARRAY_SIZE(A)
Definition: main.h:20
#define E_FAIL
Definition: ddrawi.h:102
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
#define todo_wine
Definition: minitest.h:80
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1051
LOCAL char * filetype(int t)
Definition: tree.c:114
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
int32_t INT
Definition: typedefs.h:58
#define S_FALSE
Definition: winerror.h:3451
#define MK_E_NOOBJECT
Definition: winerror.h:3898
#define E_UNEXPECTED
Definition: winerror.h:3528

Referenced by START_TEST().

◆ test_customize()

static void test_customize ( void  )
static

Definition at line 1689 of file itemdlg.c.

1690{
1691 IFileDialog *pfod;
1692 IFileDialogCustomize *pfdc;
1693 IFileDialogEventsImpl *pfdeimpl;
1694 IFileDialogEvents *pfde;
1695 IOleWindow *pow;
1696 CDCONTROLSTATEF cdstate;
1697 DWORD cookie;
1698 LPWSTR tmpstr;
1699 UINT i;
1700 UINT id_vgroup1, id_text, id_editbox1;
1701 LONG ref;
1702 HWND dlg_hwnd;
1703 HRESULT hr;
1704 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
1705 &IID_IFileDialog, (void**)&pfod);
1706 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1707
1708 hr = IFileDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc);
1709 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1710 if(FAILED(hr))
1711 {
1712 skip("Skipping IFileDialogCustomize tests.\n");
1713 IFileDialog_Release(pfod);
1714 return;
1715 }
1716
1717 i = 0;
1718 hr = IFileDialogCustomize_AddPushButton(pfdc, i, pushbutton1W);
1719 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1720 hr = IFileDialogCustomize_AddPushButton(pfdc, i, pushbutton1W);
1721 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1722
1723 hr = IFileDialog_QueryInterface(pfod, &IID_IOleWindow, (void**)&pow);
1724 ok(hr == S_OK, "Got 0x%08lx\n", hr);
1725 hr = IOleWindow_GetWindow(pow, &dlg_hwnd);
1726 ok(hr == S_OK, "Got 0x%08lx\n", hr);
1727 ok(dlg_hwnd == NULL, "NULL\n");
1728 IOleWindow_Release(pow);
1729
1730 cdstate = 0xdeadbeef;
1731 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1732 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1733 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1734
1735 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1736 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
1737
1738 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
1739 ok(hr == S_OK, "got 0x%08lx (control: %d).\n", hr, i);
1740
1741 hr = IFileDialogCustomize_EnableOpenDropDown(pfdc, i);
1742 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1743 hr = IFileDialogCustomize_EnableOpenDropDown(pfdc, ++i);
1744 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1745
1746 hr = IFileDialogCustomize_EnableOpenDropDown(pfdc, i);
1747 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1748 hr = IFileDialogCustomize_EnableOpenDropDown(pfdc, i+1);
1749 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1750
1751 cdstate = 0xdeadbeef;
1752 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1753 ok(hr == E_NOTIMPL, "got 0x%08lx.\n", hr);
1754 ok(cdstate == 0xdeadbeef, "got 0x%08x.\n", cdstate);
1755
1756 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1757 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1758 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1759 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
1760
1761 cdstate = 0xdeadbeef;
1762 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
1763 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1764 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1765 hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, 0);
1766 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1767 cdstate = 0xdeadbeef;
1768 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
1769 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1770 ok(!cdstate, "got 0x%08x.\n", cdstate);
1771 hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, CDCS_ENABLEDVISIBLE);
1772 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1773 cdstate = 0xdeadbeef;
1774 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
1775 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1776 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1777
1778 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
1779 ok(hr == E_NOTIMPL, "got 0x%08lx (control: %d).\n", hr, i);
1780
1781 hr = IFileDialogCustomize_AddMenu(pfdc, i, menuW);
1782 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1783 hr = IFileDialogCustomize_AddMenu(pfdc, ++i, label);
1784 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1785
1786 cdstate = 0xdeadbeef;
1787 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1788 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1789 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1790
1791 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1792 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1793 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1794 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
1795
1796 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
1797 ok(hr == S_OK, "got 0x%08lx (control: %d).\n", hr, i);
1798
1799 hr = IFileDialogCustomize_AddPushButton(pfdc, i, pushbutton2W);
1800 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1801 hr = IFileDialogCustomize_AddPushButton(pfdc, ++i, pushbutton2W);
1802 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1803
1804 cdstate = 0xdeadbeef;
1805 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1806 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1807 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1808
1809 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1810 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
1811
1812 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
1813 ok(hr == S_OK, "got 0x%08lx (control: %d).\n", hr, i);
1814
1815 hr = IFileDialogCustomize_AddComboBox(pfdc, i);
1816 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1817 hr = IFileDialogCustomize_AddComboBox(pfdc, ++i);
1818 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1819
1820 cdstate = 0xdeadbeef;
1821 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1822 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1823 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1824
1825 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1826 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1827 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1828 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
1829
1830 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
1831 ok(hr == S_OK, "got 0x%08lx (control: %d).\n", hr, i);
1832
1833 hr = IFileDialogCustomize_AddRadioButtonList(pfdc, i);
1834 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1835 hr = IFileDialogCustomize_AddRadioButtonList(pfdc, ++i);
1836 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1837
1838 cdstate = 0xdeadbeef;
1839 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1840 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1841 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1842
1843 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, radiobutton1W);
1844 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1845 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, radiobutton1W);
1846 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
1847
1848 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, radiobutton2W);
1849 ok(hr == S_OK, "got 0x%08lx (control: %d).\n", hr, i);
1850
1851 hr = IFileDialogCustomize_AddCheckButton(pfdc, i, label, TRUE);
1852 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1853 hr = IFileDialogCustomize_AddCheckButton(pfdc, ++i, checkbutton1W, TRUE);
1854 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1855
1856 cdstate = 0xdeadbeef;
1857 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1858 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1859 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1860
1861 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1862 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
1863
1864 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, checkbutton2W);
1865 ok(hr == S_OK, "got 0x%08lx (control: %d).\n", hr, i);
1866
1867 if(SUCCEEDED(hr))
1868 {
1869 BOOL checked;
1870 hr = IFileDialogCustomize_GetCheckButtonState(pfdc, i, &checked);
1871 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1872 ok(checked, "checkbox not checked.\n");
1873
1874 hr = IFileDialogCustomize_SetCheckButtonState(pfdc, i, FALSE);
1875 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1876
1877 hr = IFileDialogCustomize_GetCheckButtonState(pfdc, i, &checked);
1878 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1879 ok(!checked, "checkbox checked.\n");
1880
1881 hr = IFileDialogCustomize_SetCheckButtonState(pfdc, i, TRUE);
1882 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1883
1884 hr = IFileDialogCustomize_GetCheckButtonState(pfdc, i, &checked);
1885 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1886 ok(checked, "checkbox not checked.\n");
1887 }
1888
1889 hr = IFileDialogCustomize_AddEditBox(pfdc, i, label);
1890 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1891 hr = IFileDialogCustomize_AddEditBox(pfdc, ++i, editbox1W);
1892 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1893
1894 cdstate = 0xdeadbeef;
1895 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1896 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1897 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1898
1899 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1900 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
1901
1902 /* Does not affect the text in the editbox */
1903 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, editbox2W);
1904 ok(hr == S_OK, "got 0x%08lx (control: %d).\n", hr, i);
1905
1906 hr = IFileDialogCustomize_GetEditBoxText(pfdc, i, &tmpstr);
1907 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1908 if(SUCCEEDED(hr))
1909 {
1910 ok(!lstrcmpW(tmpstr, editbox1W), "got %s.\n", wine_dbgstr_w(tmpstr));
1911 CoTaskMemFree(tmpstr);
1912 }
1913
1914 hr = IFileDialogCustomize_SetEditBoxText(pfdc, i, label2);
1915 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1916
1917 hr = IFileDialogCustomize_GetEditBoxText(pfdc, i, &tmpstr);
1918 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1919 if(SUCCEEDED(hr))
1920 {
1921 ok(!lstrcmpW(tmpstr, label2), "got %s.\n", wine_dbgstr_w(tmpstr));
1922 CoTaskMemFree(tmpstr);
1923 }
1924
1925 hr = IFileDialogCustomize_AddSeparator(pfdc, i);
1926 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1927 hr = IFileDialogCustomize_AddSeparator(pfdc, ++i);
1928 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1929
1930 cdstate = 0xdeadbeef;
1931 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1932 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1933 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1934
1935 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1936 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
1937
1938 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, separatorW);
1939 ok(hr == S_OK, "got 0x%08lx (control: %d).\n", hr, i);
1940
1941 hr = IFileDialogCustomize_AddText(pfdc, i, label);
1942 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1943 hr = IFileDialogCustomize_AddText(pfdc, ++i, textW);
1944 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1945
1946 cdstate = 0xdeadbeef;
1947 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1948 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1949 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1950
1951 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1952 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
1953
1954 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, text2W);
1955 ok(hr == S_OK, "got 0x%08lx (control: %d).\n", hr, i);
1956
1957 hr = IFileDialogCustomize_StartVisualGroup(pfdc, i, label);
1958 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1959 hr = IFileDialogCustomize_StartVisualGroup(pfdc, ++i, visualgroup1W);
1960 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1961
1962 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1963 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
1964
1965 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, visualgroup2W);
1966 ok(hr == S_OK, "got 0x%08lx (control: %d).\n", hr, i);
1967
1968 cdstate = 0xdeadbeef;
1969 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1970 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1971 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
1972
1973 hr = IFileDialogCustomize_StartVisualGroup(pfdc, ++i, label);
1974 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
1975 hr = IFileDialogCustomize_EndVisualGroup(pfdc);
1976 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1977
1978 i++; /* Nonexisting control */
1979 hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
1980 todo_wine ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
1981 hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
1982 ok(hr == E_INVALIDARG, "got 0x%08lx (control: %d).\n", hr, i);
1983 cdstate = 0xdeadbeef;
1984 hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
1985 todo_wine ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
1986 ok(cdstate == 0xdeadbeef, "got 0x%08x.\n", cdstate);
1987
1989 pfdeimpl = impl_from_IFileDialogEvents(pfde);
1990 pfdeimpl->events_test = IFDEVENT_TEST1;
1991 hr = IFileDialog_Advise(pfod, pfde, &cookie);
1992 ok(hr == S_OK, "Got 0x%08lx\n", hr);
1993
1994 hr = IFileDialog_Show(pfod, NULL);
1995 ok(hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "Got 0x%08lx\n", hr);
1996
1997 hr = IFileDialog_Unadvise(pfod, cookie);
1998 ok(hr == S_OK, "Got 0x%08lx\n", hr);
1999
2000 IFileDialogEvents_Release(pfde);
2001 IFileDialogCustomize_Release(pfdc);
2002 ref = IFileDialog_Release(pfod);
2003 ok(!ref, "Refcount not zero (%ld).\n", ref);
2004
2005
2006 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
2007 &IID_IFileDialog, (void**)&pfod);
2008 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2009
2010 hr = IFileDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc);
2011 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2012
2013 i = 0;
2014 hr = IFileDialogCustomize_AddMenu(pfdc, ++i, label);
2015 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2016 if(SUCCEEDED(hr))
2017 {
2019 UINT j = 0;
2020
2021 for(j = 0; j < 10; j++)
2022 {
2023 hr = IFileDialogCustomize_AddControlItem(pfdc, i, j, label);
2024 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2025 }
2026
2027 hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
2028 ok(hr == E_NOTIMPL, "got 0x%08lx.\n", hr);
2029
2030 cdstate = 0xdeadbeef;
2031 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2032 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2033 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2034 hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, 0);
2035 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2036 cdstate = 0xdeadbeef;
2037 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2038 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2039 ok(cdstate == 0, "got 0x%08x.\n", cdstate);
2040 hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, CDCS_ENABLEDVISIBLE);
2041 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2042 cdstate = 0xdeadbeef;
2043 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2044 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2045 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2046
2047 hr = IFileDialogCustomize_RemoveAllControlItems(pfdc, i);
2048 ok(hr == E_NOTIMPL, "got 0x%08lx.\n", hr);
2049
2050 for(j = 0; j < 10; j++)
2051 {
2052 hr = IFileDialogCustomize_RemoveControlItem(pfdc, i, j);
2053 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2054 }
2055 }
2056 hr = IFileDialogCustomize_AddPushButton(pfdc, ++i, label);
2057 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2058 hr = IFileDialogCustomize_AddComboBox(pfdc, ++i);
2059 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2060 if(SUCCEEDED(hr))
2061 {
2062 DWORD selected = -1;
2063 UINT j = 0;
2064
2065 for(j = 0; j < 10; j++)
2066 {
2067 hr = IFileDialogCustomize_AddControlItem(pfdc, i, j, label);
2068 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2069 }
2070
2071 hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
2072 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
2073 ok(selected == -1, "got %ld.\n", selected);
2074
2075 cdstate = 0xdeadbeef;
2076 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2077 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2078 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2079 hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, 0);
2080 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2081 cdstate = 0xdeadbeef;
2082 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2083 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2084 ok(cdstate == 0, "got 0x%08x.\n", cdstate);
2085 hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, CDCS_ENABLEDVISIBLE);
2086 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2087 cdstate = 0xdeadbeef;
2088 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2089 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2090 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2091
2092 for(j = 0; j < 10; j++)
2093 {
2094 hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, j);
2095 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2096 hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
2097 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2098 ok(selected == j, "got %ld.\n", selected);
2099 }
2100 j++;
2101 hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, j);
2102 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
2103
2104 hr = IFileDialogCustomize_RemoveAllControlItems(pfdc, i);
2105 ok(hr == E_NOTIMPL, "got 0x%08lx.\n", hr);
2106
2107 for(j = 0; j < 10; j++)
2108 {
2109 hr = IFileDialogCustomize_RemoveControlItem(pfdc, i, j);
2110 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2111 }
2112 }
2113
2114 hr = IFileDialogCustomize_AddRadioButtonList(pfdc, ++i);
2115 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2116 if(SUCCEEDED(hr))
2117 {
2118 DWORD selected = -1;
2119 UINT j = 0;
2120
2121 for(j = 0; j < 10; j++)
2122 {
2123 hr = IFileDialogCustomize_AddControlItem(pfdc, i, j, label);
2124 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2125 }
2126
2127 hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
2128 ok(hr == E_FAIL, "got 0x%08lx.\n", hr);
2129 ok(selected == -1, "got %ld.\n", selected);
2130
2131 cdstate = 0xdeadbeef;
2132 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2133 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2134 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2135 hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, 0);
2136 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2137 cdstate = 0xdeadbeef;
2138 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2139 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2140 ok(cdstate == 0, "got 0x%08x.\n", cdstate);
2141 hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, CDCS_ENABLEDVISIBLE);
2142 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2143 cdstate = 0xdeadbeef;
2144 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2145 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2146 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2147
2148 for(j = 0; j < 10; j++)
2149 {
2150 hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, j);
2151 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2152 hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
2153 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2154 ok(selected == j, "got %ld.\n", selected);
2155 }
2156 j++;
2157 hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, j);
2158 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
2159
2160 hr = IFileDialogCustomize_RemoveAllControlItems(pfdc, i);
2161 ok(hr == E_NOTIMPL, "got 0x%08lx.\n", hr);
2162
2163 for(j = 0; j < 10; j++)
2164 {
2165 hr = IFileDialogCustomize_RemoveControlItem(pfdc, i, j);
2166 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2167 }
2168 }
2169 hr = IFileDialogCustomize_EnableOpenDropDown(pfdc, ++i);
2170 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2171 if(SUCCEEDED(hr))
2172 {
2173 DWORD selected = -1;
2174 UINT j = 0;
2175
2176 for(j = 0; j < 10; j++)
2177 {
2178 hr = IFileDialogCustomize_AddControlItem(pfdc, i, j, label);
2179 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2180 }
2181
2182 hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
2183 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2184 ok(selected == 0, "got %ld.\n", selected);
2185
2186 cdstate = 0xdeadbeef;
2187 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2188 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2189 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2190 hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, 0);
2191 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2192 cdstate = 0xdeadbeef;
2193 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2194 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2195 ok(cdstate == 0, "got 0x%08x.\n", cdstate);
2196 hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, CDCS_ENABLEDVISIBLE);
2197 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2198 cdstate = 0xdeadbeef;
2199 hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
2200 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2201 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2202 hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, 0);
2203 todo_wine ok(hr == E_NOTIMPL, "got 0x%08lx.\n", hr);
2204
2205 hr = IFileDialogCustomize_RemoveAllControlItems(pfdc, i);
2206 ok(hr == E_NOTIMPL, "got 0x%08lx.\n", hr);
2207
2208 for(j = 0; j < 10; j++)
2209 {
2210 hr = IFileDialogCustomize_RemoveControlItem(pfdc, i, j);
2211 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2212 }
2213 }
2214
2215 IFileDialogCustomize_Release(pfdc);
2216 ref = IFileDialog_Release(pfod);
2217 ok(!ref, "Refcount not zero (%ld).\n", ref);
2218
2219
2220 /* Some more tests for VisualGroup behavior */
2221 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
2222 &IID_IFileDialog, (void**)&pfod);
2223 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2224
2225 hr = IFileDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc);
2226 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2227
2228 i = -1;
2229 id_vgroup1 = ++i;
2230 hr = IFileDialogCustomize_StartVisualGroup(pfdc, id_vgroup1, visualgroup1W);
2231 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2232
2233 cdstate = 0xdeadbeef;
2234 hr = IFileDialogCustomize_GetControlState(pfdc, id_vgroup1, &cdstate);
2235 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2236 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2237
2238 id_text = ++i;
2239 hr = IFileDialogCustomize_AddText(pfdc, id_text, label);
2240 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2241
2242 cdstate = 0xdeadbeef;
2243 hr = IFileDialogCustomize_GetControlState(pfdc, id_text, &cdstate);
2244 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2245 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2246
2247 id_editbox1 = ++i;
2248 hr = IFileDialogCustomize_AddEditBox(pfdc, id_editbox1, editbox1W);
2249 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2250
2251 cdstate = 0xdeadbeef;
2252 hr = IFileDialogCustomize_GetControlState(pfdc, id_editbox1, &cdstate);
2253 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2254 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2255
2256
2257 /* Set all Visible but not Enabled */
2258 hr = IFileDialogCustomize_SetControlState(pfdc, id_vgroup1, CDCS_VISIBLE);
2259 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2260
2261 cdstate = 0xdeadbeef;
2262 hr = IFileDialogCustomize_GetControlState(pfdc, id_vgroup1, &cdstate);
2263 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2264 ok(cdstate == CDCS_VISIBLE, "got 0x%08x.\n", cdstate);
2265 cdstate = 0xdeadbeef;
2266
2267 hr = IFileDialogCustomize_GetControlState(pfdc, id_text, &cdstate);
2268 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2269 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2270
2271 cdstate = 0xdeadbeef;
2272 hr = IFileDialogCustomize_GetControlState(pfdc, id_editbox1, &cdstate);
2273 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2274 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2275
2276 /* Set text to Visible but not Enabled */
2277 hr = IFileDialogCustomize_SetControlState(pfdc, id_text, CDCS_VISIBLE);
2278 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2279
2280 cdstate = 0xdeadbeef;
2281 hr = IFileDialogCustomize_GetControlState(pfdc, id_vgroup1, &cdstate);
2282 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2283 ok(cdstate == CDCS_VISIBLE, "got 0x%08x.\n", cdstate);
2284 cdstate = 0xdeadbeef;
2285
2286 hr = IFileDialogCustomize_GetControlState(pfdc, id_text, &cdstate);
2287 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2288 ok(cdstate == CDCS_VISIBLE, "got 0x%08x.\n", cdstate);
2289
2290 cdstate = 0xdeadbeef;
2291 hr = IFileDialogCustomize_GetControlState(pfdc, id_editbox1, &cdstate);
2292 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2293 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2294
2295 /* Set vgroup to inactive */
2296 hr = IFileDialogCustomize_SetControlState(pfdc, id_vgroup1, CDCS_INACTIVE);
2297 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2298
2299 cdstate = 0xdeadbeef;
2300 hr = IFileDialogCustomize_GetControlState(pfdc, id_vgroup1, &cdstate);
2301 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2302 ok(cdstate == CDCS_INACTIVE, "got 0x%08x.\n", cdstate);
2303
2304 cdstate = 0xdeadbeef;
2305 hr = IFileDialogCustomize_GetControlState(pfdc, id_text, &cdstate);
2306 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2307 ok(cdstate == CDCS_VISIBLE, "got 0x%08x.\n", cdstate);
2308
2309 cdstate = 0xdeadbeef;
2310 hr = IFileDialogCustomize_GetControlState(pfdc, id_editbox1, &cdstate);
2311 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2312 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2313
2314 /* Set vgroup to Enabled and Visible again */
2315 hr = IFileDialogCustomize_SetControlState(pfdc, id_vgroup1, CDCS_ENABLEDVISIBLE);
2316 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2317
2318 cdstate = 0xdeadbeef;
2319 hr = IFileDialogCustomize_GetControlState(pfdc, id_vgroup1, &cdstate);
2320 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2321 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2322
2323 cdstate = 0xdeadbeef;
2324 hr = IFileDialogCustomize_GetControlState(pfdc, id_text, &cdstate);
2325 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2326 ok(cdstate == CDCS_VISIBLE, "got 0x%08x.\n", cdstate);
2327
2328 cdstate = 0xdeadbeef;
2329 hr = IFileDialogCustomize_GetControlState(pfdc, id_editbox1, &cdstate);
2330 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2331 ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
2332
2333 hr = IFileDialogCustomize_MakeProminent(pfdc, id_vgroup1);
2334 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2335
2336 IFileDialogCustomize_Release(pfdc);
2337 ref = IFileDialog_Release(pfod);
2338 ok(!ref, "Refcount not zero (%ld).\n", ref);
2339}
#define E_NOTIMPL
Definition: ddrawi.h:99
static char selected[MAX_PATH+1]
Definition: dirdlg.c:7
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
#define wine_dbgstr_w
Definition: kernel32.h:34
static const WCHAR editbox1W[]
Definition: itemdlg.c:1619
static const WCHAR text2W[]
Definition: itemdlg.c:1622
static const WCHAR radiobutton1W[]
Definition: itemdlg.c:1615
static const WCHAR label[]
Definition: itemdlg.c:1608
static const WCHAR visualgroup2W[]
Definition: itemdlg.c:1625
static const WCHAR pushbutton2W[]
Definition: itemdlg.c:1612
static const WCHAR separatorW[]
Definition: itemdlg.c:1623
static const WCHAR textW[]
Definition: itemdlg.c:1621
static const WCHAR checkbutton2W[]
Definition: itemdlg.c:1618
static const WCHAR editbox2W[]
Definition: itemdlg.c:1620
static const WCHAR pushbutton1W[]
Definition: itemdlg.c:1611
static const WCHAR menuW[]
Definition: itemdlg.c:1610
static const WCHAR label2[]
Definition: itemdlg.c:1609
static const WCHAR checkbutton1W[]
Definition: itemdlg.c:1617
static const WCHAR visualgroup1W[]
Definition: itemdlg.c:1624
static const WCHAR radiobutton2W[]
Definition: itemdlg.c:1616
FileDialogEventsTest events_test
Definition: itemdlg.c:126
uint16_t * LPWSTR
Definition: typedefs.h:56
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_CANCELLED
Definition: winerror.h:1055

Referenced by START_TEST().

◆ test_customize_dlgproc()

static LRESULT CALLBACK test_customize_dlgproc ( HWND  hwnd,
UINT  message,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 174 of file itemdlg.c.

175{
176 WNDPROC oldwndproc = GetPropA(hwnd, "WT_OLDWC");
177 IFileDialog *pfd = GetPropA(hwnd, "WT_PFD");
178 BOOL br;
179
180 switch(message)
181 {
182 case WM_USER+0x1234:
184 break;
185 case WM_TIMER:
186 switch(wparam)
187 {
191 SetTimer(hwnd, IDT_CLOSEDIALOG, 100, 0);
192 return TRUE;
193 case IDT_CLOSEDIALOG:
194 /* Calling IFileDialog_Close here does not work */
196 ok(br, "Failed\n");
197 return TRUE;
198 case IDT_SHOWDIALOG:
199 {
200 HRESULT hr;
202 hr = IFileDialog_Show(pfd, NULL);
203 ok(hr == E_UNEXPECTED, "got 0x%08lx.\n", hr);
204 SetTimer(hwnd, IDT_CLOSEDIALOG, 100, 0);
205 return TRUE;
206 }
207 }
208 }
209
210 return CallWindowProcW(oldwndproc, hwnd, message, wparam, lparam);
211}
@ wparam
Definition: SystemMenu.c:30
static void filedialog_change_filetype(IFileDialog *pfd, HWND dlg_hwnd)
Definition: itemdlg.c:1161
static void test_customize_onfolderchange(IFileDialog *pfd)
Definition: itemdlg.c:1630
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define IDCANCEL
Definition: winuser.h:842
#define WM_TIMER
Definition: winuser.h:1770
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: tftpd.h:60

Referenced by IFileDialogEvents_fnOnFolderChange().

◆ test_customize_onfolderchange()

static void test_customize_onfolderchange ( IFileDialog *  pfd)
static

Definition at line 1630 of file itemdlg.c.

1631{
1632 HWND dlg_hwnd, item, item_parent;
1633 BOOL br;
1634 WCHAR buf[1024];
1635
1636 buf[0] = '\0';
1637
1638 dlg_hwnd = get_hwnd_from_ifiledialog(pfd);
1639 ok(dlg_hwnd != NULL, "Got NULL.\n");
1640
1641 item = find_window(dlg_hwnd, NULL, checkbutton2W);
1642 ok(item != NULL, "Failed to find item.\n");
1643 item_parent = GetParent(item);
1644 GetClassNameW(item_parent, buf, 1024);
1645 ok(!lstrcmpW(buf, floatnotifysinkW), "Got %s\n", wine_dbgstr_w(buf));
1646 item = find_window(dlg_hwnd, NULL, text2W);
1647 ok(item != NULL, "Failed to find item.\n");
1648 item_parent = GetParent(item);
1649 GetClassNameW(item_parent, buf, 1024);
1650 ok(!lstrcmpW(buf, floatnotifysinkW), "Got %s\n", wine_dbgstr_w(buf));
1651 item = find_window(dlg_hwnd, NULL, radiobutton1W);
1652 ok(item != NULL, "Failed to find item.\n");
1653 item_parent = GetParent(item);
1654 GetClassNameW(item_parent, buf, 1024);
1655 ok(!lstrcmpW(buf, RadioButtonListW), "Got %s\n", wine_dbgstr_w(buf));
1656 item_parent = GetParent(item_parent);
1657 GetClassNameW(item_parent, buf, 1024);
1658 ok(!lstrcmpW(buf, floatnotifysinkW), "Got %s\n", wine_dbgstr_w(buf));
1659
1660 item = find_window(dlg_hwnd, NULL, pushbutton1W);
1661 ok(item == NULL, "Found item: %p\n", item);
1662 item = find_window(dlg_hwnd, NULL, pushbutton2W);
1663 ok(item == NULL, "Found item: %p\n", item);
1664 item = find_window(dlg_hwnd, NULL, comboboxitem1W);
1665 ok(item == NULL, "Found item: %p\n", item);
1666 item = find_window(dlg_hwnd, NULL, comboboxitem2W);
1667 ok(item == NULL, "Found item: %p\n", item);
1668 item = find_window(dlg_hwnd, NULL, radiobutton2W);
1669 ok(item == NULL, "Found item: %p\n", item);
1670 item = find_window(dlg_hwnd, NULL, checkbutton1W);
1671 ok(item == NULL, "Found item: %p\n", item);
1672 item = find_window(dlg_hwnd, NULL, editbox1W);
1673 ok(item == NULL, "Found item: %p\n", item);
1674 item = find_window(dlg_hwnd, NULL, editbox2W);
1675 ok(item == NULL, "Found item: %p\n", item);
1676 item = find_window(dlg_hwnd, NULL, textW);
1677 ok(item == NULL, "Found item: %p\n", item);
1678 item = find_window(dlg_hwnd, NULL, separatorW);
1679 ok(item == NULL, "Found item: %p\n", item);
1680 item = find_window(dlg_hwnd, NULL, visualgroup1W);
1681 ok(item == NULL, "Found item: %p\n", item);
1682 item = find_window(dlg_hwnd, NULL, visualgroup2W);
1683 todo_wine ok(item == NULL, "Found item: %p\n", item);
1684
1685 br = PostMessageW(dlg_hwnd, WM_COMMAND, IDCANCEL, 0);
1686 ok(br, "Failed\n");
1687}
static const WCHAR floatnotifysinkW[]
Definition: itemdlg.c:1627
static const WCHAR RadioButtonListW[]
Definition: itemdlg.c:1628
static const WCHAR comboboxitem2W[]
Definition: itemdlg.c:1614
static const WCHAR comboboxitem1W[]
Definition: itemdlg.c:1613
HWND WINAPI GetParent(_In_ HWND)

Referenced by test_customize_dlgproc().

◆ test_customize_remove_from_empty_combobox()

static void test_customize_remove_from_empty_combobox ( void  )
static

Definition at line 2523 of file itemdlg.c.

2524{
2525 IFileDialog *pfod;
2526 IFileDialogCustomize *pfdc;
2527 UINT i;
2528 HRESULT hr;
2529 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
2530 &IID_IFileDialog, (void**)&pfod);
2531 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2532
2533 hr = IFileDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc);
2534 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2535 if(FAILED(hr))
2536 {
2537 skip("Skipping IFileDialogCustomize tests.\n");
2538 IFileDialog_Release(pfod);
2539 return;
2540 }
2541
2542 i = 107;
2543 hr = IFileDialogCustomize_AddComboBox(pfdc, i);
2544 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2545
2546 hr = IFileDialogCustomize_RemoveAllControlItems(pfdc, i);
2547 ok(hr == E_NOTIMPL, "got 0x%08lx.\n", hr);
2548
2549 hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, 1000);
2550 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
2551
2552 hr = IFileDialogCustomize_RemoveControlItem(pfdc, i, 0);
2553 ok(hr == E_INVALIDARG, "got 0x%08lx.\n", hr);
2554
2555 IFileDialogCustomize_Release(pfdc);
2556 IFileDialog_Release(pfod);
2557}

Referenced by START_TEST().

◆ test_double_show()

static void test_double_show ( void  )
static

Definition at line 2559 of file itemdlg.c.

2560{
2561 IFileDialogEventsImpl *pfdeimpl;
2562 IFileDialogEvents *pfde;
2564 DWORD cookie;
2565 HRESULT hr;
2566
2567 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
2568 &IID_IFileDialog, (void**)&pfd);
2569 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2570
2572 pfdeimpl = impl_from_IFileDialogEvents(pfde);
2573 pfdeimpl->events_test = IFDEVENT_TEST4;
2574
2575 hr = IFileDialog_Advise(pfd, pfde, &cookie);
2576 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2577
2578 hr = IFileDialog_Show(pfd, NULL);
2579 ok(hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "got 0x%08lx.\n", hr);
2580
2581 hr = IFileDialog_Unadvise(pfd, cookie);
2582 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2583
2584 IFileDialogEvents_Release(pfde);
2585 IFileDialog_Release(pfd);
2586}

Referenced by START_TEST().

◆ test_events()

static void test_events ( void  )
static

Definition at line 1188 of file itemdlg.c.

1189{
1191 IFileDialogEventsImpl *pfdeimpl;
1192 IFileDialogEvents *pfde;
1193 DWORD cookie;
1194 ULONG ref;
1195 HRESULT hr;
1196 const WCHAR fname1[] = {'f','n','a','m','e','1', 0};
1197 const WCHAR fspec1[] = {'*','.','t','x','t',0};
1198 const WCHAR fname2[] = {'f','n','a','m','e','2', 0};
1199 const WCHAR fspec2[] = {'*','.','e','x','e',0};
1200 COMDLG_FILTERSPEC filterspec[3] = {{fname1, fspec1}, {fname2, fspec2}};
1201
1202
1203 /*
1204 * 1. Show the dialog with no filetypes added
1205 */
1206 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
1207 &IID_IFileDialog, (void**)&pfd);
1208 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1209
1211 pfdeimpl = impl_from_IFileDialogEvents(pfde);
1212 pfdeimpl->events_test = IFDEVENT_TEST2;
1213
1214 hr = IFileDialog_Advise(pfd, pfde, &cookie);
1215 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1216
1217 hr = IFileDialog_Show(pfd, NULL);
1218 ok(hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "got 0x%08lx.\n", hr);
1219
1220 ok(pfdeimpl->OnFolderChanging == 1, "Got %ld\n", pfdeimpl->OnFolderChanging);
1221 pfdeimpl->OnFolderChanging = 0;
1222 ok(pfdeimpl->OnFolderChange == 1, "Got %ld\n", pfdeimpl->OnFolderChange);
1223 pfdeimpl->OnFolderChange = 0;
1224 /* pfdeimpl->OnSelectionChange too unreliable to test. Can be 0, 1 or even 2. */
1225 pfdeimpl->OnSelectionChange = 0;
1226 ok(pfdeimpl->OnTypeChange == 0, "Got %ld\n", pfdeimpl->OnTypeChange);
1227 pfdeimpl->OnTypeChange = 0;
1228
1229 ensure_zero_events(pfdeimpl);
1230
1231 hr = IFileDialog_Unadvise(pfd, cookie);
1232 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1233
1234 IFileDialogEvents_Release(pfde);
1235 ref = IFileDialog_Release(pfd);
1236 ok(!ref || broken(ref /* win2008_64 (intermittently) */), "Got %ld\n", ref);
1237
1238
1239 /*
1240 * 2. Show the dialog with filetypes added
1241 */
1242 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
1243 &IID_IFileDialog, (void**)&pfd);
1244 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1245
1247 pfdeimpl = impl_from_IFileDialogEvents(pfde);
1248 pfdeimpl->events_test = IFDEVENT_TEST2;
1249
1250 hr = IFileDialog_Advise(pfd, pfde, &cookie);
1251 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1252
1253 hr = IFileDialog_SetFileTypes(pfd, 2, filterspec);
1254 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1255
1256 ensure_zero_events(pfdeimpl);
1257
1258 hr = IFileDialog_Show(pfd, NULL);
1259 ok(hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "got 0x%08lx.\n", hr);
1260
1261 ok(pfdeimpl->OnFolderChanging == 1, "Got %ld\n", pfdeimpl->OnFolderChanging);
1262 pfdeimpl->OnFolderChanging = 0;
1263 ok(pfdeimpl->OnFolderChange == 1, "Got %ld\n", pfdeimpl->OnFolderChange);
1264 pfdeimpl->OnFolderChange = 0;
1265 /* pfdeimpl->OnSelectionChange too unreliable to test. Can be 0, 1 or even 2. */
1266 pfdeimpl->OnSelectionChange = 0;
1267 /* Called once just by showing the dialog */
1268 ok(pfdeimpl->OnTypeChange == 1, "Got %ld\n", pfdeimpl->OnTypeChange);
1269 pfdeimpl->OnTypeChange = 0;
1270
1271 ensure_zero_events(pfdeimpl);
1272
1273 hr = IFileDialog_Unadvise(pfd, cookie);
1274 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1275
1276 IFileDialogEvents_Release(pfde);
1277 ref = IFileDialog_Release(pfd);
1278 ok(!ref || broken(ref /* win2008_64 (intermittently) */), "Got %ld\n", ref);
1279
1280
1281 /*
1282 * 3. Show the dialog with filetypes added and simulate manual change of filetype
1283 */
1284 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
1285 &IID_IFileDialog, (void**)&pfd);
1286 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1287
1289 pfdeimpl = impl_from_IFileDialogEvents(pfde);
1290 pfdeimpl->events_test = IFDEVENT_TEST3;
1291
1292 hr = IFileDialog_Advise(pfd, pfde, &cookie);
1293 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1294
1295 hr = IFileDialog_SetFileTypes(pfd, 2, filterspec);
1296 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1297
1298 ensure_zero_events(pfdeimpl);
1299
1300 hr = IFileDialog_Show(pfd, NULL);
1301 ok(hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "got 0x%08lx.\n", hr);
1302
1303 ok(pfdeimpl->OnFolderChanging == 1, "Got %ld\n", pfdeimpl->OnFolderChanging);
1304 pfdeimpl->OnFolderChanging = 0;
1305 ok(pfdeimpl->OnFolderChange == 1, "Got %ld\n", pfdeimpl->OnFolderChange);
1306 pfdeimpl->OnFolderChange = 0;
1307 /* pfdeimpl->OnSelectionChange too unreliable to test. Can be 0, 1 or even 2. */
1308 pfdeimpl->OnSelectionChange = 0;
1309 /* Called once by showing the dialog and once again when changing the filetype */
1310 todo_wine ok(pfdeimpl->OnTypeChange == 2, "Got %ld\n", pfdeimpl->OnTypeChange);
1311 pfdeimpl->OnTypeChange = 0;
1312
1313 ensure_zero_events(pfdeimpl);
1314
1315 hr = IFileDialog_Unadvise(pfd, cookie);
1316 ok(hr == S_OK, "got 0x%08lx.\n", hr);
1317
1318 IFileDialogEvents_Release(pfde);
1319 ref = IFileDialog_Release(pfd);
1320 ok(!ref || broken(ref /* win2008_64 (intermittently) */), "Got %ld\n", ref);
1321}
uint32_t ULONG
Definition: typedefs.h:59

Referenced by START_TEST().

◆ test_filename()

static void test_filename ( void  )
static

Definition at line 1512 of file itemdlg.c.

1513{
1514 IShellItem *psi_current;
1515 HRESULT hr;
1517
1518 static const WCHAR filename_noextW[] = {'w','i','n','e','t','e','s','t',0};
1519 static const WCHAR filename_dotextW[] = {'w','i','n','e','t','e','s','t','.',0};
1520 static const WCHAR filename_dotanddefW[] = {'w','i','n','e','t','e','s','t','.','.','w','t','e',0};
1521 static const WCHAR filename_defextW[] = {'w','i','n','e','t','e','s','t','.','w','t','e',0};
1522 static const WCHAR filename_mixedcaseW[] = {'w','i','n','e','t','e','s','t','.','W','T','E',0};
1523 static const WCHAR filename_ext1W[] = {'w','i','n','e','t','e','s','t','.','w','t','1',0};
1524 static const WCHAR filename_ext2W[] = {'w','i','n','e','t','e','s','t','.','w','t','2',0};
1525 static const WCHAR filename_ext1anddefW[] =
1526 {'w','i','n','e','t','e','s','t','.','w','t','1','.','w','t','e',0};
1527 static const WCHAR defextW[] = {'w','t','e',0};
1528 static const WCHAR desc1[] = {'d','e','s','c','r','i','p','t','i','o','n','1',0};
1529 static const WCHAR desc2[] = {'d','e','s','c','r','i','p','t','i','o','n','2',0};
1530 static const WCHAR descdef[] = {'d','e','f','a','u','l','t',' ','d','e','s','c',0};
1531 static const WCHAR ext1[] = {'*','.','w','t','1',0};
1532 static const WCHAR ext2[] = {'*','.','w','t','2',0};
1533 static const WCHAR extdef[] = {'*','.','w','t','e',0};
1534 static const WCHAR complexext[] = {'*','.','w','t','2',';','*','.','w','t','1',0};
1535 /* 300 chars, to be longer than MAX_PATH=260 */
1536 static const WCHAR long_ext[] = L"*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;*.wt2;";
1537
1538 static const COMDLG_FILTERSPEC filterspec[] = {
1539 { desc1, ext1 }, { desc2, ext2 }, { descdef, extdef }
1540 };
1541 static const COMDLG_FILTERSPEC filterspec2[] = {
1542 { desc1, complexext }
1543 };
1544 static const COMDLG_FILTERSPEC filterspec_long[] = {
1545 { desc2, long_ext }
1546 };
1547
1548 /* No extension */
1549 test_filename_savedlg(filename_noextW, NULL, NULL, NULL, 0, 0, filename_noextW);
1550 /* Default extension */
1551 test_filename_savedlg(filename_noextW, NULL, defextW, NULL, 0, 0, filename_defextW);
1552 /* Default extension on filename ending with a . */
1553 test_filename_savedlg(filename_dotextW, NULL, defextW, NULL, 0, 0, filename_dotanddefW);
1554 /* Default extension on filename with default extension */
1555 test_filename_savedlg(filename_defextW, NULL, defextW, NULL, 0, 0, filename_defextW);
1556 /* Default extension on filename with another extension */
1557 test_filename_savedlg(filename_ext1W, NULL, defextW, NULL, 0, 0, filename_ext1anddefW);
1558 /* Default extension, filterspec without default extension */
1559 test_filename_savedlg(filename_noextW, NULL, defextW, filterspec, 2, 0, filename_ext1W);
1560 /* Default extension, filterspec with default extension */
1561 test_filename_savedlg(filename_noextW, NULL, defextW, filterspec, 3, 0, filename_ext1W);
1562 /* Default extension, filterspec with default extension and filetype index */
1563 test_filename_savedlg(filename_noextW, NULL, defextW, filterspec, 3, 2, filename_ext2W);
1564 /* Default extension, filterspec with "complex" extension */
1565 test_filename_savedlg(filename_noextW, NULL, defextW, filterspec2, 1, 0, filename_ext2W);
1566 /* Default extension, filterspec with extension that differs in case from the specified filename */
1567 test_filename_savedlg(filename_mixedcaseW, NULL, defextW, filterspec, 0, 0, filename_mixedcaseW);
1568 /* Default extension, filterspec with default extension, filename filter */
1569 test_filename_savedlg(filename_noextW, ext2, defextW, filterspec, 3, 0, filename_ext2W);
1570 /* Default extension, filterspec exceeds MAX_PATH */
1571 test_filename_savedlg(filename_noextW, NULL, defextW, filterspec_long, 1, 0, filename_ext2W);
1572
1574 ok(!!pSHCreateItemFromParsingName, "SHCreateItemFromParsingName is missing.\n");
1575 hr = pSHCreateItemFromParsingName(buf, NULL, &IID_IShellItem, (void**)&psi_current);
1576 ok(hr == S_OK, "Got 0x%08lx\n", hr);
1577
1578 touch_file(filename_noextW);
1579 touch_file(filename_defextW);
1580 touch_file(filename_ext2W);
1581
1582 /* IFileOpenDialog, default extension */
1583 test_filename_opendlg(filename_noextW, NULL, psi_current, defextW, NULL, 0, 0, filename_noextW);
1584 /* IFileOpenDialog, default extension and filterspec */
1585 test_filename_opendlg(filename_noextW, NULL, psi_current, defextW, filterspec, 2, 0, filename_noextW);
1586 /* IFileOpenDialog, default extension, filterspec and filename filter */
1587 test_filename_opendlg(filename_noextW, ext2, psi_current, defextW, filterspec, 2, 0, filename_noextW);
1588
1589 DeleteFileW(filename_noextW);
1590 /* IFileOpenDialog, default extension, noextW deleted */
1591 test_filename_opendlg(filename_noextW, NULL, psi_current, defextW, NULL, 0, 0, filename_defextW);
1592 /* IFileOpenDialog, default extension and filename filter, noextW deleted */
1593 test_filename_opendlg(filename_noextW, ext2, psi_current, defextW, NULL, 0, 0, filename_ext2W);
1594 /* IFileOpenDialog, default extension, filterspec exceeds MAX_PATH */
1595 test_filename_opendlg(filename_noextW, NULL, psi_current, defextW, filterspec_long, 1, 0, filename_ext2W);
1596
1597 if(0) /* Interactive */
1598 {
1599 /* IFileOpenDialog, filterspec, no default extension, noextW deleted */
1600 test_filename_opendlg(filename_noextW, NULL, psi_current, NULL, filterspec, 2, 0, NULL);
1601 }
1602
1603 IShellItem_Release(psi_current);
1604 DeleteFileW(filename_defextW);
1605 DeleteFileW(filename_ext2W);
1606}
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
#define L(x)
Definition: resources.c:13
#define test_filename_opendlg(set_filename, set_filename2, psi, defext, filterspec, fs_count, ft_index, exp_filename)
Definition: itemdlg.c:1509
static void touch_file(LPCWSTR filename)
Definition: itemdlg.c:1323
#define test_filename_savedlg(set_filename, set_filename2, defext, filterspec, fs_count, ft_index, exp_filename)
Definition: itemdlg.c:1403
static const BYTE ext1[]
Definition: encode.c:2732
static const BYTE ext2[]
Definition: encode.c:2734

Referenced by START_TEST().

◆ test_filename_opendlg_()

static void test_filename_opendlg_ ( LPCWSTR  set_filename,
LPCWSTR  set_filename2,
IShellItem *  psi_current,
LPCWSTR  defext,
const COMDLG_FILTERSPEC *  filterspec,
UINT  fs_count,
UINT  ft_index,
LPCWSTR  exp_filename,
const char *  file,
int  line 
)
static

Definition at line 1406 of file itemdlg.c.

1410{
1411 IFileOpenDialog *pfod;
1412 IFileDialogEventsImpl *pfdeimpl;
1413 IFileDialogEvents *pfde;
1414 DWORD cookie;
1416 IShellItemArray *psia;
1417 IShellItem *psi;
1418 LONG ref;
1419 HRESULT hr;
1420
1421 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
1422 &IID_IFileOpenDialog, (void**)&pfod);
1423 ok_(file,line)(hr == S_OK, "CoCreateInstance failed: Got 0x%08lx\n", hr);
1424
1425 if(defext)
1426 {
1427 hr = IFileOpenDialog_SetDefaultExtension(pfod, defext);
1428 ok_(file,line)(hr == S_OK, "SetDefaultExtensions failed: Got 0x%08lx\n", hr);
1429 }
1430
1431 if(fs_count)
1432 {
1433 hr = IFileOpenDialog_SetFileTypes(pfod, fs_count, filterspec);
1434 ok_(file,line)(hr == S_OK, "SetFileTypes failed: Got 0x%08lx\n", hr);
1435 }
1436
1437 if(ft_index)
1438 {
1439 hr = IFileOpenDialog_SetFileTypeIndex(pfod, ft_index);
1440 ok_(file,line)(hr == S_OK, "SetFileTypeIndex failed: Got 0x%08lx\n", hr);
1441 }
1442
1443 if(set_filename2)
1444 {
1445 hr = IFileOpenDialog_SetFileName(pfod, set_filename2);
1446 ok_(file,line)(hr == S_OK, "SetFileName failed: Got 0x%08lx\n", hr);
1447 }
1448
1449 hr = IFileOpenDialog_SetFolder(pfod, psi_current);
1450 ok_(file,line)(hr == S_OK, "SetFolder failed: Got 0x%08lx\n", hr);
1451
1453 pfdeimpl = impl_from_IFileDialogEvents(pfde);
1454 pfdeimpl->set_filename = set_filename;
1455 pfdeimpl->set_filename_tried = FALSE;
1456 hr = IFileOpenDialog_Advise(pfod, pfde, &cookie);
1457 ok_(file,line)(hr == S_OK, "Advise failed: Got 0x%08lx\n", hr);
1458
1459 hr = IFileOpenDialog_Show(pfod, NULL);
1460 ok_(file,line)(hr == S_OK || (!exp_filename && hr == HRESULT_FROM_WIN32(ERROR_CANCELLED)),
1461 "Show failed: Got 0x%08lx\n", hr);
1462 if(hr == S_OK)
1463 {
1464 hr = IFileOpenDialog_GetResult(pfod, &psi);
1465 ok_(file,line)(hr == S_OK, "GetResult failed: Got 0x%08lx\n", hr);
1466
1467 hr = IShellItem_GetDisplayName(psi, SIGDN_PARENTRELATIVEPARSING, &filename);
1468 ok_(file,line)(hr == S_OK, "GetDisplayName(Result) failed: Got 0x%08lx\n", hr);
1469 ok_(file,line)(!lstrcmpW(filename, exp_filename), "(GetResult) Got %s\n", wine_dbgstr_w(filename));
1471 IShellItem_Release(psi);
1472
1473 hr = IFileOpenDialog_GetResults(pfod, &psia);
1474 ok_(file,line)(hr == S_OK, "GetResults failed: Got 0x%08lx\n", hr);
1475 hr = IShellItemArray_GetItemAt(psia, 0, &psi);
1476 ok_(file,line)(hr == S_OK, "GetItemAt failed: Got 0x%08lx\n", hr);
1477
1478 hr = IShellItem_GetDisplayName(psi, SIGDN_PARENTRELATIVEPARSING, &filename);
1479 ok_(file,line)(hr == S_OK, "GetDisplayName(Results) failed: Got 0x%08lx\n", hr);
1480 ok_(file,line)(!lstrcmpW(filename, exp_filename), "(GetResults) Got %s\n", wine_dbgstr_w(filename));
1482
1483 IShellItem_Release(psi);
1484 IShellItemArray_Release(psia);
1485 }
1486 else
1487 {
1488 hr = IFileOpenDialog_GetResult(pfod, &psi);
1489 ok_(file,line)(hr == E_UNEXPECTED, "GetResult: Got 0x%08lx\n", hr);
1490
1491 hr = IFileOpenDialog_GetResults(pfod, &psia);
1492 ok_(file,line)(hr == E_FAIL, "GetResults: Got 0x%08lx\n", hr);
1493 }
1494
1495 hr = IFileOpenDialog_GetFileName(pfod, &filename);
1496 ok_(file,line)(hr == S_OK, "GetFileName failed: Got 0x%08lx\n", hr);
1497 ok_(file,line)(!lstrcmpW(filename, set_filename), "(GetFileName) Got %s\n", wine_dbgstr_w(filename));
1499
1500
1501 hr = IFileOpenDialog_Unadvise(pfod, cookie);
1502 ok_(file,line)(hr == S_OK, "Unadvise failed: Got 0x%08lx\n", hr);
1503
1504 ref = IFileOpenDialog_Release(pfod);
1505 ok_(file,line)(!ref, "Got refcount %ld, should have been released.\n", ref);
1506
1507 IFileDialogEvents_Release(pfde);
1508}
LPCWSTR set_filename
Definition: itemdlg.c:124

◆ test_filename_savedlg_()

static void test_filename_savedlg_ ( LPCWSTR  set_filename,
LPCWSTR  set_filename2,
LPCWSTR  defext,
const COMDLG_FILTERSPEC *  filterspec,
UINT  fs_count,
UINT  ft_index,
LPCWSTR  exp_filename,
const char *  file,
int  line 
)
static

Definition at line 1331 of file itemdlg.c.

1334{
1335 IFileSaveDialog *pfsd;
1336 IFileDialogEventsImpl *pfdeimpl;
1337 IFileDialogEvents *pfde;
1338 DWORD cookie;
1340 IShellItem *psi;
1341 LONG ref;
1342 HRESULT hr;
1343
1344 hr = CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER,
1345 &IID_IFileSaveDialog, (void**)&pfsd);
1346 ok_(file,line)(hr == S_OK, "Got 0x%08lx\n", hr);
1347
1348 if(fs_count)
1349 {
1350 hr = IFileSaveDialog_SetFileTypes(pfsd, fs_count, filterspec);
1351 ok_(file,line)(hr == S_OK, "SetFileTypes failed: Got 0x%08lx\n", hr);
1352 }
1353
1354 if(ft_index)
1355 {
1356 hr = IFileSaveDialog_SetFileTypeIndex(pfsd, ft_index);
1357 ok_(file,line)(hr == S_OK, "SetFileTypeIndex failed: Got 0x%08lx\n", hr);
1358 }
1359
1360 if(defext)
1361 {
1362 hr = IFileSaveDialog_SetDefaultExtension(pfsd, defext);
1363 ok_(file,line)(hr == S_OK, "SetDefaultExtensions failed: Got 0x%08lx\n", hr);
1364 }
1365
1366 if(set_filename2)
1367 {
1368 hr = IFileSaveDialog_SetFileName(pfsd, set_filename2);
1369 ok_(file,line)(hr == S_OK, "SetFileName failed: Got 0x%08lx\n", hr);
1370 }
1371
1373 pfdeimpl = impl_from_IFileDialogEvents(pfde);
1374 pfdeimpl->set_filename = set_filename;
1375 hr = IFileSaveDialog_Advise(pfsd, pfde, &cookie);
1376 ok_(file,line)(hr == S_OK, "Advise failed: Got 0x%08lx\n", hr);
1377
1378 hr = IFileSaveDialog_Show(pfsd, NULL);
1379 ok_(file,line)(hr == S_OK, "Show failed: Got 0x%08lx\n", hr);
1380
1381 hr = IFileSaveDialog_GetFileName(pfsd, &filename);
1382 ok_(file,line)(hr == S_OK, "GetFileName failed: Got 0x%08lx\n", hr);
1383 ok_(file,line)(!lstrcmpW(filename, set_filename), "Got %s\n", wine_dbgstr_w(filename));
1385
1386 hr = IFileSaveDialog_GetResult(pfsd, &psi);
1387 ok_(file,line)(hr == S_OK, "GetResult failed: Got 0x%08lx\n", hr);
1388
1389 hr = IShellItem_GetDisplayName(psi, SIGDN_PARENTRELATIVEPARSING, &filename);
1390 ok_(file,line)(hr == S_OK, "GetDisplayName failed: Got 0x%08lx\n", hr);
1391 ok_(file,line)(!lstrcmpW(filename, exp_filename), "(GetDisplayName) Got %s\n", wine_dbgstr_w(filename));
1393 IShellItem_Release(psi);
1394
1395 hr = IFileSaveDialog_Unadvise(pfsd, cookie);
1396 ok_(file,line)(hr == S_OK, "Unadvise failed: Got 0x%08lx\n", hr);
1397
1398 ref = IFileSaveDialog_Release(pfsd);
1399 ok_(file,line)(!ref, "Got refcount %ld, should have been released.\n", ref);
1400
1401 IFileDialogEvents_Release(pfde);
1402}

◆ test_instantiation()

static BOOL test_instantiation ( void  )
static

Definition at line 335 of file itemdlg.c.

336{
338 IFileOpenDialog *pfod;
339 IFileSaveDialog *pfsd;
340 IServiceProvider *psp;
342 IUnknown *punk, *unk2;
343 HRESULT hr;
344 LONG ref;
345
346 /* Instantiate FileOpenDialog */
347 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
348 &IID_IFileOpenDialog, (void**)&pfod);
349 if(FAILED(hr))
350 {
351 win_skip("Could not instantiate the FileOpenDialog.\n");
352 return FALSE;
353 }
354 ok(hr == S_OK, "got 0x%08lx.\n", hr);
355
356 hr = IFileOpenDialog_QueryInterface(pfod, &IID_IFileDialog, (void**)&pfd);
357 ok(hr == S_OK, "got 0x%08lx.\n", hr);
358 if(SUCCEEDED(hr)) IFileDialog_Release(pfd);
359
360 hr = IFileOpenDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&punk);
361 ok(hr == S_OK, "got 0x%08lx.\n", hr);
362
363 hr = IFileOpenDialog_QueryInterface(pfod, &IID_IFileDialogCustomizeAlt, (void**)&unk2);
364 ok(hr == S_OK, "got 0x%08lx.\n", hr);
365 ok(punk == unk2, "got %p, %p\n", punk, unk2);
366 IUnknown_Release(punk);
367 IUnknown_Release(unk2);
368
369 hr = IFileOpenDialog_QueryInterface(pfod, &IID_IFileSaveDialog, (void**)&pfsd);
370 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
371 if(SUCCEEDED(hr)) IFileSaveDialog_Release(pfsd);
372
373 hr = IFileOpenDialog_QueryInterface(pfod, &IID_IServiceProvider, (void**)&psp);
374 ok(hr == S_OK, "got 0x%08lx.\n", hr);
375 if(SUCCEEDED(hr))
376 {
377 IExplorerBrowser *peb;
378 IShellBrowser *psb;
379
380 hr = IServiceProvider_QueryService(psp, &SID_SExplorerBrowserFrame, &IID_ICommDlgBrowser, (void**)&punk);
381 ok(hr == S_OK, "got 0x%08lx.\n", hr);
382 if(SUCCEEDED(hr)) IUnknown_Release(punk);
383
384 /* since win8, the result is E_NOTIMPL for all other services */
385 hr = IServiceProvider_QueryService(psp, &SID_STopLevelBrowser, &IID_IExplorerBrowser, (void**)&peb);
386 ok(hr == E_NOTIMPL || broken(hr == E_FAIL), "got 0x%08lx (expected E_NOTIMPL)\n", hr);
387 if(SUCCEEDED(hr)) IExplorerBrowser_Release(peb);
388 hr = IServiceProvider_QueryService(psp, &SID_STopLevelBrowser, &IID_IShellBrowser, (void**)&psb);
389 ok(hr == E_NOTIMPL || broken(hr == E_FAIL), "got 0x%08lx (expected E_NOTIMPL)\n", hr);
390 if(SUCCEEDED(hr)) IShellBrowser_Release(psb);
391 hr = IServiceProvider_QueryService(psp, &SID_STopLevelBrowser, &IID_ICommDlgBrowser, (void**)&punk);
392 ok(hr == E_NOTIMPL || broken(hr == E_FAIL), "got 0x%08lx (expected E_NOTIMPL)\n", hr);
393 if(SUCCEEDED(hr)) IUnknown_Release(punk);
394
395 hr = IServiceProvider_QueryService(psp, &SID_STopLevelBrowser, &IID_IUnknown, (void**)&punk);
396 ok(hr == E_NOTIMPL || broken(hr == E_FAIL), "got 0x%08lx (expected E_NOTIMPL)\n", hr);
397 if(SUCCEEDED(hr)) IUnknown_Release(punk);
398 hr = IServiceProvider_QueryService(psp, &IID_IUnknown, &IID_IUnknown, (void**)&punk);
399 ok(hr == E_NOTIMPL || broken(hr == E_FAIL), "got 0x%08lx (expected E_NOTIMPL)\n", hr);
400 if(SUCCEEDED(hr)) IUnknown_Release(punk);
401
402 IServiceProvider_Release(psp);
403 }
404
405 hr = IFileOpenDialog_QueryInterface(pfod, &IID_IFileDialogEvents, (void**)&punk);
406 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
407 if(SUCCEEDED(hr)) IUnknown_Release(punk);
408
409 hr = IFileOpenDialog_QueryInterface(pfod, &IID_IExplorerBrowser, (void**)&punk);
410 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
411 if(SUCCEEDED(hr)) IUnknown_Release(punk);
412
413 hr = IFileOpenDialog_QueryInterface(pfod, &IID_IExplorerBrowserEvents, (void**)&punk);
414 ok(hr == S_OK, "got 0x%08lx.\n", hr);
415 if(SUCCEEDED(hr)) IUnknown_Release(punk);
416
417 hr = IFileOpenDialog_QueryInterface(pfod, &IID_ICommDlgBrowser3, (void**)&punk);
418 ok(hr == S_OK, "got 0x%08lx.\n", hr);
419 if(SUCCEEDED(hr)) IUnknown_Release(punk);
420
421 hr = IFileOpenDialog_QueryInterface(pfod, &IID_IShellBrowser, (void**)&punk);
422 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
423 if(SUCCEEDED(hr)) IUnknown_Release(punk);
424
425 hr = IFileOpenDialog_QueryInterface(pfod, &IID_IOleWindow, (void**)&pow);
426 ok(hr == S_OK, "got 0x%08lx.\n", hr);
427 if(SUCCEEDED(hr))
428 {
429 HWND hwnd;
430
431 hr = IOleWindow_ContextSensitiveHelp(pow, TRUE);
432 todo_wine ok(hr == S_OK, "Got 0x%08lx\n", hr);
433
434 hr = IOleWindow_ContextSensitiveHelp(pow, FALSE);
435 todo_wine ok(hr == S_OK, "Got 0x%08lx\n", hr);
436
437 if(0)
438 {
439 /* Crashes on win7 */
440 IOleWindow_GetWindow(pow, NULL);
441 }
442
443 hr = IOleWindow_GetWindow(pow, &hwnd);
444 ok(hr == S_OK, "Got 0x%08lx\n", hr);
445 ok(hwnd == NULL, "Got %p\n", hwnd);
446
447 IOleWindow_Release(pow);
448 }
449
450 ref = IFileOpenDialog_Release(pfod);
451 ok(!ref, "Got refcount %ld, should have been released.\n", ref);
452
453 /* Instantiate FileSaveDialog */
454 hr = CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER,
455 &IID_IFileSaveDialog, (void**)&pfsd);
456 if(FAILED(hr))
457 {
458 win_skip("Could not instantiate the FileSaveDialog.\n");
459 return FALSE;
460 }
461 ok(hr == S_OK, "got 0x%08lx.\n", hr);
462
463 hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IFileDialog, (void**)&pfd);
464 ok(hr == S_OK, "got 0x%08lx.\n", hr);
465 if(SUCCEEDED(hr)) IFileDialog_Release(pfd);
466
467 hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IFileDialogCustomize, (void**)&punk);
468 ok(hr == S_OK, "got 0x%08lx.\n", hr);
469
470 hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IFileDialogCustomizeAlt, (void**)&unk2);
471 ok(hr == S_OK, "got 0x%08lx.\n", hr);
472 ok(punk == unk2, "got %p, %p\n", punk, unk2);
473 IUnknown_Release(punk);
474 IUnknown_Release(unk2);
475
476 hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IFileOpenDialog, (void**)&pfod);
477 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
478 if(SUCCEEDED(hr)) IFileOpenDialog_Release(pfod);
479
480 hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IFileDialogEvents, (void**)&punk);
481 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
482 if(SUCCEEDED(hr)) IFileDialog_Release(pfd);
483
484 hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IExplorerBrowser, (void**)&punk);
485 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
486 if(SUCCEEDED(hr)) IUnknown_Release(punk);
487
488 hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IExplorerBrowserEvents, (void**)&punk);
489 ok(hr == S_OK, "got 0x%08lx.\n", hr);
490 if(SUCCEEDED(hr)) IUnknown_Release(punk);
491
492 hr = IFileSaveDialog_QueryInterface(pfsd, &IID_ICommDlgBrowser3, (void**)&punk);
493 ok(hr == S_OK, "got 0x%08lx.\n", hr);
494 if(SUCCEEDED(hr)) IUnknown_Release(punk);
495
496 hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IShellBrowser, (void**)&punk);
497 ok(hr == E_NOINTERFACE, "got 0x%08lx.\n", hr);
498 if(SUCCEEDED(hr)) IUnknown_Release(punk);
499
500 hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IOleWindow, (void**)&pow);
501 ok(hr == S_OK, "got 0x%08lx.\n", hr);
502 if(SUCCEEDED(hr))
503 {
504 HWND hwnd;
505
506 hr = IOleWindow_ContextSensitiveHelp(pow, TRUE);
507 todo_wine ok(hr == S_OK, "Got 0x%08lx\n", hr);
508
509 hr = IOleWindow_ContextSensitiveHelp(pow, FALSE);
510 todo_wine ok(hr == S_OK, "Got 0x%08lx\n", hr);
511
512 if(0)
513 {
514 /* Crashes on win7 */
515 IOleWindow_GetWindow(pow, NULL);
516 }
517
518 hr = IOleWindow_GetWindow(pow, &hwnd);
519 ok(hr == S_OK, "Got 0x%08lx\n", hr);
520 ok(hwnd == NULL, "Got %p\n", hwnd);
521
522 IOleWindow_Release(pow);
523 }
524
525
526 ref = IFileSaveDialog_Release(pfsd);
527 ok(!ref, "Got refcount %ld, should have been released.\n", ref);
528 return TRUE;
529}
const GUID IID_IUnknown
#define win_skip
Definition: minitest.h:67
_In_opt_ IUnknown * punk
Definition: shlwapi.h:158

Referenced by START_TEST().

◆ test_overwrite()

static void test_overwrite ( void  )
static

Definition at line 2365 of file itemdlg.c.

2366{
2367 static const WCHAR filename_winetest[] = {'w','i','n','e','t','e','s','t','.','o','v','w',0};
2368 IFileDialogEventsImpl *pfdeimpl;
2369 IFileDialogEvents *pfde;
2370 IFileDialog *fd;
2371 DWORD cookie;
2373 IShellItem *psi_current;
2375 HRESULT hr;
2376
2378 ok(!!pSHCreateItemFromParsingName, "SHCreateItemFromParsingName is missing.\n");
2379 hr = pSHCreateItemFromParsingName(buf, NULL, &IID_IShellItem, (void**)&psi_current);
2380 ok(hr == S_OK, "Got 0x%08lx\n", hr);
2381
2382 touch_file(filename_winetest);
2383
2384 /* FOS_OVERWRITEPROMPT has no effect on open dialog */
2385 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
2386 &IID_IFileDialog, (void**)&fd);
2387 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2388
2389 hr = IFileDialog_SetOptions(fd, FOS_OVERWRITEPROMPT | FOS_NOCHANGEDIR);
2390 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2391
2392 hr = IFileDialog_SetFolder(fd, psi_current);
2393 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2394
2396 pfdeimpl = impl_from_IFileDialogEvents(pfde);
2397 pfdeimpl->set_filename = filename_winetest;
2398 hr = IFileDialog_Advise(fd, pfde, &cookie);
2399 ok(hr == S_OK, "Advise failed: Got 0x%08lx\n", hr);
2400
2401 hr = IFileDialog_Show(fd, NULL);
2402 ok(hr == S_OK, "Show failed: Got 0x%08lx\n", hr);
2403
2404 ok(!pfdeimpl->OnOverwrite, "got %lu overwrite events\n", pfdeimpl->OnOverwrite);
2405 ok(pfdeimpl->OnFileOk == 1, "got %lu ok events\n", pfdeimpl->OnFileOk);
2406
2407 hr = IFileDialog_GetFileName(fd, &filename);
2408 ok(hr == S_OK, "GetFileName failed: Got 0x%08lx\n", hr);
2409 ok(!lstrcmpW(filename, filename_winetest), "Got %s\n", wine_dbgstr_w(filename));
2411
2412 hr = IFileDialog_Unadvise(fd, cookie);
2413 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2414
2415 IFileDialog_Release(fd);
2416
2417 IFileDialogEvents_Release(pfde);
2418
2419 /* Save dialog doesn't check for overwrite without FOS_OVERWRITEPROMPT set */
2420 hr = CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER,
2421 &IID_IFileDialog, (void**)&fd);
2422 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2423
2424 hr = IFileDialog_SetOptions(fd, FOS_NOREADONLYRETURN | FOS_PATHMUSTEXIST | FOS_NOCHANGEDIR);
2425 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2426
2427 hr = IFileDialog_SetFolder(fd, psi_current);
2428 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2429
2431 pfdeimpl = impl_from_IFileDialogEvents(pfde);
2432 pfdeimpl->set_filename = filename_winetest;
2433 hr = IFileDialog_Advise(fd, pfde, &cookie);
2434 ok(hr == S_OK, "Advise failed: Got 0x%08lx\n", hr);
2435
2436 hr = IFileDialog_Show(fd, NULL);
2437 ok(hr == S_OK, "Show failed: Got 0x%08lx\n", hr);
2438
2439 ok(!pfdeimpl->OnOverwrite, "got %lu overwrite events\n", pfdeimpl->OnOverwrite);
2440 ok(pfdeimpl->OnFileOk == 1, "got %lu ok events\n", pfdeimpl->OnFileOk);
2441
2442 hr = IFileDialog_GetFileName(fd, &filename);
2443 ok(hr == S_OK, "GetFileName failed: Got 0x%08lx\n", hr);
2444 ok(!lstrcmpW(filename, filename_winetest), "Got %s\n", wine_dbgstr_w(filename));
2446
2447 hr = IFileDialog_Unadvise(fd, cookie);
2448 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2449
2450 IFileDialog_Release(fd);
2451
2452 IFileDialogEvents_Release(pfde);
2453
2454 /* Save dialog with FOS_OVERWRITEPROMPT set */
2455 hr = CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER,
2456 &IID_IFileDialog, (void**)&fd);
2457 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2458
2459 hr = IFileDialog_SetFolder(fd, psi_current);
2460 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2461
2463 pfdeimpl = impl_from_IFileDialogEvents(pfde);
2464 pfdeimpl->set_filename = filename_winetest;
2465 hr = IFileDialog_Advise(fd, pfde, &cookie);
2466 ok(hr == S_OK, "Advise failed: Got 0x%08lx\n", hr);
2467
2468 hr = IFileDialog_Show(fd, NULL);
2469 ok(hr == S_OK, "Show failed: Got 0x%08lx\n", hr);
2470
2471 ok(pfdeimpl->OnOverwrite == 1, "got %lu overwrite events\n", pfdeimpl->OnOverwrite);
2472 ok(pfdeimpl->OnFileOk == 1, "got %lu ok events\n", pfdeimpl->OnFileOk);
2473
2474 hr = IFileDialog_GetFileName(fd, &filename);
2475 ok(hr == S_OK, "GetFileName failed: Got 0x%08lx\n", hr);
2476 ok(!lstrcmpW(filename, filename_winetest), "Got %s\n", wine_dbgstr_w(filename));
2478
2479 hr = IFileDialog_Unadvise(fd, cookie);
2480 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2481
2482 IFileDialog_Release(fd);
2483
2484 IFileDialogEvents_Release(pfde);
2485
2486 DeleteFileW(filename_winetest);
2487
2488 /* Save dialog with FOS_OVERWRITEPROMPT set but without existing file */
2489 hr = CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER,
2490 &IID_IFileDialog, (void**)&fd);
2491 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2492
2493 hr = IFileDialog_SetFolder(fd, psi_current);
2494 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2495
2497 pfdeimpl = impl_from_IFileDialogEvents(pfde);
2498 pfdeimpl->set_filename = filename_winetest;
2499 hr = IFileDialog_Advise(fd, pfde, &cookie);
2500 ok(hr == S_OK, "Advise failed: Got 0x%08lx\n", hr);
2501
2502 hr = IFileDialog_Show(fd, NULL);
2503 ok(hr == S_OK, "Show failed: Got 0x%08lx\n", hr);
2504
2505 ok(!pfdeimpl->OnOverwrite, "got %lu overwrite events\n", pfdeimpl->OnOverwrite);
2506 ok(pfdeimpl->OnFileOk == 1, "got %lu ok events\n", pfdeimpl->OnFileOk);
2507
2508 hr = IFileDialog_GetFileName(fd, &filename);
2509 ok(hr == S_OK, "GetFileName failed: Got 0x%08lx\n", hr);
2510 ok(!lstrcmpW(filename, filename_winetest), "Got %s\n", wine_dbgstr_w(filename));
2512
2513 hr = IFileDialog_Unadvise(fd, cookie);
2514 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2515
2516 IFileDialog_Release(fd);
2517
2518 IFileDialogEvents_Release(pfde);
2519
2520 IShellItem_Release(psi_current);
2521}
static int fd
Definition: io.c:51

Referenced by START_TEST().

◆ test_persistent_state()

static void test_persistent_state ( void  )
static

Definition at line 2341 of file itemdlg.c.

2342{
2343 IFileDialog *fd;
2344 HRESULT hr;
2345
2346 hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
2347 &IID_IFileDialog, (void**)&fd);
2348 ok(hr == S_OK, "got 0x%08lx.\n", hr);
2349
2350if (0)
2351{
2352 /* crashes at least on Win8 */
2353 hr = IFileDialog_SetClientGuid(fd, NULL);
2354}
2355
2356 hr = IFileDialog_SetClientGuid(fd, &IID_IUnknown);
2357 ok(hr == S_OK, "got 0x%08lx\n", hr);
2358
2359 hr = IFileDialog_SetClientGuid(fd, &IID_NULL);
2360 ok(hr == S_OK, "got 0x%08lx\n", hr);
2361
2362 IFileDialog_Release(fd);
2363}
#define IID_NULL
Definition: guiddef.h:98

Referenced by START_TEST().

◆ touch_file()

static void touch_file ( LPCWSTR  filename)
static

Definition at line 1323 of file itemdlg.c.

1324{
1325 HANDLE file;
1327 ok(file != INVALID_HANDLE_VALUE, "Failed to create file.\n");
1329}
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define CREATE_NEW
Definition: disk.h:69
#define GENERIC_WRITE
Definition: nt_native.h:90

Referenced by test_filename(), and test_overwrite().

Variable Documentation

◆ checkbutton1W

const WCHAR checkbutton1W[] = {'c','h','e','c','k','b','u','t','t','o','n','1','_','i','t','e','m',0}
static

Definition at line 1617 of file itemdlg.c.

Referenced by test_customize(), and test_customize_onfolderchange().

◆ checkbutton2W

const WCHAR checkbutton2W[] = {'c','h','e','c','k','b','u','t','t','o','n','2','_','i','t','e','m',0}
static

Definition at line 1618 of file itemdlg.c.

Referenced by test_customize(), and test_customize_onfolderchange().

◆ comboboxitem1W

const WCHAR comboboxitem1W[] = {'c','o','m','b','o','b','o','x','1','_','i','t','e','m',0}
static

Definition at line 1613 of file itemdlg.c.

Referenced by test_customize_onfolderchange().

◆ comboboxitem2W

const WCHAR comboboxitem2W[] = {'c','o','m','b','o','b','o','x','2','_','i','t','e','m',0}
static

Definition at line 1614 of file itemdlg.c.

Referenced by test_customize_onfolderchange().

◆ editbox1W

const WCHAR editbox1W[] = {'e','d','i','t','b','o','x','W','1','_','i','t','e','m',0}
static

Definition at line 1619 of file itemdlg.c.

Referenced by test_customize(), and test_customize_onfolderchange().

◆ editbox2W

const WCHAR editbox2W[] = {'e','d','i','t','b','o','x','W','2','_','i','t','e','m',0}
static

Definition at line 1620 of file itemdlg.c.

Referenced by test_customize(), and test_customize_onfolderchange().

◆ floatnotifysinkW

const WCHAR floatnotifysinkW[] = {'F','l','o','a','t','N','o','t','i','f','y','S','i','n','k',0}
static

Definition at line 1627 of file itemdlg.c.

Referenced by test_customize_onfolderchange().

◆ label

◆ label2

const WCHAR label2[] = {'t','e','s','t',0}
static

Definition at line 1609 of file itemdlg.c.

Referenced by decode_mcu(), decode_mcu_AC_first(), decode_mcu_sub(), and test_customize().

◆ LPCITEMIDLIST

Definition at line 40 of file itemdlg.c.

◆ menuW

const WCHAR menuW[] = {'m','e','n','u','_','i','t','e','m',0}
static

Definition at line 1610 of file itemdlg.c.

Referenced by MCIWND_Create(), and test_customize().

◆ pushbutton1W

const WCHAR pushbutton1W[] = {'p','u','s','h','b','u','t','t','o','n','_','i','t','e','m',0}
static

Definition at line 1611 of file itemdlg.c.

Referenced by test_customize(), and test_customize_onfolderchange().

◆ pushbutton2W

const WCHAR pushbutton2W[] = {'p','u','s','h','b','u','t','t','o','n','2','_','i','t','e','m',0}
static

Definition at line 1612 of file itemdlg.c.

Referenced by test_customize(), and test_customize_onfolderchange().

◆ radiobutton1W

const WCHAR radiobutton1W[] = {'r','a','d','i','o','b','u','t','t','o','n','1','_','i','t','e','m',0}
static

Definition at line 1615 of file itemdlg.c.

Referenced by test_customize(), and test_customize_onfolderchange().

◆ radiobutton2W

const WCHAR radiobutton2W[] = {'r','a','d','i','o','b','u','t','t','o','n','2','_','i','t','e','m',0}
static

Definition at line 1616 of file itemdlg.c.

Referenced by test_customize(), and test_customize_onfolderchange().

◆ RadioButtonListW

const WCHAR RadioButtonListW[] = {'R','a','d','i','o','B','u','t','t','o','n','L','i','s','t',0}
static

Definition at line 1628 of file itemdlg.c.

Referenced by test_customize_onfolderchange().

◆ REFIID

Definition at line 42 of file itemdlg.c.

◆ separatorW

const WCHAR separatorW[] = {'s','e','p','a','r','a','t','o','r','_','i','t','e','m',0}
static

Definition at line 1623 of file itemdlg.c.

Referenced by SetChmPath(), test_customize(), and test_customize_onfolderchange().

◆ text2W

const WCHAR text2W[] = {'t','e','x','t','2','_','i','t','e','m',0}
static

Definition at line 1622 of file itemdlg.c.

Referenced by test_customize(), and test_customize_onfolderchange().

◆ textW

◆ visualgroup1W

const WCHAR visualgroup1W[] = {'v','i','s','u','a','l','g','r','o','u','p','1',0}
static

Definition at line 1624 of file itemdlg.c.

Referenced by test_customize(), and test_customize_onfolderchange().

◆ visualgroup2W

const WCHAR visualgroup2W[] = {'v','i','s','u','a','l','g','r','o','u','p','2',0}
static

Definition at line 1625 of file itemdlg.c.

Referenced by test_customize(), and test_customize_onfolderchange().

◆ vt_IFileDialogEvents

const IFileDialogEventsVtbl vt_IFileDialogEvents
static
Initial value:
= {
}
static ULONG WINAPI IFileDialogEvents_fnAddRef(IFileDialogEvents *iface)
Definition: itemdlg.c:141
static HRESULT WINAPI IFileDialogEvents_fnOnSelectionChange(IFileDialogEvents *iface, IFileDialog *pfd)
Definition: itemdlg.c:274
static HRESULT WINAPI IFileDialogEvents_fnOnOverwrite(IFileDialogEvents *iface, IFileDialog *pfd, IShellItem *psi, FDE_OVERWRITE_RESPONSE *pResponse)
Definition: itemdlg.c:298
static HRESULT WINAPI IFileDialogEvents_fnOnFolderChanging(IFileDialogEvents *iface, IFileDialog *pfd, IShellItem *psiFolder)
Definition: itemdlg.c:165
static ULONG WINAPI IFileDialogEvents_fnRelease(IFileDialogEvents *iface)
Definition: itemdlg.c:147
static HRESULT WINAPI IFileDialogEvents_fnOnTypeChange(IFileDialogEvents *iface, IFileDialog *pfd)
Definition: itemdlg.c:291
static HRESULT WINAPI IFileDialogEvents_fnQueryInterface(IFileDialogEvents *iface, REFIID riid, void **ppv)
Definition: itemdlg.c:134
static HRESULT WINAPI IFileDialogEvents_fnOnShareViolation(IFileDialogEvents *iface, IFileDialog *pfd, IShellItem *psi, FDE_SHAREVIOLATION_RESPONSE *pResponse)
Definition: itemdlg.c:281
static HRESULT WINAPI IFileDialogEvents_fnOnFileOk(IFileDialogEvents *iface, IFileDialog *pfd)
Definition: itemdlg.c:158
static HRESULT WINAPI IFileDialogEvents_fnOnFolderChange(IFileDialogEvents *iface, IFileDialog *pfd)
Definition: itemdlg.c:213

Definition at line 311 of file itemdlg.c.

Referenced by IFileDialogEvents_Constructor().