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

Go to the source code of this file.

Classes

struct  SFolder
 
struct  tagLookInInfo
 

Macros

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

Typedefs

typedef struct SFolder SFOLDER
 
typedef struct SFolderLPSFOLDER
 
typedef struct tagLookInInfo LookInInfos
 

Functions

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

Variables

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

Macro Definition Documentation

◆ CBGetItemDataPtr

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

Definition at line 141 of file filedlg.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 57 of file filedlg.c.

◆ ITEM_NOTFOUND

#define ITEM_NOTFOUND   -1

Definition at line 124 of file filedlg.c.

◆ LISTEND

#define LISTEND   -1

Definition at line 119 of file filedlg.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 58 of file filedlg.c.

◆ SEARCH_EXP

#define SEARCH_EXP   2

Definition at line 123 of file filedlg.c.

◆ SEARCH_PIDL

#define SEARCH_PIDL   1

Definition at line 122 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE0

#define TBPLACES_CMDID_PLACE0   0xa064

Definition at line 129 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE1

#define TBPLACES_CMDID_PLACE1   0xa065

Definition at line 130 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE2

#define TBPLACES_CMDID_PLACE2   0xa066

Definition at line 131 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE3

#define TBPLACES_CMDID_PLACE3   0xa067

Definition at line 132 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE4

#define TBPLACES_CMDID_PLACE4   0xa068

Definition at line 133 of file filedlg.c.

◆ UNIMPLEMENTED_FLAGS

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

Definition at line 87 of file filedlg.c.

◆ WM_GETISHELLBROWSER

#define WM_GETISHELLBROWSER   WM_USER+7

Definition at line 127 of file filedlg.c.

◆ XTEXTOFFSET

#define XTEXTOFFSET   3

Definition at line 116 of file filedlg.c.

Typedef Documentation

◆ LookInInfos

◆ LPSFOLDER

◆ SFOLDER

Function Documentation

◆ ArrangeCtrlPositions()

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

Definition at line 743 of file filedlg.c.

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

Referenced by FILEDLG95_ResizeControls().

◆ BrowseSelectedFolder()

static BOOL BrowseSelectedFolder ( HWND  hwnd)
static

Definition at line 4473 of file filedlg.c.

4474 {
4476  BOOL bBrowseSelFolder = FALSE;
4477 
4478  TRACE("\n");
4479 
4480  if (GetNumSelected(fodInfos->Shell.FOIDataObject) == 1)
4481  {
4482  LPITEMIDLIST pidlSelection;
4483 
4484  /* get the file selected */
4485  pidlSelection = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, 1);
4486  if (IsPidlFolder (fodInfos->Shell.FOIShellFolder, pidlSelection))
4487  {
4488  if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser,
4489  pidlSelection, SBSP_RELATIVE ) ) )
4490  {
4491  WCHAR buf[64];
4493  MessageBoxW( hwnd, buf, fodInfos->title, MB_OK | MB_ICONEXCLAMATION );
4494  }
4495  bBrowseSelFolder = TRUE;
4496  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
4498  }
4499  ILFree( pidlSelection );
4500  }
4501 
4502  return bBrowseSelFolder;
4503 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
struct FileOpenDlgInfos::@327 Shell
LPITEMIDLIST GetPidlFromDataObject(IDataObject *doSelected, UINT nPidlIndex)
Definition: filedlg.c:4289
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_PATHNOTEXISTING
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:989
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MB_OK
Definition: winuser.h:784
static UINT GetNumSelected(IDataObject *doSelected)
Definition: filedlg.c:4320
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4456
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156

Referenced by FILEDLG95_OnOpen().

◆ COMCTL32_ReleaseStgMedium()

static void COMCTL32_ReleaseStgMedium ( STGMEDIUM  medium)
static

Definition at line 4269 of file filedlg.c.

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

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

Referenced by FILEDLG95_OnOpen(), and on_default_action().

◆ COMDLG32_GetDisplayNameOf()

static BOOL COMDLG32_GetDisplayNameOf ( LPCITEMIDLIST  pidl,
LPWSTR  pwszPath 
)
static

Definition at line 634 of file filedlg.c.

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

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

◆ COMDLG32_SplitFileNames()

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

Definition at line 695 of file filedlg.c.

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

Referenced by FILEDLG95_FILENAME_GetFileNames(), and on_default_action().

◆ COMDLG32_StrRetToStrNW()

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

Definition at line 4207 of file filedlg.c.

4208 {
4209  switch (src->uType)
4210  {
4211  case STRRET_WSTR:
4212  lstrcpynW(dest, src->u.pOleStr, len);
4213  CoTaskMemFree(src->u.pOleStr);
4214  break;
4215 
4216  case STRRET_CSTR:
4217  if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len)
4218  dest[len-1] = 0;
4219  break;
4220 
4221  case STRRET_OFFSET:
4222  if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1, dest, len ) && len)
4223  dest[len-1] = 0;
4224  break;
4225 
4226  default:
4227  FIXME("unknown type %x!\n", src->uType);
4228  if (len) *dest = '\0';
4229  return E_FAIL;
4230  }
4231  return S_OK;
4232 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#define CP_ACP
Definition: compat.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define lstrcpynW
Definition: compat.h:397
#define FIXME(fmt,...)
Definition: debug.h:110
const char * LPCSTR
Definition: xmlstorage.h:183
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
#define MultiByteToWideChar
Definition: compat.h:100
static char * dest
Definition: rtl.c:135
SHITEMID mkid
Definition: shtypes.idl:34

Referenced by GetName().

◆ CreateTemplateDialog()

static HWND CreateTemplateDialog ( FileOpenDlgInfos fodInfos,
HWND  hwnd 
)
static

Definition at line 897 of file filedlg.c.

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

Referenced by FileOpenDlgProc95().

◆ filedialog_is_readonly_hidden()

static BOOL filedialog_is_readonly_hidden ( const FileOpenDlgInfos info)
static

Definition at line 166 of file filedlg.c.

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

Referenced by FILEDLG95_InitControls(), and FILEDLG95_ResizeControls().

◆ FILEDLG95_Clean()

void FILEDLG95_Clean ( HWND  hwnd)
static

Definition at line 2029 of file filedlg.c.

2030 {
2034 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void FILEDLG95_LOOKIN_Clean(HWND hwnd)
Definition: filedlg.c:4080
static void FILEDLG95_FILETYPE_Clean(HWND hwnd)
Definition: filedlg.c:3607
static void FILEDLG95_SHELL_Clean(HWND hwnd)
Definition: filedlg.c:3396

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

◆ FILEDLG95_FILENAME_FillFromSelection()

void FILEDLG95_FILENAME_FillFromSelection ( HWND  hwnd)

Definition at line 4131 of file filedlg.c.

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

Referenced by IShellBrowserImpl_OnSelChange().

◆ FILEDLG95_FILENAME_GetFileNames()

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

Definition at line 4239 of file filedlg.c.

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

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_FILETYPE_Clean()

static void FILEDLG95_FILETYPE_Clean ( HWND  hwnd)
static

Definition at line 3607 of file filedlg.c.

3608 {
3610  int iPos;
3611  int iCount;
3612 
3613  iCount = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCOUNT, 0, 0);
3614 
3615  TRACE("\n");
3616 
3617  /* Delete each string of the combo and their associated data */
3618  if(iCount != CB_ERR)
3619  {
3620  for(iPos = iCount-1;iPos>=0;iPos--)
3621  {
3622  heap_free((void *)CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iPos));
3623  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_DELETESTRING, iPos, 0);
3624  }
3625  }
3626  /* Current filter */
3627  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3628 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
struct FileOpenDlgInfos::@329 DlgInfos
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct FileOpenDlgInfos::@328 ShellInfos
#define CB_GETCOUNT
Definition: winuser.h:1924
#define CB_DELETESTRING
Definition: winuser.h:1919
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_Clean().

