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

Go to the source code of this file.

Classes

struct  SFolder
 
struct  tagLookInInfo
 

Macros

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

Typedefs

typedef struct SFolder SFOLDER
 
typedef struct SFolderLPSFOLDER
 
typedef struct tagLookInInfo LookInInfos
 

Functions

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

Variables

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

Macro Definition Documentation

◆ CBGetItemDataPtr

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

Definition at line 140 of file filedlg.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 54 of file filedlg.c.

◆ ITEM_NOTFOUND

#define ITEM_NOTFOUND   -1

Definition at line 123 of file filedlg.c.

◆ LISTEND

#define LISTEND   -1

Definition at line 118 of file filedlg.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 55 of file filedlg.c.

◆ SEARCH_EXP

#define SEARCH_EXP   2

Definition at line 122 of file filedlg.c.

◆ SEARCH_PIDL

#define SEARCH_PIDL   1

Definition at line 121 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE0

#define TBPLACES_CMDID_PLACE0   0xa064

Definition at line 128 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE1

#define TBPLACES_CMDID_PLACE1   0xa065

Definition at line 129 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE2

#define TBPLACES_CMDID_PLACE2   0xa066

Definition at line 130 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE3

#define TBPLACES_CMDID_PLACE3   0xa067

Definition at line 131 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE4

#define TBPLACES_CMDID_PLACE4   0xa068

Definition at line 132 of file filedlg.c.

◆ UNIMPLEMENTED_FLAGS

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

Definition at line 86 of file filedlg.c.

◆ WM_GETISHELLBROWSER

#define WM_GETISHELLBROWSER   WM_USER+7

Definition at line 126 of file filedlg.c.

◆ XTEXTOFFSET

#define XTEXTOFFSET   3

Definition at line 115 of file filedlg.c.

Typedef Documentation

◆ LookInInfos

◆ LPSFOLDER

◆ SFOLDER

Function Documentation

◆ ArrangeCtrlPositions()

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

Definition at line 750 of file filedlg.c.

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

Referenced by FILEDLG95_ResizeControls().

◆ BrowseSelectedFolder()

static BOOL BrowseSelectedFolder ( HWND  hwnd)
static

Definition at line 4486 of file filedlg.c.

4487 {
4489  BOOL bBrowseSelFolder = FALSE;
4490 
4491  TRACE("\n");
4492 
4493  if (GetNumSelected(fodInfos->Shell.FOIDataObject) == 1)
4494  {
4495  LPITEMIDLIST pidlSelection;
4496 
4497  /* get the file selected */
4498  pidlSelection = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, 1);
4499  if (IsPidlFolder (fodInfos->Shell.FOIShellFolder, pidlSelection))
4500  {
4501  if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser,
4502  pidlSelection, SBSP_RELATIVE ) ) )
4503  {
4504  WCHAR buf[64];
4506  MessageBoxW( hwnd, buf, fodInfos->title, MB_OK | MB_ICONEXCLAMATION );
4507  }
4508  bBrowseSelFolder = TRUE;
4509  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
4511  }
4512  ILFree( pidlSelection );
4513  }
4514 
4515  return bBrowseSelFolder;
4516 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TRUE
Definition: types.h:120
LPITEMIDLIST GetPidlFromDataObject(IDataObject *doSelected, UINT nPidlIndex)
Definition: filedlg.c:4302
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
#define FALSE
Definition: types.h:117
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:996
#define ARRAY_SIZE(a)
Definition: main.h:24
struct FileOpenDlgInfos::@338 Shell
#define MB_OK
Definition: winuser.h:784
static UINT GetNumSelected(IDataObject *doSelected)
Definition: filedlg.c:4333
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4469
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155

Referenced by FILEDLG95_OnOpen().

◆ COMCTL32_ReleaseStgMedium()

static void COMCTL32_ReleaseStgMedium ( STGMEDIUM  medium)
static

Definition at line 4282 of file filedlg.c.

4283 {
4284  if(medium.pUnkForRelease)
4285  {
4286  IUnknown_Release(medium.pUnkForRelease);
4287  }
4288  else
4289  {
4290  GlobalUnlock(medium.u.hGlobal);
4291  GlobalFree(medium.u.hGlobal);
4292  }
4293 }
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 662 of file filedlg.c.

664 {
665  WCHAR lpstrTemp[MAX_PATH];
666 
667  /* Get the current directory name */
668  if (!COMDLG32_GetDisplayNameOf(pidlAbsCurrent, lpstrPathAndFile))
669  {
670  /* last fallback */
671  GetCurrentDirectoryW(MAX_PATH, lpstrPathAndFile);
672  }
673  PathAddBackslashW(lpstrPathAndFile);
674 
675  TRACE("current directory=%s, file=%s\n", debugstr_w(lpstrPathAndFile), debugstr_w(lpstrFile));
676 
677  /* if the user specified a fully qualified path use it */
678  if(PathIsRelativeW(lpstrFile))
679  {
680  lstrcatW(lpstrPathAndFile, lpstrFile);
681  }
682  else
683  {
684  /* does the path have a drive letter? */
685  if (PathGetDriveNumberW(lpstrFile) == -1)
686  lstrcpyW(lpstrPathAndFile+2, lpstrFile);
687  else
688  lstrcpyW(lpstrPathAndFile, lpstrFile);
689  }
690 
691  /* resolve "." and ".." */
692  PathCanonicalizeW(lpstrTemp, lpstrPathAndFile );
693  lstrcpyW(lpstrPathAndFile, lpstrTemp);
694  TRACE("canon=%s\n", debugstr_w(lpstrPathAndFile));
695 }
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:504
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:641
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:497
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 641 of file filedlg.c.

