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

Go to the source code of this file.

Classes

struct  SFolder
 
struct  tagLookInInfo
 

Macros

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

Typedefs

typedef struct SFolder SFOLDER
 
typedef struct SFolderLPSFOLDER
 
typedef struct tagLookInInfo LookInInfos
 

Functions

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

Variables

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

Macro Definition Documentation

◆ CBGetItemDataPtr

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

Definition at line 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.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 55 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_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\
OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/)
#define OFN_NOREADONLYRETURN
Definition: commdlg.h:113
#define OFN_DONTADDTORECENT
Definition: commdlg.h:98

Definition at line 86 of file filedlg.c.

◆ WM_GETISHELLBROWSER

#define WM_GETISHELLBROWSER   WM_USER+7

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

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

Referenced by FILEDLG95_ResizeControls().

◆ BrowseSelectedFolder()

static BOOL BrowseSelectedFolder ( HWND  hwnd)
static

Definition at line 4580 of file filedlg.c.

4581 {
4583  BOOL bBrowseSelFolder = FALSE;
4584 
4585  TRACE("\n");
4586 
4587  if (GetNumSelected(fodInfos->Shell.FOIDataObject) == 1)
4588  {
4589  LPITEMIDLIST pidlSelection;
4590 
4591  /* get the file selected */
4592  pidlSelection = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, 1);
4593  if (IsPidlFolder (fodInfos->Shell.FOIShellFolder, pidlSelection))
4594  {
4595  if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser,
4596  pidlSelection, SBSP_RELATIVE ) ) )
4597  {
4598  WCHAR buf[64];
4600  MessageBoxW( hwnd, buf, fodInfos->title, MB_OK | MB_ICONEXCLAMATION );
4601  }
4602  bBrowseSelFolder = TRUE;
4603  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
4605  }
4606  ILFree( pidlSelection );
4607  }
4608 
4609  return bBrowseSelFolder;
4610 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define TRUE
Definition: types.h:120
LPITEMIDLIST GetPidlFromDataObject(IDataObject *doSelected, UINT nPidlIndex)
Definition: filedlg.c:4396
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
struct FileOpenDlgInfos::@336 Shell
#define IDS_PATHNOTEXISTING
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:1068
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MB_OK
Definition: winuser.h:784
static UINT GetNumSelected(IDataObject *doSelected)
Definition: filedlg.c:4427
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4563
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227

Referenced by FILEDLG95_OnOpen().

◆ COMCTL32_ReleaseStgMedium()

static void COMCTL32_ReleaseStgMedium ( STGMEDIUM  medium)
static

Definition at line 4376 of file filedlg.c.

4377 {
4378  if(medium.pUnkForRelease)
4379  {
4380  IUnknown_Release(medium.pUnkForRelease);
4381  }
4382  else
4383  {
4384  GlobalUnlock(medium.u.hGlobal);
4385  GlobalFree(medium.u.hGlobal);
4386  }
4387 }
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 734 of file filedlg.c.

736 {
737  WCHAR lpstrTemp[MAX_PATH];
738 
739  /* Get the current directory name */
740  if (!COMDLG32_GetDisplayNameOf(pidlAbsCurrent, lpstrPathAndFile))
741  {
742  /* last fallback */
743  GetCurrentDirectoryW(MAX_PATH, lpstrPathAndFile);
744  }
745  PathAddBackslashW(lpstrPathAndFile);
746 
747  TRACE("current directory=%s, file=%s\n", debugstr_w(lpstrPathAndFile), debugstr_w(lpstrFile));
748 
749  /* if the user specified a fully qualified path use it */
750  if(PathIsRelativeW(lpstrFile))
751  {
752  lstrcatW(lpstrPathAndFile, lpstrFile);
753  }
754  else
755  {
756  /* does the path have a drive letter? */
757  if (PathGetDriveNumberW(lpstrFile) == -1)
758  lstrcpyW(lpstrPathAndFile+2, lpstrFile);
759  else
760  lstrcpyW(lpstrPathAndFile, lpstrFile);
761  }
762 
763  /* resolve "." and ".." */
764  PathCanonicalizeW(lpstrTemp, lpstrPathAndFile );
765  lstrcpyW(lpstrPathAndFile, lpstrTemp);
766  TRACE("canon=%s\n", debugstr_w(lpstrPathAndFile));
767 }
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1558
BOOL WINAPI PathCanonicalizeW(LPWSTR lpszBuf, LPCWSTR lpszPath)
Definition: path.c:2425
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:713
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:608
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:548
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274

Referenced by FILEDLG95_OnOpen(), and on_default_action().

◆ COMDLG32_GetDisplayNameOf()

static BOOL COMDLG32_GetDisplayNameOf ( LPCITEMIDLIST  pidl,
LPWSTR  pwszPath 
)
static

Definition at line 713 of file filedlg.c.

713  {
714  LPSHELLFOLDER psfDesktop;
715  STRRET strret;
716 
717  if (FAILED(SHGetDesktopFolder(&psfDesktop)))
718  return FALSE;
719 
720  if (FAILED(IShellFolder_GetDisplayNameOf(psfDesktop, pidl, SHGDN_FORPARSING, &strret))) {
721  IShellFolder_Release(psfDesktop);
722  return FALSE;
723  }
724 
725  IShellFolder_Release(psfDesktop);
726  return SUCCEEDED(StrRetToBufW(&strret, pidl, pwszPath, MAX_PATH));
727 }
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
#define FALSE
Definition: types.h:117
if SUCCEEDED(hr)
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define MAX_PATH
Definition: compat.h:34

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

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

Referenced by FILEDLG95_FILENAME_GetFileNames(), and on_default_action().

◆ COMDLG32_StrRetToStrNW()

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

Definition at line 4314 of file filedlg.c.

4315 {
4316  switch (src->uType)
4317  {
4318  case STRRET_WSTR:
4319  lstrcpynW(dest, src->u.pOleStr, len);
4320  CoTaskMemFree(src->u.pOleStr);
4321  break;
4322 
4323  case STRRET_CSTR:
4324  if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len)
4325  dest[len-1] = 0;
4326  break;
4327 
4328  case STRRET_OFFSET:
4329  if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1, dest, len ) && len)
4330  dest[len-1] = 0;
4331  break;
4332 
4333  default:
4334  FIXME("unknown type %x!\n", src->uType);
4335  if (len) *dest = '\0';
4336  return E_FAIL;
4337  }
4338  return S_OK;
4339 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define CP_ACP
Definition: compat.h:109
#define E_FAIL
Definition: ddrawi.h:102
#define lstrcpynW
Definition: compat.h:597
#define FIXME(fmt,...)
Definition: debug.h:111
const char * LPCSTR
Definition: xmlstorage.h:183
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:51
#define MultiByteToWideChar
Definition: compat.h:110
static char * dest
Definition: rtl.c:135
SHITEMID mkid
Definition: shtypes.idl:34

Referenced by GetName().

◆ CreateTemplateDialog()

static HWND CreateTemplateDialog ( FileOpenDlgInfos fodInfos,
HWND  hwnd 
)
static

Definition at line 976 of file filedlg.c.

977 {
978  LPCVOID template;
979  HRSRC hRes;
980  HANDLE hDlgTmpl = 0;
981  HWND hChildDlg = 0;
982 
983  TRACE("%p, %p\n", fodInfos, hwnd);
984 
985  /*
986  * If OFN_ENABLETEMPLATEHANDLE is specified, the OPENFILENAME
987  * structure's hInstance parameter is not a HINSTANCE, but
988  * instead a pointer to a template resource to use.
989  */
991  {
993  if (fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE)
994  {
996  if( !(template = LockResource( fodInfos->ofnInfos->hInstance)))
997  {
999  return NULL;
1000  }
1001  }
1002  else
1003  {
1004  hinst = fodInfos->ofnInfos->hInstance;
1005  if(fodInfos->unicode)
1006  {
1007  LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
1009  }
1010  else
1011  {
1014  }
1015  if (!hRes)
1016  {
1018  return NULL;
1019  }
1020  if (!(hDlgTmpl = LoadResource( hinst, hRes )) ||
1021  !(template = LockResource( hDlgTmpl )))
1022  {
1024  return NULL;
1025  }
1026  }
1027  if (fodInfos->unicode)
1028  hChildDlg = CreateDialogIndirectParamW(hinst, template, hwnd,
1030  (LPARAM)fodInfos->ofnInfos);
1031  else
1032  hChildDlg = CreateDialogIndirectParamA(hinst, template, hwnd,
1034  (LPARAM)fodInfos->ofnInfos);
1035  return hChildDlg;
1036  }
1037  else if (is_dialog_hooked(fodInfos))
1038  {
1039  RECT rectHwnd;
1040  struct {
1041  DLGTEMPLATE tmplate;
1042  WORD menu,class,title;
1043  } temp;
1044  GetClientRect(hwnd,&rectHwnd);
1045  temp.tmplate.style = WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | DS_CONTROL | DS_3DLOOK;
1046  temp.tmplate.dwExtendedStyle = 0;
1047  temp.tmplate.cdit = 0;
1048  temp.tmplate.x = 0;
1049  temp.tmplate.y = 0;
1050  temp.tmplate.cx = 0;
1051  temp.tmplate.cy = 0;
1052  temp.menu = temp.class = temp.title = 0;
1053 
1054  hChildDlg = CreateDialogIndirectParamA(COMDLG32_hInstance, &temp.tmplate,
1055  hwnd, (DLGPROC)fodInfos->ofnInfos->lpfnHook, (LPARAM)fodInfos->ofnInfos);
1056 
1057  return hChildDlg;
1058  }
1059  return NULL;
1060 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
HINSTANCE hInstance
Definition: commdlg.h:362
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define CDERR_LOADRESFAILURE
Definition: cderr.h:12
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
OPENFILENAME ofn
Definition: main.cpp:37
HWND WINAPI CreateDialogIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
static BOOL is_dialog_hooked(const FileOpenDlgInfos *info)
Definition: filedlg.c:232
#define WS_CHILD
Definition: pedump.c:617
LPCSTR lpTemplateName
Definition: commdlg.h:348
char * LPSTR
Definition: xmlstorage.h:182
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
#define CDERR_FINDRESFAILURE
Definition: cderr.h:11
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
LONG_PTR LPARAM
Definition: windef.h:208
#define RT_DIALOG
Definition: pedump.c:367
static INT_PTR CALLBACK FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:967
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI CreateDialogIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
unsigned short WORD
Definition: ntddk_ex.h:93
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2871
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define DS_3DLOOK
Definition: winuser.h:367
static calc_node_t temp
Definition: rpn_ieee.c:38
#define DS_CONTROL
Definition: winuser.h:372
#define OFN_ENABLETEMPLATEHANDLE
Definition: commdlg.h:103
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN
Definition: cdlg32.c:128
#define NULL
Definition: types.h:112
CONST void * LPCVOID
Definition: windef.h:191
static HINSTANCE hinst
Definition: edit.c:551
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define WS_VISIBLE
Definition: pedump.c:620
static char title[]
Definition: ps.c:92
struct tagOFNA * LPOPENFILENAMEA

Referenced by FileOpenDlgProc95().

◆ filedialog_is_readonly_hidden()

static BOOL filedialog_is_readonly_hidden ( const FileOpenDlgInfos info)
static

Definition at line 237 of file filedlg.c.

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

Referenced by FILEDLG95_InitControls(), and FILEDLG95_ResizeControls().

◆ FILEDLG95_Clean()

void FILEDLG95_Clean ( HWND  hwnd)
static

Definition at line 2134 of file filedlg.c.

2135 {
2139 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void FILEDLG95_LOOKIN_Clean(HWND hwnd)
Definition: filedlg.c:4187
static void FILEDLG95_FILETYPE_Clean(HWND hwnd)
Definition: filedlg.c:3714
static void FILEDLG95_SHELL_Clean(HWND hwnd)
Definition: filedlg.c:3503

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

◆ FILEDLG95_FILENAME_FillFromSelection()

void FILEDLG95_FILENAME_FillFromSelection ( HWND  hwnd)

Definition at line 4238 of file filedlg.c.

4239 {
4241  LPITEMIDLIST pidl;
4242  LPWSTR lpstrAllFiles, lpstrTmp;
4243  UINT nFiles = 0, nFileToOpen, nFileSelected, nAllFilesLength = 0, nThisFileLength, nAllFilesMaxLength;
4244  STGMEDIUM medium;
4245  LPIDA cida;
4246  FORMATETC formatetc = get_def_format();
4247 
4248  TRACE("\n");
4249 
4250  if (FAILED(IDataObject_GetData(fodInfos->Shell.FOIDataObject, &formatetc, &medium)))
4251  return;
4252 
4253  cida = GlobalLock(medium.u.hGlobal);
4254  nFileSelected = cida->cidl;
4255 
4256  /* Allocate a buffer */
4257  nAllFilesMaxLength = MAX_PATH + 3;
4258  lpstrAllFiles = heap_alloc_zero(nAllFilesMaxLength * sizeof(WCHAR));
4259  if (!lpstrAllFiles)
4260  goto ret;
4261 
4262  /* Loop through the selection, handle only files (not folders) */
4263  for (nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++)
4264  {
4265  pidl = (LPITEMIDLIST)((LPBYTE)cida + cida->aoffset[nFileToOpen + 1]);
4266  if (pidl)
4267  {
4268  if (!IsPidlFolder(fodInfos->Shell.FOIShellFolder, pidl))
4269  {
4270  if (nAllFilesLength + MAX_PATH + 3 > nAllFilesMaxLength)
4271  {
4272  nAllFilesMaxLength *= 2;
4273  lpstrTmp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpstrAllFiles, nAllFilesMaxLength * sizeof(WCHAR));
4274  if (!lpstrTmp)
4275  goto ret;
4276  lpstrAllFiles = lpstrTmp;
4277  }
4278  nFiles += 1;
4279  lpstrAllFiles[nAllFilesLength++] = '"';
4280  GetName(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, lpstrAllFiles + nAllFilesLength);
4281  nThisFileLength = lstrlenW(lpstrAllFiles + nAllFilesLength);
4282  nAllFilesLength += nThisFileLength;
4283  lpstrAllFiles[nAllFilesLength++] = '"';
4284  lpstrAllFiles[nAllFilesLength++] = ' ';
4285  }
4286  }
4287  }
4288 
4289  if (nFiles != 0)
4290  {
4291  /* If there's only one file, use the name as-is without quotes */
4292  lpstrTmp = lpstrAllFiles;
4293  if (nFiles == 1)
4294  {
4295  lpstrTmp += 1;
4296  lpstrTmp[nThisFileLength] = 0;
4297  }
4298  SetWindowTextW(fodInfos->DlgInfos.hwndFileName, lpstrTmp);
4299  /* Select the file name like Windows does */
4300  if (filename_is_edit(fodInfos))
4301  SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
4302  }
4303 
4304 ret:
4305  heap_free(lpstrAllFiles);
4306  COMCTL32_ReleaseStgMedium(medium);
4307 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl, DWORD dwFlags, LPWSTR lpstrFileName)
Definition: filedlg.c:4462
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
static void COMCTL32_ReleaseStgMedium(STGMEDIUM medium)
Definition: filedlg.c:4376
#define lstrlenW
Definition: compat.h:609
static FORMATETC get_def_format(void)
Definition: filedlg.c:4219
unsigned char * LPBYTE
Definition: typedefs.h:53
struct FileOpenDlgInfos::@336 Shell
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define EM_SETSEL
Definition: winuser.h:2000
UINT cidl
Definition: shlobj.h:499
int ret
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HeapReAlloc
Definition: compat.h:593
UINT aoffset[1]
Definition: shlobj.h:500
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4563
struct FileOpenDlgInfos::@338 DlgInfos
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1615
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227
Definition: shlobj.h:498
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by IShellBrowserImpl_OnSelChange().

◆ FILEDLG95_FILENAME_GetFileNames()

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

Definition at line 4346 of file filedlg.c.

4347 {
4349  UINT nFileCount = 0; /* number of files */
4350  UINT nStrLen = 0; /* length of string in edit control */
4351  LPWSTR lpstrEdit; /* buffer for string from edit control */
4352 
4353  TRACE("\n");
4354 
4355  /* get the filenames from the filename control */
4356  nStrLen = GetWindowTextLengthW( fodInfos->DlgInfos.hwndFileName );
4357  lpstrEdit = heap_alloc( (nStrLen+1)*sizeof(WCHAR) );
4358  GetWindowTextW( fodInfos->DlgInfos.hwndFileName, lpstrEdit, nStrLen+1);
4359 
4360  TRACE("nStrLen=%u str=%s\n", nStrLen, debugstr_w(lpstrEdit));
4361 
4362  nFileCount = COMDLG32_SplitFileNames(lpstrEdit, nStrLen, lpstrFileList, sizeUsed);
4363  heap_free(lpstrEdit);
4364  return nFileCount;
4365 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetWindowTextLengthW(_In_ HWND)
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed)
Definition: filedlg.c:774
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
unsigned int UINT
Definition: ndis.h:50
struct FileOpenDlgInfos::@338 DlgInfos
WCHAR * LPWSTR
Definition: xmlstorage.h:184
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_FILETYPE_Clean()

static void FILEDLG95_FILETYPE_Clean ( HWND  hwnd)
static

Definition at line 3714 of file filedlg.c.

3715 {
3717  int iPos;
3718  int iCount;
3719 
3720  iCount = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCOUNT, 0, 0);
3721 
3722  TRACE("\n");
3723 
3724  /* Delete each string of the combo and their associated data */
3725  if(iCount != CB_ERR)
3726  {
3727  for(iPos = iCount-1;iPos>=0;iPos--)
3728  {
3729  heap_free((void *)CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iPos));
3730  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_DELETESTRING, iPos, 0);
3731  }
3732  }
3733  /* Current filter */
3734  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3735 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
struct FileOpenDlgInfos::@337 ShellInfos
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct FileOpenDlgInfos::@338 DlgInfos
#define CB_GETCOUNT
Definition: winuser.h:1924
#define CB_DELETESTRING
Definition: winuser.h:1919
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_Clean().

