ReactOS  0.4.13-dev-99-g7e18b6d
filedlg.c File Reference
#include "config.h"
#include "wine/port.h"
#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "winnls.h"
#include "wingdi.h"
#include "winreg.h"
#include "winuser.h"
#include "commdlg.h"
#include "dlgs.h"
#include "cdlg.h"
#include "cderr.h"
#include "shellapi.h"
#include "shlobj.h"
#include "filedlgbrowser.h"
#include "shlwapi.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
Include dependency graph for filedlg.c:

Go to the source code of this file.

Classes

struct  SFolder
 
struct  tagLookInInfo
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define UNIMPLEMENTED_FLAGS
 
#define XTEXTOFFSET   3
 
#define LISTEND   -1
 
#define SEARCH_PIDL   1
 
#define SEARCH_EXP   2
 
#define ITEM_NOTFOUND   -1
 
#define WM_GETISHELLBROWSER   WM_USER+7
 
#define TBPLACES_CMDID_PLACE0   0xa064
 
#define TBPLACES_CMDID_PLACE1   0xa065
 
#define TBPLACES_CMDID_PLACE2   0xa066
 
#define TBPLACES_CMDID_PLACE3   0xa067
 
#define TBPLACES_CMDID_PLACE4   0xa068
 
#define CBGetItemDataPtr(hwnd, iItemId)   SendMessageW(hwnd, CB_GETITEMDATA, (WPARAM)(iItemId), 0)
 

Typedefs

typedef struct SFolder SFOLDER
 
typedef struct SFolderLPSFOLDER
 
typedef struct tagLookInInfo LookInInfos
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (commdlg)
 
FileOpenDlgInfosget_filedlg_infoptr (HWND hwnd)
 
static BOOL is_dialog_hooked (const FileOpenDlgInfos *info)
 
static BOOL filedialog_is_readonly_hidden (const FileOpenDlgInfos *info)
 
