ReactOS  0.4.15-dev-5452-g3c95c95
brsfolder.c File Reference
#include <windef.h>
#include <winbase.h>
#include <shlobj.h>
#include <undocshell.h>
#include <shellapi.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include "pidl.h"
#include "shell32_main.h"
#include "shresdef.h"
Include dependency graph for brsfolder.c:

Go to the source code of this file.

Classes

struct  tagLAYOUT_DATA
 
struct  tagbrowse_info
 
struct  tagTV_ITEMDATA
 
struct  tagLAYOUT_INFO
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COBJMACROS
 
#define NONAMELESSUNION
 
#define NONAMELESSSTRUCT
 
#define SHV_CHANGE_NOTIFY   (WM_USER + 0x1111)
 
#define LAYOUT_INFO_COUNT   (sizeof(g_layout_info)/sizeof(g_layout_info[0]))
 
#define SUPPORTEDFLAGS
 

Typedefs

typedef struct tagLAYOUT_DATA LAYOUT_DATA
 
typedef struct tagbrowse_info browse_info
 
typedef struct tagTV_ITEMDATA TV_ITEMDATA
 
typedef struct tagTV_ITEMDATALPTV_ITEMDATA
 
typedef struct tagLAYOUT_INFO LAYOUT_INFO
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static void FillTreeView (browse_info *, LPSHELLFOLDER, LPITEMIDLIST, HTREEITEM, IEnumIDList *)
 
