ReactOS  0.4.14-dev-552-g2fad488
filedlg31.c File Reference
#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "winreg.h"
#include "winternl.h"
#include "commdlg.h"
#include "shlwapi.h"
#include "cderr.h"
#include "cdlg.h"
Include dependency graph for filedlg31.c:

Go to the source code of this file.

Classes

struct  tagFD31_DATA
 

Macros

#define BUFFILE   512
 
#define BUFFILEALLOC   512 * sizeof(WCHAR)
 
#define FD31_OFN_PROP   "FILEDLG_OFN"
 

Typedefs

typedef struct tagFD31_DATA FD31_DATA
 
typedef struct tagFD31_DATAPFD31_DATA
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (commdlg)
 
static BOOL FD31_Init (void)
 
static void FD31_StripEditControl (HWND hwnd)
 
static BOOL FD31_CallWindowProc (const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
 
static LPCWSTR FD31_GetFileType (LPCWSTR cfptr, LPCWSTR fptr, const WORD index)
 
static BOOL FD31_ScanDir (const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath)
 
static LONG FD31_WMDrawItem (HWND hWnd, WPARAM wParam, LPARAM lParam, int savedlg, const DRAWITEMSTRUCT *lpdis)
 
static void FD31_UpdateResult (const FD31_DATA *lfs, const WCHAR *tmpstr)
 
static void FD31_UpdateFileTitle (const FD31_DATA *lfs)
 
static LRESULT FD31_DirListDblClick (const FD31_DATA *lfs)
 
static LRESULT FD31_FileListSelect (const FD31_DATA *lfs)
 
static LRESULT FD31_TestPath (const FD31_DATA *lfs, LPWSTR path)
 
static LRESULT FD31_Validate (const FD31_DATA *lfs, LPCWSTR path, UINT control, INT itemIndex, BOOL internalUse)
 
static LRESULT FD31_DiskChange (const FD31_DATA *lfs)
 
static LRESULT FD31_FileTypeChange (const FD31_DATA *lfs)
 
static LRESULT FD31_WMCommand (HWND hWnd, LPARAM lParam, UINT notification, UINT control, const FD31_DATA *lfs)
 
static LPWSTR FD31_MapStringPairsToW (LPCSTR strA, UINT size)
 
static LPWSTR FD31_DupToW (LPCSTR str, DWORD size)
 
static void FD31_MapOfnStructA (const OPENFILENAMEA *ofnA, LPOPENFILENAMEW ofnW, BOOL open)
 
static void FD31_FreeOfnW (OPENFILENAMEW *ofnW)
 
static void FD31_DestroyPrivate (PFD31_DATA lfs)
 
static BOOL FD31_GetTemplate (PFD31_DATA lfs)
 
static PFD31_DATA FD31_AllocPrivate (LPARAM lParam, UINT dlgType, BOOL IsUnicode)
 
static LONG FD31_WMInitDialog (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
static int FD31_GetFldrHeight (void)
 
static LONG FD31_WMMeasureItem (LPARAM lParam)
 
static INT_PTR CALLBACK FD31_FileOpenDlgProc (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
 
BOOL GetFileName31A (OPENFILENAMEA *lpofn, UINT dlgType)
 
BOOL GetFileName31W (OPENFILENAMEW *lpofn, UINT dlgType)
 

Variables

static const WCHAR FILE_star [] = {'*','.','*', 0}
 
static const WCHAR FILE_bslash [] = {'\\', 0}
 
static const WCHAR FILE_specc [] = {'%','c',':', 0}
 
static const int fldrHeight = 16
 
static const int fldrWidth = 20
 
static HICON hFolder = 0
 
static HICON hFolder2 = 0
 
static HICON hFloppy = 0
 
static HICON hHDisk = 0
 
static HICON hCDRom = 0
 
static HICON hNet = 0
 

Macro Definition Documentation

◆ BUFFILE

#define BUFFILE   512

Definition at line 43 of file filedlg31.c.

◆ BUFFILEALLOC

#define BUFFILEALLOC   512 * sizeof(WCHAR)

Definition at line 44 of file filedlg31.c.

◆ FD31_OFN_PROP

#define FD31_OFN_PROP   "FILEDLG_OFN"

Definition at line 59 of file filedlg31.c.

Typedef Documentation

◆ FD31_DATA

◆ PFD31_DATA

Function Documentation

◆ FD31_AllocPrivate()

static PFD31_DATA FD31_AllocPrivate ( LPARAM  lParam,
UINT  dlgType,
BOOL  IsUnicode 
)
static

Definition at line 918 of file filedlg31.c.

919 {
920  FD31_DATA *lfs = heap_alloc_zero(sizeof(*lfs));
921 
922  TRACE("alloc private buf %p\n", lfs);
923  if (!lfs) return NULL;
924  lfs->hook = FALSE;
925  lfs->lParam = lParam;
926  lfs->open = (dlgType == OPEN_DIALOG);
927 
928  if (IsUnicode)
929  {
930  lfs->ofnA = NULL;
931  lfs->ofnW = (LPOPENFILENAMEW) lParam;
932  if (lfs->ofnW->Flags & OFN_ENABLEHOOK)
933  if (lfs->ofnW->lpfnHook)
934  lfs->hook = TRUE;
935  }
936  else
937  {
938  lfs->ofnA = (LPOPENFILENAMEA) lParam;
939  if (lfs->ofnA->Flags & OFN_ENABLEHOOK)
940  if (lfs->ofnA->lpfnHook)
941  lfs->hook = TRUE;
942  lfs->ofnW = heap_alloc_zero(lfs->ofnA->lStructSize);
943  lfs->ofnW->lStructSize = lfs->ofnA->lStructSize;
944  FD31_MapOfnStructA(lfs->ofnA, lfs->ofnW, lfs->open);
945  }
946 
947  if (! FD31_GetTemplate(lfs))
948  {
949  FD31_DestroyPrivate(lfs);
950  return NULL;
951  }
954 
955  return lfs;
956 }
DWORD Flags
Definition: commdlg.h:373
static void FD31_MapOfnStructA(const OPENFILENAMEA *ofnA, LPOPENFILENAMEW ofnW, BOOL open)
Definition: filedlg31.c:757
#define FILEOKSTRINGA
Definition: commdlg.h:17
#define TRUE
Definition: types.h:120
struct tagOFNW * LPOPENFILENAMEW
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:72
UINT lbselchstring
Definition: filedlg31.c:65
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
DWORD lStructSize
Definition: commdlg.h:360
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_DIALOG
Definition: commdlg.h:13
#define TRACE(s)
Definition: solgame.cpp:4
DWORD lStructSize
Definition: commdlg.h:329
static void FD31_DestroyPrivate(PFD31_DATA lfs)
Definition: filedlg31.c:835
LPARAM lParam
Definition: filedlg31.c:67
UINT fileokstring
Definition: filedlg31.c:66
static BOOL FD31_GetTemplate(PFD31_DATA lfs)
Definition: filedlg31.c:859
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:70
#define LBSELCHSTRINGA
Definition: commdlg.h:15
LPARAM lParam
Definition: combotst.c:139
struct tagOFNA * LPOPENFILENAMEA
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)
DWORD Flags
Definition: commdlg.h:342

Referenced by GetFileName31A(), and GetFileName31W().

◆ FD31_CallWindowProc()

static BOOL FD31_CallWindowProc ( const FD31_DATA lfs,
UINT  wMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 125 of file filedlg31.c.

126 {
127  BOOL ret;
128 
129  if (lfs->ofnA)
130  {
131  TRACE("Call hookA %p (%p, %04x, %08lx, %08lx)\n",
132  lfs->ofnA->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
133  ret = lfs->ofnA->lpfnHook(lfs->hwnd, wMsg, wParam, lParam);
134  TRACE("ret hookA %p (%p, %04x, %08lx, %08lx)\n",
135  lfs->ofnA->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
136  return ret;
137  }
138 
139  TRACE("Call hookW %p (%p, %04x, %08lx, %08lx)\n",
140  lfs->ofnW->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
141  ret = lfs->ofnW->lpfnHook(lfs->hwnd, wMsg, wParam, lParam);
142  TRACE("Ret hookW %p (%p, %04x, %08lx, %08lx)\n",
143  lfs->ofnW->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
144  return ret;
145 }
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:72
WPARAM wParam
Definition: combotst.c:138
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
int ret
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:70
LPARAM lParam
Definition: combotst.c:139

Referenced by FD31_DirListDblClick(), FD31_FileListSelect(), FD31_FileOpenDlgProc(), FD31_Validate(), and FD31_WMInitDialog().

◆ FD31_DestroyPrivate()

static void FD31_DestroyPrivate ( PFD31_DATA  lfs)
static

Definition at line 835 of file filedlg31.c.

836 {
837  HWND hwnd;
838  if (!lfs) return;
839  hwnd = lfs->hwnd;
840  TRACE("destroying private allocation %p\n", lfs);
841 
842  /* if ofnW has been allocated, have to free everything in it */
843  if (lfs->ofnA)
844  {
845  FD31_FreeOfnW(lfs->ofnW);
846  heap_free(lfs->ofnW);
847  }
848  heap_free(lfs);
850 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HANDLE WINAPI RemovePropA(_In_ HWND, _In_ LPCSTR)
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:72
#define TRACE(s)
Definition: solgame.cpp:4
static void FD31_FreeOfnW(OPENFILENAMEW *ofnW)
Definition: filedlg31.c:819
#define FD31_OFN_PROP
Definition: filedlg31.c:59
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:70
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FD31_AllocPrivate(), GetFileName31A(), and GetFileName31W().

◆ FD31_DirListDblClick()

static LRESULT FD31_DirListDblClick ( const FD31_DATA lfs)
static

Definition at line 411 of file filedlg31.c.

412 {
413  LONG lRet;
414  HWND hWnd = lfs->hwnd;
415  LPWSTR pstr;
416  WCHAR tmpstr[BUFFILE];
417 
418  /* get the raw string (with brackets) */
419  lRet = SendDlgItemMessageW(hWnd, lst2, LB_GETCURSEL, 0, 0);
420  if (lRet == LB_ERR) return TRUE;
421  pstr = heap_alloc(BUFFILEALLOC);
423  (LPARAM)pstr);
424  lstrcpyW( tmpstr, pstr );
425  heap_free(pstr);
426  /* get the selected directory in tmpstr */
427  if (tmpstr[0] == '[')
428  {
429  tmpstr[lstrlenW(tmpstr) - 1] = 0;
430  lstrcpyW(tmpstr,tmpstr+1);
431  }
432  lstrcatW(tmpstr, FILE_bslash);
433 
434  FD31_ScanDir(lfs->ofnW, hWnd, tmpstr);
435  /* notify the app */
436  if (lfs->hook)
437  {
438  if (FD31_CallWindowProc(lfs, lfs->lbselchstring, lst2,
439  MAKELONG(lRet,CD_LBSELCHANGE)))
440  return TRUE;
441  }
442  return TRUE;
443 }
#define TRUE
Definition: types.h:120
#define BUFFILE
Definition: filedlg31.c:43
UINT lbselchstring
Definition: filedlg31.c:65
HWND hWnd
Definition: settings.c:17
#define lstrlenW
Definition: compat.h:415
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define LB_ERR
Definition: winuser.h:2407
long LONG
Definition: pedump.c:60
#define MAKELONG(a, b)
Definition: typedefs.h:248
LONG_PTR LPARAM
Definition: windef.h:208
static const WCHAR FILE_bslash[]
Definition: filedlg31.c:47
__wchar_t WCHAR
Definition: xmlstorage.h:180
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static BOOL FD31_ScanDir(const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath)
Definition: filedlg31.c:176
#define LB_GETTEXT
Definition: winuser.h:2031
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:125
#define lst2
Definition: dlgs.h:96
#define lstrcpyW
Definition: compat.h:414
#define LB_GETCURSEL
Definition: winuser.h:2021
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:70
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define CD_LBSELCHANGE
Definition: commdlg.h:196
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define BUFFILEALLOC
Definition: filedlg31.c:44
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FD31_WMCommand().

◆ FD31_DiskChange()

static LRESULT FD31_DiskChange ( const FD31_DATA lfs)
static

Definition at line 616 of file filedlg31.c.

617 {
618  LONG lRet;
619  HWND hWnd = lfs->hwnd;
620  LPWSTR pstr;
621  WCHAR diskname[BUFFILE];
622 
624  lRet = SendDlgItemMessageW(hWnd, cmb2, CB_GETCURSEL, 0, 0L);
625  if (lRet == LB_ERR)
626  return 0;
627  pstr = heap_alloc(BUFFILEALLOC);
629  (LPARAM)pstr);
630  wsprintfW(diskname, FILE_specc, pstr[2]);
631  heap_free(pstr);
632 
633  return FD31_Validate( lfs, diskname, cmb2, lRet, TRUE );
634 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define TRUE
Definition: types.h:120
static void FD31_StripEditControl(HWND hwnd)
Definition: filedlg31.c:104
static const WCHAR FILE_specc[]
Definition: filedlg31.c:48
#define BUFFILE
Definition: filedlg31.c:43
#define CB_GETLBTEXT
Definition: winuser.h:1934
HWND hWnd
Definition: settings.c:17
#define CB_GETCURSEL
Definition: winuser.h:1925
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define LB_ERR
Definition: winuser.h:2407
long LONG
Definition: pedump.c:60
LONG_PTR LPARAM
Definition: windef.h:208
static LRESULT FD31_Validate(const FD31_DATA *lfs, LPCWSTR path, UINT control, INT itemIndex, BOOL internalUse)
Definition: filedlg31.c:551
__wchar_t WCHAR
Definition: xmlstorage.h:180
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const WCHAR L[]
Definition: oid.c:1250
#define cmb2
Definition: dlgs.h:49
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define BUFFILEALLOC
Definition: filedlg31.c:44
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FD31_WMCommand().

◆ FD31_DupToW()

static LPWSTR FD31_DupToW ( LPCSTR  str,
DWORD  size 
)
static

Definition at line 742 of file filedlg31.c.

743 {
744  LPWSTR strW = NULL;
745  if (str && (size > 0))
746  {
747  strW = heap_alloc(size * sizeof(WCHAR));
748  if (strW) MultiByteToWideChar( CP_ACP, 0, str, -1, strW, size );
749  }
750  return strW;
751 }
#define CP_ACP
Definition: compat.h:99
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
WCHAR strW[12]
Definition: clipboard.c:2029
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FD31_MapOfnStructA().

◆ FD31_FileListSelect()

static LRESULT FD31_FileListSelect ( const FD31_DATA lfs)
static

Definition at line 449 of file filedlg31.c.

450 {
451  LONG lRet;
452  HWND hWnd = lfs->hwnd;
453  LPWSTR pstr;
454 
455  lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0);
456  if (lRet == LB_ERR)
457  return TRUE;
458 
459  /* set the edit control to the chosen file */
460  if ((pstr = heap_alloc(BUFFILEALLOC)))
461  {
463  (LPARAM)pstr);
464  SetDlgItemTextW( hWnd, edt1, pstr );
465  heap_free(pstr);
466  }
467  if (lfs->hook)
468  {
470  MAKELONG(lRet,CD_LBSELCHANGE));
471  }
472  /* FIXME: for OFN_ALLOWMULTISELECT we need CD_LBSELSUB, CD_SELADD,
473  CD_LBSELNOITEMS */
474  return TRUE;
475 }
#define TRUE
Definition: types.h:120
UINT lbselchstring
Definition: filedlg31.c:65
HWND hWnd
Definition: settings.c:17
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define LB_ERR
Definition: winuser.h:2407
long LONG
Definition: pedump.c:60
#define MAKELONG(a, b)
Definition: typedefs.h:248
LONG_PTR LPARAM
Definition: windef.h:208
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define edt1
Definition: dlgs.h:65
#define lst1
Definition: dlgs.h:95
#define LB_GETTEXT
Definition: winuser.h:2031
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:125
#define LB_GETCURSEL
Definition: winuser.h:2021
#define CD_LBSELCHANGE
Definition: commdlg.h:196
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define BUFFILEALLOC
Definition: filedlg31.c:44
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FD31_WMCommand().

◆ FD31_FileOpenDlgProc()

static INT_PTR CALLBACK FD31_FileOpenDlgProc ( HWND  hWnd,
UINT  wMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1100 of file filedlg31.c.

1102 {
1104 
1105  TRACE("msg=%x wparam=%lx lParam=%lx\n", wMsg, wParam, lParam);
1106  if ((wMsg != WM_INITDIALOG) && lfs && lfs->hook)
1107  {
1108  INT_PTR lRet;
1109  lRet = (INT_PTR)FD31_CallWindowProc( lfs, wMsg, wParam, lParam );
1110  if (lRet) return lRet; /* else continue message processing */
1111  }
1112  switch (wMsg)
1113  {
1114  case WM_INITDIALOG:
1115  return FD31_WMInitDialog( hWnd, wParam, lParam );
1116 
1117  case WM_MEASUREITEM:
1118  return FD31_WMMeasureItem( lParam );
1119 
1120  case WM_DRAWITEM:
1121  return FD31_WMDrawItem( hWnd, wParam, lParam, !lfs->open, (DRAWITEMSTRUCT *)lParam );
1122 
1123  case WM_COMMAND:
1124  return FD31_WMCommand( hWnd, lParam, HIWORD(wParam), LOWORD(wParam), lfs );
1125 #if 0
1126  case WM_CTLCOLOR:
1127  SetBkColor( (HDC16)wParam, 0x00C0C0C0 );
1128  switch (HIWORD(lParam))
1129  {
1130  case CTLCOLOR_BTN:
1131  SetTextColor( (HDC16)wParam, 0x00000000 );
1132  return hGRAYBrush;
1133  case CTLCOLOR_STATIC:
1134  SetTextColor( (HDC16)wParam, 0x00000000 );
1135  return hGRAYBrush;
1136  }
1137  break;
1138 #endif
1139  }
1140  return FALSE;
1141 }
#define CTLCOLOR_STATIC
Definition: winuser.h:947
HWND hWnd
Definition: settings.c:17
static LONG FD31_WMMeasureItem(LPARAM lParam)
Definition: filedlg31.c:1086
#define WM_CTLCOLOR
Definition: windowsx.h:4
int32_t INT_PTR
Definition: typedefs.h:62
WPARAM wParam
Definition: combotst.c:138
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
#define CTLCOLOR_BTN
Definition: winuser.h:944
static LRESULT FD31_WMCommand(HWND hWnd, LPARAM lParam, UINT notification, UINT control, const FD31_DATA *lfs)
Definition: filedlg31.c:660
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_MEASUREITEM
Definition: winuser.h:1628
static LONG FD31_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam, int savedlg, const DRAWITEMSTRUCT *lpdis)
Definition: filedlg31.c:225
#define WM_COMMAND
Definition: winuser.h:1722
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:125
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define WM_DRAWITEM
Definition: winuser.h:1627
#define HIWORD(l)
Definition: typedefs.h:246
#define FD31_OFN_PROP
Definition: filedlg31.c:59
struct tagFD31_DATA * PFD31_DATA
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
static LONG FD31_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:961

Referenced by GetFileName31A(), and GetFileName31W().

◆ FD31_FileTypeChange()

static LRESULT FD31_FileTypeChange ( const FD31_DATA lfs)
static

Definition at line 640 of file filedlg31.c.

641 {
642  LONG lRet;
643  LPWSTR pstr;
644 
645  lRet = SendDlgItemMessageW(lfs->hwnd, cmb1, CB_GETCURSEL, 0, 0);
646  if (lRet == LB_ERR)
647  return TRUE;
648  lfs->ofnW->nFilterIndex = lRet + 1;
649  if (lfs->ofnA)
650  lfs->ofnA->nFilterIndex = lRet + 1;
651  pstr = (LPWSTR)SendDlgItemMessageW(lfs->hwnd, cmb1, CB_GETITEMDATA, lRet, 0);
652  TRACE("Selected filter : %s\n", debugstr_w(pstr));
653 
654  return FD31_Validate( lfs, pstr, cmb1, lRet, TRUE );
655 }
#define TRUE
Definition: types.h:120
#define CB_GETITEMDATA
Definition: winuser.h:1932
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:72
#define CB_GETCURSEL
Definition: winuser.h:1925
#define LB_ERR
Definition: winuser.h:2407
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
DWORD nFilterIndex
Definition: commdlg.h:366
#define TRACE(s)
Definition: solgame.cpp:4
static LRESULT FD31_Validate(const FD31_DATA *lfs, LPCWSTR path, UINT control, INT itemIndex, BOOL internalUse)
Definition: filedlg31.c:551
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:70
DWORD nFilterIndex
Definition: commdlg.h:335
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define cmb1
Definition: dlgs.h:48

Referenced by FD31_WMCommand().

◆ FD31_FreeOfnW()

static void FD31_FreeOfnW ( OPENFILENAMEW ofnW)
static

Definition at line 819 of file filedlg31.c.

820 {
821  heap_free((void *)ofnW->lpstrFilter);
823  heap_free(ofnW->lpstrFile);
824  heap_free(ofnW->lpstrFileTitle);
825  heap_free((void *)ofnW->lpstrInitialDir);
826  heap_free((void *)ofnW->lpstrTitle);
827  if (!IS_INTRESOURCE(ofnW->lpTemplateName))
828  heap_free((void *)ofnW->lpTemplateName);
829 }
LPCWSTR lpstrFilter
Definition: commdlg.h:363
LPCWSTR lpstrInitialDir
Definition: commdlg.h:371
LPWSTR lpstrFile
Definition: commdlg.h:367
LPCWSTR lpTemplateName
Definition: commdlg.h:379
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
LPCWSTR lpstrTitle
Definition: commdlg.h:372
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
LPWSTR lpstrCustomFilter
Definition: commdlg.h:364
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FD31_DestroyPrivate().

◆ FD31_GetFileType()

static LPCWSTR FD31_GetFileType ( LPCWSTR  cfptr,
LPCWSTR  fptr,
const WORD  index 
)
static

Definition at line 150 of file filedlg31.c.

151 {
152  int n, i;
153  i = 0;
154  if (cfptr)
155  for ( ;(n = lstrlenW(cfptr)) != 0; i++)
156  {
157  cfptr += n + 1;
158  if (i == index)
159  return cfptr;
160  cfptr += lstrlenW(cfptr) + 1;
161  }
162  if (fptr)
163  for ( ;(n = lstrlenW(fptr)) != 0; i++)
164  {
165  fptr += n + 1;
166  if (i == index)
167  return fptr;
168  fptr += lstrlenW(fptr) + 1;
169  }
170  return FILE_star; /* FIXME */
171 }
GLdouble n
Definition: glext.h:7729
#define lstrlenW
Definition: compat.h:415
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
static const WCHAR FILE_star[]
Definition: filedlg31.c:46
GLuint index
Definition: glext.h:6031

Referenced by FD31_ScanDir(), and FD31_WMInitDialog().

◆ FD31_GetFldrHeight()

static int FD31_GetFldrHeight ( void  )
static

Definition at line 1078 of file filedlg31.c.

1079 {
1080  return fldrHeight;
1081 }
static const int fldrHeight
Definition: filedlg31.c:49

Referenced by FD31_WMMeasureItem().

◆ FD31_GetTemplate()

static BOOL FD31_GetTemplate ( PFD31_DATA  lfs)
static

Definition at line 859 of file filedlg31.c.

860 {
861  LPOPENFILENAMEW ofnW = lfs->ofnW;
862  LPOPENFILENAMEA ofnA = lfs->ofnA;
863  HANDLE hDlgTmpl;
864 
865  if (ofnW->Flags & OFN_ENABLETEMPLATEHANDLE)
866  {
867  if (!(lfs->template = LockResource( ofnW->hInstance )))
868  {
870  return FALSE;
871  }
872  }
873  else if (ofnW->Flags & OFN_ENABLETEMPLATE)
874  {
875  HRSRC hResInfo;
876  if (ofnA)
877  hResInfo = FindResourceA( ofnA->hInstance, ofnA->lpTemplateName, (LPSTR)RT_DIALOG );
878  else
879  hResInfo = FindResourceW( ofnW->hInstance, ofnW->lpTemplateName, (LPWSTR)RT_DIALOG );
880  if (!hResInfo)
881  {
883  return FALSE;
884  }
885  if (!(hDlgTmpl = LoadResource( ofnW->hInstance, hResInfo )) ||
886  !(lfs->template = LockResource( hDlgTmpl )))
887  {
889  return FALSE;
890  }
891  }
892  else /* get it from internal Wine resource */
893  {
894  HRSRC hResInfo;
895  if (!(hResInfo = FindResourceA( COMDLG32_hInstance, lfs->open ? "OPEN_FILE" : "SAVE_FILE", (LPSTR)RT_DIALOG )))
896  {
898  return FALSE;
899  }
900  if (!(hDlgTmpl = LoadResource( COMDLG32_hInstance, hResInfo )) ||
901  !(lfs->template = LockResource( hDlgTmpl )))
902  {
904  return FALSE;
905  }
906  }
907  return TRUE;
908 }
HINSTANCE hInstance
Definition: commdlg.h:362
DWORD Flags
Definition: commdlg.h:373
#define TRUE
Definition: types.h:120
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define CDERR_LOADRESFAILURE
Definition: cderr.h:12
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:72
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
LPCSTR lpTemplateName
Definition: commdlg.h:348
char * LPSTR
Definition: xmlstorage.h:182
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
#define CDERR_FINDRESFAILURE
Definition: cderr.h:11
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
HINSTANCE hInstance
Definition: commdlg.h:331
LPCWSTR lpTemplateName
Definition: commdlg.h:379
#define RT_DIALOG
Definition: pedump.c:367
#define OFN_ENABLETEMPLATEHANDLE
Definition: commdlg.h:103
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN
Definition: cdlg32.c:119
LPCVOID template
Definition: filedlg31.c:68
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:70
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FD31_AllocPrivate().

◆ FD31_Init()

static BOOL FD31_Init ( void  )
static

Definition at line 78 of file filedlg31.c.

79 {
80  static BOOL initialized = FALSE;
81 
82  if (!initialized) {
83  hFolder = LoadImageA( COMDLG32_hInstance, "FOLDER", IMAGE_ICON, 16, 16, LR_SHARED );
84  hFolder2 = LoadImageA( COMDLG32_hInstance, "FOLDER2", IMAGE_ICON, 16, 16, LR_SHARED );
85  hFloppy = LoadImageA( COMDLG32_hInstance, "FLOPPY", IMAGE_ICON, 16, 16, LR_SHARED );
88  hNet = LoadImageA( COMDLG32_hInstance, "NETWORK", IMAGE_ICON, 16, 16, LR_SHARED );
89  if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 ||
90  hHDisk == 0 || hCDRom == 0 || hNet == 0)
91  {
92  ERR("Error loading icons!\n");
93  return FALSE;
94  }
95  initialized = TRUE;
96  }
97  return TRUE;
98 }
static HICON hHDisk
Definition: filedlg31.c:55
#define TRUE
Definition: types.h:120
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
unsigned int BOOL
Definition: ntddk_ex.h:94
static HICON hCDRom
Definition: filedlg31.c:56
static BOOL initialized
Definition: syslog.c:39
static HICON hFolder
Definition: filedlg31.c:52
static HICON hFloppy
Definition: filedlg31.c:54
#define ERR(fmt,...)
Definition: debug.h:109
static HICON hNet
Definition: filedlg31.c:57
HANDLE WINAPI LoadImageA(_In_opt_ HINSTANCE, _In_ LPCSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2147
static HICON hFolder2
Definition: filedlg31.c:53

Referenced by GetFileName31A(), and GetFileName31W().

◆ FD31_MapOfnStructA()

static void FD31_MapOfnStructA ( const OPENFILENAMEA ofnA,
LPOPENFILENAMEW  ofnW,
BOOL  open 
)
static

Definition at line 757 of file filedlg31.c.

758 {
759  UNICODE_STRING usBuffer;
760 
761  ofnW->hwndOwner = ofnA->hwndOwner;
762  ofnW->hInstance = ofnA->hInstance;
763  if (ofnA->lpstrFilter)
765 
766  if ((ofnA->lpstrCustomFilter) && (*(ofnA->lpstrCustomFilter)))
768  ofnW->nMaxCustFilter = ofnA->nMaxCustFilter;
769  ofnW->nFilterIndex = ofnA->nFilterIndex;
770  ofnW->nMaxFile = ofnA->nMaxFile;
771  ofnW->lpstrFile = FD31_DupToW(ofnA->lpstrFile, ofnW->nMaxFile);
772  ofnW->nMaxFileTitle = ofnA->nMaxFileTitle;
774  if (ofnA->lpstrInitialDir)
775  {
777  ofnW->lpstrInitialDir = usBuffer.Buffer;
778  }
779  if (ofnA->lpstrTitle) {
780  RtlCreateUnicodeStringFromAsciiz (&usBuffer, ofnA->lpstrTitle);
781  ofnW->lpstrTitle = usBuffer.Buffer;
782  } else {
783  WCHAR buf[16];
784  LPWSTR title_tmp;
785  int len;
787  len = lstrlenW(buf)+1;
788  title_tmp = heap_alloc(len * sizeof(WCHAR));
789  memcpy(title_tmp, buf, len * sizeof(WCHAR));
790  ofnW->lpstrTitle = title_tmp;
791  }
792  ofnW->Flags = ofnA->Flags;
793  ofnW->nFileOffset = ofnA->nFileOffset;
794  ofnW->nFileExtension = ofnA->nFileExtension;
795  ofnW->lpstrDefExt = FD31_DupToW(ofnA->lpstrDefExt, 3);
796  if ((ofnA->Flags & OFN_ENABLETEMPLATE) && (ofnA->lpTemplateName))
797  {
798  if (!IS_INTRESOURCE(ofnA->lpTemplateName))
799  {
801  ofnW->lpTemplateName = usBuffer.Buffer;
802  }
803  else /* numbered resource */
804  ofnW->lpTemplateName = (LPCWSTR) ofnA->lpTemplateName;
805  }
807  {
808  ofnW->pvReserved = ofnA->pvReserved;
809  ofnW->dwReserved = ofnA->dwReserved;
810  ofnW->FlagsEx = ofnA->FlagsEx;
811  }
812 }
HINSTANCE hInstance
Definition: commdlg.h:362
DWORD Flags
Definition: commdlg.h:373
LPCWSTR lpstrFilter
Definition: commdlg.h:363
WORD nFileExtension
Definition: commdlg.h:344
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define IDS_SAVE_AS
Definition: cdlg.h:177
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPSTR lpstrFileTitle
Definition: commdlg.h:338
LPCWSTR lpstrInitialDir
Definition: commdlg.h:371
#define open
Definition: acwin.h:95
HWND hwndOwner
Definition: commdlg.h:330
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LPSTR lpstrCustomFilter
Definition: commdlg.h:333
DWORD nMaxFileTitle
Definition: commdlg.h:370
LPWSTR lpstrFile
Definition: commdlg.h:367
LPCSTR lpstrDefExt
Definition: commdlg.h:345
LPCSTR lpTemplateName
Definition: commdlg.h:348
#define lstrlenW
Definition: compat.h:415
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
DWORD lStructSize
Definition: commdlg.h:360
DWORD nMaxFile
Definition: commdlg.h:337
WORD nFileExtension
Definition: commdlg.h:375
LPCWSTR lpstrDefExt
Definition: commdlg.h:376
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
WORD nFileOffset
Definition: commdlg.h:374
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
HINSTANCE hInstance
Definition: commdlg.h:331
LPCWSTR lpTemplateName
Definition: commdlg.h:379
DWORD nFilterIndex
Definition: commdlg.h:366
static LPWSTR FD31_DupToW(LPCSTR str, DWORD size)
Definition: filedlg31.c:742
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPCWSTR lpstrTitle
Definition: commdlg.h:372
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
DWORD nMaxFile
Definition: commdlg.h:368
DWORD nMaxCustFilter
Definition: commdlg.h:334
#define IDS_OPEN_FILE
Definition: cdlg.h:178
HWND hwndOwner
Definition: commdlg.h:361
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
DWORD nMaxCustFilter
Definition: commdlg.h:365
#define OPENFILENAME_SIZE_VERSION_400W
Definition: commdlg.h:397
LPSTR lpstrFile
Definition: commdlg.h:336
#define ARRAY_SIZE(a)
Definition: main.h:24
LPCSTR lpstrFilter
Definition: commdlg.h:332
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
LPCSTR lpstrTitle
Definition: commdlg.h:341
LPWSTR lpstrCustomFilter
Definition: commdlg.h:364
static LPWSTR FD31_MapStringPairsToW(LPCSTR strA, UINT size)
Definition: filedlg31.c:718
DWORD nFilterIndex
Definition: commdlg.h:335
WCHAR * LPWSTR
Definition: xmlstorage.h:184
DWORD nMaxFileTitle
Definition: commdlg.h:339
WORD nFileOffset
Definition: commdlg.h:343
DWORD Flags
Definition: commdlg.h:342

Referenced by FD31_AllocPrivate().

◆ FD31_MapStringPairsToW()

static LPWSTR FD31_MapStringPairsToW ( LPCSTR  strA,
UINT  size 
)
static

Definition at line 718 of file filedlg31.c.

719 {
720  LPCSTR s;
721  LPWSTR x;
722  unsigned int n, len;
723 
724  s = strA;
725  while (*s)
726  s = s+strlen(s)+1;
727  s++;
728  n = s + 1 - strA; /* Don't forget the other \0 */
729  if (n < size) n = size;
730 
731  len = MultiByteToWideChar( CP_ACP, 0, strA, n, NULL, 0 );
732  x = heap_alloc(len * sizeof(WCHAR));
733  MultiByteToWideChar( CP_ACP, 0, strA, n, x, len );
734  return x;
735 }
char strA[12]
Definition: clipboard.c:2028
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:99
GLdouble n
Definition: glext.h:7729
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FD31_MapOfnStructA().

◆ FD31_ScanDir()

static BOOL FD31_ScanDir ( const OPENFILENAMEW ofn,
HWND  hWnd,
LPCWSTR  newPath 
)
static

Definition at line 176 of file filedlg31.c.

177 {
179  HWND hdlg;
180  LRESULT lRet = TRUE;
181  HCURSOR hCursorWait, oldCursor;
182 
183  TRACE("Trying to change to %s\n", debugstr_w(newPath));
184  if ( newPath[0] && !SetCurrentDirectoryW( newPath ))
185  return FALSE;
186 
187  /* get the list of spec files */
190 
191  hCursorWait = LoadCursorA(0, (LPSTR)IDC_WAIT);
192  oldCursor = SetCursor(hCursorWait);
193 
194  /* list of files */
195  if ((hdlg = GetDlgItem(hWnd, lst1)) != 0) {
196  WCHAR* scptr; /* ptr on semi-colon */
197  WCHAR* filter = buffer;
198 
199  TRACE("Using filter %s\n", debugstr_w(filter));
200  SendMessageW(hdlg, LB_RESETCONTENT, 0, 0);
201  while (filter) {
202  scptr = wcschr(filter, ';');
203  if (scptr) *scptr = 0;
204  while (*filter == ' ') filter++;
205  TRACE("Using file spec %s\n", debugstr_w(filter));
206  SendMessageW(hdlg, LB_DIR, 0, (LPARAM)filter);
207  if (scptr) *scptr = ';';
208  filter = (scptr) ? (scptr + 1) : 0;
209  }
210  }
211 
212  /* list of directories */
214 
215  if (GetDlgItem(hWnd, lst2) != 0) {
217  }
218  SetCursor(oldCursor);
219  return lRet;
220 }
#define TRUE
Definition: types.h:120
#define LB_DIR
Definition: winuser.h:2015
LPSTR lpstrCustomFilter
Definition: commdlg.h:333
#define BUFFILE
Definition: filedlg31.c:43
HWND hWnd
Definition: settings.c:17
OPENFILENAME ofn
Definition: main.cpp:37
#define DDL_DIRECTORY
Definition: winuser.h:422
GLuint buffer
Definition: glext.h:5915
static LPCWSTR FD31_GetFileType(LPCWSTR cfptr, LPCWSTR fptr, const WORD index)
Definition: filedlg31.c:150
HICON HCURSOR
Definition: windef.h:299
char * LPSTR
Definition: xmlstorage.h:182
#define lstrcpynW
Definition: compat.h:405
#define LB_RESETCONTENT
Definition: winuser.h:2037
#define debugstr_w
Definition: kernel32.h:32
static const WCHAR FILE_star[]
Definition: filedlg31.c:46
#define IDC_WAIT
Definition: winuser.h:684
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define lst1
Definition: dlgs.h:95
int WINAPI DlgDirListW(_In_ HWND, _Inout_ LPWSTR, _In_ int, _In_ int, _In_ UINT)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
#define lst2
Definition: dlgs.h:96
#define lstrcpyW
Definition: compat.h:414
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2248
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define stc1
Definition: dlgs.h:160
DWORD nFilterIndex
Definition: commdlg.h:335
LONG_PTR LRESULT
Definition: windef.h:209
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define DDL_EXCLUSIVE
Definition: winuser.h:426

Referenced by FD31_DirListDblClick(), FD31_TestPath(), and FD31_WMInitDialog().

◆ FD31_StripEditControl()

static void FD31_StripEditControl ( HWND  hwnd)
static

Definition at line 104 of file filedlg31.c.

105 {
106  WCHAR temp[BUFFILE], *cp;
107 
109  cp = wcsrchr(temp, '\\');
110  if (cp != NULL) {
111  lstrcpyW(temp, cp+1);
112  }
113  cp = wcsrchr(temp, ':');
114  if (cp != NULL) {
115  lstrcpyW(temp, cp+1);
116  }
117  /* FIXME: shouldn't we do something with the result here? ;-) */
118 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2265
#define BUFFILE
Definition: filedlg31.c:43
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define edt1
Definition: dlgs.h:65
#define lstrcpyW
Definition: compat.h:414
static calc_node_t temp
Definition: rpn_ieee.c:38
#define ARRAY_SIZE(a)
Definition: main.h:24
POINT cp
Definition: magnifier.c:59

Referenced by FD31_DiskChange(), and FD31_WMCommand().

◆ FD31_TestPath()

static LRESULT FD31_TestPath ( const FD31_DATA lfs,
LPWSTR  path 
)
static

Definition at line 482 of file filedlg31.c.

483 {
484  HWND hWnd = lfs->hwnd;
485  LPWSTR pBeginFileName, pstr2;
486  WCHAR tmpstr2[BUFFILE];
487 
488  pBeginFileName = wcsrchr(path, '\\');
489  if (pBeginFileName == NULL)
490  pBeginFileName = wcsrchr(path, ':');
491 
492  if (wcschr(path,'*') != NULL || wcschr(path,'?') != NULL)
493  {
494  /* edit control contains wildcards */
495  if (pBeginFileName != NULL)
496  {
497  lstrcpynW(tmpstr2, pBeginFileName + 1, BUFFILE);
498  *(pBeginFileName + 1) = 0;
499  }
500  else
501  {
502  lstrcpyW(tmpstr2, path);
503  if(!(lfs->ofnW->Flags & OFN_NOVALIDATE))
504  *path = 0;
505  }
506 
507  TRACE("path=%s, tmpstr2=%s\n", debugstr_w(path), debugstr_w(tmpstr2));
508  SetDlgItemTextW( hWnd, edt1, tmpstr2 );
509  FD31_ScanDir(lfs->ofnW, hWnd, path);
510  return (lfs->ofnW->Flags & OFN_NOVALIDATE) != 0;
511  }
512 
513  /* no wildcards, we might have a directory or a filename */
514  /* try appending a wildcard and reading the directory */
515 
516  pstr2 = path + lstrlenW(path);
517  if (pBeginFileName == NULL || *(pBeginFileName + 1) != 0)
519 
520  /* if ScanDir succeeds, we have changed the directory */
521  if (FD31_ScanDir(lfs->ofnW, hWnd, path))
522  return FALSE; /* and path is not a valid file name */
523 
524  /* if not, this must be a filename */
525 
526  *pstr2 = 0; /* remove the wildcard added before */
527 
528  if (pBeginFileName != NULL)
529  {
530  /* strip off the pathname */
531  *pBeginFileName = 0;
532  SetDlgItemTextW( hWnd, edt1, pBeginFileName + 1 );
533 
534  lstrcpynW(tmpstr2, pBeginFileName + 1, ARRAY_SIZE(tmpstr2));
535  /* Should we MessageBox() if this fails? */
536  if (!FD31_ScanDir(lfs->ofnW, hWnd, path))
537  {
538  return FALSE;
539  }
540  lstrcpyW(path, tmpstr2);
541  }
542  else
544  return TRUE;
545 }
DWORD Flags
Definition: commdlg.h:373
#define TRUE
Definition: types.h:120
#define BUFFILE
Definition: filedlg31.c:43
HWND hWnd
Definition: settings.c:17
#define lstrlenW
Definition: compat.h:415
#define lstrcpynW
Definition: compat.h:405
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
static const WCHAR FILE_bslash[]
Definition: filedlg31.c:47
#define TRACE(s)
Definition: solgame.cpp:4
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define edt1
Definition: dlgs.h:65
static BOOL FD31_ScanDir(const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath)
Definition: filedlg31.c:176
#define lstrcpyW
Definition: compat.h:414
#define ARRAY_SIZE(a)
Definition: main.h:24
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:70
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define OFN_NOVALIDATE
Definition: commdlg.h:115
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FD31_Validate().

◆ FD31_UpdateFileTitle()

static void FD31_UpdateFileTitle ( const FD31_DATA lfs)
static

Definition at line 388 of file filedlg31.c.

389 {
390  LONG lRet;
391  LPOPENFILENAMEW ofnW = lfs->ofnW;
392  LPOPENFILENAMEA ofnA = lfs->ofnA;
393 
394  if (ofnW->lpstrFileTitle != NULL)
395  {
396  lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0);
398  (LPARAM)ofnW->lpstrFileTitle );
399  if (ofnA)
400  {
401  if (!WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFileTitle, -1,
402  ofnA->lpstrFileTitle, ofnA->nMaxFileTitle, NULL, NULL ))
403  ofnA->lpstrFileTitle[ofnA->nMaxFileTitle-1] = 0;
404  }
405  }
406 }
#define WideCharToMultiByte
Definition: compat.h:101
LPSTR lpstrFileTitle
Definition: commdlg.h:338
#define CP_ACP
Definition: compat.h:99
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:72
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define lst1
Definition: dlgs.h:95
#define LB_GETTEXT
Definition: winuser.h:2031
#define LB_GETCURSEL
Definition: winuser.h:2021
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:70
DWORD nMaxFileTitle
Definition: commdlg.h:339

Referenced by FD31_Validate().

◆ FD31_UpdateResult()

static void FD31_UpdateResult ( const FD31_DATA lfs,
const WCHAR tmpstr 
)
static

Definition at line 331 of file filedlg31.c.

332 {
333  int lenstr2;
334  LPOPENFILENAMEW ofnW = lfs->ofnW;
335  LPOPENFILENAMEA ofnA = lfs->ofnA;
336  WCHAR tmpstr2[BUFFILE];
337  WCHAR *p;
338 
339  TRACE("%s\n", debugstr_w(tmpstr));
340  if(ofnW->Flags & OFN_NOVALIDATE)
341  tmpstr2[0] = '\0';
342  else
343  GetCurrentDirectoryW(BUFFILE, tmpstr2);
344  lenstr2 = lstrlenW(tmpstr2);
345  if (lenstr2 > 3)
346  tmpstr2[lenstr2++]='\\';
347  lstrcpynW(tmpstr2+lenstr2, tmpstr, BUFFILE-lenstr2);
348  if (!ofnW->lpstrFile)
349  return;
350 
351  lstrcpynW(ofnW->lpstrFile, tmpstr2, ofnW->nMaxFile);
352 
353  /* set filename offset */
354  p = PathFindFileNameW(ofnW->lpstrFile);
355  ofnW->nFileOffset = (p - ofnW->lpstrFile);
356 
357  /* set extension offset */
358  p = PathFindExtensionW(ofnW->lpstrFile);
359  ofnW->nFileExtension = (*p) ? (p - ofnW->lpstrFile) + 1 : 0;
360 
361  TRACE("file %s, file offset %d, ext offset %d\n",
362  debugstr_w(ofnW->lpstrFile), ofnW->nFileOffset, ofnW->nFileExtension);
363 
364  /* update the real client structures if any */
365  if (ofnA)
366  {
367  LPSTR lpszTemp;
368  if (ofnW->nMaxFile &&
369  !WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFile, -1,
370  ofnA->lpstrFile, ofnA->nMaxFile, NULL, NULL ))
371  ofnA->lpstrFile[ofnA->nMaxFile-1] = 0;
372 
373  /* offsets are not guaranteed to be the same in WCHAR to MULTIBYTE conversion */
374  /* set filename offset */
375  lpszTemp = PathFindFileNameA(ofnA->lpstrFile);
376  ofnA->nFileOffset = (lpszTemp - ofnA->lpstrFile);
377 
378  /* set extension offset */
379  lpszTemp = PathFindExtensionA(ofnA->lpstrFile);
380  ofnA->nFileExtension = (*lpszTemp) ? (lpszTemp - ofnA->lpstrFile) + 1 : 0;
381  }
382 }
DWORD Flags
Definition: commdlg.h:373
WORD nFileExtension
Definition: commdlg.h:344
#define WideCharToMultiByte
Definition: compat.h:101
#define BUFFILE
Definition: filedlg31.c:43
#define CP_ACP
Definition: compat.h:99
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:72
LPWSTR lpstrFile
Definition: commdlg.h:367
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:421
char * LPSTR
Definition: xmlstorage.h:182
#define lstrlenW
Definition: compat.h:415
#define lstrcpynW
Definition: compat.h:405
DWORD nMaxFile
Definition: commdlg.h:337
WORD nFileExtension
Definition: commdlg.h:375
#define debugstr_w
Definition: kernel32.h:32
WORD nFileOffset
Definition: commdlg.h:374
smooth NULL
Definition: ftsmooth.c:416
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:389
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:442
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD nMaxFile
Definition: commdlg.h:368
LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath)
Definition: path.c:417
LPSTR lpstrFile
Definition: commdlg.h:336
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:70
#define OFN_NOVALIDATE
Definition: commdlg.h:115
LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath)
Definition: path.c:368
GLfloat GLfloat p
Definition: glext.h:8902
WORD nFileOffset
Definition: commdlg.h:343

