ReactOS  0.4.13-dev-52-g0efcfec
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/unicode.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 44 of file filedlg31.c.

◆ BUFFILEALLOC

#define BUFFILEALLOC   512 * sizeof(WCHAR)

Definition at line 45 of file filedlg31.c.

◆ FD31_OFN_PROP

#define FD31_OFN_PROP   "FILEDLG_OFN"

Definition at line 60 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 919 of file filedlg31.c.

920 {
921  FD31_DATA *lfs = heap_alloc_zero(sizeof(*lfs));
922 
923  TRACE("alloc private buf %p\n", lfs);
924  if (!lfs) return NULL;
925  lfs->hook = FALSE;
926  lfs->lParam = lParam;
927  lfs->open = (dlgType == OPEN_DIALOG);
928 
929  if (IsUnicode)
930  {
931  lfs->ofnA = NULL;
932  lfs->ofnW = (LPOPENFILENAMEW) lParam;
933  if (lfs->ofnW->Flags & OFN_ENABLEHOOK)
934  if (lfs->ofnW->lpfnHook)
935  lfs->hook = TRUE;
936  }
937  else
938  {
939  lfs->ofnA = (LPOPENFILENAMEA) lParam;
940  if (lfs->ofnA->Flags & OFN_ENABLEHOOK)
941  if (lfs->ofnA->lpfnHook)
942  lfs->hook = TRUE;
943  lfs->ofnW = heap_alloc_zero(lfs->ofnA->lStructSize);
944  lfs->ofnW->lStructSize = lfs->ofnA->lStructSize;
945  FD31_MapOfnStructA(lfs->ofnA, lfs->ofnW, lfs->open);
946  }
947 
948  if (! FD31_GetTemplate(lfs))
949  {
950  FD31_DestroyPrivate(lfs);
951  return NULL;
952  }
955 
956  return lfs;
957 }
DWORD Flags
Definition: commdlg.h:373
static void FD31_MapOfnStructA(const OPENFILENAMEA *ofnA, LPOPENFILENAMEW ofnW, BOOL open)
Definition: filedlg31.c:758
#define FILEOKSTRINGA
Definition: commdlg.h:17
#define TRUE
Definition: types.h:120
struct tagOFNW * LPOPENFILENAMEW
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:73
UINT lbselchstring
Definition: filedlg31.c:66
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:836
LPARAM lParam
Definition: filedlg31.c:68
UINT fileokstring
Definition: filedlg31.c:67
static BOOL FD31_GetTemplate(PFD31_DATA lfs)
Definition: filedlg31.c:860
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:71
#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 126 of file filedlg31.c.

127 {
128  BOOL ret;
129 
130  if (lfs->ofnA)
131  {
132  TRACE("Call hookA %p (%p, %04x, %08lx, %08lx)\n",
133  lfs->ofnA->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
134  ret = lfs->ofnA->lpfnHook(lfs->hwnd, wMsg, wParam, lParam);
135  TRACE("ret hookA %p (%p, %04x, %08lx, %08lx)\n",
136  lfs->ofnA->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
137  return ret;
138  }
139 
140  TRACE("Call hookW %p (%p, %04x, %08lx, %08lx)\n",
141  lfs->ofnW->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
142  ret = lfs->ofnW->lpfnHook(lfs->hwnd, wMsg, wParam, lParam);
143  TRACE("Ret hookW %p (%p, %04x, %08lx, %08lx)\n",
144  lfs->ofnW->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
145  return ret;
146 }
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:73
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:71
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 836 of file filedlg31.c.

837 {
838  HWND hwnd;
839  if (!lfs) return;
840  hwnd = lfs->hwnd;
841  TRACE("destroying private allocation %p\n", lfs);
842 
843  /* if ofnW has been allocated, have to free everything in it */
844  if (lfs->ofnA)
845  {
846  FD31_FreeOfnW(lfs->ofnW);
847  heap_free(lfs->ofnW);
848  }
849  heap_free(lfs);
851 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HANDLE WINAPI RemovePropA(_In_ HWND, _In_ LPCSTR)
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:73
#define TRACE(s)
Definition: solgame.cpp:4
static void FD31_FreeOfnW(OPENFILENAMEW *ofnW)
Definition: filedlg31.c:820
#define FD31_OFN_PROP
Definition: filedlg31.c:60
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:71
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 412 of file filedlg31.c.

413 {
414  LONG lRet;
415  HWND hWnd = lfs->hwnd;
416  LPWSTR pstr;
417  WCHAR tmpstr[BUFFILE];
418 
419  /* get the raw string (with brackets) */
420  lRet = SendDlgItemMessageW(hWnd, lst2, LB_GETCURSEL, 0, 0);
421  if (lRet == LB_ERR) return TRUE;
422  pstr = heap_alloc(BUFFILEALLOC);
424  (LPARAM)pstr);
425  strcpyW( tmpstr, pstr );
426  heap_free(pstr);
427  /* get the selected directory in tmpstr */
428  if (tmpstr[0] == '[')
429  {
430  tmpstr[lstrlenW(tmpstr) - 1] = 0;
431  strcpyW(tmpstr,tmpstr+1);
432  }
433  strcatW(tmpstr, FILE_bslash);
434 
435  FD31_ScanDir(lfs->ofnW, hWnd, tmpstr);
436  /* notify the app */
437  if (lfs->hook)
438  {
439  if (FD31_CallWindowProc(lfs, lfs->lbselchstring, lst2,
440  MAKELONG(lRet,CD_LBSELCHANGE)))
441  return TRUE;
442  }
443  return TRUE;
444 }
#define TRUE
Definition: types.h:120
#define BUFFILE
Definition: filedlg31.c:44
UINT lbselchstring
Definition: filedlg31.c:66
HWND hWnd
Definition: settings.c:17
#define lstrlenW
Definition: compat.h:407
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define LB_ERR
Definition: winuser.h:2386
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:48
__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:177
#define LB_GETTEXT
Definition: winuser.h:2010
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:126
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define lst2
Definition: dlgs.h:96
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
#define LB_GETCURSEL
Definition: winuser.h:2000
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:71
#define CD_LBSELCHANGE
Definition: commdlg.h:196
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define BUFFILEALLOC
Definition: filedlg31.c:45
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 617 of file filedlg31.c.

618 {
619  LONG lRet;
620  HWND hWnd = lfs->hwnd;
621  LPWSTR pstr;
622  WCHAR diskname[BUFFILE];
623 
625  lRet = SendDlgItemMessageW(hWnd, cmb2, CB_GETCURSEL, 0, 0L);
626  if (lRet == LB_ERR)
627  return 0;
628  pstr = heap_alloc(BUFFILEALLOC);
630  (LPARAM)pstr);
631  wsprintfW(diskname, FILE_specc, pstr[2]);
632  heap_free(pstr);
633 
634  return FD31_Validate( lfs, diskname, cmb2, lRet, TRUE );
635 }
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:105
static const WCHAR FILE_specc[]
Definition: filedlg31.c:49
#define BUFFILE
Definition: filedlg31.c:44
#define CB_GETLBTEXT
Definition: winuser.h:1913
HWND hWnd
Definition: settings.c:17
#define CB_GETCURSEL
Definition: winuser.h:1904
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define LB_ERR
Definition: winuser.h:2386
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:552
__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:45
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 743 of file filedlg31.c.

744 {
745  LPWSTR strW = NULL;
746  if (str && (size > 0))
747  {
748  strW = heap_alloc(size * sizeof(WCHAR));
749  if (strW) MultiByteToWideChar( CP_ACP, 0, str, -1, strW, size );
750  }
751  return strW;
752 }
#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 450 of file filedlg31.c.

451 {
452  LONG lRet;
453  HWND hWnd = lfs->hwnd;
454  LPWSTR pstr;
455 
456  lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0);
457  if (lRet == LB_ERR)
458  return TRUE;
459 
460  /* set the edit control to the chosen file */
461  if ((pstr = heap_alloc(BUFFILEALLOC)))
462  {
464  (LPARAM)pstr);
465  SetDlgItemTextW( hWnd, edt1, pstr );
466  heap_free(pstr);
467  }
468  if (lfs->hook)
469  {
471  MAKELONG(lRet,CD_LBSELCHANGE));
472  }
473  /* FIXME: for OFN_ALLOWMULTISELECT we need CD_LBSELSUB, CD_SELADD,
474  CD_LBSELNOITEMS */
475  return TRUE;
476 }
#define TRUE
Definition: types.h:120
UINT lbselchstring
Definition: filedlg31.c:66
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:2386
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:2010
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:126
#define LB_GETCURSEL
Definition: winuser.h:2000
#define CD_LBSELCHANGE
Definition: commdlg.h:196
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define BUFFILEALLOC
Definition: filedlg31.c:45
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 1101 of file filedlg31.c.