static HTREEITEM InsertTreeViewItem (browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
 
static DWORD BrowseFlagsToSHCONTF (UINT ulFlags)
 
static void browsefolder_callback (LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
 
static LAYOUT_DATALayoutInit (HWND hwnd, const LAYOUT_INFO *layout_info, int layout_count)
 
static void LayoutUpdate (HWND hwnd, LAYOUT_DATA *data, const LAYOUT_INFO *layout_info, int layout_count)
 
static void InitializeTreeView (browse_info *info)
 
static int GetIcon (LPCITEMIDLIST lpi, UINT uFlags)
 
static void GetNormalAndSelectedIcons (LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
 
static BOOL GetName (LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
 
static void FillTreeView (browse_info *info, IShellFolder *lpsf, LPITEMIDLIST pidl, HTREEITEM hParent, IEnumIDList *lpe)
 
static BOOL PIDLIsType (LPCITEMIDLIST pidl, PIDLTYPE type)
 
static void BrsFolder_CheckValidSelection (browse_info *info, LPTV_ITEMDATA lptvid)
 
static LRESULT BrsFolder_Treeview_Delete (browse_info *info, NMTREEVIEWW *pnmtv)
 
static LRESULT BrsFolder_Treeview_Expand (browse_info *info, NMTREEVIEWW *pnmtv)
 
static HRESULT BrsFolder_Treeview_Changed (browse_info *info, NMTREEVIEWW *pnmtv)
 
static LRESULT BrsFolder_Treeview_Rename (browse_info *info, NMTVDISPINFOW *pnmtv)
 
static HRESULT BrsFolder_Rename (browse_info *info, HTREEITEM rename)
 
static LRESULT BrsFolder_Treeview_Keydown (browse_info *info, LPNMTVKEYDOWN keydown)
 
static LRESULT BrsFolder_OnNotify (browse_info *info, UINT CtlID, LPNMHDR lpnmh)
 
static BOOL BrsFolder_OnCreate (HWND hWnd, browse_info *info)
 
static HRESULT BrsFolder_NewFolder (browse_info *info)
 
static BOOL BrsFolder_OnCommand (browse_info *info, UINT id)
 
static BOOL BrsFolder_OnSetExpanded (browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem)
 
static BOOL BrsFolder_OnSetSelectionW (browse_info *info, LPVOID selection, BOOL is_str)
 
static BOOL BrsFolder_OnSetSelectionA (browse_info *info, LPVOID selection, BOOL is_str)
 
static LRESULT BrsFolder_OnWindowPosChanging (browse_info *info, WINDOWPOS *pos)
 
static INT BrsFolder_OnDestroy (browse_info *info)
 
static HTREEITEM BrsFolder_FindItemByPidl (browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
 
static LRESULT BrsFolder_OnChange (browse_info *info, const LPCITEMIDLIST *pidls, LONG event)
 
static INT_PTR CALLBACK BrsFolderDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
 
LPITEMIDLIST WINAPI SHBrowseForFolderW (LPBROWSEINFOW lpbi)
 

Variables

static const LAYOUT_INFO g_layout_info []
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 25 of file brsfolder.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file brsfolder.c.

◆ LAYOUT_INFO_COUNT

#define LAYOUT_INFO_COUNT   (sizeof(g_layout_info)/sizeof(g_layout_info[0]))

Definition at line 105 of file brsfolder.c.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 28 of file brsfolder.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 27 of file brsfolder.c.

◆ SHV_CHANGE_NOTIFY

#define SHV_CHANGE_NOTIFY   (WM_USER + 0x1111)

Definition at line 48 of file brsfolder.c.

◆ SUPPORTEDFLAGS

#define SUPPORTEDFLAGS
Value:
BIF_BROWSEFORCOMPUTER | \
BIF_RETURNFSANCESTORS | \
BIF_RETURNONLYFSDIRS | \
BIF_NONEWFOLDERBUTTON | \
BIF_NEWDIALOGSTYLE | \
BIF_BROWSEINCLUDEFILES)
#define BIF_STATUSTEXT
Definition: shlobj.h:1146

Definition at line 107 of file brsfolder.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 24 of file brsfolder.c.

Typedef Documentation

◆ browse_info

◆ LAYOUT_DATA

◆ LAYOUT_INFO

◆ LPTV_ITEMDATA

◆ TV_ITEMDATA

Function Documentation

◆ BrowseFlagsToSHCONTF()

static DWORD BrowseFlagsToSHCONTF ( UINT  ulFlags)
inlinestatic

Definition at line 120 of file brsfolder.c.

121 {
122  return SHCONTF_FOLDERS | (ulFlags & BIF_BROWSEINCLUDEFILES ? SHCONTF_NONFOLDERS : 0);
123 }
#define BIF_BROWSEINCLUDEFILES
Definition: shlobj.h:1159

Referenced by BrsFolder_NewFolder(), FillTreeView(), and InitializeTreeView().

◆ browsefolder_callback()

static void browsefolder_callback ( LPBROWSEINFOW  lpBrowseInfo,
HWND  hWnd,
UINT  msg,
LPARAM  param 
)
static

Definition at line 125 of file brsfolder.c.

127 {
128  if (!lpBrowseInfo->lpfn)
129  return;
130  lpBrowseInfo->lpfn( hWnd, msg, param, lpBrowseInfo->lParam );
131 }
HWND hWnd
Definition: settings.c:17
GLfloat param
Definition: glext.h:5796
LPARAM lParam
Definition: shlobj.h:1133
BFFCALLBACK lpfn
Definition: shlobj.h:1132
#define msg(x)
Definition: auth_time.c:54

Referenced by BrsFolder_OnCreate(), and BrsFolder_Treeview_Changed().

◆ BrsFolder_CheckValidSelection()

static void BrsFolder_CheckValidSelection ( browse_info info,
LPTV_ITEMDATA  lptvid 
)
static

Definition at line 488 of file brsfolder.c.

489 {
490  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
491  LPCITEMIDLIST pidl = lptvid->lpi;
492  BOOL bEnabled = TRUE;
494  HRESULT r;
495 
496  if ((lpBrowseInfo->ulFlags & BIF_BROWSEFORCOMPUTER) &&
497  !PIDLIsType(pidl, PT_COMP))
498  bEnabled = FALSE;
499  if (lpBrowseInfo->ulFlags & BIF_RETURNFSANCESTORS)
500  {
501  dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
502  r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
503  (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
504  if (FAILED(r) || !(dwAttributes & (SFGAO_FILESYSANCESTOR|SFGAO_FILESYSTEM)))
505  bEnabled = FALSE;
506  }
507 
508  dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSTEM;
509  r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
510  (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
511  if (FAILED(r) ||
512  ((dwAttributes & (SFGAO_FOLDER|SFGAO_FILESYSTEM)) != (SFGAO_FOLDER|SFGAO_FILESYSTEM)))
513  {
514  if (lpBrowseInfo->ulFlags & BIF_RETURNONLYFSDIRS)
515  bEnabled = FALSE;
517  }
518  else
520 
521  SendMessageW(info->hWnd, BFFM_ENABLEOK, 0, bEnabled);
522 }
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
static BOOL PIDLIsType(LPCITEMIDLIST pidl, PIDLTYPE type)
Definition: brsfolder.c:480
DWORD dwAttributes
Definition: vdmdbg.h:34
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define BIF_RETURNFSANCESTORS
Definition: shlobj.h:1147
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BFFM_ENABLEOK
Definition: shlobj.h:1171
#define PT_COMP
Definition: pidl.h:99
UINT ulFlags
Definition: shlobj.h:1131
#define BIF_RETURNONLYFSDIRS
Definition: shlobj.h:1144
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPITEMIDLIST lpi
Definition: brsfolder.c:73
#define BIF_BROWSEFORCOMPUTER
Definition: shlobj.h:1157
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:412

Referenced by BrsFolder_Treeview_Changed().

◆ BrsFolder_FindItemByPidl()

static HTREEITEM BrsFolder_FindItemByPidl ( browse_info info,
LPCITEMIDLIST  pidl,
HTREEITEM  hItem 
)
static

Definition at line 1219 of file brsfolder.c.

1220 {
1221  TV_ITEMW item;
1222  TV_ITEMDATA *item_data;
1223  HRESULT hr;
1224 
1225  item.mask = TVIF_HANDLE | TVIF_PARAM;
1226  item.hItem = hItem;
1227  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
1228  item_data = (TV_ITEMDATA *)item.lParam;
1229 
1230  hr = IShellFolder_CompareIDs(item_data->lpsfParent, 0, item_data->lpifq, pidl);
1231  if(SUCCEEDED(hr) && !HRESULT_CODE(hr))
1232  return hItem;
1233 
1235 
1236  while (hItem)
1237  {
1238  HTREEITEM newItem = BrsFolder_FindItemByPidl(info, pidl, hItem);
1239  if (newItem)
1240  return newItem;
1242  }
1243  return NULL;
1244 }
HRESULT hr
Definition: shlfolder.c:183
#define TV_ITEMW
Definition: commctrl.h:3297
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
#define TVGN_NEXT
Definition: commctrl.h:3453
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3264
if SUCCEEDED(hr)
HTREEITEM hItem
Definition: treelist.h:37
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
LONG HRESULT
Definition: typedefs.h:79
#define TVGN_CHILD
Definition: commctrl.h:3456
#define TVIF_HANDLE
Definition: commctrl.h:3270
#define TVM_GETNEXTITEM
Definition: commctrl.h:3449
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define HRESULT_CODE(hr)
Definition: winerror.h:76
static HTREEITEM BrsFolder_FindItemByPidl(browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
Definition: brsfolder.c:1219
#define TVM_GETITEMW
Definition: commctrl.h:3486
#define TVIF_PARAM
Definition: commctrl.h:3268

Referenced by BrsFolder_OnChange().

◆ BrsFolder_NewFolder()

static HRESULT BrsFolder_NewFolder ( browse_info info)
static

Definition at line 886 of file brsfolder.c.

887 {
888  DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
889  IShellFolder *desktop, *cur;
890 #ifdef __REACTOS__
891  WCHAR wszNewFolder[25];
893 #else
894  ISFHelper *sfhelper;
895 #endif
897  HTREEITEM parent, added;
898  LPTV_ITEMDATA item_data;
899  LPITEMIDLIST new_item;
900  TVITEMW item;
901  HRESULT hr;
902  int len;
903 
904 #ifdef __REACTOS__
905  hr = SHGetDesktopFolder(&desktop);
906  if(FAILED(hr))
907  return hr;
908 
909  if (info->pidlRet)
910  {
911  hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur);
912  IShellFolder_Release(desktop);
913  if(FAILED(hr))
914  return hr;
915 
916  hr = SHGetPathFromIDListW(info->pidlRet, path);
917  }
918  else
919  {
920  cur = desktop;
922  }
923  if(FAILED(hr))
924  return hr;
925 
926  if (!LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, _countof(wszNewFolder)))
927  return E_FAIL;
928 
929  if (!PathYetAnotherMakeUniqueName(name, path, NULL, wszNewFolder))
930  return E_FAIL;
931 
932  len = strlenW(path);
933  if(len<MAX_PATH && name[len] == L'\\')
934  len++;
935 #else
936  if(!info->pidlRet) {
937  ERR("Make new folder button should be disabled\n");
938  return E_FAIL;
939  }
940 
941  /* Create new directory */
942  hr = SHGetDesktopFolder(&desktop);
943  if(FAILED(hr))
944  return hr;
945 
946  hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur);
947  IShellFolder_Release(desktop);
948  if(FAILED(hr))
949  return hr;
950 
951  hr = IShellFolder_QueryInterface(cur, &IID_ISFHelper, (void**)&sfhelper);
952  if(FAILED(hr))
953  return hr;
954 
955  if(!SHGetPathFromIDListW(info->pidlRet, name)) {
956  hr = E_FAIL;
957  goto cleanup;
958  }
959 
960  len = strlenW(name);
961  if(len<MAX_PATH)
962  name[len++] = '\\';
963  hr = ISFHelper_GetUniqueName(sfhelper, &name[len], MAX_PATH-len);
964  ISFHelper_Release(sfhelper);
965  if(FAILED(hr))
966  goto cleanup;
967 #endif
968 
969  hr = E_FAIL;
970  if(!CreateDirectoryW(name, NULL))
971  goto cleanup;
972 
973  /* Update parent of newly created directory */
975  if(!parent)
976  goto cleanup;
977 
978  SendMessageW(info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)parent);
979 
980  memset(&item, 0, sizeof(TVITEMW));
981  item.mask = TVIF_PARAM|TVIF_STATE;
982  item.hItem = parent;
983  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
984  item_data = (LPTV_ITEMDATA)item.lParam;
985  if(!item_data)
986  goto cleanup;
987 
988  if(item_data->pEnumIL)
989  IEnumIDList_Release(item_data->pEnumIL);
990  hr = IShellFolder_EnumObjects(cur, info->hwndTreeView, flags, &item_data->pEnumIL);
991  if(FAILED(hr))
992  goto cleanup;
993 
994  /* Update treeview */
995  if(!(item.state&TVIS_EXPANDEDONCE)) {
996  item.mask = TVIF_STATE;
997  item.state = TVIS_EXPANDEDONCE;
998  item.stateMask = TVIS_EXPANDEDONCE;
999  SendMessageW(info->hwndTreeView, TVM_SETITEMW, 0, (LPARAM)&item);
1000  }
1001 
1002  hr = IShellFolder_ParseDisplayName(cur, NULL, NULL, name+len, NULL, &new_item, NULL);
1003  if(FAILED(hr))
1004  goto cleanup;
1005 
1006  added = InsertTreeViewItem(info, cur, new_item, item_data->lpifq, NULL, parent);
1007  IShellFolder_Release(cur);
1008  SHFree(new_item);
1009 
1010  SendMessageW(info->hwndTreeView, TVM_SORTCHILDREN, FALSE, (LPARAM)parent);
1011  return BrsFolder_Rename(info, added);
1012 
1013 cleanup:
1014  return hr;
1015 }
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
#define IDS_NEWFOLDER
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
Definition: brsfolder.c:374
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
HRESULT hr
Definition: shlfolder.c:183
struct tagTV_ITEMDATA * LPTV_ITEMDATA
#define TVM_EXPAND
Definition: commctrl.h:3419
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
#define TVM_SORTCHILDREN
Definition: commctrl.h:3541
#define TVGN_CARET
Definition: commctrl.h:3461
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3264
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3285
#define E_FAIL
Definition: ddrawi.h:102
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
Definition: brsfolder.c:120
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
Definition: brsfolder.c:631
#define L(x)
Definition: ntvdm.h:50
#define TVM_SETITEMW
Definition: commctrl.h:3493
#define FALSE
Definition: types.h:117
IEnumIDList * pEnumIL
Definition: brsfolder.c:75
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
r parent
Definition: btrfs.c:3010
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TVE_EXPAND
Definition: commctrl.h:3423
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
FxCollectionEntry * cur
#define ERR(fmt,...)
Definition: debug.h:110
#define TVM_GETNEXTITEM
Definition: commctrl.h:3449
#define shell32_hInstance
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2558
Definition: name.c:38
#define TVIF_STATE
Definition: commctrl.h:3269
char * cleanup(char *str)
Definition: wpickclick.c:99
#define TVM_GETITEMW
Definition: commctrl.h:3486
BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR shortname, LPCWSTR longname)
Definition: shellpath.c:705
#define TVIF_PARAM
Definition: commctrl.h:3268
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2040
#define memset(x, y, z)
Definition: compat.h:39
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by BrsFolder_OnCommand().

◆ BrsFolder_OnChange()

static LRESULT BrsFolder_OnChange ( browse_info info,
const LPCITEMIDLIST pidls,
LONG  event 
)
static

Definition at line 1246 of file brsfolder.c.

1247 {
1248  BOOL ret = TRUE;
1249 
1250  TRACE("(%p)->(%p, %p, 0x%08x)\n", info, pidls[0], pidls[1], event);
1251 
1252  switch (event)
1253  {
1254  case SHCNE_RMDIR:
1255  case SHCNE_DELETE:
1256  {
1257  HTREEITEM handle_root = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_ROOT, 0);
1258  HTREEITEM handle_item = BrsFolder_FindItemByPidl(info, pidls[0], handle_root);
1259 
1260  if (handle_item)
1261  SendMessageW(info->hwndTreeView, TVM_DELETEITEM, 0, (LPARAM)handle_item);
1262 
1263  break;
1264  }
1265  }
1266  return ret;
1267 }
#define SHCNE_RMDIR
Definition: shlobj.h:1746
#define TRUE
Definition: types.h:120
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3264
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TVGN_ROOT
Definition: commctrl.h:3452
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define TVM_DELETEITEM
Definition: commctrl.h:3414
struct _cl_event * event
Definition: glext.h:7739
#define TVM_GETNEXTITEM
Definition: commctrl.h:3449
#define SHCNE_DELETE
Definition: shlobj.h:1744
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HTREEITEM BrsFolder_FindItemByPidl(browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
Definition: brsfolder.c:1219

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnCommand()

static BOOL BrsFolder_OnCommand ( browse_info info,
UINT  id 
)
static

Definition at line 1017 of file brsfolder.c.

1018 {
1019  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
1020 #ifdef __REACTOS__
1022 #endif
1023 
1024  switch (id)
1025  {
1026  case IDOK:
1027 #ifdef __REACTOS__
1028  /* Get the text */
1030  StrTrimW(szPath, L" \t");
1031 
1032  /* The original pidl is owned by the treeview and will be free'd. */
1034  {
1035  /* It's valid path */
1036  info->pidlRet = ILCreateFromPathW(szPath);
1037  }
1038  else
1039  {
1040  info->pidlRet = ILClone(info->pidlRet);
1041  }
1042 #endif
1043  if (info->pidlRet == NULL) /* A null pidl would mean a cancel */
1044  info->pidlRet = _ILCreateDesktop();
1045  pdump( info->pidlRet );
1046  if (lpBrowseInfo->pszDisplayName)
1047  SHGetPathFromIDListW( info->pidlRet, lpBrowseInfo->pszDisplayName );
1048  EndDialog( info->hWnd, 1 );
1049  return TRUE;
1050 
1051  case IDCANCEL:
1052  EndDialog( info->hWnd, 0 );
1053  return TRUE;
1054 
1057  return TRUE;
1058  }
1059  return FALSE;
1060 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:413
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1722
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1578
#define IDOK
Definition: winuser.h:824
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1602
#define TRUE
Definition: types.h:120
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
LPWSTR pszDisplayName
Definition: shlobj.h:1129
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
static HRESULT BrsFolder_NewFolder(browse_info *info)
Definition: brsfolder.c:886
LPCWSTR szPath
Definition: env.c:37
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:311
#define NULL
Definition: types.h:112
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:982
#define IDCANCEL
Definition: winuser.h:825
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:412

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnCreate()

static BOOL BrsFolder_OnCreate ( HWND  hWnd,
browse_info info 
)
static

Definition at line 762 of file brsfolder.c.

763 {
764  LPITEMIDLIST computer_pidl;
765  SHChangeNotifyEntry ntreg;
766  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
767 
768  info->hWnd = hWnd;
769  SetPropW( hWnd, L"__WINE_BRSFOLDERDLG_INFO", info );
770 
771  if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
772  FIXME("flags BIF_NEWDIALOGSTYLE partially implemented\n");
773  if (lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS)
774  FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS);
775 
776 #ifdef __REACTOS__
777  if (lpBrowseInfo->ulFlags & BIF_USENEWUI)
778 #else
779  if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
780 #endif
781  {
782  RECT rcWnd;
783 
784 #ifdef __REACTOS__
785  /* Resize the treeview if there's not editbox */
786  if ((lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
787  && !(lpBrowseInfo->ulFlags & BIF_EDITBOX))
788  {
789  RECT rcEdit, rcTreeView;
790  INT cy;
793  cy = rcTreeView.top - rcEdit.top;
794  MapWindowPoints(NULL, hWnd, (LPPOINT)&rcTreeView, sizeof(RECT) / sizeof(POINT));
795  rcTreeView.top -= cy;
797  rcTreeView.left, rcTreeView.top,
798  rcTreeView.right - rcTreeView.left,
799  rcTreeView.bottom - rcTreeView.top, TRUE);
800  }
801  if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
803  else
804  info->layout = NULL;
805 #else
807 #endif
808 
809  /* TODO: Windows allows shrinking the windows a bit */
810  GetWindowRect(hWnd, &rcWnd);
811  info->szMin.cx = rcWnd.right - rcWnd.left;
812  info->szMin.cy = rcWnd.bottom - rcWnd.top;
813  }
814  else
815  {
816  info->layout = NULL;
817  }
818 
819  if (lpBrowseInfo->lpszTitle)
821  else
823 
824  if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT)
825 #ifdef __REACTOS__
826  || (lpBrowseInfo->ulFlags & BIF_USENEWUI))
827 #else
828  || (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
829 #endif
831 
832  /* Hide "Make New Folder" Button? */
833  if ((lpBrowseInfo->ulFlags & BIF_NONEWFOLDERBUTTON)
834  || !(lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
836 
837  /* Hide the editbox? */
838  if (!(lpBrowseInfo->ulFlags & BIF_EDITBOX))
839  {
842  }
843 
845  if (info->hwndTreeView)
846  {
848 
849 #ifndef __REACTOS__
850  /* Resize the treeview if there's not editbox */
851  if ((lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
852  && !(lpBrowseInfo->ulFlags & BIF_EDITBOX))
853  {
854  RECT rc;
855  GetClientRect(info->hwndTreeView, &rc);
856  SetWindowPos(info->hwndTreeView, HWND_TOP, 0, 0,
857  rc.right, rc.bottom + 40, SWP_NOMOVE);
858  }
859 #endif
860  }
861  else
862  ERR("treeview control missing!\n");
863 
864  /* Register for change notifications */
865  SHGetFolderLocation(NULL, CSIDL_DESKTOP, NULL, 0, &computer_pidl);
866 
867  ntreg.pidl = computer_pidl;
868  ntreg.fRecursive = TRUE;
869 
871 
872 #ifdef __REACTOS__
873  SetFocus(info->hwndTreeView);
874 #endif
875  browsefolder_callback( info->lpBrowseInfo, hWnd, BFFM_INITIALIZED, 0 );
876 
877 #ifdef __REACTOS__
880  return TRUE;
881 #else
882  return TRUE;
883 #endif
884 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:413
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:415
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define TRUE
Definition: types.h:120
#define CSIDL_DESKTOP
Definition: shlobj.h:2025
#define SW_HIDE
Definition: winuser.h:762
#define LAYOUT_INFO_COUNT
Definition: brsfolder.c:105
HWND hWnd
Definition: settings.c:17
#define BFFM_INITIALIZED
Definition: shlobj.h:1163
LONG top
Definition: windef.h:307
#define HWND_TOP
Definition: winuser.h:1197
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define BIF_NONEWFOLDERBUTTON
Definition: shlobj.h:1154
#define BIF_EDITBOX
Definition: shlobj.h:1148
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
#define IDC_BROWSE_FOR_FOLDER_TITLE
Definition: shresdef.h:416
#define L(x)
Definition: ntvdm.h:50
#define SHCNE_ALLEVENTS
Definition: shlobj.h:1766
#define FIXME(fmt,...)
Definition: debug.h:111
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1787
#define SHACF_FILESYSTEM
Definition: shlwapi.h:1912
#define SHV_CHANGE_NOTIFY
Definition: brsfolder.c:48
#define IDC_BROWSE_FOR_FOLDER_FOLDER
Definition: shresdef.h:414
HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
Definition: autocomp.cpp:191
static LAYOUT_DATA * LayoutInit(HWND hwnd, const LAYOUT_INFO *layout_info, int layout_count)
Definition: brsfolder.c:134
LPCWSTR lpszTitle
Definition: shlobj.h:1130
#define BIF_STATUSTEXT
Definition: shlobj.h:1146
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1150
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BIF_USENEWUI
Definition: shlobj.h:1151
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1738
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define ERR(fmt,...)
Definition: debug.h:110
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
UINT ulFlags
Definition: shlobj.h:1131
static void browsefolder_callback(LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
Definition: brsfolder.c:125
static void InitializeTreeView(browse_info *info)
Definition: brsfolder.c:206
#define SUPPORTEDFLAGS
Definition: brsfolder.c:107
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:417
#define NULL
Definition: types.h:112
EXTERN_C ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, INT fSources, LONG wEventMask, UINT uMsg, INT cItems, SHChangeNotifyEntry *lpItems)
LONG bottom
Definition: windef.h:309
#define SWP_NOMOVE
Definition: winuser.h:1234
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3093
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 SHACF_FILESYS_ONLY
Definition: shlwapi.h:1917
#define SHACF_URLHISTORY
Definition: shlwapi.h:1913
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static const LAYOUT_INFO g_layout_info[]
Definition: brsfolder.c:86
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:412

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnDestroy()

static INT BrsFolder_OnDestroy ( browse_info info)
static

Definition at line 1201 of file brsfolder.c.

1202 {
1203  if (info->layout)
1204  {
1205 #ifdef __REACTOS__
1206  LayoutDestroy(info->layout);
1207 #else
1208  SHFree(info->layout);
1209 #endif
1210  info->layout = NULL;
1211  }
1212 
1213  SHChangeNotifyDeregister(info->hNotify);
1214 
1215  return 0;
1216 }
static __inline void LayoutDestroy(LAYOUT_DATA *pData)
Definition: layout.h:251
EXTERN_C BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)
#define NULL
Definition: types.h:112
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnNotify()

static LRESULT BrsFolder_OnNotify ( browse_info info,
UINT  CtlID,
LPNMHDR  lpnmh 
)
static

Definition at line 723 of file brsfolder.c.

724 {
725  NMTREEVIEWW *pnmtv = (NMTREEVIEWW *)lpnmh;
726 
727  TRACE("%p %x %p msg=%x\n", info, CtlID, lpnmh, pnmtv->hdr.code);
728 
730  return 0;
731 
732  switch (pnmtv->hdr.code)
733  {
734  case TVN_DELETEITEMA:
735  case TVN_DELETEITEMW:
736  return BrsFolder_Treeview_Delete( info, pnmtv );
737 
738  case TVN_ITEMEXPANDINGA:
739  case TVN_ITEMEXPANDINGW:
740  return BrsFolder_Treeview_Expand( info, pnmtv );
741 
742  case TVN_SELCHANGEDA:
743  case TVN_SELCHANGEDW:
744  return BrsFolder_Treeview_Changed( info, pnmtv );
745 
746  case TVN_ENDLABELEDITA:
747  case TVN_ENDLABELEDITW:
749 
750  case TVN_KEYDOWN:
752 
753  default:
754  WARN("unhandled (%d)\n", pnmtv->hdr.code);
755  break;
756  }
757 
758  return 0;
759 }
static LRESULT BrsFolder_Treeview_Expand(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:539
#define TVN_DELETEITEMA
Definition: commctrl.h:3707
#define WARN(fmt,...)
Definition: debug.h:112
static HRESULT BrsFolder_Treeview_Changed(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:574
#define TVN_SELCHANGEDA
Definition: commctrl.h:3647
UINT code
Definition: winuser.h:3149
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3712
UINT_PTR idFrom
Definition: winuser.h:3148
#define TVN_ITEMEXPANDINGW
Definition: commctrl.h:3700
#define TVN_SELCHANGEDW
Definition: commctrl.h:3648
#define TVN_DELETEITEMW
Definition: commctrl.h:3708
#define TRACE(s)
Definition: solgame.cpp:4
#define TVN_ENDLABELEDITA
Definition: commctrl.h:3711
static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydown)
Definition: brsfolder.c:672
static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv)
Definition: brsfolder.c:591
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:417
#define TVN_KEYDOWN
Definition: commctrl.h:3713
static LRESULT BrsFolder_Treeview_Delete(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:524
#define TVN_ITEMEXPANDINGA
Definition: commctrl.h:3699

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnSetExpanded()

static BOOL BrsFolder_OnSetExpanded ( browse_info info,
LPVOID  selection,
BOOL  is_str,
HTREEITEM pItem 
)
static

Definition at line 1062 of file brsfolder.c.

1064 {
1065  LPITEMIDLIST pidlSelection = selection;
1066  LPCITEMIDLIST pidlCurrent, pidlRoot;
1067  TVITEMEXW item;
1068  BOOL bResult = FALSE;
1069 
1070  memset(&item, 0, sizeof(item));
1071 
1072  /* If 'selection' is a string, convert to a Shell ID List. */
1073  if (is_str) {
1074  IShellFolder *psfDesktop;
1075  HRESULT hr;
1076 
1077  hr = SHGetDesktopFolder(&psfDesktop);
1078  if (FAILED(hr))
1079  goto done;
1080 
1081  hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL,
1082  selection, NULL, &pidlSelection, NULL);
1083  IShellFolder_Release(psfDesktop);
1084  if (FAILED(hr))
1085  goto done;
1086  }
1087 #ifdef __REACTOS__
1088  if (_ILIsDesktop(pidlSelection))
1089  {
1090  item.hItem = TVI_ROOT;
1091  bResult = TRUE;
1092  goto done;
1093  }
1094 #endif
1095 
1096  /* Move pidlCurrent behind the SHITEMIDs in pidlSelection, which are the root of
1097  * the sub-tree currently displayed. */
1098  pidlRoot = info->lpBrowseInfo->pidlRoot;
1099  pidlCurrent = pidlSelection;
1100  while (!_ILIsEmpty(pidlRoot) && _ILIsEqualSimple(pidlRoot, pidlCurrent)) {
1101  pidlRoot = ILGetNext(pidlRoot);
1102  pidlCurrent = ILGetNext(pidlCurrent);
1103  }
1104 
1105  /* The given ID List is not part of the SHBrowseForFolder's current sub-tree. */
1106  if (!_ILIsEmpty(pidlRoot))
1107  goto done;
1108 
1109  /* Initialize item to point to the first child of the root folder. */
1110  item.mask = TVIF_PARAM;
1111  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_ROOT, 0);
1112 
1113  if (item.hItem)
1114  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CHILD,
1115  (LPARAM)item.hItem);
1116 
1117  /* Walk the tree along the nodes corresponding to the remaining ITEMIDLIST */
1118  while (item.hItem && !_ILIsEmpty(pidlCurrent)) {
1119  LPTV_ITEMDATA pItemData;
1120 
1121  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
1122  pItemData = (LPTV_ITEMDATA)item.lParam;
1123 
1124  if (_ILIsEqualSimple(pItemData->lpi, pidlCurrent)) {
1125  pidlCurrent = ILGetNext(pidlCurrent);
1126  if (!_ILIsEmpty(pidlCurrent)) {
1127  /* Only expand current node and move on to its first child,
1128  * if we didn't already reach the last SHITEMID */
1129  SendMessageW(info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)item.hItem);
1130  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CHILD,
1131  (LPARAM)item.hItem);
1132  }
1133  } else {
1134  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_NEXT,
1135  (LPARAM)item.hItem);
1136  }
1137  }
1138 
1139  if (_ILIsEmpty(pidlCurrent) && item.hItem)
1140  bResult = TRUE;
1141 
1142 done:
1143  if (pidlSelection && pidlSelection != selection)
1144  ILFree(pidlSelection);
1145 
1146  if (pItem)
1147  *pItem = item.hItem;
1148 
1149  return bResult;
1150 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:257
HRESULT hr
Definition: shlfolder.c:183
struct tagTV_ITEMDATA * LPTV_ITEMDATA
#define TVM_EXPAND
Definition: commctrl.h:3419
#define TRUE
Definition: types.h:120
#define TVGN_NEXT
Definition: commctrl.h:3453
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3264
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
if(dx==0 &&dy==0)
Definition: linetemp.h:174
int selection
Definition: ctm.c:92
static BOOL _ILIsEqualSimple(LPCITEMIDLIST pidlA, LPCITEMIDLIST pidlB)
Definition: pidl.h:251
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TVGN_ROOT
Definition: commctrl.h:3452
LONG_PTR LPARAM
Definition: windef.h:208
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
LONG HRESULT
Definition: typedefs.h:79
#define TVE_EXPAND
Definition: commctrl.h:3423
#define TVI_ROOT
Definition: commctrl.h:3368
#define TVGN_CHILD
Definition: commctrl.h:3456
#define TVM_GETNEXTITEM
Definition: commctrl.h:3449
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define TVM_GETITEMW
Definition: commctrl.h:3486
#define TVIF_PARAM
Definition: commctrl.h:3268
LPITEMIDLIST lpi
Definition: brsfolder.c:73
#define memset(x, y, z)
Definition: compat.h:39
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by BrsFolder_OnSetSelectionW(), and BrsFolderDlgProc().