641  {
642  LPSHELLFOLDER psfDesktop;
643  STRRET strret;
644 
645  if (FAILED(SHGetDesktopFolder(&psfDesktop)))
646  return FALSE;
647 
648  if (FAILED(IShellFolder_GetDisplayNameOf(psfDesktop, pidl, SHGDN_FORPARSING, &strret))) {
649  IShellFolder_Release(psfDesktop);
650  return FALSE;
651  }
652 
653  IShellFolder_Release(psfDesktop);
654  return SUCCEEDED(StrRetToBufW(&strret, pidl, pwszPath, MAX_PATH));
655 }
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
#define FALSE
Definition: types.h:117
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define MAX_PATH
Definition: compat.h:34
#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 702 of file filedlg.c.

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

4221 {
4222  switch (src->uType)
4223  {
4224  case STRRET_WSTR:
4225  lstrcpynW(dest, src->u.pOleStr, len);
4226  CoTaskMemFree(src->u.pOleStr);
4227  break;
4228 
4229  case STRRET_CSTR:
4230  if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len)
4231  dest[len-1] = 0;
4232  break;
4233 
4234  case STRRET_OFFSET:
4235  if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1, dest, len ) && len)
4236  dest[len-1] = 0;
4237  break;
4238 
4239  default:
4240  FIXME("unknown type %x!\n", src->uType);
4241  if (len) *dest = '\0';
4242  return E_FAIL;
4243  }
4244  return S_OK;
4245 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define CP_ACP
Definition: compat.h:109
#define E_FAIL
Definition: ddrawi.h:102
#define lstrcpynW
Definition: compat.h:486
#define FIXME(fmt,...)
Definition: debug.h:111
const char * LPCSTR
Definition: xmlstorage.h:183
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
#define MultiByteToWideChar
Definition: compat.h:110
static char * dest
Definition: rtl.c:135
SHITEMID mkid
Definition: shtypes.idl:34

Referenced by GetName().

◆ CreateTemplateDialog()

static HWND CreateTemplateDialog ( FileOpenDlgInfos fodInfos,
HWND  hwnd 
)
static

Definition at line 904 of file filedlg.c.

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

Referenced by FileOpenDlgProc95().

◆ filedialog_is_readonly_hidden()

static BOOL filedialog_is_readonly_hidden ( const FileOpenDlgInfos info)
static

Definition at line 165 of file filedlg.c.

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

Referenced by FILEDLG95_InitControls(), and FILEDLG95_ResizeControls().

◆ FILEDLG95_Clean()

void FILEDLG95_Clean ( HWND  hwnd)
static

Definition at line 2040 of file filedlg.c.

2041 {
2045 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void FILEDLG95_LOOKIN_Clean(HWND hwnd)
Definition: filedlg.c:4093
static void FILEDLG95_FILETYPE_Clean(HWND hwnd)
Definition: filedlg.c:3620
static void FILEDLG95_SHELL_Clean(HWND hwnd)
Definition: filedlg.c:3409

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

◆ FILEDLG95_FILENAME_FillFromSelection()

void FILEDLG95_FILENAME_FillFromSelection ( HWND  hwnd)

Definition at line 4144 of file filedlg.c.

4145 {
4147  LPITEMIDLIST pidl;
4148  LPWSTR lpstrAllFiles, lpstrTmp;
4149  UINT nFiles = 0, nFileToOpen, nFileSelected, nAllFilesLength = 0, nThisFileLength, nAllFilesMaxLength;
4150  STGMEDIUM medium;
4151  LPIDA cida;
4152  FORMATETC formatetc = get_def_format();
4153 
4154  TRACE("\n");
4155 
4156  if (FAILED(IDataObject_GetData(fodInfos->Shell.FOIDataObject, &formatetc, &medium)))
4157  return;
4158 
4159  cida = GlobalLock(medium.u.hGlobal);
4160  nFileSelected = cida->cidl;
4161 
4162  /* Allocate a buffer */
4163  nAllFilesMaxLength = MAX_PATH + 3;
4164  lpstrAllFiles = heap_alloc_zero(nAllFilesMaxLength * sizeof(WCHAR));
4165  if (!lpstrAllFiles)
4166  goto ret;
4167 
4168  /* Loop through the selection, handle only files (not folders) */
4169  for (nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++)
4170  {
4171  pidl = (LPITEMIDLIST)((LPBYTE)cida + cida->aoffset[nFileToOpen + 1]);
4172  if (pidl)
4173  {
4174  if (!IsPidlFolder(fodInfos->Shell.FOIShellFolder, pidl))
4175  {
4176  if (nAllFilesLength + MAX_PATH + 3 > nAllFilesMaxLength)
4177  {
4178  nAllFilesMaxLength *= 2;
4179  lpstrTmp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpstrAllFiles, nAllFilesMaxLength * sizeof(WCHAR));
4180  if (!lpstrTmp)
4181  goto ret;
4182  lpstrAllFiles = lpstrTmp;
4183  }
4184  nFiles += 1;
4185  lpstrAllFiles[nAllFilesLength++] = '"';
4186  GetName(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, lpstrAllFiles + nAllFilesLength);
4187  nThisFileLength = lstrlenW(lpstrAllFiles + nAllFilesLength);
4188  nAllFilesLength += nThisFileLength;
4189  lpstrAllFiles[nAllFilesLength++] = '"';
4190  lpstrAllFiles[nAllFilesLength++] = ' ';
4191  }
4192  }
4193  }
4194 
4195  if (nFiles != 0)
4196  {
4197  /* If there's only one file, use the name as-is without quotes */
4198  lpstrTmp = lpstrAllFiles;
4199  if (nFiles == 1)
4200  {
4201  lpstrTmp += 1;
4202  lpstrTmp[nThisFileLength] = 0;
4203  }
4204  SetWindowTextW(fodInfos->DlgInfos.hwndFileName, lpstrTmp);
4205  /* Select the file name like Windows does */
4206  if (filename_is_edit(fodInfos))
4207  SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
4208  }
4209 
4210 ret:
4211  heap_free(lpstrAllFiles);
4212  COMCTL32_ReleaseStgMedium(medium);
4213 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl, DWORD dwFlags, LPWSTR lpstrFileName)
Definition: filedlg.c:4368
struct FileOpenDlgInfos::@340 DlgInfos
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
static void COMCTL32_ReleaseStgMedium(STGMEDIUM medium)
Definition: filedlg.c:4282
#define lstrlenW
Definition: compat.h:498
static FORMATETC get_def_format(void)
Definition: filedlg.c:4125
unsigned char * LPBYTE
Definition: typedefs.h:53
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define EM_SETSEL
Definition: winuser.h:2000
UINT cidl
Definition: shlobj.h:499
int ret
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
struct FileOpenDlgInfos::@338 Shell
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HeapReAlloc
Definition: compat.h:482
UINT aoffset[1]
Definition: shlobj.h:500
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4469
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1521
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
Definition: shlobj.h:498
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by IShellBrowserImpl_OnSelChange().