Referenced by FD31_Validate().

◆ FD31_Validate()

static LRESULT FD31_Validate ( const FD31_DATA lfs,
LPCWSTR  path,
UINT  control,
INT  itemIndex,
BOOL  internalUse 
)
static

Definition at line 551 of file filedlg31.c.

553 {
554  LONG lRet;
555  HWND hWnd = lfs->hwnd;
556  OPENFILENAMEW ofnsav;
557  LPOPENFILENAMEW ofnW = lfs->ofnW;
559  int copied_size = min( ofnW->lStructSize, sizeof(ofnsav) );
560 
561  memcpy( &ofnsav, ofnW, copied_size ); /* for later restoring */
562 
563  /* get current file name */
564  if (path)
566  else
568 
569  TRACE("got filename = %s\n", debugstr_w(filename));
570  /* if we did not click in file list to get there */
571  if (control != lst1)
572  {
573  if (!FD31_TestPath( lfs, filename) )
574  return FALSE;
575  }
577 
578  if (internalUse)
579  { /* called internally after a change in a combo */
580  if (lfs->hook)
581  {
582  FD31_CallWindowProc(lfs, lfs->lbselchstring, control,
583  MAKELONG(itemIndex,CD_LBSELCHANGE));
584  }
585  return TRUE;
586  }
587 
589  if (lfs->hook)
590  {
591  lRet = FD31_CallWindowProc(lfs, lfs->fileokstring,
592  0, lfs->lParam );
593  if (lRet)
594  {
595  memcpy( ofnW, &ofnsav, copied_size ); /* restore old state */
596  return FALSE;
597  }
598  }
599  if ((ofnW->Flags & OFN_ALLOWMULTISELECT) && (ofnW->Flags & OFN_EXPLORER))
600  {
601  if (ofnW->lpstrFile)
602  {
603  LPWSTR str = ofnW->lpstrFile;
604  LPWSTR ptr = wcsrchr(str, '\\');
605  str[lstrlenW(str) + 1] = '\0';
606  *ptr = 0;
607  }
608  }
609  return TRUE;
610 }
#define OFN_EXPLORER
Definition: commdlg.h:104
DWORD Flags
Definition: commdlg.h:373
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2265
#define TRUE
Definition: types.h:120
#define BUFFILE
Definition: filedlg31.c:43
UINT lbselchstring
Definition: filedlg31.c:65
LPWSTR lpstrFile
Definition: commdlg.h:367
static void FD31_UpdateFileTitle(const FD31_DATA *lfs)
Definition: filedlg31.c:388
HWND hWnd
Definition: settings.c:17
#define OFN_ALLOWMULTISELECT
Definition: commdlg.h:96
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:415
DWORD lStructSize
Definition: commdlg.h:360
#define lstrcpynW
Definition: compat.h:405
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
const WCHAR * str
#define MAKELONG(a, b)
Definition: typedefs.h:248
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define edt1
Definition: dlgs.h:65
#define lst1
Definition: dlgs.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:125
#define ARRAY_SIZE(a)
Definition: main.h:24
LPARAM lParam
Definition: filedlg31.c:67
#define min(a, b)
Definition: monoChain.cc:55
UINT fileokstring
Definition: filedlg31.c:66
static LRESULT FD31_TestPath(const FD31_DATA *lfs, LPWSTR path)
Definition: filedlg31.c:482
static void FD31_UpdateResult(const FD31_DATA *lfs, const WCHAR *tmpstr)
Definition: filedlg31.c:331
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:70
#define CD_LBSELCHANGE
Definition: commdlg.h:196
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FD31_DiskChange(), FD31_FileTypeChange(), and FD31_WMCommand().