static LRESULT FILEDLG95_ResizeControls (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT FILEDLG95_FillControls (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT FILEDLG95_OnWMCommand (HWND hwnd, WPARAM wParam)
 
static LRESULT FILEDLG95_OnWMGetIShellBrowser (HWND hwnd)
 
static BOOL FILEDLG95_OnOpen (HWND hwnd)
 
static LRESULT FILEDLG95_InitControls (HWND hwnd)
 
static void FILEDLG95_Clean (HWND hwnd)
 
static LRESULT FILEDLG95_SHELL_Init (HWND hwnd)
 
static BOOL FILEDLG95_SHELL_UpFolder (HWND hwnd)
 
static BOOL FILEDLG95_SHELL_ExecuteCommand (HWND hwnd, LPCSTR lpVerb)
 
static void FILEDLG95_SHELL_Clean (HWND hwnd)
 
static int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPWSTR *lpstrFileList, UINT *sizeUsed)
 
static HRESULT FILEDLG95_FILETYPE_Init (HWND hwnd)
 
static BOOL FILEDLG95_FILETYPE_OnCommand (HWND hwnd, WORD wNotifyCode)
 
static int FILEDLG95_FILETYPE_SearchExt (HWND hwnd, LPCWSTR lpstrExt)
 
static void FILEDLG95_FILETYPE_Clean (HWND hwnd)
 
static void FILEDLG95_LOOKIN_Init (HWND hwndCombo)
 
static LRESULT FILEDLG95_LOOKIN_DrawItem (LPDRAWITEMSTRUCT pDIStruct)
 
static BOOL FILEDLG95_LOOKIN_OnCommand (HWND hwnd, WORD wNotifyCode)
 
static int FILEDLG95_LOOKIN_AddItem (HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
 
static int FILEDLG95_LOOKIN_SearchItem (HWND hwnd, WPARAM searchArg, int iSearchMethod)
 
static int FILEDLG95_LOOKIN_InsertItemAfterParent (HWND hwnd, LPITEMIDLIST pidl)
 
static int FILEDLG95_LOOKIN_RemoveMostExpandedItem (HWND hwnd)
 
int FILEDLG95_LOOKIN_SelectItem (HWND hwnd, LPITEMIDLIST pidl)
 
static void FILEDLG95_LOOKIN_Clean (HWND hwnd)
 
static void FILEDLG95_MRU_load_filename (LPWSTR stored_path)
 
static WCHAR FILEDLG95_MRU_get_slot (LPCWSTR module_name, LPWSTR stored_path, PHKEY hkey_ret)
 
static void FILEDLG95_MRU_save_filename (LPCWSTR filename)
 
static HRESULT GetName (LPSHELLFOLDER lpsf, LPITEMIDLIST pidl, DWORD dwFlags, LPWSTR lpstrFileName)
 
IShellFolderGetShellFolderFromPidl (LPITEMIDLIST pidlAbs)
 
LPITEMIDLIST GetParentPidl (LPITEMIDLIST pidl)
 
static LPITEMIDLIST GetPidlFromName (IShellFolder *psf, LPWSTR lpcstrFileName)
 
static BOOL IsPidlFolder (LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
 
static UINT GetNumSelected (IDataObject *doSelected)
 
static void COMCTL32_ReleaseStgMedium (STGMEDIUM medium)
 
static INT_PTR CALLBACK FileOpenDlgProc95 (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR FILEDLG95_HandleCustomDialogMessages (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL FILEDLG95_OnOpenMultipleFiles (HWND hwnd, LPWSTR lpstrFileList, UINT nFileCount, UINT sizeUsed)
 
static BOOL BrowseSelectedFolder (HWND hwnd)
 
static BOOL get_config_key_as_dword (HKEY hkey, const WCHAR *name, DWORD *value)
 
static BOOL get_config_key_dword (HKEY hkey, const WCHAR *name, DWORD *value)
 
static BOOL get_config_key_string (HKEY hkey, const WCHAR *name, WCHAR **value)
 
static BOOL is_places_bar_enabled (const FileOpenDlgInfos *fodInfos)
 
static void filedlg_collect_places_pidls (FileOpenDlgInfos *fodInfos)
 
static BOOL GetFileName95 (FileOpenDlgInfos *fodInfos)
 
static WCHARheap_strdupAtoW (const char *str)
 
static void init_filedlg_infoW (OPENFILENAMEW *ofn, FileOpenDlgInfos *info)
 
static void init_filedlg_infoA (OPENFILENAMEA *ofn, FileOpenDlgInfos *info)
 
static BOOL GetFileDialog95 (FileOpenDlgInfos *info, UINT dlg_type)
 
static BOOL COMDLG32_GetDisplayNameOf (LPCITEMIDLIST pidl, LPWSTR pwszPath)
 
void COMDLG32_GetCanonicalPath (PCIDLIST_ABSOLUTE pidlAbsCurrent, LPWSTR lpstrFile, LPWSTR lpstrPathAndFile)
 
int COMDLG32_SplitFileNames (LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed)
 
static void ArrangeCtrlPositions (HWND hwndChildDlg, HWND hwndParentDlg, BOOL hide_help)
 
static INT_PTR CALLBACK FileOpenDlgProcUserTemplate (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static HWND CreateTemplateDialog (FileOpenDlgInfos *fodInfos, HWND hwnd)
 
LRESULT SendCustomDlgNotificationMessage (HWND hwndParentDlg, UINT uCode)
 
static INT_PTR FILEDLG95_Handle_GetFilePath (HWND hwnd, DWORD size, LPVOID result)
 
static LRESULT FILEDLG95_OnWMGetMMI (HWND hwnd, LPMINMAXINFO mmiptr)
 
static LRESULT FILEDLG95_OnWMSize (HWND hwnd, WPARAM wParam)
 
static BOOL filename_is_edit (const FileOpenDlgInfos *info)
 
static void filedlg_browse_to_pidl (const FileOpenDlgInfos *info, LPITEMIDLIST pidl)
 
static BOOL FILEDLG95_SendFileOK (HWND hwnd, FileOpenDlgInfos *fodInfos)
 
void FILEDLG95_OnOpenMessage (HWND hwnd, int idCaption, int idText)
 
int FILEDLG95_ValidatePathAction (LPWSTR lpstrPathAndFile, IShellFolder **ppsf, HWND hwnd, DWORD flags, BOOL isSaveDlg, int defAction)
 
static BOOL FILEDLG95_unixfs_is_rooted_at_desktop (void)
 
static FORMATETC get_def_format (void)
 
void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd)
 
static HRESULT COMDLG32_StrRetToStrNW (LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
 
LPITEMIDLIST GetPidlFromDataObject (IDataObject *doSelected, UINT nPidlIndex)
 
static BOOL valid_struct_size (DWORD size)
 
static BOOL is_win16_looks (DWORD flags)
 
BOOL WINAPI GetOpenFileNameA (OPENFILENAMEA *ofn)
 
BOOL WINAPI GetOpenFileNameW (OPENFILENAMEW *ofn)
 
BOOL WINAPI GetSaveFileNameA (OPENFILENAMEA *ofn)
 
BOOL WINAPI GetSaveFileNameW (LPOPENFILENAMEW ofn)
 
short WINAPI GetFileTitleA (LPCSTR lpFile, LPSTR lpTitle, WORD cbBuf)
 
short WINAPI GetFileTitleW (LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf)
 

Variables

static const char LookInInfosStr [] = "LookInInfos"
 
static SIZE MemDialogSize = { 0, 0}
 
static const WCHAR LastVisitedMRUW []
 
static const WCHAR MRUListW [] = {'M','R','U','L','i','s','t',0}
 
static const WCHAR filedlg_info_propnameW [] = {'F','i','l','e','O','p','e','n','D','l','g','I','n','f','o','s',0}
 

Macro Definition Documentation

◆ CBGetItemDataPtr

#define CBGetItemDataPtr (   hwnd,
  iItemId 
)    SendMessageW(hwnd, CB_GETITEMDATA, (WPARAM)(iItemId), 0)

Definition at line 141 of file filedlg.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 57 of file filedlg.c.

◆ ITEM_NOTFOUND

#define ITEM_NOTFOUND   -1

Definition at line 124 of file filedlg.c.

◆ LISTEND

#define LISTEND   -1

Definition at line 119 of file filedlg.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 58 of file filedlg.c.

◆ SEARCH_EXP

#define SEARCH_EXP   2

Definition at line 123 of file filedlg.c.

◆ SEARCH_PIDL

#define SEARCH_PIDL   1

Definition at line 122 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE0

#define TBPLACES_CMDID_PLACE0   0xa064

Definition at line 129 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE1

#define TBPLACES_CMDID_PLACE1   0xa065

Definition at line 130 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE2

#define TBPLACES_CMDID_PLACE2   0xa066

Definition at line 131 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE3

#define TBPLACES_CMDID_PLACE3   0xa067

Definition at line 132 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE4

#define TBPLACES_CMDID_PLACE4   0xa068

Definition at line 133 of file filedlg.c.

◆ UNIMPLEMENTED_FLAGS

#define UNIMPLEMENTED_FLAGS
Value:
OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\
OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/)
#define OFN_NOREADONLYRETURN
Definition: commdlg.h:113
#define OFN_DONTADDTORECENT
Definition: commdlg.h:98

Definition at line 87 of file filedlg.c.

◆ WM_GETISHELLBROWSER

#define WM_GETISHELLBROWSER   WM_USER+7

Definition at line 127 of file filedlg.c.

◆ XTEXTOFFSET

#define XTEXTOFFSET   3

Definition at line 116 of file filedlg.c.

Typedef Documentation

◆ LookInInfos

◆ LPSFOLDER

◆ SFOLDER

Function Documentation

◆ ArrangeCtrlPositions()

static void ArrangeCtrlPositions ( HWND  hwndChildDlg,
HWND  hwndParentDlg,
BOOL  hide_help 
)
static

Definition at line 739 of file filedlg.c.

740 {
741  HWND hwndChild, hwndStc32;
742  RECT rectParent, rectChild, rectStc32;
743  INT help_fixup = 0;
744  int chgx, chgy;
745 
746  /* Take into account if open as read only checkbox and help button
747  * are hidden
748  */
749  if (hide_help)
750  {
751  RECT rectHelp, rectCancel;
752  GetWindowRect(GetDlgItem(hwndParentDlg, pshHelp), &rectHelp);
753  GetWindowRect(GetDlgItem(hwndParentDlg, IDCANCEL), &rectCancel);
754  /* subtract the height of the help button plus the space between
755  * the help button and the cancel button to the height of the dialog
756  */
757  help_fixup = rectHelp.bottom - rectCancel.bottom;
758  }
759 
760  /*
761  There are two possibilities to add components to the default file dialog box.
762 
763  By default, all the new components are added below the standard dialog box (the else case).
764 
765  However, if there is a static text component with the stc32 id, a special case happens.
766  The x and y coordinates of stc32 indicate the top left corner where to place the standard file dialog box
767  in the window and the cx and cy indicate how to size the window.
768  Moreover, if the new component's coordinates are on the left of the stc32 , it is placed on the left
769  of the standard file dialog box. If they are above the stc32 component, it is placed above and so on....
770 
771  */
772 
773  GetClientRect(hwndParentDlg, &rectParent);
774 
775  /* when arranging controls we have to use fixed parent size */
776  rectParent.bottom -= help_fixup;
777 
778  hwndStc32 = GetDlgItem(hwndChildDlg, stc32);
779  if (hwndStc32)
780  {
781  GetWindowRect(hwndStc32, &rectStc32);
782  MapWindowPoints(0, hwndChildDlg, (LPPOINT)&rectStc32, 2);
783 
784  /* set the size of the stc32 control according to the size of
785  * client area of the parent dialog
786  */
787  SetWindowPos(hwndStc32, 0,
788  0, 0,
789  rectParent.right, rectParent.bottom,
791  }
792  else
793  SetRectEmpty(&rectStc32);
794 
795  /* this part moves controls of the child dialog */
796  hwndChild = GetWindow(hwndChildDlg, GW_CHILD);
797  while (hwndChild)
798  {
799  if (hwndChild != hwndStc32)
800  {
801  GetWindowRect(hwndChild, &rectChild);
802  MapWindowPoints(0, hwndChildDlg, (LPPOINT)&rectChild, 2);
803 
804  /* move only if stc32 exist */
805  if (hwndStc32 && rectChild.left > rectStc32.right)
806  {
807  /* move to the right of visible controls of the parent dialog */
808  rectChild.left += rectParent.right;
809  rectChild.left -= rectStc32.right;
810  }
811  /* move even if stc32 doesn't exist */
812  if (rectChild.top >= rectStc32.bottom)
813  {
814  /* move below visible controls of the parent dialog */
815  rectChild.top += rectParent.bottom;
816  rectChild.top -= rectStc32.bottom - rectStc32.top;
817  }
818 
819  SetWindowPos(hwndChild, 0, rectChild.left, rectChild.top,
820  0, 0, SWP_NOSIZE | SWP_NOZORDER);
821  }
822  hwndChild = GetWindow(hwndChild, GW_HWNDNEXT);
823  }
824 
825  /* this part moves controls of the parent dialog */
826  hwndChild = GetWindow(hwndParentDlg, GW_CHILD);
827  while (hwndChild)
828  {
829  if (hwndChild != hwndChildDlg)
830  {
831  GetWindowRect(hwndChild, &rectChild);
832  MapWindowPoints(0, hwndParentDlg, (LPPOINT)&rectChild, 2);
833 
834  /* left,top of stc32 marks the position of controls
835  * from the parent dialog
836  */
837  rectChild.left += rectStc32.left;
838  rectChild.top += rectStc32.top;
839 
840  SetWindowPos(hwndChild, 0, rectChild.left, rectChild.top,
841  0, 0, SWP_NOSIZE | SWP_NOZORDER);
842  }
843  hwndChild = GetWindow(hwndChild, GW_HWNDNEXT);
844  }
845 
846  /* calculate the size of the resulting dialog */
847 
848  /* here we have to use original parent size */
849  GetClientRect(hwndParentDlg, &rectParent);
850  GetClientRect(hwndChildDlg, &rectChild);
851  TRACE( "parent %s child %s stc32 %s\n", wine_dbgstr_rect( &rectParent),
852  wine_dbgstr_rect( &rectChild), wine_dbgstr_rect( &rectStc32));
853 
854  if (hwndStc32)
855  {
856  /* width */
857  if (rectParent.right > rectStc32.right - rectStc32.left)
858  chgx = rectChild.right - ( rectStc32.right - rectStc32.left);
859  else
860  chgx = rectChild.right - rectParent.right;
861  /* height */
862  if (rectParent.bottom > rectStc32.bottom - rectStc32.top)
863  chgy = rectChild.bottom - ( rectStc32.bottom - rectStc32.top) - help_fixup;
864  else
865  /* Unconditionally set new dialog
866  * height to that of the child
867  */
868  chgy = rectChild.bottom - rectParent.bottom;
869  }
870  else
871  {
872  chgx = 0;
873  chgy = rectChild.bottom - help_fixup;
874  }
875  /* set the size of the parent dialog */
876  GetWindowRect(hwndParentDlg, &rectParent);
877  SetWindowPos(hwndParentDlg, 0,
878  0, 0,
879  rectParent.right - rectParent.left + chgx,
880  rectParent.bottom - rectParent.top + chgy,
882 }
#define GW_HWNDNEXT
Definition: winuser.h:756
#define GW_CHILD
Definition: winuser.h:758
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
const char * wine_dbgstr_rect(const RECT *rect)
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define SWP_NOSIZE
Definition: winuser.h:1230
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define pshHelp
Definition: dlgs.h:127
#define stc32
Definition: dlgs.h:191
LONG bottom
Definition: windef.h:294
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:825

Referenced by FILEDLG95_ResizeControls().

◆ BrowseSelectedFolder()

static BOOL BrowseSelectedFolder ( HWND  hwnd)
static

Definition at line 4130 of file filedlg.c.

4131 {
4133  BOOL bBrowseSelFolder = FALSE;
4134 
4135  TRACE("\n");
4136 
4137  if (GetNumSelected(fodInfos->Shell.FOIDataObject) == 1)
4138  {
4139  LPITEMIDLIST pidlSelection;
4140 
4141  /* get the file selected */
4142  pidlSelection = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, 1);
4143  if (IsPidlFolder (fodInfos->Shell.FOIShellFolder, pidlSelection))
4144  {
4145  if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser,
4146  pidlSelection, SBSP_RELATIVE ) ) )
4147  {
4148  WCHAR buf[64];
4150  MessageBoxW( hwnd, buf, fodInfos->title, MB_OK | MB_ICONEXCLAMATION );
4151  }
4152  bBrowseSelFolder = TRUE;
4153  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
4155  }
4156  ILFree( pidlSelection );
4157  }
4158 
4159  return bBrowseSelFolder;
4160 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LPITEMIDLIST GetPidlFromDataObject(IDataObject *doSelected, UINT nPidlIndex)
Definition: filedlg.c:3946
struct FileOpenDlgInfos::@325 Shell
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_PATHNOTEXISTING
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:985
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MB_OK
Definition: winuser.h:784
static UINT GetNumSelected(IDataObject *doSelected)
Definition: filedlg.c:3977
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4113
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156

Referenced by FILEDLG95_OnOpen().

◆ COMCTL32_ReleaseStgMedium()

static void COMCTL32_ReleaseStgMedium ( STGMEDIUM  medium)
static

Definition at line 3926 of file filedlg.c.

3927 {
3928  if(medium.pUnkForRelease)
3929  {
3930  IUnknown_Release(medium.pUnkForRelease);
3931  }
3932  else
3933  {
3934  GlobalUnlock(medium.u.hGlobal);
3935  GlobalFree(medium.u.hGlobal);
3936  }
3937 }
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190

Referenced by FILEDLG95_FILENAME_FillFromSelection(), GetNumSelected(), and GetPidlFromDataObject().

◆ COMDLG32_GetCanonicalPath()

void COMDLG32_GetCanonicalPath ( PCIDLIST_ABSOLUTE  pidlAbsCurrent,
LPWSTR  lpstrFile,
LPWSTR  lpstrPathAndFile 
)

Definition at line 651 of file filedlg.c.

653 {
654  WCHAR lpstrTemp[MAX_PATH];
655 
656  /* Get the current directory name */
657  if (!COMDLG32_GetDisplayNameOf(pidlAbsCurrent, lpstrPathAndFile))
658  {
659  /* last fallback */
660  GetCurrentDirectoryW(MAX_PATH, lpstrPathAndFile);
661  }
662  PathAddBackslashW(lpstrPathAndFile);
663 
664  TRACE("current directory=%s, file=%s\n", debugstr_w(lpstrPathAndFile), debugstr_w(lpstrFile));
665 
666  /* if the user specified a fully qualified path use it */
667  if(PathIsRelativeW(lpstrFile))
668  {
669  lstrcatW(lpstrPathAndFile, lpstrFile);
670  }
671  else
672  {
673  /* does the path have a drive letter? */
674  if (PathGetDriveNumberW(lpstrFile) == -1)
675  lstrcpyW(lpstrPathAndFile+2, lpstrFile);
676  else
677  lstrcpyW(lpstrPathAndFile, lpstrFile);
678  }
679 
680  /* resolve "." and ".." */
681  PathCanonicalizeW(lpstrTemp, lpstrPathAndFile );
682  lstrcpyW(lpstrPathAndFile, lpstrTemp);
683  TRACE("canon=%s\n", debugstr_w(lpstrPathAndFile));
684 }
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1558
BOOL WINAPI PathCanonicalizeW(LPWSTR lpszBuf, LPCWSTR lpszPath)
Definition: path.c:2425
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:413
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:630
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define lstrcpyW
Definition: compat.h:406
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:548
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274

Referenced by FILEDLG95_OnOpen(), and on_default_action().

◆ COMDLG32_GetDisplayNameOf()

static BOOL COMDLG32_GetDisplayNameOf ( LPCITEMIDLIST  pidl,
LPWSTR  pwszPath 
)
static

Definition at line 630 of file filedlg.c.

630  {
631  LPSHELLFOLDER psfDesktop;
632  STRRET strret;
633 
634  if (FAILED(SHGetDesktopFolder(&psfDesktop)))
635  return FALSE;
636 
637  if (FAILED(IShellFolder_GetDisplayNameOf(psfDesktop, pidl, SHGDN_FORPARSING, &strret))) {
638  IShellFolder_Release(psfDesktop);
639  return FALSE;
640  }
641 
642  IShellFolder_Release(psfDesktop);
643  return SUCCEEDED(StrRetToBufW(&strret, pidl, pwszPath, MAX_PATH));
644 }
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define MAX_PATH
Definition: compat.h:26
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by COMDLG32_GetCanonicalPath(), FILEDLG95_Handle_GetFilePath(), FILEDLG95_HandleCustomDialogMessages(), and FILEDLG95_OnOpenMultipleFiles().

◆ COMDLG32_SplitFileNames()

int COMDLG32_SplitFileNames ( LPWSTR  lpstrEdit,
UINT  nStrLen,
LPWSTR lpstrFileList,
UINT sizeUsed 
)

Definition at line 691 of file filedlg.c.

692 {
693  UINT nStrCharCount = 0; /* index in src buffer */
694  UINT nFileIndex = 0; /* index in dest buffer */
695  UINT nFileCount = 0; /* number of files */
696 
697  /* we might get single filename without any '"',
698  * so we need nStrLen + terminating \0 + end-of-list \0 */
699  *lpstrFileList = heap_alloc((nStrLen + 2) * sizeof(WCHAR));
700  *sizeUsed = 0;
701 
702  /* build delimited file list from filenames */
703  while ( nStrCharCount <= nStrLen )
704  {
705  if ( lpstrEdit[nStrCharCount]=='"' )
706  {
707  nStrCharCount++;
708  while ((nStrCharCount <= nStrLen) && (lpstrEdit[nStrCharCount]!='"'))
709  {
710  (*lpstrFileList)[nFileIndex++] = lpstrEdit[nStrCharCount];
711  nStrCharCount++;
712  }
713  (*lpstrFileList)[nFileIndex++] = 0;
714  nFileCount++;
715  }
716  nStrCharCount++;
717  }
718 
719  /* single, unquoted string */
720  if ((nStrLen > 0) && (nFileIndex == 0) )
721  {
722  lstrcpyW(*lpstrFileList, lpstrEdit);
723  nFileIndex = lstrlenW(lpstrEdit) + 1;
724  nFileCount = 1;
725  }
726 
727  /* trailing \0 */
728  (*lpstrFileList)[nFileIndex++] = '\0';
729 
730  *sizeUsed = nFileIndex;
731  return nFileCount;
732 }
#define lstrlenW
Definition: compat.h:407
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define lstrcpyW
Definition: compat.h:406
unsigned int UINT
Definition: ndis.h:50

Referenced by FILEDLG95_FILENAME_GetFileNames(), and on_default_action().

◆ COMDLG32_StrRetToStrNW()

static HRESULT COMDLG32_StrRetToStrNW ( LPWSTR  dest,
DWORD  len,
LPSTRRET  src,
const ITEMIDLIST pidl 
)
static

Definition at line 3864 of file filedlg.c.

3865 {
3866  switch (src->uType)
3867  {
3868  case STRRET_WSTR:
3869  lstrcpynW(dest, src->u.pOleStr, len);
3870  CoTaskMemFree(src->u.pOleStr);
3871  break;
3872 
3873  case STRRET_CSTR:
3874  if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len)
3875  dest[len-1] = 0;
3876  break;
3877 
3878  case STRRET_OFFSET:
3879  if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1, dest, len ) && len)
3880  dest[len-1] = 0;
3881  break;
3882 
3883  default:
3884  FIXME("unknown type %x!\n", src->uType);
3885  if (len) *dest = '\0';
3886  return E_FAIL;
3887  }
3888  return S_OK;
3889 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#define CP_ACP
Definition: compat.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define lstrcpynW
Definition: compat.h:397
#define FIXME(fmt,...)
Definition: debug.h:110
const char * LPCSTR
Definition: xmlstorage.h:183
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
#define MultiByteToWideChar
Definition: compat.h:100
static char * dest
Definition: rtl.c:135
SHITEMID mkid
Definition: shtypes.idl:34

Referenced by GetName().

◆ CreateTemplateDialog()

static HWND CreateTemplateDialog ( FileOpenDlgInfos fodInfos,
HWND  hwnd 
)
static

Definition at line 893 of file filedlg.c.

894 {
895  LPCVOID template;
896  HRSRC hRes;
897  HANDLE hDlgTmpl = 0;
898  HWND hChildDlg = 0;
899 
900  TRACE("%p, %p\n", fodInfos, hwnd);
901 
902  /*
903  * If OFN_ENABLETEMPLATEHANDLE is specified, the OPENFILENAME
904  * structure's hInstance parameter is not a HINSTANCE, but
905  * instead a pointer to a template resource to use.
906  */
908  {
910  if (fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE)
911  {
913  if( !(template = LockResource( fodInfos->ofnInfos->hInstance)))
914  {
916  return NULL;
917  }
918  }
919  else
920  {
921  hinst = fodInfos->ofnInfos->hInstance;
922  if(fodInfos->unicode)
923  {
924  LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
926  }
927  else
928  {
931  }
932  if (!hRes)
933  {
935  return NULL;
936  }
937  if (!(hDlgTmpl = LoadResource( hinst, hRes )) ||
938  !(template = LockResource( hDlgTmpl )))
939  {
941  return NULL;
942  }
943  }
944  if (fodInfos->unicode)
945  hChildDlg = CreateDialogIndirectParamW(hinst, template, hwnd,
947  (LPARAM)fodInfos->ofnInfos);
948  else
949  hChildDlg = CreateDialogIndirectParamA(hinst, template, hwnd,
951  (LPARAM)fodInfos->ofnInfos);
952  return hChildDlg;
953  }
954  else if (is_dialog_hooked(fodInfos))
955  {
956  RECT rectHwnd;
957  struct {
958  DLGTEMPLATE tmplate;
959  WORD menu,class,title;
960  } temp;
961  GetClientRect(hwnd,&rectHwnd);
963  temp.tmplate.dwExtendedStyle = 0;
964  temp.tmplate.cdit = 0;
965  temp.tmplate.x = 0;
966  temp.tmplate.y = 0;
967  temp.tmplate.cx = 0;
968  temp.tmplate.cy = 0;
969  temp.menu = temp.class = temp.title = 0;
970 
971  hChildDlg = CreateDialogIndirectParamA(COMDLG32_hInstance, &temp.tmplate,
972  hwnd, (DLGPROC)fodInfos->ofnInfos->lpfnHook, (LPARAM)fodInfos->ofnInfos);
973 
974  return hChildDlg;
975  }
976  return NULL;
977 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
HINSTANCE hInstance
Definition: commdlg.h:362
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define CDERR_LOADRESFAILURE
Definition: cderr.h:12
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
OPENFILENAME ofn
Definition: main.cpp:37
HWND WINAPI CreateDialogIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
static BOOL is_dialog_hooked(const FileOpenDlgInfos *info)
Definition: filedlg.c:161
#define WS_CHILD
Definition: pedump.c:617
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
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
#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
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define RT_DIALOG
Definition: pedump.c:367
static INT_PTR CALLBACK FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:884
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI CreateDialogIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
unsigned short WORD
Definition: ntddk_ex.h:93
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2849
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define DS_3DLOOK
Definition: winuser.h:367
static calc_node_t temp
Definition: rpn_ieee.c:38
#define DS_CONTROL
Definition: winuser.h:372
#define OFN_ENABLETEMPLATEHANDLE
Definition: commdlg.h:103
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN
Definition: cdlg32.c:119
CONST void * LPCVOID
Definition: windef.h:191
static HINSTANCE hinst
Definition: edit.c:551
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define WS_VISIBLE
Definition: pedump.c:620
static char title[]
Definition: ps.c:92
struct tagOFNA * LPOPENFILENAMEA

Referenced by FileOpenDlgProc95().

◆ filedialog_is_readonly_hidden()

static BOOL filedialog_is_readonly_hidden ( const FileOpenDlgInfos info)
static

Definition at line 166 of file filedlg.c.

167 {
168  return (info->ofnInfos->Flags & OFN_HIDEREADONLY) || (info->DlgInfos.dwDlgProp & FODPROP_SAVEDLG);
169 }
#define FODPROP_SAVEDLG
#define OFN_HIDEREADONLY
Definition: commdlg.h:107

Referenced by FILEDLG95_InitControls(), and FILEDLG95_ResizeControls().

◆ FILEDLG95_Clean()

void FILEDLG95_Clean ( HWND  hwnd)
static

Definition at line 2005 of file filedlg.c.

2006 {
2010 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void FILEDLG95_LOOKIN_Clean(HWND hwnd)
Definition: filedlg.c:3737
static void FILEDLG95_FILETYPE_Clean(HWND hwnd)
Definition: filedlg.c:3264
static void FILEDLG95_SHELL_Clean(HWND hwnd)
Definition: filedlg.c:3053

Referenced by FILEDLG95_OnOpen(), FILEDLG95_OnOpenMultipleFiles(), and FILEDLG95_OnWMCommand().

◆ FILEDLG95_FILENAME_FillFromSelection()

void FILEDLG95_FILENAME_FillFromSelection ( HWND  hwnd)

Definition at line 3788 of file filedlg.c.

3789 {
3791  LPITEMIDLIST pidl;
3792  LPWSTR lpstrAllFiles, lpstrTmp;
3793  UINT nFiles = 0, nFileToOpen, nFileSelected, nAllFilesLength = 0, nThisFileLength, nAllFilesMaxLength;
3794  STGMEDIUM medium;
3795  LPIDA cida;
3796  FORMATETC formatetc = get_def_format();
3797 
3798  TRACE("\n");
3799 
3800  if (FAILED(IDataObject_GetData(fodInfos->Shell.FOIDataObject, &formatetc, &medium)))
3801  return;
3802 
3803  cida = GlobalLock(medium.u.hGlobal);
3804  nFileSelected = cida->cidl;
3805 
3806  /* Allocate a buffer */
3807  nAllFilesMaxLength = MAX_PATH + 3;
3808  lpstrAllFiles = heap_alloc_zero(nAllFilesMaxLength * sizeof(WCHAR));
3809  if (!lpstrAllFiles)
3810  goto ret;
3811 
3812  /* Loop through the selection, handle only files (not folders) */
3813  for (nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++)
3814  {
3815  pidl = (LPITEMIDLIST)((LPBYTE)cida + cida->aoffset[nFileToOpen + 1]);
3816  if (pidl)
3817  {
3818  if (!IsPidlFolder(fodInfos->Shell.FOIShellFolder, pidl))
3819  {
3820  if (nAllFilesLength + MAX_PATH + 3 > nAllFilesMaxLength)
3821  {
3822  nAllFilesMaxLength *= 2;
3823  lpstrTmp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpstrAllFiles, nAllFilesMaxLength * sizeof(WCHAR));
3824  if (!lpstrTmp)
3825  goto ret;
3826  lpstrAllFiles = lpstrTmp;
3827  }
3828  nFiles += 1;
3829  lpstrAllFiles[nAllFilesLength++] = '"';
3830  GetName(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, lpstrAllFiles + nAllFilesLength);
3831  nThisFileLength = lstrlenW(lpstrAllFiles + nAllFilesLength);
3832  nAllFilesLength += nThisFileLength;
3833  lpstrAllFiles[nAllFilesLength++] = '"';
3834  lpstrAllFiles[nAllFilesLength++] = ' ';
3835  }
3836  }
3837  }
3838 
3839  if (nFiles != 0)
3840  {
3841  /* If there's only one file, use the name as-is without quotes */
3842  lpstrTmp = lpstrAllFiles;
3843  if (nFiles == 1)
3844  {
3845  lpstrTmp += 1;
3846  lpstrTmp[nThisFileLength] = 0;
3847  }
3848  SetWindowTextW(fodInfos->DlgInfos.hwndFileName, lpstrTmp);
3849  /* Select the file name like Windows does */
3850  if (filename_is_edit(fodInfos))
3851  SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
3852  }
3853 
3854 ret:
3855  heap_free(lpstrAllFiles);
3856  COMCTL32_ReleaseStgMedium(medium);
3857 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl, DWORD dwFlags, LPWSTR lpstrFileName)
Definition: filedlg.c:4012
struct FileOpenDlgInfos::@325 Shell
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
static void COMCTL32_ReleaseStgMedium(STGMEDIUM medium)
Definition: filedlg.c:3926
#define lstrlenW
Definition: compat.h:407
static FORMATETC get_def_format(void)
Definition: filedlg.c:3769
unsigned char * LPBYTE
Definition: typedefs.h:52
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define EM_SETSEL
Definition: winuser.h:1979
UINT cidl
Definition: shlobj.h:491
int ret
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HeapReAlloc
Definition: compat.h:393
UINT aoffset[1]
Definition: shlobj.h:492
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4113
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1510
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
Definition: shlobj.h:490
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by IShellBrowserImpl_OnSelChange().

◆ FILEDLG95_FILENAME_GetFileNames()

static int FILEDLG95_FILENAME_GetFileNames ( HWND  hwnd,
LPWSTR lpstrFileList,
UINT sizeUsed 
)
static

Definition at line 3896 of file filedlg.c.

3897 {
3899  UINT nFileCount = 0; /* number of files */
3900  UINT nStrLen = 0; /* length of string in edit control */
3901  LPWSTR lpstrEdit; /* buffer for string from edit control */
3902 
3903  TRACE("\n");
3904 
3905  /* get the filenames from the filename control */
3906  nStrLen = GetWindowTextLengthW( fodInfos->DlgInfos.hwndFileName );
3907  lpstrEdit = heap_alloc( (nStrLen+1)*sizeof(WCHAR) );
3908  GetWindowTextW( fodInfos->DlgInfos.hwndFileName, lpstrEdit, nStrLen+1);
3909 
3910  TRACE("nStrLen=%u str=%s\n", nStrLen, debugstr_w(lpstrEdit));
3911 
3912  nFileCount = COMDLG32_SplitFileNames(lpstrEdit, nStrLen, lpstrFileList, sizeUsed);
3913  heap_free(lpstrEdit);
3914  return nFileCount;
3915 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define debugstr_w
Definition: kernel32.h:32
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetWindowTextLengthW(_In_ HWND)
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed)
Definition: filedlg.c:691
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
unsigned int UINT
Definition: ndis.h:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_FILETYPE_Clean()

static void FILEDLG95_FILETYPE_Clean ( HWND  hwnd)
static

Definition at line 3264 of file filedlg.c.

3265 {
3267  int iPos;
3268  int iCount;
3269 
3270  iCount = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCOUNT, 0, 0);
3271 
3272  TRACE("\n");
3273 
3274  /* Delete each string of the combo and their associated data */
3275  if(iCount != CB_ERR)
3276  {
3277  for(iPos = iCount-1;iPos>=0;iPos--)
3278  {
3279  heap_free((void *)CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iPos));
3280  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_DELETESTRING, iPos, 0);
3281  }
3282  }
3283  /* Current filter */
3284  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3285 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
struct FileOpenDlgInfos::@326 ShellInfos
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define CB_ERR
Definition: winuser.h:2389
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1903
#define CB_DELETESTRING
Definition: winuser.h:1898
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_Clean().

