ReactOS 0.4.17-dev-934-g091855f
filedlgbrowser.h File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "shlobj.h"
#include "objbase.h"
#include "commdlg.h"
Include dependency graph for filedlgbrowser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FileOpenDlgInfos
 

Macros

#define FODPROP_SAVEDLG   0x0001 /* File dialog is a Save file dialog */
 
#define FODPROP_USEVIEW
 
#define IDS_FILENOTFOUND   114
 
#define IDS_VERIFYFILE   115
 
#define IDS_CREATEFILE   116
 
#define IDS_OVERWRITEFILE   119
 
#define IDS_INVALID_FILENAME_TITLE   120
 
#define IDS_INVALID_FILENAME   121
 
#define IDS_PATHNOTEXISTING   122
 
#define IDS_FILENOTEXISTING   123
 
#define IDS_INVALID_FOLDERNAME   124
 
#define IDS_UPFOLDER   150
 
#define IDS_NEWFOLDER   151
 
#define IDS_LISTVIEW   152
 
#define IDS_REPORTVIEW   153
 
#define IDS_TODESKTOP   154
 
#define IDC_OPENREADONLY   chx1
 
#define IDC_TOOLBARSTATIC   stc1
 
#define IDC_FILETYPESTATIC   stc2
 
#define IDC_FILENAMESTATIC   stc3
 
#define IDC_LOOKINSTATIC   stc4
 
#define IDC_SHELLSTATIC   lst1
 
#define IDC_FILETYPE   cmb1
 
#define IDC_LOOKIN   cmb2
 
#define IDC_FILENAME   edt1
 
#define IDC_TOOLBAR   1
 
#define IDC_TOOLBARPLACES   ctl1
 

Functions

IShellBrowser * IShellBrowserImpl_Construct (HWND hwndOwner)
 
LPITEMIDLIST GetPidlFromDataObject (IDataObject *doSelected, UINT nPidlIndex)
 
void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd)
 
FileOpenDlgInfos * get_filedlg_infoptr (HWND hwnd)
 
IShellFolder * GetShellFolderFromPidl (LPITEMIDLIST pidlAbs)
 
LPITEMIDLIST GetParentPidl (LPITEMIDLIST pidl)
 
int FILEDLG95_LOOKIN_SelectItem (HWND hwnd, LPITEMIDLIST pidl)
 
LRESULT SendCustomDlgNotificationMessage (HWND hwndParentDlg, UINT uCode)
 

Macro Definition Documentation

◆ FODPROP_SAVEDLG

#define FODPROP_SAVEDLG   0x0001 /* File dialog is a Save file dialog */

Definition at line 42 of file filedlgbrowser.h.

◆ FODPROP_USEVIEW

#define FODPROP_USEVIEW
Value:
0x0002 /* Indicates the user selection must be taken
from the IShellView */

Definition at line 43 of file filedlgbrowser.h.

◆ IDC_FILENAME

#define IDC_FILENAME   edt1

Definition at line 139 of file filedlgbrowser.h.

◆ IDC_FILENAMESTATIC

#define IDC_FILENAMESTATIC   stc3

Definition at line 131 of file filedlgbrowser.h.

◆ IDC_FILETYPE

#define IDC_FILETYPE   cmb1

Definition at line 136 of file filedlgbrowser.h.

◆ IDC_FILETYPESTATIC

#define IDC_FILETYPESTATIC   stc2

Definition at line 130 of file filedlgbrowser.h.

◆ IDC_LOOKIN

#define IDC_LOOKIN   cmb2

Definition at line 137 of file filedlgbrowser.h.

◆ IDC_LOOKINSTATIC

#define IDC_LOOKINSTATIC   stc4

Definition at line 132 of file filedlgbrowser.h.

◆ IDC_OPENREADONLY

#define IDC_OPENREADONLY   chx1

Definition at line 127 of file filedlgbrowser.h.

◆ IDC_SHELLSTATIC

#define IDC_SHELLSTATIC   lst1

Definition at line 134 of file filedlgbrowser.h.

◆ IDC_TOOLBAR

#define IDC_TOOLBAR   1

Definition at line 141 of file filedlgbrowser.h.

◆ IDC_TOOLBARPLACES

#define IDC_TOOLBARPLACES   ctl1

Definition at line 142 of file filedlgbrowser.h.

◆ IDC_TOOLBARSTATIC

#define IDC_TOOLBARSTATIC   stc1

Definition at line 129 of file filedlgbrowser.h.

◆ IDS_CREATEFILE

#define IDS_CREATEFILE   116

Definition at line 111 of file filedlgbrowser.h.

◆ IDS_FILENOTEXISTING

#define IDS_FILENOTEXISTING   123

Definition at line 116 of file filedlgbrowser.h.

◆ IDS_FILENOTFOUND

#define IDS_FILENOTFOUND   114

Definition at line 109 of file filedlgbrowser.h.

◆ IDS_INVALID_FILENAME

#define IDS_INVALID_FILENAME   121

Definition at line 114 of file filedlgbrowser.h.

◆ IDS_INVALID_FILENAME_TITLE

#define IDS_INVALID_FILENAME_TITLE   120

Definition at line 113 of file filedlgbrowser.h.

◆ IDS_INVALID_FOLDERNAME

#define IDS_INVALID_FOLDERNAME   124

Definition at line 117 of file filedlgbrowser.h.

◆ IDS_LISTVIEW

#define IDS_LISTVIEW   152

Definition at line 123 of file filedlgbrowser.h.

◆ IDS_NEWFOLDER

#define IDS_NEWFOLDER   151

