ReactOS 0.4.17-dev-966-gf06eace
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 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 SFolder * LPSFOLDER
 
typedef struct tagLookInInfo LookInInfos
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (commdlg)
 
FileOpenDlgInfos * get_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 (HWND hwnd, 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)
 
IShellFolder * GetShellFolderFromPidl (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 WCHAR * heap_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}
 

Macro Definition Documentation

◆ CBGetItemDataPtr

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

Definition at line 212 of file filedlg.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 54 of file filedlg.c.

◆ ITEM_NOTFOUND

#define ITEM_NOTFOUND   -1

Definition at line 195 of file filedlg.c.

◆ LISTEND

#define LISTEND   -1

Definition at line 190 of file filedlg.c.

◆ SEARCH_EXP

#define SEARCH_EXP   2

Definition at line 194 of file filedlg.c.

◆ SEARCH_PIDL

#define SEARCH_PIDL   1

Definition at line 193 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE0

#define TBPLACES_CMDID_PLACE0   0xa064

Definition at line 200 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE1

#define TBPLACES_CMDID_PLACE1   0xa065

Definition at line 201 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE2

#define TBPLACES_CMDID_PLACE2   0xa066

Definition at line 202 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE3

#define TBPLACES_CMDID_PLACE3   0xa067

Definition at line 203 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE4

#define TBPLACES_CMDID_PLACE4   0xa068

Definition at line 204 of file filedlg.c.

◆ UNIMPLEMENTED_FLAGS

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

Definition at line 86 of file filedlg.c.

◆ WM_GETISHELLBROWSER

#define WM_GETISHELLBROWSER   WM_USER+7

Definition at line 198 of file filedlg.c.

◆ XTEXTOFFSET

#define XTEXTOFFSET   3

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

829{
830 HWND hwndChild, hwndStc32;
831 RECT rectParent, rectChild, rectStc32;
832 INT help_fixup = 0;
833 int chgx, chgy;
834
835 /* Take into account if open as read only checkbox and help button
836 * are hidden
837 */
838 if (hide_help)
839 {
840 RECT rectHelp, rectCancel;
841 GetWindowRect(GetDlgItem(hwndParentDlg, pshHelp), &rectHelp);
842 GetWindowRect(GetDlgItem(hwndParentDlg, IDCANCEL), &rectCancel);
843 /* subtract the height of the help button plus the space between
844 * the help button and the cancel button to the height of the dialog
845 */
846 help_fixup = rectHelp.bottom - rectCancel.bottom;
847 }
848
849 /*
850 There are two possibilities to add components to the default file dialog box.
851
852 By default, all the new components are added below the standard dialog box (the else case).
853
854 However, if there is a static text component with the stc32 id, a special case happens.
855 The x and y coordinates of stc32 indicate the top left corner where to place the standard file dialog box
856 in the window and the cx and cy indicate how to size the window.
857 Moreover, if the new component's coordinates are on the left of the stc32 , it is placed on the left
858 of the standard file dialog box. If they are above the stc32 component, it is placed above and so on....
859
860 */
861
862 GetClientRect(hwndParentDlg, &rectParent);
863
864 /* when arranging controls we have to use fixed parent size */
865 rectParent.bottom -= help_fixup;
866
867 hwndStc32 = GetDlgItem(hwndChildDlg, stc32);
868 if (hwndStc32)
869 {
870 GetWindowRect(hwndStc32, &rectStc32);
871 MapWindowPoints(0, hwndChildDlg, (LPPOINT)&rectStc32, 2);
872
873 /* set the size of the stc32 control according to the size of
874 * client area of the parent dialog
875 */
876 SetWindowPos(hwndStc32, 0,
877 0, 0,
878 rectParent.right, rectParent.bottom,
880 }
881 else
882 SetRectEmpty(&rectStc32);
883
884 /* this part moves controls of the child dialog */
885 hwndChild = GetWindow(hwndChildDlg, GW_CHILD);
886 while (hwndChild)
887 {
888 if (hwndChild != hwndStc32)
889 {
890 GetWindowRect(hwndChild, &rectChild);
891 MapWindowPoints(0, hwndChildDlg, (LPPOINT)&rectChild, 2);
892
893 /* move only if stc32 exist */
894 if (hwndStc32 && rectChild.left > rectStc32.right)
895 {
896 /* move to the right of visible controls of the parent dialog */
897 rectChild.left += rectParent.right;
898 rectChild.left -= rectStc32.right;
899 }
900 /* move even if stc32 doesn't exist */
901 if (rectChild.top >= rectStc32.bottom)
902 {
903 /* move below visible controls of the parent dialog */
904 rectChild.top += rectParent.bottom;
905 rectChild.top -= rectStc32.bottom - rectStc32.top;
906 }
907
908 SetWindowPos(hwndChild, 0, rectChild.left, rectChild.top,
909 0, 0, SWP_NOSIZE | SWP_NOZORDER);
910 }
911 hwndChild = GetWindow(hwndChild, GW_HWNDNEXT);
912 }
913
914 /* this part moves controls of the parent dialog */
915 hwndChild = GetWindow(hwndParentDlg, GW_CHILD);
916 while (hwndChild)
917 {
918 if (hwndChild != hwndChildDlg)
919 {
920 GetWindowRect(hwndChild, &rectChild);
921 MapWindowPoints(0, hwndParentDlg, (LPPOINT)&rectChild, 2);
922
923 /* left,top of stc32 marks the position of controls
924 * from the parent dialog
925 */
926 rectChild.left += rectStc32.left;
927 rectChild.top += rectStc32.top;
928
929 SetWindowPos(hwndChild, 0, rectChild.left, rectChild.top,
930 0, 0, SWP_NOSIZE | SWP_NOZORDER);
931 }
932 hwndChild = GetWindow(hwndChild, GW_HWNDNEXT);
933 }
934
935 /* calculate the size of the resulting dialog */
936
937 /* here we have to use original parent size */
938 GetClientRect(hwndParentDlg, &rectParent);
939 GetClientRect(hwndChildDlg, &rectChild);
940 TRACE( "parent %s child %s stc32 %s\n", wine_dbgstr_rect( &rectParent),
941 wine_dbgstr_rect( &rectChild), wine_dbgstr_rect( &rectStc32));
942
943 if (hwndStc32)
944 {
945 /* width */
946 if (rectParent.right > rectStc32.right - rectStc32.left)
947 chgx = rectChild.right - ( rectStc32.right - rectStc32.left);
948 else
949 chgx = rectChild.right - rectParent.right;
950 /* height */
951 if (rectParent.bottom > rectStc32.bottom - rectStc32.top)
952 chgy = rectChild.bottom - ( rectStc32.bottom - rectStc32.top) - help_fixup;
953 else
954 /* Unconditionally set new dialog
955 * height to that of the child
956 */
957 chgy = rectChild.bottom - rectParent.bottom;
958 }
959 else
960 {
961 chgx = 0;
962 chgy = rectChild.bottom - help_fixup;
963 }
964 /* set the size of the parent dialog */
965 GetWindowRect(hwndParentDlg, &rectParent);
966 SetWindowPos(hwndParentDlg, 0,
967 0, 0,
968 rectParent.right - rectParent.left + chgx,
969 rectParent.bottom - rectParent.top + chgy,
971}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define pshHelp
Definition: dlgs.h:132
#define stc32
Definition: dlgs.h:196
#define IDCANCEL
Definition: winuser.h:842
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 SWP_NOMOVE
Definition: winuser.h:1255
#define SWP_NOSIZE
Definition: winuser.h:1256
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define GW_HWNDNEXT
Definition: winuser.h:772
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define GW_CHILD
Definition: winuser.h:774
#define SWP_NOZORDER
Definition: winuser.h:1258
#define TRACE(s)
Definition: solgame.cpp:4
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
int32_t INT
Definition: typedefs.h:58

Referenced by FILEDLG95_ResizeControls().

◆ BrowseSelectedFolder()

static BOOL BrowseSelectedFolder ( HWND  hwnd)
static

Definition at line 4669 of file filedlg.c.

4670{
4672 BOOL bBrowseSelFolder = FALSE;
4673
4674 TRACE("\n");
4675
4676 if (GetNumSelected(fodInfos->Shell.FOIDataObject) == 1)
4677 {
4678 LPITEMIDLIST pidlSelection;
4679
4680 /* get the file selected */
4681 pidlSelection = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, 1);
4682 if (IsPidlFolder (fodInfos->Shell.FOIShellFolder, pidlSelection))
4683 {
4684 if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser,
4685 pidlSelection, SBSP_RELATIVE ) ) )
4686 {
4687 WCHAR buf[64];
4690 }
4691 bBrowseSelFolder = TRUE;
4692 if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
4694 }
4695 ILFree( pidlSelection );
4696 }
4697
4698 return bBrowseSelFolder;
4699}
#define ARRAY_SIZE(A)
Definition: main.h:20
HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define OFN_EXPLORER
Definition: commdlg.h:104
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static UINT GetNumSelected(IDataObject *doSelected)
Definition: filedlg.c:4508
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:218
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4644
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:1074
LPITEMIDLIST GetPidlFromDataObject(IDataObject *doSelected, UINT nPidlIndex)
Definition: filedlg.c:4477
#define IDS_PATHNOTEXISTING
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define FAILED(hr)
Definition: intsafe.h:51
short WCHAR
Definition: pedump.c:58
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1051
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONEXCLAMATION
Definition: winuser.h:796
#define MB_OK
Definition: winuser.h:801
#define LoadStringW
Definition: utils.h:64
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPOPENFILENAMEW ofnInfos
struct FileOpenDlgInfos::@431 Shell
DWORD Flags
Definition: commdlg.h:373
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by FILEDLG95_OnOpen().

◆ COMCTL32_ReleaseStgMedium()

static void COMCTL32_ReleaseStgMedium ( STGMEDIUM  medium)
static

Definition at line 4457 of file filedlg.c.

4458{
4459 if(medium.pUnkForRelease)
4460 {
4461 IUnknown_Release(medium.pUnkForRelease);
4462 }
4463 else
4464 {
4465 GlobalUnlock(medium.hGlobal);
4466 GlobalFree(medium.hGlobal);
4467 }
4468}
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 740 of file filedlg.c.

742{
743 WCHAR lpstrTemp[MAX_PATH];
744
745 /* Get the current directory name */
746 if (!COMDLG32_GetDisplayNameOf(pidlAbsCurrent, lpstrPathAndFile))
747 {
748 /* last fallback */
749 GetCurrentDirectoryW(MAX_PATH, lpstrPathAndFile);
750 }
751 PathAddBackslashW(lpstrPathAndFile);
752
753 TRACE("current directory=%s, file=%s\n", debugstr_w(lpstrPathAndFile), debugstr_w(lpstrFile));
754
755 /* if the user specified a fully qualified path use it */
756 if(PathIsRelativeW(lpstrFile))
757 {
758 lstrcatW(lpstrPathAndFile, lpstrFile);
759 }
760 else
761 {
762 /* does the path have a drive letter? */
763 if (PathGetDriveNumberW(lpstrFile) == -1)
764 lstrcpyW(lpstrPathAndFile+2, lpstrFile);
765 else
766 lstrcpyW(lpstrPathAndFile, lpstrFile);
767 }
768
769 /* resolve "." and ".." */
770 PathCanonicalizeW(lpstrTemp, lpstrPathAndFile );
771 lstrcpyW(lpstrPathAndFile, lpstrTemp);
772 TRACE("canon=%s\n", debugstr_w(lpstrPathAndFile));
773}
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:719
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:749
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:1786
BOOL WINAPI PathIsRelativeW(const WCHAR *path)
Definition: path.c:1006
#define debugstr_w
Definition: kernel32.h:32
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define PathCanonicalizeW
Definition: pathcch.h:314
#define PathAddBackslashW
Definition: pathcch.h:302

Referenced by FILEDLG95_OnOpen().

◆ COMDLG32_GetDisplayNameOf()

static BOOL COMDLG32_GetDisplayNameOf ( LPCITEMIDLIST  pidl,
LPWSTR  pwszPath 
)
static

Definition at line 719 of file filedlg.c.

719 {
720 LPSHELLFOLDER psfDesktop;
721 STRRET strret;
722
723 if (FAILED(SHGetDesktopFolder(&psfDesktop)))
724 return FALSE;
725
726 if (FAILED(IShellFolder_GetDisplayNameOf(psfDesktop, pidl, SHGDN_FORPARSING, &strret))) {
727 IShellFolder_Release(psfDesktop);
728 return FALSE;
729 }
730
731 IShellFolder_Release(psfDesktop);
732 return SUCCEEDED(StrRetToBufW(&strret, pidl, pwszPath, MAX_PATH));
733}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:248
#define IShellFolder_GetDisplayNameOf
Definition: utils.cpp:13
#define SUCCEEDED(hr)
Definition: intsafe.h:50

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 780 of file filedlg.c.

781{
782 UINT nStrCharCount = 0; /* index in src buffer */
783 UINT nFileIndex = 0; /* index in dest buffer */
784 UINT nFileCount = 0; /* number of files */
785
786 /* we might get single filename without any '"',
787 * so we need nStrLen + terminating \0 + end-of-list \0 */
788 *lpstrFileList = heap_alloc((nStrLen + 2) * sizeof(WCHAR));
789 *sizeUsed = 0;
790
791 /* build delimited file list from filenames */
792 while ( nStrCharCount <= nStrLen )
793 {
794 if ( lpstrEdit[nStrCharCount]=='"' )
795 {
796 nStrCharCount++;
797 while ((nStrCharCount <= nStrLen) && (lpstrEdit[nStrCharCount]!='"'))
798 {
799 (*lpstrFileList)[nFileIndex++] = lpstrEdit[nStrCharCount];
800 nStrCharCount++;
801 }
802 (*lpstrFileList)[nFileIndex++] = 0;
803 nFileCount++;
804 }
805 nStrCharCount++;
806 }
807
808 /* single, unquoted string */
809 if ((nStrLen > 0) && (nFileIndex == 0) )
810 {
811 lstrcpyW(*lpstrFileList, lpstrEdit);
812 nFileIndex = lstrlenW(lpstrEdit) + 1;
813 nFileCount = 1;
814 }
815
816 /* trailing \0 */
817 (*lpstrFileList)[nFileIndex++] = '\0';
818
819 *sizeUsed = nFileIndex;
820 return nFileCount;
821}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define lstrlenW
Definition: compat.h:750
unsigned int UINT
Definition: sysinfo.c:13

Referenced by FILEDLG95_FILENAME_GetFileNames().

◆ COMDLG32_StrRetToStrNW()

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

Definition at line 4395 of file filedlg.c.

4396{
4397 switch (src->uType)
4398 {
4399 case STRRET_WSTR:
4400 lstrcpynW(dest, src->pOleStr, len);
4401 CoTaskMemFree(src->pOleStr);
4402 break;
4403
4404 case STRRET_CSTR:
4405 if (!MultiByteToWideChar( CP_ACP, 0, src->cStr, -1, dest, len ) && len)
4406 dest[len-1] = 0;
4407 break;
4408
4409 case STRRET_OFFSET:
4410 if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->uOffset, -1, dest, len ) && len)
4411 dest[len-1] = 0;
4412 break;
4413
4414 default:
4415 FIXME("unknown type %x!\n", src->uType);
4416 if (len) *dest = '\0';
4417 return E_FAIL;
4418 }
4419 return S_OK;
4420}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_FAIL
Definition: ddrawi.h:102
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrcpynW
Definition: compat.h:738
GLenum src
Definition: glext.h:6340
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:52
static char * dest
Definition: rtl.c:149
@ STRRET_CSTR
Definition: shtypes.idl:87
@ STRRET_OFFSET
Definition: shtypes.idl:86
@ STRRET_WSTR
Definition: shtypes.idl:85
SHITEMID mkid
Definition: shtypes.idl:34
const char * LPCSTR
Definition: typedefs.h:52

Referenced by GetName().

◆ CreateTemplateDialog()

static HWND CreateTemplateDialog ( FileOpenDlgInfos *  fodInfos,
HWND  hwnd 
)
static

Definition at line 982 of file filedlg.c.

983{
984 LPCVOID template;
985 HRSRC hRes;
986 HANDLE hDlgTmpl = 0;
987 HWND hChildDlg = 0;
988
989 TRACE("%p, %p\n", fodInfos, hwnd);
990
991 /*
992 * If OFN_ENABLETEMPLATEHANDLE is specified, the OPENFILENAME
993 * structure's hInstance parameter is not a HINSTANCE, but
994 * instead a pointer to a template resource to use.
995 */
997 {
999 if (fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE)
1000 {
1002 if( !(template = LockResource( fodInfos->ofnInfos->hInstance)))
1003 {
1005 return NULL;
1006 }
1007 }
1008 else
1009 {
1010 hinst = fodInfos->ofnInfos->hInstance;
1011 if(fodInfos->unicode)
1012 {
1013 LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
1015 }
1016 else
1017 {
1020 }
1021 if (!hRes)
1022 {
1024 return NULL;
1025 }
1026 if (!(hDlgTmpl = LoadResource( hinst, hRes )) ||
1027 !(template = LockResource( hDlgTmpl )))
1028 {
1030 return NULL;
1031 }
1032 }
1033 if (fodInfos->unicode)
1034 hChildDlg = CreateDialogIndirectParamW(hinst, template, hwnd,
1036 (LPARAM)fodInfos->ofnInfos);
1037 else
1038 hChildDlg = CreateDialogIndirectParamA(hinst, template, hwnd,
1040 (LPARAM)fodInfos->ofnInfos);
1041 return hChildDlg;
1042 }
1043 else if (is_dialog_hooked(fodInfos))
1044 {
1045 RECT rectHwnd;
1046 struct {
1047 DLGTEMPLATE tmplate;
1048 WORD menu,class,title;
1049 } temp;
1050 GetClientRect(hwnd,&rectHwnd);
1052 temp.tmplate.dwExtendedStyle = 0;
1053 temp.tmplate.cdit = 0;
1054 temp.tmplate.x = 0;
1055 temp.tmplate.y = 0;
1056 temp.tmplate.cx = 0;
1057 temp.tmplate.cy = 0;
1058 temp.menu = temp.class = temp.title = 0;
1059
1061 hwnd, (DLGPROC)fodInfos->ofnInfos->lpfnHook, (LPARAM)fodInfos->ofnInfos);
1062
1063 return hChildDlg;
1064 }
1065 return NULL;
1066}
#define CDERR_LOADRESFAILURE
Definition: cderr.h:12
#define CDERR_FINDRESFAILURE
Definition: cderr.h:11
void COMDLG32_SetCommDlgExtendedError(DWORD err)
Definition: cdlg32.c:124
#define OFN_ENABLETEMPLATEHANDLE
Definition: commdlg.h:103
struct tagOFNA * LPOPENFILENAMEA
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
#define DLGPROC
Definition: maze.c:62
#define NULL
Definition: types.h:112
static INT_PTR CALLBACK FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:973
static BOOL is_dialog_hooked(const FileOpenDlgInfos *info)
Definition: filedlg.c:223
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
unsigned short WORD
Definition: ntddk_ex.h:93
LONG_PTR LPARAM
Definition: minwindef.h:175
CONST void * LPCVOID
Definition: minwindef.h:164
static HINSTANCE hinst
Definition: edit.c:551
#define menu
Definition: input.c:3282
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
#define RT_DIALOG
Definition: pedump.c:367
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
static char title[]
Definition: ps.c:92
#define DS_3DLOOK
Definition: winuser.h:367
HWND WINAPI CreateDialogIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
HWND WINAPI CreateDialogIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define DS_CONTROL
Definition: winuser.h:372
static calc_node_t temp
Definition: rpn_ieee.c:38
OPENFILENAME ofn
Definition: sndrec32.cpp:56
LPCSTR lpTemplateName
Definition: commdlg.h:348
HINSTANCE hInstance
Definition: commdlg.h:362
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
uint16_t * LPWSTR
Definition: typedefs.h:56
char * LPSTR
Definition: typedefs.h:51

Referenced by FileOpenDlgProc95().

◆ filedialog_is_readonly_hidden()

static BOOL filedialog_is_readonly_hidden ( const FileOpenDlgInfos *  info)
static

Definition at line 228 of file filedlg.c.

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

Referenced by FILEDLG95_InitControls(), and FILEDLG95_ResizeControls().

◆ FILEDLG95_Clean()

void FILEDLG95_Clean ( HWND  hwnd)
static

Definition at line 2169 of file filedlg.c.

2170{
2174}
static void FILEDLG95_FILETYPE_Clean(HWND hwnd)
Definition: filedlg.c:3793
static void FILEDLG95_LOOKIN_Clean(HWND hwnd)
Definition: filedlg.c:4268
static void FILEDLG95_SHELL_Clean(HWND hwnd)
Definition: filedlg.c:3582

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

◆ FILEDLG95_FILENAME_FillFromSelection()

void FILEDLG95_FILENAME_FillFromSelection ( HWND  hwnd)

Definition at line 4319 of file filedlg.c.