◆ FD31_WMCommand()

static LRESULT FD31_WMCommand ( HWND  hWnd,
LPARAM  lParam,
UINT  notification,
UINT  control,
const FD31_DATA lfs 
)
static

Definition at line 660 of file filedlg31.c.

662 {
663  switch (control)
664  {
665  case lst1: /* file list */
667  if (notification == LBN_DBLCLK)
668  {
669  return SendMessageW(hWnd, WM_COMMAND, IDOK, 0);
670  }
671  else if (notification == LBN_SELCHANGE)
672  return FD31_FileListSelect( lfs );
673  break;
674 
675  case lst2: /* directory list */
677  if (notification == LBN_DBLCLK)
678  return FD31_DirListDblClick( lfs );
679  break;
680 
681  case cmb1: /* file type drop list */
683  return FD31_FileTypeChange( lfs );
684  break;
685 
686  case chx1:
687  break;
688 
689  case pshHelp:
690  break;
691 
692  case cmb2: /* disk dropdown combo */
694  return FD31_DiskChange( lfs );
695  break;
696 
697  case IDOK:
698  TRACE("OK pressed\n");
699  if (FD31_Validate( lfs, NULL, control, 0, FALSE ))
700  EndDialog(hWnd, TRUE);
701  return TRUE;
702 
703  case IDCANCEL:
704  EndDialog(hWnd, FALSE);
705  return TRUE;
706 
707  case IDABORT: /* can be sent by the hook procedure */
708  EndDialog(hWnd, TRUE);
709  return TRUE;
710  }
711  return FALSE;
712 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
static void FD31_StripEditControl(HWND hwnd)
Definition: filedlg31.c:104
#define IDABORT
Definition: winuser.h:826
static LRESULT FD31_DiskChange(const FD31_DATA *lfs)
Definition: filedlg31.c:616
HWND hWnd
Definition: settings.c:17
static LRESULT FD31_DirListDblClick(const FD31_DATA *lfs)
Definition: filedlg31.c:411
#define LBN_SELCHANGE
Definition: winuser.h:2057
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define chx1
Definition: dlgs.h:31
smooth NULL
Definition: ftsmooth.c:416
static LRESULT FD31_FileListSelect(const FD31_DATA *lfs)
Definition: filedlg31.c:449
#define TRACE(s)
Definition: solgame.cpp:4
static LRESULT FD31_Validate(const FD31_DATA *lfs, LPCWSTR path, UINT control, INT itemIndex, BOOL internalUse)
Definition: filedlg31.c:551
static LRESULT FD31_FileTypeChange(const FD31_DATA *lfs)
Definition: filedlg31.c:640
#define LBN_DBLCLK
Definition: winuser.h:2053
#define lst1
Definition: dlgs.h:95
#define WM_COMMAND
Definition: winuser.h:1722
#define cmb2
Definition: dlgs.h:49
#define lst2
Definition: dlgs.h:96
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define pshHelp
Definition: dlgs.h:127
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define IDCANCEL
Definition: winuser.h:825
#define cmb1
Definition: dlgs.h:48

Referenced by FD31_FileOpenDlgProc().

◆ FD31_WMDrawItem()

static LONG FD31_WMDrawItem ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam,
int  savedlg,
const DRAWITEMSTRUCT lpdis 
)
static