◆ BrsFolder_OnSetSelectionA()

static BOOL BrsFolder_OnSetSelectionA ( browse_info info,
LPVOID  selection,
BOOL  is_str 
)
static

Definition at line 1164 of file brsfolder.c.

1164  {
1165  LPWSTR selectionW = NULL;
1166  BOOL result = FALSE;
1167  int length;
1168 
1169  if (!is_str)
1170  return BrsFolder_OnSetSelectionW(info, selection, is_str);
1171 
1172  if ((length = MultiByteToWideChar(CP_ACP, 0, selection, -1, NULL, 0)) &&
1173  (selectionW = HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR))) &&
1174  MultiByteToWideChar(CP_ACP, 0, selection, -1, selectionW, length))
1175  {
1176  result = BrsFolder_OnSetSelectionW(info, selectionW, is_str);
1177  }
1178 
1179  HeapFree(GetProcessHeap(), 0, selectionW);
1180  return result;
1181 }
GLuint64EXT * result
Definition: glext.h:11304
#define CP_ACP
Definition: compat.h:109
int selection
Definition: ctm.c:92
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static BOOL BrsFolder_OnSetSelectionW(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1152
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnSetSelectionW()

static BOOL BrsFolder_OnSetSelectionW ( browse_info info,
LPVOID  selection,
BOOL  is_str 
)
static

Definition at line 1152 of file brsfolder.c.

1152  {
1153  HTREEITEM hItem;
1154  BOOL bResult;
1155 
1156  if (!selection) return FALSE;
1157 
1158  bResult = BrsFolder_OnSetExpanded(info, selection, is_str, &hItem);
1159  if (bResult)
1160  SendMessageW(info->hwndTreeView, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem );
1161  return bResult;
1162 }
#define TVM_SELECTITEM
Definition: commctrl.h:3478
#define TVGN_CARET
Definition: commctrl.h:3461
int selection
Definition: ctm.c:92
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HTREEITEM hItem
Definition: treelist.h:37
LONG_PTR LPARAM
Definition: windef.h:208
static BOOL BrsFolder_OnSetExpanded(browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem)
Definition: brsfolder.c:1062
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by BrsFolder_OnSetSelectionA(), and BrsFolderDlgProc().

◆ BrsFolder_OnWindowPosChanging()

static LRESULT BrsFolder_OnWindowPosChanging ( browse_info info,
WINDOWPOS pos 
)
static

Definition at line 1184 of file brsfolder.c.

1185 {
1186 #ifdef __REACTOS__
1187  if ((info->lpBrowseInfo->ulFlags & BIF_USENEWUI) && !(pos->flags & SWP_NOSIZE))
1188 #else
1189  if ((info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE) && !(pos->flags & SWP_NOSIZE))
1190 #endif
1191  {
1192  if (pos->cx < info->szMin.cx)
1193  pos->cx = info->szMin.cx;
1194  if (pos->cy < info->szMin.cy)
1195  pos->cy = info->szMin.cy;
1196  }
1197  return 0;
1198 }
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1150
#define BIF_USENEWUI
Definition: shlobj.h:1151
#define SWP_NOSIZE
Definition: winuser.h:1235

Referenced by BrsFolderDlgProc().

◆ BrsFolder_Rename()

static HRESULT BrsFolder_Rename ( browse_info info,
HTREEITEM  rename 
)
static

Definition at line 631 of file brsfolder.c.

632 {
634  SendMessageW(info->hwndTreeView, TVM_EDITLABELW, 0, (LPARAM)rename);
635  return S_OK;
636 }
#define TVM_SELECTITEM
Definition: commctrl.h:3478
#define TVGN_CARET
Definition: commctrl.h:3461
_Check_return_ int __cdecl rename(_In_z_ const char *_OldFilename, _In_z_ const char *_NewFilename)
LONG_PTR LPARAM
Definition: windef.h:208
#define TVM_EDITLABELW
Definition: commctrl.h:3500
#define S_OK
Definition: intsafe.h:52
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by BrsFolder_NewFolder(), and BrsFolder_Treeview_Keydown().

◆ BrsFolder_Treeview_Changed()

static HRESULT BrsFolder_Treeview_Changed ( browse_info info,
NMTREEVIEWW pnmtv 
)
static

Definition at line 574 of file brsfolder.c.

575 {
576  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
578 
579  ILFree(info->pidlRet);
580  info->pidlRet = ILClone(lptvid->lpifq);
581 
582  if (GetName(lptvid->lpsfParent, lptvid->lpi, SHGDN_NORMAL, name))
584 
585  browsefolder_callback( info->lpBrowseInfo, info->hWnd, BFFM_SELCHANGED,
586  (LPARAM)info->pidlRet );
588  return S_OK;
589 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:413
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
Definition: brsfolder.c:344
static void BrsFolder_CheckValidSelection(browse_info *info, LPTV_ITEMDATA lptvid)
Definition: brsfolder.c:488
LPARAM lParam
Definition: commctrl.h:3325
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
TVITEMW itemNew
Definition: commctrl.h:3638
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define S_OK
Definition: intsafe.h:52
static void browsefolder_callback(LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
Definition: brsfolder.c:125
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define BFFM_SELCHANGED
Definition: shlobj.h:1164
Definition: name.c:38
LPITEMIDLIST lpi
Definition: brsfolder.c:73

Referenced by BrsFolder_OnNotify(), and BrsFolder_Treeview_Rename().

◆ BrsFolder_Treeview_Delete()

static LRESULT BrsFolder_Treeview_Delete ( browse_info info,
NMTREEVIEWW pnmtv 
)
static

Definition at line 524 of file brsfolder.c.

525 {
526  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA)pnmtv->itemOld.lParam;
527 
528  TRACE("TVN_DELETEITEMA/W %p\n", lptvid);
529 
530  IShellFolder_Release(lptvid->lpsfParent);
531  if (lptvid->pEnumIL)
532  IEnumIDList_Release(lptvid->pEnumIL);
533  SHFree(lptvid->lpi);
534  SHFree(lptvid->lpifq);
535  SHFree(lptvid);
536  return 0;
537 }
TVITEMW itemOld
Definition: commctrl.h:3637
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
LPARAM lParam
Definition: commctrl.h:3325
IEnumIDList * pEnumIL
Definition: brsfolder.c:75
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
#define TRACE(s)
Definition: solgame.cpp:4
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
LPITEMIDLIST lpi
Definition: brsfolder.c:73

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Expand()

static LRESULT BrsFolder_Treeview_Expand ( browse_info info,
NMTREEVIEWW pnmtv 
)
static

Definition at line 539 of file brsfolder.c.

540 {
541  IShellFolder *lpsf2 = NULL;
542  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
543  HRESULT r;
544 
545  TRACE("TVN_ITEMEXPANDINGA/W\n");
546 
547  if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))
548  return 0;
549 
550  if (!_ILIsEmpty(lptvid->lpi)) {
551  r = IShellFolder_BindToObject( lptvid->lpsfParent, lptvid->lpi, 0,
552  &IID_IShellFolder, (void**)&lpsf2 );
553  } else {
554  lpsf2 = lptvid->lpsfParent;
555  IShellFolder_AddRef(lpsf2);
556  r = S_OK;
557  }
558 
559  if (SUCCEEDED(r))
560  {
561  FillTreeView( info, lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem, lptvid->pEnumIL);
562  IShellFolder_Release( lpsf2 );
563  }
564 
565  /* My Computer is already sorted and trying to do a simple text
566  * sort will only mess things up */
567  if (!_ILIsMyComputer(lptvid->lpi))
568  SendMessageW( info->hwndTreeView, TVM_SORTCHILDREN,
569  FALSE, (LPARAM)pnmtv->itemNew.hItem );
570 
571  return 0;
572 }
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:257
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
#define TVM_SORTCHILDREN
Definition: commctrl.h:3541
BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
Definition: pidl.c:1931
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LPARAM lParam
Definition: commctrl.h:3325
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3285
#define FALSE
Definition: types.h:117
IEnumIDList * pEnumIL
Definition: brsfolder.c:75
if SUCCEEDED(hr)
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
TVITEMW itemNew
Definition: commctrl.h:3638
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:52
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void FillTreeView(browse_info *, LPSHELLFOLDER, LPITEMIDLIST, HTREEITEM, IEnumIDList *)
#define NULL
Definition: types.h:112
HTREEITEM hItem
Definition: commctrl.h:3317
UINT state
Definition: commctrl.h:3318
LPITEMIDLIST lpi
Definition: brsfolder.c:73

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Keydown()

