ReactOS  0.4.14-dev-593-g1793dcc
filedlg.c File Reference
#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "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/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 140 of file filedlg.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 54 of file filedlg.c.

◆ ITEM_NOTFOUND

#define ITEM_NOTFOUND   -1

Definition at line 123 of file filedlg.c.

◆ LISTEND

#define LISTEND   -1

Definition at line 118 of file filedlg.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 55 of file filedlg.c.

◆ SEARCH_EXP

#define SEARCH_EXP   2

Definition at line 122 of file filedlg.c.

◆ SEARCH_PIDL

#define SEARCH_PIDL   1

Definition at line 121 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE0

#define TBPLACES_CMDID_PLACE0   0xa064

Definition at line 128 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE1

#define TBPLACES_CMDID_PLACE1   0xa065

Definition at line 129 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE2

#define TBPLACES_CMDID_PLACE2   0xa066

Definition at line 130 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE3

#define TBPLACES_CMDID_PLACE3   0xa067

Definition at line 131 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE4

#define TBPLACES_CMDID_PLACE4   0xa068

Definition at line 132 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 86 of file filedlg.c.

◆ WM_GETISHELLBROWSER

#define WM_GETISHELLBROWSER   WM_USER+7

Definition at line 126 of file filedlg.c.

◆ XTEXTOFFSET

#define XTEXTOFFSET   3

Definition at line 115 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 742 of file filedlg.c.

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

4475 {
4477  BOOL bBrowseSelFolder = FALSE;
4478 
4479  TRACE("\n");
4480 
4481  if (GetNumSelected(fodInfos->Shell.FOIDataObject) == 1)
4482  {
4483  LPITEMIDLIST pidlSelection;
4484 
4485  /* get the file selected */
4486  pidlSelection = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, 1);
4487  if (IsPidlFolder (fodInfos->Shell.FOIShellFolder, pidlSelection))
4488  {
4489  if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser,
4490  pidlSelection, SBSP_RELATIVE ) ) )
4491  {
4492  WCHAR buf[64];
4494  MessageBoxW( hwnd, buf, fodInfos->title, MB_OK | MB_ICONEXCLAMATION );
4495  }
4496  bBrowseSelFolder = TRUE;
4497  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
4499  }
4500  ILFree( pidlSelection );
4501  }
4502 
4503  return bBrowseSelFolder;
4504 }
#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:4290
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
struct FileOpenDlgInfos::@334 Shell
#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:988
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MB_OK
Definition: winuser.h:784
static UINT GetNumSelected(IDataObject *doSelected)
Definition: filedlg.c:4321
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4457
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155

Referenced by FILEDLG95_OnOpen().

◆ COMCTL32_ReleaseStgMedium()

static void COMCTL32_ReleaseStgMedium ( STGMEDIUM  medium)
static

Definition at line 4270 of file filedlg.c.

4271 {
4272  if(medium.pUnkForRelease)
4273  {
4274  IUnknown_Release(medium.pUnkForRelease);
4275  }
4276  else
4277  {
4278  GlobalUnlock(medium.u.hGlobal);
4279  GlobalFree(medium.u.hGlobal);
4280  }
4281 }
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 654 of file filedlg.c.

656 {
657  WCHAR lpstrTemp[MAX_PATH];
658 
659  /* Get the current directory name */
660  if (!COMDLG32_GetDisplayNameOf(pidlAbsCurrent, lpstrPathAndFile))
661  {
662  /* last fallback */
663  GetCurrentDirectoryW(MAX_PATH, lpstrPathAndFile);
664  }
665  PathAddBackslashW(lpstrPathAndFile);
666 
667  TRACE("current directory=%s, file=%s\n", debugstr_w(lpstrPathAndFile), debugstr_w(lpstrFile));
668 
669  /* if the user specified a fully qualified path use it */
670  if(PathIsRelativeW(lpstrFile))
671  {
672  lstrcatW(lpstrPathAndFile, lpstrFile);
673  }
674  else
675  {
676  /* does the path have a drive letter? */
677  if (PathGetDriveNumberW(lpstrFile) == -1)
678  lstrcpyW(lpstrPathAndFile+2, lpstrFile);
679  else
680  lstrcpyW(lpstrPathAndFile, lpstrFile);
681  }
682 
683  /* resolve "." and ".." */
684  PathCanonicalizeW(lpstrTemp, lpstrPathAndFile );
685  lstrcpyW(lpstrPathAndFile, lpstrTemp);
686  TRACE("canon=%s\n", debugstr_w(lpstrPathAndFile));
687 }
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:421
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:633
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:414
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 633 of file filedlg.c.

633  {
634  LPSHELLFOLDER psfDesktop;
635  STRRET strret;
636 
637  if (FAILED(SHGetDesktopFolder(&psfDesktop)))
638  return FALSE;
639 
640  if (FAILED(IShellFolder_GetDisplayNameOf(psfDesktop, pidl, SHGDN_FORPARSING, &strret))) {
641  IShellFolder_Release(psfDesktop);
642  return FALSE;
643  }
644 
645  IShellFolder_Release(psfDesktop);
646  return SUCCEEDED(StrRetToBufW(&strret, pidl, pwszPath, MAX_PATH));
647 }
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 694 of file filedlg.c.

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

4209 {
4210  switch (src->uType)
4211  {
4212  case STRRET_WSTR:
4213  lstrcpynW(dest, src->u.pOleStr, len);
4214  CoTaskMemFree(src->u.pOleStr);
4215  break;
4216 
4217  case STRRET_CSTR:
4218  if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len)
4219  dest[len-1] = 0;
4220  break;
4221 
4222  case STRRET_OFFSET:
4223  if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1, dest, len ) && len)
4224  dest[len-1] = 0;
4225  break;
4226 
4227  default:
4228  FIXME("unknown type %x!\n", src->uType);
4229  if (len) *dest = '\0';
4230  return E_FAIL;
4231  }
4232  return S_OK;
4233 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define CP_ACP
Definition: compat.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define lstrcpynW
Definition: compat.h:405
#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 896 of file filedlg.c.

897 {
898  LPCVOID template;
899  HRSRC hRes;
900  HANDLE hDlgTmpl = 0;
901  HWND hChildDlg = 0;
902 
903  TRACE("%p, %p\n", fodInfos, hwnd);
904 
905  /*
906  * If OFN_ENABLETEMPLATEHANDLE is specified, the OPENFILENAME
907  * structure's hInstance parameter is not a HINSTANCE, but
908  * instead a pointer to a template resource to use.
909  */
911  {
913  if (fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE)
914  {
916  if( !(template = LockResource( fodInfos->ofnInfos->hInstance)))
917  {
919  return NULL;
920  }
921  }
922  else
923  {
924  hinst = fodInfos->ofnInfos->hInstance;
925  if(fodInfos->unicode)
926  {
927  LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
929  }
930  else
931  {
934  }
935  if (!hRes)
936  {
938  return NULL;
939  }
940  if (!(hDlgTmpl = LoadResource( hinst, hRes )) ||
941  !(template = LockResource( hDlgTmpl )))
942  {
944  return NULL;
945  }
946  }
947  if (fodInfos->unicode)
948  hChildDlg = CreateDialogIndirectParamW(hinst, template, hwnd,
950  (LPARAM)fodInfos->ofnInfos);
951  else
952  hChildDlg = CreateDialogIndirectParamA(hinst, template, hwnd,
954  (LPARAM)fodInfos->ofnInfos);
955  return hChildDlg;
956  }
957  else if (is_dialog_hooked(fodInfos))
958  {
959  RECT rectHwnd;
960  struct {
961  DLGTEMPLATE tmplate;
962  WORD menu,class,title;
963  } temp;
964  GetClientRect(hwnd,&rectHwnd);
966  temp.tmplate.dwExtendedStyle = 0;
967  temp.tmplate.cdit = 0;
968  temp.tmplate.x = 0;
969  temp.tmplate.y = 0;
970  temp.tmplate.cx = 0;
971  temp.tmplate.cy = 0;
972  temp.menu = temp.class = temp.title = 0;
973 
974  hChildDlg = CreateDialogIndirectParamA(COMDLG32_hInstance, &temp.tmplate,
975  hwnd, (DLGPROC)fodInfos->ofnInfos->lpfnHook, (LPARAM)fodInfos->ofnInfos);
976 
977  return hChildDlg;
978  }
979  return NULL;
980 }
#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:160
#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:887
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:2871
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 165 of file filedlg.c.

166 {
167  return (info->ofnInfos->Flags & OFN_HIDEREADONLY) || (info->DlgInfos.dwDlgProp & FODPROP_SAVEDLG);
168 }
#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 2028 of file filedlg.c.

2029 {
2033 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void FILEDLG95_LOOKIN_Clean(HWND hwnd)
Definition: filedlg.c:4081
static void FILEDLG95_FILETYPE_Clean(HWND hwnd)
Definition: filedlg.c:3608
static void FILEDLG95_SHELL_Clean(HWND hwnd)
Definition: filedlg.c:3397

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

◆ FILEDLG95_FILENAME_FillFromSelection()

void FILEDLG95_FILENAME_FillFromSelection ( HWND  hwnd)

Definition at line 4132 of file filedlg.c.

4133 {
4135  LPITEMIDLIST pidl;
4136  LPWSTR lpstrAllFiles, lpstrTmp;
4137  UINT nFiles = 0, nFileToOpen, nFileSelected, nAllFilesLength = 0, nThisFileLength, nAllFilesMaxLength;
4138  STGMEDIUM medium;
4139  LPIDA cida;
4140  FORMATETC formatetc = get_def_format();
4141 
4142  TRACE("\n");
4143 
4144  if (FAILED(IDataObject_GetData(fodInfos->Shell.FOIDataObject, &formatetc, &medium)))
4145  return;
4146 
4147  cida = GlobalLock(medium.u.hGlobal);
4148  nFileSelected = cida->cidl;
4149 
4150  /* Allocate a buffer */
4151  nAllFilesMaxLength = MAX_PATH + 3;
4152  lpstrAllFiles = heap_alloc_zero(nAllFilesMaxLength * sizeof(WCHAR));
4153  if (!lpstrAllFiles)
4154  goto ret;
4155 
4156  /* Loop through the selection, handle only files (not folders) */
4157  for (nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++)
4158  {
4159  pidl = (LPITEMIDLIST)((LPBYTE)cida + cida->aoffset[nFileToOpen + 1]);
4160  if (pidl)
4161  {
4162  if (!IsPidlFolder(fodInfos->Shell.FOIShellFolder, pidl))
4163  {
4164  if (nAllFilesLength + MAX_PATH + 3 > nAllFilesMaxLength)
4165  {
4166  nAllFilesMaxLength *= 2;
4167  lpstrTmp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpstrAllFiles, nAllFilesMaxLength * sizeof(WCHAR));
4168  if (!lpstrTmp)
4169  goto ret;
4170  lpstrAllFiles = lpstrTmp;
4171  }
4172  nFiles += 1;
4173  lpstrAllFiles[nAllFilesLength++] = '"';
4174  GetName(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, lpstrAllFiles + nAllFilesLength);
4175  nThisFileLength = lstrlenW(lpstrAllFiles + nAllFilesLength);
4176  nAllFilesLength += nThisFileLength;
4177  lpstrAllFiles[nAllFilesLength++] = '"';
4178  lpstrAllFiles[nAllFilesLength++] = ' ';
4179  }
4180  }
4181  }
4182 
4183  if (nFiles != 0)
4184  {
4185  /* If there's only one file, use the name as-is without quotes */
4186  lpstrTmp = lpstrAllFiles;
4187  if (nFiles == 1)
4188  {
4189  lpstrTmp += 1;
4190  lpstrTmp[nThisFileLength] = 0;
4191  }
4192  SetWindowTextW(fodInfos->DlgInfos.hwndFileName, lpstrTmp);
4193  /* Select the file name like Windows does */
4194  if (filename_is_edit(fodInfos))
4195  SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
4196  }
4197 
4198 ret:
4199  heap_free(lpstrAllFiles);
4200  COMCTL32_ReleaseStgMedium(medium);
4201 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl, DWORD dwFlags, LPWSTR lpstrFileName)
Definition: filedlg.c:4356
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
static void COMCTL32_ReleaseStgMedium(STGMEDIUM medium)
Definition: filedlg.c:4270
#define lstrlenW
Definition: compat.h:415
static FORMATETC get_def_format(void)
Definition: filedlg.c:4113
unsigned char * LPBYTE
Definition: typedefs.h:52
struct FileOpenDlgInfos::@334 Shell
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define EM_SETSEL
Definition: winuser.h:2000
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:401
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:4457
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1513
struct FileOpenDlgInfos::@336 DlgInfos
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
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 4240 of file filedlg.c.