4320{
4322 LPITEMIDLIST pidl;
4323 LPWSTR lpstrAllFiles, lpstrTmp;
4324 UINT nFiles = 0, nFileToOpen, nFileSelected, nAllFilesLength = 0, nThisFileLength, nAllFilesMaxLength;
4325 STGMEDIUM medium;
4326 LPIDA cida;
4327 FORMATETC formatetc = get_def_format();
4328
4329 TRACE("\n");
4330
4331 if (FAILED(IDataObject_GetData(fodInfos->Shell.FOIDataObject, &formatetc, &medium)))
4332 return;
4333
4334 cida = GlobalLock(medium.hGlobal);
4335 nFileSelected = cida->cidl;
4336
4337 /* Allocate a buffer */
4338 nAllFilesMaxLength = MAX_PATH + 3;
4339 lpstrAllFiles = heap_alloc_zero(nAllFilesMaxLength * sizeof(WCHAR));
4340 if (!lpstrAllFiles)
4341 goto ret;
4342
4343 /* Loop through the selection, handle only files (not folders) */
4344 for (nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++)
4345 {
4346 pidl = (LPITEMIDLIST)((LPBYTE)cida + cida->aoffset[nFileToOpen + 1]);
4347 if (pidl)
4348 {
4349 if (!IsPidlFolder(fodInfos->Shell.FOIShellFolder, pidl))
4350 {
4351 if (nAllFilesLength + MAX_PATH + 3 > nAllFilesMaxLength)
4352 {
4353 nAllFilesMaxLength *= 2;
4354 lpstrTmp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpstrAllFiles, nAllFilesMaxLength * sizeof(WCHAR));
4355 if (!lpstrTmp)
4356 goto ret;
4357 lpstrAllFiles = lpstrTmp;
4358 }
4359 nFiles += 1;
4360 lpstrAllFiles[nAllFilesLength++] = '"';
4361 GetName(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, lpstrAllFiles + nAllFilesLength);
4362 nThisFileLength = lstrlenW(lpstrAllFiles + nAllFilesLength);
4363 nAllFilesLength += nThisFileLength;
4364 lpstrAllFiles[nAllFilesLength++] = '"';
4365 lpstrAllFiles[nAllFilesLength++] = ' ';
4366 }
4367 }
4368 }
4369
4370 if (nFiles != 0)
4371 {
4372 /* If there's only one file, use the name as-is without quotes */
4373 lpstrTmp = lpstrAllFiles;
4374 if (nFiles == 1)
4375 {
4376 lpstrTmp += 1;
4377 lpstrTmp[nThisFileLength] = 0;
4378 }
4379 SetWindowTextW(fodInfos->DlgInfos.hwndFileName, lpstrTmp);
4380 /* Select the file name like Windows does */
4381 if (filename_is_edit(fodInfos))
4382 SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
4383 }
4384
4385ret:
4386 heap_free(lpstrAllFiles);
4388}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl, DWORD dwFlags, LPWSTR lpstrFileName)
Definition: filedlg.c:4543
static FORMATETC get_def_format(void)
Definition: filedlg.c:4300
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1650
static void COMCTL32_ReleaseStgMedium(STGMEDIUM medium)
Definition: filedlg.c:4457
#define GetProcessHeap()
Definition: compat.h:736
#define HeapReAlloc
Definition: compat.h:734
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
return ret
Definition: mutex.c:147
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define EM_SETSEL
Definition: winuser.h:2047
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: shlobj.h:582
UINT aoffset[1]
Definition: shlobj.h:583
UINT cidl
Definition: shlobj.h:582
struct FileOpenDlgInfos::@433 DlgInfos
unsigned char * LPBYTE
Definition: typedefs.h:53

Referenced by IShellBrowserImpl_OnSelChange().

◆ FILEDLG95_FILENAME_GetFileNames()

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

Definition at line 4427 of file filedlg.c.

4428{
4430 UINT nFileCount = 0; /* number of files */
4431 UINT nStrLen = 0; /* length of string in edit control */
4432 LPWSTR lpstrEdit; /* buffer for string from edit control */
4433
4434 TRACE("\n");
4435
4436 /* get the filenames from the filename control */
4437 nStrLen = GetWindowTextLengthW( fodInfos->DlgInfos.hwndFileName );
4438 lpstrEdit = heap_alloc( (nStrLen+1)*sizeof(WCHAR) );
4439 GetWindowTextW( fodInfos->DlgInfos.hwndFileName, lpstrEdit, nStrLen+1);
4440
4441 TRACE("nStrLen=%u str=%s\n", nStrLen, debugstr_w(lpstrEdit));
4442
4443 nFileCount = COMDLG32_SplitFileNames(lpstrEdit, nStrLen, lpstrFileList, sizeUsed);
4444 heap_free(lpstrEdit);
4445 return nFileCount;
4446}
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed)
Definition: filedlg.c:780
int WINAPI GetWindowTextLengthW(_In_ HWND)
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_FILETYPE_Clean()

static void FILEDLG95_FILETYPE_Clean ( HWND  hwnd)
static

Definition at line 3793 of file filedlg.c.

3794{
3796 int iPos;
3797 int iCount;
3798
3799 iCount = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCOUNT, 0, 0);
3800
3801 TRACE("\n");
3802
3803 /* Delete each string of the combo and their associated data */
3804 if(iCount != CB_ERR)
3805 {
3806 for(iPos = iCount-1;iPos>=0;iPos--)
3807 {
3808 heap_free((void *)CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iPos));
3809 SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_DELETESTRING, iPos, 0);
3810 }
3811 }
3812 /* Current filter */
3813 heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3814}
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
#define CB_ERR
Definition: winuser.h:2471
#define CB_GETCOUNT
Definition: winuser.h:1971
#define CB_DELETESTRING
Definition: winuser.h:1966
struct FileOpenDlgInfos::@432 ShellInfos

Referenced by FILEDLG95_Clean().

◆ FILEDLG95_FILETYPE_Init()

static HRESULT FILEDLG95_FILETYPE_Init ( HWND  hwnd)
static

Definition at line 3608 of file filedlg.c.

3609{
3611 int nFilters = 0; /* number of filters */
3612 int nFilterIndexCB;
3613
3614 TRACE("%p\n", hwnd);
3615
3616 if(fodInfos->customfilter)
3617 {
3618 /* customfilter has one entry... title\0ext\0
3619 * Set first entry of combo box item with customfilter
3620 */
3621 LPWSTR lpstrExt;
3622 LPCWSTR lpstrPos = fodInfos->customfilter;
3623
3624 /* Get the title */
3625 lpstrPos += lstrlenW(fodInfos->customfilter) + 1;
3626
3627 /* Copy the extensions */
3628 if (! *lpstrPos) return E_FAIL; /* malformed filter */
3629 if (!(lpstrExt = heap_alloc((lstrlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
3630 lstrcpyW(lpstrExt,lpstrPos);
3631
3632 /* Add the item at the end of the combo */
3633 SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_ADDSTRING, 0, (LPARAM)fodInfos->customfilter);
3634 SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETITEMDATA, nFilters, (LPARAM)lpstrExt);
3635
3636 nFilters++;
3637 }
3638 if(fodInfos->filter)
3639 {
3640 LPCWSTR lpstrPos = fodInfos->filter;
3641
3642 for(;;)
3643 {
3644 /* filter is a list... title\0ext\0......\0\0
3645 * Set the combo item text to the title and the item data
3646 * to the ext
3647 */
3648 LPCWSTR lpstrDisplay;
3649 LPWSTR lpstrExt;
3650
3651 /* Get the title */
3652 if(! *lpstrPos) break; /* end */
3653 lpstrDisplay = lpstrPos;
3654 lpstrPos += lstrlenW(lpstrPos) + 1;
3655
3656 SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_ADDSTRING, 0, (LPARAM)lpstrDisplay);
3657
3658 nFilters++;
3659
3660 /* Copy the extensions */
3661 if (!(lpstrExt = heap_alloc((lstrlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
3662 lstrcpyW(lpstrExt,lpstrPos);
3663 lpstrPos += lstrlenW(lpstrPos) + 1;
3664
3665 /* Add the item at the end of the combo */
3666 SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETITEMDATA, nFilters - 1, (LPARAM)lpstrExt);
3667
3668 /* malformed filters are added anyway... */
3669 if (!*lpstrExt) break;
3670 }
3671 }
3672
3673 /*
3674 * Set the current filter to the one specified
3675 * in the initialisation structure
3676 */
3677 if (fodInfos->filter || fodInfos->customfilter)
3678 {
3679 LPWSTR lpstrFilter;
3680
3681 /* Check to make sure our index isn't out of bounds. */
3682 if ( fodInfos->ofnInfos->nFilterIndex >
3683 nFilters - (fodInfos->customfilter == NULL ? 0 : 1) )
3684 fodInfos->ofnInfos->nFilterIndex = (fodInfos->customfilter == NULL ? 1 : 0);
3685
3686 /* set default filter index */
3687 if(fodInfos->ofnInfos->nFilterIndex == 0 && fodInfos->customfilter == NULL)
3688 fodInfos->ofnInfos->nFilterIndex = 1;
3689
3690 /* calculate index of Combo Box item */
3691 nFilterIndexCB = fodInfos->ofnInfos->nFilterIndex;
3692 if (fodInfos->customfilter == NULL)
3693 nFilterIndexCB--;
3694
3695 /* Set the current index selection. */
3696 SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETCURSEL, nFilterIndexCB, 0);
3697
3698 /* Get the corresponding text string from the combo box. */
3699 lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3700 nFilterIndexCB);
3701
3702 if ((INT_PTR)lpstrFilter == CB_ERR) /* control is empty */
3703 lpstrFilter = NULL;
3704
3705 if(lpstrFilter)
3706 {
3707 DWORD len;
3708 CharLowerW(lpstrFilter); /* lowercase */
3709 len = lstrlenW(lpstrFilter)+1;
3710 fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc( len * sizeof(WCHAR) );
3711 lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
3712 }
3713 } else
3714 fodInfos->ofnInfos->nFilterIndex = 0;
3715 return S_OK;
3716}
LPWSTR WINAPI CharLowerW(WCHAR *str)
Definition: string.c:1136
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CB_SETITEMDATA
Definition: winuser.h:1995
#define CB_SETCURSEL
Definition: winuser.h:1990
#define CB_ADDSTRING
Definition: winuser.h:1965
DWORD nFilterIndex
Definition: commdlg.h:366
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * LPCWSTR
Definition: typedefs.h:57

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_FILETYPE_OnCommand()

static BOOL FILEDLG95_FILETYPE_OnCommand ( HWND  hwnd,
WORD  wNotifyCode 
)
static

Definition at line 3724 of file filedlg.c.

3725{
3727
3728 switch(wNotifyCode)
3729 {
3730 case CBN_SELENDOK:
3731 {
3732 LPWSTR lpstrFilter;
3733
3734 /* Get the current item of the filetype combo box */
3735 int iItem = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCURSEL, 0, 0);
3736
3737 /* set the current filter index */
3738 fodInfos->ofnInfos->nFilterIndex = iItem +
3739 (fodInfos->customfilter == NULL ? 1 : 0);
3740
3741 /* Set the current filter with the current selection */
3742 heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3743
3744 lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3745 iItem);
3746 if((INT_PTR)lpstrFilter != CB_ERR)
3747 {
3748 DWORD len;
3749 CharLowerW(lpstrFilter); /* lowercase */
3750 len = lstrlenW(lpstrFilter)+1;
3751 fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc( len * sizeof(WCHAR) );
3752 lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
3753 if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3755 }
3756
3757 /* Refresh the actual view to display the included items*/
3758 if (fodInfos->Shell.FOIShellView)
3759 IShellView_Refresh(fodInfos->Shell.FOIShellView);
3760 }
3761 }
3762 return FALSE;
3763}
#define CDN_TYPECHANGE
Definition: commdlg.h:39
#define CBN_SELENDOK
Definition: winuser.h:2010
#define CB_GETCURSEL
Definition: winuser.h:1972

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_FILETYPE_SearchExt()

static int FILEDLG95_FILETYPE_SearchExt ( HWND  hwnd,
LPCWSTR  lpstrExt 
)
static

Definition at line 3769 of file filedlg.c.

3770{
3771 int i, iCount;
3772
3773 iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
3774
3775 TRACE("%s\n", debugstr_w(lpstrExt));
3776
3777 if(iCount != CB_ERR)
3778 {
3779 for(i=0;i<iCount;i++)
3780 {
3781 if(!lstrcmpiW(lpstrExt,(LPWSTR)CBGetItemDataPtr(hwnd,i)))
3782 return i;
3783 }
3784 }
3785 return -1;
3786}
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
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

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_FillControls()

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

Definition at line 2132 of file filedlg.c.

2133{
2134 LPITEMIDLIST pidlItemId = NULL;
2135
2137
2138 TRACE("dir=%s file=%s\n",
2139 debugstr_w(fodInfos->initdir), debugstr_w(fodInfos->filename));
2140
2141 /* Get the initial directory pidl */
2142
2143 if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->initdir)))
2144 {
2146
2148 pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder, path);
2149 }
2150
2151 /* Initialise shell objects */
2153
2154 /* Initialize the Look In combo box */
2155 FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB);
2156
2157 /* Browse to the initial directory */
2158 IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId, SBSP_ABSOLUTE);
2159
2160 ILFree(pidlItemId);
2161
2162 return TRUE;
2163}
LPARAM lParam
Definition: combotst.c:139
static LRESULT FILEDLG95_SHELL_Init(HWND hwnd)
Definition: filedlg.c:3495
static void FILEDLG95_LOOKIN_Init(HWND hwndCombo)
Definition: filedlg.c:3837
static LPITEMIDLIST GetPidlFromName(IShellFolder *psf, LPWSTR lpcstrFileName)
Definition: filedlg.c:4618

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_Handle_GetFilePath()

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

Definition at line 1103 of file filedlg.c.

1104{
1105 UINT len, total;
1106 WCHAR *p, *buffer;
1108
1109 TRACE("CDM_GETFILEPATH:\n");
1110
1111 if ( ! (fodInfos->ofnInfos->Flags & OFN_EXPLORER ) )
1112 return -1;
1113
1114 /* get path and filenames */
1115 len = SendMessageW( fodInfos->DlgInfos.hwndFileName, WM_GETTEXTLENGTH, 0, 0 );
1116 buffer = heap_alloc( (len + 2 + MAX_PATH) * sizeof(WCHAR) );
1117 COMDLG32_GetDisplayNameOf( fodInfos->ShellInfos.pidlAbsCurrent, buffer );
1118 if (len)
1119 {
1120 p = buffer + lstrlenW(buffer);
1121 *p++ = '\\';
1122 SendMessageW( fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, len + 1, (LPARAM)p );
1123 }
1124 if (fodInfos->unicode)
1125 {
1126 total = lstrlenW( buffer) + 1;
1127 if (result) lstrcpynW( result, buffer, size );
1128 TRACE( "CDM_GETFILEPATH: returning %u %s\n", total, debugstr_w(result));
1129 }
1130 else
1131 {
1132 total = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL );
1134 TRACE( "CDM_GETFILEPATH: returning %u %s\n", total, debugstr_a(result));
1135 }
1136 heap_free( buffer );
1137 return total;
1138}
#define WideCharToMultiByte
Definition: compat.h:111
size_t total
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
#define debugstr_a
Definition: kernel32.h:31
#define WM_GETTEXTLENGTH
Definition: winuser.h:1647
#define WM_GETTEXT
Definition: winuser.h:1646

Referenced by FILEDLG95_HandleCustomDialogMessages().

◆ FILEDLG95_HandleCustomDialogMessages()

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

Definition at line 1145 of file filedlg.c.

1146{
1148 WCHAR lpstrPath[MAX_PATH];
1150
1151 if(!fodInfos) return FALSE;
1152
1153 switch(uMsg)
1154 {
1155 case CDM_GETFILEPATH:
1157 break;
1158
1159 case CDM_GETFOLDERPATH:
1160 TRACE("CDM_GETFOLDERPATH:\n");
1161 COMDLG32_GetDisplayNameOf(fodInfos->ShellInfos.pidlAbsCurrent, lpstrPath);
1162 if (lParam)
1163 {
1164 if (fodInfos->unicode)
1165 lstrcpynW((LPWSTR)lParam, lpstrPath, (int)wParam);
1166 else
1167 WideCharToMultiByte(CP_ACP, 0, lpstrPath, -1,
1168 (LPSTR)lParam, (int)wParam, NULL, NULL);
1169 }
1170 retval = lstrlenW(lpstrPath) + 1;
1171 break;
1172
1174 retval = ILGetSize(fodInfos->ShellInfos.pidlAbsCurrent);
1175 if (retval <= wParam)
1176 memcpy((void*)lParam, fodInfos->ShellInfos.pidlAbsCurrent, retval);
1177 break;
1178
1179 case CDM_GETSPEC:
1180 TRACE("CDM_GETSPEC:\n");
1181 retval = SendMessageW(fodInfos->DlgInfos.hwndFileName, WM_GETTEXTLENGTH, 0, 0) + 1;
1182 if (lParam)
1183 {
1184 if (fodInfos->unicode)
1185 SendMessageW(fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, wParam, lParam);
1186 else
1187 SendMessageA(fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, wParam, lParam);
1188 }
1189 break;
1190
1191 case CDM_SETCONTROLTEXT:
1192 TRACE("CDM_SETCONTROLTEXT:\n");
1193 if ( lParam )
1194 {
1195 if( fodInfos->unicode )
1197 else
1199 }
1200 retval = TRUE;
1201 break;
1202
1203 case CDM_HIDECONTROL:
1204 /* MSDN states that it should fail for not OFN_EXPLORER case */
1205 if (fodInfos->ofnInfos->Flags & OFN_EXPLORER)
1206 {
1209 retval = TRUE;
1210 }
1211 else retval = FALSE;
1212 break;
1213
1214#ifdef __REACTOS__
1215 case CDM_SETDEFEXT:
1216 {
1217 LPWSTR olddefext = (LPWSTR)fodInfos->defext;
1218 fodInfos->defext = NULL;
1219
1220 if (fodInfos->unicode)
1221 {
1222 LPCWSTR pszExt = (LPCWSTR)lParam;
1223 if (pszExt)
1224 {
1225 INT cchExt = lstrlenW(pszExt);
1226 fodInfos->defext = heap_alloc((cchExt + 1) * sizeof(WCHAR));
1227 lstrcpyW((LPWSTR)fodInfos->defext, pszExt);
1228 }
1229 }
1230 else
1231 {
1232 LPCSTR pszExt = (LPCSTR)lParam;
1233 if (pszExt)
1234 fodInfos->defext = heap_strdupAtoW(pszExt);
1235 }
1236
1237 heap_free(olddefext);
1238 break;
1239 }
1240#endif
1241
1242 default:
1243 if (uMsg >= CDM_FIRST && uMsg <= CDM_LAST)
1244 FIXME("message CDM_FIRST+%04x not implemented\n", uMsg - CDM_FIRST);
1245 return FALSE;
1246 }
1248 return TRUE;
1249}
WPARAM wParam
Definition: combotst.c:138
#define CDM_SETCONTROLTEXT
Definition: commdlg.h:47
#define CDM_GETSPEC
Definition: commdlg.h:43
#define CDM_FIRST
Definition: commdlg.h:41
#define CDM_GETFOLDERIDLIST
Definition: commdlg.h:46
#define CDM_LAST
Definition: commdlg.h:42
#define CDM_SETDEFEXT
Definition: commdlg.h:49
#define CDM_HIDECONTROL
Definition: commdlg.h:48
#define CDM_GETFILEPATH
Definition: commdlg.h:44
#define CDM_GETFOLDERPATH
Definition: commdlg.h:45
static WCHAR * heap_strdupAtoW(const char *str)
Definition: filedlg.c:508
static INT_PTR FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID result)
Definition: filedlg.c:1103
if(dx< 0)
Definition: linetemp.h:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
UINT WINAPI ILGetSize(LPCITEMIDLIST pidl)
Definition: pidl.c:941
#define SW_HIDE
Definition: winuser.h:779
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
BOOL WINAPI SetDlgItemTextA(_In_ HWND, _In_ int, _In_ LPCSTR)
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define SetWindowLongPtrW
Definition: winuser.h:5512
Definition: dialog.c:52
int retval
Definition: wcstombs.cpp:91

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_InitControls()

static LRESULT FILEDLG95_InitControls ( HWND  hwnd)
static

Definition at line 1661 of file filedlg.c.

