ReactOS  0.4.15-dev-3295-gaa8fc87
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 214 of file filedlg.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 54 of file filedlg.c.

◆ ITEM_NOTFOUND

#define ITEM_NOTFOUND   -1

Definition at line 197 of file filedlg.c.

◆ LISTEND

#define LISTEND   -1

Definition at line 192 of file filedlg.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 55 of file filedlg.c.

◆ SEARCH_EXP

#define SEARCH_EXP   2

Definition at line 196 of file filedlg.c.

◆ SEARCH_PIDL

#define SEARCH_PIDL   1

Definition at line 195 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE0

#define TBPLACES_CMDID_PLACE0   0xa064

Definition at line 202 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE1

#define TBPLACES_CMDID_PLACE1   0xa065

Definition at line 203 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE2

#define TBPLACES_CMDID_PLACE2   0xa066

Definition at line 204 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE3

#define TBPLACES_CMDID_PLACE3   0xa067

Definition at line 205 of file filedlg.c.

◆ TBPLACES_CMDID_PLACE4

#define TBPLACES_CMDID_PLACE4   0xa068

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

◆ WM_GETISHELLBROWSER

#define WM_GETISHELLBROWSER   WM_USER+7

Definition at line 200 of file filedlg.c.

◆ XTEXTOFFSET

#define XTEXTOFFSET   3

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

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

4587 {
4589  BOOL bBrowseSelFolder = FALSE;
4590 
4591  TRACE("\n");
4592 
4593  if (GetNumSelected(fodInfos->Shell.FOIDataObject) == 1)
4594  {
4595  LPITEMIDLIST pidlSelection;
4596 
4597  /* get the file selected */
4598  pidlSelection = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, 1);
4599  if (IsPidlFolder (fodInfos->Shell.FOIShellFolder, pidlSelection))
4600  {
4601  if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser,
4602  pidlSelection, SBSP_RELATIVE ) ) )
4603  {
4604  WCHAR buf[64];
4606  MessageBoxW( hwnd, buf, fodInfos->title, MB_OK | MB_ICONEXCLAMATION );
4607  }
4608  bBrowseSelFolder = TRUE;
4609  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
4611  }
4612  ILFree( pidlSelection );
4613  }
4614 
4615  return bBrowseSelFolder;
4616 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define TRUE
Definition: types.h:120
struct FileOpenDlgInfos::@327 Shell
LPITEMIDLIST GetPidlFromDataObject(IDataObject *doSelected, UINT nPidlIndex)
Definition: filedlg.c:4402
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#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:1070
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MB_OK
Definition: winuser.h:784
static UINT GetNumSelected(IDataObject *doSelected)
Definition: filedlg.c:4433
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4569
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:229

Referenced by FILEDLG95_OnOpen().

◆ COMCTL32_ReleaseStgMedium()

static void COMCTL32_ReleaseStgMedium ( STGMEDIUM  medium)
static

Definition at line 4382 of file filedlg.c.

4383 {
4384  if(medium.pUnkForRelease)
4385  {
4386  IUnknown_Release(medium.pUnkForRelease);
4387  }
4388  else
4389  {
4390  GlobalUnlock(medium.u.hGlobal);
4391  GlobalFree(medium.u.hGlobal);
4392  }
4393 }
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 736 of file filedlg.c.

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

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

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

◆ COMDLG32_SplitFileNames()

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

Definition at line 776 of file filedlg.c.

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

Referenced by FILEDLG95_FILENAME_GetFileNames(), and on_default_action().

◆ COMDLG32_StrRetToStrNW()

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

Definition at line 4320 of file filedlg.c.

4321 {
4322  switch (src->uType)
4323  {
4324  case STRRET_WSTR:
4325  lstrcpynW(dest, src->u.pOleStr, len);
4326  CoTaskMemFree(src->u.pOleStr);
4327  break;
4328 
4329  case STRRET_CSTR:
4330  if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len)
4331  dest[len-1] = 0;
4332  break;
4333 
4334  case STRRET_OFFSET:
4335  if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1, dest, len ) && len)
4336  dest[len-1] = 0;
4337  break;
4338 
4339  default:
4340  FIXME("unknown type %x!\n", src->uType);
4341  if (len) *dest = '\0';
4342  return E_FAIL;
4343  }
4344  return S_OK;
4345 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define CP_ACP
Definition: compat.h:109
#define E_FAIL
Definition: ddrawi.h:102
#define lstrcpynW
Definition: compat.h:597
#define FIXME(fmt,...)
Definition: debug.h:111
const char * LPCSTR
Definition: xmlstorage.h:183
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:52
#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 978 of file filedlg.c.

979 {
980  LPCVOID template;
981  HRSRC hRes;
982  HANDLE hDlgTmpl = 0;
983  HWND hChildDlg = 0;
984 
985  TRACE("%p, %p\n", fodInfos, hwnd);
986 
987  /*
988  * If OFN_ENABLETEMPLATEHANDLE is specified, the OPENFILENAME
989  * structure's hInstance parameter is not a HINSTANCE, but
990  * instead a pointer to a template resource to use.
991  */
993  {
995  if (fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE)
996  {
998  if( !(template = LockResource( fodInfos->ofnInfos->hInstance)))
999  {
1001  return NULL;
1002  }
1003  }
1004  else
1005  {
1006  hinst = fodInfos->ofnInfos->hInstance;
1007  if(fodInfos->unicode)
1008  {
1009  LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
1011  }
1012  else
1013  {
1016  }
1017  if (!hRes)
1018  {
1020  return NULL;
1021  }
1022  if (!(hDlgTmpl = LoadResource( hinst, hRes )) ||
1023  !(template = LockResource( hDlgTmpl )))
1024  {
1026  return NULL;
1027  }
1028  }
1029  if (fodInfos->unicode)
1030  hChildDlg = CreateDialogIndirectParamW(hinst, template, hwnd,
1032  (LPARAM)fodInfos->ofnInfos);
1033  else
1034  hChildDlg = CreateDialogIndirectParamA(hinst, template, hwnd,
1036  (LPARAM)fodInfos->ofnInfos);
1037  return hChildDlg;
1038  }
1039  else if (is_dialog_hooked(fodInfos))
1040  {
1041  RECT rectHwnd;
1042  struct {
1043  DLGTEMPLATE tmplate;
1044  WORD menu,class,title;
1045  } temp;
1046  GetClientRect(hwnd,&rectHwnd);
1047  temp.tmplate.style = WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | DS_CONTROL | DS_3DLOOK;
1048  temp.tmplate.dwExtendedStyle = 0;
1049  temp.tmplate.cdit = 0;
1050  temp.tmplate.x = 0;
1051  temp.tmplate.y = 0;
1052  temp.tmplate.cx = 0;
1053  temp.tmplate.cy = 0;
1054  temp.menu = temp.class = temp.title = 0;
1055 
1056  hChildDlg = CreateDialogIndirectParamA(COMDLG32_hInstance, &temp.tmplate,
1057  hwnd, (DLGPROC)fodInfos->ofnInfos->lpfnHook, (LPARAM)fodInfos->ofnInfos);
1058 
1059  return hChildDlg;
1060  }
1061  return NULL;
1062 }
#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:234
#define WS_CHILD
Definition: pedump.c:617
LPCSTR lpTemplateName
Definition: commdlg.h:348
char * LPSTR
Definition: xmlstorage.h:182
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
#define CDERR_FINDRESFAILURE
Definition: cderr.h:11
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
LONG_PTR LPARAM
Definition: windef.h:208
#define RT_DIALOG
Definition: pedump.c:367
static INT_PTR CALLBACK FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg.c:969
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:2872
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define DS_3DLOOK
Definition: winuser.h:367
static calc_node_t temp
Definition: rpn_ieee.c:38
#define DS_CONTROL
Definition: winuser.h:372
#define OFN_ENABLETEMPLATEHANDLE
Definition: commdlg.h:103
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN
Definition: cdlg32.c:128
#define NULL
Definition: types.h:112
CONST void * LPCVOID
Definition: windef.h:191
static HINSTANCE hinst
Definition: edit.c:551
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define WS_VISIBLE
Definition: pedump.c:620
static char title[]
Definition: ps.c:92
struct tagOFNA * LPOPENFILENAMEA