◆ FILEDLG95_FILENAME_GetFileNames()

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

Definition at line 4252 of file filedlg.c.

4253 {
4255  UINT nFileCount = 0; /* number of files */
4256  UINT nStrLen = 0; /* length of string in edit control */
4257  LPWSTR lpstrEdit; /* buffer for string from edit control */
4258 
4259  TRACE("\n");
4260 
4261  /* get the filenames from the filename control */
4262  nStrLen = GetWindowTextLengthW( fodInfos->DlgInfos.hwndFileName );
4263  lpstrEdit = heap_alloc( (nStrLen+1)*sizeof(WCHAR) );
4264  GetWindowTextW( fodInfos->DlgInfos.hwndFileName, lpstrEdit, nStrLen+1);
4265 
4266  TRACE("nStrLen=%u str=%s\n", nStrLen, debugstr_w(lpstrEdit));
4267 
4268  nFileCount = COMDLG32_SplitFileNames(lpstrEdit, nStrLen, lpstrFileList, sizeUsed);
4269  heap_free(lpstrEdit);
4270  return nFileCount;
4271 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
struct FileOpenDlgInfos::@340 DlgInfos
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetWindowTextLengthW(_In_ HWND)
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed)
Definition: filedlg.c:702
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
unsigned int UINT
Definition: ndis.h:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_FILETYPE_Clean()

static void FILEDLG95_FILETYPE_Clean ( HWND  hwnd)
static

Definition at line 3620 of file filedlg.c.

3621 {
3623  int iPos;
3624  int iCount;
3625 
3626  iCount = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCOUNT, 0, 0);
3627 
3628  TRACE("\n");
3629 
3630  /* Delete each string of the combo and their associated data */
3631  if(iCount != CB_ERR)
3632  {
3633  for(iPos = iCount-1;iPos>=0;iPos--)
3634  {
3635  heap_free((void *)CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iPos));
3636  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_DELETESTRING, iPos, 0);
3637  }
3638  }
3639  /* Current filter */
3640  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3641 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
struct FileOpenDlgInfos::@340 DlgInfos
struct FileOpenDlgInfos::@339 ShellInfos
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
#define CB_DELETESTRING
Definition: winuser.h:1919
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_Clean().

◆ FILEDLG95_FILETYPE_Init()

static HRESULT FILEDLG95_FILETYPE_Init ( HWND  hwnd)
static

Definition at line 3435 of file filedlg.c.

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

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_FILETYPE_OnCommand()

static BOOL FILEDLG95_FILETYPE_OnCommand ( HWND  hwnd,
WORD  wNotifyCode 
)
static

Definition at line 3551 of file filedlg.c.

3552 {
3554 
3555  switch(wNotifyCode)
3556  {
3557  case CBN_SELENDOK:
3558  {
3559  LPWSTR lpstrFilter;
3560 
3561  /* Get the current item of the filetype combo box */
3562  int iItem = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCURSEL, 0, 0);
3563 
3564  /* set the current filter index */
3565  fodInfos->ofnInfos->nFilterIndex = iItem +
3566  (fodInfos->customfilter == NULL ? 1 : 0);
3567 
3568  /* Set the current filter with the current selection */
3569  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3570 
3571  lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
3572  iItem);
3573  if((INT_PTR)lpstrFilter != CB_ERR)
3574  {
3575  DWORD len;
3576  CharLowerW(lpstrFilter); /* lowercase */
3577  len = lstrlenW(lpstrFilter)+1;
3578  fodInfos->ShellInfos.lpstrCurrentFilter = heap_alloc( len * sizeof(WCHAR) );
3579  lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
3580  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3582  }
3583 
3584  /* Refresh the actual view to display the included items*/
3585  if (fodInfos->Shell.FOIShellView)
3586  IShellView_Refresh(fodInfos->Shell.FOIShellView);
3587  }
3588  }
3589  return FALSE;
3590 }
#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::@340 DlgInfos
LPWSTR WINAPI CharLowerW(_Inout_ LPWSTR)
struct FileOpenDlgInfos::@339 ShellInfos
int32_t INT_PTR
Definition: typedefs.h:64
#define lstrlenW
Definition: compat.h:498
#define CB_GETCURSEL
Definition: winuser.h:1925
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define FALSE
Definition: types.h:117
#define CBN_SELENDOK
Definition: winuser.h:1963
smooth NULL
Definition: ftsmooth.c:416
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define CB_ERR
Definition: winuser.h:2410
DWORD nFilterIndex
Definition: commdlg.h:366
LPOPENFILENAMEW ofnInfos
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define CDN_TYPECHANGE
Definition: commdlg.h:39
#define lstrcpyW
Definition: compat.h:497
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:996
struct FileOpenDlgInfos::@338 Shell
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_FILETYPE_SearchExt()

static int FILEDLG95_FILETYPE_SearchExt ( HWND  hwnd,
LPCWSTR  lpstrExt 
)
static

Definition at line 3596 of file filedlg.c.