static LRESULT BrsFolder_Treeview_Keydown ( browse_info info,
LPNMTVKEYDOWN  keydown 
)
static

Definition at line 672 of file brsfolder.c.

673 {
674  HTREEITEM selected_item;
675 
676  /* Old dialog doesn't support those advanced features */
677 #ifdef __REACTOS__
678  if (!(info->lpBrowseInfo->ulFlags & BIF_USENEWUI))
679 #else
680  if (!(info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
681 #endif
682  return 0;
683 
684  selected_item = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);
685 
686  switch (keydown->wVKey)
687  {
688  case VK_F2:
689  BrsFolder_Rename(info, selected_item);
690  break;
691  case VK_DELETE:
692  {
693 #ifdef __REACTOS__
694  BrsFolder_Delete(info, selected_item);
695 #else
696  const ITEMIDLIST *item_id;
697  ISFHelper *psfhlp;
698  HRESULT hr;
699  TVITEMW item;
700  TV_ITEMDATA *item_data;
701 
702  item.mask = TVIF_PARAM;
703  item.mask = TVIF_HANDLE|TVIF_PARAM;
704  item.hItem = selected_item;
705  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
706  item_data = (TV_ITEMDATA *)item.lParam;
707  item_id = item_data->lpi;
708 
709  hr = IShellFolder_QueryInterface(item_data->lpsfParent, &IID_ISFHelper, (void**)&psfhlp);
710  if(FAILED(hr))
711  return 0;
712 
713  /* perform the item deletion - tree view gets updated over shell notification */
714  ISFHelper_DeleteItems(psfhlp, 1, &item_id);
715  ISFHelper_Release(psfhlp);
716 #endif
717  }
718  break;
719  }
720  return 0;
721 }
HRESULT hr
Definition: shlfolder.c:183
#define TVGN_CARET
Definition: commctrl.h:3461
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3264
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
Definition: brsfolder.c:631
#define VK_F2
Definition: winuser.h:2246
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
#define VK_DELETE
Definition: winuser.h:2223
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1150
LONG HRESULT
Definition: typedefs.h:79
#define BIF_USENEWUI
Definition: shlobj.h:1151
#define TVIF_HANDLE
Definition: commctrl.h:3270
#define TVM_GETNEXTITEM
Definition: commctrl.h:3449
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TVM_GETITEMW
Definition: commctrl.h:3486
#define TVIF_PARAM
Definition: commctrl.h:3268
LPITEMIDLIST lpi
Definition: brsfolder.c:73

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Rename()

static LRESULT BrsFolder_Treeview_Rename ( browse_info info,
NMTVDISPINFOW pnmtv 
)
static

Definition at line 591 of file brsfolder.c.

592 {
593  LPTV_ITEMDATA item_data;
594  WCHAR old_path[MAX_PATH], new_path[MAX_PATH], *p;
595  NMTREEVIEWW nmtv;
596  TVITEMW item;
597 
598  if(!pnmtv->item.pszText)
599  return 0;
600 
601  item.mask = TVIF_HANDLE|TVIF_PARAM;
602  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);
603  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
604  item_data = (LPTV_ITEMDATA)item.lParam;
605 
606  SHGetPathFromIDListW(item_data->lpifq, old_path);
607  if(!(p = strrchrW(old_path, '\\')))
608  return 0;
609  p = new_path+(p-old_path+1);
610  memcpy(new_path, old_path, (p-new_path)*sizeof(WCHAR));
611  strcpyW(p, pnmtv->item.pszText);
612 
613  if(!MoveFileW(old_path, new_path))
614  return 0;
615 
616  SHFree(item_data->lpifq);
617  SHFree(item_data->lpi);
618  item_data->lpifq = SHSimpleIDListFromPathW(new_path);
619  IShellFolder_ParseDisplayName(item_data->lpsfParent, NULL, NULL,
620  pnmtv->item.pszText, NULL, &item_data->lpi, NULL);
621 
622  item.mask = TVIF_HANDLE|TVIF_TEXT;
623  item.pszText = pnmtv->item.pszText;
624  SendMessageW(info->hwndTreeView, TVM_SETITEMW, 0, (LPARAM)&item);
625 
626  nmtv.itemNew.lParam = item.lParam;
628  return 0;
629 }
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
#define TVGN_CARET
Definition: commctrl.h:3461
static HRESULT BrsFolder_Treeview_Changed(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:574
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3264
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
LPARAM lParam
Definition: commctrl.h:3325
LPWSTR pszText
Definition: commctrl.h:3320
#define TVM_SETITEMW
Definition: commctrl.h:3493
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1104
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
TVITEMW itemNew
Definition: commctrl.h:3638
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW(LPCWSTR lpszPath)
Definition: pidl.c:1120
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TVIF_HANDLE
Definition: commctrl.h:3270
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
#define TVM_GETNEXTITEM
Definition: commctrl.h:3449
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
static ATOM item
Definition: dde.c:856
#define TVIF_TEXT
Definition: commctrl.h:3266
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
TVITEMW item
Definition: commctrl.h:3672
#define TVM_GETITEMW
Definition: commctrl.h:3486
#define TVIF_PARAM
Definition: commctrl.h:3268
GLfloat GLfloat p
Definition: glext.h:8902
LPITEMIDLIST lpi
Definition: brsfolder.c:73

Referenced by BrsFolder_OnNotify().

◆ BrsFolderDlgProc()

static INT_PTR CALLBACK BrsFolderDlgProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1272 of file brsfolder.c.

1274 {
1275  browse_info *info;
1276 
1277  TRACE("hwnd=%p msg=%04x 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam );
1278 
1279  if (msg == WM_INITDIALOG)
1280  return BrsFolder_OnCreate( hWnd, (browse_info*) lParam );
1281 
1282  info = GetPropW( hWnd, L"__WINE_BRSFOLDERDLG_INFO" );
1283 
1284  switch (msg)
1285  {
1286  case WM_NOTIFY:
1288 
1289  case WM_COMMAND:
1290  return BrsFolder_OnCommand( info, wParam );
1291 
1292 #ifdef __REACTOS__
1293  case WM_GETMINMAXINFO:
1294  ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = info->szMin.cx;
1295  ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = info->szMin.cy;
1296  return 0;
1297 #else /* This is a buggy way (resize on title bar) */
1298  case WM_WINDOWPOSCHANGING:
1300 #endif
1301 
1302  case WM_SIZE:
1303  if (info->layout) /* new style dialogs */
1305  return 0;
1306 
1307  case BFFM_SETSTATUSTEXTA:
1308  TRACE("Set status %s\n", debugstr_a((LPSTR)lParam));
1310  break;
1311 
1312  case BFFM_SETSTATUSTEXTW:
1313  TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam));
1315  break;
1316 
1317  case BFFM_ENABLEOK:
1318  TRACE("Enable %ld\n", lParam);
1319  EnableWindow(GetDlgItem(hWnd, 1), lParam != 0);
1320  break;
1321 
1322  case BFFM_SETOKTEXT: /* unicode only */
1323  TRACE("Set OK text %s\n", debugstr_w((LPWSTR)lParam));
1325  break;
1326 
1327  case BFFM_SETSELECTIONA:
1329 
1330  case BFFM_SETSELECTIONW:
1332 
1333  case BFFM_SETEXPANDED: /* unicode only */
1335 
1336  case SHV_CHANGE_NOTIFY:
1338 
1339  case WM_DESTROY:
1340  return BrsFolder_OnDestroy(info);
1341  }
1342  return FALSE;
1343 }
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:415
static BOOL BrsFolder_OnSetSelectionA(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1164
#define LAYOUT_INFO_COUNT
Definition: brsfolder.c:105
static LRESULT BrsFolder_OnChange(browse_info *info, const LPCITEMIDLIST *pidls, LONG event)
Definition: brsfolder.c:1246
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
HWND hWnd
Definition: settings.c:17
#define BFFM_SETSELECTIONA
Definition: shlobj.h:1172
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
char * LPSTR
Definition: xmlstorage.h:182
#define BFFM_SETEXPANDED
Definition: shlobj.h:1176
WPARAM wParam
Definition: combotst.c:138
#define L(x)
Definition: ntvdm.h:50
static LRESULT BrsFolder_OnNotify(browse_info *info, UINT CtlID, LPNMHDR lpnmh)
Definition: brsfolder.c:723
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define debugstr_w
Definition: kernel32.h:32
struct tagMINMAXINFO * LPMINMAXINFO
#define SHV_CHANGE_NOTIFY
Definition: brsfolder.c:48
#define BFFM_SETSELECTIONW
Definition: shlobj.h:1173
static BOOL BrsFolder_OnSetSelectionW(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1152
#define WM_DESTROY
Definition: winuser.h:1599
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static void LayoutUpdate(HWND hwnd, LAYOUT_DATA *data, const LAYOUT_INFO *layout_info, int layout_count)
Definition: brsfolder.c:163
#define WM_SIZE
Definition: winuser.h:1601
#define debugstr_a
Definition: kernel32.h:31
static BOOL BrsFolder_OnSetExpanded(browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem)
Definition: brsfolder.c:1062
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1651
static LRESULT BrsFolder_OnWindowPosChanging(browse_info *info, WINDOWPOS *pos)
Definition: brsfolder.c:1184
#define WM_COMMAND
Definition: winuser.h:1730
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BFFM_ENABLEOK
Definition: shlobj.h:1171
static INT BrsFolder_OnDestroy(browse_info *info)
Definition: brsfolder.c:1201
static BOOL BrsFolder_OnCommand(browse_info *info, UINT id)
Definition: brsfolder.c:1017
#define BFFM_SETSTATUSTEXTA
Definition: shlobj.h:1170
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static BOOL BrsFolder_OnCreate(HWND hWnd, browse_info *info)
Definition: brsfolder.c:762
#define msg(x)
Definition: auth_time.c:54
#define BFFM_SETOKTEXT
Definition: shlobj.h:1175
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define BFFM_SETSTATUSTEXTW
Definition: shlobj.h:1174
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define WM_GETMINMAXINFO
Definition: winuser.h:1630
static const LAYOUT_INFO g_layout_info[]
Definition: brsfolder.c:86
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by SHBrowseForFolderW().

◆ FillTreeView() [1/2]

static void FillTreeView ( browse_info ,
LPSHELLFOLDER  ,
LPITEMIDLIST  ,
HTREEITEM  ,
IEnumIDList  
)
static

◆ FillTreeView() [2/2]

static void FillTreeView ( browse_info info,
IShellFolder lpsf,
LPITEMIDLIST  pidl,
HTREEITEM  hParent,
IEnumIDList lpe 
)
static

Definition at line 426 of file brsfolder.c.

428 {
429  LPITEMIDLIST pidlTemp = 0;
430  ULONG ulFetched;
431  HRESULT hr;
432  HWND hwnd = GetParent( info->hwndTreeView );
433 
434  TRACE("%p %p %p %p\n",lpsf, pidl, hParent, lpe);
435 
436  /* No IEnumIDList -> No children */
437  if (!lpe) return;
438 
439  SetCapture( hwnd );
441 
442  while (S_OK == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))
443  {
444  ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER;
445  IEnumIDList* pEnumIL = NULL;
446  IShellFolder* pSFChild = NULL;
447  IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulAttrs);
448  if (ulAttrs & SFGAO_FOLDER)
449  {
450  hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild);
451  if (SUCCEEDED(hr))
452  {
453  DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
454  hr = IShellFolder_EnumObjects(pSFChild, hwnd, flags, &pEnumIL);
455  if (hr == S_OK)
456  {
457  if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) ||
458  FAILED(IEnumIDList_Reset(pEnumIL)))
459  {
460  IEnumIDList_Release(pEnumIL);
461  pEnumIL = NULL;
462  }
463  }
464  IShellFolder_Release(pSFChild);
465  }
466  }
467 
468  if (!InsertTreeViewItem(info, lpsf, pidlTemp, pidl, pEnumIL, hParent))
469  goto done;
470  SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */
471  pidlTemp=NULL;
472  }
473 
474 done:
475  ReleaseCapture();
477  SHFree(pidlTemp);
478 }
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
Definition: brsfolder.c:374
HRESULT hr
Definition: shlfolder.c:183
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
char * LPSTR
Definition: xmlstorage.h:182
static DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
Definition: brsfolder.c:120
if SUCCEEDED(hr)
#define IDC_WAIT
Definition: winuser.h:684
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
GLbitfield flags
Definition: glext.h:7161
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
HWND WINAPI GetParent(_In_ HWND)
#define S_OK
Definition: intsafe.h:52
HWND WINAPI SetCapture(_In_ HWND hWnd)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define NULL
Definition: types.h:112
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