1103 {
1105 
1106  TRACE("msg=%x wparam=%lx lParam=%lx\n", wMsg, wParam, lParam);
1107  if ((wMsg != WM_INITDIALOG) && lfs && lfs->hook)
1108  {
1109  INT_PTR lRet;
1110  lRet = (INT_PTR)FD31_CallWindowProc( lfs, wMsg, wParam, lParam );
1111  if (lRet) return lRet; /* else continue message processing */
1112  }
1113  switch (wMsg)
1114  {
1115  case WM_INITDIALOG:
1116  return FD31_WMInitDialog( hWnd, wParam, lParam );
1117 
1118  case WM_MEASUREITEM:
1119  return FD31_WMMeasureItem( lParam );
1120 
1121  case WM_DRAWITEM:
1122  return FD31_WMDrawItem( hWnd, wParam, lParam, !lfs->open, (DRAWITEMSTRUCT *)lParam );
1123 
1124  case WM_COMMAND:
1125  return FD31_WMCommand( hWnd, lParam, HIWORD(wParam), LOWORD(wParam), lfs );
1126 #if 0
1127  case WM_CTLCOLOR:
1128  SetBkColor( (HDC16)wParam, 0x00C0C0C0 );
1129  switch (HIWORD(lParam))
1130  {
1131  case CTLCOLOR_BTN:
1132  SetTextColor( (HDC16)wParam, 0x00000000 );
1133  return hGRAYBrush;
1134  case CTLCOLOR_STATIC:
1135  SetTextColor( (HDC16)wParam, 0x00000000 );
1136  return hGRAYBrush;
1137  }
1138  break;
1139 #endif
1140  }
1141  return FALSE;
1142 }
#define CTLCOLOR_STATIC
Definition: winuser.h:947
HWND hWnd
Definition: settings.c:17
static LONG FD31_WMMeasureItem(LPARAM lParam)
Definition: filedlg31.c:1087
#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:661
#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:226
#define WM_COMMAND
Definition: winuser.h:1716
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:126
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:884
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:60
struct tagFD31_DATA * PFD31_DATA
#define WM_INITDIALOG
Definition: winuser.h:1715
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:962

Referenced by GetFileName31A(), and GetFileName31W().

◆ FD31_FileTypeChange()

static LRESULT FD31_FileTypeChange ( const FD31_DATA lfs)
static

Definition at line 641 of file filedlg31.c.

642 {
643  LONG lRet;
644  LPWSTR pstr;
645 
646  lRet = SendDlgItemMessageW(lfs->hwnd, cmb1, CB_GETCURSEL, 0, 0);
647  if (lRet == LB_ERR)
648  return TRUE;
649  lfs->ofnW->nFilterIndex = lRet + 1;
650  if (lfs->ofnA)
651  lfs->ofnA->nFilterIndex = lRet + 1;
652  pstr = (LPWSTR)SendDlgItemMessageW(lfs->hwnd, cmb1, CB_GETITEMDATA, lRet, 0);
653  TRACE("Selected filter : %s\n", debugstr_w(pstr));
654 
655  return FD31_Validate( lfs, pstr, cmb1, lRet, TRUE );
656 }
#define TRUE
Definition: types.h:120
#define CB_GETITEMDATA
Definition: winuser.h:1911
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:73
#define CB_GETCURSEL
Definition: winuser.h:1904
#define LB_ERR
Definition: winuser.h:2386
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:552
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:71
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 820 of file filedlg31.c.