◆ FILEDLG95_FILETYPE_Init()

static HRESULT FILEDLG95_FILETYPE_Init ( HWND  hwnd)
static

Definition at line 3529 of file filedlg.c.

3530 {
3532  int nFilters = 0; /* number of filters */
3533  int nFilterIndexCB;
3534 
3535  TRACE("%p\n", hwnd);
3536 
3537  if(fodInfos->customfilter)
3538  {
3539  /* customfilter has one entry... title\0ext\0
3540  * Set first entry of combo box item with customfilter
3541  */
3542  LPWSTR lpstrExt;
3543  LPCWSTR lpstrPos = fodInfos->customfilter;
3544 
3545  /* Get the title */
3546  lpstrPos += lstrlenW(fodInfos->customfilter) + 1;
3547 
3548  /* Copy the extensions */
3549  if (! *lpstrPos) return E_FAIL; /* malformed filter */
3550  if (!(lpstrExt = heap_alloc((lstrlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
3551  lstrcpyW(lpstrExt,lpstrPos);
3552 
3553  /* Add the item at the end of the combo */
3554  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_ADDSTRING, 0, (LPARAM)fodInfos->customfilter);
3555  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETITEMDATA, nFilters, (LPARAM)lpstrExt);
3556 
3557  nFilters++;
3558  }
3559  if(fodInfos->filter)
3560  {
3561  LPCWSTR lpstrPos = fodInfos->filter;
3562 
3563  for(;;)
3564  {
3565  /* filter is a list... title\0ext\0......\0\0
3566  * Set the combo item text to the title and the item data
3567  * to the ext
3568  */
3569  LPCWSTR lpstrDisplay;
3570  LPWSTR lpstrExt;
3571 
3572  /* Get the title */
3573  if(! *lpstrPos) break; /* end */
3574  lpstrDisplay = lpstrPos;
3575  lpstrPos += lstrlenW(lpstrPos) + 1;
3576 
3577  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_ADDSTRING, 0, (LPARAM)lpstrDisplay);
3578 
3579  nFilters++;
3580 
3581  /* Copy the extensions */
3582  if (!(lpstrExt = heap_alloc((lstrlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
3583  lstrcpyW(lpstrExt,lpstrPos);
3584  lpstrPos += lstrlenW(lpstrPos) + 1;
3585 
3586  /* Add the item at the end of the combo */
3587  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETITEMDATA, nFilters - 1, (LPARAM)lpstrExt);
3588 
3589  /* malformed filters are added anyway... */
3590  if (!*lpstrExt) break;
3591  }
3592  }
3593 
3594  /*
3595  * Set the current filter to the one specified
3596  * in the initialisation structure
3597  */
3598  if (fodInfos->filter || fodInfos->customfilter)
3599  {
3600  LPWSTR lpstrFilter;
3601 
3602  /* Check to make sure our index isn't out of bounds. */
3603  if ( fodInfos->ofnInfos->nFilterIndex >
3604  nFilters - (fodInfos->customfilter == NULL ? 0 : 1) )
3605  fodInfos->ofnInfos->nFilterIndex = (fodInfos->customfilter == NULL ? 1 : 0);
3606 
3607  /* set default filter index */
3608  if(fodInfos->ofnInfos->nFilterIndex == 0 && fodInfos->customfilter == NULL)
3609  fodInfos->ofnInfos->nFilterIndex = 1;
3610 
3611  /* calculate index of Combo Box item */
3612  nFilterIndexCB = fodInfos->ofnInfos->nFilterIndex;
3613  if (fodInfos->customfilter == NULL)
3614  nFilterIndexCB--;
3615 
3616  /* Set the current index selection. */
3617  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETCURSEL, nFilterIndexCB, 0);
3618 
3619  /* Get the corresponding text string from the combo box. */
3620  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3621  nFilterIndexCB);
3622 
3623  if ((INT_PTR)lpstrFilter == CB_ERR) /* control is empty */
3624  lpstrFilter = NULL;
3625 
3626  if(lpstrFilter)
3627  {
3628  DWORD len;
3629  CharLowerW(lpstrFilter); /* lowercase */
3630  len = lstrlenW(lpstrFilter)+1;
3631  fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc( len * sizeof(WCHAR) );
3632  lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
3633  }
3634  } else
3635  fodInfos->ofnInfos->nFilterIndex = 0;
3636  return S_OK;
3637 }
#define CB_SETITEMDATA
Definition: winuser.h:1948
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPWSTR WINAPI CharLowerW(_Inout_ LPWSTR)
int32_t INT_PTR
Definition: typedefs.h:64
#define lstrlenW
Definition: compat.h:609
#define E_FAIL
Definition: ddrawi.h:102
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define CB_ADDSTRING
Definition: winuser.h:1918
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_ERR
Definition: winuser.h:2410
DWORD nFilterIndex
Definition: commdlg.h:366
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define CB_SETCURSEL
Definition: winuser.h:1943
#define S_OK
Definition: intsafe.h:51
#define lstrcpyW
Definition: compat.h:608
struct FileOpenDlgInfos::@337 ShellInfos
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
struct FileOpenDlgInfos::@338 DlgInfos
WCHAR * LPWSTR
Definition: xmlstorage.h:184
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_FILETYPE_OnCommand()

static BOOL FILEDLG95_FILETYPE_OnCommand ( HWND  hwnd,
WORD  wNotifyCode 
)
static

Definition at line 3645 of file filedlg.c.

3646 {
3648 
3649  switch(wNotifyCode)
3650  {
3651  case CBN_SELENDOK:
3652  {
3653  LPWSTR lpstrFilter;
3654 
3655  /* Get the current item of the filetype combo box */
3656  int iItem = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCURSEL, 0, 0);
3657 
3658  /* set the current filter index */
3659  fodInfos->ofnInfos->nFilterIndex = iItem +
3660  (fodInfos->customfilter == NULL ? 1 : 0);
3661 
3662  /* Set the current filter with the current selection */
3663  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3664 
3665  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3666  iItem);
3667  if((INT_PTR)lpstrFilter != CB_ERR)
3668  {
3669  DWORD len;
3670  CharLowerW(lpstrFilter); /* lowercase */
3671  len = lstrlenW(lpstrFilter)+1;
3672  fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc( len * sizeof(WCHAR) );
3673  lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
3674  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3676  }
3677 
3678  /* Refresh the actual view to display the included items*/
3679  if (fodInfos->Shell.FOIShellView)
3680  IShellView_Refresh(fodInfos->Shell.FOIShellView);
3681  }
3682  }
3683  return FALSE;
3684 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
LPWSTR WINAPI CharLowerW(_Inout_ LPWSTR)
int32_t INT_PTR
Definition: typedefs.h:64
#define lstrlenW
Definition: compat.h:609
#define CB_GETCURSEL
Definition: winuser.h:1925
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define FALSE
Definition: types.h:117
#define CBN_SELENDOK
Definition: winuser.h:1963
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
struct FileOpenDlgInfos::@336 Shell
#define CB_ERR
Definition: winuser.h:2410
DWORD nFilterIndex
Definition: commdlg.h:366
LPOPENFILENAMEW ofnInfos
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define CDN_TYPECHANGE
Definition: commdlg.h:39
#define lstrcpyW
Definition: compat.h:608
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:1068
struct FileOpenDlgInfos::@337 ShellInfos
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
struct FileOpenDlgInfos::@338 DlgInfos
WCHAR * LPWSTR
Definition: xmlstorage.h:184
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_FILETYPE_SearchExt()

static int FILEDLG95_FILETYPE_SearchExt ( HWND  hwnd,
LPCWSTR  lpstrExt 
)
static

Definition at line 3690 of file filedlg.c.

3691 {
3692  int i, iCount;
3693 
3694  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
3695 
3696  TRACE("%s\n", debugstr_w(lpstrExt));
3697 
3698  if(iCount != CB_ERR)
3699  {
3700  for(i=0;i<iCount;i++)
3701  {
3702  if(!lstrcmpiW(lpstrExt,(LPWSTR)CBGetItemDataPtr(hwnd,i)))
3703  return i;
3704  }
3705  }
3706  return -1;
3707 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define debugstr_w
Definition: kernel32.h:32
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
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
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_FillControls()

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

Definition at line 2097 of file filedlg.c.

2098 {
2099  LPITEMIDLIST pidlItemId = NULL;
2100 
2101  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
2102 
2103  TRACE("dir=%s file=%s\n",
2104  debugstr_w(fodInfos->initdir), debugstr_w(fodInfos->filename));
2105 
2106  /* Get the initial directory pidl */
2107 
2108  if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->initdir)))
2109  {
2110  WCHAR path[MAX_PATH];
2111 
2113  pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder, path);
2114  }
2115 
2116  /* Initialise shell objects */
2118 
2119  /* Initialize the Look In combo box */
2120  FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB);
2121 
2122  /* Browse to the initial directory */
2123  IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId, SBSP_ABSOLUTE);
2124 
2125  ILFree(pidlItemId);
2126 
2127  return TRUE;
2128 }
static void FILEDLG95_LOOKIN_Init(HWND hwndCombo)
Definition: filedlg.c:3763
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define TRUE
Definition: types.h:120
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
static LRESULT FILEDLG95_SHELL_Init(HWND hwnd)
Definition: filedlg.c:3416
#define debugstr_w
Definition: kernel32.h:32
struct FileOpenDlgInfos::@336 Shell
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
static LPITEMIDLIST GetPidlFromName(IShellFolder *psf, LPWSTR lpcstrFileName)
Definition: filedlg.c:4537
#define NULL
Definition: types.h:112
struct FileOpenDlgInfos::@338 DlgInfos
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPARAM lParam
Definition: combotst.c:139

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_Handle_GetFilePath()

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