1662{
1663 BOOL win2000plus = FALSE;
1664 BOOL win98plus = FALSE;
1665 BOOL handledPath = FALSE;
1666 OSVERSIONINFOW osVi;
1667
1668 static const TBBUTTON tbb[] =
1669 {
1670 {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1672 {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1674 {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1676 {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1679 };
1680 static const TBADDBITMAP tba = {HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR};
1681
1682 RECT rectTB;
1683 RECT rectlook;
1684
1685 HIMAGELIST toolbarImageList;
1686 ITEMIDLIST *desktopPidl;
1688
1690
1691 TRACE("%p\n", fodInfos);
1692
1693 /* Get windows version emulating */
1694 osVi.dwOSVersionInfoSize = sizeof(osVi);
1695 GetVersionExW(&osVi);
1697 win98plus = ((osVi.dwMajorVersion > 4) || ((osVi.dwMajorVersion == 4) && (osVi.dwMinorVersion > 0)));
1698 } else if (osVi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
1699 win2000plus = (osVi.dwMajorVersion > 4);
1700 if (win2000plus) win98plus = TRUE;
1701 }
1702 TRACE("Running on 2000+ %d, 98+ %d\n", win2000plus, win98plus);
1703
1704
1705 /* Use either the edit or the comboboxex for the filename control */
1706 if (filename_is_edit( fodInfos ))
1707 {
1709 fodInfos->DlgInfos.hwndFileName = GetDlgItem( hwnd, edt1 );
1710 }
1711 else
1712 {
1714 fodInfos->DlgInfos.hwndFileName = GetDlgItem( hwnd, cmb13 );
1715 }
1716
1717 /* Get the hwnd of the controls */
1718 fodInfos->DlgInfos.hwndFileTypeCB = GetDlgItem(hwnd,IDC_FILETYPE);
1719 fodInfos->DlgInfos.hwndLookInCB = GetDlgItem(hwnd,IDC_LOOKIN);
1720
1721 GetWindowRect( fodInfos->DlgInfos.hwndLookInCB,&rectlook);
1722 MapWindowPoints( 0, hwnd,(LPPOINT)&rectlook,2);
1723
1724 /* construct the toolbar */
1726 MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2);
1727
1728 rectTB.right = rectlook.right + rectTB.right - rectTB.left;
1729 rectTB.bottom = rectlook.top - 1 + rectTB.bottom - rectTB.top;
1730 rectTB.left = rectlook.right;
1731 rectTB.top = rectlook.top-1;
1732
1733 if (fodInfos->unicode)
1734 fodInfos->DlgInfos.hwndTB = CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL,
1736 rectTB.left, rectTB.top,
1737 rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
1739 else
1740 fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL,
1742 rectTB.left, rectTB.top,
1743 rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
1745
1746 SendMessageW(fodInfos->DlgInfos.hwndTB, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
1747
1748/* FIXME: use TB_LOADIMAGES when implemented */
1749/* SendMessageW(fodInfos->DlgInfos.hwndTB, TB_LOADIMAGES, IDB_VIEW_SMALL_COLOR, HINST_COMMCTRL);*/
1750 SendMessageW(fodInfos->DlgInfos.hwndTB, TB_SETMAXTEXTROWS, 0, 0);
1751 SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, 12, (LPARAM) &tba);
1752
1753 /* Retrieve and add desktop icon to the toolbar */
1754 toolbarImageList = (HIMAGELIST)SendMessageW(fodInfos->DlgInfos.hwndTB, TB_GETIMAGELIST, 0, 0L);
1756 SHGetFileInfoW((const WCHAR *)desktopPidl, 0, &fileinfo, sizeof(fileinfo),
1758 ImageList_AddIcon(toolbarImageList, fileinfo.hIcon);
1759
1760 DestroyIcon(fileinfo.hIcon);
1761 CoTaskMemFree(desktopPidl);
1762
1763 /* Finish Toolbar Construction */
1764 SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSW, 9, (LPARAM) tbb);
1765 SendMessageW(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
1766
1767 if (is_places_bar_enabled(fodInfos))
1768 {
1769 TBBUTTON tb = { 0 };
1771 RECT rect;
1772 int i, cx;
1773
1776 cx = rect.right - rect.left;
1777
1780
1782 for (i = 0; i < ARRAY_SIZE(fodInfos->places); i++)
1783 {
1784 int index;
1785
1786 if (!fodInfos->places[i])
1787 continue;
1788
1789 memset(&fileinfo, 0, sizeof(fileinfo));
1790 SHGetFileInfoW((const WCHAR *)fodInfos->places[i], 0, &fileinfo, sizeof(fileinfo),
1793
1794 tb.iBitmap = index;
1795 tb.iString = (INT_PTR)fileinfo.szDisplayName;
1796 tb.fsState = TBSTATE_ENABLED | TBSTATE_WRAP;
1797 tb.idCommand = TBPLACES_CMDID_PLACE0 + i;
1799
1800 DestroyIcon(fileinfo.hIcon);
1801 }
1802
1805 }
1806
1807 /* Set the window text with the text specified in the OPENFILENAME structure */
1808 if(fodInfos->title)
1809 {
1810 SetWindowTextW(hwnd,fodInfos->title);
1811 }
1812 else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
1813 {
1814 WCHAR buf[64];
1817 }
1818
1819 /* Initialise the file name edit control */
1820 handledPath = FALSE;
1821 TRACE("Before manipulation, file = %s, dir = %s\n", debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1822
1823 if(fodInfos->filename)
1824 {
1825 /* 1. If win2000 or higher and filename contains a path, use it
1826 in preference over the lpstrInitialDir */
1827 if (win2000plus && *fodInfos->filename && wcspbrk(fodInfos->filename, L"\\")) {
1828 WCHAR tmpBuf[MAX_PATH];
1829 WCHAR *nameBit;
1830 DWORD result;
1831
1832 result = GetFullPathNameW(fodInfos->filename, MAX_PATH, tmpBuf, &nameBit);
1833 if (result) {
1834
1835 /* nameBit is always shorter than the original filename. It may be NULL
1836 * when the filename contains only a drive name instead of file name */
1837 if (nameBit)
1838 {
1839 lstrcpyW(fodInfos->filename,nameBit);
1840 *nameBit = 0x00;
1841 }
1842 else
1843 *fodInfos->filename = '\0';
1844
1845 heap_free(fodInfos->initdir);
1846 fodInfos->initdir = heap_alloc((lstrlenW(tmpBuf) + 1)*sizeof(WCHAR));
1847 lstrcpyW(fodInfos->initdir, tmpBuf);
1848 handledPath = TRUE;
1849 TRACE("Value in Filename includes path, overriding InitialDir: %s, %s\n",
1850 debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1851 }
1852 SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1853
1854 } else {
1855 SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1856 }
1857 }
1858
1859 /* 2. (All platforms) If initdir is not null, then use it */
1860 if (!handledPath && fodInfos->initdir && *fodInfos->initdir)
1861 {
1862 /* Work out the proper path as supplied one might be relative */
1863 /* (Here because supplying '.' as dir browses to My Computer) */
1864 WCHAR tmpBuf[MAX_PATH];
1865 WCHAR tmpBuf2[MAX_PATH];
1866 WCHAR *nameBit;
1867 DWORD result;
1868
1869 lstrcpyW(tmpBuf, fodInfos->initdir);
1870 if (PathFileExistsW(tmpBuf)) {
1871 /* initdir does not have to be a directory. If a file is
1872 * specified, the dir part is taken */
1873 if (PathIsDirectoryW(tmpBuf)) {
1874 PathAddBackslashW(tmpBuf);
1875 lstrcatW(tmpBuf, L"*");
1876 }
1877 result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit);
1878 if (result) {
1879 *nameBit = 0x00;
1880 heap_free(fodInfos->initdir);
1881 fodInfos->initdir = heap_alloc((lstrlenW(tmpBuf2) + 1) * sizeof(WCHAR));
1882 lstrcpyW(fodInfos->initdir, tmpBuf2);
1883 handledPath = TRUE;
1884 TRACE("Value in InitDir changed to %s\n", debugstr_w(fodInfos->initdir));
1885 }
1886 }
1887 else if (fodInfos->initdir)
1888 {
1889 heap_free(fodInfos->initdir);
1890 fodInfos->initdir = NULL;
1891 TRACE("Value in InitDir is not an existing path, changed to (nil)\n");
1892 }
1893 }
1894
1895#ifdef __REACTOS__
1896 if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir))
1897 {
1898 /* 2.5. Win2000+: Recently used defext */
1899 if (win2000plus) {
1900 fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1901 fodInfos->initdir[0] = '\0';
1902
1903 FILEDLG95_MRU_load_ext(fodInfos->initdir, MAX_PATH, fodInfos->defext);
1904
1905 if (fodInfos->initdir[0] && PathIsDirectoryW(fodInfos->initdir)) {
1906 handledPath = TRUE;
1907 } else {
1908 heap_free(fodInfos->initdir);
1909 fodInfos->initdir = NULL;
1910 }
1911 }
1912 }
1913#endif
1914
1915 if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir))
1916 {
1917 /* 3. All except w2k+: if filename contains a path use it */
1918 if (!win2000plus && fodInfos->filename && *fodInfos->filename &&
1919 wcspbrk(fodInfos->filename, L"\\")) {
1920 WCHAR tmpBuf[MAX_PATH];
1921 WCHAR *nameBit;
1922 DWORD result;
1923
1925 tmpBuf, &nameBit);
1926 if (result) {
1927 int len;
1928
1929 /* nameBit is always shorter than the original filename */
1930 lstrcpyW(fodInfos->filename, nameBit);
1931 *nameBit = 0x00;
1932
1933 len = lstrlenW(tmpBuf);
1934 heap_free(fodInfos->initdir);
1935 fodInfos->initdir = heap_alloc((len+1)*sizeof(WCHAR));
1936 lstrcpyW(fodInfos->initdir, tmpBuf);
1937
1938 handledPath = TRUE;
1939 TRACE("Value in Filename includes path, overriding initdir: %s, %s\n",
1940 debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1941 }
1942 SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1943 }
1944
1945 /* 4. Win2000+: Recently used */
1946 if (!handledPath && win2000plus) {
1947 fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1948 fodInfos->initdir[0] = '\0';
1949
1951
1952 if (fodInfos->initdir[0] && PathFileExistsW(fodInfos->initdir)){
1953 handledPath = TRUE;
1954 }else{
1955 heap_free(fodInfos->initdir);
1956 fodInfos->initdir = NULL;
1957 }
1958 }
1959
1960 /* 5. win98+ and win2000+ if any files of specified filter types in
1961 current directory, use it */
1962 if (win98plus && !handledPath && fodInfos->filter && *fodInfos->filter) {
1963
1964 LPCWSTR lpstrPos = fodInfos->filter;
1965 WIN32_FIND_DATAW FindFileData;
1966 HANDLE hFind;
1967
1968 while (1)
1969 {
1970 /* filter is a list... title\0ext\0......\0\0 */
1971
1972 /* Skip the title */
1973 if(! *lpstrPos) break; /* end */
1974 lpstrPos += lstrlenW(lpstrPos) + 1;
1975
1976 /* See if any files exist in the current dir with this extension */
1977 if(! *lpstrPos) break; /* end */
1978
1979 hFind = FindFirstFileW(lpstrPos, &FindFileData);
1980
1981 if (hFind == INVALID_HANDLE_VALUE) {
1982 /* None found - continue search */
1983 lpstrPos += lstrlenW(lpstrPos) + 1;
1984
1985 } else {
1986
1987 heap_free(fodInfos->initdir);
1988 fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1990
1991 handledPath = TRUE;
1992 TRACE("No initial dir specified, but files of type %s found in current, so using it\n",
1993 debugstr_w(lpstrPos));
1994 FindClose(hFind);
1995 break;
1996 }
1997 }
1998 }
1999
2000 /* 6. Win98+ and 2000+: Use personal files dir, others use current dir */
2001 if (!handledPath && (win2000plus || win98plus)) {
2002 fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
2003
2004 if (SHGetFolderPathW(hwnd, CSIDL_PERSONAL, 0, 0, fodInfos->initdir) == S_OK)
2005 {
2007 {
2008 /* last fallback */
2010 TRACE("No personal or desktop dir, using cwd as failsafe: %s\n", debugstr_w(fodInfos->initdir));
2011 }
2012 else
2013 TRACE("No personal dir, using desktop instead: %s\n", debugstr_w(fodInfos->initdir));
2014 }
2015 else
2016 TRACE("No initial dir specified, using personal files dir of %s\n", debugstr_w(fodInfos->initdir));
2017
2018 handledPath = TRUE;
2019 } else if (!handledPath) {
2020 fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
2022 handledPath = TRUE;
2023 TRACE("No initial dir specified, using current dir of %s\n", debugstr_w(fodInfos->initdir));
2024 }
2025 }
2026 SetFocus( fodInfos->DlgInfos.hwndFileName );
2027 TRACE("After manipulation, file = %s, dir = %s\n", debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
2028
2029 /* Must the open as read only check box be checked ?*/
2030 if(fodInfos->ofnInfos->Flags & OFN_READONLY)
2031 {
2033 }
2034
2035 /* Must the open as read only check box be hidden? */
2036 if (filedialog_is_readonly_hidden(fodInfos))
2037 {
2040 }
2041
2042 /* Must the help button be hidden? */
2043 if (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP))
2044 {
2047 }
2048
2049 /* change Open to Save */
2050 if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
2051 {
2052#ifdef __REACTOS__
2053 WCHAR buf[24];
2054#else
2055 WCHAR buf[16];
2056#endif
2061 }
2062
2063 /* Initialize the filter combo box */
2065#ifdef __REACTOS__
2066 DoInitAutoCompleteWithCWD(fodInfos, fodInfos->DlgInfos.hwndFileName);
2067#endif
2068
2069 return 0;
2070}
#define index(s, c)
Definition: various.h:29
HIMAGELIST himl
#define IDS_SAVE_AS
Definition: cdlg.h:159
#define IDS_SAVE_BUTTON
Definition: cdlg.h:156
#define IDS_SAVE_IN
Definition: cdlg.h:157
RECT rect
Definition: combotst.c:67
EXTERN_C HRESULT DoInitAutoCompleteWithCWD(FileOpenDlgInfos *pInfo, HWND hwndEdit)
Definition: autocomp.cpp:12
#define OFN_READONLY
Definition: commdlg.h:118
#define OFN_SHOWHELP
Definition: commdlg.h:120
#define edt1
Definition: dlgs.h:70
#define cmb13
Definition: dlgs.h:65
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
#define TBPLACES_CMDID_PLACE0
Definition: filedlg.c:200
static void FILEDLG95_MRU_load_filename(LPWSTR stored_path)
Definition: filedlg.c:2605
static void filedlg_collect_places_pidls(FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:365
static BOOL is_places_bar_enabled(const FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:344
static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
Definition: filedlg.c:3608
static BOOL filedialog_is_readonly_hidden(const FileOpenDlgInfos *info)
Definition: filedlg.c:228
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1164
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
BOOL WINAPI PathFileExistsW(const WCHAR *path)
Definition: path.c:2583
_ACRTIMP wchar_t *__cdecl wcspbrk(const wchar_t *, const wchar_t *)
Definition: wcs.c:2021
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3385
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2717
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:669
#define L(x)
Definition: resources.c:13
#define IDC_TOOLBARPLACES
#define IDC_LOOKINSTATIC
#define IDC_TOOLBARSTATIC
#define IDC_FILETYPE
#define IDC_OPENREADONLY
#define IDC_LOOKIN
GLuint index
Definition: glext.h:6031
static const WCHAR tb[]
Definition: suminfo.c:431
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:246
#define VER_PLATFORM_WIN32_WINDOWS
Definition: rtltypes.h:245
#define WS_GROUP
Definition: pedump.c:633
#define BTNS_BUTTON
Definition: commctrl.h:998
#define VIEW_PARENTFOLDER
Definition: commctrl.h:1095
#define TB_AUTOSIZE
Definition: commctrl.h:1137
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define BTNS_SEP
Definition: commctrl.h:999
#define HINST_COMMCTRL
Definition: commctrl.h:1063
#define VIEW_LIST
Definition: commctrl.h:1089
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:324
#define IDB_VIEW_SMALL_COLOR
Definition: commctrl.h:1066
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1134
_Out_opt_ int * cx
Definition: commctrl.h:585
#define ILC_COLOR32
Definition: commctrl.h:358
#define TB_SETIMAGELIST
Definition: commctrl.h:1150
#define VIEW_NEWFOLDER
Definition: commctrl.h:1098
#define TB_SETBUTTONSIZE
Definition: commctrl.h:1135
#define CCS_NODIVIDER
Definition: commctrl.h:2253
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:943
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define TBSTYLE_FLAT
Definition: commctrl.h:992
#define ImageList_AddIcon(himl, hicon)
Definition: commctrl.h:415
#define CCS_NORESIZE
Definition: commctrl.h:2250
#define TBSTATE_WRAP
Definition: commctrl.h:977
#define TB_SETBUTTONWIDTH
Definition: commctrl.h:1161
#define TB_ADDBUTTONSW
Definition: commctrl.h:1266
#define VIEW_DETAILS
Definition: commctrl.h:1090
#define TB_SETMAXTEXTROWS
Definition: commctrl.h:1162
#define TOOLBARCLASSNAMEA
Definition: commctrl.h:944
#define TB_ADDBITMAP
Definition: commctrl.h:1056
#define TB_GETIMAGELIST
Definition: commctrl.h:1151
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
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 IDOK
Definition: winuser.h:841
#define BM_SETCHECK
Definition: winuser.h:1950
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SM_CYICON
Definition: winuser.h:984
HWND WINAPI SetFocus(_In_opt_ HWND)
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)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SM_CXICON
Definition: winuser.h:983
BOOL WINAPI DestroyWindow(_In_ HWND)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2422
#define memset(x, y, z)
Definition: compat.h:39
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:431
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:166
#define SHGFI_ICON
Definition: shellapi.h:164
#define SHGFI_SMALLICON
Definition: shellapi.h:176
#define SHGFI_PIDL
Definition: shellapi.h:180
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2206
#define CSIDL_PERSONAL
Definition: shlobj.h:2196
#define CSIDL_FLAG_CREATE
Definition: shlobj.h:2253
#define CSIDL_DESKTOP
Definition: shlobj.h:2191
#define FCIDM_TB_DESKTOP
Definition: shresdef.h:901
#define FCIDM_TB_NEWFOLDER
Definition: shresdef.h:898
#define FCIDM_TB_SMALLICON
Definition: shresdef.h:899
#define FCIDM_TB_UPFOLDER
Definition: shresdef.h:897
#define FCIDM_TB_REPORTVIEW
Definition: shresdef.h:900
LPITEMIDLIST places[5]
ULONG dwMinorVersion
Definition: rtltypes.h:248
ULONG dwPlatformId
Definition: rtltypes.h:250
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:246
ULONG dwMajorVersion
Definition: rtltypes.h:247
#define IDC_TOOLBAR
Definition: wordpad.h:157

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_LOOKIN_AddItem()

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

Definition at line 4065 of file filedlg.c.

4066{
4067 LPITEMIDLIST pidlNext;
4068 SHFILEINFOW sfi;
4069 SFOLDER *tmpFolder;
4070 LookInInfos *liInfos;
4071
4072 TRACE("%p, %p, %d\n", hwnd, pidl, iInsertId);
4073
4074 if(!pidl)
4075 return -1;
4076
4077 if(!(liInfos = GetPropA(hwnd,LookInInfosStr)))
4078 return -1;
4079
4080 tmpFolder = heap_alloc_zero(sizeof(*tmpFolder));
4081 tmpFolder->m_iIndent = 0;
4082
4083 /* Calculate the indentation of the item in the lookin*/
4084 pidlNext = pidl;
4085 while ((pidlNext = ILGetNext(pidlNext)))
4086 {
4087 tmpFolder->m_iIndent++;
4088 }
4089
4090 tmpFolder->pidlItem = ILClone(pidl);
4091
4092 if(tmpFolder->m_iIndent > liInfos->iMaxIndentation)
4093 liInfos->iMaxIndentation = tmpFolder->m_iIndent;
4094
4095 sfi.dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
4096 SHGetFileInfoW((LPCWSTR)pidl,
4097 0,
4098 &sfi,
4099 sizeof(sfi),
4101
4102 TRACE("-- Add %s attr=0x%08lx\n", debugstr_w(sfi.szDisplayName), sfi.dwAttributes);
4103
4104 if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
4105 {
4106 int iItemID;
4107
4108 TRACE("-- Add %s at %u\n", debugstr_w(sfi.szDisplayName), tmpFolder->m_iIndent);
4109
4110 /* Add the item at the end of the list */
4111 if(iInsertId < 0)
4112 {
4113 iItemID = SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)sfi.szDisplayName);
4114 }
4115 /* Insert the item at the iInsertId position*/
4116 else
4117 {
4118 iItemID = SendMessageW(hwnd, CB_INSERTSTRING, iInsertId, (LPARAM)sfi.szDisplayName);
4119 }
4120
4121 SendMessageW(hwnd, CB_SETITEMDATA, iItemID, (LPARAM)tmpFolder);
4122 return iItemID;
4123 }
4124
4125 ILFree( tmpFolder->pidlItem );
4126 heap_free( tmpFolder );
4127 return -1;
4128
4129}
static const char LookInInfosStr[]
Definition: filedlg.c:215
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:238
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:977
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define CB_INSERTSTRING
Definition: winuser.h:1986
#define SHGFI_ATTR_SPECIFIED
Definition: shellapi.h:174
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:168
int m_iIndent
Definition: filedlg.c:98
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
DWORD dwAttributes
Definition: shellapi.h:386
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:387
int iMaxIndentation
Definition: filedlg.c:105

Referenced by FILEDLG95_LOOKIN_Init(), and FILEDLG95_LOOKIN_InsertItemAfterParent().

◆ FILEDLG95_LOOKIN_Clean()

static void FILEDLG95_LOOKIN_Clean ( HWND  hwnd)
static

Definition at line 4268 of file filedlg.c.

4269{
4271 LookInInfos *liInfos = GetPropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4272 int iPos, iCount;
4273
4274 iCount = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCOUNT, 0, 0);
4275
4276 TRACE("\n");
4277
4278 /* Delete each string of the combo and their associated data */
4279 if (iCount != CB_ERR)
4280 {
4281 for(iPos = iCount-1;iPos>=0;iPos--)
4282 {
4283 SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,iPos);
4284 ILFree(tmpFolder->pidlItem);
4285 heap_free(tmpFolder);
4286 SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_DELETESTRING, iPos, 0);
4287 }
4288 }
4289
4290 /* LookInInfos structure */
4291 heap_free(liInfos);
4292 RemovePropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4293}
struct SFolder * LPSFOLDER
HANDLE WINAPI RemovePropA(_In_ HWND, _In_ LPCSTR)

Referenced by FILEDLG95_Clean().

◆ FILEDLG95_LOOKIN_DrawItem()

static LRESULT FILEDLG95_LOOKIN_DrawItem ( HWND  hwnd,
LPDRAWITEMSTRUCT  pDIStruct 
)
static

Definition at line 3922 of file filedlg.c.