Definition at line 225 of file filedlg31.c.

227 {
228  WCHAR *str;
229  HICON hIcon;
230  COLORREF oldText = 0, oldBk = 0;
231 
232  if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst1)
233  {
234  if (!(str = heap_alloc(BUFFILEALLOC))) return FALSE;
235  SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
236  (LPARAM)str);
237 
238  if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
239  {
240  oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
241  oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
242  }
243  if (savedlg)
245 
246  ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + 1,
247  lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
248  &(lpdis->rcItem), str, lstrlenW(str), NULL);
249 
250  if (lpdis->itemState & ODS_SELECTED)
251  DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );
252 
253  if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
254  {
255  SetBkColor( lpdis->hDC, oldBk );
256  SetTextColor( lpdis->hDC, oldText );
257  }
258  heap_free(str);
259  return TRUE;
260  }
261 
262  if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst2)
263  {
264  if (!(str = heap_alloc(BUFFILEALLOC)))
265  return FALSE;
266  SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
267  (LPARAM)str);
268 
269  if (lpdis->itemState & ODS_SELECTED)
270  {
271  oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
272  oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
273  }
274  ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
275  lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
276  &(lpdis->rcItem), str, lstrlenW(str), NULL);
277 
278  if (lpdis->itemState & ODS_SELECTED)
279  DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );
280 
281  if (lpdis->itemState & ODS_SELECTED)
282  {
283  SetBkColor( lpdis->hDC, oldBk );
284  SetTextColor( lpdis->hDC, oldText );
285  }
286  DrawIconEx( lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hFolder, 16, 16, 0, 0, DI_NORMAL );
287  heap_free(str);
288  return TRUE;
289  }
290  if (lpdis->CtlType == ODT_COMBOBOX && lpdis->CtlID == cmb2)
291  {
292  char root[] = "a:";
293  if (!(str = heap_alloc(BUFFILEALLOC)))
294  return FALSE;
295  SendMessageW(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID,
296  (LPARAM)str);
297  root[0] += str[2] - 'a';
298  switch(GetDriveTypeA(root))
299  {
300  case DRIVE_REMOVABLE: hIcon = hFloppy; break;
301  case DRIVE_CDROM: hIcon = hCDRom; break;
302  case DRIVE_REMOTE: hIcon = hNet; break;
303  case DRIVE_FIXED:
304  default: hIcon = hHDisk; break;
305  }
306  if (lpdis->itemState & ODS_SELECTED)
307  {
308  oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
309  oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
310  }
311  ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
312  lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
313  &(lpdis->rcItem), str, lstrlenW(str), NULL);
314 
315  if (lpdis->itemState & ODS_SELECTED)
316  {
317  SetBkColor( lpdis->hDC, oldBk );
318  SetTextColor( lpdis->hDC, oldText );
319  }
320  DrawIconEx( lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hIcon, 16, 16, 0, 0, DI_NORMAL );
321  heap_free(str);
322  return TRUE;
323  }
324  return FALSE;
325 }
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
static HICON hHDisk
Definition: filedlg31.c:55
static const int fldrWidth
Definition: filedlg31.c:50
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
#define ODT_COMBOBOX
Definition: winuser.h:2514
#define CB_GETLBTEXT
Definition: winuser.h:1934
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define lstrlenW
Definition: compat.h:415
DWORD WINAPI GetSysColor(_In_ int)
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define DRIVE_REMOVABLE
Definition: winbase.h:248
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
#define DRIVE_REMOTE
Definition: winbase.h:250
#define ETO_OPAQUE
Definition: wingdi.h:646
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
static HICON hCDRom
Definition: filedlg31.c:56
#define ETO_CLIPPED
Definition: wingdi.h:647
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:917
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:1997
DWORD COLORREF
Definition: windef.h:300
static HICON hFolder
Definition: filedlg31.c:52
#define lst1
Definition: dlgs.h:95
#define COLOR_GRAYTEXT
Definition: winuser.h:922
#define LB_GETTEXT
Definition: winuser.h:2031
#define DI_NORMAL
Definition: wingdi.h:72
#define DRIVE_FIXED
Definition: winbase.h:249
static HICON hFloppy
Definition: filedlg31.c:54
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define cmb2
Definition: dlgs.h:49
static HICON hNet
Definition: filedlg31.c:57
#define lst2
Definition: dlgs.h:96
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DRIVE_CDROM
Definition: winbase.h:251
#define ODT_LISTBOX
Definition: winuser.h:2513
#define ODS_SELECTED
Definition: winuser.h:2520
#define BUFFILEALLOC
Definition: filedlg31.c:44
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FD31_FileOpenDlgProc().