Definition at line 1097 of file filedlg.c.

1098 {
1099  UINT len, total;
1100  WCHAR *p, *buffer;
1102 
1103  TRACE("CDM_GETFILEPATH:\n");
1104 
1105  if ( ! (fodInfos->ofnInfos->Flags & OFN_EXPLORER ) )
1106  return -1;
1107 
1108  /* get path and filenames */
1109  len = SendMessageW( fodInfos->DlgInfos.hwndFileName, WM_GETTEXTLENGTH, 0, 0 );
1110  buffer = heap_alloc( (len + 2 + MAX_PATH) * sizeof(WCHAR) );
1111  COMDLG32_GetDisplayNameOf( fodInfos->ShellInfos.pidlAbsCurrent, buffer );
1112  if (len)
1113  {
1114  p = buffer + lstrlenW(buffer);
1115  *p++ = '\\';
1116  SendMessageW( fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, len + 1, (LPARAM)p );
1117  }
1118  if (fodInfos->unicode)
1119  {
1120  total = lstrlenW( buffer) + 1;
1121  if (result) lstrcpynW( result, buffer, size );
1122  TRACE( "CDM_GETFILEPATH: returning %u %s\n", total, debugstr_w(result));
1123  }
1124  else
1125  {
1126  total = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL );
1127  if (total <= size) WideCharToMultiByte( CP_ACP, 0, buffer, -1, result, size, NULL, NULL );
1128  TRACE( "CDM_GETFILEPATH: returning %u %s\n", total, debugstr_a(result));
1129  }
1130  heap_free( buffer );
1131  return total;
1132 }
#define OFN_EXPLORER
Definition: commdlg.h:104
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define WideCharToMultiByte
Definition: compat.h:111
GLuint64EXT * result
Definition: glext.h:11304
#define CP_ACP
Definition: compat.h:109
#define WM_GETTEXT
Definition: winuser.h:1600
GLuint buffer
Definition: glext.h:5915
#define lstrlenW
Definition: compat.h:609
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define lstrcpynW
Definition: compat.h:597
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:713
#define debugstr_w
Definition: kernel32.h:32
LONG_PTR LPARAM
Definition: windef.h:208
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
GLenum GLsizei len
Definition: glext.h:6722
struct FileOpenDlgInfos::@337 ShellInfos
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
size_t total
struct FileOpenDlgInfos::@338 DlgInfos
GLfloat GLfloat p
Definition: glext.h:8902
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_HandleCustomDialogMessages().

◆ FILEDLG95_HandleCustomDialogMessages()

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

Definition at line 1139 of file filedlg.c.

1140 {
1142  WCHAR lpstrPath[MAX_PATH];
1143  INT_PTR retval;
1144 
1145  if(!fodInfos) return FALSE;
1146 
1147  switch(uMsg)
1148  {
1149  case CDM_GETFILEPATH:
1151  break;
1152 
1153  case CDM_GETFOLDERPATH:
1154  TRACE("CDM_GETFOLDERPATH:\n");
1155  COMDLG32_GetDisplayNameOf(fodInfos->ShellInfos.pidlAbsCurrent, lpstrPath);
1156  if (lParam)
1157  {
1158  if (fodInfos->unicode)
1159  lstrcpynW((LPWSTR)lParam, lpstrPath, (int)wParam);
1160  else
1161  WideCharToMultiByte(CP_ACP, 0, lpstrPath, -1,
1162  (LPSTR)lParam, (int)wParam, NULL, NULL);
1163  }
1164  retval = lstrlenW(lpstrPath) + 1;
1165  break;
1166 
1167  case CDM_GETFOLDERIDLIST:
1168  retval = ILGetSize(fodInfos->ShellInfos.pidlAbsCurrent);
1169  if (retval <= wParam)
1170  memcpy((void*)lParam, fodInfos->ShellInfos.pidlAbsCurrent, retval);
1171  break;
1172 
1173  case CDM_GETSPEC:
1174  TRACE("CDM_GETSPEC:\n");
1175  retval = SendMessageW(fodInfos->DlgInfos.hwndFileName, WM_GETTEXTLENGTH, 0, 0) + 1;
1176  if (lParam)
1177  {
1178  if (fodInfos->unicode)
1179  SendMessageW(fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, wParam, lParam);
1180  else
1181  SendMessageA(fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, wParam, lParam);
1182  }
1183  break;
1184 
1185  case CDM_SETCONTROLTEXT:
1186  TRACE("CDM_SETCONTROLTEXT:\n");
1187  if ( lParam )
1188  {
1189  if( fodInfos->unicode )
1191  else
1193  }
1194  retval = TRUE;
1195  break;
1196 
1197  case CDM_HIDECONTROL:
1198  /* MSDN states that it should fail for not OFN_EXPLORER case */
1199  if (fodInfos->ofnInfos->Flags & OFN_EXPLORER)
1200  {
1201  HWND control = GetDlgItem( hwnd, wParam );
1202  if (control) ShowWindow( control, SW_HIDE );
1203  retval = TRUE;
1204  }
1205  else retval = FALSE;
1206  break;
1207 
1208  default:
1209  if (uMsg >= CDM_FIRST && uMsg <= CDM_LAST)
1210  FIXME("message CDM_FIRST+%04x not implemented\n", uMsg - CDM_FIRST);
1211  return FALSE;
1212  }
1214  return TRUE;
1215 }
#define OFN_EXPLORER
Definition: commdlg.h:104
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define WideCharToMultiByte
Definition: compat.h:111
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CP_ACP
Definition: compat.h:109
BOOL WINAPI SetDlgItemTextA(_In_ HWND, _In_ int, _In_ LPCSTR)
#define WM_GETTEXT
Definition: winuser.h:1600
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:64
char * LPSTR
Definition: xmlstorage.h:182
#define CDM_LAST
Definition: commdlg.h:42
#define lstrlenW
Definition: compat.h:609
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define lstrcpynW
Definition: compat.h:597
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:713
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define CDM_GETFOLDERPATH
Definition: commdlg.h:45
#define CDM_HIDECONTROL
Definition: commdlg.h:48
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
#define CDM_FIRST
Definition: commdlg.h:41
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CDM_GETSPEC
Definition: commdlg.h:43
#define CDM_GETFILEPATH
Definition: commdlg.h:44
static INT_PTR FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID result)
Definition: filedlg.c:1097
#define MAX_PATH
Definition: compat.h:34
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CDM_SETCONTROLTEXT
Definition: commdlg.h:47
struct FileOpenDlgInfos::@337 ShellInfos
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define ILGetSize
Definition: shellclasses.h:638
struct FileOpenDlgInfos::@338 DlgInfos
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define CDM_GETFOLDERIDLIST
Definition: commdlg.h:46
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_InitControls()

static LRESULT FILEDLG95_InitControls ( HWND  hwnd)
static

Definition at line 1626 of file filedlg.c.