Referenced by FileOpenDlgProc95().

◆ filedialog_is_readonly_hidden()

static BOOL filedialog_is_readonly_hidden ( const FileOpenDlgInfos info)
static

Definition at line 239 of file filedlg.c.

240 {
241  return (info->ofnInfos->Flags & OFN_HIDEREADONLY) || (info->DlgInfos.dwDlgProp & FODPROP_SAVEDLG);
242 }
#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 2140 of file filedlg.c.

2141 {
2145 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void FILEDLG95_LOOKIN_Clean(HWND hwnd)
Definition: filedlg.c:4193
static void FILEDLG95_FILETYPE_Clean(HWND hwnd)
Definition: filedlg.c:3720
static void FILEDLG95_SHELL_Clean(HWND hwnd)
Definition: filedlg.c:3509

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

◆ FILEDLG95_FILENAME_FillFromSelection()

void FILEDLG95_FILENAME_FillFromSelection ( HWND  hwnd)

Definition at line 4244 of file filedlg.c.

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

4353 {
4355  UINT nFileCount = 0; /* number of files */
4356  UINT nStrLen = 0; /* length of string in edit control */
4357  LPWSTR lpstrEdit; /* buffer for string from edit control */
4358 
4359  TRACE("\n");
4360 
4361  /* get the filenames from the filename control */
4362  nStrLen = GetWindowTextLengthW( fodInfos->DlgInfos.hwndFileName );
4363  lpstrEdit = heap_alloc( (nStrLen+1)*sizeof(WCHAR) );
4364  GetWindowTextW( fodInfos->DlgInfos.hwndFileName, lpstrEdit, nStrLen+1);
4365 
4366  TRACE("nStrLen=%u str=%s\n", nStrLen, debugstr_w(lpstrEdit));
4367 
4368  nFileCount = COMDLG32_SplitFileNames(lpstrEdit, nStrLen, lpstrFileList, sizeUsed);
4369  heap_free(lpstrEdit);
4370  return nFileCount;
4371 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
struct FileOpenDlgInfos::@329 DlgInfos
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetWindowTextLengthW(_In_ HWND)
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed)
Definition: filedlg.c:776
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:229
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 3720 of file filedlg.c.

3721 {
3723  int iPos;
3724  int iCount;
3725 
3726  iCount = SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_GETCOUNT, 0, 0);
3727 
3728  TRACE("\n");
3729 
3730  /* Delete each string of the combo and their associated data */
3731  if(iCount != CB_ERR)
3732  {
3733  for(iPos = iCount-1;iPos>=0;iPos--)
3734  {
3735  heap_free((void *)CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iPos));
3736  SendMessageW(fodInfos->DlgInfos.hwndFileTypeCB, CB_DELETESTRING, iPos, 0);
3737  }
3738  }
3739  /* Current filter */
3740  heap_free(fodInfos->ShellInfos.lpstrCurrentFilter);
3741 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:214
#define CB_ERR
Definition: winuser.h:2411
#define TRACE(s)
Definition: solgame.cpp:4
struct FileOpenDlgInfos::@329 DlgInfos
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct FileOpenDlgInfos::@328 ShellInfos
#define CB_GETCOUNT
Definition: winuser.h:1925
#define CB_DELETESTRING
Definition: winuser.h:1920
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:229
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 3535 of file filedlg.c.

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

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_FILETYPE_OnCommand()

static BOOL FILEDLG95_FILETYPE_OnCommand ( HWND  hwnd,
WORD  wNotifyCode 
)
static

Definition at line 3651 of file filedlg.c.

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

3697 {
3698  int i, iCount;
3699 
3700  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
3701 
3702  TRACE("%s\n", debugstr_w(lpstrExt));
3703 
3704  if(iCount != CB_ERR)
3705  {
3706  for(i=0;i<iCount;i++)
3707  {
3708  if(!lstrcmpiW(lpstrExt,(LPWSTR)CBGetItemDataPtr(hwnd,i)))
3709  return i;
3710  }
3711  }
3712  return -1;
3713 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define debugstr_w
Definition: kernel32.h:32
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:214
#define CB_ERR
Definition: winuser.h:2411
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1925
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 2103 of file filedlg.c.

2104 {
2105  LPITEMIDLIST pidlItemId = NULL;
2106 
2107  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
2108 
2109  TRACE("dir=%s file=%s\n",
2110  debugstr_w(fodInfos->initdir), debugstr_w(fodInfos->filename));
2111 
2112  /* Get the initial directory pidl */
2113 
2114  if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->initdir)))
2115  {
2116  WCHAR path[MAX_PATH];
2117 
2119  pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder, path);
2120  }
2121 
2122  /* Initialise shell objects */
2124 
2125  /* Initialize the Look In combo box */
2126  FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB);
2127 
2128  /* Browse to the initial directory */
2129  IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId, SBSP_ABSOLUTE);
2130 
2131  ILFree(pidlItemId);
2132 
2133  return TRUE;
2134 }
static void FILEDLG95_LOOKIN_Init(HWND hwndCombo)
Definition: filedlg.c:3769
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define TRUE
Definition: types.h:120
struct FileOpenDlgInfos::@327 Shell
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
static LRESULT FILEDLG95_SHELL_Init(HWND hwnd)
Definition: filedlg.c:3422
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
struct FileOpenDlgInfos::@329 DlgInfos
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
static LPITEMIDLIST GetPidlFromName(IShellFolder *psf, LPWSTR lpcstrFileName)
Definition: filedlg.c:4543
#define NULL
Definition: types.h:112
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 1099 of file filedlg.c.

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

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