3923{
3925 COLORREF crHighLight = GetSysColor(COLOR_HIGHLIGHT);
3927 RECT rectText, rectIcon, lookin_rect;
3928 SHFILEINFOW sfi;
3929 HIMAGELIST ilItemImage;
3930 int iIndentation;
3932 LPSFOLDER tmpFolder;
3934 UINT icon_width, icon_height;
3936 int height;
3937
3938 TRACE("\n");
3939
3940 if(pDIStruct->itemID == -1)
3941 return 0;
3942
3943 if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem,
3944 pDIStruct->itemID)))
3945 return 0;
3946
3947
3948 icon_width = GetSystemMetrics(SM_CXICON);
3949 icon_height = GetSystemMetrics(SM_CYICON);
3950 if (pDIStruct->rcItem.bottom - pDIStruct->rcItem.top < icon_height)
3951 {
3952 icon_width = GetSystemMetrics(SM_CXSMICON);
3953 icon_height = GetSystemMetrics(SM_CYSMICON);
3954 shgfi_flags |= SHGFI_SMALLICON;
3955 }
3956
3957 ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
3958 0, &sfi, sizeof (sfi), shgfi_flags );
3959
3960 /* Is this item selected ? */
3961 if(pDIStruct->itemState & ODS_SELECTED)
3962 {
3963 SetTextColor(pDIStruct->hDC,(0x00FFFFFF & ~(crText)));
3964 SetBkColor(pDIStruct->hDC,crHighLight);
3965 FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_HIGHLIGHT));
3966 }
3967 else
3968 {
3969 SetTextColor(pDIStruct->hDC,crText);
3970 SetBkColor(pDIStruct->hDC,crWin);
3971 FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_WINDOW));
3972 }
3973
3974 /* Do not indent item if drawing in the edit of the combo */
3975 if(pDIStruct->itemState & ODS_COMBOBOXEDIT)
3976 iIndentation = 0;
3977 else
3978 iIndentation = tmpFolder->m_iIndent;
3979
3980 /* Draw text and icon */
3981
3982 /* Initialise the icon display area */
3983 rectIcon.left = pDIStruct->rcItem.left + 1 + icon_width/2 * iIndentation;
3984 rectIcon.top = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - icon_height) / 2;
3985 rectIcon.right = rectIcon.left + icon_width + XTEXTOFFSET;
3986 rectIcon.bottom = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + icon_height) / 2;
3987
3988 /* Initialise the text display area */
3989 GetTextMetricsW(pDIStruct->hDC, &tm);
3990 rectText.left = rectIcon.right;
3991 rectText.top =
3992 (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - tm.tmHeight) / 2;
3993 rectText.right = pDIStruct->rcItem.right;
3994 rectText.bottom =
3995 (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + tm.tmHeight) / 2;
3996
3997 /* Draw the icon from the image list */
3998 ImageList_Draw(ilItemImage,
3999 sfi.iIcon,
4000 pDIStruct->hDC,
4001 rectIcon.left,
4002 rectIcon.top,
4004
4005 /* Draw the associated text */
4006 TextOutW(pDIStruct->hDC,rectText.left,rectText.top,sfi.szDisplayName,lstrlenW(sfi.szDisplayName));
4007
4009 GetWindowRect(dialog->DlgInfos.hwndLookInCB, &lookin_rect);
4010 height = lookin_rect.bottom - lookin_rect.top;
4012
4013 return NOERROR;
4014}
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1246
#define XTEXTOFFSET
Definition: filedlg.c:187
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
static HWND dialog
Definition: gui.c:33
#define ILD_TRANSPARENT
Definition: commctrl.h:418
DWORD WINAPI GetSysColor(_In_ int)
#define ODS_SELECTED
Definition: winuser.h:2581
#define COLOR_WINDOW
Definition: winuser.h:929
#define COLOR_WINDOWTEXT
Definition: winuser.h:932
#define COLOR_HIGHLIGHT
Definition: winuser.h:937
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define SM_CYSMICON
Definition: winuser.h:1024
#define SM_CXSMICON
Definition: winuser.h:1023
#define SHGFI_OPENICON
Definition: shellapi.h:178
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:171
DWORD COLORREF
Definition: windef.h:100
#define NOERROR
Definition: winerror.h:3448
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:917

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_LOOKIN_Init()

static void FILEDLG95_LOOKIN_Init ( HWND  hwndCombo)
static

Definition at line 3837 of file filedlg.c.

3838{
3839 IShellFolder *psfRoot, *psfDrives;
3840 IEnumIDList *lpeRoot, *lpeDrives;
3841 LPITEMIDLIST pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
3842 HDC hdc;
3844 LookInInfos *liInfos = heap_alloc_zero(sizeof(*liInfos));
3845
3846 TRACE("%p\n", hwndCombo);
3847
3848 liInfos->iMaxIndentation = 0;
3849
3850 SetPropA(hwndCombo, LookInInfosStr, liInfos);
3851
3852 hdc = GetDC( hwndCombo );
3853 SelectObject( hdc, (HFONT)SendMessageW( hwndCombo, WM_GETFONT, 0, 0 ));
3854 GetTextMetricsW( hdc, &tm );
3855 ReleaseDC( hwndCombo, hdc );
3856
3857 /* set item height for both text field and listbox */
3858 SendMessageW(hwndCombo, CB_SETITEMHEIGHT, -1, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3859 SendMessageW(hwndCombo, CB_SETITEMHEIGHT, 0, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3860
3861 /* Turn on the extended UI for the combo box like Windows does */
3862 SendMessageW(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
3863
3864 /* Initialise data of Desktop folder */
3866 FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3867 ILFree(pidlTmp);
3868
3870
3871 SHGetDesktopFolder(&psfRoot);
3872
3873 if (psfRoot)
3874 {
3875 /* enumerate the contents of the desktop */
3876 if(SUCCEEDED(IShellFolder_EnumObjects(psfRoot, hwndCombo, SHCONTF_FOLDERS, &lpeRoot)))
3877 {
3878 while (S_OK == IEnumIDList_Next(lpeRoot, 1, &pidlTmp, NULL))
3879 {
3880 FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3881
3882 /* If the unixfs extension is rooted, we don't expand the drives by default */
3884 {
3885 /* special handling for CSIDL_DRIVES */
3886 if (ILIsEqual(pidlTmp, pidlDrives))
3887 {
3888 if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
3889 {
3890 /* enumerate the drives */
3891 if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives)))
3892 {
3893 while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
3894 {
3895 pidlAbsTmp = ILCombine(pidlTmp, pidlTmp1);
3896 FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
3897 ILFree(pidlAbsTmp);
3898 ILFree(pidlTmp1);
3899 }
3900 IEnumIDList_Release(lpeDrives);
3901 }
3902 IShellFolder_Release(psfDrives);
3903 }
3904 }
3905 }
3906
3907 ILFree(pidlTmp);
3908 }
3909 IEnumIDList_Release(lpeRoot);
3910 }
3911 IShellFolder_Release(psfRoot);
3912 }
3913
3914 ILFree(pidlDrives);
3915}
#define LISTEND
Definition: filedlg.c:190
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:4065
static BOOL FILEDLG95_unixfs_is_rooted_at_desktop(void)
Definition: filedlg.c:3825
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:817
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:583
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
#define WM_GETFONT
Definition: winuser.h:1679
HDC WINAPI GetDC(_In_opt_ HWND)
#define CB_SETEXTENDEDUI
Definition: winuser.h:1993
#define CB_SETITEMHEIGHT
Definition: winuser.h:1996
#define CSIDL_DRIVES
Definition: shlobj.h:2207
#define max(a, b)
Definition: svc.c:63
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546

Referenced by FILEDLG95_FillControls().

◆ FILEDLG95_LOOKIN_InsertItemAfterParent()

static int FILEDLG95_LOOKIN_InsertItemAfterParent ( HWND  hwnd,
LPITEMIDLIST  pidl 
)
static

Definition at line 4136 of file filedlg.c.

4137{
4138
4139 LPITEMIDLIST pidlParent = GetParentPidl(pidl);
4140 int iParentPos;
4141
4142 TRACE("\n");
4143
4144 if (pidl == pidlParent)
4145 return -1;
4146
4147 iParentPos = FILEDLG95_LOOKIN_SearchItem(hwnd,(WPARAM)pidlParent,SEARCH_PIDL);
4148
4149 if(iParentPos < 0)
4150 {
4151 iParentPos = FILEDLG95_LOOKIN_InsertItemAfterParent(hwnd,pidlParent);
4152 }
4153
4154 ILFree(pidlParent);
4155
4156 return FILEDLG95_LOOKIN_AddItem(hwnd,pidl,iParentPos + 1);
4157}
LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl)
Definition: filedlg.c:4600
#define SEARCH_PIDL
Definition: filedlg.c:193
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4238
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:4136
UINT_PTR WPARAM
Definition: minwindef.h:174

Referenced by FILEDLG95_LOOKIN_InsertItemAfterParent(), and FILEDLG95_LOOKIN_SelectItem().

◆ FILEDLG95_LOOKIN_OnCommand()

static BOOL FILEDLG95_LOOKIN_OnCommand ( HWND  hwnd,
WORD  wNotifyCode 
)
static

Definition at line 4022 of file filedlg.c.

4023{
4025
4026 TRACE("%p\n", fodInfos);
4027
4028 switch(wNotifyCode)
4029 {
4030 case CBN_SELENDOK:
4031 {
4032 LPSFOLDER tmpFolder;
4033 int iItem;
4034
4035 iItem = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCURSEL, 0, 0);
4036
4037 if( iItem == CB_ERR) return FALSE;
4038
4039 if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,
4040 iItem)))
4041 return FALSE;
4042
4043
4044 if(SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
4045 tmpFolder->pidlItem,
4046 SBSP_ABSOLUTE)))
4047 {
4048 if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
4050 return TRUE;
4051 }
4052 break;
4053 }
4054
4055 }
4056 return FALSE;
4057}

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_LOOKIN_RemoveMostExpandedItem()

static int FILEDLG95_LOOKIN_RemoveMostExpandedItem ( HWND  hwnd)
static

Definition at line 4208 of file filedlg.c.

4209{
4210 int iItemPos;
4212
4213 TRACE("\n");
4214
4215 if(liInfos->iMaxIndentation <= 2)
4216 return -1;
4217
4218 if((iItemPos = FILEDLG95_LOOKIN_SearchItem(hwnd,liInfos->iMaxIndentation,SEARCH_EXP)) >=0)
4219 {
4220 SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4221 ILFree(tmpFolder->pidlItem);
4222 heap_free(tmpFolder);
4223 SendMessageW(hwnd, CB_DELETESTRING, iItemPos, 0);
4224 liInfos->iMaxIndentation--;
4225
4226 return iItemPos;
4227 }
4228
4229 return -1;
4230}
#define SEARCH_EXP
Definition: filedlg.c:194

Referenced by FILEDLG95_LOOKIN_SelectItem().

◆ FILEDLG95_LOOKIN_SearchItem()

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

Definition at line 4238 of file filedlg.c.

4239{
4240 int i = 0;
4241 int iCount;
4242
4243 iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
4244
4245 TRACE("0x%08Ix 0x%x\n",searchArg, iSearchMethod);
4246
4247 if (iCount != CB_ERR)
4248 {
4249 for(;i<iCount;i++)
4250 {
4251 LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i);
4252
4253 if (iSearchMethod == SEARCH_PIDL && ILIsEqual((LPITEMIDLIST)searchArg, tmpFolder->pidlItem))
4254 return i;
4255 if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg)
4256 return i;
4257 }
4258 }
4259
4260 return -1;
4261}

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 4165 of file filedlg.c.

4166{
4167 int iItemPos;
4168 LookInInfos *liInfos;
4169
4170 TRACE("%p, %p\n", hwnd, pidl);
4171
4173
4174 liInfos = GetPropA(hwnd,LookInInfosStr);
4175
4176 if(iItemPos < 0)
4177 {
4180 }
4181
4182 else
4183 {
4184 SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4185 while(liInfos->iMaxIndentation > tmpFolder->m_iIndent)
4186 {
4187 int iRemovedItem;
4188
4189 if(-1 == (iRemovedItem = FILEDLG95_LOOKIN_RemoveMostExpandedItem(hwnd)))
4190 break;
4191 if(iRemovedItem < iItemPos)
4192 iItemPos--;
4193 }
4194 }
4195
4196 SendMessageW(hwnd, CB_SETCURSEL, iItemPos, 0);
4197 liInfos->uSelectedItem = iItemPos;
4198
4199 return 0;
4200
4201}
static int FILEDLG95_LOOKIN_RemoveMostExpandedItem(HWND hwnd)
Definition: filedlg.c:4208
UINT uSelectedItem
Definition: filedlg.c:106

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 2442 of file filedlg.c.

2443{
2444 WCHAR mru_list[32], *cur_mru_slot;
2445 BOOL taken[25] = {0};
2446 DWORD mru_list_size = sizeof(mru_list), key_type = -1, i;
2447 HKEY hkey_tmp, *hkey;
2448 LONG ret;
2449
2450 if(hkey_ret)
2451 hkey = hkey_ret;
2452 else
2453 hkey = &hkey_tmp;
2454
2455 if(stored_path)
2456 *stored_path = '\0';
2457
2459 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedMRU", hkey);
2460 if(ret){
2461 WARN("Unable to create MRU key: %ld\n", ret);
2462 return 0;
2463 }
2464
2465 ret = RegGetValueW(*hkey, NULL, L"MRUList", RRF_RT_REG_SZ, &key_type,
2466 (LPBYTE)mru_list, &mru_list_size);
2467 if(ret || key_type != REG_SZ){
2469 return 'a';
2470
2471 WARN("Error getting MRUList data: type: %ld, ret: %ld\n", key_type, ret);
2472 RegCloseKey(*hkey);
2473 return 0;
2474 }
2475
2476 for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot){
2477 WCHAR value_data[MAX_PATH], value_name[2] = {0};
2478 DWORD value_data_size = sizeof(value_data);
2479
2480 *value_name = *cur_mru_slot;
2481
2482 ret = RegGetValueW(*hkey, NULL, value_name, RRF_RT_REG_BINARY,
2483 &key_type, (LPBYTE)value_data, &value_data_size);
2484 if(ret || key_type != REG_BINARY){
2485 WARN("Error getting MRU slot data: type: %ld, ret: %ld\n", key_type, ret);
2486 continue;
2487 }
2488
2489 if(!wcsicmp(module_name, value_data)){
2490 if(!hkey_ret)
2491 RegCloseKey(*hkey);
2492 if(stored_path)
2493 lstrcpyW(stored_path, value_data + lstrlenW(value_data) + 1);
2494 return *value_name;
2495 }
2496 }
2497
2498 if(!hkey_ret)
2499 RegCloseKey(*hkey);
2500
2501 /* the module name isn't in the registry, so find the next open slot */
2502 for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot)
2503 taken[*cur_mru_slot - 'a'] = TRUE;
2504 for(i = 0; i < 25; ++i){
2505 if(!taken[i])
2506 return i + 'a';
2507 }
2508
2509 /* all slots are taken, so return the last one in MRUList */
2510 --cur_mru_slot;
2511 return *cur_mru_slot;
2512}
#define REG_SZ
Definition: layer.c:22
#define WARN(fmt,...)
Definition: precomp.h:61
#define RegCloseKey(hKey)
Definition: registry.h:49
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:171
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201
#define wcsicmp
Definition: compat.h:15
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define REG_BINARY
Definition: nt_native.h:1499
long LONG
Definition: pedump.c:60
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RRF_RT_REG_BINARY
Definition: winreg.h:60
#define RRF_RT_REG_SZ
Definition: winreg.h:58

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 2605 of file filedlg.c.

2606{
2607 WCHAR module_path[MAX_PATH], *module_name;
2608
2609 /* get the current executable's name */
2610 if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2611 {
2612 WARN("GotModuleFileName failed: %ld\n", GetLastError());
2613 return;
2614 }
2615 module_name = wcsrchr(module_path, '\\');
2616 if(!module_name)
2617 module_name = module_path;
2618 else
2619 module_name += 1;
2620
2622 TRACE("got MRU path: %s\n", wine_dbgstr_w(stored_path));
2623}
static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHKEY hkey_ret)
Definition: filedlg.c:2442
#define wcsrchr
Definition: compat.h:16
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define wine_dbgstr_w
Definition: kernel32.h:34
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_MRU_save_filename()

static void FILEDLG95_MRU_save_filename ( LPCWSTR  filename)
static

Definition at line 2515 of file filedlg.c.

2516{
2517 WCHAR module_path[MAX_PATH], *module_name, slot, slot_name[2] = {0};
2518 LONG ret;
2519 HKEY hkey;
2520
2521 /* get the current executable's name */
2522 if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2523 {
2524 WARN("GotModuleFileName failed: %ld\n", GetLastError());
2525 return;
2526 }
2527 module_name = wcsrchr(module_path, '\\');
2528 if(!module_name)
2529 module_name = module_path;
2530 else
2531 module_name += 1;
2532
2534 if(!slot)
2535 return;
2536 *slot_name = slot;
2537
2538 { /* update the slot's info */
2539 WCHAR *path_ends, *final;
2540 DWORD path_len, final_len;
2541
2542 /* use only the path segment of `filename' */
2543 path_ends = wcsrchr(filename, '\\');
2544 path_len = path_ends - filename;
2545
2546 final_len = path_len + lstrlenW(module_name) + 2;
2547
2548 final = heap_alloc(final_len * sizeof(WCHAR));
2549 if(!final)
2550 return;
2551 lstrcpyW(final, module_name);
2552 memcpy(final + lstrlenW(final) + 1, filename, path_len * sizeof(WCHAR));
2553 final[final_len-1] = '\0';
2554
2555 ret = RegSetValueExW(hkey, slot_name, 0, REG_BINARY, (LPBYTE)final,
2556 final_len * sizeof(WCHAR));
2557 if(ret){
2558 WARN("Error saving MRU data to slot %s: %ld\n", wine_dbgstr_w(slot_name), ret);
2559 heap_free(final);
2560 RegCloseKey(hkey);
2561 return;
2562 }
2563
2564 heap_free(final);
2565 }
2566
2567 { /* update MRUList value */
2568 WCHAR old_mru_list[32], new_mru_list[32];
2569 WCHAR *old_mru_slot, *new_mru_slot = new_mru_list;
2570 DWORD mru_list_size = sizeof(old_mru_list), key_type;
2571
2572 ret = RegGetValueW(hkey, NULL, L"MRUList", RRF_RT_ANY, &key_type,
2573 (LPBYTE)old_mru_list, &mru_list_size);
2574 if(ret || key_type != REG_SZ){
2576 new_mru_list[0] = slot;
2577 new_mru_list[1] = '\0';
2578 }else{
2579 WARN("Error getting MRUList data: type: %ld, ret: %ld\n", key_type, ret);
2580 RegCloseKey(hkey);
2581 return;
2582 }
2583 }else{
2584 /* copy old list data over so that the new slot is at the start
2585 * of the list */
2586 *new_mru_slot++ = slot;
2587 for(old_mru_slot = old_mru_list; *old_mru_slot; ++old_mru_slot){
2588 if(*old_mru_slot != slot)
2589 *new_mru_slot++ = *old_mru_slot;
2590 }
2591 *new_mru_slot = '\0';
2592 }
2593
2594 ret = RegSetValueExW(hkey, L"MRUList", 0, REG_SZ, (LPBYTE)new_mru_list,
2595 (lstrlenW(new_mru_list) + 1) * sizeof(WCHAR));
2596 if(ret){
2597 WARN("Error saving MRUList data: %ld\n", ret);
2598 RegCloseKey(hkey);
2599 return;
2600 }
2601 }
2602}
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:4882
const char * filename
Definition: ioapi.h:137
static DWORD path_len
Definition: batch.c:31
Definition: vfat.h:185
struct _slot slot
Definition: vfat.h:196
#define RRF_RT_ANY
Definition: winreg.h:66

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_OnOpen()

BOOL FILEDLG95_OnOpen ( HWND  hwnd)
static

Definition at line 3092 of file filedlg.c.