1627 {
1628  BOOL win2000plus = FALSE;
1629  BOOL win98plus = FALSE;
1630  BOOL handledPath = FALSE;
1631  OSVERSIONINFOW osVi;
1632  static const WCHAR szwSlash[] = { '\\', 0 };
1633  static const WCHAR szwStar[] = { '*',0 };
1634 
1635  static const TBBUTTON tbb[] =
1636  {
1637  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1639  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1641  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1643  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1646  };
1647  static const TBADDBITMAP tba = {HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR};
1648 
1649  RECT rectTB;
1650  RECT rectlook;
1651 
1652  HIMAGELIST toolbarImageList;
1653  ITEMIDLIST *desktopPidl;
1655 
1657 
1658  TRACE("%p\n", fodInfos);
1659 
1660  /* Get windows version emulating */
1661  osVi.dwOSVersionInfoSize = sizeof(osVi);
1662  GetVersionExW(&osVi);
1664  win98plus = ((osVi.dwMajorVersion > 4) || ((osVi.dwMajorVersion == 4) && (osVi.dwMinorVersion > 0)));
1665  } else if (osVi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
1666  win2000plus = (osVi.dwMajorVersion > 4);
1667  if (win2000plus) win98plus = TRUE;
1668  }
1669  TRACE("Running on 2000+ %d, 98+ %d\n", win2000plus, win98plus);
1670 
1671 
1672  /* Use either the edit or the comboboxex for the filename control */
1673  if (filename_is_edit( fodInfos ))
1674  {
1676  fodInfos->DlgInfos.hwndFileName = GetDlgItem( hwnd, edt1 );
1677  }
1678  else
1679  {
1681  fodInfos->DlgInfos.hwndFileName = GetDlgItem( hwnd, cmb13 );
1682  }
1683 
1684  /* Get the hwnd of the controls */
1685  fodInfos->DlgInfos.hwndFileTypeCB = GetDlgItem(hwnd,IDC_FILETYPE);
1686  fodInfos->DlgInfos.hwndLookInCB = GetDlgItem(hwnd,IDC_LOOKIN);
1687 
1688  GetWindowRect( fodInfos->DlgInfos.hwndLookInCB,&rectlook);
1689  MapWindowPoints( 0, hwnd,(LPPOINT)&rectlook,2);
1690 
1691  /* construct the toolbar */
1693  MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2);
1694 
1695  rectTB.right = rectlook.right + rectTB.right - rectTB.left;
1696  rectTB.bottom = rectlook.top - 1 + rectTB.bottom - rectTB.top;
1697  rectTB.left = rectlook.right;
1698  rectTB.top = rectlook.top-1;
1699 
1700  if (fodInfos->unicode)
1701  fodInfos->DlgInfos.hwndTB = CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL,
1703  rectTB.left, rectTB.top,
1704  rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
1706  else
1707  fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL,
1709  rectTB.left, rectTB.top,
1710  rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
1712 
1713  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
1714 
1715 /* FIXME: use TB_LOADIMAGES when implemented */
1716 /* SendMessageW(fodInfos->DlgInfos.hwndTB, TB_LOADIMAGES, IDB_VIEW_SMALL_COLOR, HINST_COMMCTRL);*/
1717  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_SETMAXTEXTROWS, 0, 0);
1718  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, 12, (LPARAM) &tba);
1719 
1720  /* Retrieve and add desktop icon to the toolbar */
1721  toolbarImageList = (HIMAGELIST)SendMessageW(fodInfos->DlgInfos.hwndTB, TB_GETIMAGELIST, 0, 0L);
1723  SHGetFileInfoW((const WCHAR *)desktopPidl, 0, &fileinfo, sizeof(fileinfo),
1725  ImageList_AddIcon(toolbarImageList, fileinfo.hIcon);
1726 
1727  DestroyIcon(fileinfo.hIcon);
1728  CoTaskMemFree(desktopPidl);
1729 
1730  /* Finish Toolbar Construction */
1731  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSW, 9, (LPARAM) tbb);
1732  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
1733 
1734  if (is_places_bar_enabled(fodInfos))
1735  {
1736  TBBUTTON tb = { 0 };
1737  HIMAGELIST himl;
1738  RECT rect;
1739  int i, cx;
1740 
1743  cx = rect.right - rect.left;
1744 
1747 
1748  filedlg_collect_places_pidls(fodInfos);
1749  for (i = 0; i < ARRAY_SIZE(fodInfos->places); i++)
1750  {
1751  int index;
1752 
1753  if (!fodInfos->places[i])
1754  continue;
1755 
1756  memset(&fileinfo, 0, sizeof(fileinfo));
1757  SHGetFileInfoW((const WCHAR *)fodInfos->places[i], 0, &fileinfo, sizeof(fileinfo),
1760 
1761  tb.iBitmap = index;
1762  tb.iString = (INT_PTR)fileinfo.szDisplayName;
1763  tb.fsState = TBSTATE_ENABLED | TBSTATE_WRAP;
1764  tb.idCommand = TBPLACES_CMDID_PLACE0 + i;
1766 
1767  DestroyIcon(fileinfo.hIcon);
1768  }
1769 
1772  }
1773 
1774  /* Set the window text with the text specified in the OPENFILENAME structure */
1775  if(fodInfos->title)
1776  {
1777  SetWindowTextW(hwnd,fodInfos->title);
1778  }
1779  else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
1780  {
1781  WCHAR buf[64];
1784  }
1785 
1786  /* Initialise the file name edit control */
1787  handledPath = FALSE;
1788  TRACE("Before manipulation, file = %s, dir = %s\n", debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1789 
1790  if(fodInfos->filename)
1791  {
1792  /* 1. If win2000 or higher and filename contains a path, use it
1793  in preference over the lpstrInitialDir */
1794  if (win2000plus && *fodInfos->filename && wcspbrk(fodInfos->filename, szwSlash)) {
1795  WCHAR tmpBuf[MAX_PATH];
1796  WCHAR *nameBit;
1797  DWORD result;
1798 
1799  result = GetFullPathNameW(fodInfos->filename, MAX_PATH, tmpBuf, &nameBit);
1800  if (result) {
1801 
1802  /* nameBit is always shorter than the original filename. It may be NULL
1803  * when the filename contains only a drive name instead of file name */
1804  if (nameBit)
1805  {
1806  lstrcpyW(fodInfos->filename,nameBit);
1807  *nameBit = 0x00;
1808  }
1809  else
1810  *fodInfos->filename = '\0';
1811 
1812  heap_free(fodInfos->initdir);
1813  fodInfos->initdir = heap_alloc((lstrlenW(tmpBuf) + 1)*sizeof(WCHAR));
1814  lstrcpyW(fodInfos->initdir, tmpBuf);
1815  handledPath = TRUE;
1816  TRACE("Value in Filename includes path, overriding InitialDir: %s, %s\n",
1817  debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1818  }
1819  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1820 
1821  } else {
1822  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1823  }
1824  }
1825 
1826  /* 2. (All platforms) If initdir is not null, then use it */
1827  if (!handledPath && fodInfos->initdir && *fodInfos->initdir)
1828  {
1829  /* Work out the proper path as supplied one might be relative */
1830  /* (Here because supplying '.' as dir browses to My Computer) */
1831  WCHAR tmpBuf[MAX_PATH];
1832  WCHAR tmpBuf2[MAX_PATH];
1833  WCHAR *nameBit;
1834  DWORD result;
1835 
1836  lstrcpyW(tmpBuf, fodInfos->initdir);
1837  if (PathFileExistsW(tmpBuf)) {
1838  /* initdir does not have to be a directory. If a file is
1839  * specified, the dir part is taken */
1840  if (PathIsDirectoryW(tmpBuf)) {
1841  PathAddBackslashW(tmpBuf);
1842  lstrcatW(tmpBuf, szwStar);
1843  }
1844  result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit);
1845  if (result) {
1846  *nameBit = 0x00;
1847  heap_free(fodInfos->initdir);
1848  fodInfos->initdir = heap_alloc((lstrlenW(tmpBuf2) + 1) * sizeof(WCHAR));
1849  lstrcpyW(fodInfos->initdir, tmpBuf2);
1850  handledPath = TRUE;
1851  TRACE("Value in InitDir changed to %s\n", debugstr_w(fodInfos->initdir));
1852  }
1853  }
1854  else if (fodInfos->initdir)
1855  {
1856  heap_free(fodInfos->initdir);
1857  fodInfos->initdir = NULL;
1858  TRACE("Value in InitDir is not an existing path, changed to (nil)\n");
1859  }
1860  }
1861 
1862 #ifdef __REACTOS__
1863  if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir))
1864  {
1865  /* 2.5. Win2000+: Recently used defext */
1866  if (win2000plus) {
1867  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1868  fodInfos->initdir[0] = '\0';
1869 
1870  FILEDLG95_MRU_load_ext(fodInfos->initdir, MAX_PATH, fodInfos->defext);
1871 
1872  if (fodInfos->initdir[0] && PathIsDirectoryW(fodInfos->initdir)) {
1873  handledPath = TRUE;
1874  } else {
1875  heap_free(fodInfos->initdir);
1876  fodInfos->initdir = NULL;
1877  }
1878  }
1879  }
1880 #endif
1881 
1882  if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir))
1883  {
1884  /* 3. All except w2k+: if filename contains a path use it */
1885  if (!win2000plus && fodInfos->filename &&
1886  *fodInfos->filename &&
1887  wcspbrk(fodInfos->filename, szwSlash)) {
1888  WCHAR tmpBuf[MAX_PATH];
1889  WCHAR *nameBit;
1890  DWORD result;
1891 
1893  tmpBuf, &nameBit);
1894  if (result) {
1895  int len;
1896 
1897  /* nameBit is always shorter than the original filename */
1898  lstrcpyW(fodInfos->filename, nameBit);
1899  *nameBit = 0x00;
1900 
1901  len = lstrlenW(tmpBuf);
1902  heap_free(fodInfos->initdir);
1903  fodInfos->initdir = heap_alloc((len+1)*sizeof(WCHAR));
1904  lstrcpyW(fodInfos->initdir, tmpBuf);
1905 
1906  handledPath = TRUE;
1907  TRACE("Value in Filename includes path, overriding initdir: %s, %s\n",
1908  debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1909  }
1910  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1911  }
1912 
1913  /* 4. Win2000+: Recently used */
1914  if (!handledPath && win2000plus) {
1915  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1916  fodInfos->initdir[0] = '\0';
1917 
1919 
1920  if (fodInfos->initdir[0] && PathFileExistsW(fodInfos->initdir)){
1921  handledPath = TRUE;
1922  }else{
1923  heap_free(fodInfos->initdir);
1924  fodInfos->initdir = NULL;
1925  }
1926  }
1927 
1928  /* 5. win98+ and win2000+ if any files of specified filter types in
1929  current directory, use it */
1930  if (win98plus && !handledPath && fodInfos->filter && *fodInfos->filter) {
1931 
1932  LPCWSTR lpstrPos = fodInfos->filter;
1933  WIN32_FIND_DATAW FindFileData;
1934  HANDLE hFind;
1935 
1936  while (1)
1937  {
1938  /* filter is a list... title\0ext\0......\0\0 */
1939 
1940  /* Skip the title */
1941  if(! *lpstrPos) break; /* end */
1942  lpstrPos += lstrlenW(lpstrPos) + 1;
1943 
1944  /* See if any files exist in the current dir with this extension */
1945  if(! *lpstrPos) break; /* end */
1946 
1947  hFind = FindFirstFileW(lpstrPos, &FindFileData);
1948 
1949  if (hFind == INVALID_HANDLE_VALUE) {
1950  /* None found - continue search */
1951  lpstrPos += lstrlenW(lpstrPos) + 1;
1952 
1953  } else {
1954 
1955  heap_free(fodInfos->initdir);
1956  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1958 
1959  handledPath = TRUE;
1960  TRACE("No initial dir specified, but files of type %s found in current, so using it\n",
1961  debugstr_w(lpstrPos));
1962  FindClose(hFind);
1963  break;
1964  }
1965  }
1966  }
1967 
1968  /* 6. Win98+ and 2000+: Use personal files dir, others use current dir */
1969  if (!handledPath && (win2000plus || win98plus)) {
1970  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1971 
1972  if (SHGetFolderPathW(hwnd, CSIDL_PERSONAL, 0, 0, fodInfos->initdir) == S_OK)
1973  {
1975  {
1976  /* last fallback */
1978  TRACE("No personal or desktop dir, using cwd as failsafe: %s\n", debugstr_w(fodInfos->initdir));
1979  }
1980  else
1981  TRACE("No personal dir, using desktop instead: %s\n", debugstr_w(fodInfos->initdir));
1982  }
1983  else
1984  TRACE("No initial dir specified, using personal files dir of %s\n", debugstr_w(fodInfos->initdir));
1985 
1986  handledPath = TRUE;
1987  } else if (!handledPath) {
1988  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1990  handledPath = TRUE;
1991  TRACE("No initial dir specified, using current dir of %s\n", debugstr_w(fodInfos->initdir));
1992  }
1993  }
1994  SetFocus( fodInfos->DlgInfos.hwndFileName );
1995  TRACE("After manipulation, file = %s, dir = %s\n", debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1996 
1997  /* Must the open as read only check box be checked ?*/
1998  if(fodInfos->ofnInfos->Flags & OFN_READONLY)
1999  {
2001  }
2002 
2003  /* Must the open as read only check box be hidden? */
2004  if (filedialog_is_readonly_hidden(fodInfos))
2005  {
2008  }
2009 
2010  /* Must the help button be hidden? */
2011  if (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP))
2012  {
2015  }
2016 
2017  /* change Open to Save */
2018  if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
2019  {
2020 #ifdef __REACTOS__
2021  WCHAR buf[24];
2022 #else
2023  WCHAR buf[16];
2024 #endif
2029  }
2030 
2031  /* Initialize the filter combo box */
2033 
2034  return 0;
2035 }
#define WS_GROUP
Definition: pedump.c:633
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define IDC_TOOLBARPLACES
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1702
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define TB_SETBUTTONSIZE
Definition: commctrl.h:1131
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:236
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1130
#define FCIDM_TB_REPORTVIEW
Definition: shresdef.h:799
#define IDOK
Definition: winuser.h:824
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define IDS_SAVE_AS
Definition: cdlg.h:180
GLuint64EXT * result
Definition: glext.h:11304
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
static BOOL is_places_bar_enabled(const FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:354
#define TRUE
Definition: types.h:120
#define CSIDL_DESKTOP
Definition: shlobj.h:2012
#define SW_HIDE
Definition: winuser.h:762
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
static BOOL filedialog_is_readonly_hidden(const FileOpenDlgInfos *info)
Definition: filedlg.c:237
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
#define IDC_OPENREADONLY
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:939
LONG top
Definition: windef.h:307
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1105
HWND WINAPI SetFocus(_In_opt_ HWND)
#define VIEW_LIST
Definition: commctrl.h:1085
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:64
#define TB_GETIMAGELIST
Definition: commctrl.h:1147
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
#define cmb13
Definition: dlgs.h:60
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:609
HIMAGELIST himl
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SHGFI_SMALLICON
Definition: shellapi.h:174
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
& rect
Definition: startmenu.cpp:1413
#define IDS_SAVE_BUTTON
Definition: cdlg.h:177
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define ILC_COLOR32
Definition: commctrl.h:354
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define TB_SETMAXTEXTROWS
Definition: commctrl.h:1158
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static void FILEDLG95_MRU_load_filename(LPWSTR stored_path)
Definition: filedlg.c:2570
#define CCS_NODIVIDER
Definition: commctrl.h:2244
#define BTNS_BUTTON
Definition: commctrl.h:994
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define FALSE
Definition: types.h:117
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDC_FILETYPE
#define TB_AUTOSIZE
Definition: commctrl.h:1133
#define FCIDM_TB_UPFOLDER
Definition: shresdef.h:796
#define debugstr_w
Definition: kernel32.h:32
#define SHGFI_PIDL
Definition: shellapi.h:178
#define SM_CXICON
Definition: winuser.h:962
#define FODPROP_SAVEDLG
#define FCIDM_TB_NEWFOLDER
Definition: shresdef.h:797
LONG_PTR LPARAM
Definition: windef.h:208
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
#define IDS_SAVE_IN
Definition: cdlg.h:178
GLuint index
Definition: glext.h:6031
#define IDC_LOOKINSTATIC
#define VIEW_DETAILS
Definition: commctrl.h:1086
LPOPENFILENAMEW ofnInfos
#define TB_SETIMAGELIST
Definition: commctrl.h:1146
#define IDB_VIEW_SMALL_COLOR
Definition: commctrl.h:1062
#define BM_SETCHECK
Definition: winuser.h:1903
#define TRACE(s)
Definition: solgame.cpp:4
#define TBPLACES_CMDID_PLACE0
Definition: filedlg.c:200
ULONG dwMajorVersion
Definition: rtltypes.h:247
#define BTNS_SEP
Definition: commctrl.h:995
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:413
#define IDC_LOOKIN
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2830
#define VIEW_NEWFOLDER
Definition: commctrl.h:1094
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:246
#define MAX_PATH
Definition: compat.h:34
LPITEMIDLIST places[5]
#define FCIDM_TB_DESKTOP
Definition: shresdef.h:800
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_TOOLBAR
Definition: wordpad.h:157
static const WCHAR tb[]
Definition: suminfo.c:286
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:985
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
#define OFN_READONLY
Definition: commdlg.h:118
#define TB_ADDBITMAP
Definition: commctrl.h:1052
#define CCS_NORESIZE
Definition: commctrl.h:2241
#define edt1
Definition: dlgs.h:65
#define SM_CYICON
Definition: winuser.h:963
#define index(s, c)
Definition: various.h:29
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:320
static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
Definition: filedlg.c:3529
#define TB_ADDBUTTONSW
Definition: commctrl.h:1262
GLenum GLsizei len
Definition: glext.h:6722
#define TB_SETBUTTONWIDTH
Definition: commctrl.h:1157
ULONG dwPlatformId
Definition: rtltypes.h:250
#define IDC_TOOLBARSTATIC
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define TOOLBARCLASSNAMEA
Definition: commctrl.h:940
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:51
#define lstrcpyW
Definition: compat.h:608
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void filedlg_collect_places_pidls(FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:376
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
#define FCIDM_TB_SMALLICON
Definition: shresdef.h:798
#define NULL
Definition: types.h:112
#define CSIDL_FLAG_CREATE
#define pshHelp
Definition: dlgs.h:127
#define HINST_COMMCTRL
Definition: commctrl.h:1059
#define VER_PLATFORM_WIN32_WINDOWS
Definition: rtltypes.h:235
ULONG dwMinorVersion
Definition: rtltypes.h:248
#define CSIDL_PERSONAL
Definition: shlobj.h:2017
_Out_opt_ int * cx
Definition: commctrl.h:581
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2208
#define TBSTATE_ENABLED
Definition: commctrl.h:970
struct FileOpenDlgInfos::@338 DlgInfos
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define TBSTATE_WRAP
Definition: commctrl.h:973
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define VIEW_PARENTFOLDER
Definition: commctrl.h:1091
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2027
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define SHGFI_ICON
Definition: shellapi.h:162
#define WS_VISIBLE
Definition: pedump.c:620
#define memset(x, y, z)
Definition: compat.h:39
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1615
#define TBSTYLE_FLAT
Definition: commctrl.h:988
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227
#define OFN_SHOWHELP
Definition: commdlg.h:120
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_LOOKIN_AddItem()

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

Definition at line 3984 of file filedlg.c.

3985 {
3986  LPITEMIDLIST pidlNext;
3987  SHFILEINFOW sfi;
3988  SFOLDER *tmpFolder;
3989  LookInInfos *liInfos;
3990 
3991  TRACE("%p, %p, %d\n", hwnd, pidl, iInsertId);
3992 
3993  if(!pidl)
3994  return -1;
3995 
3996  if(!(liInfos = GetPropA(hwnd,LookInInfosStr)))
3997  return -1;
3998 
3999  tmpFolder = heap_alloc_zero(sizeof(*tmpFolder));
4000  tmpFolder->m_iIndent = 0;
4001 
4002  /* Calculate the indentation of the item in the lookin*/
4003  pidlNext = pidl;
4004  while ((pidlNext = ILGetNext(pidlNext)))
4005  {
4006  tmpFolder->m_iIndent++;
4007  }
4008 
4009  tmpFolder->pidlItem = ILClone(pidl);
4010 
4011  if(tmpFolder->m_iIndent > liInfos->iMaxIndentation)
4012  liInfos->iMaxIndentation = tmpFolder->m_iIndent;
4013 
4014  sfi.dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
4015  SHGetFileInfoW((LPCWSTR)pidl,
4016  0,
4017  &sfi,
4018  sizeof(sfi),
4020 
4021  TRACE("-- Add %s attr=0x%08x\n", debugstr_w(sfi.szDisplayName), sfi.dwAttributes);
4022 
4023  if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
4024  {
4025  int iItemID;
4026 
4027  TRACE("-- Add %s at %u\n", debugstr_w(sfi.szDisplayName), tmpFolder->m_iIndent);
4028 
4029  /* Add the item at the end of the list */
4030  if(iInsertId < 0)
4031  {
4032  iItemID = SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)sfi.szDisplayName);
4033  }
4034  /* Insert the item at the iInsertId position*/
4035  else
4036  {
4037  iItemID = SendMessageW(hwnd, CB_INSERTSTRING, iInsertId, (LPARAM)sfi.szDisplayName);
4038  }
4039 
4040  SendMessageW(hwnd, CB_SETITEMDATA, iItemID, (LPARAM)tmpFolder);
4041  return iItemID;
4042  }
4043 
4044  ILFree( tmpFolder->pidlItem );
4045  heap_free( tmpFolder );
4046  return -1;
4047 
4048 }
#define CB_SETITEMDATA
Definition: winuser.h:1948
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static const char LookInInfosStr[]
Definition: filedlg.c:215
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD dwAttributes
Definition: shellapi.h:372
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
int iMaxIndentation
Definition: filedlg.c:105
#define debugstr_w
Definition: kernel32.h:32
#define SHGFI_PIDL
Definition: shellapi.h:178
#define CB_ADDSTRING
Definition: winuser.h:1918
#define CB_INSERTSTRING
Definition: winuser.h:1939
LONG_PTR LPARAM
Definition: windef.h:208
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
#define TRACE(s)
Definition: solgame.cpp:4
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:413
int m_iIndent
Definition: filedlg.c:98
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:166
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define SHGFI_ATTR_SPECIFIED
Definition: shellapi.h:172
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_LOOKIN_Init(), and FILEDLG95_LOOKIN_InsertItemAfterParent().

◆ FILEDLG95_LOOKIN_Clean()

static void FILEDLG95_LOOKIN_Clean ( HWND  hwnd)
static

Definition at line 4187 of file filedlg.c.

4188 {
4190  LookInInfos *liInfos = GetPropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4191  int iPos, iCount;
4192 
4193  iCount = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCOUNT, 0, 0);
4194 
4195  TRACE("\n");
4196 
4197  /* Delete each string of the combo and their associated data */
4198  if (iCount != CB_ERR)
4199  {
4200  for(iPos = iCount-1;iPos>=0;iPos--)
4201  {
4202  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,iPos);
4203  ILFree(tmpFolder->pidlItem);
4204  heap_free(tmpFolder);
4205  SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_DELETESTRING, iPos, 0);
4206  }
4207  }
4208 
4209  /* LookInInfos structure */
4210  heap_free(liInfos);
4211  RemovePropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4212 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HANDLE WINAPI RemovePropA(_In_ HWND, _In_ LPCSTR)
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static const char LookInInfosStr[]
Definition: filedlg.c:215
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct FileOpenDlgInfos::@338 DlgInfos
#define CB_GETCOUNT
Definition: winuser.h:1924
#define CB_DELETESTRING
Definition: winuser.h:1919
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
struct SFolder * LPSFOLDER