821 {
822  heap_free((void *)ofnW->lpstrFilter);
824  heap_free(ofnW->lpstrFile);
825  heap_free(ofnW->lpstrFileTitle);
826  heap_free((void *)ofnW->lpstrInitialDir);
827  heap_free((void *)ofnW->lpstrTitle);
828  if (!IS_INTRESOURCE(ofnW->lpTemplateName))
829  heap_free((void *)ofnW->lpTemplateName);
830 }
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 151 of file filedlg31.c.

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

Referenced by FD31_ScanDir(), and FD31_WMInitDialog().

◆ FD31_GetFldrHeight()

static int FD31_GetFldrHeight ( void  )
static

Definition at line 1079 of file filedlg31.c.

1080 {
1081  return fldrHeight;
1082 }
static const int fldrHeight
Definition: filedlg31.c:50

Referenced by FD31_WMMeasureItem().

◆ FD31_GetTemplate()

static BOOL FD31_GetTemplate ( PFD31_DATA  lfs)
static

Definition at line 860 of file filedlg31.c.

861 {
862  LPOPENFILENAMEW ofnW = lfs->ofnW;
863  LPOPENFILENAMEA ofnA = lfs->ofnA;
864  HANDLE hDlgTmpl;
865 
866  if (ofnW->Flags & OFN_ENABLETEMPLATEHANDLE)
867  {
868  if (!(lfs->template = LockResource( ofnW->hInstance )))
869  {
871  return FALSE;
872  }
873  }
874  else if (ofnW->Flags & OFN_ENABLETEMPLATE)
875  {
876  HRSRC hResInfo;
877  if (ofnA)
878  hResInfo = FindResourceA( ofnA->hInstance, ofnA->lpTemplateName, (LPSTR)RT_DIALOG );
879  else
880  hResInfo = FindResourceW( ofnW->hInstance, ofnW->lpTemplateName, (LPWSTR)RT_DIALOG );
881  if (!hResInfo)
882  {
884  return FALSE;
885  }
886  if (!(hDlgTmpl = LoadResource( ofnW->hInstance, hResInfo )) ||
887  !(lfs->template = LockResource( hDlgTmpl )))
888  {
890  return FALSE;
891  }
892  }
893  else /* get it from internal Wine resource */
894  {
895  HRSRC hResInfo;
896  if (!(hResInfo = FindResourceA( COMDLG32_hInstance, lfs->open ? "OPEN_FILE" : "SAVE_FILE", (LPSTR)RT_DIALOG )))
897  {
899  return FALSE;
900  }
901  if (!(hDlgTmpl = LoadResource( COMDLG32_hInstance, hResInfo )) ||
902  !(lfs->template = LockResource( hDlgTmpl )))
903  {
905  return FALSE;
906  }
907  }
908  return TRUE;
909 }
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:73
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:69
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:71
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FD31_AllocPrivate().

◆ FD31_Init()

static BOOL FD31_Init ( void  )
static

Definition at line 79 of file filedlg31.c.

80 {
81  static BOOL initialized = FALSE;
82 
83  if (!initialized) {
84  hFolder = LoadImageA( COMDLG32_hInstance, "FOLDER", IMAGE_ICON, 16, 16, LR_SHARED );
85  hFolder2 = LoadImageA( COMDLG32_hInstance, "FOLDER2", IMAGE_ICON, 16, 16, LR_SHARED );
86  hFloppy = LoadImageA( COMDLG32_hInstance, "FLOPPY", IMAGE_ICON, 16, 16, LR_SHARED );
89  hNet = LoadImageA( COMDLG32_hInstance, "NETWORK", IMAGE_ICON, 16, 16, LR_SHARED );
90  if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 ||
91  hHDisk == 0 || hCDRom == 0 || hNet == 0)
92  {
93  ERR("Error loading icons!\n");
94  return FALSE;
95  }
96  initialized = TRUE;
97  }
98  return TRUE;
99 }
static HICON hHDisk
Definition: filedlg31.c:56
#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:57
static BOOL initialized
Definition: syslog.c:39
static HICON hFolder
Definition: filedlg31.c:53
static HICON hFloppy
Definition: filedlg31.c:55
#define ERR(fmt,...)
Definition: debug.h:109
static HICON hNet
Definition: filedlg31.c:58
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:54

Referenced by GetFileName31A(), and GetFileName31W().

◆ FD31_MapOfnStructA()

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

Definition at line 758 of file filedlg31.c.