3597 {
3598  int i, iCount;
3599 
3600  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
3601 
3602  TRACE("%s\n", debugstr_w(lpstrExt));
3603 
3604  if(iCount != CB_ERR)
3605  {
3606  for(i=0;i<iCount;i++)
3607  {
3608  if(!lstrcmpiW(lpstrExt,(LPWSTR)CBGetItemDataPtr(hwnd,i)))
3609  return i;
3610  }
3611  }
3612  return -1;
3613 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FILEDLG95_OnOpen().

◆ FILEDLG95_FillControls()

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

Definition at line 2003 of file filedlg.c.

2004 {
2005  LPITEMIDLIST pidlItemId = NULL;
2006 
2007  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
2008 
2009  TRACE("dir=%s file=%s\n",
2010  debugstr_w(fodInfos->initdir), debugstr_w(fodInfos->filename));
2011 
2012  /* Get the initial directory pidl */
2013 
2014  if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->initdir)))
2015  {
2016  WCHAR path[MAX_PATH];
2017 
2019  pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder, path);
2020  }
2021 
2022  /* Initialise shell objects */
2024 
2025  /* Initialize the Look In combo box */
2026  FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB);
2027 
2028  /* Browse to the initial directory */
2029  IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId, SBSP_ABSOLUTE);
2030 
2031  ILFree(pidlItemId);
2032 
2033  return TRUE;
2034 }
static void FILEDLG95_LOOKIN_Init(HWND hwndCombo)
Definition: filedlg.c:3669
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
struct FileOpenDlgInfos::@340 DlgInfos
#define TRUE
Definition: types.h:120
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:504
static LRESULT FILEDLG95_SHELL_Init(HWND hwnd)
Definition: filedlg.c:3322
#define debugstr_w
Definition: kernel32.h:32
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:34
static LPITEMIDLIST GetPidlFromName(IShellFolder *psf, LPWSTR lpcstrFileName)
Definition: filedlg.c:4443
struct FileOpenDlgInfos::@338 Shell
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 1025 of file filedlg.c.

1026 {
1027  UINT len, total;
1028  WCHAR *p, *buffer;
1030 
1031  TRACE("CDM_GETFILEPATH:\n");
1032 
1033  if ( ! (fodInfos->ofnInfos->Flags & OFN_EXPLORER ) )
1034  return -1;
1035 
1036  /* get path and filenames */
1037  len = SendMessageW( fodInfos->DlgInfos.hwndFileName, WM_GETTEXTLENGTH, 0, 0 );
1038  buffer = heap_alloc( (len + 2 + MAX_PATH) * sizeof(WCHAR) );
1039  COMDLG32_GetDisplayNameOf( fodInfos->ShellInfos.pidlAbsCurrent, buffer );
1040  if (len)
1041  {
1042  p = buffer + lstrlenW(buffer);
1043  *p++ = '\\';
1044  SendMessageW( fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, len + 1, (LPARAM)p );
1045  }
1046  if (fodInfos->unicode)
1047  {
1048  total = lstrlenW( buffer) + 1;
1049  if (result) lstrcpynW( result, buffer, size );
1050  TRACE( "CDM_GETFILEPATH: returning %u %s\n", total, debugstr_w(result));
1051  }
1052  else
1053  {
1054  total = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL );
1055  if (total <= size) WideCharToMultiByte( CP_ACP, 0, buffer, -1, result, size, NULL, NULL );
1056  TRACE( "CDM_GETFILEPATH: returning %u %s\n", total, debugstr_a(result));
1057  }
1058  heap_free( buffer );
1059  return total;
1060 }
#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
struct FileOpenDlgInfos::@340 DlgInfos
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
#define WM_GETTEXT
Definition: winuser.h:1600
GLuint buffer
Definition: glext.h:5915
struct FileOpenDlgInfos::@339 ShellInfos
#define lstrlenW
Definition: compat.h:498
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define lstrcpynW
Definition: compat.h:486
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:641
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
GLenum GLsizei len
Definition: glext.h:6722
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
GLfloat GLfloat p
Definition: glext.h:8902
GLuint64EXT * result
Definition: glext.h:11304
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FILEDLG95_HandleCustomDialogMessages().

◆ FILEDLG95_HandleCustomDialogMessages()

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

Definition at line 1067 of file filedlg.c.