Referenced by FileOpenDlgProc95().

◆ FILEDLG95_InitControls()

static LRESULT FILEDLG95_InitControls ( HWND  hwnd)
static

Definition at line 1629 of file filedlg.c.

1630 {
1631  BOOL win2000plus = FALSE;
1632  BOOL win98plus = FALSE;
1633  BOOL handledPath = FALSE;
1634  OSVERSIONINFOW osVi;
1635  static const WCHAR szwSlash[] = { '\\', 0 };
1636  static const WCHAR szwStar[] = { '*',0 };
1637 
1638  static const TBBUTTON tbb[] =
1639  {
1640  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1642  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1644  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1646  {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0 },
1649  };
1650  static const TBADDBITMAP tba = {HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR};
1651 
1652  RECT rectTB;
1653  RECT rectlook;
1654 
1655  HIMAGELIST toolbarImageList;
1656  ITEMIDLIST *desktopPidl;
1658 
1660 
1661  TRACE("%p\n", fodInfos);
1662 
1663  /* Get windows version emulating */
1664  osVi.dwOSVersionInfoSize = sizeof(osVi);
1665  GetVersionExW(&osVi);
1667  win98plus = ((osVi.dwMajorVersion > 4) || ((osVi.dwMajorVersion == 4) && (osVi.dwMinorVersion > 0)));
1668  } else if (osVi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
1669  win2000plus = (osVi.dwMajorVersion > 4);
1670  if (win2000plus) win98plus = TRUE;
1671  }
1672  TRACE("Running on 2000+ %d, 98+ %d\n", win2000plus, win98plus);
1673 
1674 
1675  /* Use either the edit or the comboboxex for the filename control */
1676  if (filename_is_edit( fodInfos ))
1677  {
1679  fodInfos->DlgInfos.hwndFileName = GetDlgItem( hwnd, edt1 );
1680  }
1681  else
1682  {
1684  fodInfos->DlgInfos.hwndFileName = GetDlgItem( hwnd, cmb13 );
1685  }
1686 
1687  /* Get the hwnd of the controls */
1688  fodInfos->DlgInfos.hwndFileTypeCB = GetDlgItem(hwnd,IDC_FILETYPE);
1689  fodInfos->DlgInfos.hwndLookInCB = GetDlgItem(hwnd,IDC_LOOKIN);
1690 
1691  GetWindowRect( fodInfos->DlgInfos.hwndLookInCB,&rectlook);
1692  MapWindowPoints( 0, hwnd,(LPPOINT)&rectlook,2);
1693 
1694  /* construct the toolbar */
1696  MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2);
1697 
1698  rectTB.right = rectlook.right + rectTB.right - rectTB.left;
1699  rectTB.bottom = rectlook.top - 1 + rectTB.bottom - rectTB.top;
1700  rectTB.left = rectlook.right;
1701  rectTB.top = rectlook.top-1;
1702 
1703  if (fodInfos->unicode)
1704  fodInfos->DlgInfos.hwndTB = CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL,
1706  rectTB.left, rectTB.top,
1707  rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
1709  else
1710  fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL,
1712  rectTB.left, rectTB.top,
1713  rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
1715 
1716  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
1717 
1718 /* FIXME: use TB_LOADIMAGES when implemented */
1719 /* SendMessageW(fodInfos->DlgInfos.hwndTB, TB_LOADIMAGES, IDB_VIEW_SMALL_COLOR, HINST_COMMCTRL);*/
1720  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_SETMAXTEXTROWS, 0, 0);
1721  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, 12, (LPARAM) &tba);
1722 
1723  /* Retrieve and add desktop icon to the toolbar */
1724  toolbarImageList = (HIMAGELIST)SendMessageW(fodInfos->DlgInfos.hwndTB, TB_GETIMAGELIST, 0, 0L);
1726  SHGetFileInfoW((const WCHAR *)desktopPidl, 0, &fileinfo, sizeof(fileinfo),
1728  ImageList_AddIcon(toolbarImageList, fileinfo.hIcon);
1729 
1730  DestroyIcon(fileinfo.hIcon);
1731  CoTaskMemFree(desktopPidl);
1732 
1733  /* Finish Toolbar Construction */
1734  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSW, 9, (LPARAM) tbb);
1735  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
1736 
1737  if (is_places_bar_enabled(fodInfos))
1738  {
1739  TBBUTTON tb = { 0 };
1740  HIMAGELIST himl;
1741  RECT rect;
1742  int i, cx;
1743 
1746  cx = rect.right - rect.left;
1747 
1750 
1751  filedlg_collect_places_pidls(fodInfos);
1752  for (i = 0; i < ARRAY_SIZE(fodInfos->places); i++)
1753  {
1754  int index;
1755 
1756  if (!fodInfos->places[i])
1757  continue;
1758 
1759  memset(&fileinfo, 0, sizeof(fileinfo));
1760  SHGetFileInfoW((const WCHAR *)fodInfos->places[i], 0, &fileinfo, sizeof(fileinfo),
1763 
1764  tb.iBitmap = index;
1765  tb.iString = (INT_PTR)fileinfo.szDisplayName;
1766  tb.fsState = TBSTATE_ENABLED | TBSTATE_WRAP;
1767  tb.idCommand = TBPLACES_CMDID_PLACE0 + i;
1769 
1770  DestroyIcon(fileinfo.hIcon);
1771  }
1772 
1775  }
1776 
1777  /* Set the window text with the text specified in the OPENFILENAME structure */
1778  if(fodInfos->title)
1779  {
1780  SetWindowTextW(hwnd,fodInfos->title);
1781  }
1782  else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
1783  {
1784  WCHAR buf[64];
1787  }
1788 
1789  /* Initialise the file name edit control */
1790  handledPath = FALSE;
1791  TRACE("Before manipulation, file = %s, dir = %s\n", debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1792 
1793  if(fodInfos->filename)
1794  {
1795  /* 1. If win2000 or higher and filename contains a path, use it
1796  in preference over the lpstrInitialDir */
1797  if (win2000plus && *fodInfos->filename && wcspbrk(fodInfos->filename, szwSlash)) {
1798  WCHAR tmpBuf[MAX_PATH];
1799  WCHAR *nameBit;
1800  DWORD result;
1801 
1802  result = GetFullPathNameW(fodInfos->filename, MAX_PATH, tmpBuf, &nameBit);
1803  if (result) {
1804 
1805  /* nameBit is always shorter than the original filename. It may be NULL
1806  * when the filename contains only a drive name instead of file name */
1807  if (nameBit)
1808  {
1809  lstrcpyW(fodInfos->filename,nameBit);
1810  *nameBit = 0x00;
1811  }
1812  else
1813  *fodInfos->filename = '\0';
1814 
1815  heap_free(fodInfos->initdir);
1816  fodInfos->initdir = heap_alloc((lstrlenW(tmpBuf) + 1)*sizeof(WCHAR));
1817  lstrcpyW(fodInfos->initdir, tmpBuf);
1818  handledPath = TRUE;
1819  TRACE("Value in Filename includes path, overriding InitialDir: %s, %s\n",
1820  debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1821  }
1822  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1823 
1824  } else {
1825  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1826  }
1827  }
1828 
1829  /* 2. (All platforms) If initdir is not null, then use it */
1830  if (!handledPath && fodInfos->initdir && *fodInfos->initdir)
1831  {
1832  /* Work out the proper path as supplied one might be relative */
1833  /* (Here because supplying '.' as dir browses to My Computer) */
1834  WCHAR tmpBuf[MAX_PATH];
1835  WCHAR tmpBuf2[MAX_PATH];
1836  WCHAR *nameBit;
1837  DWORD result;
1838 
1839  lstrcpyW(tmpBuf, fodInfos->initdir);
1840  if (PathFileExistsW(tmpBuf)) {
1841  /* initdir does not have to be a directory. If a file is
1842  * specified, the dir part is taken */
1843  if (PathIsDirectoryW(tmpBuf)) {
1844  PathAddBackslashW(tmpBuf);
1845  lstrcatW(tmpBuf, szwStar);
1846  }
1847  result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit);
1848  if (result) {
1849  *nameBit = 0x00;
1850  heap_free(fodInfos->initdir);
1851  fodInfos->initdir = heap_alloc((lstrlenW(tmpBuf2) + 1) * sizeof(WCHAR));
1852  lstrcpyW(fodInfos->initdir, tmpBuf2);
1853  handledPath = TRUE;
1854  TRACE("Value in InitDir changed to %s\n", debugstr_w(fodInfos->initdir));
1855  }
1856  }
1857  else if (fodInfos->initdir)
1858  {
1859  heap_free(fodInfos->initdir);
1860  fodInfos->initdir = NULL;
1861  TRACE("Value in InitDir is not an existing path, changed to (nil)\n");
1862  }
1863  }
1864 
1865 #ifdef __REACTOS__
1866  if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir))
1867  {
1868  /* 2.5. Win2000+: Recently used defext */
1869  if (win2000plus) {
1870  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1871  fodInfos->initdir[0] = '\0';
1872 
1873  FILEDLG95_MRU_load_ext(fodInfos->initdir, MAX_PATH, fodInfos->defext);
1874 
1875  if (fodInfos->initdir[0] && PathIsDirectoryW(fodInfos->initdir)) {
1876  handledPath = TRUE;
1877  } else {
1878  heap_free(fodInfos->initdir);
1879  fodInfos->initdir = NULL;
1880  }
1881  }
1882  }
1883 #endif
1884 
1885  if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir))
1886  {
1887  /* 3. All except w2k+: if filename contains a path use it */
1888  if (!win2000plus && fodInfos->filename &&
1889  *fodInfos->filename &&
1890  wcspbrk(fodInfos->filename, szwSlash)) {
1891  WCHAR tmpBuf[MAX_PATH];
1892  WCHAR *nameBit;
1893  DWORD result;
1894 
1896  tmpBuf, &nameBit);
1897  if (result) {
1898  int len;
1899 
1900  /* nameBit is always shorter than the original filename */
1901  lstrcpyW(fodInfos->filename, nameBit);
1902  *nameBit = 0x00;
1903 
1904  len = lstrlenW(tmpBuf);
1905  heap_free(fodInfos->initdir);
1906  fodInfos->initdir = heap_alloc((len+1)*sizeof(WCHAR));
1907  lstrcpyW(fodInfos->initdir, tmpBuf);
1908 
1909  handledPath = TRUE;
1910  TRACE("Value in Filename includes path, overriding initdir: %s, %s\n",
1911  debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1912  }
1913  SetWindowTextW( fodInfos->DlgInfos.hwndFileName, fodInfos->filename );
1914  }
1915 
1916  /* 4. Win2000+: Recently used */
1917  if (!handledPath && win2000plus) {
1918  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1919  fodInfos->initdir[0] = '\0';
1920 
1922 
1923  if (fodInfos->initdir[0] && PathFileExistsW(fodInfos->initdir)){
1924  handledPath = TRUE;
1925  }else{
1926  heap_free(fodInfos->initdir);
1927  fodInfos->initdir = NULL;
1928  }
1929  }
1930 
1931  /* 5. win98+ and win2000+ if any files of specified filter types in
1932  current directory, use it */
1933  if (win98plus && !handledPath && fodInfos->filter && *fodInfos->filter) {
1934 
1935  LPCWSTR lpstrPos = fodInfos->filter;
1936  WIN32_FIND_DATAW FindFileData;
1937  HANDLE hFind;
1938 
1939  while (1)
1940  {
1941  /* filter is a list... title\0ext\0......\0\0 */
1942 
1943  /* Skip the title */
1944  if(! *lpstrPos) break; /* end */
1945  lpstrPos += lstrlenW(lpstrPos) + 1;
1946 
1947  /* See if any files exist in the current dir with this extension */
1948  if(! *lpstrPos) break; /* end */
1949 
1950  hFind = FindFirstFileW(lpstrPos, &FindFileData);
1951 
1952  if (hFind == INVALID_HANDLE_VALUE) {
1953  /* None found - continue search */
1954  lpstrPos += lstrlenW(lpstrPos) + 1;
1955 
1956  } else {
1957 
1958  heap_free(fodInfos->initdir);
1959  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1961 
1962  handledPath = TRUE;
1963  TRACE("No initial dir specified, but files of type %s found in current, so using it\n",
1964  debugstr_w(lpstrPos));
1965  FindClose(hFind);
1966  break;
1967  }
1968  }
1969  }
1970 
1971  /* 6. Win98+ and 2000+: Use personal files dir, others use current dir */
1972  if (!handledPath && (win2000plus || win98plus)) {
1973  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1974 
1975  if (SHGetFolderPathW(hwnd, CSIDL_PERSONAL, 0, 0, fodInfos->initdir) == S_OK)
1976  {
1978  {
1979  /* last fallback */
1981  TRACE("No personal or desktop dir, using cwd as failsafe: %s\n", debugstr_w(fodInfos->initdir));
1982  }
1983  else
1984  TRACE("No personal dir, using desktop instead: %s\n", debugstr_w(fodInfos->initdir));
1985  }
1986  else
1987  TRACE("No initial dir specified, using personal files dir of %s\n", debugstr_w(fodInfos->initdir));
1988 
1989  handledPath = TRUE;
1990  } else if (!handledPath) {
1991  fodInfos->initdir = heap_alloc(MAX_PATH * sizeof(WCHAR));
1993  handledPath = TRUE;
1994  TRACE("No initial dir specified, using current dir of %s\n", debugstr_w(fodInfos->initdir));
1995  }
1996  }
1997  SetFocus( fodInfos->DlgInfos.hwndFileName );
1998  TRACE("After manipulation, file = %s, dir = %s\n", debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
1999 
2000  /* Must the open as read only check box be checked ?*/
2001  if(fodInfos->ofnInfos->Flags & OFN_READONLY)
2002  {
2004  }
2005 
2006  /* Must the open as read only check box be hidden? */
2007  if (filedialog_is_readonly_hidden(fodInfos))
2008  {
2011  }
2012 
2013  /* Must the help button be hidden? */
2014  if (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP))
2015  {
2018  }
2019 
2020  /* change Open to Save */
2021  if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
2022  {
2023 #ifdef __REACTOS__
2024  WCHAR buf[24];
2025 #else
2026  WCHAR buf[16];
2027 #endif
2032  }
2033 
2034  /* Initialize the filter combo box */
2036 #ifdef __REACTOS__
2037  DoInitAutoCompleteWithCWD(fodInfos, fodInfos->DlgInfos.hwndFileName);
2038 #endif
2039 
2040  return 0;
2041 }
#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:1722
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define TB_SETBUTTONSIZE
Definition: commctrl.h:1135
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:236
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1134
#define FCIDM_TB_REPORTVIEW
Definition: shresdef.h:825
#define IDOK
Definition: winuser.h:824
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define IDS_SAVE_AS
Definition: cdlg.h:180
GLuint64EXT * result
Definition: glext.h:11304
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
static BOOL is_places_bar_enabled(const FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:356
#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:3984
static BOOL filedialog_is_readonly_hidden(const FileOpenDlgInfos *info)
Definition: filedlg.c:239
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
#define IDC_OPENREADONLY
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:943
LONG top
Definition: windef.h:307
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1105
HWND WINAPI SetFocus(_In_opt_ HWND)
#define VIEW_LIST
Definition: commctrl.h:1089
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:1151
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
#define cmb13
Definition: dlgs.h:60
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:609
HIMAGELIST himl
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SHGFI_SMALLICON
Definition: shellapi.h:174
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
& rect
Definition: startmenu.cpp:1413
#define IDS_SAVE_BUTTON
Definition: cdlg.h:177
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define ILC_COLOR32
Definition: commctrl.h:358
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define TB_SETMAXTEXTROWS
Definition: commctrl.h:1162
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static void FILEDLG95_MRU_load_filename(LPWSTR stored_path)
Definition: filedlg.c:2576
EXTERN_C HRESULT DoInitAutoCompleteWithCWD(FileOpenDlgInfos *pInfo, HWND hwndEdit)
Definition: autocomp.cpp:12
#define CCS_NODIVIDER
Definition: commctrl.h:2248
#define BTNS_BUTTON
Definition: commctrl.h:998
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:294
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDC_FILETYPE
#define TB_AUTOSIZE
Definition: commctrl.h:1137
#define FCIDM_TB_UPFOLDER
Definition: shresdef.h:822
#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:823
LONG_PTR LPARAM
Definition: windef.h:208
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
#define IDS_SAVE_IN
Definition: cdlg.h:178
GLuint index
Definition: glext.h:6031
#define IDC_LOOKINSTATIC
#define VIEW_DETAILS
Definition: commctrl.h:1090
LPOPENFILENAMEW ofnInfos
#define TB_SETIMAGELIST
Definition: commctrl.h:1150
#define IDB_VIEW_SMALL_COLOR
Definition: commctrl.h:1066
#define BM_SETCHECK
Definition: winuser.h:1904
#define TRACE(s)
Definition: solgame.cpp:4
#define TBPLACES_CMDID_PLACE0
Definition: filedlg.c:202
ULONG dwMajorVersion
Definition: rtltypes.h:247
#define BTNS_SEP
Definition: commctrl.h:999
struct FileOpenDlgInfos::@329 DlgInfos
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:414
#define IDC_LOOKIN
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3069
#define VIEW_NEWFOLDER
Definition: commctrl.h:1098
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:246
#define MAX_PATH
Definition: compat.h:34
LPITEMIDLIST places[5]
#define FCIDM_TB_DESKTOP
Definition: shresdef.h:826
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:989
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:1056
#define CCS_NORESIZE
Definition: commctrl.h:2245
#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:324
static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
Definition: filedlg.c:3535
#define TB_ADDBUTTONSW
Definition: commctrl.h:1266
GLenum GLsizei len
Definition: glext.h:6722
#define TB_SETBUTTONWIDTH
Definition: commctrl.h:1161
ULONG dwPlatformId
Definition: rtltypes.h:250
#define IDC_TOOLBARSTATIC
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define TOOLBARCLASSNAMEA
Definition: commctrl.h:944
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:52
#define lstrcpyW
Definition: compat.h:608
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void filedlg_collect_places_pidls(FileOpenDlgInfos *fodInfos)
Definition: filedlg.c:378
_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:824
#define NULL
Definition: types.h:112
#define CSIDL_FLAG_CREATE
#define pshHelp
Definition: dlgs.h:127
#define HINST_COMMCTRL
Definition: commctrl.h:1063
#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:585
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2447
#define TBSTATE_ENABLED
Definition: commctrl.h:974
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:977
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define VIEW_PARENTFOLDER
Definition: commctrl.h:1095
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2027
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define SHGFI_ICON
Definition: shellapi.h:162
#define WS_VISIBLE
Definition: pedump.c:620
#define memset(x, y, z)
Definition: compat.h:39
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1618
#define TBSTYLE_FLAT
Definition: commctrl.h:992
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:229
#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 3990 of file filedlg.c.

3991 {
3992  LPITEMIDLIST pidlNext;
3993  SHFILEINFOW sfi;
3994  SFOLDER *tmpFolder;
3995  LookInInfos *liInfos;
3996 
3997  TRACE("%p, %p, %d\n", hwnd, pidl, iInsertId);
3998 
3999  if(!pidl)
4000  return -1;
4001 
4002  if(!(liInfos = GetPropA(hwnd,LookInInfosStr)))
4003  return -1;
4004 
4005  tmpFolder = heap_alloc_zero(sizeof(*tmpFolder));
4006  tmpFolder->m_iIndent = 0;
4007 
4008  /* Calculate the indentation of the item in the lookin*/
4009  pidlNext = pidl;
4010  while ((pidlNext = ILGetNext(pidlNext)))
4011  {
4012  tmpFolder->m_iIndent++;
4013  }
4014 
4015  tmpFolder->pidlItem = ILClone(pidl);
4016 
4017  if(tmpFolder->m_iIndent > liInfos->iMaxIndentation)
4018  liInfos->iMaxIndentation = tmpFolder->m_iIndent;
4019 
4020  sfi.dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
4021  SHGetFileInfoW((LPCWSTR)pidl,
4022  0,
4023  &sfi,
4024  sizeof(sfi),
4026 
4027  TRACE("-- Add %s attr=0x%08x\n", debugstr_w(sfi.szDisplayName), sfi.dwAttributes);
4028 
4029  if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
4030  {
4031  int iItemID;
4032 
4033  TRACE("-- Add %s at %u\n", debugstr_w(sfi.szDisplayName), tmpFolder->m_iIndent);
4034 
4035  /* Add the item at the end of the list */
4036  if(iInsertId < 0)
4037  {
4038  iItemID = SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)sfi.szDisplayName);
4039  }
4040  /* Insert the item at the iInsertId position*/
4041  else
4042  {
4043  iItemID = SendMessageW(hwnd, CB_INSERTSTRING, iInsertId, (LPARAM)sfi.szDisplayName);
4044  }
4045 
4046  SendMessageW(hwnd, CB_SETITEMDATA, iItemID, (LPARAM)tmpFolder);
4047  return iItemID;
4048  }
4049 
4050  ILFree( tmpFolder->pidlItem );
4051  heap_free( tmpFolder );
4052  return -1;
4053 
4054 }
#define CB_SETITEMDATA
Definition: winuser.h:1949
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:217
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:107
#define debugstr_w
Definition: kernel32.h:32
#define SHGFI_PIDL
Definition: shellapi.h:178
#define CB_ADDSTRING
Definition: winuser.h:1919
#define CB_INSERTSTRING
Definition: winuser.h:1940
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:414
int m_iIndent
Definition: filedlg.c:100
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:166
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
LPITEMIDLIST pidlItem
Definition: filedlg.c:101
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 4193 of file filedlg.c.