3093{
3095 LPWSTR lpstrFileList;
3096 UINT nFileCount = 0;
3097 UINT sizeUsed = 0;
3098 BOOL ret = TRUE;
3099 WCHAR lpstrPathAndFile[MAX_PATH];
3100 LPSHELLFOLDER lpsf = NULL;
3101 int nOpenAction;
3102
3103 TRACE("hwnd=%p\n", hwnd);
3104
3105 /* try to browse the selected item */
3107 return FALSE;
3108
3109 /* get the files from the edit control */
3110 nFileCount = FILEDLG95_FILENAME_GetFileNames(hwnd, &lpstrFileList, &sizeUsed);
3111
3112 if(nFileCount == 0)
3113 return FALSE;
3114
3115 if(nFileCount > 1)
3116 {
3117 ret = FILEDLG95_OnOpenMultipleFiles(hwnd, lpstrFileList, nFileCount, sizeUsed);
3118 goto ret;
3119 }
3120
3121 TRACE("count=%u len=%u file=%s\n", nFileCount, sizeUsed, debugstr_w(lpstrFileList));
3122
3123/*
3124 Step 1: Build a complete path name from the current folder and
3125 the filename or path in the edit box.
3126 Special cases:
3127 - the path in the edit box is a root path
3128 (with or without drive letter)
3129 - the edit box contains ".." (or a path with ".." in it)
3130*/
3131
3132 COMDLG32_GetCanonicalPath(fodInfos->ShellInfos.pidlAbsCurrent, lpstrFileList, lpstrPathAndFile);
3133 heap_free(lpstrFileList);
3134
3135/*
3136 Step 2: here we have a cleaned up path
3137
3138 We have to parse the path step by step to see if we have to browse
3139 to a folder if the path points to a directory or the last
3140 valid element is a directory.
3141
3142 valid variables:
3143 lpstrPathAndFile: cleaned up path
3144 */
3145
3146 if (nFileCount &&
3147 (fodInfos->ofnInfos->Flags & OFN_NOVALIDATE) &&
3148 !(fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST))
3149 nOpenAction = ONOPEN_OPEN;
3150 else
3151 nOpenAction = ONOPEN_BROWSE;
3152
3153#ifdef __REACTOS__
3154 nOpenAction = FILEDLG95_ValidatePathAction(fodInfos, lpstrPathAndFile, &lpsf, hwnd,
3155#else
3156 nOpenAction = FILEDLG95_ValidatePathAction(lpstrPathAndFile, &lpsf, hwnd,
3157#endif
3158 fodInfos->ofnInfos->Flags,
3159 fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG,
3160 nOpenAction);
3161 if(!nOpenAction)
3162 goto ret;
3163
3164/*
3165 Step 3: here we have a cleaned up and validated path
3166
3167 valid variables:
3168 lpsf: ShellFolder bound to the rightmost valid path component
3169 lpstrPathAndFile: cleaned up path
3170 nOpenAction: action to do
3171*/
3172 TRACE("end validate sf=%p\n", lpsf);
3173
3174 switch(nOpenAction)
3175 {
3176 case ONOPEN_SEARCH: /* set the current filter to the file mask and refresh */
3177 TRACE("ONOPEN_SEARCH %s\n", debugstr_w(lpstrPathAndFile));
3178 {
3179 int iPos;
3180 LPWSTR lpszTemp = PathFindFileNameW(lpstrPathAndFile);
3181 DWORD len;
3182
3183 /* replace the current filter */
3184 heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3185 len = lstrlenW(lpszTemp)+1;
3186 fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc(len * sizeof(WCHAR));
3187 lstrcpyW( fodInfos->ShellInfos.lpstrCurrentFilter, lpszTemp);
3188
3189 /* set the filter cb to the extension when possible */
3190 if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, lpszTemp)))
3191 SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETCURSEL, iPos, 0);
3192 }
3193 /* fall through */
3194 case ONOPEN_BROWSE: /* browse to the highest folder we could bind to */
3195 TRACE("ONOPEN_BROWSE\n");
3196 {
3197 IPersistFolder2 * ppf2;
3198 if(SUCCEEDED(IShellFolder_QueryInterface( lpsf, &IID_IPersistFolder2, (LPVOID*)&ppf2)))
3199 {
3200 LPITEMIDLIST pidlCurrent;
3201 IPersistFolder2_GetCurFolder(ppf2, &pidlCurrent);
3202 IPersistFolder2_Release(ppf2);
3203 if (!ILIsEqual(pidlCurrent, fodInfos->ShellInfos.pidlAbsCurrent))
3204 {
3205 if (SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidlCurrent, SBSP_ABSOLUTE))
3206 && fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3207 {
3209 SendMessageA(fodInfos->DlgInfos.hwndFileName, WM_SETTEXT, 0, (LPARAM)"");
3210 }
3211 }
3212 else if( nOpenAction == ONOPEN_SEARCH )
3213 {
3214 if (fodInfos->Shell.FOIShellView)
3215 IShellView_Refresh(fodInfos->Shell.FOIShellView);
3216 }
3217 ILFree(pidlCurrent);
3218 if (filename_is_edit( fodInfos ))
3219 SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
3220 else
3221 {
3222 HWND hwnd;
3223
3224 hwnd = (HWND)SendMessageA(fodInfos->DlgInfos.hwndFileName, CBEM_GETEDITCONTROL, 0, 0);
3225 SendMessageW(hwnd, EM_SETSEL, 0, -1);
3226 }
3227 }
3228 }
3229 ret = FALSE;
3230 break;
3231 case ONOPEN_OPEN: /* fill in the return struct and close the dialog */
3232 TRACE("ONOPEN_OPEN %s\n", debugstr_w(lpstrPathAndFile));
3233 {
3234#ifndef __REACTOS__
3235 WCHAR *ext = NULL;
3236#endif
3237
3238 /* update READONLY check box flag */
3240 fodInfos->ofnInfos->Flags |= OFN_READONLY;
3241 else
3242 fodInfos->ofnInfos->Flags &= ~OFN_READONLY;
3243
3244 /* Attach the file extension with file name*/
3245#ifdef __REACTOS__
3246 /* Add extension if necessary */
3247 FILEDLG95_AddDotExtIfNeeded(fodInfos, lpstrPathAndFile);
3248 /* update dialog data */
3249 SetWindowTextW(fodInfos->DlgInfos.hwndFileName, PathFindFileNameW(lpstrPathAndFile));
3250#else /* __REACTOS__ */
3251 ext = PathFindExtensionW(lpstrPathAndFile);
3252 if (! *ext && fodInfos->defext)
3253 {
3254 /* if no extension is specified with file name, then */
3255 /* attach the extension from file filter or default one */
3256
3257 WCHAR *filterExt = NULL;
3258 LPWSTR lpstrFilter = NULL;
3259 int PathLength = lstrlenW(lpstrPathAndFile);
3260
3261 /*Get the file extension from file type filter*/
3262 lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3263 fodInfos->ofnInfos->nFilterIndex-1);
3264
3265 if (lpstrFilter != (LPWSTR)CB_ERR) /* control is not empty */
3266 {
3267 WCHAR* filterSearchIndex;
3268 filterExt = heap_alloc((lstrlenW(lpstrFilter) + 1) * sizeof(WCHAR));
3269 lstrcpyW(filterExt, lpstrFilter);
3270
3271 /* if a semicolon-separated list of file extensions was given, do not include the
3272 semicolon or anything after it in the extension.
3273 example: if filterExt was "*.abc;*.def", it will become "*.abc" */
3274 filterSearchIndex = wcschr(filterExt, ';');
3275 if (filterSearchIndex)
3276 {
3277 filterSearchIndex[0] = '\0';
3278 }
3279
3280 /* find the file extension by searching for the first dot in filterExt */
3281 /* strip the * or anything else from the extension, "*.abc" becomes "abc" */
3282 /* if the extension is invalid or contains a glob, ignore it */
3283 filterSearchIndex = wcschr(filterExt, '.');
3284 if (filterSearchIndex++ && !wcschr(filterSearchIndex, '*') && !wcschr(filterSearchIndex, '?'))
3285 {
3286 lstrcpyW(filterExt, filterSearchIndex);
3287 }
3288 else
3289 {
3290 heap_free(filterExt);
3291 filterExt = NULL;
3292 }
3293 }
3294
3295 if (!filterExt)
3296 {
3297 /* use the default file extension */
3298 filterExt = heap_alloc((lstrlenW(fodInfos->defext) + 1) * sizeof(WCHAR));
3299 lstrcpyW(filterExt, fodInfos->defext);
3300 }
3301
3302 if (*filterExt) /* ignore filterExt="" */
3303 {
3304 /* Attach the dot*/
3305 lstrcatW(lpstrPathAndFile, L".");
3306 /* Attach the extension */
3307 lstrcatW(lpstrPathAndFile, filterExt);
3308 }
3309
3310 heap_free(filterExt);
3311
3312 /* In Open dialog: if file does not exist try without extension */
3313 if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile))
3314 lpstrPathAndFile[PathLength] = '\0';
3315
3316 /* Set/clear the output OFN_EXTENSIONDIFFERENT flag */
3317 if (*ext)
3318 ext++;
3319 if (!lstrcmpiW(fodInfos->defext, ext))
3320 fodInfos->ofnInfos->Flags &= ~OFN_EXTENSIONDIFFERENT;
3321 else
3323 }
3324#endif /* __REACTOS__ */
3325
3326 /* In Save dialog: check if the file already exists */
3327 if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG
3328 && fodInfos->ofnInfos->Flags & OFN_OVERWRITEPROMPT
3329 && PathFileExistsW(lpstrPathAndFile))
3330 {
3331 WCHAR lpstrOverwrite[100];
3332 int answer;
3333
3334 LoadStringW(COMDLG32_hInstance, IDS_OVERWRITEFILE, lpstrOverwrite, 100);
3335 answer = MessageBoxW(hwnd, lpstrOverwrite, fodInfos->title,
3337 if (answer == IDNO || answer == IDCANCEL)
3338 {
3339 ret = FALSE;
3340 goto ret;
3341 }
3342 }
3343
3344 /* In Open dialog: check if it should be created if it doesn't exist */
3345 if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
3346 && fodInfos->ofnInfos->Flags & OFN_CREATEPROMPT
3347 && !PathFileExistsW(lpstrPathAndFile))
3348 {
3349 WCHAR lpstrCreate[100];
3350 int answer;
3351
3352 LoadStringW(COMDLG32_hInstance, IDS_CREATEFILE, lpstrCreate, 100);
3353 answer = MessageBoxW(hwnd, lpstrCreate, fodInfos->title,
3355 if (answer == IDNO || answer == IDCANCEL)
3356 {
3357 ret = FALSE;
3358 goto ret;
3359 }
3360 }
3361
3362 /* Check that the size of the file does not exceed buffer size.
3363 (Allow for extra \0 if OFN_MULTISELECT is set.) */
3364 if(lstrlenW(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile -
3365 ((fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) ? 1 : 0))
3366 {
3367
3368 /* fill destination buffer */
3369 if (fodInfos->ofnInfos->lpstrFile)
3370 {
3371 if(fodInfos->unicode)
3372 {
3373 LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
3374
3375 lstrcpynW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile);
3377 ofn->lpstrFile[lstrlenW(ofn->lpstrFile) + 1] = '\0';
3378 }
3379 else
3380 {
3382
3383 WideCharToMultiByte(CP_ACP, 0, lpstrPathAndFile, -1,
3386 ofn->lpstrFile[lstrlenA(ofn->lpstrFile) + 1] = '\0';
3387 }
3388 }
3389
3390 if(fodInfos->unicode)
3391 {
3392 LPWSTR lpszTemp;
3393
3394 /* set filename offset */
3395 lpszTemp = PathFindFileNameW(lpstrPathAndFile);
3396 fodInfos->ofnInfos->nFileOffset = (lpszTemp - lpstrPathAndFile);
3397
3398 /* set extension offset */
3399 lpszTemp = PathFindExtensionW(lpstrPathAndFile);
3400 fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - lpstrPathAndFile) + 1 : 0;
3401 }
3402 else
3403 {
3404 LPSTR lpszTemp;
3405 CHAR tempFileA[MAX_PATH];
3406
3407 /* avoid using fodInfos->ofnInfos->lpstrFile since it can be NULL */
3408 WideCharToMultiByte(CP_ACP, 0, lpstrPathAndFile, -1,
3409 tempFileA, sizeof(tempFileA), NULL, NULL);
3410
3411 /* set filename offset */
3412 lpszTemp = PathFindFileNameA(tempFileA);
3413 fodInfos->ofnInfos->nFileOffset = (lpszTemp - tempFileA);
3414
3415 /* set extension offset */
3416 lpszTemp = PathFindExtensionA(tempFileA);
3417 fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - tempFileA) + 1 : 0;
3418 }
3419
3420#ifdef __REACTOS__
3421 /* set the lpstrFileTitle */
3422 if(fodInfos->ofnInfos->lpstrFileTitle)
3423 {
3424 LPWSTR lpstrFileTitle = PathFindFileNameW(lpstrPathAndFile);
3425 if(fodInfos->unicode)
3426 {
3427 LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
3428 lstrcpynW(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle);
3429 }
3430 else
3431 {
3433 WideCharToMultiByte(CP_ACP, 0, lpstrFileTitle, -1,
3435 }
3436 }
3437#endif
3438
3439 /* copy currently selected filter to lpstrCustomFilter */
3440 if (fodInfos->ofnInfos->lpstrCustomFilter)
3441 {
3443 int len = WideCharToMultiByte(CP_ACP, 0, fodInfos->ShellInfos.lpstrCurrentFilter, -1,
3444 NULL, 0, NULL, NULL);
3446 {
3449 WideCharToMultiByte(CP_ACP, 0, fodInfos->ShellInfos.lpstrCurrentFilter, -1,
3450 s, len, NULL, NULL);
3451 }
3452 }
3453
3454
3455 if ( !FILEDLG95_SendFileOK(hwnd, fodInfos) )
3456 goto ret;
3457
3458 FILEDLG95_MRU_save_filename(lpstrPathAndFile);
3459#ifdef __REACTOS__
3460 FILEDLG95_MRU_save_ext(lpstrPathAndFile);
3461#endif
3462
3463 TRACE("close\n");
3465 ret = EndDialog(hwnd, TRUE);
3466 }
3467 else
3468 {
3469 WORD size;
3470
3471 size = lstrlenW(lpstrPathAndFile) + 1;
3472 if (fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT)
3473 size += 1;
3474 /* return needed size in first two bytes of lpstrFile */
3475 if(fodInfos->ofnInfos->lpstrFile)
3476 *(WORD *)fodInfos->ofnInfos->lpstrFile = size;
3478 ret = EndDialog(hwnd, FALSE);
3480 }
3481 }
3482 break;
3483 }
3484
3485ret:
3486 if(lpsf) IShellFolder_Release(lpsf);
3487 return ret;
3488}
static USHORT PathLength
#define FNERR_BUFFERTOOSMALL
Definition: cderr.h:37
#define ONOPEN_OPEN
Definition: cdlg.h:196
#define ONOPEN_BROWSE
Definition: cdlg.h:195
#define ONOPEN_SEARCH
Definition: cdlg.h:197
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
#define OFN_EXTENSIONDIFFERENT
Definition: commdlg.h:105
#define OFN_CREATEPROMPT
Definition: commdlg.h:97
#define OFN_NOVALIDATE
Definition: commdlg.h:115
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_ALLOWMULTISELECT
Definition: commdlg.h:96
void COMDLG32_GetCanonicalPath(PCIDLIST_ABSOLUTE pidlAbsCurrent, LPWSTR lpstrFile, LPWSTR lpstrPathAndFile)
Definition: filedlg.c:740
static void FILEDLG95_Clean(HWND hwnd)
Definition: filedlg.c:2169
int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf, HWND hwnd, DWORD flags, BOOL isSaveDlg, int defAction)
Definition: filedlg.c:2947
static int FILEDLG95_FILENAME_GetFileNames(HWND hwnd, LPWSTR *lpstrFileList, UINT *sizeUsed)
Definition: filedlg.c:4427
static BOOL BrowseSelectedFolder(HWND hwnd)
Definition: filedlg.c:4669
static BOOL FILEDLG95_SendFileOK(HWND hwnd, FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:2293
static BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCount, UINT sizeUsed)
Definition: filedlg.c:2330
static void FILEDLG95_MRU_save_filename(LPCWSTR filename)
Definition: filedlg.c:2515
static int FILEDLG95_FILETYPE_SearchExt(HWND hwnd, LPCWSTR lpstrExt)
Definition: filedlg.c:3769
#define wcschr
Definition: compat.h:17
HANDLE HWND
Definition: compat.h:19
static const WCHAR *const ext[]
Definition: module.c:53
LPSTR WINAPI PathFindExtensionA(const char *path)
Definition: path.c:1229
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1677
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
Definition: path.c:1250
char *WINAPI PathFindFileNameA(const char *path)
Definition: path.c:1660
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
#define IDS_CREATEFILE
#define IDS_OVERWRITEFILE
GLdouble s
Definition: gl.h:2039
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
char CHAR
Definition: pedump.c:57
#define CBEM_GETEDITCONTROL
Definition: commctrl.h:3838
#define MB_YESNO
Definition: winuser.h:828
#define WM_SETTEXT
Definition: winuser.h:1645
#define IDNO
Definition: winuser.h:847
#define BST_CHECKED
Definition: winuser.h:197
#define BM_GETCHECK
Definition: winuser.h:1947
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
DWORD nMaxCustFilter
Definition: commdlg.h:334
LPSTR lpstrFileTitle
Definition: commdlg.h:338
LPSTR lpstrCustomFilter
Definition: commdlg.h:333
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD nMaxFileTitle
Definition: commdlg.h:339
DWORD Flags
Definition: commdlg.h:342
DWORD nMaxFile
Definition: commdlg.h:337
WORD nFileExtension
Definition: commdlg.h:375
LPWSTR lpstrFile
Definition: commdlg.h:367
WORD nFileOffset
Definition: commdlg.h:374
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
LPWSTR lpstrCustomFilter
Definition: commdlg.h:364
DWORD nMaxFile
Definition: commdlg.h:368

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_OnOpenMessage()

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

Definition at line 2846 of file filedlg.c.

2847{
2848 WCHAR strMsgTitle[MAX_PATH];
2849 WCHAR strMsgText [MAX_PATH];
2850 if (idCaption)
2851 LoadStringW(COMDLG32_hInstance, idCaption, strMsgTitle, ARRAY_SIZE(strMsgTitle));
2852 else
2853 strMsgTitle[0] = '\0';
2854 LoadStringW(COMDLG32_hInstance, idText, strMsgText, ARRAY_SIZE(strMsgText));
2855 MessageBoxW(hwnd,strMsgText, strMsgTitle, MB_OK | MB_ICONHAND);
2856}
#define MB_ICONHAND
Definition: winuser.h:799

Referenced by FILEDLG95_ValidatePathAction().

◆ FILEDLG95_OnOpenMultipleFiles()

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

Definition at line 2330 of file filedlg.c.

2331{
2333 WCHAR lpstrPathSpec[MAX_PATH] = {0};
2334 UINT nCount, nSizePath;
2335
2336 TRACE("\n");
2337
2338 if(fodInfos->unicode)
2339 {
2340 LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
2341 ofn->lpstrFile[0] = '\0';
2342 }
2343 else
2344 {
2346 ofn->lpstrFile[0] = '\0';
2347 }
2348
2349 COMDLG32_GetDisplayNameOf( fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathSpec );
2350
2351 if ( !(fodInfos->ofnInfos->Flags & OFN_NOVALIDATE) &&
2352 ( fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST) &&
2353 ! ( fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG ) )
2354 {
2355 LPWSTR lpstrTemp = lpstrFileList;
2356
2357 for ( nCount = 0; nCount < nFileCount; nCount++ )
2358 {
2359 LPITEMIDLIST pidl;
2360
2361 pidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder, lpstrTemp);
2362 if (!pidl)
2363 {
2364 WCHAR lpstrNotFound[100];
2365 WCHAR lpstrMsg[100];
2366 WCHAR tmp[400];
2367
2368 LoadStringW(COMDLG32_hInstance, IDS_FILENOTFOUND, lpstrNotFound, 100);
2370
2371 lstrcpyW(tmp, lpstrTemp);
2372 lstrcatW(tmp, L"\n");
2373 lstrcatW(tmp, lpstrNotFound);
2374 lstrcatW(tmp, L"\n");
2375 lstrcatW(tmp, lpstrMsg);
2376
2377 MessageBoxW(hwnd, tmp, fodInfos->title, MB_OK | MB_ICONEXCLAMATION);
2378 return FALSE;
2379 }
2380
2381 /* move to the next file in the list of files */
2382 lpstrTemp += lstrlenW(lpstrTemp) + 1;
2383 ILFree(pidl);
2384 }
2385 }
2386
2387 nSizePath = lstrlenW(lpstrPathSpec) + 1;
2388 if ( !(fodInfos->ofnInfos->Flags & OFN_EXPLORER) )
2389 {
2390 /* For "oldstyle" dialog the components have to
2391 be separated by blanks (not '\0'!) and short
2392 filenames have to be used! */
2393 FIXME("Components have to be separated by blanks\n");
2394 }
2395 if(fodInfos->unicode)
2396 {
2397 LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
2398 lstrcpyW( ofn->lpstrFile, lpstrPathSpec);
2399 memcpy( ofn->lpstrFile + nSizePath, lpstrFileList, sizeUsed*sizeof(WCHAR) );
2400 }
2401 else
2402 {
2404
2405 if (ofn->lpstrFile != NULL)
2406 {
2407 nSizePath = WideCharToMultiByte(CP_ACP, 0, lpstrPathSpec, -1,
2409 if (ofn->nMaxFile > nSizePath)
2410 {
2411 WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
2412 ofn->lpstrFile + nSizePath,
2413 ofn->nMaxFile - nSizePath, NULL, NULL);
2414 }
2415 }
2416 }
2417
2418 fodInfos->ofnInfos->nFileOffset = nSizePath;
2419 fodInfos->ofnInfos->nFileExtension = 0;
2420
2421 if ( !FILEDLG95_SendFileOK(hwnd, fodInfos) )
2422 return FALSE;
2423
2424 /* clean and exit */
2426 return EndDialog(hwnd,TRUE);
2427}
#define IDS_FILENOTFOUND
#define IDS_VERIFYFILE

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_OnWMCommand()

static LRESULT FILEDLG95_OnWMCommand ( HWND  hwnd,
WPARAM  wParam 
)
static

Definition at line 2194 of file filedlg.c.

2195{
2197 WORD wNotifyCode = HIWORD(wParam); /* notification code */
2198 WORD id = LOWORD(wParam); /* item, control, or accelerator identifier */
2199
2200 switch (id)
2201 {
2202 /* OK button */
2203 case IDOK:
2205 break;
2206 /* Cancel button */
2207 case IDCANCEL:
2210 break;
2211 /* Filetype combo box */
2212 case IDC_FILETYPE:
2214 break;
2215 /* LookIn combo box */
2216 case IDC_LOOKIN:
2217 FILEDLG95_LOOKIN_OnCommand(hwnd,wNotifyCode);
2218 break;
2219
2220 /* --- toolbar --- */
2221 /* Up folder button */
2222 case FCIDM_TB_UPFOLDER:
2224 break;
2225 /* New folder button */
2226 case FCIDM_TB_NEWFOLDER:
2227 FILEDLG95_SHELL_ExecuteCommand(hwnd,CMDSTR_NEWFOLDERA);
2228 break;
2229 /* List option button */
2230 case FCIDM_TB_SMALLICON:
2231 FILEDLG95_SHELL_ExecuteCommand(hwnd,CMDSTR_VIEWLISTA);
2232 break;
2233 /* Details option button */
2235 FILEDLG95_SHELL_ExecuteCommand(hwnd,CMDSTR_VIEWDETAILSA);
2236 break;
2237
2238 case FCIDM_TB_DESKTOP:
2239 {
2240 LPITEMIDLIST pidl;
2241
2243 filedlg_browse_to_pidl(fodInfos, pidl);
2244 ILFree(pidl);
2245 break;
2246 }
2247
2248 /* Places bar */
2254 filedlg_browse_to_pidl(fodInfos, fodInfos->places[id - TBPLACES_CMDID_PLACE0]);
2255 break;
2256
2257 case edt1:
2258 case cmb13:
2259 break;
2260
2261 }
2262 /* Do not use the listview selection anymore */
2263 fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
2264 return 0;
2265}
#define TBPLACES_CMDID_PLACE1
Definition: filedlg.c:201
#define TBPLACES_CMDID_PLACE3
Definition: filedlg.c:203
static BOOL FILEDLG95_SHELL_ExecuteCommand(HWND hwnd, LPCSTR lpVerb)
Definition: filedlg.c:3530
static void filedlg_browse_to_pidl(const FileOpenDlgInfos *info, LPITEMIDLIST pidl)
Definition: filedlg.c:2180
#define TBPLACES_CMDID_PLACE4
Definition: filedlg.c:204
static BOOL FILEDLG95_SHELL_UpFolder(HWND hwnd)
Definition: filedlg.c:3561
#define TBPLACES_CMDID_PLACE2
Definition: filedlg.c:202
static BOOL FILEDLG95_LOOKIN_OnCommand(HWND hwnd, WORD wNotifyCode)
Definition: filedlg.c:4022
static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode)
Definition: filedlg.c:3724
static BOOL FILEDLG95_OnOpen(HWND hwnd)
Definition: filedlg.c:3092
#define LOWORD(l)
Definition: pedump.c:82
#define HIWORD(l)
Definition: typedefs.h:247

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_OnWMGetIShellBrowser()