1068 {
1070  WCHAR lpstrPath[MAX_PATH];
1071  INT_PTR retval;
1072 
1073  if(!fodInfos) return FALSE;
1074 
1075  switch(uMsg)
1076  {
1077  case CDM_GETFILEPATH:
1079  break;
1080 
1081  case CDM_GETFOLDERPATH:
1082  TRACE("CDM_GETFOLDERPATH:\n");
1083  COMDLG32_GetDisplayNameOf(fodInfos->ShellInfos.pidlAbsCurrent, lpstrPath);
1084  if (lParam)
1085  {
1086  if (fodInfos->unicode)
1087  lstrcpynW((LPWSTR)lParam, lpstrPath, (int)wParam);
1088  else
1089  WideCharToMultiByte(CP_ACP, 0, lpstrPath, -1,
1090  (LPSTR)lParam, (int)wParam, NULL, NULL);
1091  }
1092  retval = lstrlenW(lpstrPath) + 1;
1093  break;
1094 
1095  case CDM_GETFOLDERIDLIST:
1096  retval = ILGetSize(fodInfos->ShellInfos.pidlAbsCurrent);
1097  if (retval <= wParam)
1098  memcpy((void*)lParam, fodInfos->ShellInfos.pidlAbsCurrent, retval);
1099  break;
1100 
1101  case CDM_GETSPEC:
1102  TRACE("CDM_GETSPEC:\n");
1103  retval = SendMessageW(fodInfos->DlgInfos.hwndFileName, WM_GETTEXTLENGTH, 0, 0) + 1;
1104  if (lParam)
1105  {
1106  if (fodInfos->unicode)
1107  SendMessageW(fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, wParam, lParam);
1108  else
1109  SendMessageA(fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, wParam, lParam);
1110  }
1111  break;
1112 
1113  case CDM_SETCONTROLTEXT:
1114  TRACE("CDM_SETCONTROLTEXT:\n");
1115  if ( lParam )
1116  {
1117  if( fodInfos->unicode )
1119  else
1121  }
1122  retval = TRUE;
1123  break;
1124 
1125  case CDM_HIDECONTROL:
1126  /* MSDN states that it should fail for not OFN_EXPLORER case */
1127  if (fodInfos->ofnInfos->Flags & OFN_EXPLORER)
1128  {
1129  HWND control = GetDlgItem( hwnd, wParam );
1130  if (control) ShowWindow( control, SW_HIDE );
1131  retval = TRUE;
1132  }
1133  else retval = FALSE;
1134  break;
1135 
1136  default:
1137  if (uMsg >= CDM_FIRST && uMsg <= CDM_LAST)
1138  FIXME("message CDM_FIRST+%04x not implemented\n", uMsg - CDM_FIRST);
1139  return FALSE;
1140  }
1142  return TRUE;
1143 }
#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
struct FileOpenDlgInfos::@340 DlgInfos
#define WideCharToMultiByte
Definition: compat.h:111
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CP_ACP
Definition: compat.h:109
BOOL WINAPI SetDlgItemTextA(_In_ HWND, _In_ int, _In_ LPCSTR)
#define WM_GETTEXT
Definition: winuser.h:1600
struct FileOpenDlgInfos::@339 ShellInfos
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:64
char * LPSTR
Definition: xmlstorage.h:182
#define CDM_LAST
Definition: commdlg.h:42
#define lstrlenW
Definition: compat.h:498
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define lstrcpynW
Definition: compat.h:486
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath)
Definition: filedlg.c:641
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define CDM_GETFOLDERPATH
Definition: commdlg.h:45
#define CDM_HIDECONTROL
Definition: commdlg.h:48
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define CDM_FIRST
Definition: commdlg.h:41
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CDM_GETSPEC
Definition: commdlg.h:43
#define CDM_GETFILEPATH
Definition: commdlg.h:44
static INT_PTR FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID result)
Definition: filedlg.c:1025
#define MAX_PATH
Definition: compat.h:34
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CDM_SETCONTROLTEXT
Definition: commdlg.h:47
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define ILGetSize
Definition: shellclasses.h:638
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define CDM_GETFOLDERIDLIST
Definition: commdlg.h:46
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_InitControls()

static LRESULT FILEDLG95_InitControls ( HWND  hwnd)
static

Definition at line 1532 of file filedlg.c.

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

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_LOOKIN_AddItem()

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

Definition at line 3890 of file filedlg.c.

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

Referenced by FILEDLG95_LOOKIN_Init(), and FILEDLG95_LOOKIN_InsertItemAfterParent().

◆ FILEDLG95_LOOKIN_Clean()

static void FILEDLG95_LOOKIN_Clean ( HWND  hwnd)
static

Definition at line 4093 of file filedlg.c.

4094 {
4096  LookInInfos *liInfos = GetPropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4097  int iPos, iCount;
4098 
4099  iCount = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCOUNT, 0, 0);
4100 
4101  TRACE("\n");
4102 
4103  /* Delete each string of the combo and their associated data */
4104  if (iCount != CB_ERR)
4105  {
4106  for(iPos = iCount-1;iPos>=0;iPos--)
4107  {
4108  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,iPos);
4109  ILFree(tmpFolder->pidlItem);
4110  heap_free(tmpFolder);
4111  SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_DELETESTRING, iPos, 0);
4112  }
4113  }
4114 
4115  /* LookInInfos structure */
4116  heap_free(liInfos);
4117  RemovePropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4118 }
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
struct FileOpenDlgInfos::@340 DlgInfos
static const char LookInInfosStr[]
Definition: filedlg.c:143
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
#define CB_DELETESTRING
Definition: winuser.h:1919
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:155
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
struct SFolder * LPSFOLDER

Referenced by FILEDLG95_Clean().

◆ FILEDLG95_LOOKIN_DrawItem()

static LRESULT FILEDLG95_LOOKIN_DrawItem ( LPDRAWITEMSTRUCT  pDIStruct)
static

Definition at line 3754 of file filedlg.c.

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

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_LOOKIN_Init()

static void FILEDLG95_LOOKIN_Init ( HWND  hwndCombo)
static

Definition at line 3669 of file filedlg.c.