Referenced by FILEDLG95_Clean().

◆ FILEDLG95_LOOKIN_DrawItem()

static LRESULT FILEDLG95_LOOKIN_DrawItem ( LPDRAWITEMSTRUCT  pDIStruct)
static

Definition at line 3848 of file filedlg.c.

3849 {
3851  COLORREF crHighLight = GetSysColor(COLOR_HIGHLIGHT);
3853  RECT rectText;
3854  RECT rectIcon;
3855  SHFILEINFOW sfi;
3856  HIMAGELIST ilItemImage;
3857  int iIndentation;
3858  TEXTMETRICW tm;
3859  LPSFOLDER tmpFolder;
3861  UINT icon_width, icon_height;
3862 
3863  TRACE("\n");
3864 
3865  if(pDIStruct->itemID == -1)
3866  return 0;
3867 
3868  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem,
3869  pDIStruct->itemID)))
3870  return 0;
3871 
3872 
3873  icon_width = GetSystemMetrics(SM_CXICON);
3874  icon_height = GetSystemMetrics(SM_CYICON);
3875  if (pDIStruct->rcItem.bottom - pDIStruct->rcItem.top < icon_height)
3876  {
3877  icon_width = GetSystemMetrics(SM_CXSMICON);
3878  icon_height = GetSystemMetrics(SM_CYSMICON);
3879  shgfi_flags |= SHGFI_SMALLICON;
3880  }
3881 
3882  ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
3883  0, &sfi, sizeof (sfi), shgfi_flags );
3884 
3885  /* Is this item selected ? */
3886  if(pDIStruct->itemState & ODS_SELECTED)
3887  {
3888  SetTextColor(pDIStruct->hDC,(0x00FFFFFF & ~(crText)));
3889  SetBkColor(pDIStruct->hDC,crHighLight);
3890  FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_HIGHLIGHT));
3891  }
3892  else
3893  {
3894  SetTextColor(pDIStruct->hDC,crText);
3895  SetBkColor(pDIStruct->hDC,crWin);
3896  FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_WINDOW));
3897  }
3898 
3899  /* Do not indent item if drawing in the edit of the combo */
3900  if(pDIStruct->itemState & ODS_COMBOBOXEDIT)
3901  iIndentation = 0;
3902  else
3903  iIndentation = tmpFolder->m_iIndent;
3904 
3905  /* Draw text and icon */
3906 
3907  /* Initialise the icon display area */
3908  rectIcon.left = pDIStruct->rcItem.left + 1 + icon_width/2 * iIndentation;
3909  rectIcon.top = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - icon_height) / 2;
3910  rectIcon.right = rectIcon.left + icon_width + XTEXTOFFSET;
3911  rectIcon.bottom = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + icon_height) / 2;
3912 
3913  /* Initialise the text display area */
3914  GetTextMetricsW(pDIStruct->hDC, &tm);
3915  rectText.left = rectIcon.right;
3916  rectText.top =
3917  (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - tm.tmHeight) / 2;
3918  rectText.right = pDIStruct->rcItem.right;
3919  rectText.bottom =
3920  (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + tm.tmHeight) / 2;
3921 
3922  /* Draw the icon from the image list */
3923  ImageList_Draw(ilItemImage,
3924  sfi.iIcon,
3925  pDIStruct->hDC,
3926  rectIcon.left,
3927  rectIcon.top,
3928  ILD_TRANSPARENT );
3929 
3930  /* Draw the associated text */
3931  TextOutW(pDIStruct->hDC,rectText.left,rectText.top,sfi.szDisplayName,lstrlenW(sfi.szDisplayName));
3932  return NOERROR;
3933 }
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:169
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define NOERROR
Definition: winerror.h:2354
LONG top
Definition: windef.h:307
#define SM_CYSMICON
Definition: winuser.h:1003
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:609
#define SHGFI_SMALLICON
Definition: shellapi.h:174
#define COLOR_WINDOW
Definition: winuser.h:908
DWORD WINAPI GetSysColor(_In_ int)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:977
#define SHGFI_PIDL
Definition: shellapi.h:178
#define SM_CXICON
Definition: winuser.h:962
#define SHGFI_OPENICON
Definition: shellapi.h:176
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
#define XTEXTOFFSET
Definition: filedlg.c:187
#define TRACE(s)
Definition: solgame.cpp:4
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:413
DWORD COLORREF
Definition: windef.h:300
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
int m_iIndent
Definition: filedlg.c:98
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1002
#define SM_CYICON
Definition: winuser.h:963
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:320
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
Definition: time.h:76
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define ILD_TRANSPARENT
Definition: commctrl.h:414
unsigned int UINT
Definition: ndis.h:50
#define ODS_SELECTED
Definition: winuser.h:2520
LONG bottom
Definition: windef.h:309
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_LOOKIN_Init()

static void FILEDLG95_LOOKIN_Init ( HWND  hwndCombo)
static

Definition at line 3763 of file filedlg.c.