759 {
760  UNICODE_STRING usBuffer;
761 
762  ofnW->hwndOwner = ofnA->hwndOwner;
763  ofnW->hInstance = ofnA->hInstance;
764  if (ofnA->lpstrFilter)
766 
767  if ((ofnA->lpstrCustomFilter) && (*(ofnA->lpstrCustomFilter)))
769  ofnW->nMaxCustFilter = ofnA->nMaxCustFilter;
770  ofnW->nFilterIndex = ofnA->nFilterIndex;
771  ofnW->nMaxFile = ofnA->nMaxFile;
772  ofnW->lpstrFile = FD31_DupToW(ofnA->lpstrFile, ofnW->nMaxFile);
773  ofnW->nMaxFileTitle = ofnA->nMaxFileTitle;
775  if (ofnA->lpstrInitialDir)
776  {
778  ofnW->lpstrInitialDir = usBuffer.Buffer;
779  }
780  if (ofnA->lpstrTitle) {
781  RtlCreateUnicodeStringFromAsciiz (&usBuffer, ofnA->lpstrTitle);
782  ofnW->lpstrTitle = usBuffer.Buffer;
783  } else {
784  WCHAR buf[16];
785  LPWSTR title_tmp;
786  int len;
788  len = lstrlenW(buf)+1;
789  title_tmp = heap_alloc(len * sizeof(WCHAR));
790  memcpy(title_tmp, buf, len * sizeof(WCHAR));
791  ofnW->lpstrTitle = title_tmp;
792  }
793  ofnW->Flags = ofnA->Flags;
794  ofnW->nFileOffset = ofnA->nFileOffset;
795  ofnW->nFileExtension = ofnA->nFileExtension;
796  ofnW->lpstrDefExt = FD31_DupToW(ofnA->lpstrDefExt, 3);
797  if ((ofnA->Flags & OFN_ENABLETEMPLATE) && (ofnA->lpTemplateName))
798  {
799  if (!IS_INTRESOURCE(ofnA->lpTemplateName))
800  {
802  ofnW->lpTemplateName = usBuffer.Buffer;
803  }
804  else /* numbered resource */
805  ofnW->lpTemplateName = (LPCWSTR) ofnA->lpTemplateName;
806  }
808  {
809  ofnW->pvReserved = ofnA->pvReserved;
810  ofnW->dwReserved = ofnA->dwReserved;
811  ofnW->FlagsEx = ofnA->FlagsEx;
812  }
813 }
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:71
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:407
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:743
#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:719
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 719 of file filedlg31.c.

720 {
721  LPCSTR s;
722  LPWSTR x;
723  unsigned int n, len;
724 
725  s = strA;
726  while (*s)
727  s = s+strlen(s)+1;
728  s++;
729  n = s + 1 - strA; /* Don't forget the other \0 */
730  if (n < size) n = size;
731 
732  len = MultiByteToWideChar( CP_ACP, 0, strA, n, NULL, 0 );
733  x = heap_alloc(len * sizeof(WCHAR));
734  MultiByteToWideChar( CP_ACP, 0, strA, n, x, len );
735  return x;
736 }
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 177 of file filedlg31.c.

178 {
180  HWND hdlg;
181  LRESULT lRet = TRUE;
182  HCURSOR hCursorWait, oldCursor;
183 
184  TRACE("Trying to change to %s\n", debugstr_w(newPath));
185  if ( newPath[0] && !SetCurrentDirectoryW( newPath ))
186  return FALSE;
187 
188  /* get the list of spec files */
191 
192  hCursorWait = LoadCursorA(0, (LPSTR)IDC_WAIT);
193  oldCursor = SetCursor(hCursorWait);
194 
195  /* list of files */
196  if ((hdlg = GetDlgItem(hWnd, lst1)) != 0) {
197  WCHAR* scptr; /* ptr on semi-colon */
198  WCHAR* filter = buffer;
199 
200  TRACE("Using filter %s\n", debugstr_w(filter));
201  SendMessageW(hdlg, LB_RESETCONTENT, 0, 0);
202  while (filter) {
203  scptr = strchrW(filter, ';');
204  if (scptr) *scptr = 0;
205  while (*filter == ' ') filter++;
206  TRACE("Using file spec %s\n", debugstr_w(filter));
207  SendMessageW(hdlg, LB_DIR, 0, (LPARAM)filter);
208  if (scptr) *scptr = ';';
209  filter = (scptr) ? (scptr + 1) : 0;
210  }
211  }
212 
213  /* list of directories */
215 
216  if (GetDlgItem(hWnd, lst2) != 0) {
218  }
219  SetCursor(oldCursor);
220  return lRet;
221 }
#define TRUE
Definition: types.h:120
#define LB_DIR
Definition: winuser.h:1994
LPSTR lpstrCustomFilter
Definition: commdlg.h:333
#define BUFFILE
Definition: filedlg31.c:44
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
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:151
HICON HCURSOR
Definition: windef.h:284
char * LPSTR
Definition: xmlstorage.h:182
#define lstrcpynW
Definition: compat.h:397
#define LB_RESETCONTENT
Definition: winuser.h:2016
#define debugstr_w
Definition: kernel32.h:32
static const WCHAR FILE_star[]
Definition: filedlg31.c:47
#define IDC_WAIT
Definition: winuser.h:684
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
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
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define lst2
Definition: dlgs.h:96
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 105 of file filedlg31.c.