4241 {
4243  UINT nFileCount = 0; /* number of files */
4244  UINT nStrLen = 0; /* length of string in edit control */
4245  LPWSTR lpstrEdit; /* buffer for string from edit control */
4246 
4247  TRACE("\n");
4248 
4249  /* get the filenames from the filename control */
4250  nStrLen = GetWindowTextLengthW( fodInfos->DlgInfos.hwndFileName );
4251  lpstrEdit = heap_alloc( (nStrLen+1)*sizeof(WCHAR) );
4252  GetWindowTextW( fodInfos->DlgInfos.hwndFileName, lpstrEdit, nStrLen+1);
4253 
4254  TRACE("nStrLen=%u str=%s\n", nStrLen, debugstr_w(lpstrEdit));
4255 
4256  nFileCount = COMDLG32_SplitFileNames(lpstrEdit, nStrLen, lpstrFileList, sizeUsed);
4257  heap_free(lpstrEdit);
4258  return nFileCount;
4259 }
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
#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:694
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
unsigned int UINT
Definition: ndis.h:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184
struct FileOpenDlgInfos::@336 DlgInfos
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
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 3608 of file filedlg.c.

3609 {
3611  int iPos;
3612  int iCount;
3613 
3614  iCount = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCOUNT, 0, 0);
3615 
3616  TRACE("\n");
3617 
3618  /* Delete each string of the combo and their associated data */
3619  if(iCount != CB_ERR)
3620  {
3621  for(iPos = iCount-1;iPos>=0;iPos--)
3622  {
3623  heap_free((void *)CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iPos));
3624  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_DELETESTRING, iPos, 0);
3625  }
3626  }
3627  /* Current filter */
3628  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3629 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
struct FileOpenDlgInfos::@335 ShellInfos
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
#define CB_DELETESTRING
Definition: winuser.h:1919
struct FileOpenDlgInfos::@336 DlgInfos
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
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 3423 of file filedlg.c.

3424 {
3426  int nFilters = 0; /* number of filters */
3427  int nFilterIndexCB;
3428 
3429  TRACE("%p\n", hwnd);
3430 
3431  if(fodInfos->customfilter)
3432  {
3433  /* customfilter has one entry... title\0ext\0
3434  * Set first entry of combo box item with customfilter
3435  */
3436  LPWSTR lpstrExt;
3437  LPCWSTR lpstrPos = fodInfos->customfilter;
3438 
3439  /* Get the title */
3440  lpstrPos += lstrlenW(fodInfos->customfilter) + 1;
3441 
3442  /* Copy the extensions */
3443  if (! *lpstrPos) return E_FAIL; /* malformed filter */
3444  if (!(lpstrExt = heap_alloc((lstrlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
3445  lstrcpyW(lpstrExt,lpstrPos);
3446 
3447  /* Add the item at the end of the combo */
3448  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_ADDSTRING, 0, (LPARAM)fodInfos->customfilter);
3449  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETITEMDATA, nFilters, (LPARAM)lpstrExt);
3450 
3451  nFilters++;
3452  }
3453  if(fodInfos->filter)
3454  {
3455  LPCWSTR lpstrPos = fodInfos->filter;
3456 
3457  for(;;)
3458  {
3459  /* filter is a list... title\0ext\0......\0\0
3460  * Set the combo item text to the title and the item data
3461  * to the ext
3462  */
3463  LPCWSTR lpstrDisplay;
3464  LPWSTR lpstrExt;
3465 
3466  /* Get the title */
3467  if(! *lpstrPos) break; /* end */
3468  lpstrDisplay = lpstrPos;
3469  lpstrPos += lstrlenW(lpstrPos) + 1;
3470 
3471  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_ADDSTRING, 0, (LPARAM)lpstrDisplay);
3472 
3473  nFilters++;
3474 
3475  /* Copy the extensions */
3476  if (!(lpstrExt = heap_alloc((lstrlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
3477  lstrcpyW(lpstrExt,lpstrPos);
3478  lpstrPos += lstrlenW(lpstrPos) + 1;
3479 
3480  /* Add the item at the end of the combo */
3481  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETITEMDATA, nFilters - 1, (LPARAM)lpstrExt);
3482 
3483  /* malformed filters are added anyway... */
3484  if (!*lpstrExt) break;
3485  }
3486  }
3487 
3488  /*
3489  * Set the current filter to the one specified
3490  * in the initialisation structure
3491  */
3492  if (fodInfos->filter || fodInfos->customfilter)
3493  {
3494  LPWSTR lpstrFilter;
3495 
3496  /* Check to make sure our index isn't out of bounds. */
3497  if ( fodInfos->ofnInfos->nFilterIndex >
3498  nFilters - (fodInfos->customfilter == NULL ? 0 : 1) )
3499  fodInfos->ofnInfos->nFilterIndex = (fodInfos->customfilter == NULL ? 1 : 0);
3500 
3501  /* set default filter index */
3502  if(fodInfos->ofnInfos->nFilterIndex == 0 && fodInfos->customfilter == NULL)
3503  fodInfos->ofnInfos->nFilterIndex = 1;
3504 
3505  /* calculate index of Combo Box item */
3506  nFilterIndexCB = fodInfos->ofnInfos->nFilterIndex;
3507  if (fodInfos->customfilter == NULL)
3508  nFilterIndexCB--;
3509 
3510  /* Set the current index selection. */
3511  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETCURSEL, nFilterIndexCB, 0);
3512 
3513  /* Get the corresponding text string from the combo box. */
3514  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3515  nFilterIndexCB);
3516 
3517  if ((INT_PTR)lpstrFilter == CB_ERR) /* control is empty */
3518  lpstrFilter = NULL;
3519 
3520  if(lpstrFilter)
3521  {
3522  DWORD len;
3523  CharLowerW(lpstrFilter); /* lowercase */
3524  len = lstrlenW(lpstrFilter)+1;
3525  fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc( len * sizeof(WCHAR) );
3526  lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
3527  }
3528  } else
3529  fodInfos->ofnInfos->nFilterIndex = 0;
3530  return S_OK;
3531 }
#define CB_SETITEMDATA
Definition: winuser.h:1948
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
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:415
#define E_FAIL
Definition: ddrawi.h:102
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define CB_ADDSTRING
Definition: winuser.h:1918
smooth NULL
Definition: ftsmooth.c:416
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_ERR
Definition: winuser.h:2410
DWORD nFilterIndex
Definition: commdlg.h:366
LPOPENFILENAMEW ofnInfos
#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:1943
struct FileOpenDlgInfos::@335 ShellInfos
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:414
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
struct FileOpenDlgInfos::@336 DlgInfos
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_FILETYPE_OnCommand()

static BOOL FILEDLG95_FILETYPE_OnCommand ( HWND  hwnd,
WORD  wNotifyCode 
)
static

Definition at line 3539 of file filedlg.c.

3540 {
3542 
3543  switch(wNotifyCode)
3544  {
3545  case CBN_SELENDOK:
3546  {
3547  LPWSTR lpstrFilter;
3548 
3549  /* Get the current item of the filetype combo box */
3550  int iItem = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCURSEL, 0, 0);
3551 
3552  /* set the current filter index */
3553  fodInfos->ofnInfos->nFilterIndex = iItem +
3554  (fodInfos->customfilter == NULL ? 1 : 0);
3555 
3556  /* Set the current filter with the current selection */
3557  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3558 
3559  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3560  iItem);
3561  if((INT_PTR)lpstrFilter != CB_ERR)
3562  {
3563  DWORD len;
3564  CharLowerW(lpstrFilter); /* lowercase */
3565  len = lstrlenW(lpstrFilter)+1;
3566  fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc( len * sizeof(WCHAR) );
3567  lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
3568  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3570  }
3571 
3572  /* Refresh the actual view to display the included items*/
3573  if (fodInfos->Shell.FOIShellView)
3574  IShellView_Refresh(fodInfos->Shell.FOIShellView);
3575  }
3576  }
3577  return FALSE;
3578 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
LPWSTR WINAPI CharLowerW(_Inout_ LPWSTR)
int32_t INT_PTR
Definition: typedefs.h:62
#define lstrlenW
Definition: compat.h:415
#define CB_GETCURSEL
Definition: winuser.h:1925
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define CBN_SELENDOK
Definition: winuser.h:1963
smooth NULL
Definition: ftsmooth.c:416
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
struct FileOpenDlgInfos::@334 Shell
#define CB_ERR
Definition: winuser.h:2410
DWORD nFilterIndex
Definition: commdlg.h:366
LPOPENFILENAMEW ofnInfos
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
struct FileOpenDlgInfos::@335 ShellInfos
#define CDN_TYPECHANGE
Definition: commdlg.h:39
#define lstrcpyW
Definition: compat.h:414
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:988
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
struct FileOpenDlgInfos::@336 DlgInfos
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
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 3584 of file filedlg.c.

3585 {
3586  int i, iCount;
3587 
3588  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
3589 
3590  TRACE("%s\n", debugstr_w(lpstrExt));
3591 
3592  if(iCount != CB_ERR)
3593  {
3594  for(i=0;i<iCount;i++)
3595  {
3596  if(!lstrcmpiW(lpstrExt,(LPWSTR)CBGetItemDataPtr(hwnd,i)))
3597  return i;
3598  }
3599  }
3600  return -1;
3601 }
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:140
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
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 1991 of file filedlg.c.

1992 {
1993  LPITEMIDLIST pidlItemId = NULL;
1994 
1995  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
1996 
1997  TRACE("dir=%s file=%s\n",
1998  debugstr_w(fodInfos->initdir), debugstr_w(fodInfos->filename));
1999 
2000  /* Get the initial directory pidl */
2001 
2002  if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->initdir)))
2003  {
2004  WCHAR path[MAX_PATH];
2005 
2007  pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder, path);
2008  }
2009 
2010  /* Initialise shell objects */
2012 
2013  /* Initialize the Look In combo box */
2014  FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB);
2015 
2016  /* Browse to the initial directory */
2017  IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId, SBSP_ABSOLUTE);
2018 
2019  ILFree(pidlItemId);
2020 
2021  return TRUE;
2022 }
static void FILEDLG95_LOOKIN_Init(HWND hwndCombo)
Definition: filedlg.c:3657
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:421
static LRESULT FILEDLG95_SHELL_Init(HWND hwnd)
Definition: filedlg.c:3310
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
struct FileOpenDlgInfos::@334 Shell
#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:4431
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPARAM lParam
Definition: combotst.c:139
struct FileOpenDlgInfos::@336 DlgInfos

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_Handle_GetFilePath()

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