◆ FILEDLG95_FILETYPE_Init()

static HRESULT FILEDLG95_FILETYPE_Init ( HWND  hwnd)
static

Definition at line 3079 of file filedlg.c.

3080 {
3082  int nFilters = 0; /* number of filters */
3083  int nFilterIndexCB;
3084 
3085  TRACE("%p\n", hwnd);
3086 
3087  if(fodInfos->customfilter)
3088  {
3089  /* customfilter has one entry... title\0ext\0
3090  * Set first entry of combo box item with customfilter
3091  */
3092  LPWSTR lpstrExt;
3093  LPCWSTR lpstrPos = fodInfos->customfilter;
3094 
3095  /* Get the title */
3096  lpstrPos += lstrlenW(fodInfos->customfilter) + 1;
3097 
3098  /* Copy the extensions */
3099  if (! *lpstrPos) return E_FAIL; /* malformed filter */
3100  if (!(lpstrExt = heap_alloc((lstrlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
3101  lstrcpyW(lpstrExt,lpstrPos);
3102 
3103  /* Add the item at the end of the combo */
3104  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_ADDSTRING, 0, (LPARAM)fodInfos->customfilter);
3105  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETITEMDATA, nFilters, (LPARAM)lpstrExt);
3106 
3107  nFilters++;
3108  }
3109  if(fodInfos->filter)
3110  {
3111  LPCWSTR lpstrPos = fodInfos->filter;
3112 
3113  for(;;)
3114  {
3115  /* filter is a list... title\0ext\0......\0\0
3116  * Set the combo item text to the title and the item data
3117  * to the ext
3118  */
3119  LPCWSTR lpstrDisplay;
3120  LPWSTR lpstrExt;
3121 
3122  /* Get the title */
3123  if(! *lpstrPos) break; /* end */
3124  lpstrDisplay = lpstrPos;
3125  lpstrPos += lstrlenW(lpstrPos) + 1;
3126 
3127  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_ADDSTRING, 0, (LPARAM)lpstrDisplay);
3128 
3129  nFilters++;
3130 
3131  /* Copy the extensions */
3132  if (!(lpstrExt = heap_alloc((lstrlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
3133  lstrcpyW(lpstrExt,lpstrPos);
3134  lpstrPos += lstrlenW(lpstrPos) + 1;
3135 
3136  /* Add the item at the end of the combo */
3137  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETITEMDATA, nFilters - 1, (LPARAM)lpstrExt);
3138 
3139  /* malformed filters are added anyway... */
3140  if (!*lpstrExt) break;
3141  }
3142  }
3143 
3144  /*
3145  * Set the current filter to the one specified
3146  * in the initialisation structure
3147  */
3148  if (fodInfos->filter || fodInfos->customfilter)
3149  {
3150  LPWSTR lpstrFilter;
3151 
3152  /* Check to make sure our index isn't out of bounds. */
3153  if ( fodInfos->ofnInfos->nFilterIndex >
3154  nFilters - (fodInfos->customfilter == NULL ? 0 : 1) )
3155  fodInfos->ofnInfos->nFilterIndex = (fodInfos->customfilter == NULL ? 1 : 0);
3156 
3157  /* set default filter index */
3158  if(fodInfos->ofnInfos->nFilterIndex == 0 && fodInfos->customfilter == NULL)
3159  fodInfos->ofnInfos->nFilterIndex = 1;
3160 
3161  /* calculate index of Combo Box item */
3162  nFilterIndexCB = fodInfos->ofnInfos->nFilterIndex;
3163  if (fodInfos->customfilter == NULL)
3164  nFilterIndexCB--;
3165 
3166  /* Set the current index selection. */
3167  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETCURSEL, nFilterIndexCB, 0);
3168 
3169  /* Get the corresponding text string from the combo box. */
3170  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3171  nFilterIndexCB);
3172 
3173  if ((INT_PTR)lpstrFilter == CB_ERR) /* control is empty */
3174  lpstrFilter = NULL;
3175 
3176  if(lpstrFilter)
3177  {
3178  DWORD len;
3179  CharLowerW(lpstrFilter); /* lowercase */
3180  len = lstrlenW(lpstrFilter)+1;
3181  fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc( len * sizeof(WCHAR) );
3182  lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
3183  }
3184  } else
3185  fodInfos->ofnInfos->nFilterIndex = 0;
3186  return S_OK;
3187 }
#define CB_SETITEMDATA
Definition: winuser.h:1927
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
struct FileOpenDlgInfos::@326 ShellInfos
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPWSTR WINAPI CharLowerW(_Inout_ LPWSTR)
int32_t INT_PTR
Definition: typedefs.h:62
#define lstrlenW
Definition: compat.h:407
#define E_FAIL
Definition: ddrawi.h:102
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define CB_ADDSTRING
Definition: winuser.h:1897
smooth NULL
Definition: ftsmooth.c:416
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_ERR
Definition: winuser.h:2389
DWORD nFilterIndex
Definition: commdlg.h:366
LPOPENFILENAMEW ofnInfos
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define CB_SETCURSEL
Definition: winuser.h:1922
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_FILETYPE_OnCommand()

static BOOL FILEDLG95_FILETYPE_OnCommand ( HWND  hwnd,
WORD  wNotifyCode 
)
static

Definition at line 3195 of file filedlg.c.

3196 {
3198 
3199  switch(wNotifyCode)
3200  {
3201  case CBN_SELENDOK:
3202  {
3203  LPWSTR lpstrFilter;
3204 
3205  /* Get the current item of the filetype combo box */
3206  int iItem = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCURSEL, 0, 0);
3207 
3208  /* set the current filter index */
3209  fodInfos->ofnInfos->nFilterIndex = iItem +
3210  (fodInfos->customfilter == NULL ? 1 : 0);
3211 
3212  /* Set the current filter with the current selection */
3213  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3214 
3215  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3216  iItem);
3217  if((INT_PTR)lpstrFilter != CB_ERR)
3218  {
3219  DWORD len;
3220  CharLowerW(lpstrFilter); /* lowercase */
3221  len = lstrlenW(lpstrFilter)+1;
3222  fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc( len * sizeof(WCHAR) );
3223  lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
3224  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3226  }
3227 
3228  /* Refresh the actual view to display the included items*/
3229  if (fodInfos->Shell.FOIShellView)
3230  IShellView_Refresh(fodInfos->Shell.FOIShellView);
3231  }
3232  }
3233  return FALSE;
3234 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
struct FileOpenDlgInfos::@326 ShellInfos
LPWSTR WINAPI CharLowerW(_Inout_ LPWSTR)
struct FileOpenDlgInfos::@325 Shell
int32_t INT_PTR
Definition: typedefs.h:62
#define lstrlenW
Definition: compat.h:407
#define CB_GETCURSEL
Definition: winuser.h:1904
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define CBN_SELENDOK
Definition: winuser.h:1942
smooth NULL
Definition: ftsmooth.c:416
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define CB_ERR
Definition: winuser.h:2389
DWORD nFilterIndex
Definition: commdlg.h:366
LPOPENFILENAMEW ofnInfos
struct FileOpenDlgInfos::@327 DlgInfos
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define CDN_TYPECHANGE
Definition: commdlg.h:39
#define lstrcpyW
Definition: compat.h:406
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:985
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_FILETYPE_SearchExt()

static int FILEDLG95_FILETYPE_SearchExt ( HWND  hwnd,
LPCWSTR  lpstrExt 
)
static

Definition at line 3240 of file filedlg.c.

3241 {
3242  int i, iCount;
3243 
3244  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
3245 
3246  TRACE("%s\n", debugstr_w(lpstrExt));
3247 
3248  if(iCount != CB_ERR)
3249  {
3250  for(i=0;i<iCount;i++)
3251  {
3252  if(!lstrcmpiW(lpstrExt,(LPWSTR)CBGetItemDataPtr(hwnd,i)))
3253  return i;
3254  }
3255  }
3256  return -1;
3257 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
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 debugstr_w
Definition: kernel32.h:32
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define CB_ERR
Definition: winuser.h:2389
#define TRACE(s)
Definition: solgame.cpp:4
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1903
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_FillControls()

static LRESULT FILEDLG95_FillControls ( HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1968 of file filedlg.c.

1969 {
1970  LPITEMIDLIST pidlItemId = NULL;
1971 
1972  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
1973 
1974  TRACE("dir=%s file=%s\n",
1975  debugstr_w(fodInfos->initdir), debugstr_w(fodInfos->filename));
1976 
1977  /* Get the initial directory pidl */
1978 
1979  if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->initdir)))
1980  {
1981  WCHAR path[MAX_PATH];
1982 
1984  pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder, path);
1985  }
1986 
1987  /* Initialise shell objects */
1989 
1990  /* Initialize the Look In combo box */
1991  FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB);
1992 
1993  /* Browse to the initial directory */
1994  IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId, SBSP_ABSOLUTE);
1995 
1996  ILFree(pidlItemId);
1997 
1998  return TRUE;
1999 }
static void FILEDLG95_LOOKIN_Init(HWND hwndCombo)
Definition: filedlg.c:3313
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:413
struct FileOpenDlgInfos::@325 Shell
static LRESULT FILEDLG95_SHELL_Init(HWND hwnd)
Definition: filedlg.c:2966
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static LPITEMIDLIST GetPidlFromName(IShellFolder *psf, LPWSTR lpcstrFileName)
Definition: filedlg.c:4087
Definition: services.c:325
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPARAM lParam
Definition: combotst.c:139

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_Handle_GetFilePath()