static LRESULT FILEDLG95_OnWMGetIShellBrowser ( HWND  hwnd)
static

Definition at line 2272 of file filedlg.c.

2273{
2275
2276 TRACE("\n");
2277
2278 SetWindowLongPtrW(hwnd,DWLP_MSGRESULT,(LONG_PTR)fodInfos->Shell.FOIShellBrowser);
2279
2280 return TRUE;
2281}
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_OnWMGetMMI()

static LRESULT FILEDLG95_OnWMGetMMI ( HWND  hwnd,
LPMINMAXINFO  mmiptr 
)
static

Definition at line 1256 of file filedlg.c.

1257{
1259 if( !(fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)) return FALSE;
1260 if( fodInfos->initial_size.x || fodInfos->initial_size.y)
1261 {
1262 mmiptr->ptMinTrackSize = fodInfos->initial_size;
1263 }
1264 return TRUE;
1265}
#define OFN_ENABLESIZING
Definition: commdlg.h:101
long y
Definition: dcommon.idl:24
long x
Definition: dcommon.idl:24
POINT ptMinTrackSize
Definition: winuser.h:3738

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_OnWMSize()

static LRESULT FILEDLG95_OnWMSize ( HWND  hwnd,
WPARAM  wParam 
)
static

Definition at line 1277 of file filedlg.c.