Definition at line 1017 of file filedlg.c.

1018 {
1019  UINT len, total;
1020  WCHAR *p, *buffer;
1022 
1023  TRACE("CDM_GETFILEPATH:\n");
1024 
1025  if ( ! (fodInfos->ofnInfos->Flags & OFN_EXPLORER ) )
1026  return -1;
1027 
1028  /* get path and filenames */
1029  len = SendMessageW( fodInfos->DlgInfos.hwndFileName, WM_GETTEXTLENGTH, 0, 0 );
1030  buffer = heap_alloc( (len + 2 + MAX_PATH) * sizeof(WCHAR) );
1031  COMDLG32_GetDisplayNameOf( fodInfos->ShellInfos.pidlAbsCurrent, buffer );
1032  if (len)
1033  {
1034  p = buffer + lstrlenW(buffer);
1035  *p++ = '\\';
1036  SendMessageW( fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, len + 1, (LPARAM)p );
1037  }
1038  if (fodInfos->unicode)
1039  {
1040  total = lstrlenW( buffer) + 1;
1041  if (result) lstrcpynW( result, buffer, size );
1042  TRACE( "CDM_GETFILEPATH: returning %u %s\n", total, debugstr_w(result));
1043  }
1044  else
1045  {
1046  total = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL );
1047  if (total <= size) WideCharToMultiByte( CP_ACP, 0, buffer, -1, result, size, NULL, NULL );
1048  TRACE( "CDM_GETFILEPATH: returning %u %s\n", total, debugstr_a(result));
1049  }
1050  heap_free( buffer );
1051  return total;
1052 }
#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 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
#define lstrlenW
Definition: compat.h:415
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define lstrcpynW
Definition: compat.h:405
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:633
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LPOPENFILENAMEW ofnInfos
#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
struct FileOpenDlgInfos::@335 ShellInfos
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
struct FileOpenDlgInfos::@336 DlgInfos
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
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 1059 of file filedlg.c.

1060 {
1062  WCHAR lpstrPath[MAX_PATH];
1063  INT_PTR retval;
1064 
1065  if(!fodInfos) return FALSE;
1066 
1067  switch(uMsg)
1068  {
1069  case CDM_GETFILEPATH:
1071  break;
1072 
1073  case CDM_GETFOLDERPATH:
1074  TRACE("CDM_GETFOLDERPATH:\n");
1075  COMDLG32_GetDisplayNameOf(fodInfos->ShellInfos.pidlAbsCurrent, lpstrPath);
1076  if (lParam)
1077  {
1078  if (fodInfos->unicode)
1079  lstrcpynW((LPWSTR)lParam, lpstrPath, (int)wParam);
1080  else
1081  WideCharToMultiByte(CP_ACP, 0, lpstrPath, -1,
1082  (LPSTR)lParam, (int)wParam, NULL, NULL);
1083  }
1084  retval = lstrlenW(lpstrPath) + 1;
1085  break;
1086 
1087  case CDM_GETFOLDERIDLIST:
1088  retval = ILGetSize(fodInfos->ShellInfos.pidlAbsCurrent);
1089  if (retval <= wParam)
1090  memcpy((void*)lParam, fodInfos->ShellInfos.pidlAbsCurrent, retval);
1091  break;
1092 
1093  case CDM_GETSPEC:
1094  TRACE("CDM_GETSPEC:\n");
1095  retval = SendMessageW(fodInfos->DlgInfos.hwndFileName, WM_GETTEXTLENGTH, 0, 0) + 1;
1096  if (lParam)
1097  {
1098  if (fodInfos->unicode)
1099  SendMessageW(fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, wParam, lParam);
1100  else
1101  SendMessageA(fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, wParam, lParam);
1102  }
1103  break;
1104 
1105  case CDM_SETCONTROLTEXT:
1106  TRACE("CDM_SETCONTROLTEXT:\n");
1107  if ( lParam )
1108  {
1109  if( fodInfos->unicode )
1111  else
1113  }
1114  retval = TRUE;
1115  break;
1116 
1117  case CDM_HIDECONTROL:
1118  /* MSDN states that it should fail for not OFN_EXPLORER case */
1119  if (fodInfos->ofnInfos->Flags & OFN_EXPLORER)
1120  {
1121  HWND control = GetDlgItem( hwnd, wParam );
1122  if (control) ShowWindow( control, SW_HIDE );
1123  retval = TRUE;
1124  }
1125  else retval = FALSE;
1126  break;
1127 
1128  default:
1129  if (uMsg >= CDM_FIRST && uMsg <= CDM_LAST)
1130  FIXME("message CDM_FIRST+%04x not implemented\n", uMsg - CDM_FIRST);
1131  return FALSE;
1132  }
1134  return TRUE;
1135 }
#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
#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:415
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define lstrcpynW
Definition: compat.h:405
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:633
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
#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:1017
#define MAX_PATH
Definition: compat.h:26
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct FileOpenDlgInfos::@335 ShellInfos
#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:5321
#define CDM_GETFOLDERIDLIST
Definition: commdlg.h:46
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139
struct FileOpenDlgInfos::@336 DlgInfos
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_InitControls()

static LRESULT FILEDLG95_InitControls ( HWND  hwnd)
static

Definition at line 1524 of file filedlg.c.