◆ FILEDLG95_FILETYPE_Init()

static HRESULT FILEDLG95_FILETYPE_Init ( HWND  hwnd)
static

Definition at line 3422 of file filedlg.c.

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

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_FILETYPE_OnCommand()

static BOOL FILEDLG95_FILETYPE_OnCommand ( HWND  hwnd,
WORD  wNotifyCode 
)
static

Definition at line 3538 of file filedlg.c.

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

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_FILETYPE_SearchExt()

static int FILEDLG95_FILETYPE_SearchExt ( HWND  hwnd,
LPCWSTR  lpstrExt 
)
static

Definition at line 3583 of file filedlg.c.

3584 {
3585  int i, iCount;
3586 
3587  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
3588 
3589  TRACE("%s\n", debugstr_w(lpstrExt));
3590 
3591  if(iCount != CB_ERR)
3592  {
3593  for(i=0;i<iCount;i++)
3594  {
3595  if(!lstrcmpiW(lpstrExt,(LPWSTR)CBGetItemDataPtr(hwnd,i)))
3596  return i;
3597  }
3598  }
3599  return -1;
3600 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_FillControls()

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

Definition at line 1992 of file filedlg.c.

1993 {
1994  LPITEMIDLIST pidlItemId = NULL;
1995 
1996  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
1997 
1998  TRACE("dir=%s file=%s\n",
1999  debugstr_w(fodInfos->initdir), debugstr_w(fodInfos->filename));
2000 
2001  /* Get the initial directory pidl */
2002 
2003  if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->initdir)))
2004  {
2005  WCHAR path[MAX_PATH];
2006 
2008  pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder, path);
2009  }
2010 
2011  /* Initialise shell objects */
2013 
2014  /* Initialize the Look In combo box */
2015  FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB);
2016 
2017  /* Browse to the initial directory */
2018  IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId, SBSP_ABSOLUTE);
2019 
2020  ILFree(pidlItemId);
2021 
2022  return TRUE;
2023 }
static void FILEDLG95_LOOKIN_Init(HWND hwndCombo)
Definition: filedlg.c:3656
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
struct FileOpenDlgInfos::@327 Shell
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:413
static LRESULT FILEDLG95_SHELL_Init(HWND hwnd)
Definition: filedlg.c:3309
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
struct FileOpenDlgInfos::@329 DlgInfos
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static LPITEMIDLIST GetPidlFromName(IShellFolder *psf, LPWSTR lpcstrFileName)
Definition: filedlg.c:4430
Definition: services.c:325
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPARAM lParam
Definition: combotst.c:139

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_Handle_GetFilePath()

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

Definition at line 1018 of file filedlg.c.

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

Referenced by FILEDLG95_HandleCustomDialogMessages().

◆ FILEDLG95_HandleCustomDialogMessages()

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

Definition at line 1060 of file filedlg.c.

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

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_InitControls()

static LRESULT FILEDLG95_InitControls ( HWND  hwnd)
static

Definition at line 1525 of file filedlg.c.

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

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_LOOKIN_AddItem()

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

Definition at line 3877 of file filedlg.c.

3878 {
3879  LPITEMIDLIST pidlNext;
3880  SHFILEINFOW sfi;
3881  SFOLDER *tmpFolder;
3882  LookInInfos *liInfos;
3883 
3884  TRACE("%p, %p, %d\n", hwnd, pidl, iInsertId);
3885 
3886  if(!pidl)
3887  return -1;
3888 
3889  if(!(liInfos = GetPropA(hwnd,LookInInfosStr)))
3890  return -1;
3891 
3892  tmpFolder = heap_alloc_zero(sizeof(*tmpFolder));
3893  tmpFolder->m_iIndent = 0;
3894 
3895  /* Calculate the indentation of the item in the lookin*/
3896  pidlNext = pidl;
3897  while ((pidlNext = ILGetNext(pidlNext)))
3898  {
3899  tmpFolder->m_iIndent++;
3900  }
3901 
3902  tmpFolder->pidlItem = ILClone(pidl);
3903 
3904  if(tmpFolder->m_iIndent > liInfos->iMaxIndentation)
3905  liInfos->iMaxIndentation = tmpFolder->m_iIndent;
3906 
3907  sfi.dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
3908  SHGetFileInfoW((LPCWSTR)pidl,
3909  0,
3910  &sfi,
3911  sizeof(sfi),
3913 
3914  TRACE("-- Add %s attr=0x%08x\n", debugstr_w(sfi.szDisplayName), sfi.dwAttributes);
3915 
3916  if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
3917  {
3918  int iItemID;
3919 
3920  TRACE("-- Add %s at %u\n", debugstr_w(sfi.szDisplayName), tmpFolder->m_iIndent);
3921 
3922  /* Add the item at the end of the list */
3923  if(iInsertId < 0)
3924  {
3925  iItemID = SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)sfi.szDisplayName);
3926  }
3927  /* Insert the item at the iInsertId position*/
3928  else
3929  {
3930  iItemID = SendMessageW(hwnd, CB_INSERTSTRING, iInsertId, (LPARAM)sfi.szDisplayName);
3931  }
3932 
3933  SendMessageW(hwnd, CB_SETITEMDATA, iItemID, (LPARAM)tmpFolder);
3934  return iItemID;
3935  }
3936 
3937  ILFree( tmpFolder->pidlItem );
3938  heap_free( tmpFolder );
3939  return -1;
3940 
3941 }
#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:144
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD dwAttributes
Definition: shellapi.h:372
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
int iMaxIndentation
Definition: filedlg.c:106
#define debugstr_w
Definition: kernel32.h:32
#define SHGFI_PIDL
Definition: shellapi.h:178
#define CB_ADDSTRING
Definition: winuser.h:1918
#define CB_INSERTSTRING
Definition: winuser.h:1939
LONG_PTR LPARAM
Definition: windef.h:208
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
#define TRACE(s)
Definition: solgame.cpp:4
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:410
int m_iIndent
Definition: filedlg.c:99
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:166
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define SHGFI_ATTR_SPECIFIED
Definition: shellapi.h:172
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_LOOKIN_Init(), and FILEDLG95_LOOKIN_InsertItemAfterParent().

◆ FILEDLG95_LOOKIN_Clean()

static void FILEDLG95_LOOKIN_Clean ( HWND  hwnd)
static

Definition at line 4080 of file filedlg.c.