106 {
107  WCHAR temp[BUFFILE], *cp;
108 
110  cp = strrchrW(temp, '\\');
111  if (cp != NULL) {
112  strcpyW(temp, cp+1);
113  }
114  cp = strrchrW(temp, ':');
115  if (cp != NULL) {
116  strcpyW(temp, cp+1);
117  }
118  /* FIXME: shouldn't we do something with the result here? ;-) */
119 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2195
#define BUFFILE
Definition: filedlg31.c:44
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define edt1
Definition: dlgs.h:65
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
static calc_node_t temp
Definition: rpn_ieee.c:38
#define ARRAY_SIZE(a)
Definition: main.h:24
POINT cp
Definition: magnifier.c:60

Referenced by FD31_DiskChange(), and FD31_WMCommand().

◆ FD31_TestPath()

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

Definition at line 483 of file filedlg31.c.

484 {
485  HWND hWnd = lfs->hwnd;
486  LPWSTR pBeginFileName, pstr2;
487  WCHAR tmpstr2[BUFFILE];
488 
489  pBeginFileName = strrchrW(path, '\\');
490  if (pBeginFileName == NULL)
491  pBeginFileName = strrchrW(path, ':');
492 
493  if (strchrW(path,'*') != NULL || strchrW(path,'?') != NULL)
494  {
495  /* edit control contains wildcards */
496  if (pBeginFileName != NULL)
497  {
498  lstrcpynW(tmpstr2, pBeginFileName + 1, BUFFILE);
499  *(pBeginFileName + 1) = 0;
500  }
501  else
502  {
503  strcpyW(tmpstr2, path);
504  if(!(lfs->ofnW->Flags & OFN_NOVALIDATE))
505  *path = 0;
506  }
507 
508  TRACE("path=%s, tmpstr2=%s\n", debugstr_w(path), debugstr_w(tmpstr2));
509  SetDlgItemTextW( hWnd, edt1, tmpstr2 );
510  FD31_ScanDir(lfs->ofnW, hWnd, path);
511  return (lfs->ofnW->Flags & OFN_NOVALIDATE) != 0;
512  }
513 
514  /* no wildcards, we might have a directory or a filename */
515  /* try appending a wildcard and reading the directory */
516 
517  pstr2 = path + lstrlenW(path);
518  if (pBeginFileName == NULL || *(pBeginFileName + 1) != 0)
520 
521  /* if ScanDir succeeds, we have changed the directory */
522  if (FD31_ScanDir(lfs->ofnW, hWnd, path))
523  return FALSE; /* and path is not a valid file name */
524 
525  /* if not, this must be a filename */
526 
527  *pstr2 = 0; /* remove the wildcard added before */
528 
529  if (pBeginFileName != NULL)
530  {
531  /* strip off the pathname */
532  *pBeginFileName = 0;
533  SetDlgItemTextW( hWnd, edt1, pBeginFileName + 1 );
534 
535  lstrcpynW(tmpstr2, pBeginFileName + 1, ARRAY_SIZE(tmpstr2));
536  /* Should we MessageBox() if this fails? */
537  if (!FD31_ScanDir(lfs->ofnW, hWnd, path))
538  {
539  return FALSE;
540  }
541  strcpyW(path, tmpstr2);
542  }
543  else
545  return TRUE;
546 }
DWORD Flags
Definition: commdlg.h:373
#define TRUE
Definition: types.h:120
#define BUFFILE
Definition: filedlg31.c:44
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
HWND hWnd
Definition: settings.c:17
#define lstrlenW
Definition: compat.h:407
#define lstrcpynW
Definition: compat.h:397
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR FILE_bslash[]
Definition: filedlg31.c:48
#define TRACE(s)
Definition: solgame.cpp:4
__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:177
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: services.c:325
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:71
#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 389 of file filedlg31.c.

390 {
391  LONG lRet;
392  LPOPENFILENAMEW ofnW = lfs->ofnW;
393  LPOPENFILENAMEA ofnA = lfs->ofnA;
394 
395  if (ofnW->lpstrFileTitle != NULL)
396  {
397  lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0);
399  (LPARAM)ofnW->lpstrFileTitle );
400  if (ofnA)
401  {
402  if (!WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFileTitle, -1,
403  ofnA->lpstrFileTitle, ofnA->nMaxFileTitle, NULL, NULL ))
404  ofnA->lpstrFileTitle[ofnA->nMaxFileTitle-1] = 0;
405  }
406  }
407 }
#define WideCharToMultiByte
Definition: compat.h:101
LPSTR lpstrFileTitle
Definition: commdlg.h:338
#define CP_ACP
Definition: compat.h:99
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:73
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:2010
#define LB_GETCURSEL
Definition: winuser.h:2000
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:71
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 332 of file filedlg31.c.

333 {
334  int lenstr2;
335  LPOPENFILENAMEW ofnW = lfs->ofnW;
336  LPOPENFILENAMEA ofnA = lfs->ofnA;
337  WCHAR tmpstr2[BUFFILE];
338  WCHAR *p;
339 
340  TRACE("%s\n", debugstr_w(tmpstr));
341  if(ofnW->Flags & OFN_NOVALIDATE)
342  tmpstr2[0] = '\0';
343  else
344  GetCurrentDirectoryW(BUFFILE, tmpstr2);
345  lenstr2 = strlenW(tmpstr2);
346  if (lenstr2 > 3)
347  tmpstr2[lenstr2++]='\\';
348  lstrcpynW(tmpstr2+lenstr2, tmpstr, BUFFILE-lenstr2);
349  if (!ofnW->lpstrFile)
350  return;
351 
352  lstrcpynW(ofnW->lpstrFile, tmpstr2, ofnW->nMaxFile);
353 
354  /* set filename offset */
355  p = PathFindFileNameW(ofnW->lpstrFile);
356  ofnW->nFileOffset = (p - ofnW->lpstrFile);
357 
358  /* set extension offset */
359  p = PathFindExtensionW(ofnW->lpstrFile);
360  ofnW->nFileExtension = (*p) ? (p - ofnW->lpstrFile) + 1 : 0;
361 
362  TRACE("file %s, file offset %d, ext offset %d\n",
363  debugstr_w(ofnW->lpstrFile), ofnW->nFileOffset, ofnW->nFileExtension);
364 
365  /* update the real client structures if any */
366  if (ofnA)
367  {
368  LPSTR lpszTemp;
369  if (ofnW->nMaxFile &&
370  !WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFile, -1,
371  ofnA->lpstrFile, ofnA->nMaxFile, NULL, NULL ))
372  ofnA->lpstrFile[ofnA->nMaxFile-1] = 0;
373 
374  /* offsets are not guaranteed to be the same in WCHAR to MULTIBYTE conversion */
375  /* set filename offset */
376  lpszTemp = PathFindFileNameA(ofnA->lpstrFile);
377  ofnA->nFileOffset = (lpszTemp - ofnA->lpstrFile);
378 
379  /* set extension offset */
380  lpszTemp = PathFindExtensionA(ofnA->lpstrFile);
381  ofnA->nFileExtension = (*lpszTemp) ? (lpszTemp - ofnA->lpstrFile) + 1 : 0;
382  }
383 }
DWORD Flags
Definition: commdlg.h:373
WORD nFileExtension
Definition: commdlg.h:344
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WideCharToMultiByte
Definition: compat.h:101
#define BUFFILE
Definition: filedlg31.c:44
#define CP_ACP
Definition: compat.h:99
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:73
LPWSTR lpstrFile
Definition: commdlg.h:367
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:413
char * LPSTR
Definition: xmlstorage.h:182
#define lstrcpynW
Definition: compat.h:397
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:71
#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 552 of file filedlg31.c.