3764 {
3765  IShellFolder *psfRoot, *psfDrives;
3766  IEnumIDList *lpeRoot, *lpeDrives;
3767  LPITEMIDLIST pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
3768  HDC hdc;
3769  TEXTMETRICW tm;
3770  LookInInfos *liInfos = heap_alloc_zero(sizeof(*liInfos));
3771 
3772  TRACE("%p\n", hwndCombo);
3773 
3774  liInfos->iMaxIndentation = 0;
3775 
3776  SetPropA(hwndCombo, LookInInfosStr, liInfos);
3777 
3778  hdc = GetDC( hwndCombo );
3779  SelectObject( hdc, (HFONT)SendMessageW( hwndCombo, WM_GETFONT, 0, 0 ));
3780  GetTextMetricsW( hdc, &tm );
3781  ReleaseDC( hwndCombo, hdc );
3782 
3783  /* set item height for both text field and listbox */
3784  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, -1, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3785  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, 0, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3786 
3787  /* Turn on the extended UI for the combo box like Windows does */
3788  SendMessageW(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
3789 
3790  /* Initialise data of Desktop folder */
3792  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3793  ILFree(pidlTmp);
3794 
3796 
3797  SHGetDesktopFolder(&psfRoot);
3798 
3799  if (psfRoot)
3800  {
3801  /* enumerate the contents of the desktop */
3802  if(SUCCEEDED(IShellFolder_EnumObjects(psfRoot, hwndCombo, SHCONTF_FOLDERS, &lpeRoot)))
3803  {
3804  while (S_OK == IEnumIDList_Next(lpeRoot, 1, &pidlTmp, NULL))
3805  {
3806  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3807 
3808  /* If the unixfs extension is rooted, we don't expand the drives by default */
3810  {
3811  /* special handling for CSIDL_DRIVES */
3812  if (ILIsEqual(pidlTmp, pidlDrives))
3813  {
3814  if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
3815  {
3816  /* enumerate the drives */
3817  if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives)))
3818  {
3819  while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
3820  {
3821  pidlAbsTmp = ILCombine(pidlTmp, pidlTmp1);
3822  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
3823  ILFree(pidlAbsTmp);
3824  ILFree(pidlTmp1);
3825  }
3826  IEnumIDList_Release(lpeDrives);
3827  }
3828  IShellFolder_Release(psfDrives);
3829  }
3830  }
3831  }
3832 
3833  ILFree(pidlTmp);
3834  }
3835  IEnumIDList_Release(lpeRoot);
3836  }
3837  IShellFolder_Release(psfRoot);
3838  }
3839 
3840  ILFree(pidlDrives);
3841 }
#define max(a, b)
Definition: svc.c:63
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
static const char LookInInfosStr[]
Definition: filedlg.c:215
#define LISTEND
Definition: filedlg.c:190
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
#define CSIDL_DESKTOP
Definition: shlobj.h:2012
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
#define SM_CYSMICON
Definition: winuser.h:1003
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
int iMaxIndentation
Definition: filedlg.c:105
#define CB_SETITEMHEIGHT
Definition: winuser.h:1949
#define CSIDL_DRIVES
Definition: shlobj.h:2028
if SUCCEEDED(hr)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_GETFONT
Definition: winuser.h:1633
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
static BOOL FILEDLG95_unixfs_is_rooted_at_desktop(void)
Definition: filedlg.c:3746
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2830
int WINAPI GetSystemMetrics(_In_ int)
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:3984
HDC hdc
Definition: main.c:9
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
Definition: time.h:76
#define S_OK
Definition: intsafe.h:51
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_SETEXTENDEDUI
Definition: winuser.h:1946
#define NULL
Definition: types.h:112
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by FILEDLG95_FillControls().

◆ FILEDLG95_LOOKIN_InsertItemAfterParent()

static int FILEDLG95_LOOKIN_InsertItemAfterParent ( HWND  hwnd,
LPITEMIDLIST  pidl 
)
static

Definition at line 4055 of file filedlg.c.

4056 {
4057 
4058  LPITEMIDLIST pidlParent = GetParentPidl(pidl);
4059  int iParentPos;
4060 
4061  TRACE("\n");
4062 
4063  if (pidl == pidlParent)
4064  return -1;
4065 
4066  iParentPos = FILEDLG95_LOOKIN_SearchItem(hwnd,(WPARAM)pidlParent,SEARCH_PIDL);
4067 
4068  if(iParentPos < 0)
4069  {
4070  iParentPos = FILEDLG95_LOOKIN_InsertItemAfterParent(hwnd,pidlParent);
4071  }
4072 
4073  ILFree(pidlParent);
4074 
4075  return FILEDLG95_LOOKIN_AddItem(hwnd,pidl,iParentPos + 1);
4076 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4157
UINT_PTR WPARAM
Definition: windef.h:207
#define SEARCH_PIDL
Definition: filedlg.c:193
LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl)
Definition: filedlg.c:4519
#define TRACE(s)
Definition: solgame.cpp:4
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:3984
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:4055
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by FILEDLG95_LOOKIN_SelectItem().

◆ FILEDLG95_LOOKIN_OnCommand()

static BOOL FILEDLG95_LOOKIN_OnCommand ( HWND  hwnd,
WORD  wNotifyCode 
)
static

Definition at line 3941 of file filedlg.c.

3942 {
3944 
3945  TRACE("%p\n", fodInfos);
3946 
3947  switch(wNotifyCode)
3948  {
3949  case CBN_SELENDOK:
3950  {
3951  LPSFOLDER tmpFolder;
3952  int iItem;
3953 
3954  iItem = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCURSEL, 0, 0);
3955 
3956  if( iItem == CB_ERR) return FALSE;
3957 
3958  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,
3959  iItem)))
3960  return FALSE;
3961 
3962 
3963  if(SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
3964  tmpFolder->pidlItem,
3965  SBSP_ABSOLUTE)))
3966  {
3967  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3969  return TRUE;
3970  }
3971  break;
3972  }
3973 
3974  }
3975  return FALSE;
3976 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define TRUE
Definition: types.h:120
#define CB_GETCURSEL
Definition: winuser.h:1925
#define FALSE
Definition: types.h:117
#define CBN_SELENDOK
Definition: winuser.h:1963
if SUCCEEDED(hr)
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
struct FileOpenDlgInfos::@336 Shell
#define CB_ERR
Definition: winuser.h:2410
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:1068
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct FileOpenDlgInfos::@338 DlgInfos
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_LOOKIN_RemoveMostExpandedItem()

static int FILEDLG95_LOOKIN_RemoveMostExpandedItem ( HWND  hwnd)
static

Definition at line 4127 of file filedlg.c.

4128 {
4129  int iItemPos;
4131 
4132  TRACE("\n");
4133 
4134  if(liInfos->iMaxIndentation <= 2)
4135  return -1;
4136 
4137  if((iItemPos = FILEDLG95_LOOKIN_SearchItem(hwnd,liInfos->iMaxIndentation,SEARCH_EXP)) >=0)
4138  {
4139  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4140  ILFree(tmpFolder->pidlItem);
4141  heap_free(tmpFolder);
4142  SendMessageW(hwnd, CB_DELETESTRING, iItemPos, 0);
4143  liInfos->iMaxIndentation--;
4144 
4145  return iItemPos;
4146  }
4147 
4148  return -1;
4149 }
#define SEARCH_EXP
Definition: filedlg.c:194
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static const char LookInInfosStr[]
Definition: filedlg.c:215
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4157
int iMaxIndentation
Definition: filedlg.c:105
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_DELETESTRING
Definition: winuser.h:1919
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
struct SFolder * LPSFOLDER

Referenced by FILEDLG95_LOOKIN_SelectItem().

◆ FILEDLG95_LOOKIN_SearchItem()

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

Definition at line 4157 of file filedlg.c.

4158 {
4159  int i = 0;
4160  int iCount;
4161 
4162  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
4163 
4164  TRACE("0x%08lx 0x%x\n",searchArg, iSearchMethod);
4165 
4166  if (iCount != CB_ERR)
4167  {
4168  for(;i<iCount;i++)
4169  {
4170  LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i);
4171 
4172  if (iSearchMethod == SEARCH_PIDL && ILIsEqual((LPITEMIDLIST)searchArg, tmpFolder->pidlItem))
4173  return i;
4174  if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg)
4175  return i;
4176  }
4177  }
4178 
4179  return -1;
4180 }
#define SEARCH_EXP
Definition: filedlg.c:194
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
#define SEARCH_PIDL
Definition: filedlg.c:193
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:98
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
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
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
struct SFolder * LPSFOLDER

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

◆ FILEDLG95_LOOKIN_SelectItem()

int FILEDLG95_LOOKIN_SelectItem ( HWND  hwnd,
LPITEMIDLIST  pidl 
)

Definition at line 4084 of file filedlg.c.

4085 {
4086  int iItemPos;
4087  LookInInfos *liInfos;
4088 
4089  TRACE("%p, %p\n", hwnd, pidl);
4090 
4092 
4093  liInfos = GetPropA(hwnd,LookInInfosStr);
4094 
4095  if(iItemPos < 0)
4096  {
4099  }
4100 
4101  else
4102  {
4103  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4104  while(liInfos->iMaxIndentation > tmpFolder->m_iIndent)
4105  {
4106  int iRemovedItem;
4107 
4108  if(-1 == (iRemovedItem = FILEDLG95_LOOKIN_RemoveMostExpandedItem(hwnd)))
4109  break;
4110  if(iRemovedItem < iItemPos)
4111  iItemPos--;
4112  }
4113  }
4114 
4115  SendMessageW(hwnd, CB_SETCURSEL, iItemPos, 0);
4116  liInfos->uSelectedItem = iItemPos;
4117 
4118  return 0;
4119 
4120 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const char LookInInfosStr[]
Definition: filedlg.c:215
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4157
UINT_PTR WPARAM
Definition: windef.h:207
int iMaxIndentation
Definition: filedlg.c:105
#define SEARCH_PIDL
Definition: filedlg.c:193
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:98
#define CB_SETCURSEL
Definition: winuser.h:1943
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static int FILEDLG95_LOOKIN_RemoveMostExpandedItem(HWND hwnd)
Definition: filedlg.c:4127
UINT uSelectedItem
Definition: filedlg.c:106
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:4055
struct SFolder * LPSFOLDER

Referenced by IShellBrowserImpl_BrowseObject().

◆ FILEDLG95_MRU_get_slot()

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

Definition at line 2408 of file filedlg.c.

2409 {
2410  WCHAR mru_list[32], *cur_mru_slot;
2411  BOOL taken[25] = {0};
2412  DWORD mru_list_size = sizeof(mru_list), key_type = -1, i;
2413  HKEY hkey_tmp, *hkey;
2414  LONG ret;
2415 
2416  if(hkey_ret)
2417  hkey = hkey_ret;
2418  else
2419  hkey = &hkey_tmp;
2420 
2421  if(stored_path)
2422  *stored_path = '\0';
2423 
2425  if(ret){
2426  WARN("Unable to create MRU key: %d\n", ret);
2427  return 0;
2428  }
2429 
2430  ret = RegGetValueW(*hkey, NULL, MRUListW, RRF_RT_REG_SZ, &key_type,
2431  (LPBYTE)mru_list, &mru_list_size);
2432  if(ret || key_type != REG_SZ){
2433  if(ret == ERROR_FILE_NOT_FOUND)
2434  return 'a';
2435 
2436  WARN("Error getting MRUList data: type: %d, ret: %d\n", key_type, ret);
2437  RegCloseKey(*hkey);
2438  return 0;
2439  }
2440 
2441  for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot){
2442  WCHAR value_data[MAX_PATH], value_name[2] = {0};
2443  DWORD value_data_size = sizeof(value_data);
2444 
2445  *value_name = *cur_mru_slot;
2446 
2447  ret = RegGetValueW(*hkey, NULL, value_name, RRF_RT_REG_BINARY,
2448  &key_type, (LPBYTE)value_data, &value_data_size);
2449  if(ret || key_type != REG_BINARY){
2450  WARN("Error getting MRU slot data: type: %d, ret: %d\n", key_type, ret);
2451  continue;
2452  }
2453 
2454  if(!wcsicmp(module_name, value_data)){
2455  if(!hkey_ret)
2456  RegCloseKey(*hkey);
2457  if(stored_path)
2458  lstrcpyW(stored_path, value_data + lstrlenW(value_data) + 1);
2459  return *value_name;
2460  }
2461  }
2462 
2463  if(!hkey_ret)
2464  RegCloseKey(*hkey);
2465 
2466  /* the module name isn't in the registry, so find the next open slot */
2467  for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot)
2468  taken[*cur_mru_slot - 'a'] = TRUE;
2469  for(i = 0; i < 25; ++i){
2470  if(!taken[i])
2471  return i + 'a';
2472  }
2473 
2474  /* all slots are taken, so return the last one in MRUList */
2475  --cur_mru_slot;
2476  return *cur_mru_slot;
2477 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
#define REG_BINARY
Definition: nt_native.h:1496
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define WARN(fmt,...)
Definition: debug.h:112
#define RRF_RT_REG_SZ
Definition: driver.c:575
#define lstrlenW
Definition: compat.h:609
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define wcsicmp
Definition: compat.h:15
int ret
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
static const WCHAR MRUListW[]
Definition: filedlg.c:223
#define lstrcpyW
Definition: compat.h:608
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const WCHAR LastVisitedMRUW[]
Definition: filedlg.c:218
#define NULL
Definition: types.h:112
#define RRF_RT_REG_BINARY
Definition: driver.c:577
#define REG_SZ
Definition: layer.c:22

Referenced by FILEDLG95_MRU_load_filename(), and FILEDLG95_MRU_save_filename().

◆ FILEDLG95_MRU_load_filename()

static void FILEDLG95_MRU_load_filename ( LPWSTR  stored_path)
static

Definition at line 2570 of file filedlg.c.

2571 {
2572  WCHAR module_path[MAX_PATH], *module_name;
2573 
2574  /* get the current executable's name */
2575  if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2576  {
2577  WARN("GotModuleFileName failed: %d\n", GetLastError());
2578  return;
2579  }
2580  module_name = wcsrchr(module_path, '\\');
2581  if(!module_name)
2582  module_name = module_path;
2583  else
2584  module_name += 1;
2585 
2586  FILEDLG95_MRU_get_slot(module_name, stored_path, NULL);
2587  TRACE("got MRU path: %s\n", wine_dbgstr_w(stored_path));
2588 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define WARN(fmt,...)
Definition: debug.h:112
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define wcsrchr
Definition: compat.h:16
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHKEY hkey_ret)
Definition: filedlg.c:2408

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_MRU_save_filename()

static void FILEDLG95_MRU_save_filename ( LPCWSTR  filename)
static