1525 {
1526  BOOL win2000plus = FALSE;
1527  BOOL win98plus = FALSE;
1528  BOOL handledPath = FALSE;
1529  OSVERSIONINFOW osVi;
1530  static const WCHAR szwSlash[] = { '\\', 0 };
1531  static const WCHAR szwStar[] = { '*',0 };
1532 
1533  static const TBBUTTON tbb[] =
1534  {
1535  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1537  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1539  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1541  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1544  };
1545  static const TBADDBITMAP tba = {HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR};
1546 
1547  RECT rectTB;
1548  RECT rectlook;
1549 
1550  HIMAGELIST toolbarImageList;
1551  ITEMIDLIST *desktopPidl;
1553 
1555 
1556  TRACE("%p\n", fodInfos);
1557 
1558  /* Get windows version emulating */
1559  osVi.dwOSVersionInfoSize = sizeof(osVi);
1560  GetVersionExW(&osVi);
1562  win98plus = ((osVi.dwMajorVersion > 4) || ((osVi.dwMajorVersion == 4) && (osVi.dwMinorVersion > 0)));
1563  } else if (osVi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
1564  win2000plus = (osVi.dwMajorVersion > 4);
1565  if (win2000plus) win98plus = TRUE;
1566  }
1567  TRACE("Running on 2000+ %d, 98+ %d\n", win2000plus, win98plus);
1568 
1569 
1570  /* Use either the edit or the comboboxex for the filename control */
1571  if (filename_is_edit( fodInfos ))
1572  {
1574  fodInfos->DlgInfos.hwndFileName = GetDlgItem( hwnd, edt1 );
1575  }
1576  else
1577  {
1579  fodInfos->DlgInfos.hwndFileName = GetDlgItem( hwnd, cmb13 );
1580  }
1581 
1582  /* Get the hwnd of the controls */
1583  fodInfos->DlgInfos.hwndFileTypeCB = GetDlgItem(hwnd,IDC_FILETYPE);
1584  fodInfos->DlgInfos.hwndLookInCB = GetDlgItem(hwnd,IDC_LOOKIN);
1585 
1586  GetWindowRect( fodInfos->DlgInfos.hwndLookInCB,&rectlook);
1587  MapWindowPoints( 0, hwnd,(LPPOINT)&rectlook,2);
1588 
1589  /* construct the toolbar */
1591  MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2);
1592 
1593  rectTB.right = rectlook.right + rectTB.right - rectTB.left;
1594  rectTB.bottom = rectlook.top - 1 + rectTB.bottom - rectTB.top;
1595  rectTB.left = rectlook.right;
1596  rectTB.top = rectlook.top-1;
1597 
1598  if (fodInfos->unicode)
1599  fodInfos->DlgInfos.hwndTB = CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL,
1601  rectTB.left, rectTB.top,
1602  rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
1604  else
1605  fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL,
1607  rectTB.left, rectTB.top,
1608  rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
1610 
1611  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
1612 
1613 /* FIXME: use TB_LOADIMAGES when implemented */
1614 /* SendMessageW(fodInfos->DlgInfos.hwndTB, TB_LOADIMAGES, IDB_VIEW_SMALL_COLOR, HINST_COMMCTRL);*/
1615  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_SETMAXTEXTROWS, 0, 0);
1616  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, 12, (LPARAM) &tba);
1617 
1618  /* Retrieve and add desktop icon to the toolbar */
1619  toolbarImageList = (HIMAGELIST)SendMessageW(fodInfos->DlgInfos.hwndTB, TB_GETIMAGELIST, 0, 0L);
1621  SHGetFileInfoW((const WCHAR *)desktopPidl, 0, &fileinfo, sizeof(fileinfo),
1623  ImageList_AddIcon(toolbarImageList, fileinfo.hIcon);
1624 
1625  DestroyIcon(fileinfo.hIcon);
1626  CoTaskMemFree(desktopPidl);
1627 
1628  /* Finish Toolbar Construction */
1629  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSW, 9, (LPARAM) tbb);
1630  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
1631 
1632  if (is_places_bar_enabled(fodInfos))
1633  {
1634  TBBUTTON tb = { 0 };
1635  HIMAGELIST himl;
1636  RECT rect;
1637  int i, cx;
1638 
1641  cx = rect.right - rect.left;
1642 
1645 
1646  filedlg_collect_places_pidls(fodInfos);
1647  for (i = 0; i < ARRAY_SIZE(fodInfos->places); i++)
1648  {
1649  int index;
1650 
1651  if (!fodInfos->places[i])
1652  continue;
1653 
1654  memset(&fileinfo, 0, sizeof(fileinfo));
1655  SHGetFileInfoW((const WCHAR *)fodInfos->places[i], 0, &fileinfo, sizeof(fileinfo),
1658 
1659  tb.iBitmap = index;
1660  tb.iString = (INT_PTR)fileinfo.szDisplayName;
1661  tb.fsState = TBSTATE_ENABLED | TBSTATE_WRAP;
1662  tb.idCommand = TBPLACES_CMDID_PLACE0 + i;
1664 
1665  DestroyIcon(fileinfo.hIcon);
1666  }
1667 
1670  }
1671 
1672  /* Set the window text with the text specified in the OPENFILENAME structure */
1673  if(fodInfos->title)
1674  {
1675  SetWindowTextW(hwnd,fodInfos->title);
1676  }
1677  else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
1678  {
1679  WCHAR buf[64];
1682  }
1683 
1684  /* Initialise the file name edit control */
1685  handledPath = FALSE;
1686  TRACE("Before manipulation, file = %s, dir = %s\n", debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1687 
1688  if(fodInfos->filename)
1689  {
1690  /* 1. If win2000 or higher and filename contains a path, use it
1691  in preference over the lpstrInitialDir */
1692  if (win2000plus && *fodInfos->filename && wcspbrk(fodInfos->filename, szwSlash)) {
1693  WCHAR tmpBuf[MAX_PATH];
1694  WCHAR *nameBit;
1695  DWORD result;
1696 
1697  result = GetFullPathNameW(fodInfos->filename, MAX_PATH, tmpBuf, &nameBit);
1698  if (result) {
1699 
1700  /* nameBit is always shorter than the original filename. It may be NULL
1701  * when the filename contains only a drive name instead of file name */
1702  if (nameBit)
1703  {
1704  lstrcpyW(fodInfos->filename,nameBit);
1705  *nameBit = 0x00;
1706  }
1707  else
1708  *fodInfos->filename = '\0';
1709 
1710  heap_free(fodInfos->initdir);
1711  fodInfos->initdir = heap_alloc((lstrlenW(tmpBuf) + 1)*sizeof(WCHAR));
1712  lstrcpyW(fodInfos->initdir, tmpBuf);
1713  handledPath = TRUE;
1714  TRACE("Value in Filename includes path, overriding InitialDir: %s, %s\n",
1715  debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1716  }
1717  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1718 
1719  } else {
1720  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1721  }
1722  }
1723 
1724  /* 2. (All platforms) If initdir is not null, then use it */
1725  if (!handledPath && fodInfos->initdir && *fodInfos->initdir)
1726  {
1727  /* Work out the proper path as supplied one might be relative */
1728  /* (Here because supplying '.' as dir browses to My Computer) */
1729  WCHAR tmpBuf[MAX_PATH];
1730  WCHAR tmpBuf2[MAX_PATH];
1731  WCHAR *nameBit;
1732  DWORD result;
1733 
1734  lstrcpyW(tmpBuf, fodInfos->initdir);
1735  if (PathFileExistsW(tmpBuf)) {
1736  /* initdir does not have to be a directory. If a file is
1737  * specified, the dir part is taken */
1738  if (PathIsDirectoryW(tmpBuf)) {
1739  PathAddBackslashW(tmpBuf);
1740  lstrcatW(tmpBuf, szwStar);
1741  }
1742  result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit);
1743  if (result) {
1744  *nameBit = 0x00;
1745  heap_free(fodInfos->initdir);
1746  fodInfos->initdir = heap_alloc((lstrlenW(tmpBuf2) + 1) * sizeof(WCHAR));
1747  lstrcpyW(fodInfos->initdir, tmpBuf2);
1748  handledPath = TRUE;
1749  TRACE("Value in InitDir changed to %s\n", debugstr_w(fodInfos->initdir));
1750  }
1751  }
1752  else if (fodInfos->initdir)
1753  {
1754  heap_free(fodInfos->initdir);
1755  fodInfos->initdir = NULL;
1756  TRACE("Value in InitDir is not an existing path, changed to (nil)\n");
1757  }
1758  }
1759 
1760 #ifdef __REACTOS__
1761  if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir))
1762  {
1763  /* 2.5. Win2000+: Recently used defext */
1764  if (win2000plus) {
1765  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1766  fodInfos->initdir[0] = '\0';
1767 
1768  FILEDLG95_MRU_load_ext(fodInfos->initdir, MAX_PATH, fodInfos->defext);
1769 
1770  if (fodInfos->initdir[0] && PathIsDirectoryW(fodInfos->initdir)) {
1771  handledPath = TRUE;
1772  } else {
1773  heap_free(fodInfos->initdir);
1774  fodInfos->initdir = NULL;
1775  }
1776  }
1777  }
1778 #endif
1779 
1780  if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir))
1781  {
1782  /* 3. All except w2k+: if filename contains a path use it */
1783  if (!win2000plus && fodInfos->filename &&
1784  *fodInfos->filename &&
1785  wcspbrk(fodInfos->filename, szwSlash)) {
1786  WCHAR tmpBuf[MAX_PATH];
1787  WCHAR *nameBit;
1788  DWORD result;
1789 
1791  tmpBuf, &nameBit);
1792  if (result) {
1793  int len;
1794 
1795  /* nameBit is always shorter than the original filename */
1796  lstrcpyW(fodInfos->filename, nameBit);
1797  *nameBit = 0x00;
1798 
1799  len = lstrlenW(tmpBuf);
1800  heap_free(fodInfos->initdir);
1801  fodInfos->initdir = heap_alloc((len+1)*sizeof(WCHAR));
1802  lstrcpyW(fodInfos->initdir, tmpBuf);
1803 
1804  handledPath = TRUE;
1805  TRACE("Value in Filename includes path, overriding initdir: %s, %s\n",
1806  debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1807  }
1808  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1809  }
1810 
1811  /* 4. Win2000+: Recently used */
1812  if (!handledPath && win2000plus) {
1813  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1814  fodInfos->initdir[0] = '\0';
1815 
1817 
1818  if (fodInfos->initdir[0] && PathFileExistsW(fodInfos->initdir)){
1819  handledPath = TRUE;
1820  }else{
1821  heap_free(fodInfos->initdir);
1822  fodInfos->initdir = NULL;
1823  }
1824  }
1825 
1826  /* 5. win98+ and win2000+ if any files of specified filter types in
1827  current directory, use it */
1828  if (win98plus && !handledPath && fodInfos->filter && *fodInfos->filter) {
1829 
1830  LPCWSTR lpstrPos = fodInfos->filter;
1831  WIN32_FIND_DATAW FindFileData;
1832  HANDLE hFind;
1833 
1834  while (1)
1835  {
1836  /* filter is a list... title\0ext\0......\0\0 */
1837 
1838  /* Skip the title */
1839  if(! *lpstrPos) break; /* end */
1840  lpstrPos += lstrlenW(lpstrPos) + 1;
1841 
1842  /* See if any files exist in the current dir with this extension */
1843  if(! *lpstrPos) break; /* end */
1844 
1845  hFind = FindFirstFileW(lpstrPos, &FindFileData);
1846 
1847  if (hFind == INVALID_HANDLE_VALUE) {
1848  /* None found - continue search */
1849  lpstrPos += lstrlenW(lpstrPos) + 1;
1850 
1851  } else {
1852 
1853  heap_free(fodInfos->initdir);
1854  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1856 
1857  handledPath = TRUE;
1858  TRACE("No initial dir specified, but files of type %s found in current, so using it\n",
1859  debugstr_w(lpstrPos));
1860  FindClose(hFind);
1861  break;
1862  }
1863  }
1864  }
1865 
1866  /* 6. Win98+ and 2000+: Use personal files dir, others use current dir */
1867  if (!handledPath && (win2000plus || win98plus)) {
1868  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1869 
1870  if (SHGetFolderPathW(hwnd, CSIDL_PERSONAL, 0, 0, fodInfos->initdir) == S_OK)
1871  {
1873  {
1874  /* last fallback */
1876  TRACE("No personal or desktop dir, using cwd as failsafe: %s\n", debugstr_w(fodInfos->initdir));
1877  }
1878  else
1879  TRACE("No personal dir, using desktop instead: %s\n", debugstr_w(fodInfos->initdir));
1880  }
1881  else
1882  TRACE("No initial dir specified, using personal files dir of %s\n", debugstr_w(fodInfos->initdir));
1883 
1884  handledPath = TRUE;
1885  } else if (!handledPath) {
1886  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1888  handledPath = TRUE;
1889  TRACE("No initial dir specified, using current dir of %s\n", debugstr_w(fodInfos->initdir));
1890  }
1891  }
1892  SetFocus( fodInfos->DlgInfos.hwndFileName );
1893  TRACE("After manipulation, file = %s, dir = %s\n", debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1894 
1895  /* Must the open as read only check box be checked ?*/
1896  if(fodInfos->ofnInfos->Flags & OFN_READONLY)
1897  {
1899  }
1900 
1901  /* Must the open as read only check box be hidden? */
1902  if (filedialog_is_readonly_hidden(fodInfos))
1903  {
1906  }
1907 
1908  /* Must the help button be hidden? */
1909  if (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP))
1910  {
1913  }
1914 
1915  /* change Open to Save */
1916  if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
1917  {
1918  WCHAR buf[16];
1923  }
1924 
1925  /* Initialize the filter combo box */
1927 
1928  return 0;
1929 }
#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:1131
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:236
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1130
#define TRUE
Definition: types.h:120
#define FCIDM_TB_REPORTVIEW
Definition: shresdef.h:778
#define IDOK
Definition: winuser.h:824
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
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:282
#define CSIDL_DESKTOP
Definition: shlobj.h:2003
#define SW_HIDE
Definition: winuser.h:762
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
static BOOL filedialog_is_readonly_hidden(const FileOpenDlgInfos *info)
Definition: filedlg.c:165
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:421
#define IDC_OPENREADONLY
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:939
LONG top
Definition: windef.h:307
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
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:1085
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:62
#define TB_GETIMAGELIST
Definition: commctrl.h:1147
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
#define cmb13
Definition: dlgs.h:60
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:415
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:354
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define TB_SETMAXTEXTROWS
Definition: commctrl.h:1158
static void FILEDLG95_MRU_load_filename(LPWSTR stored_path)
Definition: filedlg.c:2464
#define CCS_NODIVIDER
Definition: commctrl.h:2244
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:994
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
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:1133
#define FCIDM_TB_UPFOLDER
Definition: shresdef.h:775
#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:776
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:1086
LPOPENFILENAMEW ofnInfos
#define TB_SETIMAGELIST
Definition: commctrl.h:1146
#define IDB_VIEW_SMALL_COLOR
Definition: commctrl.h:1062
#define BM_SETCHECK
Definition: winuser.h:1903
#define TRACE(s)
Definition: solgame.cpp:4
#define TBPLACES_CMDID_PLACE0
Definition: filedlg.c:128
ULONG dwMajorVersion
Definition: rtltypes.h:243
#define BTNS_SEP
Definition: commctrl.h:995
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:2695
#define VIEW_NEWFOLDER
Definition: commctrl.h:1094
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:242
#define MAX_PATH
Definition: compat.h:26
LPITEMIDLIST places[5]
#define FCIDM_TB_DESKTOP
Definition: shresdef.h:779
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:985
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
#define OFN_READONLY
Definition: commdlg.h:118
#define TB_ADDBITMAP
Definition: commctrl.h:1052
#define CCS_NORESIZE
Definition: commctrl.h:2241
#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:320
static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
Definition: filedlg.c:3423
#define TB_ADDBUTTONSW
Definition: commctrl.h:1262
GLenum GLsizei len
Definition: glext.h:6722
#define TB_SETBUTTONWIDTH
Definition: commctrl.h:1157
ULONG dwPlatformId
Definition: rtltypes.h:246
#define IDC_TOOLBARSTATIC
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define TOOLBARCLASSNAMEA
Definition: commctrl.h:940
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:414
#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:304
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
#define FCIDM_TB_SMALLICON
Definition: shresdef.h:777
#define CSIDL_FLAG_CREATE
#define pshHelp
Definition: dlgs.h:127
#define HINST_COMMCTRL
Definition: commctrl.h:1059
#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:581
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2087
#define TBSTATE_ENABLED
Definition: commctrl.h:970
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:973
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define VIEW_PARENTFOLDER
Definition: commctrl.h:1091
#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:1513
#define TBSTYLE_FLAT
Definition: commctrl.h:988
struct FileOpenDlgInfos::@336 DlgInfos
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
#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 3878 of file filedlg.c.