554 {
555  LONG lRet;
556  HWND hWnd = lfs->hwnd;
557  OPENFILENAMEW ofnsav;
558  LPOPENFILENAMEW ofnW = lfs->ofnW;
560  int copied_size = min( ofnW->lStructSize, sizeof(ofnsav) );
561 
562  memcpy( &ofnsav, ofnW, copied_size ); /* for later restoring */
563 
564  /* get current file name */
565  if (path)
567  else
569 
570  TRACE("got filename = %s\n", debugstr_w(filename));
571  /* if we did not click in file list to get there */
572  if (control != lst1)
573  {
574  if (!FD31_TestPath( lfs, filename) )
575  return FALSE;
576  }
578 
579  if (internalUse)
580  { /* called internally after a change in a combo */
581  if (lfs->hook)
582  {
583  FD31_CallWindowProc(lfs, lfs->lbselchstring, control,
584  MAKELONG(itemIndex,CD_LBSELCHANGE));
585  }
586  return TRUE;
587  }
588 
590  if (lfs->hook)
591  {
592  lRet = FD31_CallWindowProc(lfs, lfs->fileokstring,
593  0, lfs->lParam );
594  if (lRet)
595  {
596  memcpy( ofnW, &ofnsav, copied_size ); /* restore old state */
597  return FALSE;
598  }
599  }
600  if ((ofnW->Flags & OFN_ALLOWMULTISELECT) && (ofnW->Flags & OFN_EXPLORER))
601  {
602  if (ofnW->lpstrFile)
603  {
604  LPWSTR str = ofnW->lpstrFile;
605  LPWSTR ptr = strrchrW(str, '\\');
606  str[lstrlenW(str) + 1] = '\0';
607  *ptr = 0;
608  }
609  }
610  return TRUE;
611 }
#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:2195
#define TRUE
Definition: types.h:120
#define BUFFILE
Definition: filedlg31.c:44
UINT lbselchstring
Definition: filedlg31.c:66
LPWSTR lpstrFile
Definition: commdlg.h:367
static void FD31_UpdateFileTitle(const FD31_DATA *lfs)
Definition: filedlg31.c:389
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:407
DWORD lStructSize
Definition: commdlg.h:360
#define lstrcpynW
Definition: compat.h:397
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
#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
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:126
#define ARRAY_SIZE(a)
Definition: main.h:24
LPARAM lParam
Definition: filedlg31.c:68
Definition: services.c:325
#define min(a, b)
Definition: monoChain.cc:55
UINT fileokstring
Definition: filedlg31.c:67
static LRESULT FD31_TestPath(const FD31_DATA *lfs, LPWSTR path)
Definition: filedlg31.c:483
static void FD31_UpdateResult(const FD31_DATA *lfs, const WCHAR *tmpstr)
Definition: filedlg31.c:332
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:71
#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 661 of file filedlg31.c.