1278{
1279 RECT rc, rcview;
1280 int chgx, chgy;
1281 HWND ctrl;
1282 HDWP hdwp;
1283 FileOpenDlgInfos *fodInfos;
1284
1285 if( wParam != SIZE_RESTORED) return FALSE;
1286 fodInfos = get_filedlg_infoptr(hwnd);
1287 if( !(fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)) return FALSE;
1288 /* get the new dialog rectangle */
1289 GetWindowRect( hwnd, &rc);
1290 TRACE("%p, size from %ld,%ld to %ld,%ld\n", hwnd, fodInfos->sizedlg.cx, fodInfos->sizedlg.cy,
1291 rc.right -rc.left, rc.bottom -rc.top);
1292 /* not initialized yet */
1293 if( (fodInfos->sizedlg.cx == 0 && fodInfos->sizedlg.cy == 0) ||
1294 ((fodInfos->sizedlg.cx == rc.right -rc.left) && /* no change */
1295 (fodInfos->sizedlg.cy == rc.bottom -rc.top)))
1296 return FALSE;
1297 chgx = rc.right - rc.left - fodInfos->sizedlg.cx;
1298 chgy = rc.bottom - rc.top - fodInfos->sizedlg.cy;
1299 fodInfos->sizedlg.cx = rc.right - rc.left;
1300 fodInfos->sizedlg.cy = rc.bottom - rc.top;
1301 /* change the size of the view window */
1302 GetWindowRect( fodInfos->ShellInfos.hwndView, &rcview);
1303 MapWindowPoints( NULL, hwnd, (LPPOINT) &rcview, 2);
1304 hdwp = BeginDeferWindowPos( 10);
1305 DeferWindowPos( hdwp, fodInfos->ShellInfos.hwndView, NULL, 0, 0,
1306 rcview.right - rcview.left + chgx,
1307 rcview.bottom - rcview.top + chgy,
1309 /* change position and sizes of the controls */
1311 {
1312 int ctrlid = GetDlgCtrlID( ctrl);
1313 GetWindowRect( ctrl, &rc);
1314 MapWindowPoints( NULL, hwnd, (LPPOINT) &rc, 2);
1315 if( ctrl == fodInfos->DlgInfos.hwndGrip)
1316 {
1317 DeferWindowPos( hdwp, ctrl, NULL, rc.left + chgx, rc.top + chgy,
1318 0, 0,
1320 }
1321 else if( rc.top > rcview.bottom)
1322 {
1323 /* if it was below the shell view
1324 * move to bottom */
1325 switch( ctrlid)
1326 {
1327 /* file name (edit or comboboxex) and file types combo change also width */
1328 case edt1:
1329 case cmb13:
1330 case cmb1:
1331 DeferWindowPos( hdwp, ctrl, NULL, rc.left, rc.top + chgy,
1332 rc.right - rc.left + chgx, rc.bottom - rc.top,
1334 break;
1335 /* then these buttons must move out of the way */
1336 case IDOK:
1337 case IDCANCEL:
1338 case pshHelp:
1339 DeferWindowPos( hdwp, ctrl, NULL, rc.left + chgx, rc.top + chgy,
1340 0, 0,
1342 break;
1343 default:
1344 DeferWindowPos( hdwp, ctrl, NULL, rc.left, rc.top + chgy,
1345 0, 0,
1347 }
1348 }
1349 else if( rc.left > rcview.right)
1350 {
1351 /* if it was to the right of the shell view
1352 * move to right */
1353 DeferWindowPos( hdwp, ctrl, NULL, rc.left + chgx, rc.top,
1354 0, 0,
1356 }
1357 else
1358 /* special cases */
1359 {
1360 switch( ctrlid)
1361 {
1362#if 0 /* this is Win2k, Win XP. Vista and Higher don't move/size these controls */
1363 case IDC_LOOKIN:
1364 DeferWindowPos( hdwp, ctrl, NULL, 0, 0,
1365 rc.right - rc.left + chgx, rc.bottom - rc.top,
1367 break;
1368 case IDC_TOOLBARSTATIC:
1369 case IDC_TOOLBAR:
1370 DeferWindowPos( hdwp, ctrl, NULL, rc.left + chgx, rc.top,
1371 0, 0,
1373 break;
1374#endif
1375 /* not resized in windows. Since wine uses this invisible control
1376 * to size the browser view it needs to be resized */
1377 case IDC_SHELLSTATIC:
1378 DeferWindowPos( hdwp, ctrl, NULL, 0, 0,
1379 rc.right - rc.left + chgx,
1380 rc.bottom - rc.top + chgy,
1382 break;
1383 case IDC_TOOLBARPLACES:
1384 DeferWindowPos( hdwp, ctrl, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top + chgy,
1386 break;
1387 }
1388 }
1389 }
1390 if(fodInfos->DlgInfos.hwndCustomDlg &&
1392 {
1393 for( ctrl = GetWindow( fodInfos->DlgInfos.hwndCustomDlg, GW_CHILD);
1395 {
1396 GetWindowRect( ctrl, &rc);
1397 MapWindowPoints( NULL, hwnd, (LPPOINT) &rc, 2);
1398 if( rc.top > rcview.bottom)
1399 {
1400 /* if it was below the shell view
1401 * move to bottom */
1402 DeferWindowPos( hdwp, ctrl, NULL, rc.left, rc.top + chgy,
1403 rc.right - rc.left, rc.bottom - rc.top,
1405 }
1406 else if( rc.left > rcview.right)
1407 {
1408 /* if it was to the right of the shell view
1409 * move to right */
1410 DeferWindowPos( hdwp, ctrl, NULL, rc.left + chgx, rc.top,
1411 rc.right - rc.left, rc.bottom - rc.top,
1413 }
1414 }
1415 /* size the custom dialog at the end: some applications do some
1416 * control re-arranging at this point */
1417 GetClientRect(hwnd, &rc);
1418 DeferWindowPos( hdwp,fodInfos->DlgInfos.hwndCustomDlg, NULL,
1420 }
1421 EndDeferWindowPos( hdwp);
1422 /* should not be needed */
1424 return TRUE;
1425}
#define cmb1
Definition: dlgs.h:53
#define IDC_SHELLSTATIC
#define ctrl
Definition: input.c:3281
#define SWP_NOACTIVATE
Definition: winuser.h:1253
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
#define RDW_ALLCHILDREN
Definition: winuser.h:1232
#define SIZE_RESTORED
Definition: winuser.h:2541
int WINAPI GetDlgCtrlID(_In_ HWND)
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define RDW_INVALIDATE
Definition: winuser.h:1225
HDWP WINAPI BeginDeferWindowPos(_In_ int)
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_ResizeControls()

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

Definition at line 2077 of file filedlg.c.

2078{
2080
2081 if (fodInfos->DlgInfos.hwndCustomDlg)
2082 {
2083 RECT rc;
2085
2086 ArrangeCtrlPositions(fodInfos->DlgInfos.hwndCustomDlg, hwnd,
2087 filedialog_is_readonly_hidden(fodInfos) && !(fodInfos->ofnInfos->Flags & OFN_SHOWHELP));
2088
2089 /* resize the custom dialog to the parent size */
2091 GetClientRect(hwnd, &rc);
2092 else
2093 {
2094 /* our own fake template is zero sized and doesn't have children, so
2095 * there is no need to resize it. Picasa depends on it.
2096 */
2097 flags |= SWP_NOSIZE;
2098 SetRectEmpty(&rc);
2099 }
2100 SetWindowPos(fodInfos->DlgInfos.hwndCustomDlg, HWND_BOTTOM,
2101 0, 0, rc.right, rc.bottom, flags);
2102 }
2103 else
2104 {
2105 /* Resize the height; if opened as read-only, checkbox and help button are
2106 * hidden and we are not using a custom template nor a customDialog
2107 */
2108 if (filedialog_is_readonly_hidden(fodInfos) &&
2109 (!(fodInfos->ofnInfos->Flags &
2111 {
2112 RECT rectDlg, rectHelp, rectCancel;
2113 GetWindowRect(hwnd, &rectDlg);
2114 GetWindowRect(GetDlgItem(hwnd, pshHelp), &rectHelp);
2115 GetWindowRect(GetDlgItem(hwnd, IDCANCEL), &rectCancel);
2116 /* subtract the height of the help button plus the space between the help
2117 * button and the cancel button to the height of the dialog
2118 */
2119 SetWindowPos(hwnd, 0, 0, 0, rectDlg.right-rectDlg.left,
2120 (rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom),
2122 }
2123 }
2124 return TRUE;
2125}
static void ArrangeCtrlPositions(HWND hwndChildDlg, HWND hwndParentDlg, BOOL hide_help)
Definition: filedlg.c:828
GLbitfield flags
Definition: glext.h:7161
#define HWND_BOTTOM
Definition: winuser.h:1216

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_SendFileOK()

static BOOL FILEDLG95_SendFileOK ( HWND  hwnd,
FileOpenDlgInfos *  fodInfos 
)
static

Definition at line 2293 of file filedlg.c.

2294{
2295 /* ask the hook if we can close */
2296 if (is_dialog_hooked(fodInfos))
2297 {
2298 LRESULT retval = 0;
2299
2300 TRACE("---\n");
2301 /* First send CDN_FILEOK as MSDN doc says */
2302 if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
2304 if( retval)
2305 {
2306 TRACE("canceled\n");
2307 return FALSE;
2308 }
2309
2310 /* fodInfos->ofnInfos points to an ASCII or UNICODE structure as appropriate */
2311 retval = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,
2312 fodInfos->HookMsg.fileokstring, 0, (LPARAM)fodInfos->ofnInfos);
2313 if( retval)
2314 {
2315 TRACE("canceled\n");
2316 return FALSE;
2317 }
2318 }
2319 return TRUE;
2320}
#define CDN_FILEOK
Definition: commdlg.h:38
LONG_PTR LRESULT
Definition: minwindef.h:176
struct FileOpenDlgInfos::@434 HookMsg

Referenced by FILEDLG95_OnOpen(), and FILEDLG95_OnOpenMultipleFiles().

◆ FILEDLG95_SHELL_Clean()

static void FILEDLG95_SHELL_Clean ( HWND  hwnd)
static

Definition at line 3582 of file filedlg.c.

3583{
3585
3586 TRACE("\n");
3587
3588 ILFree(fodInfos->ShellInfos.pidlAbsCurrent);
3589
3590 /* clean Shell interfaces */
3591 if (fodInfos->Shell.FOIShellView)
3592 {
3593 IShellView_DestroyViewWindow(fodInfos->Shell.FOIShellView);
3594 IShellView_Release(fodInfos->Shell.FOIShellView);
3595 }
3596 if (fodInfos->Shell.FOIShellFolder)
3597 IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
3598 IShellBrowser_Release(fodInfos->Shell.FOIShellBrowser);
3599 if (fodInfos->Shell.FOIDataObject)
3600 IDataObject_Release(fodInfos->Shell.FOIDataObject);
3601}

Referenced by FILEDLG95_Clean().

◆ FILEDLG95_SHELL_ExecuteCommand()

static BOOL FILEDLG95_SHELL_ExecuteCommand ( HWND  hwnd,
LPCSTR  lpVerb 
)
static

Definition at line 3530 of file filedlg.c.

3531{
3533 IContextMenu * pcm;
3534
3535 TRACE("(%p,%p)\n", hwnd, lpVerb);
3536
3537 if(SUCCEEDED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView,
3538 SVGIO_BACKGROUND,
3539 &IID_IContextMenu,
3540 (LPVOID*)&pcm)))
3541 {
3542 CMINVOKECOMMANDINFO ci;
3543 ZeroMemory(&ci, sizeof(CMINVOKECOMMANDINFO));
3544 ci.cbSize = sizeof(CMINVOKECOMMANDINFO);
3545 ci.lpVerb = lpVerb;
3546 ci.hwnd = hwnd;
3547
3548 IContextMenu_InvokeCommand(pcm, &ci);
3549 IContextMenu_Release(pcm);
3550 }
3551
3552 return FALSE;
3553}
#define ZeroMemory
Definition: minwinbase.h:31

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_SHELL_Init()

static LRESULT FILEDLG95_SHELL_Init ( HWND  hwnd)
static

Definition at line 3495 of file filedlg.c.

3496{
3498
3499 TRACE("%p\n", hwnd);
3500
3501 /*
3502 * Initialisation of the FileOpenDialogInfos structure
3503 */
3504
3505 /* Shell */
3506
3507 /*ShellInfos */
3508 fodInfos->ShellInfos.hwndOwner = hwnd;
3509
3510 /* Disable multi-select if flag not set */
3511 if (!(fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT))
3512 {
3513 fodInfos->ShellInfos.folderSettings.fFlags |= FWF_SINGLESEL;
3514 }
3515 fodInfos->ShellInfos.folderSettings.fFlags |= FWF_AUTOARRANGE | FWF_ALIGNLEFT;
3516 fodInfos->ShellInfos.folderSettings.ViewMode = FVM_LIST;
3517
3518 /* Construct the IShellBrowser interface */
3519 fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd);
3520
3521 return NOERROR;
3522}
static IShellBrowser * IShellBrowserImpl_Construct(void)
Definition: shlview.c:278
@ FWF_AUTOARRANGE
Definition: shobjidl.idl:687
@ FWF_ALIGNLEFT
Definition: shobjidl.idl:698
@ FWF_SINGLESEL
Definition: shobjidl.idl:693
@ FVM_LIST
Definition: shobjidl.idl:727

Referenced by FILEDLG95_FillControls().

◆ FILEDLG95_SHELL_UpFolder()

static BOOL FILEDLG95_SHELL_UpFolder ( HWND  hwnd)
static

Definition at line 3561 of file filedlg.c.

3562{
3564
3565 TRACE("\n");
3566
3567 if(SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
3568 NULL,
3569 SBSP_PARENT)))
3570 {
3571 if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3573 return TRUE;
3574 }
3575 return FALSE;
3576}

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_unixfs_is_rooted_at_desktop()

static BOOL FILEDLG95_unixfs_is_rooted_at_desktop ( void  )
inlinestatic

Definition at line 3825 of file filedlg.c.

3825 {
3826 HKEY hKey;
3827
3829 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace\\"
3830 "{9D20AAE8-0625-44B0-9CA7-71889C2254D9}", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
3831 return FALSE;
3832
3834 return TRUE;
3835}
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
FxAutoRegKey hKey
#define KEY_READ
Definition: nt_native.h:1026
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by FILEDLG95_LOOKIN_Init().

◆ FILEDLG95_ValidatePathAction()

int FILEDLG95_ValidatePathAction ( LPWSTR  lpstrPathAndFile,
IShellFolder **  ppsf,
HWND  hwnd,
DWORD  flags,
BOOL  isSaveDlg,
int  defAction 
)

Definition at line 2947 of file filedlg.c.

2950{
2951 int nOpenAction = defAction;
2952 LPWSTR lpszTemp, lpszTemp1;
2953 LPITEMIDLIST pidl = NULL;
2954
2955 /* check for invalid chars */
2956 if((wcspbrk(lpstrPathAndFile+3, L"/:<>|") != NULL) && !(flags & OFN_NOVALIDATE))
2957 {
2959 return FALSE;
2960 }
2961
2962 if (FAILED (SHGetDesktopFolder(ppsf))) return FALSE;
2963
2964 lpszTemp1 = lpszTemp = lpstrPathAndFile;
2965 while (lpszTemp1)
2966 {
2967 LPSHELLFOLDER lpsfChild;
2968 WCHAR lpwstrTemp[MAX_PATH];
2969 DWORD dwEaten, dwAttributes;
2970 LPWSTR p;
2971
2972 lstrcpyW(lpwstrTemp, lpszTemp);
2973 if (lpszTemp == lpstrPathAndFile && (p = PathSkipRootW(lpwstrTemp)))
2974 {
2975 *p = 0;
2976 }
2977 else
2978 {
2979 p = PathFindNextComponentW(lpwstrTemp);
2980 if (!p) break; /* end of path */
2981 *p = 0;
2982 }
2983 lpszTemp = lpszTemp + lstrlenW(lpwstrTemp);
2984
2985 /* There are no wildcards when OFN_NOVALIDATE is set */
2986 if(*lpszTemp==0 && !(flags & OFN_NOVALIDATE))
2987 {
2988 /* if the last element is a wildcard do a search */
2989 if(wcspbrk(lpszTemp1, L"*?") != NULL)
2990 {
2991 nOpenAction = ONOPEN_SEARCH;
2992 break;
2993 }
2994 }
2995 lpszTemp1 = lpszTemp;
2996
2997 TRACE("parse now=%s next=%s sf=%p\n",debugstr_w(lpwstrTemp), debugstr_w(lpszTemp), *ppsf);
2998
2999 /* append a backslash to drive letters */
3000 if(lstrlenW(lpwstrTemp)==2 && lpwstrTemp[1] == ':' &&
3001 ((lpwstrTemp[0] >= 'a' && lpwstrTemp[0] <= 'z') ||
3002 (lpwstrTemp[0] >= 'A' && lpwstrTemp[0] <= 'Z')))
3003 {
3004 PathAddBackslashW(lpwstrTemp);
3005 }
3006
3007#ifdef __REACTOS__
3008 dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSANCESTOR;
3009#else
3010 dwAttributes = SFGAO_FOLDER;
3011#endif
3012 if(SUCCEEDED(IShellFolder_ParseDisplayName(*ppsf, hwnd, NULL, lpwstrTemp, &dwEaten, &pidl, &dwAttributes)))
3013 {
3014 /* the path component is valid, we have a pidl of the next path component */
3015 TRACE("parse OK attr=0x%08lx pidl=%p\n", dwAttributes, pidl);
3016#ifdef __REACTOS__
3017 if((dwAttributes & (SFGAO_FOLDER | SFGAO_FILESYSANCESTOR)) == (SFGAO_FOLDER | SFGAO_FILESYSANCESTOR))
3018#else
3019 if(dwAttributes & SFGAO_FOLDER)
3020#endif
3021 {
3022 if(FAILED(IShellFolder_BindToObject(*ppsf, pidl, 0, &IID_IShellFolder, (LPVOID*)&lpsfChild)))
3023 {
3024 ERR("bind to failed\n"); /* should not fail */
3025 break;
3026 }
3027 IShellFolder_Release(*ppsf);
3028 *ppsf = lpsfChild;
3029 lpsfChild = NULL;
3030 }
3031 else
3032 {
3033 TRACE("value\n");
3034
3035 /* end dialog, return value */
3036 nOpenAction = ONOPEN_OPEN;
3037 break;
3038 }
3039 ILFree(pidl);
3040 pidl = NULL;
3041 }
3042 else if (!(flags & OFN_NOVALIDATE))
3043 {
3044 if(*lpszTemp || /* points to trailing null for last path element */
3045 (lpwstrTemp[lstrlenW(lpwstrTemp)-1] == '\\')) /* or if last element ends in '\' */
3046 {
3048 {
3050 break;
3051 }
3052 }
3053 else
3054 {
3055 if( (flags & OFN_FILEMUSTEXIST) && !isSaveDlg )
3056 {
3057#ifdef __REACTOS__
3058 FILEDLG95_AddDotExtIfNeeded(fodInfos, lpstrPathAndFile);
3059 if (!PathFileExistsW(lpstrPathAndFile))
3060 {
3062 break;
3063 }
3064#else
3066 break;
3067#endif
3068 }
3069 }
3070 /* change to the current folder */
3071 nOpenAction = ONOPEN_OPEN;
3072 break;
3073 }
3074 else
3075 {
3076 nOpenAction = ONOPEN_OPEN;
3077 break;
3078 }
3079 }
3080 ILFree(pidl);
3081
3082 return nOpenAction;
3083}
#define ERR(fmt,...)
Definition: precomp.h:57
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText)
Definition: filedlg.c:2846
WCHAR *WINAPI PathSkipRootW(const WCHAR *path)
Definition: path.c:2269
WCHAR *WINAPI PathFindNextComponentW(const WCHAR *path)
Definition: path.c:2224
#define IShellFolder_ParseDisplayName
Definition: utils.cpp:14
#define IDS_INVALID_FILENAME_TITLE
#define IDS_FILENOTEXISTING
#define IDS_INVALID_FILENAME
DWORD dwAttributes
Definition: vdmdbg.h:34

Referenced by FILEDLG95_OnOpen().

◆ filedlg_browse_to_pidl()

static void filedlg_browse_to_pidl ( const FileOpenDlgInfos *  info,
LPITEMIDLIST  pidl 
)
static

Definition at line 2180 of file filedlg.c.

2181{
2182 TRACE("%p, %p\n", info->ShellInfos.hwndOwner, pidl);
2183
2184 IShellBrowser_BrowseObject(info->Shell.FOIShellBrowser, pidl, SBSP_ABSOLUTE);
2185 if (info->ofnInfos->Flags & OFN_EXPLORER)
2187}

Referenced by FILEDLG95_OnWMCommand().

◆ filedlg_collect_places_pidls()

static void filedlg_collect_places_pidls ( FileOpenDlgInfos *  fodInfos)
static

Definition at line 365 of file filedlg.c.

366{
367 static const int default_places[] =
368 {
369#ifdef __REACTOS__
375#else
379#endif
380 };
381 unsigned int i;
382 HKEY hkey;
383
384 if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Comdlg32\\Placesbar",
385 &hkey))
386 {
387 for (i = 0; i < ARRAY_SIZE(fodInfos->places); i++)
388 {
389 WCHAR nameW[8];
390 DWORD value;
391 HRESULT hr;
392 WCHAR *str;
393
394 swprintf(nameW, ARRAY_SIZE(nameW), L"Place%d", i);
395 if (get_config_key_dword(hkey, nameW, &value))
396 {
398 if (FAILED(hr))
399 WARN("Unrecognized special folder %lu.\n", value);
400 }
401 else if (get_config_key_string(hkey, nameW, &str))
402 {
403 hr = SHParseDisplayName(str, NULL, &fodInfos->places[i], 0, NULL);
404 if (FAILED(hr))
405 WARN("Failed to parse custom places location, %s.\n", debugstr_w(str));
406 heap_free(str);
407 }
408 }
409
410 /* FIXME: eliminate duplicates. */
411
412 RegCloseKey(hkey);
413 return;
414 }
415
416 for (i = 0; i < ARRAY_SIZE(default_places); i++)
417 SHGetSpecialFolderLocation(NULL, default_places[i], &fodInfos->places[i]);
418}
static const WCHAR nameW[]
Definition: main.c:49
HRESULT hr
Definition: delayimp.cpp:582
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
static BOOL get_config_key_dword(HKEY hkey, const WCHAR *name, DWORD *value)
Definition: filedlg.c:309
static BOOL get_config_key_string(HKEY hkey, const WCHAR *name, WCHAR **value)
Definition: filedlg.c:323
#define swprintf
Definition: precomp.h:40
HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut)
Definition: pidl.c:1548
const WCHAR * str
#define CSIDL_RECENT
Definition: shlobj.h:2199
#define CSIDL_MYDOCUMENTS
Definition: shlobj.h:2203
#define CSIDL_NETWORK
Definition: shlobj.h:2208
Definition: pdh_main.c:64

Referenced by FILEDLG95_InitControls().

◆ filename_is_edit()

static BOOL filename_is_edit ( const FileOpenDlgInfos *  info)
inlinestatic

Definition at line 1650 of file filedlg.c.

1651{
1652 return (info->ofnInfos->lStructSize == OPENFILENAME_SIZE_VERSION_400W) &&
1654}
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define OPENFILENAME_SIZE_VERSION_400W
Definition: commdlg.h:397

Referenced by FILEDLG95_FILENAME_FillFromSelection(), FILEDLG95_InitControls(), and FILEDLG95_OnOpen().

◆ FileOpenDlgProc95()

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

Definition at line 1432 of file filedlg.c.

1433{
1434#if 0
1435 TRACE("%p 0x%04x\n", hwnd, uMsg);
1436#endif
1437
1438 switch(uMsg)
1439 {
1440 case WM_INITDIALOG:
1441 {
1443 RECT rc, rcstc;
1444 int gripx = GetSystemMetrics( SM_CYHSCROLL);
1445 int gripy = GetSystemMetrics( SM_CYVSCROLL);
1446
1447 /* Some shell namespace extensions depend on COM being initialized. */
1449 fodInfos->ole_initialized = TRUE;
1450
1451 SetPropW(hwnd, L"FileOpenDlgInfos", fodInfos);
1452
1454
1455 if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
1456 {
1458 DWORD ex_style = GetWindowLongW(hwnd, GWL_EXSTYLE);
1459 RECT client, client_adjusted;
1460
1461 if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
1462 {
1463 style |= WS_SIZEBOX;
1464 ex_style |= WS_EX_WINDOWEDGE;
1465 }
1466 else
1467 style &= ~WS_SIZEBOX;
1469 SetWindowLongW(hwnd, GWL_EXSTYLE, ex_style);
1470
1472 GetClientRect( hwnd, &client_adjusted );
1473 AdjustWindowRectEx( &client_adjusted, style, FALSE, ex_style );
1474
1475 GetWindowRect( hwnd, &rc );
1476 rc.right += client_adjusted.right - client.right;
1477 rc.bottom += client_adjusted.bottom - client.bottom;
1478 SetWindowPos(hwnd, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_FRAMECHANGED | SWP_NOACTIVATE |
1480
1481 GetWindowRect( hwnd, &rc );
1482 fodInfos->DlgInfos.hwndGrip =
1483 CreateWindowExA( 0, "SCROLLBAR", NULL,
1486 rc.right - gripx, rc.bottom - gripy,
1487 gripx, gripy, hwnd, (HMENU) -1, COMDLG32_hInstance, NULL);
1488 }
1489
1490 fodInfos->DlgInfos.hwndCustomDlg =
1492
1495
1496 if( fodInfos->DlgInfos.hwndCustomDlg)
1497 ShowWindow( fodInfos->DlgInfos.hwndCustomDlg, SW_SHOW);
1498
1499 if(fodInfos->ofnInfos->Flags & OFN_EXPLORER) {
1502 }
1503
1504 /* if the app has changed the position of the invisible listbox,
1505 * change that of the listview (browser) as well */
1506 GetWindowRect( fodInfos->ShellInfos.hwndView, &rc);
1508 if( !EqualRect( &rc, &rcstc))
1509 {
1510 MapWindowPoints( NULL, hwnd, (LPPOINT) &rcstc, 2);
1511 SetWindowPos( fodInfos->ShellInfos.hwndView, NULL,
1512 rcstc.left, rcstc.top, rcstc.right - rcstc.left, rcstc.bottom - rcstc.top,
1514 }
1515
1516 if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
1517 {
1518 GetWindowRect( hwnd, &rc);
1519 fodInfos->sizedlg.cx = rc.right - rc.left;
1520 fodInfos->sizedlg.cy = rc.bottom - rc.top;
1521 fodInfos->initial_size.x = fodInfos->sizedlg.cx;
1522 fodInfos->initial_size.y = fodInfos->sizedlg.cy;
1523 GetClientRect( hwnd, &rc);
1524 SetWindowPos( fodInfos->DlgInfos.hwndGrip, NULL,
1525 rc.right - gripx, rc.bottom - gripy,
1527 /* resize the dialog to the previous invocation */
1532 }
1533
1534 if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
1536
1537#ifdef __REACTOS__
1538 /* Enable hook and translate */
1539 EnterCriticalSection(&COMDLG32_OpenFileLock);
1540 if (++s_nFileDialogHookCount == 1)
1541 {
1542 s_hFileDialogHook = SetWindowsHookEx(WH_MSGFILTER, FILEDLG95_TranslateMsgProc,
1543 0, GetCurrentThreadId());
1544 }
1545 FILEDLG95_AddRemoveTranslate(NULL, hwnd);
1546 LeaveCriticalSection(&COMDLG32_OpenFileLock);
1547#endif
1548 return 0;
1549 }
1550 case WM_SIZE:
1552 case WM_GETMINMAXINFO:
1554 case WM_COMMAND:
1556 case WM_DRAWITEM:
1557 {
1558 switch(((LPDRAWITEMSTRUCT)lParam)->CtlID)
1559 {
1560 case IDC_LOOKIN:
1562 return TRUE;
1563 }
1564 }
1565 return FALSE;
1566
1569
1570 case WM_DESTROY:
1571 {
1573 HWND places_bar = GetDlgItem(hwnd, IDC_TOOLBARPLACES);
1575
1576 if (fodInfos && fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
1577 MemDialogSize = fodInfos->sizedlg;
1578
1579 if (places_bar)
1580 {
1584 }
1585#ifdef __REACTOS__
1586 /* Disable hook and translate */
1587 EnterCriticalSection(&COMDLG32_OpenFileLock);
1588 FILEDLG95_AddRemoveTranslate(hwnd, NULL);
1589 if (--s_nFileDialogHookCount == 0)
1590 {
1591 UnhookWindowsHookEx(s_hFileDialogHook);
1592 s_hFileDialogHook = NULL;
1593 }
1594 LeaveCriticalSection(&COMDLG32_OpenFileLock);
1596#endif
1597 return FALSE;
1598 }
1599
1600 case WM_NCDESTROY:
1601 RemovePropW(hwnd, L"FileOpenDlgInfos");
1602 return 0;
1603
1604 case WM_NOTIFY:
1605 {
1606 LPNMHDR lpnmh = (LPNMHDR)lParam;
1607 UINT stringId = -1;
1608
1609 /* set up the button tooltips strings */
1610 if(TTN_GETDISPINFOA == lpnmh->code )
1611 {
1613 switch(lpnmh->idFrom )
1614 {
1615 /* Up folder button */
1616 case FCIDM_TB_UPFOLDER:
1617 stringId = IDS_UPFOLDER;
1618 break;
1619 /* New folder button */
1620 case FCIDM_TB_NEWFOLDER:
1621 stringId = IDS_NEWFOLDER;
1622 break;
1623 /* List option button */
1624 case FCIDM_TB_SMALLICON:
1625 stringId = IDS_LISTVIEW;
1626 break;
1627 /* Details option button */
1629 stringId = IDS_REPORTVIEW;
1630 break;
1631 /* Desktop button */
1632 case FCIDM_TB_DESKTOP:
1633 stringId = IDS_TODESKTOP;
1634 break;
1635 default:
1636 stringId = 0;
1637 }
1638 lpdi->hinst = COMDLG32_hInstance;
1639 lpdi->lpszText = MAKEINTRESOURCEA(stringId);
1640 }
1641 return FALSE;
1642 }
1643 default :
1644 if(uMsg >= CDM_FIRST && uMsg <= CDM_LAST)
1646 return FALSE;
1647 }
1648}
EXTERN_C HRESULT DoReleaseAutoCompleteWithCWD(FileOpenDlgInfos *pInfo)
Definition: autocomp.cpp:94
#define CDN_INITDONE
Definition: commdlg.h:33
#define CDN_SELCHANGE
Definition: commdlg.h:34
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:941
static SIZE MemDialogSize
Definition: filedlg.c:216
static LRESULT FILEDLG95_ResizeControls(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:2077
static LRESULT FILEDLG95_LOOKIN_DrawItem(HWND hwnd, LPDRAWITEMSTRUCT pDIStruct)
Definition: filedlg.c:3922
static LRESULT FILEDLG95_OnWMSize(HWND hwnd, WPARAM wParam)
Definition: filedlg.c:1277
#define WM_GETISHELLBROWSER
Definition: filedlg.c:198
static LRESULT FILEDLG95_OnWMGetIShellBrowser(HWND hwnd)
Definition: filedlg.c:2272
static INT_PTR FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:1145
static LRESULT FILEDLG95_InitControls(HWND hwnd)
Definition: filedlg.c:1661
static LRESULT FILEDLG95_FillControls(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:2132
static HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd)
Definition: filedlg.c:982
static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam)
Definition: filedlg.c:2194
static LRESULT FILEDLG95_OnWMGetMMI(HWND hwnd, LPMINMAXINFO mmiptr)
Definition: filedlg.c:1256
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
#define IDS_LISTVIEW
#define IDS_UPFOLDER
#define IDS_TODESKTOP
#define IDS_REPORTVIEW
#define IDS_NEWFOLDER
#define WS_SIZEBOX
Definition: pedump.c:642
#define TTN_GETDISPINFOA
Definition: commctrl.h:1877
struct tagNMTTDISPINFOA * LPNMTTDISPINFOA
#define SWP_FRAMECHANGED
Definition: winuser.h:1251
#define SBS_SIZEGRIP
Definition: winuser.h:332
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
#define SM_CYVSCROLL
Definition: winuser.h:992
#define WM_SIZE
Definition: winuser.h:1639
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
#define WH_MSGFILTER
Definition: winuser.h:29
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1768
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
#define WM_INITDIALOG
Definition: winuser.h:1767
#define SetWindowsHookEx
Definition: winuser.h:6022
#define SM_CYHSCROLL
Definition: winuser.h:973
#define WM_DRAWITEM
Definition: winuser.h:1673
#define WM_GETMINMAXINFO
Definition: winuser.h:1668
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
struct tagNMHDR * LPNMHDR
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define SBS_SIZEBOXBOTTOMRIGHTALIGN
Definition: winuser.h:330
#define WM_NCDESTROY
Definition: winuser.h:1712
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1637
#define GWL_STYLE
Definition: winuser.h:863
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define GWL_EXSTYLE
Definition: winuser.h:862
#define WM_NOTIFY
Definition: richedit.h:61
static FILE * client
Definition: client.c:37
Definition: style.c:91
UINT_PTR idFrom
Definition: winuser.h:3266
UINT code
Definition: winuser.h:3267
HINSTANCE hinst
Definition: commctrl.h:1904
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by GetFileName95().

◆ FileOpenDlgProcUserTemplate()

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

Definition at line 973 of file filedlg.c.

974{
975 switch(uMsg) {
976 case WM_INITDIALOG:
977 return TRUE;
978 }
979 return FALSE;
980}

Referenced by CreateTemplateDialog().

◆ get_config_key_as_dword()

static BOOL get_config_key_as_dword ( HKEY  hkey,
const WCHAR *  name,
DWORD *  value 
)
static

Definition at line 295 of file filedlg.c.

296{
298
299 size = sizeof(data);
300 if (hkey && !RegQueryValueExW(hkey, name, 0, &type, (BYTE *)&data, &size))
301 {
302 *value = data;
303 return TRUE;
304 }
305
306 return FALSE;
307}
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: name.c:39
unsigned char BYTE
Definition: xxhash.c:193

Referenced by is_places_bar_enabled().

◆ get_config_key_dword()

static BOOL get_config_key_dword ( HKEY  hkey,
const WCHAR *  name,
DWORD *  value 
)
static

Definition at line 309 of file filedlg.c.

310{
312
313 size = sizeof(data);
314 if (hkey && !RegQueryValueExW(hkey, name, 0, &type, (BYTE *)&data, &size) && type == REG_DWORD)
315 {
316 *value = data;
317 return TRUE;
318 }
319
320 return FALSE;
321}
#define REG_DWORD
Definition: sdbapi.c:615

Referenced by filedlg_collect_places_pidls().

◆ get_config_key_string()

static BOOL get_config_key_string ( HKEY  hkey,
const WCHAR *  name,
WCHAR **  value 
)
static

Definition at line 323 of file filedlg.c.

324{
325 DWORD type, size;
326 WCHAR *str;
327
328 if (RegQueryValueExW(hkey, name, 0, &type, NULL, &size))
329 return FALSE;
330 if (type != REG_SZ && type != REG_EXPAND_SZ)
331 return FALSE;
332
334 if (RegQueryValueExW(hkey, name, 0, &type, (BYTE *)str, &size))
335 {
336 heap_free(str);
337 return FALSE;
338 }
339
340 *value = str;
341 return TRUE;
342}
#define REG_EXPAND_SZ
Definition: nt_native.h:1497

Referenced by filedlg_collect_places_pidls().

◆ get_def_format()

static FORMATETC get_def_format ( void  )
static

Definition at line 4300 of file filedlg.c.

4301{
4302 static CLIPFORMAT cfFormat;
4303 FORMATETC formatetc;
4304
4305 if (!cfFormat) cfFormat = RegisterClipboardFormatA(CFSTR_SHELLIDLISTA);
4306 formatetc.cfFormat = cfFormat;
4307 formatetc.ptd = 0;
4308 formatetc.dwAspect = DVASPECT_CONTENT;
4309 formatetc.lindex = -1;
4310 formatetc.tymed = TYMED_HGLOBAL;
4311 return formatetc;
4312}
UINT WINAPI RegisterClipboardFormatA(_In_ LPCSTR)
#define CFSTR_SHELLIDLISTA
Definition: shlobj.h:428

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

◆ get_filedlg_infoptr()

◆ GetFileDialog95()

static BOOL GetFileDialog95 ( FileOpenDlgInfos *  info,
UINT  dlg_type 
)
static

Definition at line 640 of file filedlg.c.

641{
642 WCHAR *current_dir = NULL;
643 unsigned int i;
644 BOOL ret;
645
646 /* save current directory */
647 if (info->ofnInfos->Flags & OFN_NOCHANGEDIR)
648 {
649 current_dir = heap_alloc(MAX_PATH * sizeof(WCHAR));
650 GetCurrentDirectoryW(MAX_PATH, current_dir);
651 }
652
653 switch (dlg_type)
654 {
655 case OPEN_DIALOG:
657 break;
658 case SAVE_DIALOG:
659 info->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG;
661 break;
662 default:
663 ret = FALSE;
664 }
665
666#ifdef __REACTOS__
667 /* set the lpstrFileTitle */
668 if (ret && info->ofnInfos->lpstrFile && info->ofnInfos->lpstrFileTitle)
669 {
670 if (info->unicode)
671 {
672 LPOPENFILENAMEW ofn = info->ofnInfos;
673 WCHAR *file_title = PathFindFileNameW(ofn->lpstrFile);
675 }
676 else
677 {
679 char *file_title = PathFindFileNameA(ofn->lpstrFile);
681 }
682 }
683#endif
684
685 if (current_dir)
686 {
687 SetCurrentDirectoryW(current_dir);
688 heap_free(current_dir);
689 }
690
691 if (!info->unicode)
692 {
693 heap_free((void *)info->defext);
694 heap_free((void *)info->title);
695 heap_free((void *)info->filter);
696 heap_free((void *)info->customfilter);
697 }
698#ifdef __REACTOS__
699 else
700 {
701 heap_free((void *)info->defext);
702 }
703#endif
704
705 heap_free(info->filename);
706 heap_free(info->initdir);
707
708 for (i = 0; i < ARRAY_SIZE(info->places); i++)
709 ILFree(info->places[i]);
710
711 return ret;
712}
#define OFN_NOCHANGEDIR
Definition: commdlg.h:109
#define OPEN_DIALOG
Definition: commdlg.h:13
#define SAVE_DIALOG
Definition: commdlg.h:12
static BOOL GetFileName95(FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:430
#define lstrcpynA
Definition: compat.h:751
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2267

Referenced by GetOpenFileNameA(), GetOpenFileNameW(), GetSaveFileNameA(), and GetSaveFileNameW().

◆ GetFileName95()

static BOOL GetFileName95 ( FileOpenDlgInfos *  fodInfos)
static

Definition at line 430 of file filedlg.c.

431{
432 LRESULT lRes;
433 void *template;
434 HRSRC hRes;
435 HANDLE hDlgTmpl = 0;
436 WORD templateid;
437
438 /* test for missing functionality */
439 if (fodInfos->ofnInfos->Flags & UNIMPLEMENTED_FLAGS)
440 {
441 FIXME("Flags 0x%08lx not yet implemented\n",
442 fodInfos->ofnInfos->Flags & UNIMPLEMENTED_FLAGS);
443 }
444
445 /* Create the dialog from a template */
446
447 if (is_places_bar_enabled(fodInfos))
448 templateid = NEWFILEOPENV2ORD;
449 else
450 templateid = NEWFILEOPENORD;
451
453 {
455 return FALSE;
456 }
457 if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hRes )) ||
458 !(template = LockResource( hDlgTmpl )))
459 {
461 return FALSE;
462 }
463
464 /* msdn: explorer style dialogs permit sizing by default.
465 * The OFN_ENABLESIZING flag is only needed when a hook or
466 * custom template is provided */
467 if( (fodInfos->ofnInfos->Flags & OFN_EXPLORER) &&
469 fodInfos->ofnInfos->Flags |= OFN_ENABLESIZING;
470
471 if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
472 {
473 fodInfos->sizedlg.cx = fodInfos->sizedlg.cy = 0;
474 fodInfos->initial_size.x = fodInfos->initial_size.y = 0;
475 }
476
477 /* old style hook messages */
478 if (is_dialog_hooked(fodInfos))
479 {
480 fodInfos->HookMsg.fileokstring = RegisterWindowMessageW(FILEOKSTRINGW);
481 fodInfos->HookMsg.lbselchstring = RegisterWindowMessageW(LBSELCHSTRINGW);
482 fodInfos->HookMsg.helpmsgstring = RegisterWindowMessageW(HELPMSGSTRINGW);
483 fodInfos->HookMsg.sharevistring = RegisterWindowMessageW(SHAREVISTRINGW);
484 }
485
486 if (fodInfos->unicode)
488 template,
489 fodInfos->ofnInfos->hwndOwner,
491 (LPARAM) fodInfos);
492 else
494 template,
495 fodInfos->ofnInfos->hwndOwner,
497 (LPARAM) fodInfos);
498 if (fodInfos->ole_initialized)
500
501 /* Unable to create the dialog */
502 if( lRes == -1)
503 return FALSE;
504
505 return lRes;
506}
#define HELPMSGSTRINGW
Definition: commdlg.h:27
#define FILEOKSTRINGW
Definition: commdlg.h:24
#define SHAREVISTRINGW
Definition: commdlg.h:23
#define LBSELCHSTRINGW
Definition: commdlg.h:22
#define UNIMPLEMENTED_FLAGS
Definition: filedlg.c:86
static INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:1432
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:218
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
INT_PTR WINAPI DialogBoxIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HWND hwndOwner
Definition: commdlg.h:361

Referenced by GetFileDialog95().

◆ GetFileTitleA()

short WINAPI GetFileTitleA ( LPCSTR  lpFile,
LPSTR  lpTitle,
WORD  cbBuf 
)

Definition at line 4850 of file filedlg.c.

4851{
4852 int ret;
4853 UNICODE_STRING strWFile;
4854 LPWSTR lpWTitle;
4855
4856 RtlCreateUnicodeStringFromAsciiz(&strWFile, lpFile);
4857 lpWTitle = heap_alloc(cbBuf * sizeof(WCHAR));
4858 ret = GetFileTitleW(strWFile.Buffer, lpWTitle, cbBuf);
4859 if (!ret) WideCharToMultiByte( CP_ACP, 0, lpWTitle, -1, lpTitle, cbBuf, NULL, NULL );
4860 RtlFreeUnicodeString( &strWFile );
4861 heap_free( lpWTitle );
4862 return ret;
4863}
TCHAR lpTitle[80]
Definition: ctm.c:69
short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf)
Definition: filedlg.c:4880
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)

◆ GetFileTitleW()

short WINAPI GetFileTitleW ( LPCWSTR  lpFile,
LPWSTR  lpTitle,
WORD  cbBuf 
)

Definition at line 4880 of file filedlg.c.

4881{
4882 int i, len;
4883 TRACE("(%p %p %d);\n", lpFile, lpTitle, cbBuf);
4884
4885 if(lpFile == NULL || lpTitle == NULL)
4886 return -1;
4887
4888 len = lstrlenW(lpFile);
4889
4890 if (len == 0)
4891 return -1;
4892
4893 if(wcspbrk(lpFile, L"*[]"))
4894 return -1;
4895
4896 len--;
4897
4898 if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
4899 return -1;
4900
4901 for(i = len; i >= 0; i--)
4902 {
4903 if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':')
4904 {
4905 i++;
4906 break;
4907 }
4908 }
4909
4910 if(i == -1)
4911 i++;
4912
4913 TRACE("---> %s\n", debugstr_w(&lpFile[i]));
4914
4915 len = lstrlenW(lpFile+i)+1;
4916 if(cbBuf < len)
4917 return len;
4918
4919 lstrcpyW(lpTitle, &lpFile[i]);
4920 return 0;
4921}

Referenced by GetFileTitleA(), and QueryFileDescription().

◆ GetName()

static HRESULT GetName ( LPSHELLFOLDER  lpsf,
LPITEMIDLIST  pidl,
DWORD  dwFlags,
LPWSTR  lpstrFileName 
)
static

Definition at line 4543 of file filedlg.c.

4544{
4545 STRRET str;
4546 HRESULT hRes;
4547
4548 TRACE("sf=%p pidl=%p\n", lpsf, pidl);
4549
4550 if(!lpsf)
4551 {
4552 SHGetDesktopFolder(&lpsf);
4553 hRes = GetName(lpsf,pidl,dwFlags,lpstrFileName);
4554 IShellFolder_Release(lpsf);
4555 return hRes;
4556 }
4557
4558 /* Get the display name of the pidl relative to the folder */
4559 if (SUCCEEDED(hRes = IShellFolder_GetDisplayNameOf(lpsf, pidl, dwFlags, &str)))
4560 {
4561 return COMDLG32_StrRetToStrNW(lpstrFileName, MAX_PATH, &str, pidl);
4562 }
4563 return E_FAIL;
4564}
static HRESULT COMDLG32_StrRetToStrNW(LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
Definition: filedlg.c:4395
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141

Referenced by DECLARE_INTERFACE_(), DECLARE_INTERFACE_IID_(), FILEDLG95_FILENAME_FillFromSelection(), and GetName().

◆ GetNumSelected()

static UINT GetNumSelected ( IDataObject *  doSelected)
static

Definition at line 4508 of file filedlg.c.

4509{
4510 UINT retVal = 0;
4511 STGMEDIUM medium;
4512 FORMATETC formatetc = get_def_format();
4513
4514 TRACE("sv=%p\n", doSelected);
4515
4516 if (!doSelected) return 0;
4517
4518 /* Get the pidls from IDataObject */
4519 if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
4520 {
4521 LPIDA cida = GlobalLock(medium.hGlobal);
4522 retVal = cida->cidl;
4524 return retVal;
4525 }
4526 return 0;
4527}

Referenced by BrowseSelectedFolder().

◆ GetOpenFileNameA()

BOOL WINAPI GetOpenFileNameA ( OPENFILENAMEA *  ofn)

Definition at line 4725 of file filedlg.c.

4726{
4727 TRACE("flags 0x%08lx\n", ofn->Flags);
4728
4730 {
4732 return FALSE;
4733 }
4734
4735 /* OFN_FILEMUSTEXIST implies OFN_PATHMUSTEXIST */
4738
4739 if (is_win16_looks(ofn->Flags))
4741 else
4742 {
4744
4747 }
4748}
#define CDERR_STRUCTSIZE
Definition: cderr.h:6
BOOL GetFileName31A(OPENFILENAMEA *lpofn, UINT dlgType)
Definition: filedlg31.c:1145
static BOOL valid_struct_size(DWORD size)
Definition: filedlg.c:4701
static void init_filedlg_infoA(OPENFILENAMEA *ofn, FileOpenDlgInfos *info)
Definition: filedlg.c:574
static BOOL GetFileDialog95(FileOpenDlgInfos *info, UINT dlg_type)
Definition: filedlg.c:640
static BOOL is_win16_looks(DWORD flags)
Definition: filedlg.c:4707
DWORD lStructSize
Definition: commdlg.h:329

Referenced by export(), test_arrange(), test_create_view_template(), test_create_view_window2(), test_DialogCancel(), test_directory_filename(), test_getfolderpath(), test_mru(), test_null_filename(), test_ok(), test_ole_initialization(), test_resizable2(), test_resize(), UIINSERTOBJECTDLG_AddControl(), UIINSERTOBJECTDLG_BrowseFile(), and WINHELP_GetOpenFileName().

◆ GetOpenFileNameW()

BOOL WINAPI GetOpenFileNameW ( OPENFILENAMEW *  ofn)

Definition at line 4760 of file filedlg.c.

4761{
4762 TRACE("flags 0x%08lx\n", ofn->Flags);
4763
4765 {
4767 return FALSE;
4768 }
4769
4770 /* OFN_FILEMUSTEXIST implies OFN_PATHMUSTEXIST */
4773
4774 if (is_win16_looks(ofn->Flags))
4776 else
4777 {
4779
4782 }
4783}
BOOL GetFileName31W(OPENFILENAMEW *lpofn, UINT dlgType)
Definition: filedlg31.c:1170
static void init_filedlg_infoW(OPENFILENAMEW *ofn, FileOpenDlgInfos *info)
Definition: filedlg.c:523

Referenced by ActionDlg_OnBrowse(), COpenWithDialog::Browse(), DIALOG_Browse(), DialogOpenFile(), DoOpenFile(), GetOpenFileNameWrapW(), import_file_dlg_proc(), LoadClipboardFromFile(), MainWnd_OnImport(), MountFloppy(), CMainWnd::OnFileOpen(), OpenUserEventLog(), PickIconProc(), promptdisk_browse(), RecvSubvolGUIW(), SoundsDlgProc(), test_DialogCancel(), test_directory_filename(), test_null_filename(), and wWinMain().

◆ GetParentPidl()

LPITEMIDLIST GetParentPidl ( LPITEMIDLIST  pidl)

Definition at line 4600 of file filedlg.c.

4601{
4602 LPITEMIDLIST pidlParent;
4603
4604 TRACE("%p\n", pidl);
4605
4606 pidlParent = ILClone(pidl);
4607 ILRemoveLastID(pidlParent);
4608
4609 return pidlParent;
4610}
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:222

Referenced by FILEDLG95_LOOKIN_InsertItemAfterParent(), and IShellBrowserImpl_BrowseObject().

◆ GetPidlFromDataObject()

LPITEMIDLIST GetPidlFromDataObject ( IDataObject *  doSelected,
UINT  nPidlIndex 
)

Definition at line 4477 of file filedlg.c.

4478{
4479
4480 STGMEDIUM medium;
4481 FORMATETC formatetc = get_def_format();
4482 LPITEMIDLIST pidl = NULL;
4483
4484 TRACE("sv=%p index=%u\n", doSelected, nPidlIndex);
4485
4486 if (!doSelected)
4487 return NULL;
4488
4489 /* Get the pidls from IDataObject */
4490 if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
4491 {
4492 LPIDA cida = GlobalLock(medium.hGlobal);
4493 if(nPidlIndex <= cida->cidl)
4494 {
4495 pidl = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[nPidlIndex]]));
4496 }
4498 }
4499 return pidl;
4500}

Referenced by BrowseSelectedFolder(), and IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand().

◆ GetPidlFromName()

static LPITEMIDLIST GetPidlFromName ( IShellFolder *  psf,
LPWSTR  lpcstrFileName 
)
static

Definition at line 4618 of file filedlg.c.

4619{
4620 LPITEMIDLIST pidl = NULL;
4621 ULONG ulEaten;
4622
4623 TRACE("sf=%p file=%s\n", lpsf, debugstr_w(lpcstrFileName));
4624
4625 if(!lpcstrFileName) return NULL;
4626 if(!*lpcstrFileName) return NULL;
4627
4628 if(!lpsf)
4629 {
4630 if (SUCCEEDED(SHGetDesktopFolder(&lpsf))) {
4631 IShellFolder_ParseDisplayName(lpsf, 0, NULL, lpcstrFileName, &ulEaten, &pidl, NULL);
4632 IShellFolder_Release(lpsf);
4633 }
4634 }
4635 else
4636 {
4637 IShellFolder_ParseDisplayName(lpsf, 0, NULL, lpcstrFileName, &ulEaten, &pidl, NULL);
4638 }
4639 return pidl;
4640}
uint32_t ULONG
Definition: typedefs.h:59

Referenced by FILEDLG95_FillControls(), and FILEDLG95_OnOpenMultipleFiles().

◆ GetSaveFileNameA()

BOOL WINAPI GetSaveFileNameA ( OPENFILENAMEA *  ofn)

Definition at line 4796 of file filedlg.c.

4797{
4799 {
4801 return FALSE;
4802 }
4803
4804 if (is_win16_looks(ofn->Flags))
4806 else
4807 {
4809
4812 }
4813}

Referenced by test_DialogCancel(), test_extension_helper(), and test_getfolderpath().

◆ GetSaveFileNameW()

◆ GetShellFolderFromPidl()

IShellFolder * GetShellFolderFromPidl ( LPITEMIDLIST  pidlAbs)

Definition at line 4572 of file filedlg.c.

4573{
4574 IShellFolder *psf = NULL,*psfParent;
4575
4576 TRACE("%p\n", pidlAbs);
4577
4578 if(SUCCEEDED(SHGetDesktopFolder(&psfParent)))
4579 {
4580 psf = psfParent;
4581 if(pidlAbs && pidlAbs->mkid.cb)
4582 {
4583 if(SUCCEEDED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf)))
4584 {
4585 IShellFolder_Release(psfParent);
4586 return psf;
4587 }
4588 }
4589 /* return the desktop */
4590 return psfParent;
4591 }
4592 return NULL;
4593}

Referenced by IShellBrowserImpl_BrowseObject().

◆ heap_strdupAtoW()

static WCHAR * heap_strdupAtoW ( const char *  str)
static

Definition at line 508 of file filedlg.c.

509{
510 WCHAR *ret;
511 INT len;
512
513 if (!str)
514 return NULL;
515
516 len = MultiByteToWideChar(CP_ACP, 0, str, -1, 0, 0);
517 ret = heap_alloc(len * sizeof(WCHAR));
519
520 return ret;
521}

Referenced by FILEDLG95_HandleCustomDialogMessages(), and init_filedlg_infoA().

◆ init_filedlg_infoA()

static void init_filedlg_infoA ( OPENFILENAMEA *  ofn,
FileOpenDlgInfos *  info 
)
static

Definition at line 574 of file filedlg.c.

575{
576 OPENFILENAMEW ofnW;
577 int len;
578
579 ofnW = *(OPENFILENAMEW *)ofn;
580
584
585 if (ofn->lpstrFile)
586 {
588 ofnW.lpstrFile = heap_alloc(len * sizeof(WCHAR));
590 ofnW.nMaxFile = len;
591 }
592
593 if (ofn->lpstrFilter)
594 {
595 LPCSTR s;
596 int n;
597
598 /* filter is a list... title\0ext\0......\0\0 */
599 s = ofn->lpstrFilter;
600 while (*s) s = s+strlen(s)+1;
601 s++;
602 n = s - ofn->lpstrFilter;
604 ofnW.lpstrFilter = heap_alloc(len * sizeof(WCHAR));
606 }
607
608 /* convert lpstrCustomFilter */
610 {
611 int n, len;
612 LPCSTR s;
613
614 /* customfilter contains a pair of strings... title\0ext\0 */
616 if (*s) s = s+strlen(s)+1;
617 if (*s) s = s+strlen(s)+1;
620 ofnW.lpstrCustomFilter = heap_alloc(len * sizeof(WCHAR));
622 }
623
624 init_filedlg_infoW(&ofnW, info);
625
626 /* fixup A-specific fields */
627 info->ofnInfos = (OPENFILENAMEW *)ofn;
628 info->unicode = FALSE;
629
630 /* free what was duplicated */
631 heap_free((void *)ofnW.lpstrInitialDir);
632 heap_free(ofnW.lpstrFile);
633}
GLdouble n
Definition: glext.h:7729
LPCSTR lpstrDefExt
Definition: commdlg.h:345
LPCSTR lpstrTitle
Definition: commdlg.h:341
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
LPCSTR lpstrFilter
Definition: commdlg.h:332
LPCWSTR lpstrInitialDir
Definition: commdlg.h:371
LPCWSTR lpstrTitle
Definition: commdlg.h:372
LPCWSTR lpstrDefExt
Definition: commdlg.h:376
LPCWSTR lpstrFilter
Definition: commdlg.h:363

Referenced by GetOpenFileNameA(), and GetSaveFileNameA().

◆ init_filedlg_infoW()

static void init_filedlg_infoW ( OPENFILENAMEW *  ofn,
FileOpenDlgInfos *  info 
)
static

Definition at line 523 of file filedlg.c.

524{
526
527 /* Initialize ComboBoxEx32 */
528 icc.dwSize = sizeof(icc);
531
532 /* Initialize CommDlgExtendedError() */
534
535 memset(info, 0, sizeof(*info));
536
537 /* Pass in the original ofn */
538 info->ofnInfos = ofn;
539
540 info->title = ofn->lpstrTitle;
541#ifdef __REACTOS__
542 if (ofn->lpstrDefExt)
543 {
544 INT cchExt = lstrlenW(ofn->lpstrDefExt);
545 LPWSTR pszExt = heap_alloc((cchExt + 1) * sizeof(WCHAR));
546 lstrcpyW(pszExt, ofn->lpstrDefExt);
547 info->defext = pszExt;
548 }
549#else
550 info->defext = ofn->lpstrDefExt;
551#endif
552 info->filter = ofn->lpstrFilter;
553 info->customfilter = ofn->lpstrCustomFilter;
554
555 if (ofn->lpstrFile)
556 {
557 info->filename = heap_alloc(ofn->nMaxFile * sizeof(WCHAR));
558 lstrcpynW(info->filename, ofn->lpstrFile, ofn->nMaxFile);
559 }
560
561 if (ofn->lpstrInitialDir)
562 {
564 if (len)
565 {
566 info->initdir = heap_alloc(len * sizeof(WCHAR));
568 }
569 }
570
571 info->unicode = TRUE;
572}
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:904
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
#define ICC_USEREX_CLASSES
Definition: commctrl.h:68

Referenced by GetOpenFileNameW(), GetSaveFileNameW(), and init_filedlg_infoA().

◆ is_dialog_hooked()

static BOOL is_dialog_hooked ( const FileOpenDlgInfos *  info)
static

Definition at line 223 of file filedlg.c.

224{
225 return (info->ofnInfos->Flags & OFN_ENABLEHOOK) && info->ofnInfos->lpfnHook;
226}

Referenced by CreateTemplateDialog(), FILEDLG95_SendFileOK(), and GetFileName95().

◆ is_places_bar_enabled()

static BOOL is_places_bar_enabled ( const FileOpenDlgInfos *  fodInfos)
static

Definition at line 344 of file filedlg.c.

345{
346 DWORD value;
347 HKEY hkey;
348
349 if (fodInfos->ofnInfos->lStructSize != sizeof(*fodInfos->ofnInfos) ||
350 (fodInfos->ofnInfos->FlagsEx & OFN_EX_NOPLACESBAR) ||
351 !(fodInfos->ofnInfos->Flags & OFN_EXPLORER))
352 {
353 return FALSE;
354 }
355
356 if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Comdlg32", &hkey))
357 return TRUE;
358
359 value = 0;
360 get_config_key_as_dword(hkey, L"NoPlacesBar", &value);
361 RegCloseKey(hkey);
362 return value == 0;
363}
#define OFN_EX_NOPLACESBAR
Definition: commdlg.h:121
static BOOL get_config_key_as_dword(HKEY hkey, const WCHAR *name, DWORD *value)
Definition: filedlg.c:295
DWORD lStructSize
Definition: commdlg.h:360

Referenced by FILEDLG95_InitControls(), and GetFileName95().

◆ is_win16_looks()

static BOOL is_win16_looks ( DWORD  flags)
inlinestatic

Definition at line 4707 of file filedlg.c.

4708{
4710 !(flags & OFN_EXPLORER));
4711}

Referenced by GetOpenFileNameA(), GetOpenFileNameW(), GetSaveFileNameA(), and GetSaveFileNameW().

◆ IsPidlFolder()

static BOOL IsPidlFolder ( LPSHELLFOLDER  psf,
LPCITEMIDLIST  pidl 
)
static

Definition at line 4644 of file filedlg.c.

4645{
4646#ifdef __REACTOS__
4647 ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR;
4648#else
4649 ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
4650#endif
4651 HRESULT ret;
4652
4653 TRACE("%p, %p\n", psf, pidl);
4654
4655 ret = IShellFolder_GetAttributesOf( psf, 1, &pidl, &uAttr );
4656
4657 TRACE("-- 0x%08lx 0x%08lx\n", uAttr, ret);
4658 /* see documentation shell 4.1*/
4659#ifdef __REACTOS__
4660 return (uAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER)) && (uAttr & SFGAO_FILESYSANCESTOR);
4661#else
4662 return uAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER);
4663#endif
4664}

