ReactOS  0.4.14-dev-52-g6116262
filedlg.c File Reference
#include <windows.h>
#include <wine/test.h>
#include "shlguid.h"
#include "shobjidl.h"
#include "commdlg.h"
#include "cderr.h"
#include "dlgs.h"
Include dependency graph for filedlg.c:

Go to the source code of this file.

Classes

struct  ok_wndproc_testcase
 
struct  posz
 

Macros

#define COBJMACROS
 
#define MAXNRCTRLS   30
 
#define TESTRECTS(R1, R2, Mx, My, Sx, Sy)
 

Functions

static void toolbarcheck (HWND hDlg)
 
static UINT_PTR CALLBACK OFNHookProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_DialogCancel (void)
 
static UINT_PTR CALLBACK create_view_window2_hook (HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
static UINT_PTR WINAPI template_hook (HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_create_view_window2 (void)
 
static void test_create_view_template (void)
 
static UINT_PTR WINAPI resize_template_hook (HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_resize (void)
 
static UINT_PTR WINAPI test_ok_wndproc (HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
static UINT_PTR WINAPI ok_template_hook (HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_ok (void)
 
static UINT_PTR WINAPI template_hook_arrange (HWND dlgChild, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_arrange (void)
 
static UINT_PTR CALLBACK path_hook_proc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_getfolderpath (void)
 
static void test_resizable2 (void)
 
static void test_mru (void)
 
static UINT_PTR WINAPI test_extension_wndproc (HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_extension_helper (OPENFILENAMEA *ofn, const char *filter, const char *expected_filename)
 
static void test_extension (void)
 
static BOOL WINAPI test_null_enum (HWND hwnd, LPARAM lParam)
 
static UINT_PTR WINAPI test_null_wndproc (HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_null_filename (void)
 
static void test_directory_filename (void)
 
static UINT_PTR WINAPI test_ole_init_wndproc (HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK hook_proc (int code, WPARAM wp, LPARAM lp)
 
static void test_ole_initialization (void)
 
 START_TEST (filedlg)
 

Variables

static BOOL resizesupported = TRUE
 
struct {
   DWORD   flags
 
   int   resize_folderchange
 
   int   resize_timer1
 
   int   resize_check
 
   BOOL   todo
 
   BOOL   testcontrols
 
resize_testcases []
 
static ok_wndproc_testcase ok_testcases []
 
struct {
   int   nrcontrols
 
   posz   poszDlg
 
   posz   poszStc32
 
   posz   poszBtn
 
   DWORD   ofnflags
 
arrange_tests []
 
static CHAR SYSDIR [MAX_PATH]
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file filedlg.c.

◆ MAXNRCTRLS

#define MAXNRCTRLS   30

◆ TESTRECTS

#define TESTRECTS (   R1,
  R2,
  Mx,
  My,
  Sx,
  Sy 
)
Value:
((R1).left + (Mx) ==(R2).left \
&&(R1).top + (My) ==(R2).top \
&&(R1).right + (Mx) + (Sx) == (R2).right \
&&(R1).bottom + (My) + (Sy) ==(R2).bottom)
#define R2(v, w, x, y, z, i)
Definition: sha1.c:37
GLint GLint bottom
Definition: glext.h:7726
#define R1(v, w, x, y, z, i)
Definition: sha1.c:36
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859

Function Documentation

◆ create_view_window2_hook()

static UINT_PTR CALLBACK create_view_window2_hook ( HWND  dlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 165 of file filedlg.c.

166 {
167  if (msg == WM_NOTIFY)
168  {
169  if (((LPNMHDR)lParam)->code == CDN_FOLDERCHANGE)
170  {
171  IShellBrowser *shell_browser = (IShellBrowser *)SendMessageA(GetParent(dlg), WM_USER + 7 /* WM_GETISHELLBROWSER */, 0, 0);
172  IShellView *shell_view = NULL;
173  IShellView2 *shell_view2 = NULL;
174  SV2CVW2_PARAMS view_params;
175  FOLDERSETTINGS folder_settings;
176  HRESULT hr;
177  RECT rect = {0, 0, 0, 0};
178 
179  hr = IShellBrowser_QueryActiveShellView(shell_browser, &shell_view);
180  ok(SUCCEEDED(hr), "QueryActiveShellView returned %#x\n", hr);
181  if (FAILED(hr)) goto cleanup;
182 
183  hr = IShellView_QueryInterface(shell_view, &IID_IShellView2, (void **)&shell_view2);
184  if (hr == E_NOINTERFACE)
185  {
186  win_skip("IShellView2 not supported\n");
187  goto cleanup;
188  }
189  ok(SUCCEEDED(hr), "QueryInterface returned %#x\n", hr);
190  if (FAILED(hr)) goto cleanup;
191 
192  hr = IShellView2_DestroyViewWindow(shell_view2);
193  ok(SUCCEEDED(hr), "DestroyViewWindow returned %#x\n", hr);
194 
195  folder_settings.ViewMode = FVM_LIST;
196  folder_settings.fFlags = 0;
197 
198  view_params.cbSize = sizeof(view_params);
199  view_params.psvPrev = NULL;
200  view_params.pfs = &folder_settings;
201  view_params.psbOwner = shell_browser;
202  view_params.prcView = &rect;
203  view_params.pvid = NULL;
204  view_params.hwndView = NULL;
205 
206  hr = IShellView2_CreateViewWindow2(shell_view2, &view_params);
207  if (hr == E_FAIL)
208  {
209  win_skip("CreateViewWindow2 is broken on Vista/W2K8\n");
210  goto cleanup;
211  }
212  ok(SUCCEEDED(hr), "CreateViewWindow2 returned %#x\n", hr);
213  if (FAILED(hr)) goto cleanup;
214 
215  hr = IShellView2_GetCurrentInfo(shell_view2, &folder_settings);
216  ok(SUCCEEDED(hr), "GetCurrentInfo returned %#x\n", hr);
217  ok(folder_settings.ViewMode == FVM_LIST,
218  "view mode is %d, expected FVM_LIST\n",
219  folder_settings.ViewMode);
220 
221  hr = IShellView2_DestroyViewWindow(shell_view2);
222  ok(SUCCEEDED(hr), "DestroyViewWindow returned %#x\n", hr);
223 
224  /* XP and W2K3 need this. On W2K the call to DestroyWindow() fails and has
225  * no side effects. NT4 doesn't get here. (FIXME: Vista doesn't get here yet).
226  */
227  DestroyWindow(view_params.hwndView);
228 
229  view_params.pvid = &VID_Details;
230  hr = IShellView2_CreateViewWindow2(shell_view2, &view_params);
231  ok(SUCCEEDED(hr), "CreateViewWindow2 returned %#x\n", hr);
232  if (FAILED(hr)) goto cleanup;
233 
234  hr = IShellView2_GetCurrentInfo(shell_view2, &folder_settings);
235  ok(SUCCEEDED(hr), "GetCurrentInfo returned %#x\n", hr);
236  ok(folder_settings.ViewMode == FVM_DETAILS || broken(folder_settings.ViewMode == FVM_LIST), /* nt4 */
237  "view mode is %d, expected FVM_DETAILS\n",
238  folder_settings.ViewMode);
239 
240 cleanup:
241  if (shell_view2) IShellView2_Release(shell_view2);
242  if (shell_view) IShellView_Release(shell_view);
244  }
245  }
246  return 0;
247 }
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI DestroyWindow(_In_ HWND)
& rect
Definition: startmenu.cpp:1413
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_USER
Definition: winuser.h:1877
#define broken(x)
Definition: _sntprintf.h:21
HWND WINAPI GetParent(_In_ HWND)
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
char * cleanup(char *str)
Definition: wpickclick.c:99
#define IDCANCEL
Definition: winuser.h:825
#define win_skip
Definition: test.h:141
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by test_create_view_window2().

◆ hook_proc()

static LRESULT CALLBACK hook_proc ( int  code,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 1279 of file filedlg.c.

1280 {
1281  static BOOL first_dlg = TRUE;
1282  HRESULT hr;
1283 
1284  if (code == HCBT_CREATEWND)
1285  {
1286  CBT_CREATEWNDW *c = (CBT_CREATEWNDW *)lp;
1287 
1288  if (c->lpcs->lpszClass == (LPWSTR)WC_DIALOG)
1289  {
1290  /* OleInitialize() creates a window for the main apartment. Since
1291  * Vista OleInitialize() is called before the file dialog is
1292  * created. SimCity 2000 expects that the first window created
1293  * after GetOpenFileA() is a file dialog window. Mark Vista+
1294  * behavior as broken. */
1295  hr = OleInitialize(NULL);
1296  ok((first_dlg ? hr == S_OK : hr == S_FALSE)
1297  || broken(first_dlg && hr == S_FALSE),
1298  "OleInitialize() returned %#x (first dialog %#x)\n", hr, first_dlg);
1299  OleUninitialize();
1300  first_dlg = FALSE;
1301  }
1302  }
1303 
1304  return CallNextHookEx(NULL, code, wp, lp);
1305 }
#define TRUE
Definition: types.h:120
#define HCBT_CREATEWND
Definition: winuser.h:58
HRESULT hr
Definition: shlfolder.c:183
#define WC_DIALOG
Definition: undocuser.h:11
unsigned int BOOL
Definition: ntddk_ex.h:94
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
const GLubyte * c
Definition: glext.h:8905
#define broken(x)
Definition: _sntprintf.h:21
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:172
#define S_OK
Definition: intsafe.h:59
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
WCHAR * LPWSTR
Definition: xmlstorage.h:184
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:233

Referenced by test_ole_initialization().

◆ OFNHookProc()

static UINT_PTR CALLBACK OFNHookProc ( HWND  hDlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 64 of file filedlg.c.

65 {
66  LPNMHDR nmh;
67 
68  if( msg == WM_NOTIFY)
69  {
70  nmh = (LPNMHDR) lParam;
71  if( nmh->code == CDN_INITDONE)
72  {
74  } else if (nmh->code == CDN_FOLDERCHANGE )
75  {
76  char buf[1024];
77  int ret;
78 
79  memset(buf, 0x66, sizeof(buf));
81  ok(ret > 0, "CMD_GETFOLDERIDLIST not implemented\n");
82  if (ret > 5)
83  ok(buf[0] == 0x66 && buf[1] == 0x66, "CMD_GETFOLDERIDLIST: The buffer was touched on failure\n");
84  toolbarcheck( GetParent(hDlg));
85  }
86  }
87 
88  return 0;
89 }
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3133
LONG_PTR LPARAM
Definition: windef.h:208
#define CDN_INITDONE
Definition: commdlg.h:33
int ret
#define WM_COMMAND
Definition: winuser.h:1722
HWND WINAPI GetParent(_In_ HWND)
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
static void toolbarcheck(HWND hDlg)
Definition: filedlg.c:40
#define CDM_GETFOLDERIDLIST
Definition: commdlg.h:46
#define IDCANCEL
Definition: winuser.h:825
#define memset(x, y, z)
Definition: compat.h:39
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by test_DialogCancel().

◆ ok_template_hook()

static UINT_PTR WINAPI ok_template_hook ( HWND  dlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 617 of file filedlg.c.

618 {
619  if (msg == WM_SETFONT)
621  return FALSE;
622 }
#define SetWindowLongPtrA
Definition: winuser.h:5246
#define GWLP_WNDPROC
Definition: treelist.c:66
static UINT_PTR WINAPI test_ok_wndproc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:574
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WM_SETFONT
Definition: winuser.h:1632
#define msg(x)
Definition: auth_time.c:54

Referenced by test_ok().

◆ path_hook_proc()

static UINT_PTR CALLBACK path_hook_proc ( HWND  hDlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 866 of file filedlg.c.

867 {
868  LPNMHDR nmh;
869 
870  if( msg == WM_NOTIFY)
871  {
872  nmh = (LPNMHDR) lParam;
873  if( nmh->code == CDN_INITDONE)
874  {
876  }
877  else if ( nmh->code == CDN_FOLDERCHANGE)
878  {
879  char buf[1024];
880  int ret;
881 
882  memset(buf, 0x66, sizeof(buf));
883  ret = SendMessageA( GetParent(hDlg), CDM_GETFOLDERPATH, sizeof(buf), (LPARAM)buf);
884  ok(!lstrcmpiA(SYSDIR, buf), "Expected '%s', got '%s'\n", SYSDIR, buf);
885  ok(lstrlenA(SYSDIR) + 1 == ret, "Expected %d, got %d\n", lstrlenA(SYSDIR) + 1, ret);
886  }
887  }
888 
889  return 0;
890 }
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static CHAR SYSDIR[MAX_PATH]
Definition: filedlg.c:864
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3133
#define CDM_GETFOLDERPATH
Definition: commdlg.h:45
LONG_PTR LPARAM
Definition: windef.h:208
#define CDN_INITDONE
Definition: commdlg.h:33
int ret
#define WM_COMMAND
Definition: winuser.h:1722
HWND WINAPI GetParent(_In_ HWND)
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
#define IDCANCEL
Definition: winuser.h:825
#define memset(x, y, z)
Definition: compat.h:39
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by test_getfolderpath().

◆ resize_template_hook()

static UINT_PTR WINAPI resize_template_hook ( HWND  dlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 328 of file filedlg.c.

329 {
330  static RECT initrc, rc;
331  static int index, count;
332  static BOOL gotSWP_bottom, gotShowWindow;
333  HWND parent = GetParent( dlg);
334  int resize;
335 #define MAXNRCTRLS 30
336  static RECT ctrlrcs[MAXNRCTRLS];
337  static int ctrlids[MAXNRCTRLS];
338  static HWND ctrls[MAXNRCTRLS];
339  static int nrctrls;
340 
341  switch( msg)
342  {
343  case WM_INITDIALOG:
344  {
345  DWORD style;
346 
347  index = ((OPENFILENAMEA*)lParam)->lCustData;
348  count = 0;
349  gotSWP_bottom = gotShowWindow = FALSE;
350  /* test style */
353  if( !(style & WS_SIZEBOX)) {
354  win_skip( "OFN_ENABLESIZING flag not supported.\n");
357  } else
358  ok( style & WS_SIZEBOX,
359  "testid %d: dialog should have a WS_SIZEBOX style.\n", index);
360  else
361  ok( !(style & WS_SIZEBOX),
362  "testid %d: dialog should not have a WS_SIZEBOX style.\n", index);
363  break;
364  }
365  case WM_NOTIFY:
366  {
367  if(( (LPNMHDR)lParam)->code == CDN_FOLDERCHANGE){
368  GetWindowRect( parent, &initrc);
369  if( (resize = resize_testcases[index].resize_folderchange)){
370  MoveWindow( parent, initrc.left,initrc.top, initrc.right - initrc.left + resize,
371  initrc.bottom - initrc.top + resize, TRUE);
372  }
373  SetTimer( dlg, 0, 100, 0);
374  }
375  break;
376  }
377  case WM_TIMER:
378  {
379  if( count == 0){
380  /* store the control rectangles */
382  HWND ctrl;
383  int i;
384  for( i = 0, ctrl = GetWindow( parent, GW_CHILD);
385  i < MAXNRCTRLS && ctrl;
386  i++, ctrl = GetWindow( ctrl, GW_HWNDNEXT)) {
387  ctrlids[i] = GetDlgCtrlID( ctrl);
388  GetWindowRect( ctrl, &ctrlrcs[i]);
389  MapWindowPoints( NULL, parent, (LPPOINT) &ctrlrcs[i], 2);
390  ctrls[i] = ctrl;
391  }
392  nrctrls = i;
393  }
394  if( (resize = resize_testcases[index].resize_timer1)){
395  GetWindowRect( parent, &rc);
396  MoveWindow( parent, rc.left,rc.top, rc.right - rc.left + resize,
397  rc.bottom - rc.top + resize, TRUE);
398  }
399  } else if( count == 1){
400  resize = resize_testcases[index].resize_check;
401  GetWindowRect( parent, &rc);
403  ok( resize == rc.right - rc.left - initrc.right + initrc.left,
404  "testid %d size-x change %d expected %d\n", index,
405  rc.right - rc.left - initrc.right + initrc.left, resize);
406  ok( resize == rc.bottom - rc.top - initrc.bottom + initrc.top,
407  "testid %d size-y change %d expected %d\n", index,
408  rc.bottom - rc.top - initrc.bottom + initrc.top, resize);
409  }
411  int i;
412  RECT rc;
413  for( i = 0; i < nrctrls; i++) {
414  GetWindowRect( ctrls[i], &rc);
415  MapWindowPoints( NULL, parent, (LPPOINT) &rc, 2);
416  switch( ctrlids[i]){
417 
418 /* test if RECT R1, moved and sized result in R2 */
419 #define TESTRECTS( R1, R2, Mx, My, Sx, Sy) \
420  ((R1).left + (Mx) ==(R2).left \
421  &&(R1).top + (My) ==(R2).top \
422  &&(R1).right + (Mx) + (Sx) == (R2).right \
423  &&(R1).bottom + (My) + (Sy) ==(R2).bottom)
424 
425  /* sized horizontal and moved vertical */
426  case cmb1:
427  case edt1:
428  ok( TESTRECTS( ctrlrcs[i], rc, 0, 10, 10, 0),
429  "control id %03x should have sized horizontally and moved vertically, before %s after %s\n",
430  ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ),
431  wine_dbgstr_rect( &rc ));
432  break;
433  /* sized horizontal and vertical */
434  case lst2:
435  ok( TESTRECTS( ctrlrcs[i], rc, 0, 0, 10, 10),
436  "control id %03x should have sized horizontally and vertically, before %s after %s\n",
437  ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ),
438  wine_dbgstr_rect( &rc ));
439  break;
440  /* moved horizontal and vertical */
441  case IDCANCEL:
442  case pshHelp:
443  ok( TESTRECTS( ctrlrcs[i], rc, 10, 10, 0, 0),
444  "control id %03x should have moved horizontally and vertically, before %s after %s\n",
445  ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ),
446  wine_dbgstr_rect( &rc ));
447  break;
448  /* moved vertically */
449  case chx1:
450  case stc2:
451  case stc3:
452  ok( TESTRECTS( ctrlrcs[i], rc, 0, 10, 0, 0),
453  "control id %03x should have moved vertically, before %s after %s\n",
454  ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ),
455  wine_dbgstr_rect( &rc ));
456  break;
457  /* resized horizontal */
458  case cmb2: /* aka IDC_LOOKIN */
459  ok( TESTRECTS( ctrlrcs[i], rc, 0, 0, 10, 0)||
460  TESTRECTS( ctrlrcs[i], rc, 0, 0, 0, 0), /* Vista and higher */
461  "control id %03x should have resized horizontally, before %s after %s\n",
462  ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ),
463  wine_dbgstr_rect( &rc ));
464  break;
465  /* non moving non sizing controls */
466  case stc4:
467  ok( TESTRECTS( rc, ctrlrcs[i], 0, 0, 0, 0),
468  "control id %03x was moved/resized, before %s after %s\n",
469  ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ),
470  wine_dbgstr_rect( &rc ));
471  break;
472  /* todo_wine: non moving non sizing controls */
473  case lst1:
474 todo_wine
475  ok( TESTRECTS( rc, ctrlrcs[i], 0, 0, 0, 0),
476  "control id %03x was moved/resized, before %s after %s\n",
477  ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ),
478  wine_dbgstr_rect( &rc ));
479  break;
480  /* don't test: id is not unique */
481  case IDOK:
482  case stc1:
483  case 0:
484  case -1:
485  break;
486  default:
487  trace("untested control id %03x before %s after %s\n",
488  ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ),
489  wine_dbgstr_rect( &rc ));
490 #undef TESTRECTS
491 #undef MAXNRCTRLS
492  }
493  }
494  }
495  KillTimer( dlg, 0);
497  }
498  count++;
499  }
500  break;
502  {
503  WINDOWPOS *pwp = (WINDOWPOS *)lParam;
504  if( !index && pwp->hwndInsertAfter == HWND_BOTTOM){
505  gotSWP_bottom = TRUE;
506  ok(!gotShowWindow, "The WM_WINDOWPOSCHANGING message came after a WM_SHOWWINDOW message\n");
507  }
508  }
509  break;
510  case WM_SHOWWINDOW:
511  {
512  if( !index){
513  gotShowWindow = TRUE;
514  ok(gotSWP_bottom, "No WM_WINDOWPOSCHANGING message came before a WM_SHOWWINDOW message\n");
515  }
516  }
517  break;
518  }
519  return 0;
520 }
#define GW_HWNDNEXT
Definition: winuser.h:756
#define TESTRECTS(R1, R2, Mx, My, Sx, Sy)
static BOOL resizesupported
Definition: filedlg.c:38
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define GW_CHILD
Definition: winuser.h:758
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint GLuint GLsizei count
Definition: gl.h:1545
static const struct @1589 resize_testcases[]
BOOL todo
Definition: filedlg.c:313
LONG top
Definition: windef.h:292
int resize_timer1
Definition: filedlg.c:311
#define WM_SHOWWINDOW
Definition: winuser.h:1610
HWND hwndInsertAfter
Definition: winuser.h:3563
#define stc2
Definition: dlgs.h:161
#define WS_SIZEBOX
Definition: pedump.c:642
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
int WINAPI GetDlgCtrlID(_In_ HWND)
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
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define chx1
Definition: dlgs.h:31
unsigned int BOOL
Definition: ntddk_ex.h:94
#define stc3
Definition: dlgs.h:162
smooth NULL
Definition: ftsmooth.c:416
#define stc4
Definition: dlgs.h:163
GLuint index
Definition: glext.h:6031
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define ctrl
Definition: input.c:1669
#define todo_wine_if(is_todo)
Definition: test.h:155
#define HWND_BOTTOM
Definition: winuser.h:1191
#define trace
Definition: atltest.h:70
r parent
Definition: btrfs.c:2897
#define WM_TIMER
Definition: winuser.h:1724
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
const char * wine_dbgstr_rect(const RECT *rect)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
#define edt1
Definition: dlgs.h:65
int resize_folderchange
Definition: filedlg.c:310
#define lst1
Definition: dlgs.h:95
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define index(s, c)
Definition: various.h:29
#define todo_wine
Definition: test.h:154
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define GWL_STYLE
Definition: winuser.h:846
#define cmb2
Definition: dlgs.h:49
HWND WINAPI GetParent(_In_ HWND)
#define lst2
Definition: dlgs.h:96
#define ok(value,...)
Definition: atltest.h:57
#define pshHelp
Definition: dlgs.h:127
#define stc1
Definition: dlgs.h:160
#define msg(x)
Definition: auth_time.c:54
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL testcontrols
Definition: filedlg.c:314
#define IDCANCEL
Definition: winuser.h:825
Arabic default style
Definition: afstyles.h:93
#define OFN_ENABLESIZING
Definition: commdlg.h:101
#define cmb1
Definition: dlgs.h:48
#define win_skip
Definition: test.h:141
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61
#define MAXNRCTRLS

Referenced by test_resize().

◆ START_TEST()

START_TEST ( filedlg  )

Definition at line 1333 of file filedlg.c.

1334 {
1338  test_arrange();
1339  test_resize();
1340  test_ok();
1342  test_mru();
1344  test_extension();
1348 }
static void test_ok(void)
Definition: filedlg.c:624
static BOOL resizesupported
Definition: filedlg.c:38
static void test_arrange(void)
Definition: filedlg.c:787
static void test_resize(void)
Definition: filedlg.c:522
static void test_mru(void)
Definition: filedlg.c:969
static void test_DialogCancel(void)
Definition: filedlg.c:92
static void test_create_view_window2(void)
Definition: filedlg.c:270
static void test_ole_initialization(void)
Definition: filedlg.c:1307
static void test_resizable2(void)
Definition: filedlg.c:928
static void test_getfolderpath(void)
Definition: filedlg.c:892
static void test_null_filename(void)
Definition: filedlg.c:1156
static void test_extension(void)
Definition: filedlg.c:1054
static void test_create_view_template(void)
Definition: filedlg.c:287
static void test_directory_filename(void)
Definition: filedlg.c:1226

◆ template_hook()

static UINT_PTR WINAPI template_hook ( HWND  dlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 249 of file filedlg.c.

250 {
251  if (msg == WM_INITDIALOG)
252  {
253  HWND p,cb;
254  INT sel;
255  p = GetParent(dlg);
256  ok(p!=NULL, "Failed to get parent of template\n");
257  cb = GetDlgItem(p,0x470);
258  ok(cb!=NULL, "Failed to get filter combobox\n");
259  sel = SendMessageA(cb, CB_GETCURSEL, 0, 0);
260  ok (sel != -1, "Failed to get selection from filter listbox\n");
261  }
262  if (msg == WM_NOTIFY)
263  {
264  if (((LPNMHDR)lParam)->code == CDN_FOLDERCHANGE)
266  }
267  return 0;
268 }
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int32_t INT
Definition: typedefs.h:56
#define CB_GETCURSEL
Definition: winuser.h:1925
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static DWORD cb
Definition: integrity.c:41
#define WM_COMMAND
Definition: winuser.h:1722
HWND WINAPI GetParent(_In_ HWND)
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
GLfloat GLfloat p
Definition: glext.h:8902
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by test_create_view_template().

◆ template_hook_arrange()

static UINT_PTR WINAPI template_hook_arrange ( HWND  dlgChild,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 697 of file filedlg.c.

698 {
699  static int index, fixhelp;
700  static posz posz0[2];
701  static RECT clrcParent, clrcChild, rcStc32;
702  static HWND hwndStc32;
703  HWND dlgParent;
704 
705  dlgParent = GetParent( dlgChild);
706  if (msg == WM_INITDIALOG) {
707  index = ((OPENFILENAMEA*)lParam)->lCustData;
708  /* get the positions before rearrangement */
709  GetClientRect( dlgParent, &clrcParent);
710  GetClientRect( dlgChild, &clrcChild);
711  hwndStc32 = GetDlgItem( dlgChild, stc32);
712  if( hwndStc32) GetWindowRect( hwndStc32, &rcStc32);
713  }
714  if (msg == WM_NOTIFY && ((LPNMHDR)lParam)->code == CDN_FOLDERCHANGE) {
715  RECT wrcParent;
716 
717  GetWindowRect( dlgParent, &wrcParent);
718  /* the fist two "tests" just save the dialogs position, with and without
719  * help button */
720  if( index == 0) {
721  posz0[0].x = wrcParent.left;
722  posz0[0].y = wrcParent.top;
723  posz0[0].cx = wrcParent.right - wrcParent.left;
724  posz0[0].cy = wrcParent.bottom - wrcParent.top;
725  } else if( index == 1) {
726  posz0[1].x = wrcParent.left;
727  posz0[1].y = wrcParent.top;
728  posz0[1].cx = wrcParent.right - wrcParent.left;
729  posz0[1].cy = wrcParent.bottom - wrcParent.top;
730  fixhelp = posz0[1].cy - posz0[0].cy;
731  } else {
732  /* the real tests */
733  int withhelp;
734  int expectx, expecty;
735  DWORD style;
736 
737  withhelp = (arrange_tests[index].ofnflags & OFN_SHOWHELP) != 0;
738  GetWindowRect( dlgParent, &wrcParent);
739  if( !hwndStc32) {
740  /* case with no custom subitem with stc32:
741  * default to all custom controls below the standard */
742  expecty = posz0[withhelp].cy + clrcChild.bottom;
743  expectx = posz0[withhelp].cx;
744  } else {
745  /* special case: there is a control with id stc32 */
746  /* expected height */
747  expecty = posz0[withhelp].cy;
748  if( rcStc32.bottom - rcStc32.top + (withhelp ? 0 : fixhelp) > clrcParent.bottom) {
749  expecty += clrcChild.bottom - clrcParent.bottom;
750  if( !withhelp) expecty += fixhelp;
751  }
752  else
753  expecty += clrcChild.bottom - ( rcStc32.bottom - rcStc32.top) ;
754  /* expected width */
755  expectx = posz0[withhelp].cx;
756  if( rcStc32.right - rcStc32.left > clrcParent.right) {
757  expectx += clrcChild.right - clrcParent.right;
758  }
759  else
760  expectx += clrcChild.right - ( rcStc32.right - rcStc32.left) ;
761  }
762  style = GetWindowLongA( dlgParent, GWL_STYLE);
763  if( !(style & WS_SIZEBOX)) {
764  /* without the OFN_ENABLESIZING flag */
765  ok( wrcParent.bottom - wrcParent.top == expecty,
766  "Wrong height of dialog %d, expected %d\n",
767  wrcParent.bottom - wrcParent.top, expecty);
768  ok( wrcParent.right - wrcParent.left == expectx,
769  "Wrong width of dialog %d, expected %d\n",
770  wrcParent.right - wrcParent.left, expectx);
771  } else {
772  /* with the OFN_ENABLESIZING flag */
773  ok( wrcParent.bottom - wrcParent.top > expecty,
774  "Wrong height of dialog %d, expected more than %d\n",
775  wrcParent.bottom - wrcParent.top, expecty);
776  ok( wrcParent.right - wrcParent.left > expectx,
777  "Wrong width of dialog %d, expected more than %d\n",
778  wrcParent.right - wrcParent.left, expectx);
779  }
780 
781  }
782  PostMessageA( dlgParent, WM_COMMAND, IDCANCEL, 0);
783  }
784  return 0;
785 }
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
int y
Definition: filedlg.c:665
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG top
Definition: windef.h:292
#define WS_SIZEBOX
Definition: pedump.c:642
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
Definition: filedlg.c:664
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
GLuint index
Definition: glext.h:6031
int cx
Definition: filedlg.c:666
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
#define WM_COMMAND
Definition: winuser.h:1722
#define GWL_STYLE
Definition: winuser.h:846
int x
Definition: filedlg.c:665
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
static struct @1590 arrange_tests[]
#define ok(value,...)
Definition: atltest.h:57
#define stc32
Definition: dlgs.h:191
#define msg(x)
Definition: auth_time.c:54
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define IDCANCEL
Definition: winuser.h:825
int cy
Definition: filedlg.c:666
Arabic default style
Definition: afstyles.h:93
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61
#define OFN_SHOWHELP
Definition: commdlg.h:120

Referenced by test_arrange().

◆ test_arrange()

static void test_arrange ( void  )
static

Definition at line 787 of file filedlg.c.

788 {
789  OPENFILENAMEA ofn = {0};
790  char filename[1024] = {0};
791  DWORD ret;
792  HRSRC hRes;
793  HANDLE hDlgTmpl;
794  LPBYTE pv;
795  DLGTEMPLATE *template;
796  DLGITEMTEMPLATE *itemtemplateStc32, *itemtemplateBtn;
797  int i;
798 
799  /* load subdialog template into memory */
800  hRes = FindResourceA( GetModuleHandleA(NULL), "template_stc32", (LPSTR)RT_DIALOG);
801  hDlgTmpl = LoadResource( GetModuleHandleA(NULL), hRes );
802  /* get pointers to the structures for the dialog and the controls */
803  pv = LockResource( hDlgTmpl );
804  template = (DLGTEMPLATE*)pv;
805  if( template->x != 11111) {
806  win_skip("could not find the dialog template\n");
807  return;
808  }
809  /* skip dialog template, menu, class and title */
810  pv += sizeof(DLGTEMPLATE);
811  pv += 3 * sizeof(WORD);
812  /* skip font info */
813  while( *(WORD*)pv)
814  pv += sizeof(WORD);
815  pv += sizeof(WORD);
816  /* align on 32 bit boundaries */
817  pv = (LPBYTE)(((UINT_PTR)pv + 3 ) & ~3);
818  itemtemplateStc32 = (DLGITEMTEMPLATE*)pv;
819  if( itemtemplateStc32->x != 22222) {
820  win_skip("could not find the first item template\n");
821  return;
822  }
823  /* skip itemtemplate, class, title and creation data */
824  pv += sizeof(DLGITEMTEMPLATE);
825  pv += 4 * sizeof(WORD);
826  /* align on 32 bit boundaries */
827  pv = (LPBYTE)(((UINT_PTR)pv + 3 ) & ~3);
828  itemtemplateBtn = (DLGITEMTEMPLATE*)pv;
829  if( itemtemplateBtn->x != 12345) {
830  win_skip("could not find the second item template\n");
831  return;
832  }
833 
836  ofn.nMaxFile = 1024;
838  ofn.hInstance = hDlgTmpl;
839  ofn.lpstrFilter="text\0*.txt\0All\0*\0\0";
840  for( i = 0; arrange_tests[i].nrcontrols != -1; i++) {
841  ofn.lCustData = i;
843  arrange_tests[i].ofnflags;
844  template->cdit = arrange_tests[i].nrcontrols;
845  template->x = arrange_tests[i].poszDlg.x;
846  template->y = arrange_tests[i].poszDlg.y;
847  template->cx = arrange_tests[i].poszDlg.cx;
848  template->cy = arrange_tests[i].poszDlg.cy;
849  itemtemplateStc32->x = arrange_tests[i].poszStc32.x;
850  itemtemplateStc32->y = arrange_tests[i].poszStc32.y;
851  itemtemplateStc32->cx = arrange_tests[i].poszStc32.cx;
852  itemtemplateStc32->cy = arrange_tests[i].poszStc32.cy;
853  itemtemplateBtn->x = arrange_tests[i].poszBtn.x;
854  itemtemplateBtn->y = arrange_tests[i].poszBtn.y;
855  itemtemplateBtn->cx = arrange_tests[i].poszBtn.cx;
856  itemtemplateBtn->cy = arrange_tests[i].poszBtn.cy;
858  ok(!ret, "GetOpenFileNameA returned %#x\n", ret);
860  ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
861  }
862 }
#define OFN_EXPLORER
Definition: commdlg.h:104
LPARAM lCustData
Definition: commdlg.h:346
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
OPENFILENAME ofn
Definition: main.cpp:37
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
char * LPSTR
Definition: xmlstorage.h:182
const char * filename
Definition: ioapi.h:135
DWORD nMaxFile
Definition: commdlg.h:337
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 char * LPBYTE
Definition: typedefs.h:52
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
static UINT_PTR WINAPI template_hook_arrange(HWND dlgChild, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:697
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
HINSTANCE hInstance
Definition: commdlg.h:331
#define RT_DIALOG
Definition: pedump.c:367
DWORD lStructSize
Definition: commdlg.h:329
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
static struct @1590 arrange_tests[]
LPSTR lpstrFile
Definition: commdlg.h:336
#define OFN_ENABLETEMPLATEHANDLE
Definition: commdlg.h:103
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
LPCSTR lpstrFilter
Definition: commdlg.h:332
const UINT template
Definition: action.c:7785
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
#define win_skip
Definition: test.h:141
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ test_create_view_template()

static void test_create_view_template ( void  )
static

Definition at line 287 of file filedlg.c.

288 {
289  OPENFILENAMEA ofn = {0};
290  char filename[1024] = {0};
291  DWORD ret;
292 
295  ofn.nMaxFile = 1024;
299  ofn.lpTemplateName = "template1";
300  ofn.lpstrFilter="text\0*.txt\0All\0*\0\0";
302  ok(!ret, "GetOpenFileNameA returned %#x\n", ret);
304  ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
305 }
#define OFN_EXPLORER
Definition: commdlg.h:104
OPENFILENAME ofn
Definition: main.cpp:37
LPCSTR lpTemplateName
Definition: commdlg.h:348
const char * filename
Definition: ioapi.h:135
DWORD nMaxFile
Definition: commdlg.h:337
static UINT_PTR WINAPI template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:249
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
smooth NULL
Definition: ftsmooth.c:416
HINSTANCE hInstance
Definition: commdlg.h:331
DWORD lStructSize
Definition: commdlg.h:329
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
LPSTR lpstrFile
Definition: commdlg.h:336
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ test_create_view_window2()

static void test_create_view_window2 ( void  )
static

Definition at line 270 of file filedlg.c.

271 {
272  OPENFILENAMEA ofn = {0};
273  char filename[1024] = {0};
274  DWORD ret;
275 
278  ofn.nMaxFile = 1024;
282  ok(!ret, "GetOpenFileNameA returned %#x\n", ret);
284  ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
285 }
#define OFN_EXPLORER
Definition: commdlg.h:104
OPENFILENAME ofn
Definition: main.cpp:37
const char * filename
Definition: ioapi.h:135
DWORD nMaxFile
Definition: commdlg.h:337
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
static UINT_PTR CALLBACK create_view_window2_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:165
DWORD lStructSize
Definition: commdlg.h:329
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
LPSTR lpstrFile
Definition: commdlg.h:336
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ test_DialogCancel()

static void test_DialogCancel ( void  )
static

Definition at line 92 of file filedlg.c.

93 {
95  BOOL result;
96  char szFileName[MAX_PATH] = "";
97  char szInitialDir[MAX_PATH];
98 
99  GetWindowsDirectoryA(szInitialDir, MAX_PATH);
100 
101  ZeroMemory(&ofn, sizeof(ofn));
102 
104  ofn.hwndOwner = NULL;
105  ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
106  ofn.lpstrFile = szFileName;
109  ofn.lpstrDefExt = "txt";
111  ofn.lpstrInitialDir = szInitialDir;
112 
113  PrintDlgA(NULL);
115  "expected CDERR_INITIALIZATION, got %d\n", CommDlgExtendedError());
116 
118  ok(FALSE == result, "expected FALSE, got %d\n", result);
119  ok(0 == CommDlgExtendedError(), "expected 0, got %d\n",
121 
122  PrintDlgA(NULL);
124  "expected CDERR_INITIALIZATION, got %d\n", CommDlgExtendedError());
125 
127  ok(FALSE == result, "expected FALSE, got %d\n", result);
128  ok(0 == CommDlgExtendedError(), "expected 0, got %d\n",
130 
131  PrintDlgA(NULL);
133  "expected CDERR_INITIALIZATION, got %d\n", CommDlgExtendedError());
134 
135  /* Before passing the ofn to Unicode functions, remove the ANSI strings */
136  ofn.lpstrFilter = NULL;
138  ofn.lpstrDefExt = NULL;
139 
140  PrintDlgA(NULL);
142  "expected CDERR_INITIALIZATION, got %d\n", CommDlgExtendedError());
143 
144  SetLastError(0xdeadbeef);
147  win_skip("GetOpenFileNameW is not implemented\n");
148  else
149  {
150  ok(FALSE == result, "expected FALSE, got %d\n", result);
151  ok(0 == CommDlgExtendedError(), "expected 0, got %d\n", CommDlgExtendedError());
152  }
153 
154  SetLastError(0xdeadbeef);
157  win_skip("GetSaveFileNameW is not implemented\n");
158  else
159  {
160  ok(FALSE == result, "expected FALSE, got %d\n", result);
161  ok(0 == CommDlgExtendedError(), "expected 0, got %d\n", CommDlgExtendedError());
162  }
163 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
HWND hwndOwner
Definition: commdlg.h:330
OPENFILENAME ofn
Definition: main.cpp:37
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
LPCSTR lpstrDefExt
Definition: commdlg.h:345
BOOL WINAPI GetSaveFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4600
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn)
Definition: filedlg.c:4629
DWORD nMaxFile
Definition: commdlg.h:337
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4564
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd)
Definition: printdlg.c:2240
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
#define CDERR_INITIALIZATION
Definition: cderr.h:7
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
#define SetLastError(x)
Definition: compat.h:409
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
LPSTR lpstrFile
Definition: commdlg.h:336
#define ok(value,...)
Definition: atltest.h:57
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2336
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
static UINT_PTR CALLBACK OFNHookProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:64
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
GLuint64EXT * result
Definition: glext.h:11304
#define win_skip
Definition: test.h:141
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ test_directory_filename()

static void test_directory_filename ( void  )
static

Definition at line 1226 of file filedlg.c.

1227 {
1228  OPENFILENAMEA ofnA = {0};
1229  OPENFILENAMEW ofnW = {0};
1230  WCHAR filterW[] = {'t','e','x','t','\0','*','.','t','x','t','\0',
1231  'A','l','l','\0','*','\0','\0'};
1232  char szInitialDir[MAX_PATH] = {0};
1233  WCHAR szInitialDirW[MAX_PATH] = {0};
1234  DWORD ret;
1235 
1236  GetWindowsDirectoryA(szInitialDir, MAX_PATH);
1237  GetWindowsDirectoryW(szInitialDirW, MAX_PATH);
1238 
1239  szInitialDir[strlen(szInitialDir)] = '\\';
1240  szInitialDirW[lstrlenW(szInitialDirW)] = '\\';
1241 
1243  ofnA.lpstrFile = szInitialDir;
1244  ofnA.nMaxFile = MAX_PATH;
1245  ofnA.lpfnHook = test_null_wndproc;
1248  ofnA.lpstrFilter = "text\0*.txt\0All\0*\0\0";
1249  ofnA.lpstrDefExt = NULL;
1250  ret = GetOpenFileNameA(&ofnA);
1251  todo_wine ok(!ret, "GetOpenFileNameA returned %#x\n", ret);
1252 
1253  /* unicode tests */
1255  ofnW.lpstrFile = szInitialDirW;
1256  ofnW.nMaxFile = MAX_PATH;
1257  ofnW.lpfnHook = test_null_wndproc;
1260  ofnW.lpstrFilter = filterW;
1261  ofnW.lpstrDefExt = NULL;
1262  ret = GetOpenFileNameW(&ofnW);
1263  todo_wine ok(!ret, "GetOpenFileNameW returned %#x\n", ret);
1264 }
#define OFN_EXPLORER
Definition: commdlg.h:104
HINSTANCE hInstance
Definition: commdlg.h:362
DWORD Flags
Definition: commdlg.h:373
LPCWSTR lpstrFilter
Definition: commdlg.h:363
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LPWSTR lpstrFile
Definition: commdlg.h:367
LPCSTR lpstrDefExt
Definition: commdlg.h:345
#define lstrlenW
Definition: compat.h:407
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
DWORD lStructSize
Definition: commdlg.h:360
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
DWORD nMaxFile
Definition: commdlg.h:337
LPCWSTR lpstrDefExt
Definition: commdlg.h:376
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4564
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
smooth NULL
Definition: ftsmooth.c:416
HINSTANCE hInstance
Definition: commdlg.h:331
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD nMaxFile
Definition: commdlg.h:368
int ret
#define todo_wine
Definition: test.h:154
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define OPENFILENAME_SIZE_VERSION_400W
Definition: commdlg.h:397
LPSTR lpstrFile
Definition: commdlg.h:336
#define ok(value,...)
Definition: atltest.h:57
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2336
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
LPCSTR lpstrFilter
Definition: commdlg.h:332
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:847
static UINT_PTR WINAPI test_null_wndproc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:1136
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ test_extension()

static void test_extension ( void  )
static

Definition at line 1054 of file filedlg.c.

1055 {
1057  char filename[1024] = {0};
1058  char curdir[MAX_PATH];
1059  unsigned int i;
1060  BOOL boolret;
1061 
1062  const char *defext_concrete_filters[] = {
1063  "TestFilter (*.abc)\0*.abc\0",
1064  "TestFilter (*.abc;)\0*.abc;\0",
1065  "TestFilter (*.abc;*.def)\0*.abc;*.def\0",
1066  };
1067 
1068  const char *defext_wildcard_filters[] = {
1069  "TestFilter (*.pt*)\0*.pt*\0",
1070  "TestFilter (*.pt*;*.abc)\0*.pt*;*.abc\0",
1071  "TestFilter (*.ab?)\0*.ab?\0",
1072  "TestFilter (*.*)\0*.*\0",
1073  "TestFilter (*sav)\0*sav\0",
1074  NULL /* is a test, not an endmark! */
1075  };
1076 
1077  boolret = GetCurrentDirectoryA(sizeof(curdir), curdir);
1078  ok(boolret, "Failed to get current dir err %d\n", GetLastError());
1079 
1080  ofn.hwndOwner = NULL;
1082  ofn.nMaxFile = MAX_PATH;
1084  ofn.lpstrInitialDir = curdir;
1086  ofn.nFileExtension = 0;
1087 
1088  ofn.lpstrDefExt = NULL;
1089 
1090  /* Without lpstrDefExt, append no extension */
1091  test_extension_helper(&ofn, "TestFilter (*.abc) lpstrDefExt=NULL\0*.abc\0", "deadbeef");
1092  test_extension_helper(&ofn, "TestFilter (*.ab?) lpstrDefExt=NULL\0*.ab?\0", "deadbeef");
1093 
1094  ofn.lpstrDefExt = "";
1095 
1096  /* If lpstrDefExt="" and the filter has a concrete extension, append it */
1097  test_extension_helper(&ofn, "TestFilter (*.abc) lpstrDefExt=\"\"\0*.abc\0", "deadbeef.abc");
1098 
1099  /* If lpstrDefExt="" and the filter has a wildcard extension, do nothing */
1100  test_extension_helper(&ofn, "TestFilter (*.ab?) lpstrDefExt=\"\"\0*.ab?\0", "deadbeef");
1101 
1102  ofn.lpstrDefExt = "xyz";
1103 
1104  /* Append concrete extensions from filters */
1105  for (i = 0; i < ARRAY_SIZE(defext_concrete_filters); i++) {
1106  test_extension_helper(&ofn, defext_concrete_filters[i], "deadbeef.abc");
1107  }
1108 
1109  /* Append nothing from this filter */
1110  test_extension_helper(&ofn, "TestFilter (*.)\0*.\0", "deadbeef");
1111 
1112  /* Ignore wildcard extensions in filters */
1113  for (i = 0; i < ARRAY_SIZE(defext_wildcard_filters); i++) {
1114  test_extension_helper(&ofn, defext_wildcard_filters[i], "deadbeef.xyz");
1115  }
1116 
1117  /* Append valid extensions consisting of multiple parts */
1118  test_extension_helper(&ofn, "TestFilter (*.abc.def)\0*.abc.def\0", "deadbeef.abc.def");
1119  test_extension_helper(&ofn, "TestFilter (.abc.def)\0.abc.def\0", "deadbeef.abc.def");
1120  test_extension_helper(&ofn, "TestFilter (*.*.def)\0*.*.def\0", "deadbeef.xyz");
1121 }
#define OFN_EXPLORER
Definition: commdlg.h:104
WORD nFileExtension
Definition: commdlg.h:344
HWND hwndOwner
Definition: commdlg.h:330
OPENFILENAME ofn
Definition: main.cpp:37
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LPCSTR lpstrDefExt
Definition: commdlg.h:345
const char * filename
Definition: ioapi.h:135
DWORD nMaxFile
Definition: commdlg.h:337
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
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
unsigned int BOOL
Definition: ntddk_ex.h:94
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
smooth NULL
Definition: ftsmooth.c:416
static void test_extension_helper(OPENFILENAMEA *ofn, const char *filter, const char *expected_filename)
Definition: filedlg.c:1033
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
#define MAX_PATH
Definition: compat.h:26
static UINT_PTR WINAPI test_extension_wndproc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:1018
LPSTR lpstrFile
Definition: commdlg.h:336
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ test_extension_helper()

static void test_extension_helper ( OPENFILENAMEA ofn,
const char filter,
const char expected_filename 
)
static

Definition at line 1033 of file filedlg.c.

1035 {
1036  char *filename_ptr;
1037  DWORD ret;
1038  BOOL boolret;
1039 
1040  strcpy(ofn->lpstrFile, "deadbeef");
1041  ofn->lpstrFilter = filter;
1042 
1043  boolret = GetSaveFileNameA(ofn);
1044  ok(boolret, "%s: expected TRUE\n", filter);
1045 
1047  ok(!ret, "%s: CommDlgExtendedError returned %#x\n", filter, ret);
1048 
1049  filename_ptr = ofn->lpstrFile + ofn->nFileOffset;
1050  ok(strcmp(filename_ptr, expected_filename) == 0,
1051  "%s: Filename is %s, expected %s\n", filter, filename_ptr, expected_filename);
1052 }
OPENFILENAME ofn
Definition: main.cpp:37
BOOL WINAPI GetSaveFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4600
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
LPSTR lpstrFile
Definition: commdlg.h:336
#define ok(value,...)
Definition: atltest.h:57
LPCSTR lpstrFilter
Definition: commdlg.h:332
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
WORD nFileOffset
Definition: commdlg.h:343

Referenced by test_extension().

◆ test_extension_wndproc()

static UINT_PTR WINAPI test_extension_wndproc ( HWND  dlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1018 of file filedlg.c.

1019 {
1020  HWND parent = GetParent( dlg);
1021  if( msg == WM_NOTIFY) {
1022  SetTimer( dlg, 0, 1000, 0);
1024  }
1025  if( msg == WM_TIMER) {
1026  /* the dialog did not close automatically */
1027  KillTimer( dlg, 0);
1029  }
1030  return FALSE;
1031 }
#define IDOK
Definition: winuser.h:824
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
r parent
Definition: btrfs.c:2897
#define WM_TIMER
Definition: winuser.h:1724
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define WM_COMMAND
Definition: winuser.h:1722
HWND WINAPI GetParent(_In_ HWND)
#define msg(x)
Definition: auth_time.c:54
#define IDCANCEL
Definition: winuser.h:825
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by test_extension().

◆ test_getfolderpath()

static void test_getfolderpath ( void  )
static

Definition at line 892 of file filedlg.c.

893 {
895  BOOL result;
896  char szFileName[MAX_PATH] = "";
897  char szInitialDir[MAX_PATH];
898 
899  /* We need to pick a different directory as the other tests because of new
900  * Windows 7 behavior.
901  */
902  GetSystemDirectoryA(szInitialDir, MAX_PATH);
903  lstrcpyA(SYSDIR, szInitialDir);
904 
905  ZeroMemory(&ofn, sizeof(ofn));
906 
908  ofn.hwndOwner = NULL;
909  ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
910  ofn.lpstrFile = szFileName;
913  ofn.lpstrDefExt = "txt";
915  ofn.lpstrInitialDir = szInitialDir;
916 
918  ok(FALSE == result, "expected FALSE, got %d\n", result);
919  ok(0 == CommDlgExtendedError(), "expected 0, got %d\n",
921 
923  ok(FALSE == result, "expected FALSE, got %d\n", result);
924  ok(0 == CommDlgExtendedError(), "expected 0, got %d\n",
926 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
HWND hwndOwner
Definition: commdlg.h:330
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2282
OPENFILENAME ofn
Definition: main.cpp:37
#define ZeroMemory
Definition: winbase.h:1635
LPCSTR lpstrDefExt
Definition: commdlg.h:345
static UINT_PTR CALLBACK path_hook_proc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:866
BOOL WINAPI GetSaveFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4600
static CHAR SYSDIR[MAX_PATH]
Definition: filedlg.c:864
DWORD nMaxFile
Definition: commdlg.h:337
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
unsigned int BOOL
Definition: ntddk_ex.h:94
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
smooth NULL
Definition: ftsmooth.c:416
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
LPSTR lpstrFile
Definition: commdlg.h:336
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
GLuint64EXT * result
Definition: glext.h:11304
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ test_mru()

static void test_mru ( void  )
static

Definition at line 969 of file filedlg.c.

970 {
971  ok_wndproc_testcase testcase = {0};
973  const char *test_dir_name = "C:\\mru_test";
974  const char *test_file_name = "test.txt";
975  const char *test_full_path = "C:\\mru_test\\test.txt";
976  char filename_buf[MAX_PATH];
977  DWORD ret;
978 
979  ofn.lpstrFile = filename_buf;
980  ofn.nMaxFile = sizeof(filename_buf);
981  ofn.lpTemplateName = "template1";
984  ofn.lCustData = (LPARAM)&testcase;
986 
987  SetLastError(0xdeadbeef);
988  ret = CreateDirectoryA(test_dir_name, NULL);
989  ok(ret == TRUE, "CreateDirectoryA should have succeeded: %d\n", GetLastError());
990 
991  /* "teach" comdlg32 about this directory */
992  strcpy(filename_buf, test_full_path);
993  SetLastError(0xdeadbeef);
995  ok(ret, "GetOpenFileNameA should have succeeded: %d\n", GetLastError());
997  ok(!ret, "CommDlgExtendedError returned %x\n", ret);
998  ok(testcase.actclose, "Open File dialog should have closed.\n");
999  ok(!strcmp(ofn.lpstrFile, test_full_path), "Expected to get %s, got %s\n", test_full_path, ofn.lpstrFile);
1000 
1001  /* get a filename without a full path. it should return the file in
1002  * test_dir_name, not in the CWD */
1003  strcpy(filename_buf, test_file_name);
1004  SetLastError(0xdeadbeef);
1005  ret = GetOpenFileNameA(&ofn);
1006  ok(ret, "GetOpenFileNameA should have succeeded: %d\n", GetLastError());
1008  ok(!ret, "CommDlgExtendedError returned %x\n", ret);
1009  ok(testcase.actclose, "Open File dialog should have closed.\n");
1010  if(strcmp(ofn.lpstrFile, test_full_path) != 0)
1011  win_skip("Platform doesn't save MRU data\n");
1012 
1013  SetLastError(0xdeadbeef);
1014  ret = RemoveDirectoryA(test_dir_name);
1015  ok(ret == TRUE, "RemoveDirectoryA should have succeeded: %d\n", GetLastError());
1016 }
#define OFN_EXPLORER
Definition: commdlg.h:104
#define TRUE
Definition: types.h:120
LPARAM lCustData
Definition: commdlg.h:346
#define OFN_NOCHANGEDIR
Definition: commdlg.h:109
OPENFILENAME ofn
Definition: main.cpp:37
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LPCSTR lpTemplateName
Definition: commdlg.h:348
DWORD nMaxFile
Definition: commdlg.h:337
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define test_file_name(a)
Definition: pipe.c:1224
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE hInstance
Definition: commdlg.h:331
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
LPSTR lpstrFile
Definition: commdlg.h:336
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
static UINT_PTR WINAPI test_ok_wndproc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:574
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
#define win_skip
Definition: test.h:141
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ test_null_enum()

static BOOL WINAPI test_null_enum ( HWND  hwnd,
LPARAM  lParam 
)
static

Definition at line 1123 of file filedlg.c.

1124 {
1125  /* Find the textbox and send a filename so IDOK will work.
1126  If the file textbox is empty IDOK will be ignored */
1127  CHAR className[20];
1128  if(GetClassNameA(hwnd, className, sizeof(className)) > 0 && !strcmp("Edit",className))
1129  {
1130  SetWindowTextA(hwnd, "testfile");
1131  return FALSE; /* break window enumeration */
1132  }
1133  return TRUE;
1134 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
int WINAPI GetClassNameA(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPSTR lpClassName, _In_ int nMaxCount)
char CHAR
Definition: xmlstorage.h:175
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by test_null_wndproc().

◆ test_null_filename()

static void test_null_filename ( void  )
static

Definition at line 1156 of file filedlg.c.

1157 {
1158  OPENFILENAMEA ofnA = {0};
1159  OPENFILENAMEW ofnW = {0};
1160  WCHAR filterW[] = {'t','e','x','t','\0','*','.','t','x','t','\0',
1161  'A','l','l','\0','*','\0','\0'};
1162  DWORD ret;
1163 
1165  ofnA.lpstrFile = NULL;
1166  ofnA.nMaxFile = 0;
1167  ofnA.nFileOffset = 0xdead;
1168  ofnA.nFileExtension = 0xbeef;
1169  ofnA.lpfnHook = test_null_wndproc;
1172  ofnA.lpstrFilter = "text\0*.txt\0All\0*\0\0";
1173  ofnA.lpstrDefExt = NULL;
1174  ret = GetOpenFileNameA(&ofnA);
1175  todo_wine ok(ret, "GetOpenFileNameA returned %#x\n", ret);
1177  todo_wine ok(!ret, "CommDlgExtendedError returned %#x, should be 0\n", ret);
1178 
1179  todo_wine ok(ofnA.nFileOffset != 0xdead, "ofnA.nFileOffset is 0xdead\n");
1180  todo_wine ok(ofnA.nFileExtension != 0xbeef, "ofnA.nFileExtension is 0xbeef\n");
1181 
1182  ofnA.lpstrFile = NULL;
1183  ofnA.nMaxFile = 1024; /* bogus input - lpstrFile = NULL but fake 1024 bytes available */
1184  ofnA.nFileOffset = 0xdead;
1185  ofnA.nFileExtension = 0xbeef;
1186  ret = GetOpenFileNameA(&ofnA);
1187  ok(ret, "GetOpenFileNameA returned %#x\n", ret);
1189  ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
1190 
1191  ok(ofnA.nFileOffset != 0xdead, "ofnA.nFileOffset is 0xdead\n");
1192  ok(ofnA.nFileExtension == 0, "ofnA.nFileExtension is 0x%x, should be 0\n", ofnA.nFileExtension);
1193 
1194  /* unicode tests */
1196  ofnW.lpstrFile = NULL;
1197  ofnW.nMaxFile = 0;
1198  ofnW.nFileOffset = 0xdead;
1199  ofnW.nFileExtension = 0xbeef;
1200  ofnW.lpfnHook = test_null_wndproc;
1203  ofnW.lpstrFilter = filterW;
1204  ofnW.lpstrDefExt = NULL;
1205  ret = GetOpenFileNameW(&ofnW);
1206  todo_wine ok(ret, "GetOpenFileNameW returned %#x\n", ret);
1208  todo_wine ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
1209 
1210  todo_wine ok(ofnW.nFileOffset != 0xdead, "ofnW.nFileOffset is 0xdead\n");
1211  todo_wine ok(ofnW.nFileExtension != 0xbeef, "ofnW.nFileExtension is 0xbeef\n");
1212 
1213  ofnW.lpstrFile = NULL;
1214  ofnW.nMaxFile = 1024; /* bogus input - lpstrFile = NULL but fake 1024 bytes available */
1215  ofnW.nFileOffset = 0xdead;
1216  ofnW.nFileExtension = 0xbeef;
1217  ret = GetOpenFileNameW(&ofnW);
1218  ok(ret, "GetOpenFileNameA returned %#x\n", ret);
1220  ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
1221 
1222  ok(ofnW.nFileOffset != 0xdead, "ofnW.nFileOffset is 0xdead\n");
1223  ok(ofnW.nFileExtension == 0, "ofnW.nFileExtension is 0x%x, should be 0\n", ofnW.nFileExtension);
1224 }
#define OFN_EXPLORER
Definition: commdlg.h:104
HINSTANCE hInstance
Definition: commdlg.h:362
DWORD Flags
Definition: commdlg.h:373
LPCWSTR lpstrFilter
Definition: commdlg.h:363
WORD nFileExtension
Definition: commdlg.h:344
LPWSTR lpstrFile
Definition: commdlg.h:367
LPCSTR lpstrDefExt
Definition: commdlg.h:345
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
DWORD lStructSize
Definition: commdlg.h:360
DWORD nMaxFile
Definition: commdlg.h:337
WORD nFileExtension
Definition: commdlg.h:375
LPCWSTR lpstrDefExt
Definition: commdlg.h:376
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4564
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
WORD nFileOffset
Definition: commdlg.h:374
smooth NULL
Definition: ftsmooth.c:416
HINSTANCE hInstance
Definition: commdlg.h:331
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD lStructSize
Definition: commdlg.h:329
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD nMaxFile
Definition: commdlg.h:368
int ret
#define todo_wine
Definition: test.h:154
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define OPENFILENAME_SIZE_VERSION_400W
Definition: commdlg.h:397
LPSTR lpstrFile
Definition: commdlg.h:336
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
LPCSTR lpstrFilter
Definition: commdlg.h:332
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:847
static UINT_PTR WINAPI test_null_wndproc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:1136
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
WORD nFileOffset
Definition: commdlg.h:343
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ test_null_wndproc()

static UINT_PTR WINAPI test_null_wndproc ( HWND  dlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1136 of file filedlg.c.

1137 {
1138  HWND parent = GetParent( dlg);
1139  if( msg == WM_NOTIFY) {
1140  SetTimer( dlg, 0, 100, 0);
1141  SetTimer( dlg, 1, 1000, 0);
1143  }
1144  if( msg == WM_TIMER) {
1145  if(!wParam)
1147  else {
1148  /* the dialog did not close automatically */
1149  KillTimer( dlg, 0);
1151  }
1152  }
1153  return FALSE;
1154 }
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
#define IDOK
Definition: winuser.h:824
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static BOOL WINAPI test_null_enum(HWND hwnd, LPARAM lParam)
Definition: filedlg.c:1123
WPARAM wParam
Definition: combotst.c:138
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
r parent
Definition: btrfs.c:2897
#define WM_TIMER
Definition: winuser.h:1724
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define WM_COMMAND
Definition: winuser.h:1722
HWND WINAPI GetParent(_In_ HWND)
#define msg(x)
Definition: auth_time.c:54
#define IDCANCEL
Definition: winuser.h:825
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by test_directory_filename(), and test_null_filename().

◆ test_ok()

static void test_ok ( void  )
static

Definition at line 624 of file filedlg.c.

625 {
627  char filename[1024] = {0};
628  char tmpfilename[ MAX_PATH];
629  char curdir[MAX_PATH];
630  int i;
631  DWORD ret;
632  BOOL cdret;
633 
634  cdret = GetCurrentDirectoryA(sizeof(curdir), curdir);
635  ok(cdret, "Failed to get current dir err %d\n", GetLastError());
636  if (!GetTempFileNameA(".", "txt", 0, tmpfilename)) {
637  skip("Failed to create a temporary file name\n");
638  return;
639  }
641  ofn.nMaxFile = 1024;
643  ofn.lpTemplateName = "template1";
645  for( i = 0; ok_testcases[i].retval != -1; i++) {
650  ok( ok_testcases[i].expclose == ok_testcases[i].actclose,
651  "testid %d: Open File dialog should %shave closed.\n", i,
652  ok_testcases[i].expclose ? "" : "NOT ");
653  ok(ret == ok_testcases[i].expclose, "testid %d: GetOpenFileName returned %#x\n", i, ret);
655  ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
656  cdret = SetCurrentDirectoryA(curdir);
657  ok(cdret, "Failed to restore current dir err %d\n", GetLastError());
658  }
660  ok( ret, "Failed to delete temporary file %s err %d\n", tmpfilename, GetLastError());
661 }
#define OFN_EXPLORER
Definition: commdlg.h:104
LPARAM lCustData
Definition: commdlg.h:346
static UINT_PTR WINAPI ok_template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:617
OPENFILENAME ofn
Definition: main.cpp:37
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LPCSTR lpTemplateName
Definition: commdlg.h:348
const char * filename
Definition: ioapi.h:135
DWORD nMaxFile
Definition: commdlg.h:337
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
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
unsigned int BOOL
Definition: ntddk_ex.h:94
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
HINSTANCE hInstance
Definition: commdlg.h:331
#define MAX_PATH
Definition: compat.h:26
static const char tmpfilename[]
Definition: parser.c:49
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205
static ok_wndproc_testcase ok_testcases[]
Definition: filedlg.c:556
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
LPSTR lpstrFile
Definition: commdlg.h:336
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
static UINT_PTR WINAPI test_ok_wndproc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:574
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
#define skip(...)
Definition: atltest.h:64
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ test_ok_wndproc()

static UINT_PTR WINAPI test_ok_wndproc ( HWND  dlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 574 of file filedlg.c.

575 {
576  HWND parent = GetParent( dlg);
577  static ok_wndproc_testcase *testcase = NULL;
578  static UINT msgFILEOKSTRING;
579  if (msg == WM_INITDIALOG)
580  {
581  testcase = (ok_wndproc_testcase*)((OPENFILENAMEA*)lParam)->lCustData;
582  testcase->actclose = TRUE;
583  msgFILEOKSTRING = RegisterWindowMessageA( FILEOKSTRINGA);
584  }
585  if( msg == WM_NOTIFY) {
586  if(((LPNMHDR)lParam)->code == CDN_FOLDERCHANGE) {
587  SetTimer( dlg, 0, 100, 0);
589  return FALSE;
590  } else if(((LPNMHDR)lParam)->code == CDN_FILEOK) {
591  if( testcase->usemsgokstr)
592  return FALSE;
593  if( testcase->setmsgresult)
594  SetWindowLongPtrA( dlg, DWLP_MSGRESULT, testcase->retval);
595  return testcase->retval;
596  }
597  }
598  if( msg == msgFILEOKSTRING) {
599  if( !testcase->usemsgokstr)
600  return FALSE;
601  if( testcase->setmsgresult)
602  SetWindowLongPtrA( dlg, DWLP_MSGRESULT, testcase->retval);
603  return testcase->retval;
604  }
605  if( msg == WM_TIMER) {
606  /* the dialog did not close automatically */
607  testcase->actclose = FALSE;
608  KillTimer( dlg, 0);
610  return FALSE;
611  }
612  if( testcase && testcase->do_subclass)
613  return DefWindowProcA( dlg, msg, wParam, lParam);
614  return FALSE;
615 }
#define FILEOKSTRINGA
Definition: commdlg.h:17
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
smooth NULL
Definition: ftsmooth.c:416
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
r parent
Definition: btrfs.c:2897
#define CDN_FILEOK
Definition: commdlg.h:38
#define WM_TIMER
Definition: winuser.h:1724
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SetWindowLongPtrA
Definition: winuser.h:5246
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI GetParent(_In_ HWND)
unsigned int UINT
Definition: ndis.h:50
#define msg(x)
Definition: auth_time.c:54
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)

Referenced by ok_template_hook(), test_mru(), and test_ok().

◆ test_ole_init_wndproc()

static UINT_PTR WINAPI test_ole_init_wndproc ( HWND  dlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1266 of file filedlg.c.

1267 {
1268  HRESULT hr;
1269 
1270  hr = OleInitialize(NULL);
1271  ok(hr == S_FALSE, "OleInitialize() returned %#x\n", hr);
1272  OleUninitialize();
1273 
1274  if (msg == WM_NOTIFY)
1276  return FALSE;
1277 }
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define WM_COMMAND
Definition: winuser.h:1722
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:172
HWND WINAPI GetParent(_In_ HWND)
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
#define IDCANCEL
Definition: winuser.h:825
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:233
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by test_ole_initialization().

◆ test_ole_initialization()

static void test_ole_initialization ( void  )
static

Definition at line 1307 of file filedlg.c.

1308 {
1309  char file[MAX_PATH] = {0};
1310  OPENFILENAMEA ofn = {0};
1311  HRESULT hr;
1312  HHOOK hook;
1313  BOOL ret;
1314 
1316 
1318  ofn.lpstrFile = file;
1319  ofn.nMaxFile = MAX_PATH;
1323  ret = GetOpenFileNameA(&ofn);
1324  ok(!ret, "GetOpenFileNameA returned %#x\n", ret);
1325 
1326  hr = OleInitialize(NULL);
1327  ok(hr == S_OK, "OleInitialize() returned %#x\n", hr);
1328  OleUninitialize();
1329 
1331 }
#define OFN_EXPLORER
Definition: commdlg.h:104
HRESULT hr
Definition: shlfolder.c:183
OPENFILENAME ofn
Definition: main.cpp:37
DWORD nMaxFile
Definition: commdlg.h:337
static UINT_PTR WINAPI test_ole_init_wndproc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:1266
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
unsigned int BOOL
Definition: ntddk_ex.h:94
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
smooth NULL
Definition: ftsmooth.c:416
#define WH_CBT
Definition: winuser.h:35
HINSTANCE hInstance
Definition: commdlg.h:331
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
Definition: msg.h:42
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
const char file[]
Definition: icontest.c:11
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:172
#define S_OK
Definition: intsafe.h:59
static LRESULT CALLBACK hook_proc(int code, WPARAM wp, LPARAM lp)
Definition: filedlg.c:1279
LPSTR lpstrFile
Definition: commdlg.h:336
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
HHOOK WINAPI SetWindowsHookExW(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:233
DWORD Flags
Definition: commdlg.h:342
Definition: fci.c:126

Referenced by START_TEST().

◆ test_resizable2()

static void test_resizable2 ( void  )
static

Definition at line 928 of file filedlg.c.

929 {
930  OPENFILENAMEA ofn = {0};
931  char filename[1024] = "pls press Enter if sizable, Esc otherwise";
932  DWORD ret;
933 
934  /* interactive because there is no hook function */
935  if( !winetest_interactive) {
936  skip( "some interactive resizable dialog tests (set WINETEST_INTERACTIVE=1)\n");
937  return;
938  }
941  ofn.nMaxFile = 1024;
942  ofn.lpfnHook = NULL;
944  ofn.lpTemplateName = "template1";
947  ok( ret == TRUE, "File Dialog should have been sizable\n");
949  ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
952  ok( !ret, "File Dialog should NOT have been sizable\n");
954  ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
959  ok( !ret, "File Dialog should NOT have been sizable\n");
961  ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
964  ok( !ret, "File Dialog should NOT have been sizable\n");
966  ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
967 }
#define OFN_EXPLORER
Definition: commdlg.h:104
#define TRUE
Definition: types.h:120
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
OPENFILENAME ofn
Definition: main.cpp:37
int winetest_interactive
LPCSTR lpTemplateName
Definition: commdlg.h:348
char * LPSTR
Definition: xmlstorage.h:182
const char * filename
Definition: ioapi.h:135
DWORD nMaxFile
Definition: commdlg.h:337
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
HINSTANCE hInstance
Definition: commdlg.h:331
#define RT_DIALOG
Definition: pedump.c:367
DWORD lStructSize
Definition: commdlg.h:329
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
LPSTR lpstrFile
Definition: commdlg.h:336
#define OFN_ENABLETEMPLATEHANDLE
Definition: commdlg.h:103
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
#define skip(...)
Definition: atltest.h:64
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ test_resize()

static void test_resize ( void  )
static

Definition at line 522 of file filedlg.c.

523 {
525  char filename[1024] = {0};
526  DWORD ret;
527  int i;
528 
530  ofn.nMaxFile = 1024;
533  ofn.lpTemplateName = "template_sz";
534  for( i = 0; resize_testcases[i].flags != 0xffffffff; i++) {
535  ofn.lCustData = i;
536  ofn.Flags = resize_testcases[i].flags |
539  ok(!ret, "GetOpenFileName returned %#x\n", ret);
541  ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
542  }
543 }
#define OFN_EXPLORER
Definition: commdlg.h:104
LPARAM lCustData
Definition: commdlg.h:346
static const struct @1589 resize_testcases[]
OPENFILENAME ofn
Definition: main.cpp:37
LPCSTR lpTemplateName
Definition: commdlg.h:348
const char * filename
Definition: ioapi.h:135
DWORD nMaxFile
Definition: commdlg.h:337
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
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
#define OPENFILENAME_SIZE_VERSION_400A
Definition: commdlg.h:396
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
smooth NULL
Definition: ftsmooth.c:416
HINSTANCE hInstance
Definition: commdlg.h:331
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
LPSTR lpstrFile
Definition: commdlg.h:336
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
static UINT_PTR WINAPI resize_template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:328
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
#define OFN_SHOWHELP
Definition: commdlg.h:120
DWORD Flags
Definition: commdlg.h:342

Referenced by START_TEST().

◆ toolbarcheck()

static void toolbarcheck ( HWND  hDlg)
static

Definition at line 40 of file filedlg.c.

41 {
42  /* test toolbar properties */
43  /* bug #10532 */
44  int maxtextrows;
45  HWND ctrl;
46  DWORD ret;
47  char classname[20];
48 
49  for( ctrl = GetWindow( hDlg, GW_CHILD);
52  classname[7] = '\0';
53  if( !strcmp( classname, "Toolbar")) break;
54  }
55  ok( ctrl != NULL, "could not get the toolbar control\n");
56  ret = SendMessageA( ctrl, TB_ADDSTRINGA, 0, (LPARAM)"winetestwinetest\0\0");
57  ok( ret == 0, "addstring returned %d (expected 0)\n", ret);
58  maxtextrows = SendMessageA( ctrl, TB_GETTEXTROWS, 0, 0);
59  ok( maxtextrows == 0 || broken(maxtextrows == 1), /* Win2k and below */
60  "Get(Max)TextRows returned %d (expected 0)\n", maxtextrows);
61 }
#define GW_HWNDNEXT
Definition: winuser.h:756
#define TB_ADDSTRINGA
Definition: commctrl.h:1103
int WINAPI GetClassNameA(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPSTR lpClassName, _In_ int nMaxCount)
#define GW_CHILD
Definition: winuser.h:758
#define TB_GETTEXTROWS
Definition: commctrl.h:1135
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR classname[128]
Definition: startup.c:15
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define ctrl
Definition: input.c:1669
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by OFNHookProc().

Variable Documentation

◆ arrange_tests

struct { ... } arrange_tests[]
Initial value:
= {
{ 0, {0},{0},{0},0 },
{ 0, {0},{0},{0}, OFN_SHOWHELP},
{ 0, {0, 0, 316, 76},{0},{0},0 },
{ 0, {0, 0, 100, 76},{0},{0}, OFN_SHOWHELP},
{ 1, {0, 0, 316, 76} ,{0, 0, 204, 76,},{0},0 },
{ 1, {0, 0, 316, 76} ,{0, 0, 204, 76,},{0}, OFN_SHOWHELP},
{ 1, {0, 0, 316, 170} ,{0, 0, 204, 170,},{0},0 },
{ 1, {0, 0, 316, 165} ,{0, 0, 411, 165,},{0}, OFN_SHOWHELP },
{ 1, {0, 0, 300, 100} ,{73, 17, 50, 50,},{0},0 },
{ 2, {0, 0, 280, 100} ,{0, 0, 50, 50,},{300,20,30,30},0 },
{ 0, {0},{0},{0}, OFN_SHOWHELP|OFN_ENABLESIZING},
{ -1 }
}
#define OFN_ENABLESIZING
Definition: commdlg.h:101
#define OFN_SHOWHELP
Definition: commdlg.h:120

Referenced by template_hook_arrange(), and test_arrange().

◆ flags

Definition at line 309 of file filedlg.c.

◆ nrcontrols

int nrcontrols

Definition at line 669 of file filedlg.c.

◆ ofnflags

DWORD ofnflags

Definition at line 673 of file filedlg.c.

◆ ok_testcases

ok_wndproc_testcase ok_testcases[]
static
Initial value:
= {
{ 0, FALSE, FALSE, FALSE, TRUE},
{ 0, TRUE, FALSE, FALSE, TRUE},
{ 0, FALSE, FALSE, TRUE, TRUE},
{ 0, TRUE, FALSE, TRUE, TRUE},
{ 1, FALSE, FALSE, FALSE, TRUE},
{ 1, TRUE, FALSE, FALSE, FALSE},
{ 1, FALSE, FALSE, TRUE, FALSE},
{ 1, TRUE, FALSE, TRUE, FALSE},
{ 1, TRUE, TRUE, FALSE, FALSE},
{ 1, FALSE, TRUE, TRUE, FALSE},
{ -1 }
}
#define TRUE
Definition: types.h:120

Definition at line 556 of file filedlg.c.

Referenced by test_ok().

◆ poszBtn

posz poszBtn

Definition at line 672 of file filedlg.c.

◆ poszDlg

posz poszDlg

Definition at line 670 of file filedlg.c.

◆ poszStc32

posz poszStc32

Definition at line 671 of file filedlg.c.

◆ resize_check

int resize_check

Definition at line 312 of file filedlg.c.

◆ resize_folderchange

int resize_folderchange

Definition at line 310 of file filedlg.c.

Referenced by resize_template_hook().

◆ resize_testcases

const { ... } resize_testcases[]
Initial value:
= {
{ 0 , 10, 10, 20,FALSE,FALSE},
{ 0 ,-10,-10,-20,FALSE,FALSE},
{ OFN_ENABLESIZING , 0,-10, 0,FALSE,FALSE},
{ OFN_ENABLESIZING , 0, 10, 10,FALSE, TRUE},
{ OFN_ENABLESIZING ,-10, 0, 10,FALSE,FALSE},
{ OFN_ENABLESIZING , 10, 0, 10,FALSE,FALSE},
{ OFN_ENABLESIZING , 0, 10, 20,FALSE,FALSE},
{ 0xffffffff }
}
#define TRUE
Definition: types.h:120
#define OFN_ENABLESIZING
Definition: commdlg.h:101

Referenced by resize_template_hook(), and test_resize().

◆ resize_timer1

int resize_timer1

Definition at line 311 of file filedlg.c.

Referenced by resize_template_hook().

◆ resizesupported

BOOL resizesupported = TRUE
static

Definition at line 38 of file filedlg.c.

Referenced by resize_template_hook(), and START_TEST().

◆ SYSDIR

CHAR SYSDIR[MAX_PATH]
static

Definition at line 864 of file filedlg.c.

Referenced by path_hook_proc(), and test_getfolderpath().

◆ testcontrols

BOOL testcontrols

Definition at line 314 of file filedlg.c.

Referenced by resize_template_hook().

◆ todo