4081 {
4083  LookInInfos *liInfos = GetPropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4084  int iPos, iCount;
4085 
4086  iCount = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCOUNT, 0, 0);
4087 
4088  TRACE("\n");
4089 
4090  /* Delete each string of the combo and their associated data */
4091  if (iCount != CB_ERR)
4092  {
4093  for(iPos = iCount-1;iPos>=0;iPos--)
4094  {
4095  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,iPos);
4096  ILFree(tmpFolder->pidlItem);
4097  heap_free(tmpFolder);
4098  SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_DELETESTRING, iPos, 0);
4099  }
4100  }
4101 
4102  /* LookInInfos structure */
4103  heap_free(liInfos);
4104  RemovePropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4105 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HANDLE WINAPI RemovePropA(_In_ HWND, _In_ LPCSTR)
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static const char LookInInfosStr[]
Definition: filedlg.c:144
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
struct FileOpenDlgInfos::@329 DlgInfos
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
#define CB_DELETESTRING
Definition: winuser.h:1919
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
struct SFolder * LPSFOLDER

Referenced by FILEDLG95_Clean().

◆ FILEDLG95_LOOKIN_DrawItem()

static LRESULT FILEDLG95_LOOKIN_DrawItem ( LPDRAWITEMSTRUCT  pDIStruct)
static

Definition at line 3741 of file filedlg.c.

3742 {
3744  COLORREF crHighLight = GetSysColor(COLOR_HIGHLIGHT);
3746  RECT rectText;
3747  RECT rectIcon;
3748  SHFILEINFOW sfi;
3749  HIMAGELIST ilItemImage;
3750  int iIndentation;
3751  TEXTMETRICW tm;
3752  LPSFOLDER tmpFolder;
3754  UINT icon_width, icon_height;
3755 
3756  TRACE("\n");
3757 
3758  if(pDIStruct->itemID == -1)
3759  return 0;
3760 
3761  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem,
3762  pDIStruct->itemID)))
3763  return 0;
3764 
3765 
3766  icon_width = GetSystemMetrics(SM_CXICON);
3767  icon_height = GetSystemMetrics(SM_CYICON);
3768  if (pDIStruct->rcItem.bottom - pDIStruct->rcItem.top < icon_height)
3769  {
3770  icon_width = GetSystemMetrics(SM_CXSMICON);
3771  icon_height = GetSystemMetrics(SM_CYSMICON);
3772  shgfi_flags |= SHGFI_SMALLICON;
3773  }
3774 
3775  ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
3776  0, &sfi, sizeof (sfi), shgfi_flags );
3777 
3778  /* Is this item selected ? */
3779  if(pDIStruct->itemState & ODS_SELECTED)
3780  {
3781  SetTextColor(pDIStruct->hDC,(0x00FFFFFF & ~(crText)));
3782  SetBkColor(pDIStruct->hDC,crHighLight);
3783  FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_HIGHLIGHT));
3784  }
3785  else
3786  {
3787  SetTextColor(pDIStruct->hDC,crText);
3788  SetBkColor(pDIStruct->hDC,crWin);
3789  FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_WINDOW));
3790  }
3791 
3792  /* Do not indent item if drawing in the edit of the combo */
3793  if(pDIStruct->itemState & ODS_COMBOBOXEDIT)
3794  iIndentation = 0;
3795  else
3796  iIndentation = tmpFolder->m_iIndent;
3797 
3798  /* Draw text and icon */
3799 
3800  /* Initialise the icon display area */
3801  rectIcon.left = pDIStruct->rcItem.left + 1 + icon_width/2 * iIndentation;
3802  rectIcon.top = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - icon_height) / 2;
3803  rectIcon.right = rectIcon.left + icon_width + XTEXTOFFSET;
3804  rectIcon.bottom = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + icon_height) / 2;
3805 
3806  /* Initialise the text display area */
3807  GetTextMetricsW(pDIStruct->hDC, &tm);
3808  rectText.left = rectIcon.right;
3809  rectText.top =
3810  (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - tm.tmHeight) / 2;
3811  rectText.right = pDIStruct->rcItem.right;
3812  rectText.bottom =
3813  (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + tm.tmHeight) / 2;
3814 
3815  /* Draw the icon from the image list */
3816  ImageList_Draw(ilItemImage,
3817  sfi.iIcon,
3818  pDIStruct->hDC,
3819  rectIcon.left,
3820  rectIcon.top,
3821  ILD_TRANSPARENT );
3822 
3823  /* Draw the associated text */
3824  TextOutW(pDIStruct->hDC,rectText.left,rectText.top,sfi.szDisplayName,lstrlenW(sfi.szDisplayName));
3825  return NOERROR;
3826 }
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:169
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define NOERROR
Definition: winerror.h:2354
LONG top
Definition: windef.h:292
#define SM_CYSMICON
Definition: winuser.h:1003
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define lstrlenW
Definition: compat.h:407
#define SHGFI_SMALLICON
Definition: shellapi.h:174
#define COLOR_WINDOW
Definition: winuser.h:908
DWORD WINAPI GetSysColor(_In_ int)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
#define SHGFI_PIDL
Definition: shellapi.h:178
#define SM_CXICON
Definition: winuser.h:962
#define SHGFI_OPENICON
Definition: shellapi.h:176
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
#define XTEXTOFFSET
Definition: filedlg.c:116
#define TRACE(s)
Definition: solgame.cpp:4
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:410
DWORD COLORREF
Definition: windef.h:285
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
int m_iIndent
Definition: filedlg.c:99
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1002
#define SM_CYICON
Definition: winuser.h:963
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:309
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
Definition: time.h:76
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define ILD_TRANSPARENT
Definition: commctrl.h:403
unsigned int UINT
Definition: ndis.h:50
#define ODS_SELECTED
Definition: winuser.h:2520
LONG bottom
Definition: windef.h:294
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_LOOKIN_Init()

static void FILEDLG95_LOOKIN_Init ( HWND  hwndCombo)
static

Definition at line 3656 of file filedlg.c.