663 {
664  switch (control)
665  {
666  case lst1: /* file list */
668  if (notification == LBN_DBLCLK)
669  {
670  return SendMessageW(hWnd, WM_COMMAND, IDOK, 0);
671  }
672  else if (notification == LBN_SELCHANGE)
673  return FD31_FileListSelect( lfs );
674  break;
675 
676  case lst2: /* directory list */
678  if (notification == LBN_DBLCLK)
679  return FD31_DirListDblClick( lfs );
680  break;
681 
682  case cmb1: /* file type drop list */
684  return FD31_FileTypeChange( lfs );
685  break;
686 
687  case chx1:
688  break;
689 
690  case pshHelp:
691  break;
692 
693  case cmb2: /* disk dropdown combo */
695  return FD31_DiskChange( lfs );
696  break;
697 
698  case IDOK:
699  TRACE("OK pressed\n");
700  if (FD31_Validate( lfs, NULL, control, 0, FALSE ))
701  EndDialog(hWnd, TRUE);
702  return TRUE;
703 
704  case IDCANCEL:
705  EndDialog(hWnd, FALSE);
706  return TRUE;
707 
708  case IDABORT: /* can be sent by the hook procedure */
709  EndDialog(hWnd, TRUE);
710  return TRUE;
711  }
712  return FALSE;
713 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
static void FD31_StripEditControl(HWND hwnd)
Definition: filedlg31.c:105
#define IDABORT
Definition: winuser.h:826
static LRESULT FD31_DiskChange(const FD31_DATA *lfs)
Definition: filedlg31.c:617
HWND hWnd
Definition: settings.c:17
static LRESULT FD31_DirListDblClick(const FD31_DATA *lfs)
Definition: filedlg31.c:412
#define LBN_SELCHANGE
Definition: winuser.h:2036
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:450
#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:552
static LRESULT FD31_FileTypeChange(const FD31_DATA *lfs)
Definition: filedlg31.c:641
#define LBN_DBLCLK
Definition: winuser.h:2032
#define lst1
Definition: dlgs.h:95
#define WM_COMMAND
Definition: winuser.h:1716
#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:1940
#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 226 of file filedlg31.c.

228 {
229  WCHAR *str;
230  HICON hIcon;
231  COLORREF oldText = 0, oldBk = 0;
232 
233  if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst1)
234  {
235  if (!(str = heap_alloc(BUFFILEALLOC))) return FALSE;
236  SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
237  (LPARAM)str);
238 
239  if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
240  {
241  oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
242  oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
243  }
244  if (savedlg)
246 
247  ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + 1,
248  lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
249  &(lpdis->rcItem), str, lstrlenW(str), NULL);
250 
251  if (lpdis->itemState & ODS_SELECTED)
252  DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );
253 
254  if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
255  {
256  SetBkColor( lpdis->hDC, oldBk );
257  SetTextColor( lpdis->hDC, oldText );
258  }
259  heap_free(str);
260  return TRUE;
261  }
262 
263  if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst2)
264  {
265  if (!(str = heap_alloc(BUFFILEALLOC)))
266  return FALSE;
267  SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
268  (LPARAM)str);
269 
270  if (lpdis->itemState & ODS_SELECTED)
271  {
272  oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
273  oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
274  }
275  ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
276  lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
277  &(lpdis->rcItem), str, lstrlenW(str), NULL);
278 
279  if (lpdis->itemState & ODS_SELECTED)
280  DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );
281 
282  if (lpdis->itemState & ODS_SELECTED)
283  {
284  SetBkColor( lpdis->hDC, oldBk );
285  SetTextColor( lpdis->hDC, oldText );
286  }
287  DrawIconEx( lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hFolder, 16, 16, 0, 0, DI_NORMAL );
288  heap_free(str);
289  return TRUE;
290  }
291  if (lpdis->CtlType == ODT_COMBOBOX && lpdis->CtlID == cmb2)
292  {
293  char root[] = "a:";
294  if (!(str = heap_alloc(BUFFILEALLOC)))
295  return FALSE;
296  SendMessageW(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID,
297  (LPARAM)str);
298  root[0] += str[2] - 'a';
299  switch(GetDriveTypeA(root))
300  {
301  case DRIVE_REMOVABLE: hIcon = hFloppy; break;
302  case DRIVE_CDROM: hIcon = hCDRom; break;
303  case DRIVE_REMOTE: hIcon = hNet; break;
304  case DRIVE_FIXED:
305  default: hIcon = hHDisk; break;
306  }
307  if (lpdis->itemState & ODS_SELECTED)
308  {
309  oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
310  oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
311  }
312  ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
313  lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
314  &(lpdis->rcItem), str, lstrlenW(str), NULL);
315 
316  if (lpdis->itemState & ODS_SELECTED)
317  {
318  SetBkColor( lpdis->hDC, oldBk );
319  SetTextColor( lpdis->hDC, oldText );
320  }
321  DrawIconEx( lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hIcon, 16, 16, 0, 0, DI_NORMAL );
322  heap_free(str);
323  return TRUE;
324  }
325  return FALSE;
326 }
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:56
static const int fldrWidth
Definition: filedlg31.c:51
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:2493
#define CB_GETLBTEXT
Definition: winuser.h:1913
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
#define lstrlenW
Definition: compat.h:407
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:57
#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:285
static HICON hFolder
Definition: filedlg31.c:53
#define lst1
Definition: dlgs.h:95
#define COLOR_GRAYTEXT
Definition: winuser.h:922
#define LB_GETTEXT
Definition: winuser.h:2010
#define DI_NORMAL
Definition: wingdi.h:72
#define DRIVE_FIXED
Definition: winbase.h:249
static HICON hFloppy
Definition: filedlg31.c:55
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:884
#define cmb2
Definition: dlgs.h:49
static HICON hNet
Definition: filedlg31.c:58
#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:2492
#define ODS_SELECTED
Definition: winuser.h:2499
#define BUFFILEALLOC
Definition: filedlg31.c:45
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 962 of file filedlg31.c.