static INT_PTR FILEDLG95_Handle_GetFilePath ( HWND  hwnd,
DWORD  size,
LPVOID  result 
)
static

Definition at line 1014 of file filedlg.c.

1015 {
1016  UINT len, total;
1017  WCHAR *p, *buffer;
1019 
1020  TRACE("CDM_GETFILEPATH:\n");
1021 
1022  if ( ! (fodInfos->ofnInfos->Flags & OFN_EXPLORER ) )
1023  return -1;
1024 
1025  /* get path and filenames */
1026  len = SendMessageW( fodInfos->DlgInfos.hwndFileName, WM_GETTEXTLENGTH, 0, 0 );
1027  buffer = heap_alloc( (len + 2 + MAX_PATH) * sizeof(WCHAR) );
1028  COMDLG32_GetDisplayNameOf( fodInfos->ShellInfos.pidlAbsCurrent, buffer );
1029  if (len)
1030  {
1031  p = buffer + strlenW(buffer);
1032  *p++ = '\\';
1033  SendMessageW( fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, len + 1, (LPARAM)p );
1034  }
1035  if (fodInfos->unicode)
1036  {
1037  total = strlenW( buffer) + 1;
1038  if (result) lstrcpynW( result, buffer, size );
1039  TRACE( "CDM_GETFILEPATH: returning %u %s\n", total, debugstr_w(result));
1040  }
1041  else
1042  {
1043  total = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL );
1044  if (total <= size) WideCharToMultiByte( CP_ACP, 0, buffer, -1, result, size, NULL, NULL );
1045  TRACE( "CDM_GETFILEPATH: returning %u %s\n", total, debugstr_a(result));
1046  }
1047  heap_free( buffer );
1048  return total;
1049 }
#define OFN_EXPLORER
Definition: commdlg.h:104
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
struct FileOpenDlgInfos::@326 ShellInfos
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
#define WM_GETTEXT
Definition: winuser.h:1600
GLuint buffer
Definition: glext.h:5915
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define lstrcpynW
Definition: compat.h:397
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:630
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LPOPENFILENAMEW ofnInfos
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:26
GLenum GLsizei len
Definition: glext.h:6722
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
GLfloat GLfloat p
Definition: glext.h:8902
GLuint64EXT * result
Definition: glext.h:11304
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_HandleCustomDialogMessages().

◆ FILEDLG95_HandleCustomDialogMessages()

static INT_PTR FILEDLG95_HandleCustomDialogMessages ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1056 of file filedlg.c.

1057 {
1059  WCHAR lpstrPath[MAX_PATH];
1060  INT_PTR retval;
1061 
1062  if(!fodInfos) return FALSE;
1063 
1064  switch(uMsg)
1065  {
1066  case CDM_GETFILEPATH:
1068  break;
1069 
1070  case CDM_GETFOLDERPATH:
1071  TRACE("CDM_GETFOLDERPATH:\n");
1072  COMDLG32_GetDisplayNameOf(fodInfos->ShellInfos.pidlAbsCurrent, lpstrPath);
1073  if (lParam)
1074  {
1075  if (fodInfos->unicode)
1076  lstrcpynW((LPWSTR)lParam, lpstrPath, (int)wParam);
1077  else
1078  WideCharToMultiByte(CP_ACP, 0, lpstrPath, -1,
1079  (LPSTR)lParam, (int)wParam, NULL, NULL);
1080  }
1081  retval = lstrlenW(lpstrPath) + 1;
1082  break;
1083 
1084  case CDM_GETFOLDERIDLIST:
1085  retval = ILGetSize(fodInfos->ShellInfos.pidlAbsCurrent);
1086  if (retval <= wParam)
1087  memcpy((void*)lParam, fodInfos->ShellInfos.pidlAbsCurrent, retval);
1088  break;
1089 
1090  case CDM_GETSPEC:
1091  TRACE("CDM_GETSPEC:\n");
1092  retval = SendMessageW(fodInfos->DlgInfos.hwndFileName, WM_GETTEXTLENGTH, 0, 0) + 1;
1093  if (lParam)
1094  {
1095  if (fodInfos->unicode)
1096  SendMessageW(fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, wParam, lParam);
1097  else
1098  SendMessageA(fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, wParam, lParam);
1099  }
1100  break;
1101 
1102  case CDM_SETCONTROLTEXT:
1103  TRACE("CDM_SETCONTROLTEXT:\n");
1104  if ( lParam )
1105  {
1106  if( fodInfos->unicode )
1108  else
1110  }
1111  retval = TRUE;
1112  break;
1113 
1114  case CDM_HIDECONTROL:
1115  /* MSDN states that it should fail for not OFN_EXPLORER case */
1116  if (fodInfos->ofnInfos->Flags & OFN_EXPLORER)
1117  {
1118  HWND control = GetDlgItem( hwnd, wParam );
1119  if (control) ShowWindow( control, SW_HIDE );
1120  retval = TRUE;
1121  }
1122  else retval = FALSE;
1123  break;
1124 
1125  default:
1126  if (uMsg >= CDM_FIRST && uMsg <= CDM_LAST)
1127  FIXME("message CDM_FIRST+%04x not implemented\n", uMsg - CDM_FIRST);
1128  return FALSE;
1129  }
1131  return TRUE;
1132 }
#define OFN_EXPLORER
Definition: commdlg.h:104
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define TRUE
Definition: types.h:120
struct FileOpenDlgInfos::@326 ShellInfos
#define WideCharToMultiByte
Definition: compat.h:101
#define SW_HIDE
Definition: winuser.h:762
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CP_ACP
Definition: compat.h:99
BOOL WINAPI SetDlgItemTextA(_In_ HWND, _In_ int, _In_ LPCSTR)
#define WM_GETTEXT
Definition: winuser.h:1600
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:62
char * LPSTR
Definition: xmlstorage.h:182
#define CDM_LAST
Definition: commdlg.h:42
#define lstrlenW
Definition: compat.h:407
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define lstrcpynW
Definition: compat.h:397
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:630
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define CDM_GETFOLDERPATH
Definition: commdlg.h:45
#define CDM_HIDECONTROL
Definition: commdlg.h:48
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define CDM_FIRST
Definition: commdlg.h:41
LPOPENFILENAMEW ofnInfos
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CDM_GETSPEC
Definition: commdlg.h:43
#define CDM_GETFILEPATH
Definition: commdlg.h:44
static INT_PTR FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID result)
Definition: filedlg.c:1014
#define MAX_PATH
Definition: compat.h:26
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CDM_SETCONTROLTEXT
Definition: commdlg.h:47
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define ILGetSize
Definition: shellclasses.h:638
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define CDM_GETFOLDERIDLIST
Definition: commdlg.h:46
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_InitControls()

static LRESULT FILEDLG95_InitControls ( HWND  hwnd)
static

Definition at line 1521 of file filedlg.c.