Definition at line 2480 of file filedlg.c.

2481 {
2482  WCHAR module_path[MAX_PATH], *module_name, slot, slot_name[2] = {0};
2483  LONG ret;
2484  HKEY hkey;
2485 
2486  /* get the current executable's name */
2487  if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2488  {
2489  WARN("GotModuleFileName failed: %d\n", GetLastError());
2490  return;
2491  }
2492  module_name = wcsrchr(module_path, '\\');
2493  if(!module_name)
2494  module_name = module_path;
2495  else
2496  module_name += 1;
2497 
2499  if(!slot)
2500  return;
2501  *slot_name = slot;
2502 
2503  { /* update the slot's info */
2504  WCHAR *path_ends, *final;
2505  DWORD path_len, final_len;
2506 
2507  /* use only the path segment of `filename' */
2508  path_ends = wcsrchr(filename, '\\');
2509  path_len = path_ends - filename;
2510 
2511  final_len = path_len + lstrlenW(module_name) + 2;
2512 
2513  final = heap_alloc(final_len * sizeof(WCHAR));
2514  if(!final)
2515  return;
2516  lstrcpyW(final, module_name);
2517  memcpy(final + lstrlenW(final) + 1, filename, path_len * sizeof(WCHAR));
2518  final[final_len-1] = '\0';
2519 
2520  ret = RegSetValueExW(hkey, slot_name, 0, REG_BINARY, (LPBYTE)final,
2521  final_len * sizeof(WCHAR));
2522  if(ret){
2523  WARN("Error saving MRU data to slot %s: %d\n", wine_dbgstr_w(slot_name), ret);
2524  heap_free(final);
2525  RegCloseKey(hkey);
2526  return;
2527  }
2528 
2529  heap_free(final);
2530  }
2531 
2532  { /* update MRUList value */
2533  WCHAR old_mru_list[32], new_mru_list[32];
2534  WCHAR *old_mru_slot, *new_mru_slot = new_mru_list;
2535  DWORD mru_list_size = sizeof(old_mru_list), key_type;
2536 
2537  ret = RegGetValueW(hkey, NULL, MRUListW, RRF_RT_ANY, &key_type,
2538  (LPBYTE)old_mru_list, &mru_list_size);
2539  if(ret || key_type != REG_SZ){
2540  if(ret == ERROR_FILE_NOT_FOUND){
2541  new_mru_list[0] = slot;
2542  new_mru_list[1] = '\0';
2543  }else{
2544  WARN("Error getting MRUList data: type: %d, ret: %d\n", key_type, ret);
2545  RegCloseKey(hkey);
2546  return;
2547  }
2548  }else{
2549  /* copy old list data over so that the new slot is at the start
2550  * of the list */
2551  *new_mru_slot++ = slot;
2552  for(old_mru_slot = old_mru_list; *old_mru_slot; ++old_mru_slot){
2553  if(*old_mru_slot != slot)
2554  *new_mru_slot++ = *old_mru_slot;
2555  }
2556  *new_mru_slot = '\0';
2557  }
2558 
2559  ret = RegSetValueExW(hkey, MRUListW, 0, REG_SZ, (LPBYTE)new_mru_list,
2560  (lstrlenW(new_mru_list) + 1) * sizeof(WCHAR));
2561  if(ret){
2562  WARN("Error saving MRUList data: %d\n", ret);
2563  RegCloseKey(hkey);
2564  return;
2565  }
2566  }
2567 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
struct _slot slot
Definition: vfat.h:196
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
#define REG_BINARY
Definition: nt_native.h:1496
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define WARN(fmt,...)
Definition: debug.h:112
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:609
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define wcsrchr
Definition: compat.h:16
static const WCHAR MRUListW[]
Definition: filedlg.c:223
Definition: vfat.h:184
static DWORD path_len
Definition: batch.c:31
#define lstrcpyW
Definition: compat.h:608
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define RRF_RT_ANY
Definition: winreg.h:64
static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHKEY hkey_ret)
Definition: filedlg.c:2408
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define REG_SZ
Definition: layer.c:22

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_OnOpen()

BOOL FILEDLG95_OnOpen ( HWND  hwnd)
static

Definition at line 2947 of file filedlg.c.