3657 {
3658  IShellFolder *psfRoot, *psfDrives;
3659  IEnumIDList *lpeRoot, *lpeDrives;
3660  LPITEMIDLIST pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
3661  HDC hdc;
3662  TEXTMETRICW tm;
3663  LookInInfos *liInfos = heap_alloc_zero(sizeof(*liInfos));
3664 
3665  TRACE("%p\n", hwndCombo);
3666 
3667  liInfos->iMaxIndentation = 0;
3668 
3669  SetPropA(hwndCombo, LookInInfosStr, liInfos);
3670 
3671  hdc = GetDC( hwndCombo );
3672  SelectObject( hdc, (HFONT)SendMessageW( hwndCombo, WM_GETFONT, 0, 0 ));
3673  GetTextMetricsW( hdc, &tm );
3674  ReleaseDC( hwndCombo, hdc );
3675 
3676  /* set item height for both text field and listbox */
3677  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, -1, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3678  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, 0, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3679 
3680  /* Turn on the extended UI for the combo box like Windows does */
3681  SendMessageW(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
3682 
3683  /* Initialise data of Desktop folder */
3685  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3686  ILFree(pidlTmp);
3687 
3689 
3690  SHGetDesktopFolder(&psfRoot);
3691 
3692  if (psfRoot)
3693  {
3694  /* enumerate the contents of the desktop */
3695  if(SUCCEEDED(IShellFolder_EnumObjects(psfRoot, hwndCombo, SHCONTF_FOLDERS, &lpeRoot)))
3696  {
3697  while (S_OK == IEnumIDList_Next(lpeRoot, 1, &pidlTmp, NULL))
3698  {
3699  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3700 
3701  /* If the unixfs extension is rooted, we don't expand the drives by default */
3703  {
3704  /* special handling for CSIDL_DRIVES */
3705  if (ILIsEqual(pidlTmp, pidlDrives))
3706  {
3707  if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
3708  {
3709  /* enumerate the drives */
3710  if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives)))
3711  {
3712  while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
3713  {
3714  pidlAbsTmp = ILCombine(pidlTmp, pidlTmp1);
3715  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
3716  ILFree(pidlAbsTmp);
3717  ILFree(pidlTmp1);
3718  }
3719  IEnumIDList_Release(lpeDrives);
3720  }
3721  IShellFolder_Release(psfDrives);
3722  }
3723  }
3724  }
3725 
3726  ILFree(pidlTmp);
3727  }
3728  IEnumIDList_Release(lpeRoot);
3729  }
3730  IShellFolder_Release(psfRoot);
3731  }
3732 
3733  ILFree(pidlDrives);
3734 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
static const char LookInInfosStr[]
Definition: filedlg.c:144
#define LISTEND
Definition: filedlg.c:119
HDC WINAPI GetDC(_In_opt_ HWND)
#define CSIDL_DESKTOP
Definition: shlobj.h:2003
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define SM_CYSMICON
Definition: winuser.h:1003
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
int iMaxIndentation
Definition: filedlg.c:106
#define CB_SETITEMHEIGHT
Definition: winuser.h:1949
#define CSIDL_DRIVES
Definition: shlobj.h:2019
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
#define WM_GETFONT
Definition: winuser.h:1633
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
static BOOL FILEDLG95_unixfs_is_rooted_at_desktop(void)
Definition: filedlg.c:3639
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2687
int WINAPI GetSystemMetrics(_In_ int)
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:3877
HDC hdc
Definition: main.c:9
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
Definition: time.h:76
#define S_OK
Definition: intsafe.h:59
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_SETEXTENDEDUI
Definition: winuser.h:1946
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by FILEDLG95_FillControls().

◆ FILEDLG95_LOOKIN_InsertItemAfterParent()

static int FILEDLG95_LOOKIN_InsertItemAfterParent ( HWND  hwnd,
LPITEMIDLIST  pidl 
)
static

Definition at line 3948 of file filedlg.c.

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

3835 {
3837 
3838  TRACE("%p\n", fodInfos);
3839 
3840  switch(wNotifyCode)
3841  {
3842  case CBN_SELENDOK:
3843  {
3844  LPSFOLDER tmpFolder;
3845  int iItem;
3846 
3847  iItem = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCURSEL, 0, 0);
3848 
3849  if( iItem == CB_ERR) return FALSE;
3850 
3851  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,
3852  iItem)))
3853  return FALSE;
3854 
3855 
3856  if(SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
3857  tmpFolder->pidlItem,
3858  SBSP_ABSOLUTE)))
3859  {
3860  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3862  return TRUE;
3863  }
3864  break;
3865  }
3866 
3867  }
3868  return FALSE;
3869 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define TRUE
Definition: types.h:120
struct FileOpenDlgInfos::@327 Shell
#define CB_GETCURSEL
Definition: winuser.h:1925
#define CBN_SELENDOK
Definition: winuser.h:1963
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define CB_ERR
Definition: winuser.h:2410
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
struct FileOpenDlgInfos::@329 DlgInfos
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:989
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SUCCEEDED(hr)
Definition: intsafe.h:57
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_LOOKIN_RemoveMostExpandedItem()

static int FILEDLG95_LOOKIN_RemoveMostExpandedItem ( HWND  hwnd)
static

Definition at line 4020 of file filedlg.c.

4021 {
4022  int iItemPos;
4024 
4025  TRACE("\n");
4026 
4027  if(liInfos->iMaxIndentation <= 2)
4028  return -1;
4029 
4030  if((iItemPos = FILEDLG95_LOOKIN_SearchItem(hwnd,liInfos->iMaxIndentation,SEARCH_EXP)) >=0)
4031  {
4032  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4033  ILFree(tmpFolder->pidlItem);
4034  heap_free(tmpFolder);
4035  SendMessageW(hwnd, CB_DELETESTRING, iItemPos, 0);
4036  liInfos->iMaxIndentation--;
4037 
4038  return iItemPos;
4039  }
4040 
4041  return -1;
4042 }
#define SEARCH_EXP
Definition: filedlg.c:123
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static const char LookInInfosStr[]
Definition: filedlg.c:144
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4050
int iMaxIndentation
Definition: filedlg.c:106
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_DELETESTRING
Definition: winuser.h: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 4050 of file filedlg.c.

4051 {
4052  int i = 0;
4053  int iCount;
4054 
4055  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
4056 
4057  TRACE("0x%08lx 0x%x\n",searchArg, iSearchMethod);
4058 
4059  if (iCount != CB_ERR)
4060  {
4061  for(;i<iCount;i++)
4062  {
4063  LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i);
4064 
4065  if (iSearchMethod == SEARCH_PIDL && ILIsEqual((LPITEMIDLIST)searchArg, tmpFolder->pidlItem))
4066  return i;
4067  if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg)
4068  return i;
4069  }
4070  }
4071 
4072  return -1;
4073 }
#define SEARCH_EXP
Definition: filedlg.c:123
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SEARCH_PIDL
Definition: filedlg.c:122
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:99
LPITEMIDLIST pidlItem
Definition: filedlg.c:100
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h: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 3977 of file filedlg.c.

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