1522 {
1523  BOOL win2000plus = FALSE;
1524  BOOL win98plus = FALSE;
1525  BOOL handledPath = FALSE;
1526  OSVERSIONINFOW osVi;
1527  static const WCHAR szwSlash[] = { '\\', 0 };
1528  static const WCHAR szwStar[] = { '*',0 };
1529 
1530  static const TBBUTTON tbb[] =
1531  {
1532  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1534  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1536  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1538  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1541  };
1542  static const TBADDBITMAP tba = {HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR};
1543 
1544  RECT rectTB;
1545  RECT rectlook;
1546 
1547  HIMAGELIST toolbarImageList;
1548  ITEMIDLIST *desktopPidl;
1550 
1552 
1553  TRACE("%p\n", fodInfos);
1554 
1555  /* Get windows version emulating */
1556  osVi.dwOSVersionInfoSize = sizeof(osVi);
1557  GetVersionExW(&osVi);
1559  win98plus = ((osVi.dwMajorVersion > 4) || ((osVi.dwMajorVersion == 4) && (osVi.dwMinorVersion > 0)));
1560  } else if (osVi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
1561  win2000plus = (osVi.dwMajorVersion > 4);
1562  if (win2000plus) win98plus = TRUE;
1563  }
1564  TRACE("Running on 2000+ %d, 98+ %d\n", win2000plus, win98plus);
1565 
1566 
1567  /* Use either the edit or the comboboxex for the filename control */
1568  if (filename_is_edit( fodInfos ))
1569  {
1571  fodInfos->DlgInfos.hwndFileName = GetDlgItem( hwnd, edt1 );
1572  }
1573  else
1574  {
1576  fodInfos->DlgInfos.hwndFileName = GetDlgItem( hwnd, cmb13 );
1577  }
1578 
1579  /* Get the hwnd of the controls */
1580  fodInfos->DlgInfos.hwndFileTypeCB = GetDlgItem(hwnd,IDC_FILETYPE);
1581  fodInfos->DlgInfos.hwndLookInCB = GetDlgItem(hwnd,IDC_LOOKIN);
1582 
1583  GetWindowRect( fodInfos->DlgInfos.hwndLookInCB,&rectlook);
1584  MapWindowPoints( 0, hwnd,(LPPOINT)&rectlook,2);
1585 
1586  /* construct the toolbar */
1588  MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2);
1589 
1590  rectTB.right = rectlook.right + rectTB.right - rectTB.left;
1591  rectTB.bottom = rectlook.top - 1 + rectTB.bottom - rectTB.top;
1592  rectTB.left = rectlook.right;
1593  rectTB.top = rectlook.top-1;
1594 
1595  if (fodInfos->unicode)
1596  fodInfos->DlgInfos.hwndTB = CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL,
1598  rectTB.left, rectTB.top,
1599  rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
1601  else
1602  fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL,
1604  rectTB.left, rectTB.top,
1605  rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
1607 
1608  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
1609 
1610 /* FIXME: use TB_LOADIMAGES when implemented */
1611 /* SendMessageW(fodInfos->DlgInfos.hwndTB, TB_LOADIMAGES, IDB_VIEW_SMALL_COLOR, HINST_COMMCTRL);*/
1612  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_SETMAXTEXTROWS, 0, 0);
1613  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, 12, (LPARAM) &tba);
1614 
1615  /* Retrieve and add desktop icon to the toolbar */
1616  toolbarImageList = (HIMAGELIST)SendMessageW(fodInfos->DlgInfos.hwndTB, TB_GETIMAGELIST, 0, 0L);
1618  SHGetFileInfoW((const WCHAR *)desktopPidl, 0, &fileinfo, sizeof(fileinfo),
1620  ImageList_AddIcon(toolbarImageList, fileinfo.hIcon);
1621 
1622  DestroyIcon(fileinfo.hIcon);
1623  CoTaskMemFree(desktopPidl);
1624 
1625  /* Finish Toolbar Construction */
1626  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSW, 9, (LPARAM) tbb);
1627  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
1628 
1629  if (is_places_bar_enabled(fodInfos))
1630  {
1631  TBBUTTON tb = { 0 };
1632  HIMAGELIST himl;
1633  RECT rect;
1634  int i, cx;
1635 
1638  cx = rect.right - rect.left;
1639 
1642 
1643  filedlg_collect_places_pidls(fodInfos);
1644  for (i = 0; i < ARRAY_SIZE(fodInfos->places); i++)
1645  {
1646  int index;
1647 
1648  if (!fodInfos->places[i])
1649  continue;
1650 
1651  memset(&fileinfo, 0, sizeof(fileinfo));
1652  SHGetFileInfoW((const WCHAR *)fodInfos->places[i], 0, &fileinfo, sizeof(fileinfo),
1655 
1656  tb.iBitmap = index;
1657  tb.iString = (INT_PTR)fileinfo.szDisplayName;
1658  tb.fsState = TBSTATE_ENABLED | TBSTATE_WRAP;
1659  tb.idCommand = TBPLACES_CMDID_PLACE0 + i;
1661 
1662  DestroyIcon(fileinfo.hIcon);
1663  }
1664 
1667  }
1668 
1669  /* Set the window text with the text specified in the OPENFILENAME structure */
1670  if(fodInfos->title)
1671  {
1672  SetWindowTextW(hwnd,fodInfos->title);
1673  }
1674  else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
1675  {
1676  WCHAR buf[64];
1679  }
1680 
1681  /* Initialise the file name edit control */
1682  handledPath = FALSE;
1683  TRACE("Before manipulation, file = %s, dir = %s\n", debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1684 
1685  if(fodInfos->filename)
1686  {
1687  /* 1. If win2000 or higher and filename contains a path, use it
1688  in preference over the lpstrInitialDir */
1689  if (win2000plus && *fodInfos->filename && strpbrkW(fodInfos->filename, szwSlash)) {
1690  WCHAR tmpBuf[MAX_PATH];
1691  WCHAR *nameBit;
1692  DWORD result;
1693 
1694  result = GetFullPathNameW(fodInfos->filename, MAX_PATH, tmpBuf, &nameBit);
1695  if (result) {
1696 
1697  /* nameBit is always shorter than the original filename. It may be NULL
1698  * when the filename contains only a drive name instead of file name */
1699  if (nameBit)
1700  {
1701  lstrcpyW(fodInfos->filename,nameBit);
1702  *nameBit = 0x00;
1703  }
1704  else
1705  *fodInfos->filename = '\0';
1706 
1707  heap_free(fodInfos->initdir);
1708  fodInfos->initdir = heap_alloc((lstrlenW(tmpBuf) + 1)*sizeof(WCHAR));
1709  lstrcpyW(fodInfos->initdir, tmpBuf);
1710  handledPath = TRUE;
1711  TRACE("Value in Filename includes path, overriding InitialDir: %s, %s\n",
1712  debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1713  }
1714  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1715 
1716  } else {
1717  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1718  }
1719  }
1720 
1721  /* 2. (All platforms) If initdir is not null, then use it */
1722  if (!handledPath && fodInfos->initdir && *fodInfos->initdir)
1723  {
1724  /* Work out the proper path as supplied one might be relative */
1725  /* (Here because supplying '.' as dir browses to My Computer) */
1726  WCHAR tmpBuf[MAX_PATH];
1727  WCHAR tmpBuf2[MAX_PATH];
1728  WCHAR *nameBit;
1729  DWORD result;
1730 
1731  lstrcpyW(tmpBuf, fodInfos->initdir);
1732  if (PathFileExistsW(tmpBuf)) {
1733  /* initdir does not have to be a directory. If a file is
1734  * specified, the dir part is taken */
1735  if (PathIsDirectoryW(tmpBuf)) {
1736  PathAddBackslashW(tmpBuf);
1737  lstrcatW(tmpBuf, szwStar);
1738  }
1739  result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit);
1740  if (result) {
1741  *nameBit = 0x00;
1742  heap_free(fodInfos->initdir);
1743  fodInfos->initdir = heap_alloc((lstrlenW(tmpBuf2) + 1) * sizeof(WCHAR));
1744  lstrcpyW(fodInfos->initdir, tmpBuf2);
1745  handledPath = TRUE;
1746  TRACE("Value in InitDir changed to %s\n", debugstr_w(fodInfos->initdir));
1747  }
1748  }
1749  else if (fodInfos->initdir)
1750  {
1751  heap_free(fodInfos->initdir);
1752  fodInfos->initdir = NULL;
1753  TRACE("Value in InitDir is not an existing path, changed to (nil)\n");
1754  }
1755  }
1756 
1757  if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir))
1758  {
1759  /* 3. All except w2k+: if filename contains a path use it */
1760  if (!win2000plus && fodInfos->filename &&
1761  *fodInfos->filename &&
1762  strpbrkW(fodInfos->filename, szwSlash)) {
1763  WCHAR tmpBuf[MAX_PATH];
1764  WCHAR *nameBit;
1765  DWORD result;
1766 
1768  tmpBuf, &nameBit);
1769  if (result) {
1770  int len;
1771 
1772  /* nameBit is always shorter than the original filename */
1773  lstrcpyW(fodInfos->filename, nameBit);
1774  *nameBit = 0x00;
1775 
1776  len = lstrlenW(tmpBuf);
1777  heap_free(fodInfos->initdir);
1778  fodInfos->initdir = heap_alloc((len+1)*sizeof(WCHAR));
1779  lstrcpyW(fodInfos->initdir, tmpBuf);
1780 
1781  handledPath = TRUE;
1782  TRACE("Value in Filename includes path, overriding initdir: %s, %s\n",
1783  debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1784  }
1785  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1786  }
1787 
1788  /* 4. Win2000+: Recently used */
1789  if (!handledPath && win2000plus) {
1790  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1791  fodInfos->initdir[0] = '\0';
1792 
1794 
1795  if (fodInfos->initdir[0] && PathFileExistsW(fodInfos->initdir)){
1796  handledPath = TRUE;
1797  }else{
1798  heap_free(fodInfos->initdir);
1799  fodInfos->initdir = NULL;
1800  }
1801  }
1802 
1803  /* 5. win98+ and win2000+ if any files of specified filter types in
1804  current directory, use it */
1805  if (win98plus && !handledPath && fodInfos->filter && *fodInfos->filter) {
1806 
1807  LPCWSTR lpstrPos = fodInfos->filter;
1808  WIN32_FIND_DATAW FindFileData;
1809  HANDLE hFind;
1810 
1811  while (1)
1812  {
1813  /* filter is a list... title\0ext\0......\0\0 */
1814 
1815  /* Skip the title */
1816  if(! *lpstrPos) break; /* end */
1817  lpstrPos += lstrlenW(lpstrPos) + 1;
1818 
1819  /* See if any files exist in the current dir with this extension */
1820  if(! *lpstrPos) break; /* end */
1821 
1822  hFind = FindFirstFileW(lpstrPos, &FindFileData);
1823 
1824  if (hFind == INVALID_HANDLE_VALUE) {
1825  /* None found - continue search */
1826  lpstrPos += lstrlenW(lpstrPos) + 1;
1827 
1828  } else {
1829 
1830  heap_free(fodInfos->initdir);
1831  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1833 
1834  handledPath = TRUE;
1835  TRACE("No initial dir specified, but files of type %s found in current, so using it\n",
1836  debugstr_w(lpstrPos));
1837  FindClose(hFind);
1838  break;
1839  }
1840  }
1841  }
1842 
1843  /* 6. Win98+ and 2000+: Use personal files dir, others use current dir */
1844  if (!handledPath && (win2000plus || win98plus)) {
1845  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1846 
1847  if (SHGetFolderPathW(hwnd, CSIDL_PERSONAL, 0, 0, fodInfos->initdir) == S_OK)
1848  {
1850  {
1851  /* last fallback */
1853  TRACE("No personal or desktop dir, using cwd as failsafe: %s\n", debugstr_w(fodInfos->initdir));
1854  }
1855  else
1856  TRACE("No personal dir, using desktop instead: %s\n", debugstr_w(fodInfos->initdir));
1857  }
1858  else
1859  TRACE("No initial dir specified, using personal files dir of %s\n", debugstr_w(fodInfos->initdir));
1860 
1861  handledPath = TRUE;
1862  } else if (!handledPath) {
1863  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1865  handledPath = TRUE;
1866  TRACE("No initial dir specified, using current dir of %s\n", debugstr_w(fodInfos->initdir));
1867  }
1868  }
1869  SetFocus( fodInfos->DlgInfos.hwndFileName );
1870  TRACE("After manipulation, file = %s, dir = %s\n", debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1871 
1872  /* Must the open as read only check box be checked ?*/
1873  if(fodInfos->ofnInfos->Flags & OFN_READONLY)
1874  {
1876  }
1877 
1878  /* Must the open as read only check box be hidden? */
1879  if (filedialog_is_readonly_hidden(fodInfos))
1880  {
1883  }
1884 
1885  /* Must the help button be hidden? */
1886  if (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP))
1887  {
1890  }
1891 
1892  /* change Open to Save */
1893  if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
1894  {
1895  WCHAR buf[16];
1900  }
1901 
1902  /* Initialize the filter combo box */
1904 
1905  return 0;
1906 }
#define WS_GROUP
Definition: pedump.c:633
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define IDC_TOOLBARPLACES
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1702
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define TB_SETBUTTONSIZE
Definition: commctrl.h:1107
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:236
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1106
#define TRUE
Definition: types.h:120
#define FCIDM_TB_REPORTVIEW
Definition: shresdef.h:766
#define IDOK
Definition: winuser.h:824
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define IDS_SAVE_AS
Definition: cdlg.h:177
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
static BOOL is_places_bar_enabled(const FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:279
#define CSIDL_DESKTOP
Definition: shlobj.h:2003
#define SW_HIDE
Definition: winuser.h:762
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
static BOOL filedialog_is_readonly_hidden(const FileOpenDlgInfos *info)
Definition: filedlg.c:166
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:413
#define IDC_OPENREADONLY
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:915
LONG top
Definition: windef.h:292
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1105
HWND WINAPI SetFocus(_In_opt_ HWND)
#define VIEW_LIST
Definition: commctrl.h:1061
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:291
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:62
#define TB_GETIMAGELIST
Definition: commctrl.h:1123
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
#define cmb13
Definition: dlgs.h:60
LONG right
Definition: windef.h:293
#define lstrlenW
Definition: compat.h:407
HIMAGELIST himl
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SHGFI_SMALLICON
Definition: shellapi.h:174
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
& rect
Definition: startmenu.cpp:1413
#define IDS_SAVE_BUTTON
Definition: cdlg.h:174
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define ILC_COLOR32
Definition: commctrl.h:343
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define TB_SETMAXTEXTROWS
Definition: commctrl.h:1134
static void FILEDLG95_MRU_load_filename(LPWSTR stored_path)
Definition: filedlg.c:2441
#define CCS_NODIVIDER
Definition: commctrl.h:2220
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 BTNS_BUTTON
Definition: commctrl.h:970
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDC_FILETYPE
#define TB_AUTOSIZE
Definition: commctrl.h:1109
#define FCIDM_TB_UPFOLDER
Definition: shresdef.h:763
#define debugstr_w
Definition: kernel32.h:32
#define SHGFI_PIDL
Definition: shellapi.h:178
#define SM_CXICON
Definition: winuser.h:962
#define FODPROP_SAVEDLG
#define FCIDM_TB_NEWFOLDER
Definition: shresdef.h:764
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
#define IDS_SAVE_IN
Definition: cdlg.h:175
GLuint index
Definition: glext.h:6031
#define IDC_LOOKINSTATIC
#define VIEW_DETAILS
Definition: commctrl.h:1062
LPOPENFILENAMEW ofnInfos
#define TB_SETIMAGELIST
Definition: commctrl.h:1122
struct FileOpenDlgInfos::@327 DlgInfos
#define IDB_VIEW_SMALL_COLOR
Definition: commctrl.h:1038
#define BM_SETCHECK
Definition: winuser.h:1882
#define TRACE(s)
Definition: solgame.cpp:4
#define TBPLACES_CMDID_PLACE0
Definition: filedlg.c:129
ULONG dwMajorVersion
Definition: rtltypes.h:243
#define BTNS_SEP
Definition: commctrl.h:971
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:410
#define IDC_LOOKIN
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2687
#define VIEW_NEWFOLDER
Definition: commctrl.h:1070
WINE_UNICODE_INLINE WCHAR * strpbrkW(const WCHAR *str, const WCHAR *accept)
Definition: unicode.h:261
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:242
#define MAX_PATH
Definition: compat.h:26
LPITEMIDLIST places[5]
#define FCIDM_TB_DESKTOP
Definition: shresdef.h:767
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_TOOLBAR
Definition: wordpad.h:157
static const WCHAR tb[]
Definition: suminfo.c:286
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:961
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:505
#define OFN_READONLY
Definition: commdlg.h:118
#define TB_ADDBITMAP
Definition: commctrl.h:1028
#define CCS_NORESIZE
Definition: commctrl.h:2217
#define edt1
Definition: dlgs.h:65
#define SM_CYICON
Definition: winuser.h:963
#define index(s, c)
Definition: various.h:29
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:309
static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
Definition: filedlg.c:3079
#define TB_ADDBUTTONSW
Definition: commctrl.h:1238
GLenum GLsizei len
Definition: glext.h:6722
#define TB_SETBUTTONWIDTH
Definition: commctrl.h:1133
ULONG dwPlatformId
Definition: rtltypes.h:246
#define IDC_TOOLBARSTATIC
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define TOOLBARCLASSNAMEA
Definition: commctrl.h:916
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void filedlg_collect_places_pidls(FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:301
#define FCIDM_TB_SMALLICON
Definition: shresdef.h:765
#define CSIDL_FLAG_CREATE
#define pshHelp
Definition: dlgs.h:127
#define HINST_COMMCTRL
Definition: commctrl.h:1035
#define VER_PLATFORM_WIN32_WINDOWS
Definition: rtltypes.h:235
ULONG dwMinorVersion
Definition: rtltypes.h:244
#define CSIDL_PERSONAL
Definition: shlobj.h:2008
_Out_opt_ int * cx
Definition: commctrl.h:570
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2085
#define TBSTATE_ENABLED
Definition: commctrl.h:946
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define TBSTATE_WRAP
Definition: commctrl.h:949
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define VIEW_PARENTFOLDER
Definition: commctrl.h:1067
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2018
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define SHGFI_ICON
Definition: shellapi.h:162
#define WS_VISIBLE
Definition: pedump.c:620
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1510
#define TBSTYLE_FLAT
Definition: commctrl.h:964
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
#define OFN_SHOWHELP
Definition: commdlg.h:120
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_LOOKIN_AddItem()

static int FILEDLG95_LOOKIN_AddItem ( HWND  hwnd,
LPITEMIDLIST  pidl,
int  iInsertId 
)
static

Definition at line 3534 of file filedlg.c.

3535 {
3536  LPITEMIDLIST pidlNext;
3537  SHFILEINFOW sfi;
3538  SFOLDER *tmpFolder;
3539  LookInInfos *liInfos;
3540 
3541  TRACE("%p, %p, %d\n", hwnd, pidl, iInsertId);
3542 
3543  if(!pidl)
3544  return -1;
3545 
3546  if(!(liInfos = GetPropA(hwnd,LookInInfosStr)))
3547  return -1;
3548 
3549  tmpFolder = heap_alloc_zero(sizeof(*tmpFolder));
3550  tmpFolder->m_iIndent = 0;
3551 
3552  /* Calculate the indentation of the item in the lookin*/
3553  pidlNext = pidl;
3554  while ((pidlNext = ILGetNext(pidlNext)))
3555  {
3556  tmpFolder->m_iIndent++;
3557  }
3558 
3559  tmpFolder->pidlItem = ILClone(pidl);
3560 
3561  if(tmpFolder->m_iIndent > liInfos->iMaxIndentation)
3562  liInfos->iMaxIndentation = tmpFolder->m_iIndent;
3563 
3564  sfi.dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
3565  SHGetFileInfoW((LPCWSTR)pidl,
3566  0,
3567  &sfi,
3568  sizeof(sfi),
3570 
3571  TRACE("-- Add %s attr=0x%08x\n", debugstr_w(sfi.szDisplayName), sfi.dwAttributes);
3572 
3573  if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
3574  {
3575  int iItemID;
3576 
3577  TRACE("-- Add %s at %u\n", debugstr_w(sfi.szDisplayName), tmpFolder->m_iIndent);
3578 
3579  /* Add the item at the end of the list */
3580  if(iInsertId < 0)
3581  {
3582  iItemID = SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)sfi.szDisplayName);
3583  }
3584  /* Insert the item at the iInsertId position*/
3585  else
3586  {
3587  iItemID = SendMessageW(hwnd, CB_INSERTSTRING, iInsertId, (LPARAM)sfi.szDisplayName);
3588  }
3589 
3590  SendMessageW(hwnd, CB_SETITEMDATA, iItemID, (LPARAM)tmpFolder);
3591  return iItemID;
3592  }
3593 
3594  ILFree( tmpFolder->pidlItem );
3595  heap_free( tmpFolder );
3596  return -1;
3597 
3598 }
#define CB_SETITEMDATA
Definition: winuser.h:1927
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static const char LookInInfosStr[]
Definition: filedlg.c:144
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD dwAttributes
Definition: shellapi.h:372
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
int iMaxIndentation
Definition: filedlg.c:106
#define debugstr_w
Definition: kernel32.h:32
#define SHGFI_PIDL
Definition: shellapi.h:178
#define CB_ADDSTRING
Definition: winuser.h:1897
#define CB_INSERTSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
#define TRACE(s)
Definition: solgame.cpp:4
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:410
int m_iIndent
Definition: filedlg.c:99
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:166
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define SHGFI_ATTR_SPECIFIED
Definition: shellapi.h:172
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_LOOKIN_Init(), and FILEDLG95_LOOKIN_InsertItemAfterParent().

◆ FILEDLG95_LOOKIN_Clean()

static void FILEDLG95_LOOKIN_Clean ( HWND  hwnd)
static

Definition at line 3737 of file filedlg.c.

3738 {
3740  LookInInfos *liInfos = GetPropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
3741  int iPos, iCount;
3742 
3743  iCount = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCOUNT, 0, 0);
3744 
3745  TRACE("\n");
3746 
3747  /* Delete each string of the combo and their associated data */
3748  if (iCount != CB_ERR)
3749  {
3750  for(iPos = iCount-1;iPos>=0;iPos--)
3751  {
3752  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,iPos);
3753  ILFree(tmpFolder->pidlItem);
3754  heap_free(tmpFolder);
3755  SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_DELETESTRING, iPos, 0);
3756  }
3757  }
3758 
3759  /* LookInInfos structure */
3760  heap_free(liInfos);
3761  RemovePropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
3762 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HANDLE WINAPI RemovePropA(_In_ HWND, _In_ LPCSTR)
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static const char LookInInfosStr[]
Definition: filedlg.c:144
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define CB_ERR
Definition: winuser.h:2389
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1903
#define CB_DELETESTRING
Definition: winuser.h:1898
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
struct SFolder * LPSFOLDER

Referenced by FILEDLG95_Clean().

◆ FILEDLG95_LOOKIN_DrawItem()

static LRESULT FILEDLG95_LOOKIN_DrawItem ( LPDRAWITEMSTRUCT  pDIStruct)
static

Definition at line 3398 of file filedlg.c.