3670 {
3671  IShellFolder *psfRoot, *psfDrives;
3672  IEnumIDList *lpeRoot, *lpeDrives;
3673  LPITEMIDLIST pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
3674  HDC hdc;
3675  TEXTMETRICW tm;
3676  LookInInfos *liInfos = heap_alloc_zero(sizeof(*liInfos));
3677 
3678  TRACE("%p\n", hwndCombo);
3679 
3680  liInfos->iMaxIndentation = 0;
3681 
3682  SetPropA(hwndCombo, LookInInfosStr, liInfos);
3683 
3684  hdc = GetDC( hwndCombo );
3685  SelectObject( hdc, (HFONT)SendMessageW( hwndCombo, WM_GETFONT, 0, 0 ));
3686  GetTextMetricsW( hdc, &tm );
3687  ReleaseDC( hwndCombo, hdc );
3688 
3689  /* set item height for both text field and listbox */
3690  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, -1, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3691  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, 0, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3692 
3693  /* Turn on the extended UI for the combo box like Windows does */
3694  SendMessageW(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
3695 
3696  /* Initialise data of Desktop folder */
3698  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3699  ILFree(pidlTmp);
3700 
3702 
3703  SHGetDesktopFolder(&psfRoot);
3704 
3705  if (psfRoot)
3706  {
3707  /* enumerate the contents of the desktop */
3708  if(SUCCEEDED(IShellFolder_EnumObjects(psfRoot, hwndCombo, SHCONTF_FOLDERS, &lpeRoot)))
3709  {
3710  while (S_OK == IEnumIDList_Next(lpeRoot, 1, &pidlTmp, NULL))
3711  {
3712  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3713 
3714  /* If the unixfs extension is rooted, we don't expand the drives by default */
3716  {
3717  /* special handling for CSIDL_DRIVES */
3718  if (ILIsEqual(pidlTmp, pidlDrives))
3719  {
3720  if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
3721  {
3722  /* enumerate the drives */
3723  if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives)))
3724  {
3725  while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
3726  {
3727  pidlAbsTmp = ILCombine(pidlTmp, pidlTmp1);
3728  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
3729  ILFree(pidlAbsTmp);
3730  ILFree(pidlTmp1);
3731  }
3732  IEnumIDList_Release(lpeDrives);
3733  }
3734  IShellFolder_Release(psfDrives);
3735  }
3736  }
3737  }
3738 
3739  ILFree(pidlTmp);
3740  }
3741  IEnumIDList_Release(lpeRoot);
3742  }
3743  IShellFolder_Release(psfRoot);
3744  }
3745 
3746  ILFree(pidlDrives);
3747 }
#define max(a, b)
Definition: svc.c:63
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
static const char LookInInfosStr[]
Definition: filedlg.c:143
#define LISTEND
Definition: filedlg.c:118
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
#define CSIDL_DESKTOP
Definition: shlobj.h:2012
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
#define SM_CYSMICON
Definition: winuser.h:1003
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
int iMaxIndentation
Definition: filedlg.c:105
#define CB_SETITEMHEIGHT
Definition: winuser.h:1949
#define CSIDL_DRIVES
Definition: shlobj.h:2028
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:3652
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2830
int WINAPI GetSystemMetrics(_In_ int)
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:3890
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 3961 of file filedlg.c.

3962 {
3963 
3964  LPITEMIDLIST pidlParent = GetParentPidl(pidl);
3965  int iParentPos;
3966 
3967  TRACE("\n");
3968 
3969  if (pidl == pidlParent)
3970  return -1;
3971 
3972  iParentPos = FILEDLG95_LOOKIN_SearchItem(hwnd,(WPARAM)pidlParent,SEARCH_PIDL);
3973 
3974  if(iParentPos < 0)
3975  {
3976  iParentPos = FILEDLG95_LOOKIN_InsertItemAfterParent(hwnd,pidlParent);
3977  }
3978 
3979  ILFree(pidlParent);
3980 
3981  return FILEDLG95_LOOKIN_AddItem(hwnd,pidl,iParentPos + 1);
3982 }
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:4063
UINT_PTR WPARAM
Definition: windef.h:207
#define SEARCH_PIDL
Definition: filedlg.c:121
LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl)
Definition: filedlg.c:4425
#define TRACE(s)
Definition: solgame.cpp:4
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:3890
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:3961
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 3847 of file filedlg.c.

3848 {
3850 
3851  TRACE("%p\n", fodInfos);
3852 
3853  switch(wNotifyCode)
3854  {
3855  case CBN_SELENDOK:
3856  {
3857  LPSFOLDER tmpFolder;
3858  int iItem;
3859 
3860  iItem = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCURSEL, 0, 0);
3861 
3862  if( iItem == CB_ERR) return FALSE;
3863 
3864  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,
3865  iItem)))
3866  return FALSE;
3867 
3868 
3869  if(SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
3870  tmpFolder->pidlItem,
3871  SBSP_ABSOLUTE)))
3872  {
3873  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3875  return TRUE;
3876  }
3877  break;
3878  }
3879 
3880  }
3881  return FALSE;
3882 }
#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
struct FileOpenDlgInfos::@340 DlgInfos
#define TRUE
Definition: types.h:120
#define CB_GETCURSEL
Definition: winuser.h:1925
#define FALSE
Definition: types.h:117
#define CBN_SELENDOK
Definition: winuser.h:1963
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define CB_ERR
Definition: winuser.h:2410
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:996
struct FileOpenDlgInfos::@338 Shell
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:155

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_LOOKIN_RemoveMostExpandedItem()

static int FILEDLG95_LOOKIN_RemoveMostExpandedItem ( HWND  hwnd)
static

Definition at line 4033 of file filedlg.c.

4034 {
4035  int iItemPos;
4037 
4038  TRACE("\n");
4039 
4040  if(liInfos->iMaxIndentation <= 2)
4041  return -1;
4042 
4043  if((iItemPos = FILEDLG95_LOOKIN_SearchItem(hwnd,liInfos->iMaxIndentation,SEARCH_EXP)) >=0)
4044  {
4045  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4046  ILFree(tmpFolder->pidlItem);
4047  heap_free(tmpFolder);
4048  SendMessageW(hwnd, CB_DELETESTRING, iItemPos, 0);
4049  liInfos->iMaxIndentation--;
4050 
4051  return iItemPos;
4052  }
4053 
4054  return -1;
4055 }
#define SEARCH_EXP
Definition: filedlg.c:122
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static const char LookInInfosStr[]
Definition: filedlg.c:143
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4063
int iMaxIndentation
Definition: filedlg.c:105
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_DELETESTRING
Definition: winuser.h:1919
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
struct SFolder * LPSFOLDER

Referenced by FILEDLG95_LOOKIN_SelectItem().

◆ FILEDLG95_LOOKIN_SearchItem()

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

Definition at line 4063 of file filedlg.c.