◆ GetIcon()

static int GetIcon ( LPCITEMIDLIST  lpi,
UINT  uFlags 
)
static

Definition at line 299 of file brsfolder.c.

300 {
301  SHFILEINFOW sfi;
302  SHGetFileInfoW((LPCWSTR)lpi, 0 ,&sfi, sizeof(SHFILEINFOW), uFlags);
303  return sfi.iIcon;
304 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
UINT uFlags
Definition: api.c:59
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:414

Referenced by DECLARE_INTERFACE_(), and GetNormalAndSelectedIcons().

◆ GetName()

static BOOL GetName ( LPSHELLFOLDER  lpsf,
LPCITEMIDLIST  lpi,
DWORD  dwFlags,
LPWSTR  lpFriendlyName 
)
static

Definition at line 344 of file brsfolder.c.

345 {
347  STRRET str;
348 
349  TRACE("%p %p %x %p\n", lpsf, lpi, dwFlags, lpFriendlyName);
350  if (SUCCEEDED(IShellFolder_GetDisplayNameOf(lpsf, lpi, dwFlags, &str)))
351  bSuccess = StrRetToStrNW(lpFriendlyName, MAX_PATH, &str, lpi);
352  else
353  bSuccess = FALSE;
354 
355  TRACE("-- %s\n", debugstr_w(lpFriendlyName));
356  return bSuccess;
357 }
#define TRUE
Definition: types.h:120
static BOOLEAN bSuccess
Definition: drive.cpp:433
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
const WCHAR * str
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_PATH
Definition: compat.h:34
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
BOOL WINAPI StrRetToStrNW(LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
Definition: shellstring.c:85

Referenced by BrsFolder_Treeview_Changed(), and InsertTreeViewItem().

◆ GetNormalAndSelectedIcons()

static void GetNormalAndSelectedIcons ( LPITEMIDLIST  lpifq,
LPTVITEMW  lpTV_ITEM 
)
static

Definition at line 306 of file brsfolder.c.

307 {
308  LPITEMIDLIST pidlDesktop = NULL;
309  DWORD flags;
310 
311  TRACE("%p %p\n",lpifq, lpTV_ITEM);
312 
313  if (!lpifq)
314  {
315  pidlDesktop = _ILCreateDesktop();
316  lpifq = pidlDesktop;
317  }
318 
320  lpTV_ITEM->iImage = GetIcon( lpifq, flags );
321 
323  lpTV_ITEM->iSelectedImage = GetIcon( lpifq, flags );
324 
325  if (pidlDesktop)
326  ILFree( pidlDesktop );
327 }
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:169
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1602
int iImage
Definition: commctrl.h:3322
#define SHGFI_SMALLICON
Definition: shellapi.h:174
#define SHGFI_PIDL
Definition: shellapi.h:178
#define SHGFI_OPENICON
Definition: shellapi.h:176
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
static int GetIcon(LPCITEMIDLIST lpi, UINT uFlags)
Definition: brsfolder.c:299
int iSelectedImage
Definition: commctrl.h:3323
#define NULL
Definition: types.h:112
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by InsertTreeViewItem().

◆ InitializeTreeView()

static void InitializeTreeView ( browse_info info)
static

Definition at line 206 of file brsfolder.c.

207 {
208  LPITEMIDLIST pidlParent, pidlChild;
209  HIMAGELIST hImageList;
210  HRESULT hr;
211  IShellFolder *lpsfParent, *lpsfRoot;
212  IEnumIDList * pEnumChildren = NULL;
213  HTREEITEM item;
214  DWORD flags;
215  LPCITEMIDLIST root = info->lpBrowseInfo->pidlRoot;
216 
217  TRACE("%p\n", info );
218 
219  Shell_GetImageLists(NULL, &hImageList);
220 
221  if (hImageList)
222  SendMessageW( info->hwndTreeView, TVM_SETIMAGELIST, 0, (LPARAM)hImageList );
223 
224  /* We want to call InsertTreeViewItem down the code, in order to insert
225  * the root item of the treeview. Due to InsertTreeViewItem's signature,
226  * we need the following to do this:
227  *
228  * + An ITEMIDLIST corresponding to _the parent_ of root.
229  * + An ITEMIDLIST, which is a relative path from root's parent to root
230  * (containing a single SHITEMID).
231  * + An IShellFolder interface pointer of root's parent folder.
232  *
233  * If root is 'Desktop', then root's parent is also 'Desktop'.
234  */
235 
236  pidlParent = ILClone(root);
237  ILRemoveLastID(pidlParent);
238  pidlChild = ILClone(ILFindLastID(root));
239 
240  if (_ILIsDesktop(pidlParent)) {
241  hr = SHGetDesktopFolder(&lpsfParent);
242  } else {
243  IShellFolder *lpsfDesktop;
244  hr = SHGetDesktopFolder(&lpsfDesktop);
245  if (FAILED(hr)) {
246  WARN("SHGetDesktopFolder failed! hr = %08x\n", hr);
247  ILFree(pidlChild);
248  ILFree(pidlParent);
249  return;
250  }
251  hr = IShellFolder_BindToObject(lpsfDesktop, pidlParent, 0, &IID_IShellFolder, (LPVOID*)&lpsfParent);
252  IShellFolder_Release(lpsfDesktop);
253  }
254 
255  if (FAILED(hr)) {
256  WARN("Could not bind to parent shell folder! hr = %08x\n", hr);
257  ILFree(pidlChild);
258  ILFree(pidlParent);
259  return;
260  }
261 
262  if (!_ILIsEmpty(pidlChild)) {
263  hr = IShellFolder_BindToObject(lpsfParent, pidlChild, 0, &IID_IShellFolder, (LPVOID*)&lpsfRoot);
264  } else {
265  lpsfRoot = lpsfParent;
266  hr = IShellFolder_AddRef(lpsfParent);
267  }
268 
269  if (FAILED(hr)) {
270  WARN("Could not bind to root shell folder! hr = %08x\n", hr);
271  IShellFolder_Release(lpsfParent);
272  ILFree(pidlChild);
273  ILFree(pidlParent);
274  return;
275  }
276 
277  flags = BrowseFlagsToSHCONTF( info->lpBrowseInfo->ulFlags );
278  hr = IShellFolder_EnumObjects( lpsfRoot, info->hWnd, flags, &pEnumChildren );
279  if (FAILED(hr)) {
280  WARN("Could not get child iterator! hr = %08x\n", hr);
281  IShellFolder_Release(lpsfParent);
282  IShellFolder_Release(lpsfRoot);
283  ILFree(pidlChild);
284  ILFree(pidlParent);
285  return;
286  }
287 
288  SendMessageW( info->hwndTreeView, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT );
289  item = InsertTreeViewItem( info, lpsfParent, pidlChild,
290  pidlParent, pEnumChildren, TVI_ROOT );
291  SendMessageW( info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)item );
292 
293  ILFree(pidlChild);
294  ILFree(pidlParent);
295  IShellFolder_Release(lpsfRoot);
296  IShellFolder_Release(lpsfParent);
297 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:257
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
Definition: brsfolder.c:374
HRESULT hr
Definition: shlfolder.c:183
#define TVM_EXPAND
Definition: commctrl.h:3419
#define WARN(fmt,...)
Definition: debug.h:112
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:212
static DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
Definition: brsfolder.c:120
#define TVM_SETIMAGELIST
Definition: commctrl.h:3446
LONG_PTR LPARAM
Definition: windef.h:208
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TVE_EXPAND
Definition: commctrl.h:3423
GLbitfield flags
Definition: glext.h:7161
#define TVI_ROOT
Definition: commctrl.h:3368
#define TVM_DELETEITEM
Definition: commctrl.h:3414
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:700
static ATOM item
Definition: dde.c:856
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by BrsFolder_OnCreate().

◆ InsertTreeViewItem()

static HTREEITEM InsertTreeViewItem ( browse_info info,
IShellFolder lpsf,
LPCITEMIDLIST  pidl,
LPCITEMIDLIST  pidlParent,
IEnumIDList pEnumIL,
HTREEITEM  hParent 
)
static

Definition at line 374 of file brsfolder.c.

377 {
378  TVITEMW tvi;
379  TVINSERTSTRUCTW tvins;
380  WCHAR szBuff[MAX_PATH];
381  LPTV_ITEMDATA lptvid=0;
382 
384 
385  tvi.cChildren= pEnumIL ? 1 : 0;
386  tvi.mask |= TVIF_CHILDREN;
387 
388  if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff))
389  return NULL;
390 
391  lptvid = SHAlloc( sizeof(TV_ITEMDATA) );
392  if (!lptvid)
393  return NULL;
394 
395  tvi.pszText = szBuff;
396  tvi.cchTextMax = MAX_PATH;
397  tvi.lParam = (LPARAM)lptvid;
398 
399  IShellFolder_AddRef(lpsf);
400  lptvid->lpsfParent = lpsf;
401  lptvid->lpi = ILClone(pidl);
402  lptvid->lpifq = pidlParent ? ILCombine(pidlParent, pidl) : ILClone(pidl);
403  lptvid->pEnumIL = pEnumIL;
404  GetNormalAndSelectedIcons(lptvid->lpifq, &tvi);
405 
406  tvins.u.item = tvi;
407  tvins.hInsertAfter = NULL;
408  tvins.hParent = hParent;
409 
410  return TreeView_InsertItem( info->hwndTreeView, &tvins );
411 }
int cchTextMax
Definition: commctrl.h:3321
HTREEITEM hParent
Definition: commctrl.h:3393
static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
Definition: brsfolder.c:306
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
Definition: brsfolder.c:344
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
LPARAM lParam
Definition: commctrl.h:3325
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3271
UINT mask
Definition: commctrl.h:3316
LPWSTR pszText
Definition: commctrl.h:3320
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3412
#define TVIF_CHILDREN
Definition: commctrl.h:3272
HTREEITEM hInsertAfter
Definition: commctrl.h:3394
IEnumIDList * pEnumIL
Definition: brsfolder.c:75
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
int cChildren
Definition: commctrl.h:3324
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define TVIF_TEXT
Definition: commctrl.h:3266
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define TVIF_IMAGE
Definition: commctrl.h:3267
#define NULL
Definition: types.h:112
#define TVIF_PARAM
Definition: commctrl.h:3268
LPITEMIDLIST lpi
Definition: brsfolder.c:73
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304