963 {
964  int i, n;
965  WCHAR tmpstr[BUFFILE];
966  LPWSTR pstr, old_pstr;
968  PFD31_DATA lfs = (PFD31_DATA) lParam;
969 
970  if (!lfs) return FALSE;
971  SetPropA(hWnd, FD31_OFN_PROP, lfs);
972  lfs->hwnd = hWnd;
973  ofn = lfs->ofnW;
974 
975  TRACE("flags=%x initialdir=%s\n", ofn->Flags, debugstr_w(ofn->lpstrInitialDir));
976 
978  /* read custom filter information */
979  if (ofn->lpstrCustomFilter)
980  {
981  pstr = ofn->lpstrCustomFilter;
982  n = 0;
983  TRACE("lpstrCustomFilter = %p\n", pstr);
984  while(*pstr)
985  {
986  old_pstr = pstr;
988  (LPARAM)(ofn->lpstrCustomFilter) + n );
989  n += lstrlenW(pstr) + 1;
990  pstr += lstrlenW(pstr) + 1;
991  TRACE("add str=%s associated to %s\n",
992  debugstr_w(old_pstr), debugstr_w(pstr));
994  n += lstrlenW(pstr) + 1;
995  pstr += lstrlenW(pstr) + 1;
996  }
997  }
998  /* read filter information */
999  if (ofn->lpstrFilter) {
1000  pstr = (LPWSTR) ofn->lpstrFilter;
1001  n = 0;
1002  while(*pstr) {
1003  old_pstr = pstr;
1005  (LPARAM)(ofn->lpstrFilter + n) );
1006  n += lstrlenW(pstr) + 1;
1007  pstr += lstrlenW(pstr) + 1;
1008  TRACE("add str=%s associated to %s\n",
1009  debugstr_w(old_pstr), debugstr_w(pstr));
1011  n += lstrlenW(pstr) + 1;
1012  pstr += lstrlenW(pstr) + 1;
1013  }
1014  }
1015  /* set default filter */
1016  if (ofn->nFilterIndex == 0 && ofn->lpstrCustomFilter == NULL)
1017  ofn->nFilterIndex = 1;
1019  if (ofn->lpstrFile && ofn->lpstrFile[0])
1020  {
1021  TRACE( "SetText of edt1 to %s\n", debugstr_w(ofn->lpstrFile) );
1023  }
1024  else
1025  {
1028  TRACE("nFilterIndex = %d, SetText of edt1 to %s\n",
1029  ofn->nFilterIndex, debugstr_w(tmpstr));
1030  SetDlgItemTextW( hWnd, edt1, tmpstr );
1031  }
1032  /* get drive list */
1033  *tmpstr = 0;
1035  /* read initial directory */
1036  /* FIXME: Note that this is now very version-specific (See MSDN description of
1037  * the OPENFILENAME structure). For example under 2000/XP any path in the
1038  * lpstrFile overrides the lpstrInitialDir, but not under 95/98/ME
1039  */
1040  if (ofn->lpstrInitialDir != NULL)
1041  {
1042  int len;
1043  lstrcpynW(tmpstr, ofn->lpstrInitialDir, 511);
1044  len = lstrlenW(tmpstr);
1045  if (len > 0 && tmpstr[len-1] != '\\' && tmpstr[len-1] != ':') {
1046  tmpstr[len]='\\';
1047  tmpstr[len+1]='\0';
1048  }
1049  }
1050  else
1051  *tmpstr = 0;
1052  if (!FD31_ScanDir(ofn, hWnd, tmpstr)) {
1053  *tmpstr = 0;
1054  if (!FD31_ScanDir(ofn, hWnd, tmpstr))
1055  WARN("Couldn't read initial directory %s!\n", debugstr_w(tmpstr));
1056  }
1057  /* select current drive in combo 2, omit missing drives */
1058  {
1059  char dir[MAX_PATH];
1060  char str[4] = "a:\\";
1061  GetCurrentDirectoryA( sizeof(dir), dir );
1062  for(i = 0, n = -1; i < 26; i++)
1063  {
1064  str[0] = 'a' + i;
1066  if (toupper(str[0]) == toupper(dir[0])) break;
1067  }
1068  }
1070  if (!(ofn->Flags & OFN_SHOWHELP))
1072  if (ofn->Flags & OFN_HIDEREADONLY)
1074  if (lfs->hook)
1075  return FD31_CallWindowProc(lfs, WM_INITDIALOG, wParam, lfs->lParam);
1076  return TRUE;
1077 }
#define CB_SETITEMDATA
Definition: winuser.h:1927
#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:44
#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:151
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define lstrlenW
Definition: compat.h:407
WPARAM wParam
Definition: combotst.c:138
#define lstrcpynW
Definition: compat.h:397
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:1897
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:177
#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:1922
#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:126
#define cmb2
Definition: dlgs.h:49
LPSTR lpstrFile
Definition: commdlg.h:336
LPARAM lParam
Definition: filedlg31.c:68
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:60
struct tagFD31_DATA * PFD31_DATA
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:71
DWORD nFilterIndex
Definition: commdlg.h:335
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define cmb1
Definition: dlgs.h:48
#define WM_INITDIALOG
Definition: winuser.h:1715
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 1087 of file filedlg31.c.

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

Referenced by FD31_FileOpenDlgProc().

◆ GetFileName31A()

BOOL GetFileName31A ( OPENFILENAMEA lpofn,
UINT  dlgType 
)

Definition at line 1149 of file filedlg31.c.

1150 {
1151  BOOL bRet = FALSE;
1152  PFD31_DATA lfs;
1153 
1154  if (!lpofn || !FD31_Init()) return FALSE;
1155 
1156  TRACE("ofn flags %08x\n", lpofn->Flags);
1157  lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, FALSE);
1158  if (lfs)
1159  {
1162  FD31_DestroyPrivate(lfs);
1163  }
1164 
1165  TRACE("return lpstrFile='%s' !\n", lpofn->lpstrFile);
1166  return bRet;
1167 }
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:919
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:836
static BOOL FD31_Init(void)
Definition: filedlg31.c:79
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:69
static INT_PTR CALLBACK FD31_FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:1101
DWORD Flags
Definition: commdlg.h:342

Referenced by GetOpenFileNameA(), and GetSaveFileNameA().

◆ GetFileName31W()

BOOL GetFileName31W ( OPENFILENAMEW lpofn,
UINT  dlgType 
)

Definition at line 1174 of file filedlg31.c.

1175 {
1176  BOOL bRet = FALSE;
1177  PFD31_DATA lfs;
1178 
1179  if (!lpofn || !FD31_Init()) return FALSE;
1180 
1181  lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, TRUE);
1182  if (lfs)
1183  {
1186  FD31_DestroyPrivate(lfs);
1187  }
1188 
1189  TRACE("file %s, file offset %d, ext offset %d\n",
1190  debugstr_w(lpofn->lpstrFile), lpofn->nFileOffset, lpofn->nFileExtension);
1191  return bRet;
1192 }
#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:919
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:836
static BOOL FD31_Init(void)
Definition: filedlg31.c:79
HWND hwndOwner
Definition: commdlg.h:361
LPCVOID template
Definition: filedlg31.c:69
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:1101

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 48 of file filedlg31.c.

Referenced by FD31_DirListDblClick(), and FD31_TestPath().

◆ FILE_specc

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

Definition at line 49 of file filedlg31.c.

Referenced by FD31_DiskChange().

◆ FILE_star

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

Definition at line 47 of file filedlg31.c.

Referenced by FD31_GetFileType(), and FD31_ScanDir().

◆ fldrHeight

const int fldrHeight = 16
static

Definition at line 50 of file filedlg31.c.

Referenced by FD31_GetFldrHeight().

◆ fldrWidth

const int fldrWidth = 20
static

Definition at line 51 of file filedlg31.c.

Referenced by FD31_WMDrawItem().

◆ hCDRom

HICON hCDRom = 0
static

Definition at line 57 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hFloppy

HICON hFloppy = 0
static

Definition at line 55 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hFolder

HICON hFolder = 0
static

Definition at line 53 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hFolder2

HICON hFolder2 = 0
static

Definition at line 54 of file filedlg31.c.

Referenced by FD31_Init().

◆ hHDisk

HICON hHDisk = 0
static

Definition at line 56 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hNet

HICON hNet = 0
static

Definition at line 58 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().