◆ FD31_WMInitDialog()

static LONG FD31_WMInitDialog ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 961 of file filedlg31.c.

962 {
963  int i, n;
964  WCHAR tmpstr[BUFFILE];
965  LPWSTR pstr, old_pstr;
967  PFD31_DATA lfs = (PFD31_DATA) lParam;
968 
969  if (!lfs) return FALSE;
970  SetPropA(hWnd, FD31_OFN_PROP, lfs);
971  lfs->hwnd = hWnd;
972  ofn = lfs->ofnW;
973 
974  TRACE("flags=%x initialdir=%s\n", ofn->Flags, debugstr_w(ofn->lpstrInitialDir));
975 
977  /* read custom filter information */
978  if (ofn->lpstrCustomFilter)
979  {
980  pstr = ofn->lpstrCustomFilter;
981  n = 0;
982  TRACE("lpstrCustomFilter = %p\n", pstr);
983  while(*pstr)
984  {
985  old_pstr = pstr;
987  (LPARAM)(ofn->lpstrCustomFilter) + n );
988  n += lstrlenW(pstr) + 1;
989  pstr += lstrlenW(pstr) + 1;
990  TRACE("add str=%s associated to %s\n",
991  debugstr_w(old_pstr), debugstr_w(pstr));
993  n += lstrlenW(pstr) + 1;
994  pstr += lstrlenW(pstr) + 1;
995  }
996  }
997  /* read filter information */
998  if (ofn->lpstrFilter) {
999  pstr = (LPWSTR) ofn->lpstrFilter;
1000  n = 0;
1001  while(*pstr) {
1002  old_pstr = pstr;
1004  (LPARAM)(ofn->lpstrFilter + n) );
1005  n += lstrlenW(pstr) + 1;
1006  pstr += lstrlenW(pstr) + 1;
1007  TRACE("add str=%s associated to %s\n",
1008  debugstr_w(old_pstr), debugstr_w(pstr));
1010  n += lstrlenW(pstr) + 1;
1011  pstr += lstrlenW(pstr) + 1;
1012  }
1013  }
1014  /* set default filter */
1015  if (ofn->nFilterIndex == 0 && ofn->lpstrCustomFilter == NULL)
1016  ofn->nFilterIndex = 1;
1018  if (ofn->lpstrFile && ofn->lpstrFile[0])
1019  {
1020  TRACE( "SetText of edt1 to %s\n", debugstr_w(ofn->lpstrFile) );
1022  }
1023  else
1024  {
1027  TRACE("nFilterIndex = %d, SetText of edt1 to %s\n",
1028  ofn->nFilterIndex, debugstr_w(tmpstr));
1029  SetDlgItemTextW( hWnd, edt1, tmpstr );
1030  }
1031  /* get drive list */
1032  *tmpstr = 0;
1034  /* read initial directory */
1035  /* FIXME: Note that this is now very version-specific (See MSDN description of
1036  * the OPENFILENAME structure). For example under 2000/XP any path in the
1037  * lpstrFile overrides the lpstrInitialDir, but not under 95/98/ME
1038  */
1039  if (ofn->lpstrInitialDir != NULL)
1040  {
1041  int len;
1042  lstrcpynW(tmpstr, ofn->lpstrInitialDir, 511);
1043  len = lstrlenW(tmpstr);
1044  if (len > 0 && tmpstr[len-1] != '\\' && tmpstr[len-1] != ':') {
1045  tmpstr[len]='\\';
1046  tmpstr[len+1]='\0';
1047  }
1048  }
1049  else
1050  *tmpstr = 0;
1051  if (!FD31_ScanDir(ofn, hWnd, tmpstr)) {
1052  *tmpstr = 0;
1053  if (!FD31_ScanDir(ofn, hWnd, tmpstr))
1054  WARN("Couldn't read initial directory %s!\n", debugstr_w(tmpstr));
1055  }
1056  /* select current drive in combo 2, omit missing drives */
1057  {
1058  char dir[MAX_PATH];
1059  char str[4] = "a:\\";
1060  GetCurrentDirectoryA( sizeof(dir), dir );
1061  for(i = 0, n = -1; i < 26; i++)
1062  {
1063  str[0] = 'a' + i;
1065  if (toupper(str[0]) == toupper(dir[0])) break;
1066  }
1067  }
1069  if (!(ofn->Flags & OFN_SHOWHELP))
1071  if (ofn->Flags & OFN_HIDEREADONLY)
1073  if (lfs->hook)
1074  return FD31_CallWindowProc(lfs, WM_INITDIALOG, wParam, lfs->lParam);
1075  return TRUE;
1076 }
#define CB_SETITEMDATA
Definition: winuser.h:1948
#define TRUE
Definition: types.h:120
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
LPSTR lpstrCustomFilter
Definition: commdlg.h:333
#define BUFFILE
Definition: filedlg31.c:43
#define SW_HIDE
Definition: winuser.h:762
int WINAPI DlgDirListComboBoxW(_In_ HWND, _Inout_ LPWSTR, _In_ int, _In_ int, _In_ UINT)
#define WARN(fmt,...)
Definition: debug.h:111
HWND hWnd
Definition: settings.c:17
GLdouble n
Definition: glext.h:7729
OPENFILENAME ofn
Definition: main.cpp:37
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
static LPCWSTR FD31_GetFileType(LPCWSTR cfptr, LPCWSTR fptr, const WORD index)
Definition: filedlg31.c:150
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define lstrlenW
Definition: compat.h:415
WPARAM wParam
Definition: combotst.c:138
#define lstrcpynW
Definition: compat.h:405
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
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
#define chx1
Definition: dlgs.h:31
#define debugstr_w
Definition: kernel32.h:32
#define CB_ADDSTRING
Definition: winuser.h:1918
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
unsigned int dir
Definition: maze.c:112
int toupper(int c)
Definition: utclib.c:881
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
#define MAX_PATH
Definition: compat.h:26
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define edt1
Definition: dlgs.h:65
static BOOL FD31_ScanDir(const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath)
Definition: filedlg31.c:176
#define DDL_DRIVES
Definition: winuser.h:425
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
GLenum GLsizei len
Definition: glext.h:6722
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define CB_SETCURSEL
Definition: winuser.h:1943
#define DRIVE_NO_ROOT_DIR
Definition: winbase.h:254
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:125
#define cmb2
Definition: dlgs.h:49
LPSTR lpstrFile
Definition: commdlg.h:336
LPARAM lParam
Definition: filedlg31.c:67
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define pshHelp
Definition: dlgs.h:127
LPCSTR lpstrTitle
Definition: commdlg.h:341
#define FD31_OFN_PROP
Definition: filedlg31.c:59
struct tagFD31_DATA * PFD31_DATA
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:70
DWORD nFilterIndex
Definition: commdlg.h:335
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define cmb1
Definition: dlgs.h:48
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define DDL_EXCLUSIVE
Definition: winuser.h:426
#define OFN_SHOWHELP
Definition: commdlg.h:120
DWORD Flags
Definition: commdlg.h:342