3399 {
3401  COLORREF crHighLight = GetSysColor(COLOR_HIGHLIGHT);
3403  RECT rectText;
3404  RECT rectIcon;
3405  SHFILEINFOW sfi;
3406  HIMAGELIST ilItemImage;
3407  int iIndentation;
3408  TEXTMETRICW tm;
3409  LPSFOLDER tmpFolder;
3411  UINT icon_width, icon_height;
3412 
3413  TRACE("\n");
3414 
3415  if(pDIStruct->itemID == -1)
3416  return 0;
3417 
3418  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem,
3419  pDIStruct->itemID)))
3420  return 0;
3421 
3422 
3423  icon_width = GetSystemMetrics(SM_CXICON);
3424  icon_height = GetSystemMetrics(SM_CYICON);
3425  if (pDIStruct->rcItem.bottom - pDIStruct->rcItem.top < icon_height)
3426  {
3427  icon_width = GetSystemMetrics(SM_CXSMICON);
3428  icon_height = GetSystemMetrics(SM_CYSMICON);
3429  shgfi_flags |= SHGFI_SMALLICON;
3430  }
3431 
3432  ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
3433  0, &sfi, sizeof (sfi), shgfi_flags );
3434 
3435  /* Is this item selected ? */
3436  if(pDIStruct->itemState & ODS_SELECTED)
3437  {
3438  SetTextColor(pDIStruct->hDC,(0x00FFFFFF & ~(crText)));
3439  SetBkColor(pDIStruct->hDC,crHighLight);
3440  FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_HIGHLIGHT));
3441  }
3442  else
3443  {
3444  SetTextColor(pDIStruct->hDC,crText);
3445  SetBkColor(pDIStruct->hDC,crWin);
3446  FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_WINDOW));
3447  }
3448 
3449  /* Do not indent item if drawing in the edit of the combo */
3450  if(pDIStruct->itemState & ODS_COMBOBOXEDIT)
3451  iIndentation = 0;
3452  else
3453  iIndentation = tmpFolder->m_iIndent;
3454 
3455  /* Draw text and icon */
3456 
3457  /* Initialise the icon display area */
3458  rectIcon.left = pDIStruct->rcItem.left + 1 + icon_width/2 * iIndentation;
3459  rectIcon.top = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - icon_height) / 2;
3460  rectIcon.right = rectIcon.left + icon_width + XTEXTOFFSET;
3461  rectIcon.bottom = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + icon_height) / 2;
3462 
3463  /* Initialise the text display area */
3464  GetTextMetricsW(pDIStruct->hDC, &tm);
3465  rectText.left = rectIcon.right;
3466  rectText.top =
3467  (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - tm.tmHeight) / 2;
3468  rectText.right = pDIStruct->rcItem.right;
3469  rectText.bottom =
3470  (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + tm.tmHeight) / 2;
3471 
3472  /* Draw the icon from the image list */
3473  ImageList_Draw(ilItemImage,
3474  sfi.iIcon,
3475  pDIStruct->hDC,
3476  rectIcon.left,
3477  rectIcon.top,
3478  ILD_TRANSPARENT );
3479 
3480  /* Draw the associated text */
3481  TextOutW(pDIStruct->hDC,rectText.left,rectText.top,sfi.szDisplayName,lstrlenW(sfi.szDisplayName));
3482  return NOERROR;
3483 }
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:169
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define NOERROR
Definition: winerror.h:2354
LONG top
Definition: windef.h:292
#define SM_CYSMICON
Definition: winuser.h:1003
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1193
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define lstrlenW
Definition: compat.h:407
#define SHGFI_SMALLICON
Definition: shellapi.h:174
#define COLOR_WINDOW
Definition: winuser.h:908
DWORD WINAPI GetSysColor(_In_ int)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
#define SHGFI_PIDL
Definition: shellapi.h:178
#define SM_CXICON
Definition: winuser.h:962
#define SHGFI_OPENICON
Definition: shellapi.h:176
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
#define XTEXTOFFSET
Definition: filedlg.c:116
#define TRACE(s)
Definition: solgame.cpp:4
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:410
DWORD COLORREF
Definition: windef.h:285
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
int m_iIndent
Definition: filedlg.c:99
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1002
#define SM_CYICON
Definition: winuser.h:963
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:309
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
Definition: time.h:76
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:884
#define ILD_TRANSPARENT
Definition: commctrl.h:403
unsigned int UINT
Definition: ndis.h:50
#define ODS_SELECTED
Definition: winuser.h:2499
LONG bottom
Definition: windef.h:294
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_LOOKIN_Init()

static void FILEDLG95_LOOKIN_Init ( HWND  hwndCombo)
static

Definition at line 3313 of file filedlg.c.

3314 {
3315  IShellFolder *psfRoot, *psfDrives;
3316  IEnumIDList *lpeRoot, *lpeDrives;
3317  LPITEMIDLIST pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
3318  HDC hdc;
3319  TEXTMETRICW tm;
3320  LookInInfos *liInfos = heap_alloc_zero(sizeof(*liInfos));
3321 
3322  TRACE("%p\n", hwndCombo);
3323 
3324  liInfos->iMaxIndentation = 0;
3325 
3326  SetPropA(hwndCombo, LookInInfosStr, liInfos);
3327 
3328  hdc = GetDC( hwndCombo );
3329  SelectObject( hdc, (HFONT)SendMessageW( hwndCombo, WM_GETFONT, 0, 0 ));
3330  GetTextMetricsW( hdc, &tm );
3331  ReleaseDC( hwndCombo, hdc );
3332 
3333  /* set item height for both text field and listbox */
3334  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, -1, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3335  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, 0, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3336 
3337  /* Turn on the extended UI for the combo box like Windows does */
3338  SendMessageW(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
3339 
3340  /* Initialise data of Desktop folder */
3342  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3343  ILFree(pidlTmp);
3344 
3346 
3347  SHGetDesktopFolder(&psfRoot);
3348 
3349  if (psfRoot)
3350  {
3351  /* enumerate the contents of the desktop */
3352  if(SUCCEEDED(IShellFolder_EnumObjects(psfRoot, hwndCombo, SHCONTF_FOLDERS, &lpeRoot)))
3353  {
3354  while (S_OK == IEnumIDList_Next(lpeRoot, 1, &pidlTmp, NULL))
3355  {
3356  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3357 
3358  /* If the unixfs extension is rooted, we don't expand the drives by default */
3360  {
3361  /* special handling for CSIDL_DRIVES */
3362  if (ILIsEqual(pidlTmp, pidlDrives))
3363  {
3364  if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
3365  {
3366  /* enumerate the drives */
3367  if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives)))
3368  {
3369  while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
3370  {
3371  pidlAbsTmp = ILCombine(pidlTmp, pidlTmp1);
3372  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
3373  ILFree(pidlAbsTmp);
3374  ILFree(pidlTmp1);
3375  }
3376  IEnumIDList_Release(lpeDrives);
3377  }
3378  IShellFolder_Release(psfDrives);
3379  }
3380  }
3381  }
3382 
3383  ILFree(pidlTmp);
3384  }
3385  IEnumIDList_Release(lpeRoot);
3386  }
3387  IShellFolder_Release(psfRoot);
3388  }
3389 
3390  ILFree(pidlDrives);
3391 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
static const char LookInInfosStr[]
Definition: filedlg.c:144
#define LISTEND
Definition: filedlg.c:119
HDC WINAPI GetDC(_In_opt_ HWND)
#define CSIDL_DESKTOP
Definition: shlobj.h:2003
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define SM_CYSMICON
Definition: winuser.h:1003
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
int iMaxIndentation
Definition: filedlg.c:106
#define CB_SETITEMHEIGHT
Definition: winuser.h:1928
#define CSIDL_DRIVES
Definition: shlobj.h:2019
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
#define WM_GETFONT
Definition: winuser.h:1633
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
static BOOL FILEDLG95_unixfs_is_rooted_at_desktop(void)
Definition: filedlg.c:3296
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2687
int WINAPI GetSystemMetrics(_In_ int)
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:3534
HDC hdc
Definition: main.c:9
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
Definition: time.h:76
#define S_OK
Definition: intsafe.h:59
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_SETEXTENDEDUI
Definition: winuser.h:1925
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by FILEDLG95_FillControls().

◆ FILEDLG95_LOOKIN_InsertItemAfterParent()

static int FILEDLG95_LOOKIN_InsertItemAfterParent ( HWND  hwnd,
LPITEMIDLIST  pidl 
)
static

Definition at line 3605 of file filedlg.c.

3606 {
3607 
3608  LPITEMIDLIST pidlParent = GetParentPidl(pidl);
3609  int iParentPos;
3610 
3611  TRACE("\n");
3612 
3613  if (pidl == pidlParent)
3614  return -1;
3615 
3616  iParentPos = FILEDLG95_LOOKIN_SearchItem(hwnd,(WPARAM)pidlParent,SEARCH_PIDL);
3617 
3618  if(iParentPos < 0)
3619  {
3620  iParentPos = FILEDLG95_LOOKIN_InsertItemAfterParent(hwnd,pidlParent);
3621  }
3622 
3623  ILFree(pidlParent);
3624 
3625  return FILEDLG95_LOOKIN_AddItem(hwnd,pidl,iParentPos + 1);
3626 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:3707
UINT_PTR WPARAM
Definition: windef.h:207
#define SEARCH_PIDL
Definition: filedlg.c:122
LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl)
Definition: filedlg.c:4069
#define TRACE(s)
Definition: solgame.cpp:4
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:3534
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:3605
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by FILEDLG95_LOOKIN_SelectItem().

◆ FILEDLG95_LOOKIN_OnCommand()

static BOOL FILEDLG95_LOOKIN_OnCommand ( HWND  hwnd,
WORD  wNotifyCode 
)
static

Definition at line 3491 of file filedlg.c.

3492 {
3494 
3495  TRACE("%p\n", fodInfos);
3496 
3497  switch(wNotifyCode)
3498  {
3499  case CBN_SELENDOK:
3500  {
3501  LPSFOLDER tmpFolder;
3502  int iItem;
3503 
3504  iItem = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCURSEL, 0, 0);
3505 
3506  if( iItem == CB_ERR) return FALSE;
3507 
3508  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,
3509  iItem)))
3510  return FALSE;
3511 
3512 
3513  if(SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
3514  tmpFolder->pidlItem,
3515  SBSP_ABSOLUTE)))
3516  {
3517  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3519  return TRUE;
3520  }
3521  break;
3522  }
3523 
3524  }
3525  return FALSE;
3526 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define TRUE
Definition: types.h:120
struct FileOpenDlgInfos::@325 Shell
#define CB_GETCURSEL
Definition: winuser.h:1904
#define CBN_SELENDOK
Definition: winuser.h:1942
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define CB_ERR
Definition: winuser.h:2389
LPOPENFILENAMEW ofnInfos
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:985
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SUCCEEDED(hr)
Definition: intsafe.h:57
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_LOOKIN_RemoveMostExpandedItem()

static int FILEDLG95_LOOKIN_RemoveMostExpandedItem ( HWND  hwnd)
static

Definition at line 3677 of file filedlg.c.

3678 {
3679  int iItemPos;
3681 
3682  TRACE("\n");
3683 
3684  if(liInfos->iMaxIndentation <= 2)
3685  return -1;
3686 
3687  if((iItemPos = FILEDLG95_LOOKIN_SearchItem(hwnd,liInfos->iMaxIndentation,SEARCH_EXP)) >=0)
3688  {
3689  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
3690  ILFree(tmpFolder->pidlItem);
3691  heap_free(tmpFolder);
3692  SendMessageW(hwnd, CB_DELETESTRING, iItemPos, 0);
3693  liInfos->iMaxIndentation--;
3694 
3695  return iItemPos;
3696  }
3697 
3698  return -1;
3699 }
#define SEARCH_EXP
Definition: filedlg.c:123
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static const char LookInInfosStr[]
Definition: filedlg.c:144
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:3707
int iMaxIndentation
Definition: filedlg.c:106
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_DELETESTRING
Definition: winuser.h:1898
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
struct SFolder * LPSFOLDER

Referenced by FILEDLG95_LOOKIN_SelectItem().

◆ FILEDLG95_LOOKIN_SearchItem()

static int FILEDLG95_LOOKIN_SearchItem ( HWND  hwnd,
WPARAM  searchArg,
int  iSearchMethod 
)
static

Definition at line 3707 of file filedlg.c.

3708 {
3709  int i = 0;
3710  int iCount;
3711 
3712  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
3713 
3714  TRACE("0x%08lx 0x%x\n",searchArg, iSearchMethod);
3715 
3716  if (iCount != CB_ERR)
3717  {
3718  for(;i<iCount;i++)
3719  {
3720  LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i);
3721 
3722  if (iSearchMethod == SEARCH_PIDL && ILIsEqual((LPITEMIDLIST)searchArg, tmpFolder->pidlItem))
3723  return i;
3724  if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg)
3725  return i;
3726  }
3727  }
3728 
3729  return -1;
3730 }
#define SEARCH_EXP
Definition: filedlg.c:123
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
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 SEARCH_PIDL
Definition: filedlg.c:122
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define CB_ERR
Definition: winuser.h:2389
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:99
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1903
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
struct SFolder * LPSFOLDER

Referenced by FILEDLG95_LOOKIN_InsertItemAfterParent(), FILEDLG95_LOOKIN_RemoveMostExpandedItem(), and FILEDLG95_LOOKIN_SelectItem().

◆ FILEDLG95_LOOKIN_SelectItem()

int FILEDLG95_LOOKIN_SelectItem ( HWND  hwnd,
LPITEMIDLIST  pidl 
)

Definition at line 3634 of file filedlg.c.