3879 {
3880  LPITEMIDLIST pidlNext;
3881  SHFILEINFOW sfi;
3882  SFOLDER *tmpFolder;
3883  LookInInfos *liInfos;
3884 
3885  TRACE("%p, %p, %d\n", hwnd, pidl, iInsertId);
3886 
3887  if(!pidl)
3888  return -1;
3889 
3890  if(!(liInfos = GetPropA(hwnd,LookInInfosStr)))
3891  return -1;
3892 
3893  tmpFolder = heap_alloc_zero(sizeof(*tmpFolder));
3894  tmpFolder->m_iIndent = 0;
3895 
3896  /* Calculate the indentation of the item in the lookin*/
3897  pidlNext = pidl;
3898  while ((pidlNext = ILGetNext(pidlNext)))
3899  {
3900  tmpFolder->m_iIndent++;
3901  }
3902 
3903  tmpFolder->pidlItem = ILClone(pidl);
3904 
3905  if(tmpFolder->m_iIndent > liInfos->iMaxIndentation)
3906  liInfos->iMaxIndentation = tmpFolder->m_iIndent;
3907 
3908  sfi.dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
3909  SHGetFileInfoW((LPCWSTR)pidl,
3910  0,
3911  &sfi,
3912  sizeof(sfi),
3914 
3915  TRACE("-- Add %s attr=0x%08x\n", debugstr_w(sfi.szDisplayName), sfi.dwAttributes);
3916 
3917  if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
3918  {
3919  int iItemID;
3920 
3921  TRACE("-- Add %s at %u\n", debugstr_w(sfi.szDisplayName), tmpFolder->m_iIndent);
3922 
3923  /* Add the item at the end of the list */
3924  if(iInsertId < 0)
3925  {
3926  iItemID = SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)sfi.szDisplayName);
3927  }
3928  /* Insert the item at the iInsertId position*/
3929  else
3930  {
3931  iItemID = SendMessageW(hwnd, CB_INSERTSTRING, iInsertId, (LPARAM)sfi.szDisplayName);
3932  }
3933 
3934  SendMessageW(hwnd, CB_SETITEMDATA, iItemID, (LPARAM)tmpFolder);
3935  return iItemID;
3936  }
3937 
3938  ILFree( tmpFolder->pidlItem );
3939  heap_free( tmpFolder );
3940  return -1;
3941 
3942 }
#define CB_SETITEMDATA
Definition: winuser.h:1948
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:143
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:105
#define debugstr_w
Definition: kernel32.h:32
#define SHGFI_PIDL
Definition: shellapi.h:178
#define CB_ADDSTRING
Definition: winuser.h:1918
#define CB_INSERTSTRING
Definition: winuser.h:1939
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:98
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:166
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
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 4081 of file filedlg.c.

4082 {
4084  LookInInfos *liInfos = GetPropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4085  int iPos, iCount;
4086 
4087  iCount = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCOUNT, 0, 0);
4088 
4089  TRACE("\n");
4090 
4091  /* Delete each string of the combo and their associated data */
4092  if (iCount != CB_ERR)
4093  {
4094  for(iPos = iCount-1;iPos>=0;iPos--)
4095  {
4096  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,iPos);
4097  ILFree(tmpFolder->pidlItem);
4098  heap_free(tmpFolder);
4099  SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_DELETESTRING, iPos, 0);
4100  }
4101  }
4102 
4103  /* LookInInfos structure */
4104  heap_free(liInfos);
4105  RemovePropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4106 }
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:143
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
#define CB_DELETESTRING
Definition: winuser.h:1919
struct FileOpenDlgInfos::@336 DlgInfos
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
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 3742 of file filedlg.c.

3743 {
3745  COLORREF crHighLight = GetSysColor(COLOR_HIGHLIGHT);
3747  RECT rectText;
3748  RECT rectIcon;
3749  SHFILEINFOW sfi;
3750  HIMAGELIST ilItemImage;
3751  int iIndentation;
3752  TEXTMETRICW tm;
3753  LPSFOLDER tmpFolder;
3755  UINT icon_width, icon_height;
3756 
3757  TRACE("\n");
3758 
3759  if(pDIStruct->itemID == -1)
3760  return 0;
3761 
3762  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem,
3763  pDIStruct->itemID)))
3764  return 0;
3765 
3766 
3767  icon_width = GetSystemMetrics(SM_CXICON);
3768  icon_height = GetSystemMetrics(SM_CYICON);
3769  if (pDIStruct->rcItem.bottom - pDIStruct->rcItem.top < icon_height)
3770  {
3771  icon_width = GetSystemMetrics(SM_CXSMICON);
3772  icon_height = GetSystemMetrics(SM_CYSMICON);
3773  shgfi_flags |= SHGFI_SMALLICON;
3774  }
3775 
3776  ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
3777  0, &sfi, sizeof (sfi), shgfi_flags );
3778 
3779  /* Is this item selected ? */
3780  if(pDIStruct->itemState & ODS_SELECTED)
3781  {
3782  SetTextColor(pDIStruct->hDC,(0x00FFFFFF & ~(crText)));
3783  SetBkColor(pDIStruct->hDC,crHighLight);
3784  FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_HIGHLIGHT));
3785  }
3786  else
3787  {
3788  SetTextColor(pDIStruct->hDC,crText);
3789  SetBkColor(pDIStruct->hDC,crWin);
3790  FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_WINDOW));
3791  }
3792 
3793  /* Do not indent item if drawing in the edit of the combo */
3794  if(pDIStruct->itemState & ODS_COMBOBOXEDIT)
3795  iIndentation = 0;
3796  else
3797  iIndentation = tmpFolder->m_iIndent;
3798 
3799  /* Draw text and icon */
3800 
3801  /* Initialise the icon display area */
3802  rectIcon.left = pDIStruct->rcItem.left + 1 + icon_width/2 * iIndentation;
3803  rectIcon.top = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - icon_height) / 2;
3804  rectIcon.right = rectIcon.left + icon_width + XTEXTOFFSET;
3805  rectIcon.bottom = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + icon_height) / 2;
3806 
3807  /* Initialise the text display area */
3808  GetTextMetricsW(pDIStruct->hDC, &tm);
3809  rectText.left = rectIcon.right;
3810  rectText.top =
3811  (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - tm.tmHeight) / 2;
3812  rectText.right = pDIStruct->rcItem.right;
3813  rectText.bottom =
3814  (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + tm.tmHeight) / 2;
3815 
3816  /* Draw the icon from the image list */
3817  ImageList_Draw(ilItemImage,
3818  sfi.iIcon,
3819  pDIStruct->hDC,
3820  rectIcon.left,
3821  rectIcon.top,
3822  ILD_TRANSPARENT );
3823 
3824  /* Draw the associated text */
3825  TextOutW(pDIStruct->hDC,rectText.left,rectText.top,sfi.szDisplayName,lstrlenW(sfi.szDisplayName));
3826  return NOERROR;
3827 }
#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:307
#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:1228
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:415
#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:140
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
#define XTEXTOFFSET
Definition: filedlg.c:115
#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:300
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
int m_iIndent
Definition: filedlg.c:98
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:320
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
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:888
#define ILD_TRANSPARENT
Definition: commctrl.h:414
unsigned int UINT
Definition: ndis.h:50
#define ODS_SELECTED
Definition: winuser.h:2520
LONG bottom
Definition: windef.h:309
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 3657 of file filedlg.c.

3658 {
3659  IShellFolder *psfRoot, *psfDrives;
3660  IEnumIDList *lpeRoot, *lpeDrives;
3661  LPITEMIDLIST pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
3662  HDC hdc;
3663  TEXTMETRICW tm;
3664  LookInInfos *liInfos = heap_alloc_zero(sizeof(*liInfos));
3665 
3666  TRACE("%p\n", hwndCombo);
3667 
3668  liInfos->iMaxIndentation = 0;
3669 
3670  SetPropA(hwndCombo, LookInInfosStr, liInfos);
3671 
3672  hdc = GetDC( hwndCombo );
3673  SelectObject( hdc, (HFONT)SendMessageW( hwndCombo, WM_GETFONT, 0, 0 ));
3674  GetTextMetricsW( hdc, &tm );
3675  ReleaseDC( hwndCombo, hdc );
3676 
3677  /* set item height for both text field and listbox */
3678  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, -1, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3679  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, 0, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3680 
3681  /* Turn on the extended UI for the combo box like Windows does */
3682  SendMessageW(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
3683 
3684  /* Initialise data of Desktop folder */
3686  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3687  ILFree(pidlTmp);
3688 
3690 
3691  SHGetDesktopFolder(&psfRoot);
3692 
3693  if (psfRoot)
3694  {
3695  /* enumerate the contents of the desktop */
3696  if(SUCCEEDED(IShellFolder_EnumObjects(psfRoot, hwndCombo, SHCONTF_FOLDERS, &lpeRoot)))
3697  {
3698  while (S_OK == IEnumIDList_Next(lpeRoot, 1, &pidlTmp, NULL))
3699  {
3700  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3701 
3702  /* If the unixfs extension is rooted, we don't expand the drives by default */
3704  {
3705  /* special handling for CSIDL_DRIVES */
3706  if (ILIsEqual(pidlTmp, pidlDrives))
3707  {
3708  if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
3709  {
3710  /* enumerate the drives */
3711  if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives)))
3712  {
3713  while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
3714  {
3715  pidlAbsTmp = ILCombine(pidlTmp, pidlTmp1);
3716  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
3717  ILFree(pidlAbsTmp);
3718  ILFree(pidlTmp1);
3719  }
3720  IEnumIDList_Release(lpeDrives);
3721  }
3722  IShellFolder_Release(psfDrives);
3723  }
3724  }
3725  }
3726 
3727  ILFree(pidlTmp);
3728  }
3729  IEnumIDList_Release(lpeRoot);
3730  }
3731  IShellFolder_Release(psfRoot);
3732  }
3733 
3734  ILFree(pidlDrives);
3735 }
#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:143
#define LISTEND
Definition: filedlg.c:118
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:105
#define CB_SETITEMHEIGHT
Definition: winuser.h:1949
#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:3640
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2695
int WINAPI GetSystemMetrics(_In_ int)
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:3878
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:1946
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 3949 of file filedlg.c.