Referenced by FD31_FileOpenDlgProc().

◆ FD31_WMMeasureItem()

static LONG FD31_WMMeasureItem ( LPARAM  lParam)
static

Definition at line 1086 of file filedlg31.c.

1087 {
1088  LPMEASUREITEMSTRUCT lpmeasure;
1089 
1090  lpmeasure = (LPMEASUREITEMSTRUCT)lParam;
1091  lpmeasure->itemHeight = FD31_GetFldrHeight();
1092  return TRUE;
1093 }
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
#define TRUE
Definition: types.h:120
static int FD31_GetFldrHeight(void)
Definition: filedlg31.c:1078
LPARAM lParam
Definition: combotst.c:139

Referenced by FD31_FileOpenDlgProc().

◆ GetFileName31A()

BOOL GetFileName31A ( OPENFILENAMEA lpofn,
UINT  dlgType 
)

Definition at line 1148 of file filedlg31.c.

1149 {
1150  BOOL bRet = FALSE;
1151  PFD31_DATA lfs;
1152 
1153  if (!lpofn || !FD31_Init()) return FALSE;
1154 
1155  TRACE("ofn flags %08x\n", lpofn->Flags);
1156  lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, FALSE);
1157  if (lfs)
1158  {
1161  FD31_DestroyPrivate(lfs);
1162  }
1163 
1164  TRACE("return lpstrFile='%s' !\n", lpofn->lpstrFile);
1165  return bRet;
1166 }
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
HWND hwndOwner
Definition: commdlg.h:330
static PFD31_DATA FD31_AllocPrivate(LPARAM lParam, UINT dlgType, BOOL IsUnicode)
Definition: filedlg31.c:918
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
static void FD31_DestroyPrivate(PFD31_DATA lfs)
Definition: filedlg31.c:835
static BOOL FD31_Init(void)
Definition: filedlg31.c:78
INT_PTR WINAPI DialogBoxIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
LPSTR lpstrFile
Definition: commdlg.h:336
LPCVOID template
Definition: filedlg31.c:68
static INT_PTR CALLBACK FD31_FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:1100
DWORD Flags
Definition: commdlg.h:342