2948 {
2950  LPWSTR lpstrFileList;
2951  UINT nFileCount = 0;
2952  UINT sizeUsed = 0;
2953  BOOL ret = TRUE;
2954  WCHAR lpstrPathAndFile[MAX_PATH];
2955  LPSHELLFOLDER lpsf = NULL;
2956  int nOpenAction;
2957 
2958  TRACE("hwnd=%p\n", hwnd);
2959 
2960  /* try to browse the selected item */
2962  return FALSE;
2963 
2964  /* get the files from the edit control */
2965  nFileCount = FILEDLG95_FILENAME_GetFileNames(hwnd, &lpstrFileList, &sizeUsed);
2966 
2967  if(nFileCount == 0)
2968  return FALSE;
2969 
2970  if(nFileCount > 1)
2971  {
2972  ret = FILEDLG95_OnOpenMultipleFiles(hwnd, lpstrFileList, nFileCount, sizeUsed);
2973  goto ret;
2974  }
2975 
2976  TRACE("count=%u len=%u file=%s\n", nFileCount, sizeUsed, debugstr_w(lpstrFileList));
2977 
2978 /*
2979  Step 1: Build a complete path name from the current folder and
2980  the filename or path in the edit box.
2981  Special cases:
2982  - the path in the edit box is a root path
2983  (with or without drive letter)
2984  - the edit box contains ".." (or a path with ".." in it)
2985 */
2986 
2987  COMDLG32_GetCanonicalPath(fodInfos->ShellInfos.pidlAbsCurrent, lpstrFileList, lpstrPathAndFile);
2988  heap_free(lpstrFileList);
2989 
2990 /*
2991  Step 2: here we have a cleaned up path
2992 
2993  We have to parse the path step by step to see if we have to browse
2994  to a folder if the path points to a directory or the last
2995  valid element is a directory.
2996 
2997  valid variables:
2998  lpstrPathAndFile: cleaned up path
2999  */
3000 
3001  if (nFileCount &&
3002  (fodInfos->ofnInfos->Flags & OFN_NOVALIDATE) &&
3003  !(fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST))
3004  nOpenAction = ONOPEN_OPEN;
3005  else
3006  nOpenAction = ONOPEN_BROWSE;
3007 
3008  nOpenAction = FILEDLG95_ValidatePathAction(lpstrPathAndFile, &lpsf, hwnd,
3009  fodInfos->ofnInfos->Flags,
3010  fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG,
3011  nOpenAction);
3012  if(!nOpenAction)
3013  goto ret;
3014 
3015 /*
3016  Step 3: here we have a cleaned up and validated path
3017 
3018  valid variables:
3019  lpsf: ShellFolder bound to the rightmost valid path component
3020  lpstrPathAndFile: cleaned up path
3021  nOpenAction: action to do
3022 */
3023  TRACE("end validate sf=%p\n", lpsf);
3024 
3025  switch(nOpenAction)
3026  {
3027  case ONOPEN_SEARCH: /* set the current filter to the file mask and refresh */
3028  TRACE("ONOPEN_SEARCH %s\n", debugstr_w(lpstrPathAndFile));
3029  {
3030  int iPos;
3031  LPWSTR lpszTemp = PathFindFileNameW(lpstrPathAndFile);
3032  DWORD len;
3033 
3034  /* replace the current filter */
3035  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3036  len = lstrlenW(lpszTemp)+1;
3037  fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc(len * sizeof(WCHAR));
3038  lstrcpyW( fodInfos->ShellInfos.lpstrCurrentFilter, lpszTemp);
3039 
3040  /* set the filter cb to the extension when possible */
3041  if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, lpszTemp)))
3042  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETCURSEL, iPos, 0);
3043  }
3044  /* fall through */
3045  case ONOPEN_BROWSE: /* browse to the highest folder we could bind to */
3046  TRACE("ONOPEN_BROWSE\n");
3047  {
3048  IPersistFolder2 * ppf2;
3049  if(SUCCEEDED(IShellFolder_QueryInterface( lpsf, &IID_IPersistFolder2, (LPVOID*)&ppf2)))
3050  {
3051  LPITEMIDLIST pidlCurrent;
3052  IPersistFolder2_GetCurFolder(ppf2, &pidlCurrent);
3053  IPersistFolder2_Release(ppf2);
3054  if (!ILIsEqual(pidlCurrent, fodInfos->ShellInfos.pidlAbsCurrent))
3055  {
3056  if (SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidlCurrent, SBSP_ABSOLUTE))
3057  && fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3058  {
3060  SendMessageA(fodInfos->DlgInfos.hwndFileName, WM_SETTEXT, 0, (LPARAM)"");
3061  }
3062  }
3063  else if( nOpenAction == ONOPEN_SEARCH )
3064  {
3065  if (fodInfos->Shell.FOIShellView)
3066  IShellView_Refresh(fodInfos->Shell.FOIShellView);
3067  }
3068  ILFree(pidlCurrent);
3069  if (filename_is_edit( fodInfos ))
3070  SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
3071  else
3072  {
3073  HWND hwnd;
3074 
3075  hwnd = (HWND)SendMessageA(fodInfos->DlgInfos.hwndFileName, CBEM_GETEDITCONTROL, 0, 0);
3076  SendMessageW(hwnd, EM_SETSEL, 0, -1);
3077  }
3078  }
3079  }
3080  ret = FALSE;
3081  break;
3082  case ONOPEN_OPEN: /* fill in the return struct and close the dialog */
3083  TRACE("ONOPEN_OPEN %s\n", debugstr_w(lpstrPathAndFile));
3084  {
3085  WCHAR *ext = NULL;
3086 
3087  /* update READONLY check box flag */
3089  fodInfos->ofnInfos->Flags |= OFN_READONLY;
3090  else
3091  fodInfos->ofnInfos->Flags &= ~OFN_READONLY;
3092 
3093  /* Attach the file extension with file name*/
3094  ext = PathFindExtensionW(lpstrPathAndFile);
3095 #ifdef __REACTOS__
3096  {
3097  LPWSTR filterExt = NULL, lpstrFilter = NULL, pch, pchNext;
3098  LPCWSTR the_ext = NULL;
3099  static const WCHAR szwDot[] = {'.',0};
3100  int PathLength = lstrlenW(lpstrPathAndFile);
3101 
3102  /* get filter extensions */
3103  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3104  fodInfos->ofnInfos->nFilterIndex - 1);
3105  if (lpstrFilter != (LPWSTR)CB_ERR) /* control is not empty */
3106  {
3107  LPWSTR filterSearchIndex, pchFirst = NULL;
3108  filterExt = heap_alloc((lstrlenW(lpstrFilter) + 1) * sizeof(WCHAR));
3109  if (filterExt)
3110  {
3111  strcpyW(filterExt, lpstrFilter);
3112 
3113  if (ext && *ext)
3114  {
3115  /* find ext in filter */
3116  for (pch = filterExt; pch && *pch; pch = pchNext)
3117  {
3118  filterSearchIndex = strchrW(pch, ';');
3119  if (filterSearchIndex)
3120  {
3121  filterSearchIndex[0] = 0;
3122  pchNext = filterSearchIndex + 1;
3123  }
3124  else
3125  {
3126  pchNext = NULL;
3127  }
3128 
3129  while (*pch == '*' || *pch == '.' || *pch == '?')
3130  {
3131  ++pch;
3132  }
3133 
3134  if (!pchFirst)
3135  pchFirst = pch;
3136 
3137  if (lstrcmpiW(pch, &ext[1]) == 0)
3138  {
3139  the_ext = pch;
3140  break;
3141  }
3142  }
3143 
3144  /* use first one if not found */
3145  if (!the_ext && pchFirst && *pchFirst)
3146  {
3147  the_ext = pchFirst;
3148  }
3149  }
3150  }
3151  }
3152 
3153  if (!the_ext)
3154  {
3155  /* use default extension if no extension in filter */
3156  the_ext = fodInfos->defext;
3157  }
3158 
3159  if (the_ext && *the_ext && lstrcmpiW(&ext[1], the_ext) != 0)
3160  {
3161  if (strlenW(lpstrPathAndFile) + 1 + strlenW(the_ext) + 1 <=
3162  fodInfos->ofnInfos->nMaxFile)
3163  {
3164  /* append the dot */
3165  lstrcatW(lpstrPathAndFile, szwDot);
3166  /* append the extension */
3167  lstrcatW(lpstrPathAndFile, the_ext);
3168  /* update ext */
3169  ext = PathFindExtensionW(lpstrPathAndFile);
3170  }
3171  }
3172 
3173  heap_free(filterExt);
3174 
3175  /* In Open dialog: if file does not exist try without extension */
3176  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile))
3177  lpstrPathAndFile[PathLength] = 0;
3178 
3179  /* Set/clear the output OFN_EXTENSIONDIFFERENT flag */
3180  if (*ext)
3181  ext++;
3182  if (!lstrcmpiW(fodInfos->defext, ext))
3183  fodInfos->ofnInfos->Flags &= ~OFN_EXTENSIONDIFFERENT;
3184  else
3185  fodInfos->ofnInfos->Flags |= OFN_EXTENSIONDIFFERENT;
3186  }
3187 
3188  /* update dialog data */
3189  SetWindowTextW(fodInfos->DlgInfos.hwndFileName, PathFindFileNameW(lpstrPathAndFile));
3190 #else /* __REACTOS__ */
3191  if (! *ext && fodInfos->defext)
3192  {
3193  /* if no extension is specified with file name, then */
3194  /* attach the extension from file filter or default one */
3195 
3196  WCHAR *filterExt = NULL;
3197  LPWSTR lpstrFilter = NULL;
3198  static const WCHAR szwDot[] = {'.',0};
3199  int PathLength = lstrlenW(lpstrPathAndFile);
3200 
3201  /*Get the file extension from file type filter*/
3202  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3203  fodInfos->ofnInfos->nFilterIndex-1);
3204 
3205  if (lpstrFilter != (LPWSTR)CB_ERR) /* control is not empty */
3206  {
3207  WCHAR* filterSearchIndex;
3208  filterExt = heap_alloc((lstrlenW(lpstrFilter) + 1) * sizeof(WCHAR));
3209  lstrcpyW(filterExt, lpstrFilter);
3210 
3211  /* if a semicolon-separated list of file extensions was given, do not include the
3212  semicolon or anything after it in the extension.
3213  example: if filterExt was "*.abc;*.def", it will become "*.abc" */
3214  filterSearchIndex = wcschr(filterExt, ';');
3215  if (filterSearchIndex)
3216  {
3217  filterSearchIndex[0] = '\0';
3218  }
3219 
3220  /* find the file extension by searching for the first dot in filterExt */
3221  /* strip the * or anything else from the extension, "*.abc" becomes "abc" */
3222  /* if the extension is invalid or contains a glob, ignore it */
3223  filterSearchIndex = wcschr(filterExt, '.');
3224  if (filterSearchIndex++ && !wcschr(filterSearchIndex, '*') && !wcschr(filterSearchIndex, '?'))
3225  {
3226  lstrcpyW(filterExt, filterSearchIndex);
3227  }
3228  else
3229  {
3230  heap_free(filterExt);
3231  filterExt = NULL;
3232  }
3233  }
3234 
3235  if (!filterExt)
3236  {
3237  /* use the default file extension */
3238  filterExt = heap_alloc((lstrlenW(fodInfos->defext) + 1) * sizeof(WCHAR));
3239  lstrcpyW(filterExt, fodInfos->defext);
3240  }
3241 
3242  if (*filterExt) /* ignore filterExt="" */
3243  {
3244  /* Attach the dot*/
3245  lstrcatW(lpstrPathAndFile, szwDot);
3246  /* Attach the extension */
3247  lstrcatW(lpstrPathAndFile, filterExt);
3248  }
3249 
3250  heap_free(filterExt);
3251 
3252  /* In Open dialog: if file does not exist try without extension */
3253  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile))
3254  lpstrPathAndFile[PathLength] = '\0';
3255 
3256  /* Set/clear the output OFN_EXTENSIONDIFFERENT flag */
3257  if (*ext)
3258  ext++;
3259  if (!lstrcmpiW(fodInfos->defext, ext))
3260  fodInfos->ofnInfos->Flags &= ~OFN_EXTENSIONDIFFERENT;
3261  else
3262  fodInfos->ofnInfos->Flags |= OFN_EXTENSIONDIFFERENT;
3263  }
3264 #endif /* __REACTOS__ */
3265 
3266  /* In Save dialog: check if the file already exists */
3267  if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG
3268  && fodInfos->ofnInfos->Flags & OFN_OVERWRITEPROMPT
3269  && PathFileExistsW(lpstrPathAndFile))
3270  {
3271  WCHAR lpstrOverwrite[100];
3272  int answer;
3273 
3274  LoadStringW(COMDLG32_hInstance, IDS_OVERWRITEFILE, lpstrOverwrite, 100);
3275  answer = MessageBoxW(hwnd, lpstrOverwrite, fodInfos->title,
3277  if (answer == IDNO || answer == IDCANCEL)
3278  {
3279  ret = FALSE;
3280  goto ret;
3281  }
3282  }
3283 
3284  /* In Open dialog: check if it should be created if it doesn't exist */
3285  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
3286  && fodInfos->ofnInfos->Flags & OFN_CREATEPROMPT
3287  && !PathFileExistsW(lpstrPathAndFile))
3288  {
3289  WCHAR lpstrCreate[100];
3290  int answer;
3291 
3292  LoadStringW(COMDLG32_hInstance, IDS_CREATEFILE, lpstrCreate, 100);
3293  answer = MessageBoxW(hwnd, lpstrCreate, fodInfos->title,
3295  if (answer == IDNO || answer == IDCANCEL)
3296  {
3297  ret = FALSE;
3298  goto ret;
3299  }
3300  }
3301 
3302  /* Check that the size of the file does not exceed buffer size.
3303  (Allow for extra \0 if OFN_MULTISELECT is set.) */
3304  if(lstrlenW(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile -
3305  ((fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) ? 1 : 0))
3306  {
3307 
3308  /* fill destination buffer */
3309  if (fodInfos->ofnInfos->lpstrFile)
3310  {
3311  if(fodInfos->unicode)
3312  {
3313  LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
3314 
3315  lstrcpynW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile);
3317  ofn->lpstrFile[lstrlenW(ofn->lpstrFile) + 1] = '\0';
3318  }
3319  else
3320  {
3322 
3323  WideCharToMultiByte(CP_ACP, 0, lpstrPathAndFile, -1,
3326  ofn->lpstrFile[lstrlenA(ofn->lpstrFile) + 1] = '\0';
3327  }
3328  }
3329 
3330  if(fodInfos->unicode)
3331  {
3332  LPWSTR lpszTemp;
3333 
3334  /* set filename offset */
3335  lpszTemp = PathFindFileNameW(lpstrPathAndFile);
3336  fodInfos->ofnInfos->nFileOffset = (lpszTemp - lpstrPathAndFile);
3337 
3338  /* set extension offset */
3339  lpszTemp = PathFindExtensionW(lpstrPathAndFile);
3340  fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - lpstrPathAndFile) + 1 : 0;
3341  }
3342  else
3343  {
3344  LPSTR lpszTemp;
3345  CHAR tempFileA[MAX_PATH];
3346 
3347  /* avoid using fodInfos->ofnInfos->lpstrFile since it can be NULL */
3348  WideCharToMultiByte(CP_ACP, 0, lpstrPathAndFile, -1,
3349  tempFileA, sizeof(tempFileA), NULL, NULL);
3350 
3351  /* set filename offset */
3352  lpszTemp = PathFindFileNameA(tempFileA);
3353  fodInfos->ofnInfos->nFileOffset = (lpszTemp - tempFileA);
3354 
3355  /* set extension offset */
3356  lpszTemp = PathFindExtensionA(tempFileA);
3357  fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - tempFileA) + 1 : 0;
3358  }
3359 
3360  /* copy currently selected filter to lpstrCustomFilter */
3361  if (fodInfos->ofnInfos->lpstrCustomFilter)
3362  {
3364  int len = WideCharToMultiByte(CP_ACP, 0, fodInfos->ShellInfos.lpstrCurrentFilter, -1,
3365  NULL, 0, NULL, NULL);
3367  {
3369  s += strlen(ofn->lpstrCustomFilter)+1;
3370  WideCharToMultiByte(CP_ACP, 0, fodInfos->ShellInfos.lpstrCurrentFilter, -1,
3371  s, len, NULL, NULL);
3372  }
3373  }
3374 
3375 
3376  if ( !FILEDLG95_SendFileOK(hwnd, fodInfos) )
3377  goto ret;
3378 
3379  FILEDLG95_MRU_save_filename(lpstrPathAndFile);
3380 #ifdef __REACTOS__
3381  FILEDLG95_MRU_save_ext(lpstrPathAndFile);
3382 #endif
3383 
3384  TRACE("close\n");
3386  ret = EndDialog(hwnd, TRUE);
3387  }
3388  else
3389  {
3390  WORD size;
3391 
3392  size = lstrlenW(lpstrPathAndFile) + 1;
3393  if (fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT)
3394  size += 1;
3395  /* return needed size in first two bytes of lpstrFile */
3396  if(fodInfos->ofnInfos->lpstrFile)
3397  *(WORD *)fodInfos->ofnInfos->lpstrFile = size;
3399  ret = EndDialog(hwnd, FALSE);
3401  }
3402  }
3403  break;
3404  }
3405 
3406 ret:
3407  if(lpsf) IShellFolder_Release(lpsf);
3408  return ret;
3409 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WideCharToMultiByte
Definition: compat.h:111
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
LPSTR lpstrCustomFilter
Definition: commdlg.h:333
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define CP_ACP
Definition: compat.h:109
char CHAR
Definition: xmlstorage.h:175
LPWSTR lpstrFile
Definition: commdlg.h:367
#define IDC_OPENREADONLY
HANDLE HWND
Definition: compat.h:19
OPENFILENAME ofn
Definition: main.cpp:37
#define OFN_ALLOWMULTISELECT
Definition: commdlg.h:96
#define ONOPEN_BROWSE
Definition: cdlg.h:213
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
char * LPSTR
Definition: xmlstorage.h:182
static USHORT PathLength
#define lstrlenW
Definition: compat.h:609
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static int FILEDLG95_FILETYPE_SearchExt(HWND hwnd, LPCWSTR lpstrExt)
Definition: filedlg.c:3690
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define pch(ap)
Definition: match.c:418
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define lstrcpynW
Definition: compat.h:597
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
DWORD nMaxFile
Definition: commdlg.h:337
WORD nFileExtension
Definition: commdlg.h:375
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define OFN_CREATEPROMPT
Definition: commdlg.h:97
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
unsigned int BOOL
Definition: ntddk_ex.h:94
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
#define FODPROP_SAVEDLG
WORD nFileOffset
Definition: commdlg.h:374
char ext[3]
Definition: mkdosfs.c:358
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:389
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1900
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
#define CBEM_GETEDITCONTROL
Definition: commctrl.h:3829
struct FileOpenDlgInfos::@336 Shell
void COMDLG32_GetCanonicalPath(PCIDLIST_ABSOLUTE pidlAbsCurrent, LPWSTR lpstrFile, LPWSTR lpstrPathAndFile)
Definition: filedlg.c:734
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:442
#define WM_SETTEXT
Definition: winuser.h:1599
#define CB_ERR
Definition: winuser.h:2410
DWORD nFilterIndex
Definition: commdlg.h:366
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static BOOL BrowseSelectedFolder(HWND hwnd)
Definition: filedlg.c:4580
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf, HWND hwnd, DWORD flags, BOOL isSaveDlg, int defAction)
Definition: filedlg.c:2823
#define IDS_OVERWRITEFILE
#define MAX_PATH
Definition: compat.h:34
#define EM_SETSEL
Definition: winuser.h:2000
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD nMaxFile
Definition: commdlg.h:368
#define OFN_EXTENSIONDIFFERENT
Definition: commdlg.h:105
DWORD nMaxCustFilter
Definition: commdlg.h:334
#define OFN_READONLY
Definition: commdlg.h:118
int ret
static BOOL FILEDLG95_SendFileOK(HWND hwnd, FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:2258
static void FILEDLG95_MRU_save_filename(LPCWSTR filename)
Definition: filedlg.c:2480
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
#define CB_SETCURSEL
Definition: winuser.h:1943
#define ONOPEN_OPEN
Definition: cdlg.h:214
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define lstrcpyW
Definition: compat.h:608
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:1068
LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath)
Definition: path.c:417
LPSTR lpstrFile
Definition: commdlg.h:336
#define FNERR_BUFFERTOOSMALL
Definition: cderr.h:37
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN
Definition: cdlg32.c:128
struct FileOpenDlgInfos::@337 ShellInfos
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define BST_CHECKED
Definition: winuser.h:197
static BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCount, UINT sizeUsed)
Definition: filedlg.c:2295
LPWSTR lpstrCustomFilter
Definition: commdlg.h:364
struct FileOpenDlgInfos::@338 DlgInfos
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define IDNO
Definition: winuser.h:830
#define OFN_NOVALIDATE
Definition: commdlg.h:115
LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath)
Definition: path.c:368
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define IDS_CREATEFILE
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1615
static int FILEDLG95_FILENAME_GetFileNames(HWND hwnd, LPWSTR *lpstrFileList, UINT *sizeUsed)
Definition: filedlg.c:4346
struct tagOFNA * LPOPENFILENAMEA
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:227
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static void FILEDLG95_Clean(HWND hwnd)
Definition: filedlg.c:2134
#define ONOPEN_SEARCH
Definition: cdlg.h:215
DWORD Flags
Definition: commdlg.h:342

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_OnOpenMessage()

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

Definition at line 2811 of file filedlg.c.

2812 {
2813  WCHAR strMsgTitle[MAX_PATH];
2814  WCHAR strMsgText [MAX_PATH];
2815  if (idCaption)
2816