Referenced by BrowseSelectedFolder(), and FILEDLG95_FILENAME_FillFromSelection().

◆ SendCustomDlgNotificationMessage()

LRESULT SendCustomDlgNotificationMessage ( HWND  hwndParentDlg,
UINT  uCode 
)

Definition at line 1074 of file filedlg.c.

1075{
1076 FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndParentDlg);
1077 LRESULT hook_result;
1078 OFNOTIFYW ofnNotify;
1079
1080 TRACE("%p %d\n", hwndParentDlg, uCode);
1081
1082 if (!fodInfos || !fodInfos->DlgInfos.hwndCustomDlg)
1083 return 0;
1084
1085 TRACE("CALL NOTIFY for %d\n", uCode);
1086
1087 ofnNotify.hdr.hwndFrom = hwndParentDlg;
1088 ofnNotify.hdr.idFrom = 0;
1089 ofnNotify.hdr.code = uCode;
1090 ofnNotify.lpOFN = fodInfos->ofnInfos;
1091 ofnNotify.pszFile = NULL;
1092
1093 if (fodInfos->unicode)
1094 hook_result = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify);
1095 else
1096 hook_result = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify);
1097
1098 TRACE("RET NOTIFY retval %#Ix\n", hook_result);
1099
1100 return hook_result;
1101}
NMHDR hdr
Definition: commdlg.h:411
LPWSTR pszFile
Definition: commdlg.h:413
LPOPENFILENAMEW lpOFN
Definition: commdlg.h:412
HWND hwndFrom
Definition: winuser.h:3265

Referenced by BrowseSelectedFolder(), FILEDLG95_FILETYPE_OnCommand(), FILEDLG95_LOOKIN_OnCommand(), FILEDLG95_OnOpen(), FILEDLG95_SendFileOK(), FILEDLG95_SHELL_UpFolder(), filedlg_browse_to_pidl(), FileOpenDlgProc95(), IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(), and IShellBrowserImpl_OnSelChange().

◆ valid_struct_size()

static BOOL valid_struct_size ( DWORD  size)
inlinestatic

Definition at line 4701 of file filedlg.c.

4702{
4704 (size == sizeof( OPENFILENAMEW ));
4705}
struct tagOFNW OPENFILENAMEW

Referenced by GetOpenFileNameA(), GetOpenFileNameW(), GetSaveFileNameA(), and GetSaveFileNameW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( commdlg  )

Variable Documentation

◆ LookInInfosStr

◆ MemDialogSize

SIZE MemDialogSize = { 0, 0}
static

Definition at line 216 of file filedlg.c.

Referenced by FileOpenDlgProc95().