Referenced by GetOpenFileNameA(), and GetSaveFileNameA().

◆ GetFileName31W()

BOOL GetFileName31W ( OPENFILENAMEW lpofn,
UINT  dlgType 
)

Definition at line 1173 of file filedlg31.c.

1174 {
1175  BOOL bRet = FALSE;
1176  PFD31_DATA lfs;
1177 
1178  if (!lpofn || !FD31_Init()) return FALSE;
1179 
1180  lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, TRUE);
1181  if (lfs)
1182  {
1185  FD31_DestroyPrivate(lfs);
1186  }
1187 
1188  TRACE("file %s, file offset %d, ext offset %d\n",
1189  debugstr_w(lpofn->lpstrFile), lpofn->nFileOffset, lpofn->nFileExtension);
1190  return bRet;
1191 }
#define TRUE
Definition: types.h:120
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
static PFD31_DATA FD31_AllocPrivate(LPARAM lParam, UINT dlgType, BOOL IsUnicode)
Definition: filedlg31.c:918
LPWSTR lpstrFile
Definition: commdlg.h:367
WORD nFileExtension
Definition: commdlg.h:375
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
WORD nFileOffset
Definition: commdlg.h:374
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
static void FD31_DestroyPrivate(PFD31_DATA lfs)
Definition: filedlg31.c:835
static BOOL FD31_Init(void)
Definition: filedlg31.c:78
HWND hwndOwner
Definition: commdlg.h:361
LPCVOID template
Definition: filedlg31.c:68
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
static INT_PTR CALLBACK FD31_FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:1100