3635 {
3636  int iItemPos;
3637  LookInInfos *liInfos;
3638 
3639  TRACE("%p, %p\n", hwnd, pidl);
3640 
3642 
3643  liInfos = GetPropA(hwnd,LookInInfosStr);
3644 
3645  if(iItemPos < 0)
3646  {
3649  }
3650 
3651  else
3652  {
3653  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
3654  while(liInfos->iMaxIndentation > tmpFolder->m_iIndent)
3655  {
3656  int iRemovedItem;
3657 
3658  if(-1 == (iRemovedItem = FILEDLG95_LOOKIN_RemoveMostExpandedItem(hwnd)))
3659  break;
3660  if(iRemovedItem < iItemPos)
3661  iItemPos--;
3662  }
3663  }
3664 
3665  SendMessageW(hwnd, CB_SETCURSEL, iItemPos, 0);
3666  liInfos->uSelectedItem = iItemPos;
3667 
3668  return 0;
3669 
3670 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const char LookInInfosStr[]
Definition: filedlg.c:144
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:3707
UINT_PTR WPARAM
Definition: windef.h:207
int iMaxIndentation
Definition: filedlg.c:106
#define SEARCH_PIDL
Definition: filedlg.c:122
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:99
#define CB_SETCURSEL
Definition: winuser.h:1922
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static int FILEDLG95_LOOKIN_RemoveMostExpandedItem(HWND hwnd)
Definition: filedlg.c:3677
UINT uSelectedItem
Definition: filedlg.c:107
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:3605
struct SFolder * LPSFOLDER

Referenced by IShellBrowserImpl_BrowseObject().

◆ FILEDLG95_MRU_get_slot()

static WCHAR FILEDLG95_MRU_get_slot ( LPCWSTR  module_name,
LPWSTR  stored_path,
PHKEY  hkey_ret 
)
static

Definition at line 2279 of file filedlg.c.

2280 {
2281  WCHAR mru_list[32], *cur_mru_slot;
2282  BOOL taken[25] = {0};
2283  DWORD mru_list_size = sizeof(mru_list), key_type = -1, i;
2284  HKEY hkey_tmp, *hkey;
2285  LONG ret;
2286 
2287  if(hkey_ret)
2288  hkey = hkey_ret;
2289  else
2290  hkey = &hkey_tmp;
2291 
2292  if(stored_path)
2293  *stored_path = '\0';
2294 
2296  if(ret){
2297  WARN("Unable to create MRU key: %d\n", ret);
2298  return 0;
2299  }
2300 
2301  ret = RegGetValueW(*hkey, NULL, MRUListW, RRF_RT_REG_SZ, &key_type,
2302  (LPBYTE)mru_list, &mru_list_size);
2303  if(ret || key_type != REG_SZ){
2304  if(ret == ERROR_FILE_NOT_FOUND)
2305  return 'a';
2306 
2307  WARN("Error getting MRUList data: type: %d, ret: %d\n", key_type, ret);
2308  RegCloseKey(*hkey);
2309  return 0;
2310  }
2311 
2312  for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot){
2313  WCHAR value_data[MAX_PATH], value_name[2] = {0};
2314  DWORD value_data_size = sizeof(value_data);
2315 
2316  *value_name = *cur_mru_slot;
2317 
2318  ret = RegGetValueW(*hkey, NULL, value_name, RRF_RT_REG_BINARY,
2319  &key_type, (LPBYTE)value_data, &value_data_size);
2320  if(ret || key_type != REG_BINARY){
2321  WARN("Error getting MRU slot data: type: %d, ret: %d\n", key_type, ret);
2322  continue;
2323  }
2324 
2325  if(!strcmpiW(module_name, value_data)){
2326  if(!hkey_ret)
2327  RegCloseKey(*hkey);
2328  if(stored_path)
2329  lstrcpyW(stored_path, value_data + lstrlenW(value_data) + 1);
2330  return *value_name;
2331  }
2332  }
2333 
2334  if(!hkey_ret)
2335  RegCloseKey(*hkey);
2336 
2337  /* the module name isn't in the registry, so find the next open slot */
2338  for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot)
2339  taken[*cur_mru_slot - 'a'] = TRUE;
2340  for(i = 0; i < 25; ++i){
2341  if(!taken[i])
2342  return i + 'a';
2343  }
2344 
2345  /* all slots are taken, so return the last one in MRUList */
2346  --cur_mru_slot;
2347  return *cur_mru_slot;
2348 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1975
#define TRUE
Definition: types.h:120
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
#define REG_BINARY
Definition: nt_native.h:1496
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define WARN(fmt,...)
Definition: debug.h:111
#define RRF_RT_REG_SZ
Definition: driver.c:575
#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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1202
static const WCHAR MRUListW[]
Definition: filedlg.c:152
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define lstrcpyW
Definition: compat.h:406
static const WCHAR LastVisitedMRUW[]
Definition: filedlg.c:147
#define RRF_RT_REG_BINARY
Definition: driver.c:577
#define REG_SZ
Definition: layer.c:22

Referenced by FILEDLG95_MRU_load_filename(), and FILEDLG95_MRU_save_filename().

◆ FILEDLG95_MRU_load_filename()

static void FILEDLG95_MRU_load_filename ( LPWSTR  stored_path)
static

Definition at line 2441 of file filedlg.c.

2442 {
2443  WCHAR module_path[MAX_PATH], *module_name;
2444 
2445  /* get the current executable's name */
2446  if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2447  {
2448  WARN("GotModuleFileName failed: %d\n", GetLastError());
2449  return;
2450  }
2451  module_name = strrchrW(module_path, '\\');
2452  if(!module_name)
2453  module_name = module_path;
2454  else
2455  module_name += 1;
2456 
2457  FILEDLG95_MRU_get_slot(module_name, stored_path, NULL);
2458  TRACE("got MRU path: %s\n", wine_dbgstr_w(stored_path));
2459 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:607
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
#define WARN(fmt,...)
Definition: debug.h:111
#define wine_dbgstr_w
Definition: kernel32.h:34
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
#define ARRAY_SIZE(a)
Definition: main.h:24
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:845
static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHKEY hkey_ret)
Definition: filedlg.c:2279

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_MRU_save_filename()

static void FILEDLG95_MRU_save_filename ( LPCWSTR  filename)
static

Definition at line 2351 of file filedlg.c.

2352 {
2353  WCHAR module_path[MAX_PATH], *module_name, slot, slot_name[2] = {0};
2354  LONG ret;
2355  HKEY hkey;
2356 
2357  /* get the current executable's name */
2358  if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2359  {
2360  WARN("GotModuleFileName failed: %d\n", GetLastError());
2361  return;
2362  }
2363  module_name = strrchrW(module_path, '\\');
2364  if(!module_name)
2365  module_name = module_path;
2366  else
2367  module_name += 1;
2368 
2370  if(!slot)
2371  return;
2372  *slot_name = slot;
2373 
2374  { /* update the slot's info */
2375  WCHAR *path_ends, *final;
2376  DWORD path_len, final_len;
2377 
2378  /* use only the path segment of `filename' */
2379  path_ends = strrchrW(filename, '\\');
2380  path_len = path_ends - filename;
2381 
2382  final_len = path_len + lstrlenW(module_name) + 2;
2383 
2384  final = heap_alloc(final_len * sizeof(WCHAR));
2385  if(!final)
2386  return;
2387  lstrcpyW(final, module_name);
2388  memcpy(final + lstrlenW(final) + 1, filename, path_len * sizeof(WCHAR));
2389  final[final_len-1] = '\0';
2390 
2391  ret = RegSetValueExW(hkey, slot_name, 0, REG_BINARY, (LPBYTE)final,
2392  final_len * sizeof(WCHAR));
2393  if(ret){
2394  WARN("Error saving MRU data to slot %s: %d\n", wine_dbgstr_w(slot_name), ret);
2395  heap_free(final);
2396  RegCloseKey(hkey);
2397  return;
2398  }
2399 
2400  heap_free(final);
2401  }
2402 
2403  { /* update MRUList value */
2404  WCHAR old_mru_list[32], new_mru_list[32];
2405  WCHAR *old_mru_slot, *new_mru_slot = new_mru_list;
2406  DWORD mru_list_size = sizeof(old_mru_list), key_type;
2407 
2408  ret = RegGetValueW(hkey, NULL, MRUListW, RRF_RT_ANY, &key_type,
2409  (LPBYTE)old_mru_list, &mru_list_size);
2410  if(ret || key_type != REG_SZ){
2411  if(ret == ERROR_FILE_NOT_FOUND){
2412  new_mru_list[0] = slot;
2413  new_mru_list[1] = '\0';
2414  }else{
2415  WARN("Error getting MRUList data: type: %d, ret: %d\n", key_type, ret);
2416  RegCloseKey(hkey);
2417  return;
2418  }
2419  }else{
2420  /* copy old list data over so that the new slot is at the start
2421  * of the list */
2422  *new_mru_slot++ = slot;
2423  for(old_mru_slot = old_mru_list; *old_mru_slot; ++old_mru_slot){
2424  if(*old_mru_slot != slot)
2425  *new_mru_slot++ = *old_mru_slot;
2426  }
2427  *new_mru_slot = '\0';
2428  }
2429 
2430  ret = RegSetValueExW(hkey, MRUListW, 0, REG_SZ, (LPBYTE)new_mru_list,
2431  (lstrlenW(new_mru_list) + 1) * sizeof(WCHAR));
2432  if(ret){
2433  WARN("Error saving MRUList data: %d\n", ret);
2434  RegCloseKey(hkey);
2435  return;
2436  }
2437  }
2438 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1975
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:607
struct _slot slot
Definition: vfat.h:196
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
#define REG_BINARY
Definition: nt_native.h:1496
#define WARN(fmt,...)
Definition: debug.h:111
#define wine_dbgstr_w
Definition: kernel32.h:34
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:407
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4917
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const WCHAR MRUListW[]
Definition: filedlg.c:152
Definition: vfat.h:184
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
static DWORD path_len
Definition: batch.c:31
#define lstrcpyW
Definition: compat.h:406
#define ARRAY_SIZE(a)
Definition: main.h:24
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:845
#define RRF_RT_ANY
Definition: winreg.h:64
static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHKEY hkey_ret)
Definition: filedlg.c:2279
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define REG_SZ
Definition: layer.c:22

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_OnOpen()

BOOL FILEDLG95_OnOpen ( HWND  hwnd)
static

Definition at line 2597 of file filedlg.c.