Referenced by BrsFolder_NewFolder(), FillTreeView(), and InitializeTreeView().

◆ LayoutInit()

static LAYOUT_DATA* LayoutInit ( HWND  hwnd,
const LAYOUT_INFO layout_info,
int  layout_count 
)
static

Definition at line 134 of file brsfolder.c.

135 {
136  LAYOUT_DATA *data;
137  RECT rcWnd;
138  int i;
139 
140  GetClientRect(hwnd, &rcWnd);
141  data = SHAlloc(sizeof(LAYOUT_DATA)*layout_count);
142  for (i = 0; i < layout_count; i++)
143  {
144  RECT r;
145  HWND hItem = GetDlgItem(hwnd, layout_info[i].iItemId);
146 
147  if (hItem == NULL)
148  ERR("Item %d not found\n", i);
149  GetWindowRect(hItem, &r);
151 
152  data[i].left = r.left;
153  data[i].right = rcWnd.right - r.right;
154  data[i].width = r.right - r.left;
155 
156  data[i].top = r.top;
157  data[i].bottom = rcWnd.bottom - r.bottom;
158  data[i].height = r.bottom - r.top;
159  }
160  return data;
161 }
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG right
Definition: windef.h:308
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define ERR(fmt,...)
Definition: debug.h:110
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
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 HWND_DESKTOP
Definition: winuser.h:1199
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304