3950 {
3951 
3952  LPITEMIDLIST pidlParent = GetParentPidl(pidl);
3953  int iParentPos;
3954 
3955  TRACE("\n");
3956 
3957  if (pidl == pidlParent)
3958  return -1;
3959 
3960  iParentPos = FILEDLG95_LOOKIN_SearchItem(hwnd,(WPARAM)pidlParent,SEARCH_PIDL);
3961 
3962  if(iParentPos < 0)
3963  {
3964  iParentPos = FILEDLG95_LOOKIN_InsertItemAfterParent(hwnd,pidlParent);
3965  }
3966 
3967  ILFree(pidlParent);
3968 
3969  return FILEDLG95_LOOKIN_AddItem(hwnd,pidl,iParentPos + 1);
3970 }
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:4051
UINT_PTR WPARAM
Definition: windef.h:207
#define SEARCH_PIDL
Definition: filedlg.c:121
LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl)
Definition: filedlg.c:4413
#define TRACE(s)
Definition: solgame.cpp:4
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:3878
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:3949
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 3835 of file filedlg.c.

3836 {
3838 
3839  TRACE("%p\n", fodInfos);
3840 
3841  switch(wNotifyCode)
3842  {
3843  case CBN_SELENDOK:
3844  {
3845  LPSFOLDER tmpFolder;
3846  int iItem;
3847 
3848  iItem = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCURSEL, 0, 0);
3849 
3850  if( iItem == CB_ERR) return FALSE;
3851 
3852  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,
3853  iItem)))
3854  return FALSE;
3855 
3856 
3857  if(SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
3858  tmpFolder->pidlItem,
3859  SBSP_ABSOLUTE)))
3860  {
3861  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3863  return TRUE;
3864  }
3865  break;
3866  }
3867 
3868  }
3869  return FALSE;
3870 }
#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
#define CB_GETCURSEL
Definition: winuser.h:1925
#define CBN_SELENDOK
Definition: winuser.h:1963
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
struct FileOpenDlgInfos::@334 Shell
#define CB_ERR
Definition: winuser.h:2410
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:988
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct FileOpenDlgInfos::@336 DlgInfos
#define SUCCEEDED(hr)
Definition: intsafe.h:57
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_LOOKIN_RemoveMostExpandedItem()

static int FILEDLG95_LOOKIN_RemoveMostExpandedItem ( HWND  hwnd)
static

Definition at line 4021 of file filedlg.c.

4022 {
4023  int iItemPos;
4025 
4026  TRACE("\n");
4027 
4028  if(liInfos->iMaxIndentation <= 2)
4029  return -1;
4030 
4031  if((iItemPos = FILEDLG95_LOOKIN_SearchItem(hwnd,liInfos->iMaxIndentation,SEARCH_EXP)) >=0)
4032  {
4033  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4034  ILFree(tmpFolder->pidlItem);
4035  heap_free(tmpFolder);
4036  SendMessageW(hwnd, CB_DELETESTRING, iItemPos, 0);
4037  liInfos->iMaxIndentation--;
4038 
4039  return iItemPos;
4040  }
4041 
4042  return -1;
4043 }
#define SEARCH_EXP
Definition: filedlg.c:122
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:143
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4051
int iMaxIndentation
Definition: filedlg.c:105
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_DELETESTRING
Definition: winuser.h:1919
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 4051 of file filedlg.c.

4052 {
4053  int i = 0;
4054  int iCount;
4055 
4056  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
4057 
4058  TRACE("0x%08lx 0x%x\n",searchArg, iSearchMethod);
4059 
4060  if (iCount != CB_ERR)
4061  {
4062  for(;i<iCount;i++)
4063  {
4064  LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i);
4065 
4066  if (iSearchMethod == SEARCH_PIDL && ILIsEqual((LPITEMIDLIST)searchArg, tmpFolder->pidlItem))
4067  return i;
4068  if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg)
4069  return i;
4070  }
4071  }
4072 
4073  return -1;
4074 }
#define SEARCH_EXP
Definition: filedlg.c:122
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:121
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:98
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
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 3978 of file filedlg.c.

3979 {
3980  int iItemPos;
3981  LookInInfos *liInfos;
3982 
3983  TRACE("%p, %p\n", hwnd, pidl);
3984 
3986 
3987  liInfos = GetPropA(hwnd,LookInInfosStr);
3988 
3989  if(iItemPos < 0)
3990  {
3993  }
3994 
3995  else
3996  {
3997  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
3998  while(liInfos->iMaxIndentation > tmpFolder->m_iIndent)
3999  {
4000  int iRemovedItem;
4001 
4002  if(-1 == (iRemovedItem = FILEDLG95_LOOKIN_RemoveMostExpandedItem(hwnd)))
4003  break;
4004  if(iRemovedItem < iItemPos)
4005  iItemPos--;
4006  }
4007  }
4008 
4009  SendMessageW(hwnd, CB_SETCURSEL, iItemPos, 0);
4010  liInfos->uSelectedItem = iItemPos;
4011 
4012  return 0;
4013 
4014 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const char LookInInfosStr[]
Definition: filedlg.c:143
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4051
UINT_PTR WPARAM
Definition: windef.h:207
int iMaxIndentation
Definition: filedlg.c:105
#define SEARCH_PIDL
Definition: filedlg.c:121
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:98
#define CB_SETCURSEL
Definition: winuser.h:1943
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:4021
UINT uSelectedItem
Definition: filedlg.c:106
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:3949
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 2302 of file filedlg.c.

2303 {
2304  WCHAR mru_list[32], *cur_mru_slot;
2305  BOOL taken[25] = {0};
2306  DWORD mru_list_size = sizeof(mru_list), key_type = -1, i;
2307  HKEY hkey_tmp, *hkey;
2308  LONG ret;
2309 
2310  if(hkey_ret)
2311  hkey = hkey_ret;
2312  else
2313  hkey = &hkey_tmp;
2314 
2315  if(stored_path)
2316  *stored_path = '\0';
2317 
2319  if(ret){
2320  WARN("Unable to create MRU key: %d\n", ret);
2321  return 0;
2322  }
2323 
2324  ret = RegGetValueW(*hkey, NULL, MRUListW, RRF_RT_REG_SZ, &key_type,
2325  (LPBYTE)mru_list, &mru_list_size);
2326  if(ret || key_type != REG_SZ){
2327  if(ret == ERROR_FILE_NOT_FOUND)
2328  return 'a';
2329 
2330  WARN("Error getting MRUList data: type: %d, ret: %d\n", key_type, ret);
2331  RegCloseKey(*hkey);
2332  return 0;
2333  }
2334 
2335  for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot){
2336  WCHAR value_data[MAX_PATH], value_name[2] = {0};
2337  DWORD value_data_size = sizeof(value_data);
2338 
2339  *value_name = *cur_mru_slot;
2340 
2341  ret = RegGetValueW(*hkey, NULL, value_name, RRF_RT_REG_BINARY,
2342  &key_type, (LPBYTE)value_data, &value_data_size);
2343  if(ret || key_type != REG_BINARY){
2344  WARN("Error getting MRU slot data: type: %d, ret: %d\n", key_type, ret);
2345  continue;
2346  }
2347 
2348  if(!wcsicmp(module_name, value_data)){
2349  if(!hkey_ret)
2350  RegCloseKey(*hkey);
2351  if(stored_path)
2352  lstrcpyW(stored_path, value_data + lstrlenW(value_data) + 1);
2353  return *value_name;
2354  }
2355  }
2356 
2357  if(!hkey_ret)
2358  RegCloseKey(*hkey);
2359 
2360  /* the module name isn't in the registry, so find the next open slot */
2361  for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot)
2362  taken[*cur_mru_slot - 'a'] = TRUE;
2363  for(i = 0; i < 25; ++i){
2364  if(!taken[i])
2365  return i + 'a';
2366  }
2367 
2368  /* all slots are taken, so return the last one in MRUList */
2369  --cur_mru_slot;
2370  return *cur_mru_slot;
2371 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
#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:415
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
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:1199
static const WCHAR MRUListW[]
Definition: filedlg.c:151
#define wcsicmp
Definition: string.h:1152
#define lstrcpyW
Definition: compat.h:414
static const WCHAR LastVisitedMRUW[]
Definition: filedlg.c:146
#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 2464 of file filedlg.c.

2465 {
2466  WCHAR module_path[MAX_PATH], *module_name;
2467 
2468  /* get the current executable's name */
2469  if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2470  {
2471  WARN("GotModuleFileName failed: %d\n", GetLastError());
2472  return;
2473  }
2474  module_name = wcsrchr(module_path, '\\');
2475  if(!module_name)
2476  module_name = module_path;
2477  else
2478  module_name += 1;
2479 
2480  FILEDLG95_MRU_get_slot(module_name, stored_path, NULL);
2481  TRACE("got MRU path: %s\n", wine_dbgstr_w(stored_path));
2482 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define ARRAY_SIZE(a)
Definition: main.h:24
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:847
static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHKEY hkey_ret)
Definition: filedlg.c:2302

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_MRU_save_filename()

static void FILEDLG95_MRU_save_filename ( LPCWSTR  filename)
static

Definition at line 2374 of file filedlg.c.