4064 {
4065  int i = 0;
4066  int iCount;
4067 
4068  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
4069 
4070  TRACE("0x%08lx 0x%x\n",searchArg, iSearchMethod);
4071 
4072  if (iCount != CB_ERR)
4073  {
4074  for(;i<iCount;i++)
4075  {
4076  LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i);
4077 
4078  if (iSearchMethod == SEARCH_PIDL && ILIsEqual((LPITEMIDLIST)searchArg, tmpFolder->pidlItem))
4079  return i;
4080  if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg)
4081  return i;
4082  }
4083  }
4084 
4085  return -1;
4086 }
#define SEARCH_EXP
Definition: filedlg.c:122
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SEARCH_PIDL
Definition: filedlg.c:121
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define CB_ERR
Definition: winuser.h:2410
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:98
LPITEMIDLIST pidlItem
Definition: filedlg.c:99
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1924
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
struct SFolder * LPSFOLDER

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

◆ FILEDLG95_LOOKIN_SelectItem()

int FILEDLG95_LOOKIN_SelectItem ( HWND  hwnd,
LPITEMIDLIST  pidl 
)

Definition at line 3990 of file filedlg.c.

3991 {
3992  int iItemPos;
3993  LookInInfos *liInfos;
3994 
3995  TRACE("%p, %p\n", hwnd, pidl);
3996 
3998 
3999  liInfos = GetPropA(hwnd,LookInInfosStr);
4000 
4001  if(iItemPos < 0)
4002  {
4005  }
4006 
4007  else
4008  {
4009  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4010  while(liInfos->iMaxIndentation > tmpFolder->m_iIndent)
4011  {
4012  int iRemovedItem;
4013 
4014  if(-1 == (iRemovedItem = FILEDLG95_LOOKIN_RemoveMostExpandedItem(hwnd)))
4015  break;
4016  if(iRemovedItem < iItemPos)
4017  iItemPos--;
4018  }
4019  }
4020 
4021  SendMessageW(hwnd, CB_SETCURSEL, iItemPos, 0);
4022  liInfos->uSelectedItem = iItemPos;
4023 
4024  return 0;
4025 
4026 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const char LookInInfosStr[]
Definition: filedlg.c:143
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4063
UINT_PTR WPARAM
Definition: windef.h:207
int iMaxIndentation
Definition: filedlg.c:105
#define SEARCH_PIDL
Definition: filedlg.c:121
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:140
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:98
#define CB_SETCURSEL
Definition: winuser.h:1943
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static int FILEDLG95_LOOKIN_RemoveMostExpandedItem(HWND hwnd)
Definition: filedlg.c:4033
UINT uSelectedItem
Definition: filedlg.c:106
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:3961
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 2314 of file filedlg.c.

2315 {
2316  WCHAR mru_list[32], *cur_mru_slot;
2317  BOOL taken[25] = {0};
2318  DWORD mru_list_size = sizeof(mru_list), key_type = -1, i;
2319  HKEY hkey_tmp, *hkey;
2320  LONG ret;
2321 
2322  if(hkey_ret)
2323  hkey = hkey_ret;
2324  else
2325  hkey = &hkey_tmp;
2326 
2327  if(stored_path)
2328  *stored_path = '\0';
2329 
2331  if(ret){
2332  WARN("Unable to create MRU key: %d\n", ret);
2333  return 0;
2334  }
2335 
2336  ret = RegGetValueW(*hkey, NULL, MRUListW, RRF_RT_REG_SZ, &key_type,
2337  (LPBYTE)mru_list, &mru_list_size);
2338  if(ret || key_type != REG_SZ){
2339  if(ret == ERROR_FILE_NOT_FOUND)
2340  return 'a';
2341 
2342  WARN("Error getting MRUList data: type: %d, ret: %d\n", key_type, ret);
2343  RegCloseKey(*hkey);
2344  return 0;
2345  }
2346 
2347  for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot){
2348  WCHAR value_data[MAX_PATH], value_name[2] = {0};
2349  DWORD value_data_size = sizeof(value_data);
2350 
2351  *value_name = *cur_mru_slot;
2352 
2353  ret = RegGetValueW(*hkey, NULL, value_name, RRF_RT_REG_BINARY,
2354  &key_type, (LPBYTE)value_data, &value_data_size);
2355  if(ret || key_type != REG_BINARY){
2356  WARN("Error getting MRU slot data: type: %d, ret: %d\n", key_type, ret);
2357  continue;
2358  }
2359 
2360  if(!wcsicmp(module_name, value_data)){
2361  if(!hkey_ret)
2362  RegCloseKey(*hkey);
2363  if(stored_path)
2364  lstrcpyW(stored_path, value_data + lstrlenW(value_data) + 1);
2365  return *value_name;
2366  }
2367  }
2368 
2369  if(!hkey_ret)
2370  RegCloseKey(*hkey);
2371 
2372  /* the module name isn't in the registry, so find the next open slot */
2373  for(cur_mru_slot = mru_list; *cur_mru_slot; ++cur_mru_slot)
2374  taken[*cur_mru_slot - 'a'] = TRUE;
2375  for(i = 0; i < 25; ++i){
2376  if(!taken[i])
2377  return i + 'a';
2378  }
2379 
2380  /* all slots are taken, so return the last one in MRUList */
2381  --cur_mru_slot;
2382  return *cur_mru_slot;
2383 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
#define REG_BINARY
Definition: nt_native.h:1496
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define WARN(fmt,...)
Definition: debug.h:112
#define RRF_RT_REG_SZ
Definition: driver.c:575
#define lstrlenW
Definition: compat.h:498
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:53
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:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define wcsicmp
Definition: compat.h:15
int ret
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
static const WCHAR MRUListW[]
Definition: filedlg.c:151
#define lstrcpyW
Definition: compat.h:497
static const WCHAR LastVisitedMRUW[]
Definition: filedlg.c:146
#define RRF_RT_REG_BINARY
Definition: driver.c:577
#define REG_SZ
Definition: layer.c:22

Referenced by FILEDLG95_MRU_load_filename(), and FILEDLG95_MRU_save_filename().

◆ FILEDLG95_MRU_load_filename()

static void FILEDLG95_MRU_load_filename ( LPWSTR  stored_path)
static

Definition at line 2476 of file filedlg.c.

2477 {
2478  WCHAR module_path[MAX_PATH], *module_name;
2479 
2480  /* get the current executable's name */
2481  if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2482  {
2483  WARN("GotModuleFileName failed: %d\n", GetLastError());
2484  return;
2485  }
2486  module_name = wcsrchr(module_path, '\\');
2487  if(!module_name)
2488  module_name = module_path;
2489  else
2490  module_name += 1;
2491 
2492  FILEDLG95_MRU_get_slot(module_name, stored_path, NULL);
2493  TRACE("got MRU path: %s\n", wine_dbgstr_w(stored_path));
2494 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define WARN(fmt,...)
Definition: debug.h:112
DWORD WINAPI GetLastError(VOID)
Definition: except.c: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:34
#define wcsrchr
Definition: compat.h:16
#define ARRAY_SIZE(a)
Definition: main.h:24
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHKEY hkey_ret)
Definition: filedlg.c:2314

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_MRU_save_filename()

static void FILEDLG95_MRU_save_filename ( LPCWSTR  filename)
static

Definition at line 2386 of file filedlg.c.

2387 {
2388  WCHAR module_path[MAX_PATH], *module_name, slot, slot_name[2] = {0};
2389  LONG ret;
2390  HKEY hkey;
2391 
2392  /* get the current executable's name */
2393  if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2394  {
2395  WARN("GotModuleFileName failed: %d\n", GetLastError());
2396  return;
2397  }
2398  module_name = wcsrchr(module_path, '\\');
2399  if(!module_name)
2400  module_name = module_path;
2401  else
2402  module_name += 1;
2403 
2405  if(!slot)
2406  return;
2407  *slot_name = slot;
2408 
2409  { /* update the slot's info */
2410  WCHAR *path_ends, *final;
2411  DWORD path_len, final_len;
2412 
2413  /* use only the path segment of `filename' */
2414  path_ends = wcsrchr(filename, '\\');
2415  path_len = path_ends - filename;
2416 
2417  final_len = path_len + lstrlenW(module_name) + 2;
2418 
2419  final = heap_alloc(final_len * sizeof(WCHAR));
2420  if(!final)
2421  return;
2422  lstrcpyW(final, module_name);
2423  memcpy(final + lstrlenW(final) + 1, filename, path_len * sizeof(WCHAR));
2424  final[final_len-1] = '\0';
2425 
2426  ret = RegSetValueExW(hkey, slot_name, 0, REG_BINARY, (LPBYTE)final,
2427  final_len * sizeof(WCHAR));
2428  if(ret){
2429  WARN("Error saving MRU data to slot %s: %d\n", wine_dbgstr_w(slot_name), ret);
2430  heap_free(final);
2431  RegCloseKey(hkey);
2432  return;
2433  }
2434 
2435  heap_free(final);
2436  }
2437 
2438  { /* update MRUList value */
2439  WCHAR old_mru_list[32], new_mru_list[32];
2440  WCHAR *old_mru_slot, *new_mru_slot = new_mru_list;
2441  DWORD mru_list_size = sizeof(old_mru_list), key_type;
2442 
2443  ret = RegGetValueW(hkey, NULL, MRUListW, RRF_RT_ANY, &key_type,
2444  (LPBYTE)old_mru_list, &mru_list_size);
2445  if(ret || key_type != REG_SZ){
2446  if(ret == ERROR_FILE_NOT_FOUND){
2447  new_mru_list[0] = slot;
2448  new_mru_list[1] = '\0';
2449  }else{
2450  WARN("Error getting MRUList data: type: %d, ret: %d\n", key_type, ret);
2451  RegCloseKey(hkey);
2452  return;
2453  }
2454  }else{
2455  /* copy old list data over so that the new slot is at the start
2456  * of the list */
2457  *new_mru_slot++ = slot;
2458  for(old_mru_slot = old_mru_list; *old_mru_slot; ++old_mru_slot){
2459  if(*old_mru_slot != slot)
2460  *new_mru_slot++ = *old_mru_slot;
2461  }
2462  *new_mru_slot = '\0';
2463  }
2464 
2465  ret = RegSetValueExW(hkey, MRUListW, 0, REG_SZ, (LPBYTE)new_mru_list,
2466  (lstrlenW(new_mru_list) + 1) * sizeof(WCHAR));
2467  if(ret){
2468  WARN("Error saving MRUList data: %d\n", ret);
2469  RegCloseKey(hkey);
2470  return;
2471  }
2472  }
2473 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
struct _slot slot
Definition: vfat.h:196
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
#define REG_BINARY
Definition: nt_native.h:1496
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define WARN(fmt,...)
Definition: debug.h:112
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:498
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
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:34
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define wcsrchr
Definition: compat.h:16
static const WCHAR MRUListW[]
Definition: filedlg.c:151
Definition: vfat.h:184
static DWORD path_len
Definition: batch.c:31
#define lstrcpyW
Definition: compat.h:497
#define ARRAY_SIZE(a)
Definition: main.h:24
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define RRF_RT_ANY
Definition: winreg.h:64
static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHKEY hkey_ret)
Definition: filedlg.c:2314
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 2853 of file filedlg.c.

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

2718 {
2719  WCHAR strMsgTitle[MAX_PATH];
2720  WCHAR strMsgText [MAX_PATH];
2721  if (idCaption)
2722  LoadStringW(COMDLG32_hInstance, idCaption, strMsgTitle, ARRAY_SIZE(strMsgTitle));
2723  else
2724  strMsgTitle[0] = '\0';
2725  LoadStringW(COMDLG32_hInstance, idText, strMsgText, ARRAY_SIZE(strMsgText));
2726  MessageBoxW(hwnd,strMsgText, strMsgTitle, MB_OK | MB_ICONHAND);
2727 }
#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:34