2304 {
2305  WCHAR mru_list[32], *cur_mru_slot;
2306  BOOL taken[25] = {0};
2307  DWORD mru_list_size = sizeof(mru_list), key_type = -1, i;
2308  HKEY hkey_tmp, *hkey;
2309  LONG ret;
2310 
2311  if(hkey_ret)
2312  hkey = hkey_ret;
2313  else
2314  hkey = &hkey_tmp;
2315 
2316  if(stored_path)
2317  *stored_path = '\0';
2318 
2320  if(ret){
2321  WARN("Unable to create MRU key: %d\n", ret);
2322  return 0;
2323  }
2324 
2325  ret = RegGetValueW(*hkey, NULL, MRUListW, RRF_RT_REG_SZ, &key_type,
2326  (LPBYTE)mru_list, &mru_list_size);
2327  if(ret || key_type != REG_SZ){
2328  if(ret == ERROR_FILE_NOT_FOUND)
2329  return 'a';
2330 
2331  WARN("Error getting MRUList data: type: %d, ret: %d\n", key_type, ret);
2332  RegCloseKey(*hkey);
2333  return 0;
2334  }
2335 
2336  for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot){
2337  WCHAR value_data[MAX_PATH], value_name[2] = {0};
2338  DWORD value_data_size = sizeof(value_data);
2339 
2340  *value_name = *cur_mru_slot;
2341 
2342  ret = RegGetValueW(*hkey, NULL, value_name, RRF_RT_REG_BINARY,
2343  &key_type, (LPBYTE)value_data, &value_data_size);
2344  if(ret || key_type != REG_BINARY){
2345  WARN("Error getting MRU slot data: type: %d, ret: %d\n", key_type, ret);
2346  continue;
2347  }
2348 
2349  if(!strcmpiW(module_name, value_data)){
2350  if(!hkey_ret)
2351  RegCloseKey(*hkey);
2352  if(stored_path)
2353  lstrcpyW(stored_path, value_data + lstrlenW(value_data) + 1);
2354  return *value_name;
2355  }
2356  }
2357 
2358  if(!hkey_ret)
2359  RegCloseKey(*hkey);
2360 
2361  /* the module name isn't in the registry, so find the next open slot */
2362  for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot)
2363  taken[*cur_mru_slot - 'a'] = TRUE;
2364  for(i = 0; i < 25; ++i){
2365  if(!taken[i])
2366  return i + 'a';
2367  }
2368 
2369  /* all slots are taken, so return the last one in MRUList */
2370  --cur_mru_slot;
2371  return *cur_mru_slot;
2372 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
#define TRUE
Definition: types.h:120
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
#define REG_BINARY
Definition: nt_native.h:1496
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define WARN(fmt,...)
Definition: debug.h:111
#define RRF_RT_REG_SZ
Definition: driver.c:575
#define lstrlenW
Definition: compat.h:407
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
static const WCHAR MRUListW[]
Definition: filedlg.c:152
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define lstrcpyW
Definition: compat.h:406
static const WCHAR LastVisitedMRUW[]
Definition: filedlg.c:147
#define RRF_RT_REG_BINARY
Definition: driver.c:577
#define REG_SZ
Definition: layer.c:22

Referenced by FILEDLG95_MRU_load_filename(), and FILEDLG95_MRU_save_filename().

◆ FILEDLG95_MRU_load_filename()

static void FILEDLG95_MRU_load_filename ( LPWSTR  stored_path)
static

Definition at line 2465 of file filedlg.c.

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

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_MRU_save_filename()

static void FILEDLG95_MRU_save_filename ( LPCWSTR  filename)
static

Definition at line 2375 of file filedlg.c.

2376 {
2377  WCHAR module_path[MAX_PATH], *module_name, slot, slot_name[2] = {0};
2378  LONG ret;
2379  HKEY hkey;
2380 
2381  /* get the current executable's name */
2382  if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2383  {
2384  WARN("GotModuleFileName failed: %d\n", GetLastError());
2385  return;
2386  }
2387  module_name = strrchrW(module_path, '\\');
2388  if(!module_name)
2389  module_name = module_path;
2390  else
2391  module_name += 1;
2392 
2394  if(!slot)
2395  return;
2396  *slot_name = slot;
2397 
2398  { /* update the slot's info */
2399  WCHAR *path_ends, *final;
2400  DWORD path_len, final_len;
2401 
2402  /* use only the path segment of `filename' */
2403  path_ends = strrchrW(filename, '\\');
2404  path_len = path_ends - filename;
2405 
2406  final_len = path_len + lstrlenW(module_name) + 2;
2407 
2408  final = heap_alloc(final_len * sizeof(WCHAR));
2409  if(!final)
2410  return;
2411  lstrcpyW(final, module_name);
2412  memcpy(final + lstrlenW(final) + 1, filename, path_len * sizeof(WCHAR));
2413  final[final_len-1] = '\0';
2414 
2415  ret = RegSetValueExW(hkey, slot_name, 0, REG_BINARY, (LPBYTE)final,
2416  final_len * sizeof(WCHAR));
2417  if(ret){
2418  WARN("Error saving MRU data to slot %s: %d\n", wine_dbgstr_w(slot_name), ret);
2419  heap_free(final);
2420  RegCloseKey(hkey);
2421  return;
2422  }
2423 
2424  heap_free(final);
2425  }
2426 
2427  { /* update MRUList value */
2428  WCHAR old_mru_list[32], new_mru_list[32];
2429  WCHAR *old_mru_slot, *new_mru_slot = new_mru_list;
2430  DWORD mru_list_size = sizeof(old_mru_list), key_type;
2431 
2432  ret = RegGetValueW(hkey, NULL, MRUListW, RRF_RT_ANY, &key_type,
2433  (LPBYTE)old_mru_list, &mru_list_size);
2434  if(ret || key_type != REG_SZ){
2435  if(ret == ERROR_FILE_NOT_FOUND){
2436  new_mru_list[0] = slot;
2437  new_mru_list[1] = '\0';
2438  }else{
2439  WARN("Error getting MRUList data: type: %d, ret: %d\n", key_type, ret);
2440  RegCloseKey(hkey);
2441  return;
2442  }
2443  }else{
2444  /* copy old list data over so that the new slot is at the start
2445  * of the list */
2446  *new_mru_slot++ = slot;
2447  for(old_mru_slot = old_mru_list; *old_mru_slot; ++old_mru_slot){
2448  if(*old_mru_slot != slot)
2449  *new_mru_slot++ = *old_mru_slot;
2450  }
2451  *new_mru_slot = '\0';
2452  }
2453 
2454  ret = RegSetValueExW(hkey, MRUListW, 0, REG_SZ, (LPBYTE)new_mru_list,
2455  (lstrlenW(new_mru_list) + 1) * sizeof(WCHAR));
2456  if(ret){
2457  WARN("Error saving MRUList data: %d\n", ret);
2458  RegCloseKey(hkey);
2459  return;
2460  }
2461  }
2462 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
struct _slot slot
Definition: vfat.h:196
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
#define REG_BINARY
Definition: nt_native.h:1496
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:407
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const WCHAR MRUListW[]
Definition: filedlg.c:152
Definition: vfat.h:184
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
static DWORD path_len
Definition: batch.c:31
#define lstrcpyW
Definition: compat.h:406
#define ARRAY_SIZE(a)
Definition: main.h:24
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:847
#define RRF_RT_ANY
Definition: winreg.h:64
static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHKEY hkey_ret)
Definition: filedlg.c:2303
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 2840 of file filedlg.c.