2375 {
2376  WCHAR module_path[MAX_PATH], *module_name, slot, slot_name[2] = {0};
2377  LONG ret;
2378  HKEY hkey;
2379 
2380  /* get the current executable's name */
2381  if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2382  {
2383  WARN("GotModuleFileName failed: %d\n", GetLastError());
2384  return;
2385  }
2386  module_name = wcsrchr(module_path, '\\');
2387  if(!module_name)
2388  module_name = module_path;
2389  else
2390  module_name += 1;
2391 
2393  if(!slot)
2394  return;
2395  *slot_name = slot;
2396 
2397  { /* update the slot's info */
2398  WCHAR *path_ends, *final;
2399  DWORD path_len, final_len;
2400 
2401  /* use only the path segment of `filename' */
2402  path_ends = wcsrchr(filename, '\\');
2403  path_len = path_ends - filename;
2404 
2405  final_len = path_len + lstrlenW(module_name) + 2;
2406 
2407  final = heap_alloc(final_len * sizeof(WCHAR));
2408  if(!final)
2409  return;
2410  lstrcpyW(final, module_name);
2411  memcpy(final + lstrlenW(final) + 1, filename, path_len * sizeof(WCHAR));
2412  final[final_len-1] = '\0';
2413 
2414  ret = RegSetValueExW(hkey, slot_name, 0, REG_BINARY, (LPBYTE)final,
2415  final_len * sizeof(WCHAR));
2416  if(ret){
2417  WARN("Error saving MRU data to slot %s: %d\n", wine_dbgstr_w(slot_name), ret);
2418  heap_free(final);
2419  RegCloseKey(hkey);
2420  return;
2421  }
2422 
2423  heap_free(final);
2424  }
2425 
2426  { /* update MRUList value */
2427  WCHAR old_mru_list[32], new_mru_list[32];
2428  WCHAR *old_mru_slot, *new_mru_slot = new_mru_list;
2429  DWORD mru_list_size = sizeof(old_mru_list), key_type;
2430 
2431  ret = RegGetValueW(hkey, NULL, MRUListW, RRF_RT_ANY, &key_type,
2432  (LPBYTE)old_mru_list, &mru_list_size);
2433  if(ret || key_type != REG_SZ){
2434  if(ret == ERROR_FILE_NOT_FOUND){
2435  new_mru_list[0] = slot;
2436  new_mru_list[1] = '\0';
2437  }else{
2438  WARN("Error getting MRUList data: type: %d, ret: %d\n", key_type, ret);
2439  RegCloseKey(hkey);
2440  return;
2441  }
2442  }else{
2443  /* copy old list data over so that the new slot is at the start
2444  * of the list */
2445  *new_mru_slot++ = slot;
2446  for(old_mru_slot = old_mru_list; *old_mru_slot; ++old_mru_slot){
2447  if(*old_mru_slot != slot)
2448  *new_mru_slot++ = *old_mru_slot;
2449  }
2450  *new_mru_slot = '\0';
2451  }
2452 
2453  ret = RegSetValueExW(hkey, MRUListW, 0, REG_SZ, (LPBYTE)new_mru_list,
2454  (lstrlenW(new_mru_list) + 1) * sizeof(WCHAR));
2455  if(ret){
2456  WARN("Error saving MRUList data: %d\n", ret);
2457  RegCloseKey(hkey);
2458  return;
2459  }
2460  }
2461 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
struct _slot slot
Definition: vfat.h:196
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
#define REG_BINARY
Definition: nt_native.h:1496
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:415
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
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
#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:4895
__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:151
Definition: vfat.h:184
static DWORD path_len
Definition: batch.c:31
#define lstrcpyW
Definition: compat.h:414
#define ARRAY_SIZE(a)
Definition: main.h:24
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:847
#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:2302
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 2841 of file filedlg.c.

2842 {
2844  LPWSTR lpstrFileList;
2845  UINT nFileCount = 0;
2846  UINT sizeUsed = 0;
2847  BOOL ret = TRUE;
2848  WCHAR lpstrPathAndFile[MAX_PATH];
2849  LPSHELLFOLDER lpsf = NULL;
2850  int nOpenAction;
2851 
2852  TRACE("hwnd=%p\n", hwnd);
2853 
2854  /* try to browse the selected item */
2856  return FALSE;
2857 
2858  /* get the files from the edit control */
2859  nFileCount = FILEDLG95_FILENAME_GetFileNames(hwnd, &lpstrFileList, &sizeUsed);
2860 
2861  if(nFileCount == 0)
2862  return FALSE;
2863 
2864  if(nFileCount > 1)
2865  {
2866  ret = FILEDLG95_OnOpenMultipleFiles(hwnd, lpstrFileList, nFileCount, sizeUsed);
2867  goto ret;
2868  }
2869 
2870  TRACE("count=%u len=%u file=%s\n", nFileCount, sizeUsed, debugstr_w(lpstrFileList));
2871 
2872 /*
2873  Step 1: Build a complete path name from the current folder and
2874  the filename or path in the edit box.
2875  Special cases:
2876  - the path in the edit box is a root path
2877  (with or without drive letter)
2878  - the edit box contains ".." (or a path with ".." in it)
2879 */
2880 
2881  COMDLG32_GetCanonicalPath(fodInfos->ShellInfos.pidlAbsCurrent, lpstrFileList, lpstrPathAndFile);
2882  heap_free(lpstrFileList);
2883 
2884 /*
2885  Step 2: here we have a cleaned up path
2886 
2887  We have to parse the path step by step to see if we have to browse
2888  to a folder if the path points to a directory or the last
2889  valid element is a directory.
2890 
2891  valid variables:
2892  lpstrPathAndFile: cleaned up path
2893  */
2894 
2895  if (nFileCount &&
2896  (fodInfos->ofnInfos->Flags & OFN_NOVALIDATE) &&
2897  !(fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST))
2898  nOpenAction = ONOPEN_OPEN;
2899  else
2900  nOpenAction = ONOPEN_BROWSE;
2901 
2902  nOpenAction = FILEDLG95_ValidatePathAction(lpstrPathAndFile, &lpsf, hwnd,
2903  fodInfos->ofnInfos->Flags,
2904  fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG,
2905  nOpenAction);
2906  if(!nOpenAction)
2907  goto ret;
2908 
2909 /*
2910  Step 3: here we have a cleaned up and validated path
2911 
2912  valid variables:
2913  lpsf: ShellFolder bound to the rightmost valid path component
2914  lpstrPathAndFile: cleaned up path
2915  nOpenAction: action to do
2916 */
2917  TRACE("end validate sf=%p\n", lpsf);
2918 
2919  switch(nOpenAction)
2920  {
2921  case ONOPEN_SEARCH: /* set the current filter to the file mask and refresh */
2922  TRACE("ONOPEN_SEARCH %s\n", debugstr_w(lpstrPathAndFile));
2923  {
2924  int iPos;
2925  LPWSTR lpszTemp = PathFindFileNameW(lpstrPathAndFile);
2926  DWORD len;
2927 
2928  /* replace the current filter */
2929  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
2930  len = lstrlenW(lpszTemp)+1;
2931  fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc(len * sizeof(WCHAR));
2932  lstrcpyW( fodInfos->ShellInfos.lpstrCurrentFilter, lpszTemp);
2933 
2934  /* set the filter cb to the extension when possible */
2935  if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, lpszTemp)))
2936  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETCURSEL, iPos, 0);
2937  }
2938  /* fall through */
2939  case ONOPEN_BROWSE: /* browse to the highest folder we could bind to */
2940  TRACE("ONOPEN_BROWSE\n");
2941  {
2942  IPersistFolder2 * ppf2;
2943  if(SUCCEEDED(IShellFolder_QueryInterface( lpsf, &IID_IPersistFolder2, (LPVOID*)&ppf2)))
2944  {
2945  LPITEMIDLIST pidlCurrent;
2946  IPersistFolder2_GetCurFolder(ppf2, &pidlCurrent);
2947  IPersistFolder2_Release(ppf2);
2948  if (!ILIsEqual(pidlCurrent, fodInfos->ShellInfos.pidlAbsCurrent))
2949  {
2950  if (SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidlCurrent, SBSP_ABSOLUTE))
2951  && fodInfos->ofnInfos->Flags & OFN_EXPLORER)
2952  {
2954  SendMessageA(fodInfos->DlgInfos.hwndFileName, WM_SETTEXT, 0, (LPARAM)"");
2955  }
2956  }
2957  else if( nOpenAction == ONOPEN_SEARCH )
2958  {
2959  if (fodInfos->Shell.FOIShellView)
2960  IShellView_Refresh(fodInfos->Shell.FOIShellView);
2961  }
2962  ILFree(pidlCurrent);
2963  if (filename_is_edit( fodInfos ))
2964  SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
2965  else
2966  {
2967  HWND hwnd;
2968 
2969  hwnd = (HWND)SendMessageA(fodInfos->DlgInfos.hwndFileName, CBEM_GETEDITCONTROL, 0, 0);
2970  SendMessageW(hwnd, EM_SETSEL, 0, -1);
2971  }
2972  }
2973  }
2974  ret = FALSE;
2975  break;
2976  case ONOPEN_OPEN: /* fill in the return struct and close the dialog */
2977  TRACE("ONOPEN_OPEN %s\n", debugstr_w(lpstrPathAndFile));
2978  {
2979  WCHAR *ext = NULL;
2980 
2981  /* update READONLY check box flag */
2983  fodInfos->ofnInfos->Flags |= OFN_READONLY;
2984  else
2985  fodInfos->ofnInfos->Flags &= ~OFN_READONLY;
2986 
2987  /* Attach the file extension with file name*/
2988  ext = PathFindExtensionW(lpstrPathAndFile);
2989 #ifdef __REACTOS__
2990  {
2991  LPWSTR filterExt = NULL, lpstrFilter = NULL, pch, pchNext;
2992  LPCWSTR the_ext = NULL;
2993  static const WCHAR szwDot[] = {'.',0};
2994  int PathLength = lstrlenW(lpstrPathAndFile);
2995 
2996  /* get filter extensions */
2997  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
2998  fodInfos->ofnInfos->nFilterIndex - 1);
2999  if (lpstrFilter != (LPWSTR)CB_ERR) /* control is not empty */
3000  {
3001  LPWSTR filterSearchIndex, pchFirst = NULL;
3002  filterExt = heap_alloc((lstrlenW(lpstrFilter) + 1) * sizeof(WCHAR));
3003  if (filterExt)
3004  {
3005  strcpyW(filterExt, lpstrFilter);
3006 
3007  if (ext && *ext)
3008  {
3009  /* find ext in filter */
3010  for (pch = filterExt; pch && *pch; pch = pchNext)
3011  {
3012  filterSearchIndex = strchrW(pch, ';');
3013  if (filterSearchIndex)
3014  {
3015  filterSearchIndex[0] = 0;
3016  pchNext = filterSearchIndex + 1;
3017  }
3018  else
3019  {
3020  pchNext = NULL;
3021  }
3022 
3023  while (*pch == '*' || *pch == '.' || *pch == '?')
3024  {
3025  ++pch;
3026  }
3027 
3028  if (!pchFirst)
3029  pchFirst = pch;
3030 
3031  if (lstrcmpiW(pch, &ext[1]) == 0)
3032  {
3033  the_ext = pch;
3034  break;
3035  }
3036  }
3037 
3038  /* use first one if not found */
3039  if (!the_ext && pchFirst && *pchFirst)
3040  {
3041  the_ext = pchFirst;
3042  }
3043  }
3044  }
3045  }
3046 
3047  if (!the_ext)
3048  {
3049  /* use default extension if no extension in filter */
3050  the_ext = fodInfos->defext;
3051  }
3052 
3053  if (the_ext && *the_ext && lstrcmpiW(&ext[1], the_ext) != 0)
3054  {
3055  if (strlenW(lpstrPathAndFile) + 1 + strlenW(the_ext) + 1 <=
3056  fodInfos->ofnInfos->nMaxFile)
3057  {
3058  /* append the dot */
3059  lstrcatW(lpstrPathAndFile, szwDot);
3060  /* append the extension */
3061  lstrcatW(lpstrPathAndFile, the_ext);
3062  /* update ext */
3063  ext = PathFindExtensionW(lpstrPathAndFile);
3064  }
3065  }
3066 
3067  heap_free(filterExt);
3068 
3069  /* In Open dialog: if file does not exist try without extension */
3070  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile))
3071  lpstrPathAndFile[PathLength] = 0;
3072 
3073  /* Set/clear the output OFN_EXTENSIONDIFFERENT flag */
3074  if (*ext)
3075  ext++;
3076  if (!lstrcmpiW(fodInfos->defext, ext))
3077  fodInfos->ofnInfos->Flags &= ~OFN_EXTENSIONDIFFERENT;
3078  else
3079  fodInfos->ofnInfos->Flags |= OFN_EXTENSIONDIFFERENT;
3080  }
3081 
3082  /* update dialog data */
3083  SetWindowTextW(fodInfos->DlgInfos.hwndFileName, PathFindFileNameW(lpstrPathAndFile));
3084 #else /* __REACTOS__ */
3085  if (! *ext && fodInfos->defext)
3086  {
3087  /* if no extension is specified with file name, then */
3088  /* attach the extension from file filter or default one */
3089 
3090  WCHAR *filterExt = NULL;
3091  LPWSTR lpstrFilter = NULL;
3092  static const WCHAR szwDot[] = {'.',0};
3093  int PathLength = lstrlenW(lpstrPathAndFile);
3094 
3095  /*Get the file extension from file type filter*/
3096  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3097  fodInfos->ofnInfos->nFilterIndex-1);
3098 
3099  if (lpstrFilter != (LPWSTR)CB_ERR) /* control is not empty */
3100  {
3101  WCHAR* filterSearchIndex;
3102  filterExt = heap_alloc((lstrlenW(lpstrFilter) + 1) * sizeof(WCHAR));
3103  lstrcpyW(filterExt, lpstrFilter);
3104 
3105  /* if a semicolon-separated list of file extensions was given, do not include the
3106  semicolon or anything after it in the extension.
3107  example: if filterExt was "*.abc;*.def", it will become "*.abc" */
3108  filterSearchIndex = wcschr(filterExt, ';');
3109  if (filterSearchIndex)
3110  {
3111  filterSearchIndex[0] = '\0';
3112  }
3113 
3114  /* find the file extension by searching for the first dot in filterExt */
3115  /* strip the * or anything else from the extension, "*.abc" becomes "abc" */
3116  /* if the extension is invalid or contains a glob, ignore it */
3117  filterSearchIndex = wcschr(filterExt, '.');
3118  if (filterSearchIndex++ && !wcschr(filterSearchIndex, '*') && !wcschr(filterSearchIndex, '?'))
3119  {
3120  lstrcpyW(filterExt, filterSearchIndex);
3121  }
3122  else
3123  {
3124  heap_free(filterExt);
3125  filterExt = NULL;
3126  }
3127  }
3128 
3129  if (!filterExt)
3130  {
3131  /* use the default file extension */
3132  filterExt = heap_alloc((lstrlenW(fodInfos->defext) + 1) * sizeof(WCHAR));
3133  lstrcpyW(filterExt, fodInfos->defext);
3134  }
3135 
3136  if (*filterExt) /* ignore filterExt="" */
3137  {
3138  /* Attach the dot*/
3139  lstrcatW(lpstrPathAndFile, szwDot);
3140  /* Attach the extension */
3141  lstrcatW(lpstrPathAndFile, filterExt);
3142  }
3143 
3144  heap_free(filterExt);
3145 
3146  /* In Open dialog: if file does not exist try without extension */
3147  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile))
3148  lpstrPathAndFile[PathLength] = '\0';
3149 
3150  /* Set/clear the output OFN_EXTENSIONDIFFERENT flag */
3151  if (*ext)
3152  ext++;
3153  if (!lstrcmpiW(fodInfos->defext, ext))
3154  fodInfos->ofnInfos->Flags &= ~OFN_EXTENSIONDIFFERENT;
3155  else
3156  fodInfos->ofnInfos->Flags |= OFN_EXTENSIONDIFFERENT;
3157  }
3158 #endif /* __REACTOS__ */
3159 
3160  /* In Save dialog: check if the file already exists */
3161  if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG
3162  && fodInfos->ofnInfos->Flags & OFN_OVERWRITEPROMPT
3163  && PathFileExistsW(lpstrPathAndFile))
3164  {
3165  WCHAR lpstrOverwrite[100];
3166  int answer;
3167 
3168  LoadStringW(COMDLG32_hInstance, IDS_OVERWRITEFILE, lpstrOverwrite, 100);
3169  answer = MessageBoxW(hwnd, lpstrOverwrite, fodInfos->title,
3171  if (answer == IDNO || answer == IDCANCEL)
3172  {
3173  ret = FALSE;
3174  goto ret;
3175  }
3176  }
3177 
3178  /* In Open dialog: check if it should be created if it doesn't exist */
3179  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
3180  && fodInfos->ofnInfos->Flags & OFN_CREATEPROMPT
3181  && !PathFileExistsW(lpstrPathAndFile))
3182  {
3183  WCHAR lpstrCreate[100];
3184  int answer;
3185 
3186  LoadStringW(COMDLG32_hInstance, IDS_CREATEFILE, lpstrCreate, 100);
3187  answer = MessageBoxW(hwnd, lpstrCreate, fodInfos->title,
3189  if (answer == IDNO || answer == IDCANCEL)
3190  {
3191  ret = FALSE;
3192  goto ret;
3193  }
3194  }
3195 
3196  /* Check that the size of the file does not exceed buffer size.
3197  (Allow for extra \0 if OFN_MULTISELECT is set.) */
3198  if(lstrlenW(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile -
3199  ((fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) ? 1 : 0))
3200  {
3201 
3202  /* fill destination buffer */
3203  if (fodInfos->ofnInfos->lpstrFile)
3204  {
3205  if(fodInfos->unicode)
3206  {
3207  LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
3208 
3209  lstrcpynW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile);
3211  ofn->lpstrFile[lstrlenW(ofn->lpstrFile) + 1] = '\0';
3212  }
3213  else
3214  {
3216 
3217  WideCharToMultiByte(CP_ACP, 0, lpstrPathAndFile, -1,
3220  ofn->lpstrFile[lstrlenA(ofn->lpstrFile) + 1] = '\0';
3221  }
3222  }
3223 
3224  if(fodInfos->unicode)
3225  {
3226  LPWSTR lpszTemp;
3227 
3228  /* set filename offset */
3229  lpszTemp = PathFindFileNameW(lpstrPathAndFile);
3230  fodInfos->ofnInfos->nFileOffset = (lpszTemp - lpstrPathAndFile);
3231 
3232  /* set extension offset */
3233  lpszTemp = PathFindExtensionW(lpstrPathAndFile);
3234  fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - lpstrPathAndFile) + 1 : 0;
3235  }
3236  else
3237  {
3238  LPSTR lpszTemp;
3239  CHAR tempFileA[MAX_PATH];
3240 
3241  /* avoid using fodInfos->ofnInfos->lpstrFile since it can be NULL */
3242  WideCharToMultiByte(CP_ACP, 0, lpstrPathAndFile, -1,
3243  tempFileA, sizeof(tempFileA), NULL, NULL);
3244 
3245  /* set filename offset */
3246  lpszTemp = PathFindFileNameA(tempFileA);
3247  fodInfos->ofnInfos->nFileOffset = (lpszTemp - tempFileA);
3248 
3249  /* set extension offset */
3250  lpszTemp = PathFindExtensionA(tempFileA);
3251  fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - tempFileA) + 1 : 0;
3252  }
3253 
3254  /* copy currently selected filter to lpstrCustomFilter */
3255  if (fodInfos->ofnInfos->lpstrCustomFilter)
3256  {
3258  int len = WideCharToMultiByte(CP_ACP, 0, fodInfos->ShellInfos.lpstrCurrentFilter, -1,
3259  NULL, 0, NULL, NULL);
3261  {
3263  s += strlen(ofn->lpstrCustomFilter)+1;
3264  WideCharToMultiByte(CP_ACP, 0, fodInfos->ShellInfos.lpstrCurrentFilter, -1,
3265  s, len, NULL, NULL);
3266  }
3267  }
3268 
3269 
3270  if ( !FILEDLG95_SendFileOK(hwnd, fodInfos) )
3271  goto ret;
3272 
3273  FILEDLG95_MRU_save_filename(lpstrPathAndFile);
3274 #ifdef __REACTOS__
3275  FILEDLG95_MRU_save_ext(lpstrPathAndFile);
3276 #endif
3277 
3278  TRACE("close\n");
3280  ret = EndDialog(hwnd, TRUE);
3281  }
3282  else
3283  {
3284  WORD size;
3285 
3286  size = lstrlenW(lpstrPathAndFile) + 1;
3287  if (fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT)
3288  size += 1;
3289  /* return needed size in first two bytes of lpstrFile */
3290  if(fodInfos->ofnInfos->lpstrFile)
3291  *(WORD *)fodInfos->ofnInfos->lpstrFile = size;
3293  ret = EndDialog(hwnd, FALSE);
3295  }
3296  }
3297  break;
3298  }
3299 
3300 ret:
3301  if(lpsf) IShellFolder_Release(lpsf);
3302  return ret;
3303 }
#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
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WideCharToMultiByte
Definition: compat.h:101
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
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
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
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:415
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:3584
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define pch(ap)
Definition: match.c:418
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define lstrcpynW
Definition: compat.h:405
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:140
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:389
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1900
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
struct FileOpenDlgInfos::@334 Shell
#define CBEM_GETEDITCONTROL
Definition: commctrl.h:3829
void COMDLG32_GetCanonicalPath(PCIDLIST_ABSOLUTE pidlAbsCurrent, LPWSTR lpstrFile, LPWSTR lpstrPathAndFile)
Definition: filedlg.c:654
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:442
#define WM_SETTEXT
Definition: winuser.h:1599
#define CB_ERR
Definition: winuser.h:2410
DWORD nFilterIndex
Definition: commdlg.h:366
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static BOOL BrowseSelectedFolder(HWND hwnd)
Definition: filedlg.c:4474
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
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:2717
#define IDS_OVERWRITEFILE
#define MAX_PATH
Definition: compat.h:26
#define EM_SETSEL
Definition: winuser.h:2000
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:2152
static void FILEDLG95_MRU_save_filename(LPCWSTR filename)
Definition: filedlg.c:2374
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
#define CB_SETCURSEL
Definition: winuser.h:1943
struct FileOpenDlgInfos::@335 ShellInfos
#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:414
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:988
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:2189
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:1513
static int FILEDLG95_FILENAME_GetFileNames(HWND hwnd, LPWSTR *lpstrFileList, UINT *sizeUsed)
Definition: filedlg.c:4240
struct tagOFNA * LPOPENFILENAMEA
struct FileOpenDlgInfos::@336 DlgInfos
#define SUCCEEDED(hr)
Definition: intsafe.h:57
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static void FILEDLG95_Clean(HWND hwnd)
Definition: filedlg.c:2028
#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 2705 of file filedlg.c.

2706 {
2707  WCHAR strMsgTitle[MAX_PATH];
2708  WCHAR strMsgText [MAX_PATH];
2709  if (idCaption)
2710  LoadStringW(COMDLG32_hInstance, idCaption, strMsgTitle, ARRAY_SIZE(strMsgTitle));
2711  else
2712  strMsgTitle[0] = '\0';
2713  LoadStringW(COMDLG32_hInstance, idText, strMsgText, ARRAY_SIZE(strMsgText));
2714  MessageBoxW(hwnd,strMsgText, strMsgTitle, MB_OK | MB_ICONHAND);
2715 }
#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()