Referenced by BrsFolder_OnCreate().

◆ LayoutUpdate()

static void LayoutUpdate ( HWND  hwnd,
LAYOUT_DATA data,
const LAYOUT_INFO layout_info,
int  layout_count 
)
static

Definition at line 163 of file brsfolder.c.

164 {
165  RECT rcWnd;
166  int i;
167 
168  GetClientRect(hwnd, &rcWnd);
169  for (i = 0; i < layout_count; i++)
170  {
171  RECT r;
172  HWND hItem = GetDlgItem(hwnd, layout_info[i].iItemId);
173 
174  GetWindowRect(hItem, &r);
176 
177  if (layout_info[i].dwAnchor & BF_RIGHT)
178  {
179  r.right = rcWnd.right - data[i].right;
180  if (!(layout_info[i].dwAnchor & BF_LEFT))
181  r.left = r.right - data[i].width;
182  }
183 
184  if (layout_info[i].dwAnchor & BF_BOTTOM)
185  {
186  r.bottom = rcWnd.bottom - data[i].bottom;
187  if (!(layout_info[i].dwAnchor & BF_TOP))
188  r.top = r.bottom - data[i].height;
189  }
190 
191  SetWindowPos(hItem, NULL, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER);
192  }
193 }
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define BF_BOTTOM
Definition: winuser.h:457
#define SWP_NOZORDER
Definition: winuser.h:1237
LONG right
Definition: windef.h:308
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BF_RIGHT
Definition: winuser.h:456
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
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 BF_TOP
Definition: winuser.h:455
#define HWND_DESKTOP
Definition: winuser.h:1199
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
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)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define BF_LEFT
Definition: winuser.h:454