2841 {
2843  LPWSTR lpstrFileList;
2844  UINT nFileCount = 0;
2845  UINT sizeUsed = 0;
2846  BOOL ret = TRUE;
2847  WCHAR lpstrPathAndFile[MAX_PATH];
2848  LPSHELLFOLDER lpsf = NULL;
2849  int nOpenAction;
2850 
2851  TRACE("hwnd=%p\n", hwnd);
2852 
2853  /* try to browse the selected item */
2855  return FALSE;
2856 
2857  /* get the files from the edit control */
2858  nFileCount = FILEDLG95_FILENAME_GetFileNames(hwnd, &lpstrFileList, &sizeUsed);
2859 
2860  if(nFileCount == 0)
2861  return FALSE;
2862 
2863  if(nFileCount > 1)
2864  {
2865  ret = FILEDLG95_OnOpenMultipleFiles(hwnd, lpstrFileList, nFileCount, sizeUsed);
2866  goto ret;
2867  }
2868 
2869  TRACE("count=%u len=%u file=%s\n", nFileCount, sizeUsed, debugstr_w(lpstrFileList));
2870 
2871 /*
2872  Step 1: Build a complete path name from the current folder and
2873  the filename or path in the edit box.
2874  Special cases:
2875  - the path in the edit box is a root path
2876  (with or without drive letter)
2877  - the edit box contains ".." (or a path with ".." in it)
2878 */
2879 
2880  COMDLG32_GetCanonicalPath(fodInfos->ShellInfos.pidlAbsCurrent, lpstrFileList, lpstrPathAndFile);
2881  heap_free(lpstrFileList);
2882 
2883 /*
2884  Step 2: here we have a cleaned up path
2885 
2886  We have to parse the path step by step to see if we have to browse
2887  to a folder if the path points to a directory or the last
2888  valid element is a directory.
2889 
2890  valid variables:
2891  lpstrPathAndFile: cleaned up path
2892  */
2893 
2894  if (nFileCount &&
2895  (fodInfos->ofnInfos->Flags & OFN_NOVALIDATE) &&
2896  !(fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST))
2897  nOpenAction = ONOPEN_OPEN;
2898  else
2899  nOpenAction = ONOPEN_BROWSE;
2900 
2901  nOpenAction = FILEDLG95_ValidatePathAction(lpstrPathAndFile, &lpsf, hwnd,
2902  fodInfos->ofnInfos->Flags,
2903  fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG,
2904  nOpenAction);
2905  if(!nOpenAction)
2906  goto ret;
2907 
2908 /*
2909  Step 3: here we have a cleaned up and validated path
2910 
2911  valid variables:
2912  lpsf: ShellFolder bound to the rightmost valid path component
2913  lpstrPathAndFile: cleaned up path
2914  nOpenAction: action to do
2915 */
2916  TRACE("end validate sf=%p\n", lpsf);
2917 
2918  switch(nOpenAction)
2919  {
2920  case ONOPEN_SEARCH: /* set the current filter to the file mask and refresh */
2921  TRACE("ONOPEN_SEARCH %s\n", debugstr_w(lpstrPathAndFile));
2922  {
2923  int iPos;
2924  LPWSTR lpszTemp = PathFindFileNameW(lpstrPathAndFile);
2925  DWORD len;
2926 
2927  /* replace the current filter */
2928  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
2929  len = lstrlenW(lpszTemp)+1;
2930  fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc(len * sizeof(WCHAR));
2931  lstrcpyW( fodInfos->ShellInfos.lpstrCurrentFilter, lpszTemp);
2932 
2933  /* set the filter cb to the extension when possible */
2934  if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, lpszTemp)))
2935  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_SETCURSEL, iPos, 0);
2936  }
2937  /* fall through */
2938  case ONOPEN_BROWSE: /* browse to the highest folder we could bind to */
2939  TRACE("ONOPEN_BROWSE\n");
2940  {
2941  IPersistFolder2 * ppf2;
2942  if(SUCCEEDED(IShellFolder_QueryInterface( lpsf, &IID_IPersistFolder2, (LPVOID*)&ppf2)))
2943  {
2944  LPITEMIDLIST pidlCurrent;
2945  IPersistFolder2_GetCurFolder(ppf2, &pidlCurrent);
2946  IPersistFolder2_Release(ppf2);
2947  if (!ILIsEqual(pidlCurrent, fodInfos->ShellInfos.pidlAbsCurrent))
2948  {
2949  if (SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidlCurrent, SBSP_ABSOLUTE))
2950  && fodInfos->ofnInfos->Flags & OFN_EXPLORER)
2951  {
2953  SendMessageA(fodInfos->DlgInfos.hwndFileName, WM_SETTEXT, 0, (LPARAM)"");
2954  }
2955  }
2956  else if( nOpenAction == ONOPEN_SEARCH )
2957  {
2958  if (fodInfos->Shell.FOIShellView)
2959  IShellView_Refresh(fodInfos->Shell.FOIShellView);
2960  }
2961  ILFree(pidlCurrent);
2962  if (filename_is_edit( fodInfos ))
2963  SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
2964  else
2965  {
2966  HWND hwnd;
2967 
2968  hwnd = (HWND)SendMessageA(fodInfos->DlgInfos.hwndFileName, CBEM_GETEDITCONTROL, 0, 0);
2969  SendMessageW(hwnd, EM_SETSEL, 0, -1);
2970  }
2971  }
2972  }
2973  ret = FALSE;
2974  break;
2975  case ONOPEN_OPEN: /* fill in the return struct and close the dialog */
2976  TRACE("ONOPEN_OPEN %s\n", debugstr_w(lpstrPathAndFile));
2977  {
2978  WCHAR *ext = NULL;
2979 
2980  /* update READONLY check box flag */
2982  fodInfos->ofnInfos->Flags |= OFN_READONLY;
2983  else
2984  fodInfos->ofnInfos->Flags &= ~OFN_READONLY;
2985 
2986  /* Attach the file extension with file name*/
2987  ext = PathFindExtensionW(lpstrPathAndFile);
2988 #ifdef __REACTOS__
2989  {
2990  LPWSTR filterExt = NULL, lpstrFilter = NULL, pch, pchNext;
2991  LPCWSTR the_ext = NULL;
2992  static const WCHAR szwDot[] = {'.',0};
2993  int PathLength = lstrlenW(lpstrPathAndFile);
2994 
2995  /* get filter extensions */
2996  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
2997  fodInfos->ofnInfos->nFilterIndex - 1);
2998  if (lpstrFilter != (LPWSTR)CB_ERR) /* control is not empty */
2999  {
3000  LPWSTR filterSearchIndex, pchFirst = NULL;
3001  filterExt = heap_alloc((lstrlenW(lpstrFilter) + 1) * sizeof(WCHAR));
3002  if (filterExt)
3003  {
3004  strcpyW(filterExt, lpstrFilter);
3005 
3006  if (ext && *ext)
3007  {
3008  /* find ext in filter */
3009  for (pch = filterExt; pch && *pch; pch = pchNext)
3010  {
3011  filterSearchIndex = strchrW(pch, ';');
3012  if (filterSearchIndex)
3013  {
3014  filterSearchIndex[0] = 0;
3015  pchNext = filterSearchIndex + 1;
3016  }
3017  else
3018  {
3019  pchNext = NULL;
3020  }
3021 
3022  while (*pch == '*' || *pch == '.' || *pch == '?')
3023  {
3024  ++pch;
3025  }
3026 
3027  if (!pchFirst)
3028  pchFirst = pch;
3029 
3030  if (lstrcmpiW(pch, &ext[1]) == 0)
3031  {
3032  the_ext = pch;
3033  break;
3034  }
3035  }
3036 
3037  /* use first one if not found */
3038  if (!the_ext && pchFirst && *pchFirst)
3039  {
3040  the_ext = pchFirst;
3041  }
3042  }
3043  }
3044  }
3045 
3046  if (!the_ext)
3047  {
3048  /* use default extension if no extension in filter */
3049  the_ext = fodInfos->defext;
3050  }
3051 
3052  if (the_ext && *the_ext && lstrcmpiW(&ext[1], the_ext) != 0)
3053  {
3054  if (strlenW(lpstrPathAndFile) + 1 + strlenW(the_ext) + 1 <=
3055  fodInfos->ofnInfos->nMaxFile)
3056  {
3057  /* append the dot */
3058  lstrcatW(lpstrPathAndFile, szwDot);
3059  /* append the extension */
3060  lstrcatW(lpstrPathAndFile, the_ext);
3061  /* update ext */
3062  ext = PathFindExtensionW(lpstrPathAndFile);
3063  }
3064  }
3065 
3066  heap_free(filterExt);
3067 
3068  /* In Open dialog: if file does not exist try without extension */
3069  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile))
3070  lpstrPathAndFile[PathLength] = 0;
3071 
3072  /* Set/clear the output OFN_EXTENSIONDIFFERENT flag */
3073  if (*ext)
3074  ext++;
3075  if (!lstrcmpiW(fodInfos->defext, ext))
3076  fodInfos->ofnInfos->Flags &= ~OFN_EXTENSIONDIFFERENT;
3077  else
3078  fodInfos->ofnInfos->Flags |= OFN_EXTENSIONDIFFERENT;
3079  }
3080 
3081  /* update dialog data */
3082  SetWindowTextW(fodInfos->DlgInfos.hwndFileName, PathFindFileNameW(lpstrPathAndFile));
3083 #else
3084  if (! *ext && fodInfos->defext)
3085  {
3086  /* if no extension is specified with file name, then */
3087  /* attach the extension from file filter or default one */
3088 
3089  WCHAR *filterExt = NULL;
3090  LPWSTR lpstrFilter = NULL;
3091  static const WCHAR szwDot[] = {'.',0};
3092  int PathLength = lstrlenW(lpstrPathAndFile);
3093 
3094  /*Get the file extension from file type filter*/
3095  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3096  fodInfos->ofnInfos->nFilterIndex-1);
3097 
3098  if (lpstrFilter != (LPWSTR)CB_ERR) /* control is not empty */
3099  {
3100  WCHAR* filterSearchIndex;
3101  filterExt = heap_alloc((lstrlenW(lpstrFilter) + 1) * sizeof(WCHAR));
3102  strcpyW(filterExt, lpstrFilter);
3103 
3104  /* if a semicolon-separated list of file extensions was given, do not include the
3105  semicolon or anything after it in the extension.
3106  example: if filterExt was "*.abc;*.def", it will become "*.abc" */
3107  filterSearchIndex = strchrW(filterExt, ';');
3108  if (filterSearchIndex)
3109  {
3110  filterSearchIndex[0] = '\0';
3111  }
3112 
3113  /* find the file extension by searching for the first dot in filterExt */
3114  /* strip the * or anything else from the extension, "*.abc" becomes "abc" */
3115  /* if the extension is invalid or contains a glob, ignore it */
3116  filterSearchIndex = strchrW(filterExt, '.');
3117  if (filterSearchIndex++ && !strchrW(filterSearchIndex, '*') && !strchrW(filterSearchIndex, '?'))
3118  {
3119  strcpyW(filterExt, filterSearchIndex);
3120  }
3121  else
3122  {
3123  heap_free(filterExt);
3124  filterExt = NULL;
3125  }
3126  }
3127 
3128  if (!filterExt)
3129  {
3130  /* use the default file extension */
3131  filterExt = heap_alloc((lstrlenW(fodInfos->defext) + 1) * sizeof(WCHAR));
3132  strcpyW(filterExt, fodInfos->defext);
3133  }
3134 
3135  if (*filterExt) /* ignore filterExt="" */
3136  {
3137  /* Attach the dot*/
3138  lstrcatW(lpstrPathAndFile, szwDot);
3139  /* Attach the extension */
3140  lstrcatW(lpstrPathAndFile, filterExt);
3141  }
3142 
3143  heap_free(filterExt);
3144 
3145  /* In Open dialog: if file does not exist try without extension */
3146  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile))
3147  lpstrPathAndFile[PathLength] = '\0';
3148 
3149  /* Set/clear the output OFN_EXTENSIONDIFFERENT flag */
3150  if (*ext)
3151  ext++;
3152  if (!lstrcmpiW(fodInfos->defext, ext))
3153  fodInfos->ofnInfos->Flags &= ~OFN_EXTENSIONDIFFERENT;
3154  else
3155  fodInfos->ofnInfos->Flags |= OFN_EXTENSIONDIFFERENT;
3156  }
3157 #endif
3158 
3159  /* In Save dialog: check if the file already exists */
3160  if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG
3161  && fodInfos->ofnInfos->Flags & OFN_OVERWRITEPROMPT
3162  && PathFileExistsW(lpstrPathAndFile))
3163  {
3164  WCHAR lpstrOverwrite[100];
3165  int answer;
3166 
3167  LoadStringW(COMDLG32_hInstance, IDS_OVERWRITEFILE, lpstrOverwrite, 100);
3168  answer = MessageBoxW(hwnd, lpstrOverwrite, fodInfos->title,
3170  if (answer == IDNO || answer == IDCANCEL)
3171  {
3172  ret = FALSE;
3173  goto ret;
3174  }
3175  }
3176 
3177  /* In Open dialog: check if it should be created if it doesn't exist */
3178  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
3179  && fodInfos->ofnInfos->Flags & OFN_CREATEPROMPT
3180  && !PathFileExistsW(lpstrPathAndFile))
3181  {
3182  WCHAR lpstrCreate[100];
3183  int answer;
3184 
3185  LoadStringW(COMDLG32_hInstance, IDS_CREATEFILE, lpstrCreate, 100);
3186  answer = MessageBoxW(hwnd, lpstrCreate, fodInfos->title,
3188  if (answer == IDNO || answer == IDCANCEL)
3189  {
3190  ret = FALSE;
3191  goto ret;
3192  }
3193  }
3194 
3195  /* Check that the size of the file does not exceed buffer size.
3196  (Allow for extra \0 if OFN_MULTISELECT is set.) */
3197  if(lstrlenW(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile -
3198  ((fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) ? 1 : 0))
3199  {
3200 
3201  /* fill destination buffer */
3202  if (fodInfos->ofnInfos->lpstrFile)
3203  {
3204  if(fodInfos->unicode)
3205  {
3206  LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
3207 
3208  lstrcpynW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile);
3210  ofn->lpstrFile[lstrlenW(ofn->lpstrFile) + 1] = '\0';
3211  }
3212  else
3213  {
3215 
3216  WideCharToMultiByte(CP_ACP, 0, lpstrPathAndFile, -1,
3219  ofn->lpstrFile[lstrlenA(ofn->lpstrFile) + 1] = '\0';
3220  }
3221  }
3222 
3223  if(fodInfos->unicode)
3224  {
3225  LPWSTR lpszTemp;
3226 
3227  /* set filename offset */
3228  lpszTemp = PathFindFileNameW(lpstrPathAndFile);
3229  fodInfos->ofnInfos->nFileOffset = (lpszTemp - lpstrPathAndFile);
3230 
3231  /* set extension offset */
3232  lpszTemp = PathFindExtensionW(lpstrPathAndFile);
3233  fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - lpstrPathAndFile) + 1 : 0;
3234  }
3235  else
3236  {
3237  LPSTR lpszTemp;
3238  CHAR tempFileA[MAX_PATH];
3239 
3240  /* avoid using fodInfos->ofnInfos->lpstrFile since it can be NULL */
3241  WideCharToMultiByte(CP_ACP, 0, lpstrPathAndFile, -1,
3242  tempFileA, sizeof(tempFileA), NULL, NULL);
3243 
3244  /* set filename offset */
3245  lpszTemp = PathFindFileNameA(tempFileA);
3246  fodInfos->ofnInfos->nFileOffset = (lpszTemp - tempFileA);
3247 
3248  /* set extension offset */
3249  lpszTemp = PathFindExtensionA(tempFileA);
3250  fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - tempFileA) + 1 : 0;
3251  }
3252 
3253  /* copy currently selected filter to lpstrCustomFilter */
3254  if (fodInfos->ofnInfos->lpstrCustomFilter)
3255  {
3257  int len = WideCharToMultiByte(CP_ACP, 0, fodInfos->ShellInfos.lpstrCurrentFilter, -1,
3258  NULL, 0, NULL, NULL);
3260  {
3262  s += strlen(ofn->lpstrCustomFilter)+1;
3263  WideCharToMultiByte(CP_ACP, 0, fodInfos->ShellInfos.lpstrCurrentFilter, -1,
3264  s, len, NULL, NULL);
3265  }
3266  }
3267 
3268 
3269  if ( !FILEDLG95_SendFileOK(hwnd, fodInfos) )
3270  goto ret;
3271 
3272  FILEDLG95_MRU_save_filename(lpstrPathAndFile);
3273 #ifdef __REACTOS__
3274  FILEDLG95_MRU_save_ext(lpstrPathAndFile);
3275 #endif
3276 
3277  TRACE("close\n");
3279  ret = EndDialog(hwnd, TRUE);
3280  }
3281  else
3282  {
3283  WORD size;
3284 
3285  size = lstrlenW(lpstrPathAndFile) + 1;
3286  if (fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT)
3287  size += 1;
3288  /* return needed size in first two bytes of lpstrFile */
3289  if(fodInfos->ofnInfos->lpstrFile)
3290  *(WORD *)fodInfos->ofnInfos->lpstrFile = size;
3292  ret = EndDialog(hwnd, FALSE);
3294  }
3295  }
3296  break;
3297  }
3298 
3299 ret:
3300  if(lpsf) IShellFolder_Release(lpsf);
3301  return ret;
3302 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WideCharToMultiByte
Definition: compat.h:101
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LPSTR lpstrCustomFilter
Definition: commdlg.h:333
struct FileOpenDlgInfos::@327 Shell
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
LPWSTR lpstrFile
Definition: commdlg.h:367
#define IDC_OPENREADONLY
HANDLE HWND
Definition: compat.h:13
OPENFILENAME ofn
Definition: main.cpp:37
#define OFN_ALLOWMULTISELECT
Definition: commdlg.h:96
#define ONOPEN_BROWSE
Definition: cdlg.h:210
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
char * LPSTR
Definition: xmlstorage.h:182
static USHORT PathLength
#define lstrlenW
Definition: compat.h:407
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static int FILEDLG95_FILETYPE_SearchExt(HWND hwnd, LPCWSTR lpstrExt)
Definition: filedlg.c:3583
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:397
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
DWORD nMaxFile
Definition: commdlg.h:337
WORD nFileExtension
Definition: commdlg.h:375
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define OFN_CREATEPROMPT
Definition: commdlg.h:97
#define MB_YESNO
Definition: winuser.h:811
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FODPROP_SAVEDLG
WORD nFileOffset
Definition: commdlg.h:374
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:389
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1900
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
#define CBEM_GETEDITCONTROL
Definition: commctrl.h:3805
void COMDLG32_GetCanonicalPath(PCIDLIST_ABSOLUTE pidlAbsCurrent, LPWSTR lpstrFile, LPWSTR lpstrPathAndFile)
Definition: filedlg.c:655
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:4473
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
struct FileOpenDlgInfos::@329 DlgInfos
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:2716
#define IDS_OVERWRITEFILE
#define MAX_PATH
Definition: compat.h:26
#define EM_SETSEL
Definition: winuser.h:2000
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD nMaxFile
Definition: commdlg.h:368
#define OFN_EXTENSIONDIFFERENT
Definition: commdlg.h:105
DWORD nMaxCustFilter
Definition: commdlg.h:334
#define OFN_READONLY
Definition: commdlg.h:118
int ret
static BOOL FILEDLG95_SendFileOK(HWND hwnd, FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:2153
static void FILEDLG95_MRU_save_filename(LPCWSTR filename)
Definition: filedlg.c:2375
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:211
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define lstrcpyW
Definition: compat.h:406
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:989
LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath)
Definition: path.c:417
LPSTR lpstrFile
Definition: commdlg.h:336
#define FNERR_BUFFERTOOSMALL
Definition: cderr.h:37
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN
Definition: cdlg32.c:119
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct FileOpenDlgInfos::@328 ShellInfos
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
unsigned int UINT
Definition: ndis.h:50
#define BST_CHECKED
Definition: winuser.h:197
static BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCount, UINT sizeUsed)
Definition: filedlg.c:2190
LPWSTR lpstrCustomFilter
Definition: commdlg.h:364
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define IDNO
Definition: winuser.h:830
#define OFN_NOVALIDATE
Definition: commdlg.h:115
LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath)
Definition: path.c:368
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define IDS_CREATEFILE
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1514
static int FILEDLG95_FILENAME_GetFileNames(HWND hwnd, LPWSTR *lpstrFileList, UINT *sizeUsed)
Definition: filedlg.c:4239
struct tagOFNA * LPOPENFILENAMEA
#define SUCCEEDED(hr)
Definition: intsafe.h:57
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static void FILEDLG95_Clean(HWND hwnd)
Definition: filedlg.c:2029
#define ONOPEN_SEARCH
Definition: cdlg.h:212
DWORD Flags
Definition: commdlg.h:342

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_OnOpenMessage()

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

Definition at line 2704 of file filedlg.c.

2705 {
2706  WCHAR strMsgTitle[MAX_PATH];
2707  WCHAR strMsgText [MAX_PATH];
2708  if (idCaption)
2709  LoadStringW(COMDLG32_hInstance, idCaption, strMsgTitle, ARRAY_SIZE(strMsgTitle));
2710  else
2711  strMsgTitle[0] = '\0';
2712  LoadStringW(COMDLG32_hInstance, idText, strMsgText, ARRAY_SIZE(strMsgText));
2713  MessageBoxW(hwnd,strMsgText, strMsgTitle, MB_OK | MB_ICONHAND);
2714 }
#define MB_ICONHAND
Definition: winuser.h:782
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MB_OK
Definition: winuser.h:784

Referenced by FILEDLG95_ValidatePathAction(), and on_default_action().

◆ FILEDLG95_OnOpenMultipleFiles()

BOOL FILEDLG95_OnOpenMultipleFiles (