4194 {
4196  LookInInfos *liInfos = GetPropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4197  int iPos, iCount;
4198 
4199  iCount = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCOUNT, 0, 0);
4200 
4201  TRACE("\n");
4202 
4203  /* Delete each string of the combo and their associated data */
4204  if (iCount != CB_ERR)
4205  {
4206  for(iPos = iCount-1;iPos>=0;iPos--)
4207  {
4208  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,iPos);
4209  ILFree(tmpFolder->pidlItem);
4210  heap_free(tmpFolder);
4211  SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_DELETESTRING, iPos, 0);
4212  }
4213  }
4214 
4215  /* LookInInfos structure */
4216  heap_free(liInfos);
4217  RemovePropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
4218 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HANDLE WINAPI RemovePropA(_In_ HWND, _In_ LPCSTR)
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static const char LookInInfosStr[]
Definition: filedlg.c:217
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:214
#define CB_ERR
Definition: winuser.h:2411
#define TRACE(s)
Definition: solgame.cpp:4
struct FileOpenDlgInfos::@329 DlgInfos
LPITEMIDLIST pidlItem
Definition: filedlg.c:101
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1925
#define CB_DELETESTRING
Definition: winuser.h:1920
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:229
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 3854 of file filedlg.c.

3855 {
3857  COLORREF crHighLight = GetSysColor(COLOR_HIGHLIGHT);
3859  RECT rectText;
3860  RECT rectIcon;
3861  SHFILEINFOW sfi;
3862  HIMAGELIST ilItemImage;
3863  int iIndentation;
3864  TEXTMETRICW tm;
3865  LPSFOLDER tmpFolder;
3867  UINT icon_width, icon_height;
3868 
3869  TRACE("\n");
3870 
3871  if(pDIStruct->itemID == -1)
3872  return 0;
3873 
3874  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem,
3875  pDIStruct->itemID)))
3876  return 0;
3877 
3878 
3879  icon_width = GetSystemMetrics(SM_CXICON);
3880  icon_height = GetSystemMetrics(SM_CYICON);
3881  if (pDIStruct->rcItem.bottom - pDIStruct->rcItem.top < icon_height)
3882  {
3883  icon_width = GetSystemMetrics(SM_CXSMICON);
3884  icon_height = GetSystemMetrics(SM_CYSMICON);
3885  shgfi_flags |= SHGFI_SMALLICON;
3886  }
3887 
3888  ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
3889  0, &sfi, sizeof (sfi), shgfi_flags );
3890 
3891  /* Is this item selected ? */
3892  if(pDIStruct->itemState & ODS_SELECTED)
3893  {
3894  SetTextColor(pDIStruct->hDC,(0x00FFFFFF & ~(crText)));
3895  SetBkColor(pDIStruct->hDC,crHighLight);
3896  FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_HIGHLIGHT));
3897  }
3898  else
3899  {
3900  SetTextColor(pDIStruct->hDC,crText);
3901  SetBkColor(pDIStruct->hDC,crWin);
3902  FillRect(pDIStruct->hDC,&pDIStruct->rcItem,GetSysColorBrush(COLOR_WINDOW));
3903  }
3904 
3905  /* Do not indent item if drawing in the edit of the combo */
3906  if(pDIStruct->itemState & ODS_COMBOBOXEDIT)
3907  iIndentation = 0;
3908  else
3909  iIndentation = tmpFolder->m_iIndent;
3910 
3911  /* Draw text and icon */
3912 
3913  /* Initialise the icon display area */
3914  rectIcon.left = pDIStruct->rcItem.left + 1 + icon_width/2 * iIndentation;
3915  rectIcon.top = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - icon_height) / 2;
3916  rectIcon.right = rectIcon.left + icon_width + XTEXTOFFSET;
3917  rectIcon.bottom = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + icon_height) / 2;
3918 
3919  /* Initialise the text display area */
3920  GetTextMetricsW(pDIStruct->hDC, &tm);
3921  rectText.left = rectIcon.right;
3922  rectText.top =
3923  (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - tm.tmHeight) / 2;
3924  rectText.right = pDIStruct->rcItem.right;
3925  rectText.bottom =
3926  (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + tm.tmHeight) / 2;
3927 
3928  /* Draw the icon from the image list */
3929  ImageList_Draw(ilItemImage,
3930  sfi.iIcon,
3931  pDIStruct->hDC,
3932  rectIcon.left,
3933  rectIcon.top,
3934  ILD_TRANSPARENT );
3935 
3936  /* Draw the associated text */
3937  TextOutW(pDIStruct->hDC,rectText.left,rectText.top,sfi.szDisplayName,lstrlenW(sfi.szDisplayName));
3938  return NOERROR;
3939 }
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:169
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define NOERROR
Definition: winerror.h:2354
LONG top
Definition: windef.h:307
#define SM_CYSMICON
Definition: winuser.h:1003
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:609
#define SHGFI_SMALLICON
Definition: shellapi.h:174
#define COLOR_WINDOW
Definition: winuser.h:908
DWORD WINAPI GetSysColor(_In_ int)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
#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:214
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
#define XTEXTOFFSET
Definition: filedlg.c:189
#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:414
DWORD COLORREF
Definition: windef.h:300
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
int m_iIndent
Definition: filedlg.c:100
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:324
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
LPITEMIDLIST pidlItem
Definition: filedlg.c:101
Definition: time.h:68
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:911
#define ILD_TRANSPARENT
Definition: commctrl.h:418
unsigned int UINT
Definition: ndis.h:50
#define ODS_SELECTED
Definition: winuser.h:2521
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 3769 of file filedlg.c.