2598 {
2600  LPWSTR lpstrFileList;
2601  UINT nFileCount = 0;
2602  UINT sizeUsed = 0;
2603  BOOL ret = TRUE;
2604  WCHAR lpstrPathAndFile[MAX_PATH];
2605  LPSHELLFOLDER lpsf = NULL;
2606  int nOpenAction;
2607 
2608  TRACE("hwnd=%p\n", hwnd);
2609 
2610  /* try to browse the selected item */
2612  return FALSE;
2613 
2614  /* get the files from the edit control */
2615  nFileCount = FILEDLG95_FILENAME_GetFileNames(hwnd, &lpstrFileList, &sizeUsed);
2616 
2617  if(nFileCount == 0)
2618  return FALSE;
2619 
2620  if(nFileCount > 1)
2621  {
2622  ret = FILEDLG95_OnOpenMultipleFiles(hwnd, lpstrFileList, nFileCount, sizeUsed);
2623  goto ret;
2624  }
2625 
2626  TRACE("count=%u len=%u file=%s\n", nFileCount, sizeUsed, debugstr_w(lpstrFileList));
2627 
2628 /*
2629  Step 1: Build a complete path name from the current folder and
2630  the filename or path in the edit box.
2631  Special cases:
2632  - the path in the edit box is a root path
2633  (with or without drive letter)
2634  - the edit box contains ".." (or a path with ".." in it)
2635 */
2636 
2637  COMDLG32_GetCanonicalPath(fodInfos->ShellInfos.pidlAbsCurrent, lpstrFileList, lpstrPathAndFile);
2638  heap_free(lpstrFileList);
2639 
2640 /*
2641  Step 2: here we have a cleaned up path
2642 
2643  We have to parse the path step by step to see if we have to browse
2644  to a folder if the path points to a directory or the last
2645  valid element is a directory.
2646 
2647  valid variables:
2648  lpstrPathAndFile: cleaned up path
2649  */
2650 
2651  if (nFileCount &&
2652  (fodInfos->ofnInfos->Flags & OFN_NOVALIDATE) &&
2653  !(fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST))
2654  nOpenAction = ONOPEN_OPEN;
2655  else
2656  nOpenAction = ONOPEN_BROWSE;
2657 
2658  nOpenAction = FILEDLG95_ValidatePathAction(lpstrPathAndFile, &lpsf, hwnd,
2659  fodInfos->ofnInfos->Flags,
2660  fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG,
2661  nOpenAction);
2662  if(!nOpenAction)
2663  goto ret;
2664 
2665 /*
2666  Step 3: here we have a cleaned up and validated path
2667 
2668  valid variables:
2669  lpsf: ShellFolder bound to the rightmost valid path component
2670  lpstrPathAndFile: cleaned up path
2671  nOpenAction: action to do
2672 */
2673  TRACE("end validate sf=%p\n", lpsf);
2674 
2675  switch(nOpenAction)
2676  {
2677  case ONOPEN_SEARCH: /* set the current filter to the file mask and refresh */
2678  TRACE("ONOPEN_SEARCH %s\n", debugstr_w(lpstrPathAndFile));
2679  {
2680  int iPos;
2681  LPWSTR lpszTemp = PathFindFileNameW(lpstrPathAndFile);
2682  DWORD len;
2683 
2684  /* replace the current filter */
2685  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
2686  len = lstrlenW(lpszTemp)+1;
2687  fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc(len * sizeof(WCHAR));
2688  lstrcpyW( fodInfos->ShellInfos.lpstrCurrentFilter, lpszTemp);
2689 
2690  /* set the filter cb to the extension when possible */
2691  if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, lpszTemp)))
2692  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETCURSEL, iPos, 0);
2693  }
2694  /* fall through */
2695  case ONOPEN_BROWSE: /* browse to the highest folder we could bind to */
2696  TRACE("ONOPEN_BROWSE\n");
2697  {
2698  IPersistFolder2 * ppf2;
2699  if(SUCCEEDED(IShellFolder_QueryInterface( lpsf, &IID_IPersistFolder2, (LPVOID*)&ppf2)))
2700  {
2701  LPITEMIDLIST pidlCurrent;
2702  IPersistFolder2_GetCurFolder(ppf2, &pidlCurrent);
2703  IPersistFolder2_Release(ppf2);
2704  if (!ILIsEqual(pidlCurrent, fodInfos->ShellInfos.pidlAbsCurrent))
2705  {
2706  if (SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidlCurrent, SBSP_ABSOLUTE))
2707  && fodInfos->ofnInfos->Flags & OFN_EXPLORER)
2708  {
2710  SendMessageA(fodInfos->DlgInfos.hwndFileName, WM_SETTEXT, 0, (LPARAM)"");
2711  }
2712  }
2713  else if( nOpenAction == ONOPEN_SEARCH )
2714  {
2715  if (fodInfos->Shell.FOIShellView)
2716  IShellView_Refresh(fodInfos->Shell.FOIShellView);
2717  }
2718  ILFree(pidlCurrent);
2719  if (filename_is_edit( fodInfos ))
2720  SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
2721  else
2722  {
2723  HWND hwnd;
2724 
2725  hwnd = (HWND)SendMessageA(fodInfos->DlgInfos.hwndFileName, CBEM_GETEDITCONTROL, 0, 0);
2726  SendMessageW(hwnd, EM_SETSEL, 0, -1);
2727  }
2728  }
2729  }
2730  ret = FALSE;
2731  break;
2732  case ONOPEN_OPEN: /* fill in the return struct and close the dialog */
2733  TRACE("ONOPEN_OPEN %s\n", debugstr_w(lpstrPathAndFile));
2734  {
2735  WCHAR *ext = NULL;
2736 
2737  /* update READONLY check box flag */
2739  fodInfos->ofnInfos->Flags |= OFN_READONLY;
2740  else
2741  fodInfos->ofnInfos->Flags &= ~OFN_READONLY;
2742 
2743  /* Attach the file extension with file name*/
2744  ext = PathFindExtensionW(lpstrPathAndFile);
2745  if (! *ext && fodInfos->defext)
2746  {
2747  /* if no extension is specified with file name, then */
2748  /* attach the extension from file filter or default one */
2749 
2750  WCHAR *filterExt = NULL;
2751  LPWSTR lpstrFilter = NULL;
2752  static const WCHAR szwDot[] = {'.',0};
2753  int PathLength = lstrlenW(lpstrPathAndFile);
2754 
2755  /*Get the file extension from file type filter*/
2756  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
2757  fodInfos->ofnInfos->nFilterIndex-1);
2758 
2759  if (lpstrFilter != (LPWSTR)CB_ERR) /* control is not empty */
2760  {
2761  WCHAR* filterSearchIndex;
2762  filterExt = heap_alloc((lstrlenW(lpstrFilter) + 1) * sizeof(WCHAR));
2763  strcpyW(filterExt, lpstrFilter);
2764 
2765  /* if a semicolon-separated list of file extensions was given, do not include the
2766  semicolon or anything after it in the extension.
2767  example: if filterExt was "*.abc;*.def", it will become "*.abc" */
2768  filterSearchIndex = strchrW(filterExt, ';');
2769  if (filterSearchIndex)
2770  {
2771  filterSearchIndex[0] = '\0';
2772  }
2773 
2774  /* find the file extension by searching for the first dot in filterExt */
2775  /* strip the * or anything else from the extension, "*.abc" becomes "abc" */
2776  /* if the extension is invalid or contains a glob, ignore it */
2777  filterSearchIndex = strchrW(filterExt, '.');
2778  if (filterSearchIndex++ && !strchrW(filterSearchIndex, '*') && !strchrW(filterSearchIndex, '?'))
2779  {
2780  strcpyW(filterExt, filterSearchIndex);
2781  }
2782  else
2783  {
2784  heap_free(filterExt);
2785  filterExt = NULL;
2786  }
2787  }
2788 
2789  if (!filterExt)
2790  {
2791  /* use the default file extension */
2792  filterExt = heap_alloc((lstrlenW(fodInfos->defext) + 1) * sizeof(WCHAR));
2793  strcpyW(filterExt, fodInfos->defext);
2794  }
2795 
2796  if (*filterExt) /* ignore filterExt="" */
2797  {
2798  /* Attach the dot*/
2799  lstrcatW(lpstrPathAndFile, szwDot);
2800  /* Attach the extension */
2801  lstrcatW(lpstrPathAndFile, filterExt);
2802  }
2803 
2804  heap_free(filterExt);
2805 
2806  /* In Open dialog: if file does not exist try without extension */
2807  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile))
2808  lpstrPathAndFile[PathLength] = '\0';
2809 
2810  /* Set/clear the output OFN_EXTENSIONDIFFERENT flag */
2811  if (*ext)
2812  ext++;
2813  if (!lstrcmpiW(fodInfos->defext, ext))
2814  fodInfos->ofnInfos->Flags &= ~OFN_EXTENSIONDIFFERENT;
2815  else
2816  fodInfos->ofnInfos->Flags |= OFN_EXTENSIONDIFFERENT;
2817  }
2818 
2819  /* In Save dialog: check if the file already exists */
2820  if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG
2821  && fodInfos->ofnInfos->Flags & OFN_OVERWRITEPROMPT
2822  && PathFileExistsW(lpstrPathAndFile))
2823  {
2824  WCHAR lpstrOverwrite[100];
2825  int answer;
2826 
2827  LoadStringW(COMDLG32_hInstance, IDS_OVERWRITEFILE, lpstrOverwrite, 100);
2828  answer = MessageBoxW(hwnd, lpstrOverwrite, fodInfos->title,
2830  if (answer == IDNO || answer == IDCANCEL)
2831  {
2832  ret = FALSE;
2833  goto ret;
2834  }
2835  }
2836 
2837  /* In Open dialog: check if it should be created if it doesn't exist */
2838  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
2839  && fodInfos->ofnInfos->Flags & OFN_CREATEPROMPT
2840  && !PathFileExistsW(lpstrPathAndFile))
2841  {
2842  WCHAR lpstrCreate[100];
2843  int answer;
2844 
2845  LoadStringW(COMDLG32_hInstance, IDS_CREATEFILE, lpstrCreate, 100);
2846  answer = MessageBoxW(hwnd, lpstrCreate, fodInfos->title,
2848  if (answer == IDNO || answer == IDCANCEL)
2849  {
2850  ret = FALSE;
2851  goto ret;
2852  }
2853  }
2854 
2855  /* Check that the size of the file does not exceed buffer size.
2856  (Allow for extra \0 if OFN_MULTISELECT is set.) */
2857  if(lstrlenW(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile -
2858  ((fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) ? 1 : 0))
2859  {
2860 
2861  /* fill destination buffer */
2862  if (fodInfos->ofnInfos->lpstrFile)
2863  {
2864  if(fodInfos->unicode)
2865  {
2866  LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
2867 
2868  lstrcpynW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile);
2870  ofn->lpstrFile[lstrlenW(ofn->lpstrFile) + 1] = '\0';
2871  }
2872  else
2873  {
2875 
2876  WideCharToMultiByte(CP_ACP, 0, lpstrPathAndFile, -1,
2879  ofn->lpstrFile[lstrlenA(ofn->lpstrFile) + 1] = '\0';
2880  }
2881  }
2882 
2883  if(fodInfos->unicode)
2884  {
2885  LPWSTR lpszTemp;
2886 
2887  /* set filename offset */
2888  lpszTemp = PathFindFileNameW(lpstrPathAndFile);
2889  fodInfos->ofnInfos->nFileOffset = (lpszTemp - lpstrPathAndFile);
2890 
2891  /* set extension offset */
2892  lpszTemp = PathFindExtensionW(lpstrPathAndFile);
2893  fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - lpstrPathAndFile) + 1 : 0;
2894  }
2895  else
2896  {
2897  LPSTR lpszTemp;
2898  CHAR tempFileA[MAX_PATH];
2899 
2900  /* avoid using fodInfos->ofnInfos->lpstrFile since it can be NULL */
2901  WideCharToMultiByte(CP_ACP, 0, lpstrPathAndFile, -1,
2902  tempFileA, sizeof(tempFileA), NULL, NULL);
2903 
2904  /* set filename offset */
2905  lpszTemp = PathFindFileNameA(tempFileA);
2906  fodInfos->ofnInfos->nFileOffset = (lpszTemp - tempFileA);
2907 
2908  /* set extension offset */
2909  lpszTemp = PathFindExtensionA(tempFileA);
2910  fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - tempFileA) + 1 : 0;
2911  }
2912 
2913  /* copy currently selected filter to lpstrCustomFilter */
2914  if (fodInfos->ofnInfos->lpstrCustomFilter)
2915  {
2917  int len = WideCharToMultiByte(CP_ACP, 0, fodInfos->ShellInfos.lpstrCurrentFilter, -1,
2918  NULL, 0, NULL, NULL);
2920  {
2922  s += strlen(ofn->lpstrCustomFilter)+1;
2923  WideCharToMultiByte(CP_ACP, 0, fodInfos->ShellInfos.lpstrCurrentFilter, -1,
2924  s, len, NULL, NULL);
2925  }
2926  }
2927 
2928 
2929  if ( !FILEDLG95_SendFileOK(hwnd, fodInfos) )
2930  goto ret;
2931 
2932  FILEDLG95_MRU_save_filename(lpstrPathAndFile);
2933 
2934  TRACE("close\n");
2936  ret = EndDialog(hwnd, TRUE);
2937  }
2938  else
2939  {
2940  WORD size;
2941 
2942  size = lstrlenW(lpstrPathAndFile) + 1;
2943  if (fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT)
2944  size += 1;
2945  /* return needed size in first two bytes of lpstrFile */
2946  if(fodInfos->ofnInfos->lpstrFile)
2947  *(WORD *)fodInfos->ofnInfos->lpstrFile = size;
2949  ret = EndDialog(hwnd, FALSE);
2951  }
2952  }
2953  break;
2954  }
2955 
2956 ret:
2957  if(lpsf) IShellFolder_Release(lpsf);
2958  return ret;
2959 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
struct FileOpenDlgInfos::@326 ShellInfos
#define WideCharToMultiByte
Definition: compat.h:101
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LPSTR lpstrCustomFilter
Definition: commdlg.h:333
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
LPWSTR lpstrFile
Definition: commdlg.h:367
#define IDC_OPENREADONLY
HANDLE HWND
Definition: compat.h:13
OPENFILENAME ofn
Definition: main.cpp:37
#define OFN_ALLOWMULTISELECT
Definition: commdlg.h:96
#define ONOPEN_BROWSE
Definition: cdlg.h:210
struct FileOpenDlgInfos::@325 Shell
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
char * LPSTR
Definition: xmlstorage.h:182
static USHORT PathLength
#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 int FILEDLG95_FILETYPE_SearchExt(HWND hwnd, LPCWSTR lpstrExt)
Definition: filedlg.c:3240
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define lstrcpynW
Definition: compat.h:397
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
DWORD nMaxFile
Definition: commdlg.h:337
WORD nFileExtension
Definition: commdlg.h:375
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define OFN_CREATEPROMPT
Definition: commdlg.h:97
#define MB_YESNO
Definition: winuser.h:811
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FODPROP_SAVEDLG
WORD nFileOffset
Definition: commdlg.h:374
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:389
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1879
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
#define CBEM_GETEDITCONTROL
Definition: commctrl.h:3805
void COMDLG32_GetCanonicalPath(PCIDLIST_ABSOLUTE pidlAbsCurrent, LPWSTR lpstrFile, LPWSTR lpstrPathAndFile)
Definition: filedlg.c:651
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:442
#define WM_SETTEXT
Definition: winuser.h:1599
#define CB_ERR
Definition: winuser.h:2389
DWORD nFilterIndex
Definition: commdlg.h:366
LPOPENFILENAMEW ofnInfos
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static BOOL BrowseSelectedFolder(HWND hwnd)
Definition: filedlg.c:4130
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf, HWND hwnd, DWORD flags, BOOL isSaveDlg, int defAction)
Definition: filedlg.c:2473
#define IDS_OVERWRITEFILE
#define MAX_PATH
Definition: compat.h:26
#define EM_SETSEL
Definition: winuser.h:1979
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD nMaxFile
Definition: commdlg.h:368
#define OFN_EXTENSIONDIFFERENT
Definition: commdlg.h:105
DWORD nMaxCustFilter
Definition: commdlg.h:334
#define OFN_READONLY
Definition: commdlg.h:118
int ret
static BOOL FILEDLG95_SendFileOK(HWND hwnd, FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:2129
static void FILEDLG95_MRU_save_filename(LPCWSTR filename)
Definition: filedlg.c:2351
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
#define CB_SETCURSEL
Definition: winuser.h:1922
#define ONOPEN_OPEN
Definition: cdlg.h:211
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define lstrcpyW
Definition: compat.h:406
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:985
LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath)
Definition: path.c:417
LPSTR lpstrFile
Definition: commdlg.h:336
#define FNERR_BUFFERTOOSMALL
Definition: cderr.h:37
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN
Definition: cdlg32.c:119
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
unsigned int UINT
Definition: ndis.h:50
#define BST_CHECKED
Definition: winuser.h:197
static BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCount, UINT sizeUsed)
Definition: filedlg.c:2166
LPWSTR lpstrCustomFilter
Definition: commdlg.h:364
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define IDNO
Definition: winuser.h:830
#define OFN_NOVALIDATE
Definition: commdlg.h:115
LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath)
Definition: path.c:368
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define IDS_CREATEFILE
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1510
static int FILEDLG95_FILENAME_GetFileNames(HWND hwnd, LPWSTR *lpstrFileList, UINT *sizeUsed)
Definition: filedlg.c:3896
struct tagOFNA * LPOPENFILENAMEA
#define SUCCEEDED(hr)
Definition: intsafe.h:57
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static void FILEDLG95_Clean(HWND hwnd)
Definition: filedlg.c:2005
#define ONOPEN_SEARCH
Definition: cdlg.h:212
DWORD Flags
Definition: commdlg.h:342

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_OnOpenMessage()

void FILEDLG95_OnOpenMessage ( HWND  hwnd,
int  idCaption,
int  idText 
)

Definition at line 2461 of file filedlg.c.

2462 {
2463  WCHAR strMsgTitle[MAX_PATH];
2464  WCHAR strMsgText [MAX_PATH];
2465  if (idCaption)
2466  LoadStringW(COMDLG32_hInstance, idCaption, strMsgTitle, ARRAY_SIZE(strMsgTitle));
2467  else
2468  strMsgTitle[0] = '\0';
2469  LoadStringW(COMDLG32_hInstance, idText, strMsgText, ARRAY_SIZE(strMsgText));
2470  MessageBoxW(hwnd,strMsgText, strMsgTitle, MB_OK | MB_ICONHAND);
2471 }
#define MB_ICONHAND
Definition: winuser.h:782
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MB_OK
Definition: winuser.h:784

Referenced by FILEDLG95_ValidatePathAction(), and on_default_action().

◆ FILEDLG95_OnOpenMultipleFiles()

BOOL FILEDLG95_OnOpenMultipleFiles ( HWND  hwnd,
LPWSTR  lpstrFileList,
UINT  nFileCount,
UINT  sizeUsed 
)
static

Definition at line 2166 of file filedlg.c.

2167 {
2169  WCHAR lpstrPathSpec[MAX_PATH] = {0};
2170  UINT nCount, nSizePath;
2171 
2172  TRACE("\n");
2173 
2174  if(fodInfos->unicode)
2175  {
2176  LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
2177  ofn->lpstrFile[0] = '\0';
2178  }
2179  else
2180  {
2182  ofn->lpstrFile[0] = '\0';
2183  }
2184 
2185  COMDLG32_GetDisplayNameOf( fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathSpec );
2186 
2187  if ( !(fodInfos->ofnInfos->Flags & OFN_NOVALIDATE) &&
2188  ( fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST) &&
2189  ! ( fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG ) )
2190  {
2191  LPWSTR lpstrTemp = lpstrFileList;
2192 
2193  for ( nCount = 0; nCount < nFileCount; nCount++ )
2194  {
2195  LPITEMIDLIST pidl;
2196 
2197  pidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder, lpstrTemp);
2198  if (!pidl)
2199  {
2200  WCHAR lpstrNotFound[100];
2201  WCHAR lpstrMsg[100];
2202  WCHAR tmp[400];
2203  static const WCHAR nl[] = {'\n',0};
2204 
2205  LoadStringW(COMDLG32_hInstance, IDS_FILENOTFOUND, lpstrNotFound, 100);
2207 
2208  lstrcpyW(tmp, lpstrTemp);
2209  lstrcatW(tmp, nl);
2210  lstrcatW(tmp, lpstrNotFound);
2211  lstrcatW(tmp, nl);
2212  lstrcatW(tmp, lpstrMsg);
2213 
2214  MessageBoxW(hwnd, tmp, fodInfos->title, MB_OK | MB_ICONEXCLAMATION);
2215  return FALSE;
2216  }
2217 
2218  /* move to the next file in the list of files */
2219  lpstrTemp += lstrlenW(lpstrTemp) + 1;
2220  ILFree(pidl);
2221  }
2222  }
2223 
2224  nSizePath = lstrlenW(lpstrPathSpec) + 1;
2225  if ( !(fodInfos->ofnInfos->Flags & OFN_EXPLORER) )
2226  {
2227  /* For "oldstyle" dialog the components have to
2228  be separated by blanks (not '\0'!) and short
2229  filenames have to be used! */
2230  FIXME("Components have to be separated by blanks\n");
2231  }
2232  if(fodInfos->unicode)
2233  {
2234  LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
2235  lstrcpyW( ofn->lpstrFile, lpstrPathSpec);
2236  memcpy( ofn->lpstrFile + nSizePath, lpstrFileList, sizeUsed*sizeof(WCHAR) );
2237  }
2238  else
2239  {
2241 
2242  if (ofn->lpstrFile != NULL)
2243  {
2244  nSizePath = WideCharToMultiByte(CP_ACP, 0, lpstrPathSpec, -1,
2246  if (ofn->nMaxFile > nSizePath)
2247  {
2248  WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
2249  ofn->lpstrFile + nSizePath,
2250  ofn->nMaxFile - nSizePath, NULL, NULL);
2251  }
2252  }
2253  }
2254 
2255  fodInfos->ofnInfos->nFileOffset = nSizePath;
2256  fodInfos->ofnInfos->nFileExtension = 0;
2257 
2258  if ( !FILEDLG95_SendFileOK(hwnd, fodInfos) )
2259  return FALSE;
2260 
2261  /* clean and exit */
2263  return EndDialog(hwnd,TRUE);
2264 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
struct FileOpenDlgInfos::@326 ShellInfos