Referenced by GetOpenFileNameW(), and GetSaveFileNameW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( commdlg  )

Variable Documentation

◆ FILE_bslash

const WCHAR FILE_bslash[] = {'\\', 0}
static

Definition at line 47 of file filedlg31.c.

Referenced by FD31_DirListDblClick(), and FD31_TestPath().

◆ FILE_specc

const WCHAR FILE_specc[] = {'%','c',':', 0}
static

Definition at line 48 of file filedlg31.c.

Referenced by FD31_DiskChange().

◆ FILE_star

const WCHAR FILE_star[] = {'*','.','*', 0}
static

Definition at line 46 of file filedlg31.c.

Referenced by FD31_GetFileType(), and FD31_ScanDir().

◆ fldrHeight

const int fldrHeight = 16
static

Definition at line 49 of file filedlg31.c.

Referenced by FD31_GetFldrHeight().

◆ fldrWidth

const int fldrWidth = 20
static

Definition at line 50 of file filedlg31.c.

Referenced by FD31_WMDrawItem().

◆ hCDRom

HICON hCDRom = 0
static

Definition at line 56 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hFloppy

HICON hFloppy = 0
static

Definition at line 54 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hFolder

HICON hFolder = 0
static

Definition at line 52 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hFolder2

HICON hFolder2 = 0
static

Definition at line 53 of file filedlg31.c.

Referenced by FD31_Init().

◆ hHDisk

HICON hHDisk = 0
static

Definition at line 55 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hNet

HICON hNet = 0
static

Definition at line 57 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().