Referenced by BrsFolderDlgProc().

◆ PIDLIsType()

static BOOL PIDLIsType ( LPCITEMIDLIST  pidl,
PIDLTYPE  type 
)
inlinestatic

Definition at line 480 of file brsfolder.c.

481 {
483  if (!data)
484  return FALSE;
485  return (data->type == type);
486 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2187
#define FALSE
Definition: types.h:117
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by BrsFolder_CheckValidSelection().

◆ SHBrowseForFolderA()

LPITEMIDLIST WINAPI SHBrowseForFolderA ( LPBROWSEINFOA  lpbi)

Definition at line 1349 of file brsfolder.c.

1350 {
1351  BROWSEINFOW bi;
1352  LPITEMIDLIST lpid;
1353  INT len;
1354  LPWSTR title;
1355 
1356  TRACE("%p\n", lpbi);
1357 
1358  bi.hwndOwner = lpbi->hwndOwner;
1359  bi.pidlRoot = lpbi->pidlRoot;
1360  if (lpbi->pszDisplayName)
1361  bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) );
1362  else
1363  bi.pszDisplayName = NULL;
1364 
1365  if (lpbi->lpszTitle)
1366  {
1367  len = MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, NULL, 0 );
1368  title = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
1369  MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, title, len );
1370  }
1371  else
1372  title = NULL;
1373 
1374  bi.lpszTitle = title;
1375  bi.ulFlags = lpbi->ulFlags;
1376  bi.lpfn = lpbi->lpfn;
1377  bi.lParam = lpbi->lParam;
1378  bi.iImage = lpbi->iImage;
1379  lpid = SHBrowseForFolderW( &bi );
1380  if (bi.pszDisplayName)
1381  {
1383  lpbi->pszDisplayName, MAX_PATH, 0, NULL);
1385  }
1386  HeapFree(GetProcessHeap(), 0, title);
1387  lpbi->iImage = bi.iImage;
1388  return lpid;
1389 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
HWND hwndOwner
Definition: shlobj.h:1127
BFFCALLBACK lpfn
Definition: shlobj.h:1121
int32_t INT
Definition: typedefs.h:58
LPSTR pszDisplayName
Definition: shlobj.h:1118
LPWSTR pszDisplayName
Definition: shlobj.h:1129
LPCWSTR lpszTitle
Definition: shlobj.h:1130
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
PCIDLIST_ABSOLUTE pidlRoot
Definition: shlobj.h:1117
LPCSTR lpszTitle
Definition: shlobj.h:1119
GLenum GLsizei len
Definition: glext.h:6722
PCIDLIST_ABSOLUTE pidlRoot
Definition: shlobj.h:1128
UINT ulFlags
Definition: shlobj.h:1120
LPITEMIDLIST WINAPI SHBrowseForFolderW(LPBROWSEINFOW lpbi)
Definition: brsfolder.c:1398
LPARAM lParam
Definition: shlobj.h:1122
UINT ulFlags
Definition: shlobj.h:1131
LPARAM lParam
Definition: shlobj.h:1133
BFFCALLBACK lpfn
Definition: shlobj.h:1132
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HWND hwndOwner
Definition: shlobj.h:1116
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static char title[]
Definition: ps.c:92
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by test_click_make_new_folder_button(), and test_selection().

◆ SHBrowseForFolderW()

LPITEMIDLIST WINAPI SHBrowseForFolderW ( LPBROWSEINFOW  lpbi)

Definition at line 1398 of file brsfolder.c.

1399 {
1400  browse_info info;
1401  DWORD r;
1402  HRESULT hr;
1403 #ifdef __REACTOS__
1404  WORD wDlgId;
1405 #else
1406  const WCHAR * templateName;
1407  INITCOMMONCONTROLSEX icex;
1408 #endif
1409 
1410  info.hWnd = 0;
1411  info.pidlRet = NULL;
1412  info.lpBrowseInfo = lpbi;
1413  info.hwndTreeView = NULL;
1414 
1415 #ifdef __REACTOS__
1416  info.layout = NULL;
1417 #else
1418  icex.dwSize = sizeof( icex );
1419  icex.dwICC = ICC_TREEVIEW_CLASSES;
1420  InitCommonControlsEx( &icex );
1421 #endif
1422 
1423  hr = OleInitialize(NULL);
1424 
1425 #ifdef __REACTOS__
1426  if (lpbi->ulFlags & BIF_USENEWUI)
1427 #else
1428  if (lpbi->ulFlags & BIF_NEWDIALOGSTYLE)
1429 #endif
1430  wDlgId = IDD_BROWSE_FOR_FOLDER_NEW;
1431  else
1432  wDlgId = IDD_BROWSE_FOR_FOLDER;
1435  if (SUCCEEDED(hr))
1436  OleUninitialize();
1437  if (!r)
1438  {
1439  ILFree(info.pidlRet);
1440  return NULL;
1441  }
1442 
1443  return info.pidlRet;
1444 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
HRESULT hr
Definition: shlfolder.c:183
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
HWND hwndOwner
Definition: shlobj.h:1127
#define ICC_TREEVIEW_CLASSES
Definition: commctrl.h:59
static struct _test_info info[]
Definition: SetCursorPos.c:19
if SUCCEEDED(hr)
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_BROWSE_FOR_FOLDER
Definition: shresdef.h:410
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1150
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define BIF_USENEWUI
Definition: shlobj.h:1151
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define IDD_BROWSE_FOR_FOLDER_NEW
Definition: shresdef.h:411
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
UINT ulFlags
Definition: shlobj.h:1131
#define shell32_hInstance
#define NULL
Definition: types.h:112
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static INT_PTR CALLBACK BrsFolderDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: brsfolder.c:1272
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230

Referenced by CBandSiteMenu::_CreateNewISFBand(), BtrfsSend::AddClone(), CShellDispatch::BrowseForFolder(), BtrfsSend::BrowseParent(), ChooseFolder(), FileExtractDialogWndProc(), CZipExtract::CExtractSettingsPage::OnBrowse(), SHBrowseForFolderA(), SHBrowseForFolderWrapW(), and WelcomeDlgProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ g_layout_info

const LAYOUT_INFO g_layout_info[]
static
Initial value:
=
{
}
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:413
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:415
#define IDOK
Definition: winuser.h:824
#define BF_BOTTOM
Definition: winuser.h:457
#define IDC_BROWSE_FOR_FOLDER_TITLE
Definition: shresdef.h:416
#define IDC_BROWSE_FOR_FOLDER_FOLDER
Definition: shresdef.h:414
#define BF_RIGHT
Definition: winuser.h:456
#define BF_TOP
Definition: winuser.h:455
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:417
#define IDCANCEL
Definition: winuser.h:825
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:412
#define BF_LEFT
Definition: winuser.h:454

Definition at line 86 of file brsfolder.c.

Referenced by BrsFolder_OnCreate(), and BrsFolderDlgProc().