3770 {
3771  IShellFolder *psfRoot, *psfDrives;
3772  IEnumIDList *lpeRoot, *lpeDrives;
3773  LPITEMIDLIST pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
3774  HDC hdc;
3775  TEXTMETRICW tm;
3776  LookInInfos *liInfos = heap_alloc_zero(sizeof(*liInfos));
3777 
3778  TRACE("%p\n", hwndCombo);
3779 
3780  liInfos->iMaxIndentation = 0;
3781 
3782  SetPropA(hwndCombo, LookInInfosStr, liInfos);
3783 
3784  hdc = GetDC( hwndCombo );
3785  SelectObject( hdc, (HFONT)SendMessageW( hwndCombo, WM_GETFONT, 0, 0 ));
3786  GetTextMetricsW( hdc, &tm );
3787  ReleaseDC( hwndCombo, hdc );
3788 
3789  /* set item height for both text field and listbox */
3790  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, -1, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3791  SendMessageW(hwndCombo, CB_SETITEMHEIGHT, 0, max(tm.tmHeight, GetSystemMetrics(SM_CYSMICON)));
3792 
3793  /* Turn on the extended UI for the combo box like Windows does */
3794  SendMessageW(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
3795 
3796  /* Initialise data of Desktop folder */
3798  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3799  ILFree(pidlTmp);
3800 
3802 
3803  SHGetDesktopFolder(&psfRoot);
3804 
3805  if (psfRoot)
3806  {
3807  /* enumerate the contents of the desktop */
3808  if(SUCCEEDED(IShellFolder_EnumObjects(psfRoot, hwndCombo, SHCONTF_FOLDERS, &lpeRoot)))
3809  {
3810  while (S_OK == IEnumIDList_Next(lpeRoot, 1, &pidlTmp, NULL))
3811  {
3812  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
3813 
3814  /* If the unixfs extension is rooted, we don't expand the drives by default */
3816  {
3817  /* special handling for CSIDL_DRIVES */
3818  if (ILIsEqual(pidlTmp, pidlDrives))
3819  {
3820  if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
3821  {
3822  /* enumerate the drives */
3823  if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives)))
3824  {
3825  while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
3826  {
3827  pidlAbsTmp = ILCombine(pidlTmp, pidlTmp1);
3828  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
3829  ILFree(pidlAbsTmp);
3830  ILFree(pidlTmp1);
3831  }
3832  IEnumIDList_Release(lpeDrives);
3833  }
3834  IShellFolder_Release(psfDrives);
3835  }
3836  }
3837  }
3838 
3839  ILFree(pidlTmp);
3840  }
3841  IEnumIDList_Release(lpeRoot);
3842  }
3843  IShellFolder_Release(psfRoot);
3844  }
3845 
3846  ILFree(pidlDrives);
3847 }
#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:217
#define LISTEND
Definition: filedlg.c:192
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:1539
#define SM_CYSMICON
Definition: winuser.h:1003
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
int iMaxIndentation
Definition: filedlg.c:107
#define CB_SETITEMHEIGHT
Definition: winuser.h:1950
#define CSIDL_DRIVES
Definition: shlobj.h:2028
if SUCCEEDED(hr)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_GETFONT
Definition: winuser.h:1634
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
static BOOL FILEDLG95_unixfs_is_rooted_at_desktop(void)
Definition: filedlg.c:3752
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3069
int WINAPI GetSystemMetrics(_In_ int)
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:3990
HDC hdc
Definition: main.c:9
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
Definition: time.h:68
#define S_OK
Definition: intsafe.h:52
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_SETEXTENDEDUI
Definition: winuser.h:1947
#define NULL
Definition: types.h:112
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by FILEDLG95_FillControls().