Definition at line 122 of file filedlgbrowser.h.

◆ IDS_OVERWRITEFILE

#define IDS_OVERWRITEFILE   119

Definition at line 112 of file filedlgbrowser.h.

◆ IDS_PATHNOTEXISTING

#define IDS_PATHNOTEXISTING   122

Definition at line 115 of file filedlgbrowser.h.

◆ IDS_REPORTVIEW

#define IDS_REPORTVIEW   153

Definition at line 124 of file filedlgbrowser.h.

◆ IDS_TODESKTOP

#define IDS_TODESKTOP   154

Definition at line 125 of file filedlgbrowser.h.

◆ IDS_UPFOLDER

#define IDS_UPFOLDER   150

Definition at line 121 of file filedlgbrowser.h.

◆ IDS_VERIFYFILE

#define IDS_VERIFYFILE   115

Definition at line 110 of file filedlgbrowser.h.

Function Documentation

◆ FILEDLG95_FILENAME_FillFromSelection()

void FILEDLG95_FILENAME_FillFromSelection ( HWND  hwnd)

Definition at line 4319 of file filedlg.c.

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

Referenced by IShellBrowserImpl_OnSelChange().

◆ FILEDLG95_LOOKIN_SelectItem()

int FILEDLG95_LOOKIN_SelectItem ( HWND  hwnd,
LPITEMIDLIST  pidl 
)

Definition at line 4165 of file filedlg.c.

4166{
4167 int iItemPos;
4168 LookInInfos *liInfos;
4169
4170 TRACE("%p, %p\n", hwnd, pidl);
4171
4173
4174 liInfos = GetPropA(hwnd,LookInInfosStr);
4175
4176 if(iItemPos < 0)
4177 {
4180 }
4181
4182 else
4183 {
4184 SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4185 while(liInfos->iMaxIndentation > tmpFolder->m_iIndent)
4186 {
4187 int iRemovedItem;
4188
4189 if(-1 == (iRemovedItem = FILEDLG95_LOOKIN_RemoveMostExpandedItem(hwnd)))
4190 break;
4191 if(iRemovedItem < iItemPos)
4192 iItemPos--;
4193 }
4194 }
4195
4196 SendMessageW(hwnd, CB_SETCURSEL, iItemPos, 0);
4197 liInfos->uSelectedItem = iItemPos;
4198
4199 return 0;
4200
4201}
#define SEARCH_PIDL
Definition: filedlg.c:193
static int FILEDLG95_LOOKIN_RemoveMostExpandedItem(HWND hwnd)
Definition: filedlg.c:4208
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4238
static const char LookInInfosStr[]
Definition: filedlg.c:215
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:4136
struct SFolder * LPSFOLDER
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:212
UINT_PTR WPARAM
Definition: minwindef.h:174
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define CB_SETCURSEL
Definition: winuser.h:1990
int m_iIndent
Definition: filedlg.c:98
UINT uSelectedItem
Definition: filedlg.c:106
int iMaxIndentation
Definition: filedlg.c:105

Referenced by IShellBrowserImpl_BrowseObject().

◆ get_filedlg_infoptr()

◆ GetParentPidl()

LPITEMIDLIST GetParentPidl ( LPITEMIDLIST  pidl)

Definition at line 4600 of file filedlg.c.

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

Referenced by FILEDLG95_LOOKIN_InsertItemAfterParent(), and IShellBrowserImpl_BrowseObject().

◆ GetPidlFromDataObject()

LPITEMIDLIST GetPidlFromDataObject ( IDataObject *  doSelected,
UINT  nPidlIndex 
)

Definition at line 4477 of file filedlg.c.

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

Referenced by BrowseSelectedFolder(), and IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand().

◆ GetShellFolderFromPidl()

IShellFolder * GetShellFolderFromPidl ( LPITEMIDLIST  pidlAbs)

Definition at line 4572 of file filedlg.c.

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

Referenced by IShellBrowserImpl_BrowseObject().

◆ IShellBrowserImpl_Construct()

IShellBrowser * IShellBrowserImpl_Construct ( HWND  hwndOwner)

Definition at line 197 of file filedlgbrowser.c.

198{
199 FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndOwner);
201
202 sb = heap_alloc(sizeof(*sb));
203
204 /* Initialisation of the member variables */
205 sb->ref=1;
206 sb->hwndOwner = hwndOwner;
207
208 /* Initialisation of the vTables */
209 sb->IShellBrowser_iface.lpVtbl = &IShellBrowserImpl_Vtbl;
210 sb->ICommDlgBrowser_iface.lpVtbl = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
211 sb->IServiceProvider_iface.lpVtbl = &IShellBrowserImpl_IServiceProvider_Vtbl;
213 &fodInfos->ShellInfos.pidlAbsCurrent);
214
215 TRACE("%p\n", sb);
216
217 return &sb->IShellBrowser_iface;
218}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3385
superblock * sb
Definition: btrfs.c:4261
static const ICommDlgBrowserVtbl IShellBrowserImpl_ICommDlgBrowser_Vtbl
static const IShellBrowserVtbl IShellBrowserImpl_Vtbl
static const IServiceProviderVtbl IShellBrowserImpl_IServiceProvider_Vtbl
#define CSIDL_DESKTOP
Definition: shlobj.h:2191
struct FileOpenDlgInfos::@432 ShellInfos

◆ SendCustomDlgNotificationMessage()

LRESULT SendCustomDlgNotificationMessage ( HWND  hwndParentDlg,
UINT  uCode 
)

Definition at line 1074 of file filedlg.c.

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

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