◆ FILEDLG95_LOOKIN_InsertItemAfterParent()

static int FILEDLG95_LOOKIN_InsertItemAfterParent ( HWND  hwnd,
LPITEMIDLIST  pidl 
)
static

Definition at line 4061 of file filedlg.c.

4062 {
4063 
4064  LPITEMIDLIST pidlParent = GetParentPidl(pidl);
4065  int iParentPos;
4066 
4067  TRACE("\n");
4068 
4069  if (pidl == pidlParent)
4070  return -1;
4071 
4072  iParentPos = FILEDLG95_LOOKIN_SearchItem(hwnd,(WPARAM)pidlParent,SEARCH_PIDL);
4073 
4074  if(iParentPos < 0)
4075  {
4076  iParentPos = FILEDLG95_LOOKIN_InsertItemAfterParent(hwnd,pidlParent);
4077  }
4078 
4079  ILFree(pidlParent);
4080 
4081  return FILEDLG95_LOOKIN_AddItem(hwnd,pidl,iParentPos + 1);
4082 }
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:4163
UINT_PTR WPARAM
Definition: windef.h:207
#define SEARCH_PIDL
Definition: filedlg.c:195
LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl)
Definition: filedlg.c:4525
#define TRACE(s)
Definition: solgame.cpp:4
static int FILEDLG95_LOOKIN_AddItem(HWND hwnd, LPITEMIDLIST pidl, int iInsertId)
Definition: filedlg.c:3990
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:4061
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 3947 of file filedlg.c.

3948 {
3950 
3951  TRACE("%p\n", fodInfos);
3952 
3953  switch(wNotifyCode)
3954  {
3955  case CBN_SELENDOK:
3956  {
3957  LPSFOLDER tmpFolder;
3958  int iItem;
3959 
3960  iItem = SendMessageW(fodInfos->DlgInfos.hwndLookInCB, CB_GETCURSEL, 0, 0);
3961 
3962  if( iItem == CB_ERR) return FALSE;
3963 
3964  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,
3965  iItem)))
3966  return FALSE;
3967 
3968 
3969  if(SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
3970  tmpFolder->pidlItem,
3971  SBSP_ABSOLUTE)))
3972  {
3973  if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
3975  return TRUE;
3976  }
3977  break;
3978  }
3979 
3980  }
3981  return FALSE;
3982 }
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD Flags
Definition: commdlg.h:373
#define CDN_FOLDERCHANGE
Definition: commdlg.h:35
#define TRUE
Definition: types.h:120
struct FileOpenDlgInfos::@327 Shell
#define CB_GETCURSEL
Definition: winuser.h:1926
#define FALSE
Definition: types.h:117
#define CBN_SELENDOK
Definition: winuser.h:1964
if SUCCEEDED(hr)
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:214
#define CB_ERR
Definition: winuser.h:2411
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
struct FileOpenDlgInfos::@329 DlgInfos
LPITEMIDLIST pidlItem
Definition: filedlg.c:101
LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
Definition: filedlg.c:1070
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:229

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_LOOKIN_RemoveMostExpandedItem()

static int FILEDLG95_LOOKIN_RemoveMostExpandedItem ( HWND  hwnd)
static

Definition at line 4133 of file filedlg.c.

4134 {
4135  int iItemPos;
4137 
4138  TRACE("\n");
4139 
4140  if(liInfos->iMaxIndentation <= 2)
4141  return -1;
4142 
4143  if((iItemPos = FILEDLG95_LOOKIN_SearchItem(hwnd,liInfos->iMaxIndentation,SEARCH_EXP)) >=0)
4144  {
4145  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4146  ILFree(tmpFolder->pidlItem);
4147  heap_free(tmpFolder);
4148  SendMessageW(hwnd, CB_DELETESTRING, iItemPos, 0);
4149  liInfos->iMaxIndentation--;
4150 
4151  return iItemPos;
4152  }
4153 
4154  return -1;
4155 }
#define SEARCH_EXP
Definition: filedlg.c:196
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:217
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4163
int iMaxIndentation
Definition: filedlg.c:107
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:214
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST pidlItem
Definition: filedlg.c:101
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_DELETESTRING
Definition: winuser.h:1920
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 4163 of file filedlg.c.

4164 {
4165  int i = 0;
4166  int iCount;
4167 
4168  iCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
4169 
4170  TRACE("0x%08lx 0x%x\n",searchArg, iSearchMethod);
4171 
4172  if (iCount != CB_ERR)
4173  {
4174  for(;i<iCount;i++)
4175  {
4176  LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i);
4177 
4178  if (iSearchMethod == SEARCH_PIDL && ILIsEqual((LPITEMIDLIST)searchArg, tmpFolder->pidlItem))
4179  return i;
4180  if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg)
4181  return i;
4182  }
4183  }
4184 
4185  return -1;
4186 }
#define SEARCH_EXP
Definition: filedlg.c:196
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
#define SEARCH_PIDL
Definition: filedlg.c:195
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:214
#define CB_ERR
Definition: winuser.h:2411
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:100
LPITEMIDLIST pidlItem
Definition: filedlg.c:101
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1925
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 4090 of file filedlg.c.

4091 {
4092  int iItemPos;
4093  LookInInfos *liInfos;
4094 
4095  TRACE("%p, %p\n", hwnd, pidl);
4096 
4098 
4099  liInfos = GetPropA(hwnd,LookInInfosStr);
4100 
4101  if(iItemPos < 0)
4102  {
4105  }
4106 
4107  else
4108  {
4109  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4110  while(liInfos->iMaxIndentation > tmpFolder->m_iIndent)
4111  {
4112  int iRemovedItem;
4113 
4114  if(-1 == (iRemovedItem = FILEDLG95_LOOKIN_RemoveMostExpandedItem(hwnd)))
4115  break;
4116  if(iRemovedItem < iItemPos)
4117  iItemPos--;
4118  }
4119  }
4120 
4121  SendMessageW(hwnd, CB_SETCURSEL, iItemPos, 0);
4122  liInfos->uSelectedItem = iItemPos;
4123 
4124  return 0;
4125 
4126 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const char LookInInfosStr[]
Definition: filedlg.c:217
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4163
UINT_PTR WPARAM
Definition: windef.h:207
int iMaxIndentation
Definition: filedlg.c:107
#define SEARCH_PIDL
Definition: filedlg.c:195
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:214
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:100
#define CB_SETCURSEL
Definition: winuser.h:1944
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:4133
UINT uSelectedItem
Definition: filedlg.c:108
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:4061
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 2414 of file filedlg.c.

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

Referenced by FILEDLG95_MRU_load_filename(), and FILEDLG95_MRU_save_filename().

◆ FILEDLG95_MRU_load_filename()

static void FILEDLG95_MRU_load_filename ( LPWSTR  stored_path)
static

Definition at line 2576 of file filedlg.c.

2577 {
2578  WCHAR module_path[MAX_PATH], *module_name;
2579 
2580  /* get the current executable's name */
2581  if (!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, ARRAY_SIZE(module_path)))
2582  {
2583  WARN("GotModuleFileName failed: %d\n", GetLastError());
2584  return;
2585  }
2586  module_name = wcsrchr(module_path, '\\');
2587  if(!module_name)
2588  module_name = module_path;
2589  else
2590  module_name += 1;
2591 
2592  FILEDLG95_MRU_get_slot(module_name, stored_path, NULL);
2593  TRACE("got MRU path: %s\n", wine_dbgstr_w(stored_path));
2594 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:170
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:1040
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define wcsrchr
Definition: compat.h:16
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHKEY hkey_ret)
Definition: filedlg.c:2414

Referenced by FILEDLG95_InitControls().

◆ FILEDLG95_MRU_save_filename()

static void FILEDLG95_MRU_save_filename ( LPCWSTR  filename)
static

Definition at line 2486 of file filedlg.c.

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

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

Referenced by FILEDLG95_OnWMCommand().

◆ FILEDLG95_OnOpenMessage()