ReactOS  0.4.15-dev-2534-geba00d1
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 []
 
static const WCHAR szBrowseFolderInfo []
 
static const WCHAR swBrowseTemplateName []
 
static const WCHAR swNewBrowseTemplateName []
 

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 126 of file brsfolder.c.

127 {
128  return SHCONTF_FOLDERS | (ulFlags & BIF_BROWSEINCLUDEFILES ? SHCONTF_NONFOLDERS : 0);
129 }
#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 131 of file brsfolder.c.

133 {
134  if (!lpBrowseInfo->lpfn)
135  return;
136  lpBrowseInfo->lpfn( hWnd, msg, param, lpBrowseInfo->lParam );
137 }
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 494 of file brsfolder.c.

495 {
496  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
497  LPCITEMIDLIST pidl = lptvid->lpi;
498  BOOL bEnabled = TRUE;
500  HRESULT r;
501 
502  if ((lpBrowseInfo->ulFlags & BIF_BROWSEFORCOMPUTER) &&
503  !PIDLIsType(pidl, PT_COMP))
504  bEnabled = FALSE;
505  if (lpBrowseInfo->ulFlags & BIF_RETURNFSANCESTORS)
506  {
507  dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
508  r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
509  (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
510  if (FAILED(r) || !(dwAttributes & (SFGAO_FILESYSANCESTOR|SFGAO_FILESYSTEM)))
511  bEnabled = FALSE;
512  }
513 
514  dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSTEM;
515  r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
516  (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
517  if (FAILED(r) ||
518  ((dwAttributes & (SFGAO_FOLDER|SFGAO_FILESYSTEM)) != (SFGAO_FOLDER|SFGAO_FILESYSTEM)))
519  {
520  if (lpBrowseInfo->ulFlags & BIF_RETURNONLYFSDIRS)
521  bEnabled = FALSE;
523  }
524  else
526 
527  SendMessageW(info->hWnd, BFFM_ENABLEOK, 0, bEnabled);
528 }
#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:486
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:404

Referenced by BrsFolder_Treeview_Changed().

◆ BrsFolder_FindItemByPidl()

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

Definition at line 1225 of file brsfolder.c.

1226 {
1227  TV_ITEMW item;
1228  TV_ITEMDATA *item_data;
1229  HRESULT hr;
1230 
1231  item.mask = TVIF_HANDLE | TVIF_PARAM;
1232  item.hItem = hItem;
1233  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
1234  item_data = (TV_ITEMDATA *)item.lParam;
1235 
1236  hr = IShellFolder_CompareIDs(item_data->lpsfParent, 0, item_data->lpifq, pidl);
1237  if(SUCCEEDED(hr) && !HRESULT_CODE(hr))
1238  return hItem;
1239 
1241 
1242  while (hItem)
1243  {
1244  HTREEITEM newItem = BrsFolder_FindItemByPidl(info, pidl, hItem);
1245  if (newItem)
1246  return newItem;
1248  }
1249  return NULL;
1250 }
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:1225
#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 892 of file brsfolder.c.

893 {
894  DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
895  IShellFolder *desktop, *cur;
896 #ifdef __REACTOS__
897  WCHAR wszNewFolder[25];
899 #else
900  ISFHelper *sfhelper;
901 #endif
903  HTREEITEM parent, added;
904  LPTV_ITEMDATA item_data;
905  LPITEMIDLIST new_item;
906  TVITEMW item;
907  HRESULT hr;
908  int len;
909 
910 #ifdef __REACTOS__
911  hr = SHGetDesktopFolder(&desktop);
912  if(FAILED(hr))
913  return hr;
914 
915  if (info->pidlRet)
916  {
917  hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur);
918  IShellFolder_Release(desktop);
919  if(FAILED(hr))
920  return hr;
921 
922  hr = SHGetPathFromIDListW(info->pidlRet, path);
923  }
924  else
925  {
926  cur = desktop;
928  }
929  if(FAILED(hr))
930  return hr;
931 
932  if (!LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, _countof(wszNewFolder)))
933  return E_FAIL;
934 
935  if (!PathYetAnotherMakeUniqueName(name, path, NULL, wszNewFolder))
936  return E_FAIL;
937 
938  len = strlenW(path);
939  if(len<MAX_PATH && name[len] == L'\\')
940  len++;
941 #else
942  if(!info->pidlRet) {
943  ERR("Make new folder button should be disabled\n");
944  return E_FAIL;
945  }
946 
947  /* Create new directory */
948  hr = SHGetDesktopFolder(&desktop);
949  if(FAILED(hr))
950  return hr;
951 
952  hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur);
953  IShellFolder_Release(desktop);
954  if(FAILED(hr))
955  return hr;
956 
957  hr = IShellFolder_QueryInterface(cur, &IID_ISFHelper, (void**)&sfhelper);
958  if(FAILED(hr))
959  return hr;
960 
961  if(!SHGetPathFromIDListW(info->pidlRet, name)) {
962  hr = E_FAIL;
963  goto cleanup;
964  }
965 
966  len = strlenW(name);
967  if(len<MAX_PATH)
968  name[len++] = '\\';
969  hr = ISFHelper_GetUniqueName(sfhelper, &name[len], MAX_PATH-len);
970  ISFHelper_Release(sfhelper);
971  if(FAILED(hr))
972  goto cleanup;
973 #endif
974 
975  hr = E_FAIL;
976  if(!CreateDirectoryW(name, NULL))
977  goto cleanup;
978 
979  /* Update parent of newly created directory */
981  if(!parent)
982  goto cleanup;
983 
984  SendMessageW(info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)parent);
985 
986  memset(&item, 0, sizeof(TVITEMW));
987  item.mask = TVIF_PARAM|TVIF_STATE;
988  item.hItem = parent;
989  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
990  item_data = (LPTV_ITEMDATA)item.lParam;
991  if(!item_data)
992  goto cleanup;
993 
994  if(item_data->pEnumIL)
995  IEnumIDList_Release(item_data->pEnumIL);
996  hr = IShellFolder_EnumObjects(cur, info->hwndTreeView, flags, &item_data->pEnumIL);
997  if(FAILED(hr))
998  goto cleanup;
999 
1000  /* Update treeview */
1001  if(!(item.state&TVIS_EXPANDEDONCE)) {
1002  item.mask = TVIF_STATE;
1003  item.state = TVIS_EXPANDEDONCE;
1004  item.stateMask = TVIS_EXPANDEDONCE;
1005  SendMessageW(info->hwndTreeView, TVM_SETITEMW, 0, (LPARAM)&item);
1006  }
1007 
1008  hr = IShellFolder_ParseDisplayName(cur, NULL, NULL, name+len, NULL, &new_item, NULL);
1009  if(FAILED(hr))
1010  goto cleanup;
1011 
1012  added = InsertTreeViewItem(info, cur, new_item, item_data->lpifq, NULL, parent);
1013  IShellFolder_Release(cur);
1014  SHFree(new_item);
1015 
1016  SendMessageW(info->hwndTreeView, TVM_SORTCHILDREN, FALSE, (LPARAM)parent);
1017  return BrsFolder_Rename(info, added);
1018 
1019 cleanup:
1020  return hr;
1021 }
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:380
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:126
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
Definition: brsfolder.c:637
#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:2944
__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
static const WCHAR L[]
Definition: oid.c:1250
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:331
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2208
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:368
#define TVIF_PARAM
Definition: commctrl.h:3268
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2027
#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 1252 of file brsfolder.c.

1253 {
1254  BOOL ret = TRUE;
1255 
1256  TRACE("(%p)->(%p, %p, 0x%08x)\n", info, pidls[0], pidls[1], event);
1257 
1258  switch (event)
1259  {
1260  case SHCNE_RMDIR:
1261  case SHCNE_DELETE:
1262  {
1263  HTREEITEM handle_root = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_ROOT, 0);
1264  HTREEITEM handle_item = BrsFolder_FindItemByPidl(info, pidls[0], handle_root);
1265 
1266  if (handle_item)
1267  SendMessageW(info->hwndTreeView, TVM_DELETEITEM, 0, (LPARAM)handle_item);
1268 
1269  break;
1270  }
1271  }
1272  return ret;
1273 }
#define SHCNE_RMDIR
Definition: shlobj.h:1733
#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:1731
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:1225

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnCommand()

static BOOL BrsFolder_OnCommand ( browse_info info,
UINT  id 
)
static

Definition at line 1023 of file brsfolder.c.

1024 {
1025  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
1026 #ifdef __REACTOS__
1028 #endif
1029 
1030  switch (id)
1031  {
1032  case IDOK:
1033 #ifdef __REACTOS__
1034  /* Get the text */
1036  StrTrimW(szPath, L" \t");
1037 
1038  /* The original pidl is owned by the treeview and will be free'd. */
1040  {
1041  /* It's valid path */
1042  info->pidlRet = ILCreateFromPathW(szPath);
1043  }
1044  else
1045  {
1046  info->pidlRet = ILClone(info->pidlRet);
1047  }
1048 #endif
1049  if (info->pidlRet == NULL) /* A null pidl would mean a cancel */
1050  info->pidlRet = _ILCreateDesktop();
1051  pdump( info->pidlRet );
1052  if (lpBrowseInfo->pszDisplayName)
1053  SHGetPathFromIDListW( info->pidlRet, lpBrowseInfo->pszDisplayName );
1054  EndDialog( info->hWnd, 1 );
1055  return TRUE;
1056 
1057  case IDCANCEL:
1058  EndDialog( info->hWnd, 0 );
1059  return TRUE;
1060 
1063  return TRUE;
1064  }
1065  return FALSE;
1066 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:405
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1702
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1558
#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 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 const WCHAR L[]
Definition: oid.c:1250
static HRESULT BrsFolder_NewFolder(browse_info *info)
Definition: brsfolder.c:892
LPCWSTR szPath
Definition: env.c:37
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248
#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:404

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnCreate()

static BOOL BrsFolder_OnCreate ( HWND  hWnd,
browse_info info 
)
static

Definition at line 768 of file brsfolder.c.

769 {
770  LPITEMIDLIST computer_pidl;
771  SHChangeNotifyEntry ntreg;
772  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
773 
774  info->hWnd = hWnd;
776 
777  if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
778  FIXME("flags BIF_NEWDIALOGSTYLE partially implemented\n");
779  if (lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS)
780  FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS);
781 
782 #ifdef __REACTOS__
783  if (lpBrowseInfo->ulFlags & BIF_USENEWUI)
784 #else
785  if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
786 #endif
787  {
788  RECT rcWnd;
789 
790 #ifdef __REACTOS__
791  /* Resize the treeview if there's not editbox */
792  if ((lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
793  && !(lpBrowseInfo->ulFlags & BIF_EDITBOX))
794  {
795  RECT rcEdit, rcTreeView;
796  INT cy;
799  cy = rcTreeView.top - rcEdit.top;
800  MapWindowPoints(NULL, hWnd, (LPPOINT)&rcTreeView, sizeof(RECT) / sizeof(POINT));
801  rcTreeView.top -= cy;
803  rcTreeView.left, rcTreeView.top,
804  rcTreeView.right - rcTreeView.left,
805  rcTreeView.bottom - rcTreeView.top, TRUE);
806  }
807  if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
809  else
810  info->layout = NULL;
811 #else
813 #endif
814 
815  /* TODO: Windows allows shrinking the windows a bit */
816  GetWindowRect(hWnd, &rcWnd);
817  info->szMin.cx = rcWnd.right - rcWnd.left;
818  info->szMin.cy = rcWnd.bottom - rcWnd.top;
819  }
820  else
821  {
822  info->layout = NULL;
823  }
824 
825  if (lpBrowseInfo->lpszTitle)
827  else
829 
830  if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT)
831 #ifdef __REACTOS__
832  || (lpBrowseInfo->ulFlags & BIF_USENEWUI))
833 #else
834  || (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
835 #endif
837 
838  /* Hide "Make New Folder" Button? */
839  if ((lpBrowseInfo->ulFlags & BIF_NONEWFOLDERBUTTON)
840  || !(lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
842 
843  /* Hide the editbox? */
844  if (!(lpBrowseInfo->ulFlags & BIF_EDITBOX))
845  {
848  }
849 
851  if (info->hwndTreeView)
852  {
854 
855 #ifndef __REACTOS__
856  /* Resize the treeview if there's not editbox */
857  if ((lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
858  && !(lpBrowseInfo->ulFlags & BIF_EDITBOX))
859  {
860  RECT rc;
861  GetClientRect(info->hwndTreeView, &rc);
862  SetWindowPos(info->hwndTreeView, HWND_TOP, 0, 0,
863  rc.right, rc.bottom + 40, SWP_NOMOVE);
864  }
865 #endif
866  }
867  else
868  ERR("treeview control missing!\n");
869 
870  /* Register for change notifications */
871  SHGetFolderLocation(NULL, CSIDL_DESKTOP, NULL, 0, &computer_pidl);
872 
873  ntreg.pidl = computer_pidl;
874  ntreg.fRecursive = TRUE;
875 
877 
878 #ifdef __REACTOS__
879  SetFocus(info->hwndTreeView);
880 #endif
881  browsefolder_callback( info->lpBrowseInfo, hWnd, BFFM_INITIALIZED, 0 );
882 
883 #ifdef __REACTOS__
886  return TRUE;
887 #else
888  return TRUE;
889 #endif
890 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:405
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:407
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:2012
#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:1193
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:408
#define SHCNE_ALLEVENTS
Definition: shlobj.h:1753
#define FIXME(fmt,...)
Definition: debug.h:111
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1774
#define SHACF_FILESYSTEM
Definition: shlwapi.h:1912
#define SHV_CHANGE_NOTIFY
Definition: brsfolder.c:48
#define IDC_BROWSE_FOR_FOLDER_FOLDER
Definition: shresdef.h:406
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:140
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:1725
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:131
static void InitializeTreeView(browse_info *info)
Definition: brsfolder.c:212
#define SUPPORTEDFLAGS
Definition: brsfolder.c:107
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:409
#define NULL
Definition: types.h:112
static const WCHAR szBrowseFolderInfo[]
Definition: brsfolder.c:120
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:1229
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2741
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:404

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnDestroy()

static INT BrsFolder_OnDestroy ( browse_info info)
static

Definition at line 1207 of file brsfolder.c.

1208 {
1209  if (info->layout)
1210  {
1211 #ifdef __REACTOS__
1212  LayoutDestroy(info->layout);
1213 #else
1214  SHFree(info->layout);
1215 #endif
1216  info->layout = NULL;
1217  }
1218 
1219  SHChangeNotifyDeregister(info->hNotify);
1220 
1221  return 0;
1222 }
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:331

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnNotify()

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

Definition at line 729 of file brsfolder.c.

730 {
731  NMTREEVIEWW *pnmtv = (NMTREEVIEWW *)lpnmh;
732 
733  TRACE("%p %x %p msg=%x\n", info, CtlID, lpnmh, pnmtv->hdr.code);
734 
736  return 0;
737 
738  switch (pnmtv->hdr.code)
739  {
740  case TVN_DELETEITEMA:
741  case TVN_DELETEITEMW:
742  return BrsFolder_Treeview_Delete( info, pnmtv );
743 
744  case TVN_ITEMEXPANDINGA:
745  case TVN_ITEMEXPANDINGW:
746  return BrsFolder_Treeview_Expand( info, pnmtv );
747 
748  case TVN_SELCHANGEDA:
749  case TVN_SELCHANGEDW:
750  return BrsFolder_Treeview_Changed( info, pnmtv );
751 
752  case TVN_ENDLABELEDITA:
753  case TVN_ENDLABELEDITW:
755 
756  case TVN_KEYDOWN:
758 
759  default:
760  WARN("unhandled (%d)\n", pnmtv->hdr.code);
761  break;
762  }
763 
764  return 0;
765 }
static LRESULT BrsFolder_Treeview_Expand(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:545
#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:580
#define TVN_SELCHANGEDA
Definition: commctrl.h:3647
UINT code
Definition: winuser.h:3134
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3712
UINT_PTR idFrom
Definition: winuser.h:3133
#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:678
static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv)
Definition: brsfolder.c:597
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:409
#define TVN_KEYDOWN
Definition: commctrl.h:3713
static LRESULT BrsFolder_Treeview_Delete(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:530
#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 1068 of file brsfolder.c.

1070 {
1071  LPITEMIDLIST pidlSelection = selection;
1072  LPCITEMIDLIST pidlCurrent, pidlRoot;
1073  TVITEMEXW item;
1074  BOOL bResult = FALSE;
1075 
1076  memset(&item, 0, sizeof(item));
1077 
1078  /* If 'selection' is a string, convert to a Shell ID List. */
1079  if (is_str) {
1080  IShellFolder *psfDesktop;
1081  HRESULT hr;
1082 
1083  hr = SHGetDesktopFolder(&psfDesktop);
1084  if (FAILED(hr))
1085  goto done;
1086 
1087  hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL,
1088  selection, NULL, &pidlSelection, NULL);
1089  IShellFolder_Release(psfDesktop);
1090  if (FAILED(hr))
1091  goto done;
1092  }
1093 #ifdef __REACTOS__
1094  if (_ILIsDesktop(pidlSelection))
1095  {
1096  item.hItem = TVI_ROOT;
1097  bResult = TRUE;
1098  goto done;
1099  }
1100 #endif
1101 
1102  /* Move pidlCurrent behind the SHITEMIDs in pidlSelection, which are the root of
1103  * the sub-tree currently displayed. */
1104  pidlRoot = info->lpBrowseInfo->pidlRoot;
1105  pidlCurrent = pidlSelection;
1106  while (!_ILIsEmpty(pidlRoot) && _ILIsEqualSimple(pidlRoot, pidlCurrent)) {
1107  pidlRoot = ILGetNext(pidlRoot);
1108  pidlCurrent = ILGetNext(pidlCurrent);
1109  }
1110 
1111  /* The given ID List is not part of the SHBrowseForFolder's current sub-tree. */
1112  if (!_ILIsEmpty(pidlRoot))
1113  goto done;
1114 
1115  /* Initialize item to point to the first child of the root folder. */
1116  item.mask = TVIF_PARAM;
1117  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_ROOT, 0);
1118 
1119  if (item.hItem)
1120  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CHILD,
1121  (LPARAM)item.hItem);
1122 
1123  /* Walk the tree along the nodes corresponding to the remaining ITEMIDLIST */
1124  while (item.hItem && !_ILIsEmpty(pidlCurrent)) {
1125  LPTV_ITEMDATA pItemData;
1126 
1127  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
1128  pItemData = (LPTV_ITEMDATA)item.lParam;
1129 
1130  if (_ILIsEqualSimple(pItemData->lpi, pidlCurrent)) {
1131  pidlCurrent = ILGetNext(pidlCurrent);
1132  if (!_ILIsEmpty(pidlCurrent)) {
1133  /* Only expand current node and move on to its first child,
1134  * if we didn't already reach the last SHITEMID */
1135  SendMessageW(info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)item.hItem);
1136  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CHILD,
1137  (LPARAM)item.hItem);
1138  }
1139  } else {
1140  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_NEXT,
1141  (LPARAM)item.hItem);
1142  }
1143  }
1144 
1145  if (_ILIsEmpty(pidlCurrent) && item.hItem)
1146  bResult = TRUE;
1147 
1148 done:
1149  if (pidlSelection && pidlSelection != selection)
1150  ILFree(pidlSelection);
1151 
1152  if (pItem)
1153  *pItem = item.hItem;
1154 
1155  return bResult;
1156 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:256
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:250
#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 1170 of file brsfolder.c.

1170  {
1171  LPWSTR selectionW = NULL;
1172  BOOL result = FALSE;
1173  int length;
1174 
1175  if (!is_str)
1176  return BrsFolder_OnSetSelectionW(info, selection, is_str);
1177 
1178  if ((length = MultiByteToWideChar(CP_ACP, 0, selection, -1, NULL, 0)) &&
1179  (selectionW = HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR))) &&
1180  MultiByteToWideChar(CP_ACP, 0, selection, -1, selectionW, length))
1181  {
1182  result = BrsFolder_OnSetSelectionW(info, selectionW, is_str);
1183  }
1184 
1185  HeapFree(GetProcessHeap(), 0, selectionW);
1186  return result;
1187 }
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:1158
#define GetProcessHeap()
Definition: compat.h:595
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:594

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnSetSelectionW()

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

Definition at line 1158 of file brsfolder.c.

1158  {
1159  HTREEITEM hItem;
1160  BOOL bResult;
1161 
1162  if (!selection) return FALSE;
1163 
1164  bResult = BrsFolder_OnSetExpanded(info, selection, is_str, &hItem);
1165  if (bResult)
1166  SendMessageW(info->hwndTreeView, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem );
1167  return bResult;
1168 }
#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:1068
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 1190 of file brsfolder.c.

1191 {
1192 #ifdef __REACTOS__
1193  if ((info->lpBrowseInfo->ulFlags & BIF_USENEWUI) && !(pos->flags & SWP_NOSIZE))
1194 #else
1195  if ((info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE) && !(pos->flags & SWP_NOSIZE))
1196 #endif
1197  {
1198  if (pos->cx < info->szMin.cx)
1199  pos->cx = info->szMin.cx;
1200  if (pos->cy < info->szMin.cy)
1201  pos->cy = info->szMin.cy;
1202  }
1203  return 0;
1204 }
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1150
#define BIF_USENEWUI
Definition: shlobj.h:1151
#define SWP_NOSIZE
Definition: winuser.h:1230

Referenced by BrsFolderDlgProc().

◆ BrsFolder_Rename()

static HRESULT BrsFolder_Rename ( browse_info info,
HTREEITEM  rename 
)
static

Definition at line 637 of file brsfolder.c.

638 {
640  SendMessageW(info->hwndTreeView, TVM_EDITLABELW, 0, (LPARAM)rename);
641  return S_OK;
642 }
#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:51
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 580 of file brsfolder.c.

581 {
582  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
584 
585  ILFree(info->pidlRet);
586  info->pidlRet = ILClone(lptvid->lpifq);
587 
588  if (GetName(lptvid->lpsfParent, lptvid->lpi, SHGDN_NORMAL, name))
590 
591  browsefolder_callback( info->lpBrowseInfo, info->hWnd, BFFM_SELCHANGED,
592  (LPARAM)info->pidlRet );
594  return S_OK;
595 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:405
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:350
static void BrsFolder_CheckValidSelection(browse_info *info, LPTV_ITEMDATA lptvid)
Definition: brsfolder.c:494
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:51
static void browsefolder_callback(LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
Definition: brsfolder.c:131
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 530 of file brsfolder.c.

531 {
532  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA)pnmtv->itemOld.lParam;
533 
534  TRACE("TVN_DELETEITEMA/W %p\n", lptvid);
535 
536  IShellFolder_Release(lptvid->lpsfParent);
537  if (lptvid->pEnumIL)
538  IEnumIDList_Release(lptvid->pEnumIL);
539  SHFree(lptvid->lpi);
540  SHFree(lptvid->lpifq);
541  SHFree(lptvid);
542  return 0;
543 }
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:331
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 545 of file brsfolder.c.

546 {
547  IShellFolder *lpsf2 = NULL;
548  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
549  HRESULT r;
550 
551  TRACE("TVN_ITEMEXPANDINGA/W\n");
552 
553  if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))
554  return 0;
555 
556  if (!_ILIsEmpty(lptvid->lpi)) {
557  r = IShellFolder_BindToObject( lptvid->lpsfParent, lptvid->lpi, 0,
558  &IID_IShellFolder, (void**)&lpsf2 );
559  } else {
560  lpsf2 = lptvid->lpsfParent;
561  IShellFolder_AddRef(lpsf2);
562  r = S_OK;
563  }
564 
565  if (SUCCEEDED(r))
566  {
567  FillTreeView( info, lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem, lptvid->pEnumIL);
568  IShellFolder_Release( lpsf2 );
569  }
570 
571  /* My Computer is already sorted and trying to do a simple text
572  * sort will only mess things up */
573  if (!_ILIsMyComputer(lptvid->lpi))
574  SendMessageW( info->hwndTreeView, TVM_SORTCHILDREN,
575  FALSE, (LPARAM)pnmtv->itemNew.hItem );
576 
577  return 0;
578 }
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:256
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:1920
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:51
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 678 of file brsfolder.c.

679 {
680  HTREEITEM selected_item;
681 
682  /* Old dialog doesn't support those advanced features */
683 #ifdef __REACTOS__
684  if (!(info->lpBrowseInfo->ulFlags & BIF_USENEWUI))
685 #else
686  if (!(info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
687 #endif
688  return 0;
689 
690  selected_item = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);
691 
692  switch (keydown->wVKey)
693  {
694  case VK_F2:
695  BrsFolder_Rename(info, selected_item);
696  break;
697  case VK_DELETE:
698  {
699 #ifdef __REACTOS__
700  BrsFolder_Delete(info, selected_item);
701 #else
702  const ITEMIDLIST *item_id;
703  ISFHelper *psfhlp;
704  HRESULT hr;
705  TVITEMW item;
706  TV_ITEMDATA *item_data;
707 
708  item.mask = TVIF_PARAM;
709  item.mask = TVIF_HANDLE|TVIF_PARAM;
710  item.hItem = selected_item;
711  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
712  item_data = (TV_ITEMDATA *)item.lParam;
713  item_id = item_data->lpi;
714 
715  hr = IShellFolder_QueryInterface(item_data->lpsfParent, &IID_ISFHelper, (void**)&psfhlp);
716  if(FAILED(hr))
717  return 0;
718 
719  /* perform the item deletion - tree view gets updated over shell notification */
720  ISFHelper_DeleteItems(psfhlp, 1, &item_id);
721  ISFHelper_Release(psfhlp);
722 #endif
723  }
724  break;
725  }
726  return 0;
727 }
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:637
#define VK_F2
Definition: winuser.h:2231
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
#define VK_DELETE
Definition: winuser.h:2208
#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 597 of file brsfolder.c.

598 {
599  LPTV_ITEMDATA item_data;
600  WCHAR old_path[MAX_PATH], new_path[MAX_PATH], *p;
601  NMTREEVIEWW nmtv;
602  TVITEMW item;
603 
604  if(!pnmtv->item.pszText)
605  return 0;
606 
607  item.mask = TVIF_HANDLE|TVIF_PARAM;
608  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);
609  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
610  item_data = (LPTV_ITEMDATA)item.lParam;
611 
612  SHGetPathFromIDListW(item_data->lpifq, old_path);
613  if(!(p = strrchrW(old_path, '\\')))
614  return 0;
615  p = new_path+(p-old_path+1);
616  memcpy(new_path, old_path, (p-new_path)*sizeof(WCHAR));
617  strcpyW(p, pnmtv->item.pszText);
618 
619  if(!MoveFileW(old_path, new_path))
620  return 0;
621 
622  SHFree(item_data->lpifq);
623  SHFree(item_data->lpi);
624  item_data->lpifq = SHSimpleIDListFromPathW(new_path);
625  IShellFolder_ParseDisplayName(item_data->lpsfParent, NULL, NULL,
626  pnmtv->item.pszText, NULL, &item_data->lpi, NULL);
627 
628  item.mask = TVIF_HANDLE|TVIF_TEXT;
629  item.pszText = pnmtv->item.pszText;
630  SendMessageW(info->hwndTreeView, TVM_SETITEMW, 0, (LPARAM)&item);
631 
632  nmtv.itemNew.lParam = item.lParam;
634  return 0;
635 }
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:580
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:1044
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:331
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 1278 of file brsfolder.c.

1280 {
1281  browse_info *info;
1282 
1283  TRACE("hwnd=%p msg=%04x 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam );
1284 
1285  if (msg == WM_INITDIALOG)
1286  return BrsFolder_OnCreate( hWnd, (browse_info*) lParam );
1287 
1289 
1290  switch (msg)
1291  {
1292  case WM_NOTIFY:
1294 
1295  case WM_COMMAND:
1296  return BrsFolder_OnCommand( info, wParam );
1297 
1298 #ifdef __REACTOS__
1299  case WM_GETMINMAXINFO:
1300  ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = info->szMin.cx;
1301  ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = info->szMin.cy;
1302  return 0;
1303 #else /* This is a buggy way (resize on title bar) */
1304  case WM_WINDOWPOSCHANGING:
1306 #endif
1307 
1308  case WM_SIZE:
1309  if (info->layout) /* new style dialogs */
1311  return 0;
1312 
1313  case BFFM_SETSTATUSTEXTA:
1314  TRACE("Set status %s\n", debugstr_a((LPSTR)lParam));
1316  break;
1317 
1318  case BFFM_SETSTATUSTEXTW:
1319  TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam));
1321  break;
1322 
1323  case BFFM_ENABLEOK:
1324  TRACE("Enable %ld\n", lParam);
1325  EnableWindow(GetDlgItem(hWnd, 1), lParam != 0);
1326  break;
1327 
1328  case BFFM_SETOKTEXT: /* unicode only */
1329  TRACE("Set OK text %s\n", debugstr_w((LPWSTR)lParam));
1331  break;
1332 
1333  case BFFM_SETSELECTIONA:
1335 
1336  case BFFM_SETSELECTIONW:
1338 
1339  case BFFM_SETEXPANDED: /* unicode only */
1341 
1342  case SHV_CHANGE_NOTIFY:
1344 
1345  case WM_DESTROY:
1346  return BrsFolder_OnDestroy(info);
1347  }
1348  return FALSE;
1349 }
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:407
static BOOL BrsFolder_OnSetSelectionA(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1170
#define LAYOUT_INFO_COUNT
Definition: brsfolder.c:105
static LRESULT BrsFolder_OnChange(browse_info *info, const LPCITEMIDLIST *pidls, LONG event)
Definition: brsfolder.c:1252
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
static LRESULT BrsFolder_OnNotify(browse_info *info, UINT CtlID, LPNMHDR lpnmh)
Definition: brsfolder.c:729
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#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:1158
#define WM_DESTROY
Definition: winuser.h:1591
#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:169
#define WM_SIZE
Definition: winuser.h:1593
#define debugstr_a
Definition: kernel32.h:31
static BOOL BrsFolder_OnSetExpanded(browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem)
Definition: brsfolder.c:1068
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
struct _test_info info[]
Definition: SetCursorPos.c:19
static LRESULT BrsFolder_OnWindowPosChanging(browse_info *info, WINDOWPOS *pos)
Definition: brsfolder.c:1190
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BFFM_ENABLEOK
Definition: shlobj.h:1171
static INT BrsFolder_OnDestroy(browse_info *info)
Definition: brsfolder.c:1207
static BOOL BrsFolder_OnCommand(browse_info *info, UINT id)
Definition: brsfolder.c:1023
#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:768
#define msg(x)
Definition: auth_time.c:54
static const WCHAR szBrowseFolderInfo[]
Definition: brsfolder.c:120
#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:1721
LPARAM lParam
Definition: combotst.c:139
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
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 432 of file brsfolder.c.

434 {
435  LPITEMIDLIST pidlTemp = 0;
436  ULONG ulFetched;
437  HRESULT hr;
438  HWND hwnd = GetParent( info->hwndTreeView );
439 
440  TRACE("%p %p %p %p\n",lpsf, pidl, hParent, lpe);
441 
442  /* No IEnumIDList -> No children */
443  if (!lpe) return;
444 
445  SetCapture( hwnd );
447 
448  while (S_OK == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))
449  {
450  ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER;
451  IEnumIDList* pEnumIL = NULL;
452  IShellFolder* pSFChild = NULL;
453  IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulAttrs);
454  if (ulAttrs & SFGAO_FOLDER)
455  {
456  hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild);
457  if (SUCCEEDED(hr))
458  {
459  DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
460  hr = IShellFolder_EnumObjects(pSFChild, hwnd, flags, &pEnumIL);
461  if (hr == S_OK)
462  {
463  if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) ||
464  FAILED(IEnumIDList_Reset(pEnumIL)))
465  {
466  IEnumIDList_Release(pEnumIL);
467  pEnumIL = NULL;
468  }
469  }
470  IShellFolder_Release(pSFChild);
471  }
472  }
473 
474  if (!InsertTreeViewItem(info, lpsf, pidlTemp, pidl, pEnumIL, hParent))
475  goto done;
476  SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */
477  pidlTemp=NULL;
478  }
479 
480 done:
481  ReleaseCapture();
483  SHFree(pidlTemp);
484 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
Definition: brsfolder.c:380
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:126
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
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
HWND WINAPI GetParent(_In_ HWND)
#define S_OK
Definition: intsafe.h:51
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:331
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2889
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

◆ GetIcon()

static int GetIcon ( LPCITEMIDLIST  lpi,
UINT  uFlags 
)
static

Definition at line 305 of file brsfolder.c.

306 {
307  SHFILEINFOW sfi;
308  SHGetFileInfoW((LPCWSTR)lpi, 0 ,&sfi, sizeof(SHFILEINFOW), uFlags);
309  return sfi.iIcon;
310 }
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 350 of file brsfolder.c.

351 {
353  STRRET str;
354 
355  TRACE("%p %p %x %p\n", lpsf, lpi, dwFlags, lpFriendlyName);
356  if (SUCCEEDED(IShellFolder_GetDisplayNameOf(lpsf, lpi, dwFlags, &str)))
357  bSuccess = StrRetToStrNW(lpFriendlyName, MAX_PATH, &str, lpi);
358  else
359  bSuccess = FALSE;
360 
361  TRACE("-- %s\n", debugstr_w(lpFriendlyName));
362  return bSuccess;
363 }
#define TRUE
Definition: types.h:120
static BOOLEAN bSuccess
Definition: drive.cpp:432
#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 312 of file brsfolder.c.

313 {
314  LPITEMIDLIST pidlDesktop = NULL;
315  DWORD flags;
316 
317  TRACE("%p %p\n",lpifq, lpTV_ITEM);
318 
319  if (!lpifq)
320  {
321  pidlDesktop = _ILCreateDesktop();
322  lpifq = pidlDesktop;
323  }
324 
326  lpTV_ITEM->iImage = GetIcon( lpifq, flags );
327 
329  lpTV_ITEM->iSelectedImage = GetIcon( lpifq, flags );
330 
331  if (pidlDesktop)
332  ILFree( pidlDesktop );
333 }
#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:305
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 212 of file brsfolder.c.

213 {
214  LPITEMIDLIST pidlParent, pidlChild;
215  HIMAGELIST hImageList;
216  HRESULT hr;
217  IShellFolder *lpsfParent, *lpsfRoot;
218  IEnumIDList * pEnumChildren = NULL;
219  HTREEITEM item;
220  DWORD flags;
221  LPCITEMIDLIST root = info->lpBrowseInfo->pidlRoot;
222 
223  TRACE("%p\n", info );
224 
225  Shell_GetImageLists(NULL, &hImageList);
226 
227  if (hImageList)
228  SendMessageW( info->hwndTreeView, TVM_SETIMAGELIST, 0, (LPARAM)hImageList );
229 
230  /* We want to call InsertTreeViewItem down the code, in order to insert
231  * the root item of the treeview. Due to InsertTreeViewItem's signature,
232  * we need the following to do this:
233  *
234  * + An ITEMIDLIST corresponding to _the parent_ of root.
235  * + An ITEMIDLIST, which is a relative path from root's parent to root
236  * (containing a single SHITEMID).
237  * + An IShellFolder interface pointer of root's parent folder.
238  *
239  * If root is 'Desktop', then root's parent is also 'Desktop'.
240  */
241 
242  pidlParent = ILClone(root);
243  ILRemoveLastID(pidlParent);
244  pidlChild = ILClone(ILFindLastID(root));
245 
246  if (_ILIsDesktop(pidlParent)) {
247  hr = SHGetDesktopFolder(&lpsfParent);
248  } else {
249  IShellFolder *lpsfDesktop;
250  hr = SHGetDesktopFolder(&lpsfDesktop);
251  if (FAILED(hr)) {
252  WARN("SHGetDesktopFolder failed! hr = %08x\n", hr);
253  ILFree(pidlChild);
254  ILFree(pidlParent);
255  return;
256  }
257  hr = IShellFolder_BindToObject(lpsfDesktop, pidlParent, 0, &IID_IShellFolder, (LPVOID*)&lpsfParent);
258  IShellFolder_Release(lpsfDesktop);
259  }
260 
261  if (FAILED(hr)) {
262  WARN("Could not bind to parent shell folder! hr = %08x\n", hr);
263  ILFree(pidlChild);
264  ILFree(pidlParent);
265  return;
266  }
267 
268  if (!_ILIsEmpty(pidlChild)) {
269  hr = IShellFolder_BindToObject(lpsfParent, pidlChild, 0, &IID_IShellFolder, (LPVOID*)&lpsfRoot);
270  } else {
271  lpsfRoot = lpsfParent;
272  hr = IShellFolder_AddRef(lpsfParent);
273  }
274 
275  if (FAILED(hr)) {
276  WARN("Could not bind to root shell folder! hr = %08x\n", hr);
277  IShellFolder_Release(lpsfParent);
278  ILFree(pidlChild);
279  ILFree(pidlParent);
280  return;
281  }
282 
283  flags = BrowseFlagsToSHCONTF( info->lpBrowseInfo->ulFlags );
284  hr = IShellFolder_EnumObjects( lpsfRoot, info->hWnd, flags, &pEnumChildren );
285  if (FAILED(hr)) {
286  WARN("Could not get child iterator! hr = %08x\n", hr);
287  IShellFolder_Release(lpsfParent);
288  IShellFolder_Release(lpsfRoot);
289  ILFree(pidlChild);
290  ILFree(pidlParent);
291  return;
292  }
293 
294  SendMessageW( info->hwndTreeView, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT );
295  item = InsertTreeViewItem( info, lpsfParent, pidlChild,
296  pidlParent, pEnumChildren, TVI_ROOT );
297  SendMessageW( info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)item );
298 
299  ILFree(pidlChild);
300  ILFree(pidlParent);
301  IShellFolder_Release(lpsfRoot);
302  IShellFolder_Release(lpsfParent);
303 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:256
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
Definition: brsfolder.c:380
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:126
#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:706
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 380 of file brsfolder.c.

383 {
384  TVITEMW tvi;
385  TVINSERTSTRUCTW tvins;
386  WCHAR szBuff[MAX_PATH];
387  LPTV_ITEMDATA lptvid=0;
388 
390 
391  tvi.cChildren= pEnumIL ? 1 : 0;
392  tvi.mask |= TVIF_CHILDREN;
393 
394  if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff))
395  return NULL;
396 
397  lptvid = SHAlloc( sizeof(TV_ITEMDATA) );
398  if (!lptvid)
399  return NULL;
400 
401  tvi.pszText = szBuff;
402  tvi.cchTextMax = MAX_PATH;
403  tvi.lParam = (LPARAM)lptvid;
404 
405  IShellFolder_AddRef(lpsf);
406  lptvid->lpsfParent = lpsf;
407  lptvid->lpi = ILClone(pidl);
408  lptvid->lpifq = pidlParent ? ILCombine(pidlParent, pidl) : ILClone(pidl);
409  lptvid->pEnumIL = pEnumIL;
410  GetNormalAndSelectedIcons(lptvid->lpifq, &tvi);
411 
412  tvins.u.item = tvi;
413  tvins.hInsertAfter = NULL;
414  tvins.hParent = hParent;
415 
416  return TreeView_InsertItem( info->hwndTreeView, &tvins );
417 }
int cchTextMax
Definition: commctrl.h:3321
HTREEITEM hParent
Definition: commctrl.h:3393
static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
Definition: brsfolder.c:312
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
Definition: brsfolder.c:350
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
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#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:309

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 140 of file brsfolder.c.

141 {
142  LAYOUT_DATA *data;
143  RECT rcWnd;
144  int i;
145 
146  GetClientRect(hwnd, &rcWnd);
147  data = SHAlloc(sizeof(LAYOUT_DATA)*layout_count);
148  for (i = 0; i < layout_count; i++)
149  {
150  RECT r;
151  HWND hItem = GetDlgItem(hwnd, layout_info[i].iItemId);
152 
153  if (hItem == NULL)
154  ERR("Item %d not found\n", i);
155  GetWindowRect(hItem, &r);
157 
158  data[i].left = r.left;
159  data[i].right = rcWnd.right - r.right;
160  data[i].width = r.right - r.left;
161 
162  data[i].top = r.top;
163  data[i].bottom = rcWnd.bottom - r.bottom;
164  data[i].height = r.bottom - r.top;
165  }
166  return data;
167 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
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:1195
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309

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 169 of file brsfolder.c.

170 {
171  RECT rcWnd;
172  int i;
173 
174  GetClientRect(hwnd, &rcWnd);
175  for (i = 0; i < layout_count; i++)
176  {
177  RECT r;
178  HWND hItem = GetDlgItem(hwnd, layout_info[i].iItemId);
179 
180  GetWindowRect(hItem, &r);
182 
183  if (layout_info[i].dwAnchor & BF_RIGHT)
184  {
185  r.right = rcWnd.right - data[i].right;
186  if (!(layout_info[i].dwAnchor & BF_LEFT))
187  r.left = r.right - data[i].width;
188  }
189 
190  if (layout_info[i].dwAnchor & BF_BOTTOM)
191  {
192  r.bottom = rcWnd.bottom - data[i].bottom;
193  if (!(layout_info[i].dwAnchor & BF_TOP))
194  r.top = r.bottom - data[i].height;
195  }
196 
197  SetWindowPos(hItem, NULL, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER);
198  }
199 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
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:1232
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:1195
#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)
#define BF_LEFT
Definition: winuser.h:454

Referenced by BrsFolderDlgProc().

◆ PIDLIsType()

static BOOL PIDLIsType ( LPCITEMIDLIST  pidl,
PIDLTYPE  type 
)
inlinestatic

Definition at line 486 of file brsfolder.c.

487 {
489  if (!data)
490  return FALSE;
491  return (data->type == type);
492 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2176
#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 1362 of file brsfolder.c.

1363 {
1364  BROWSEINFOW bi;
1365  LPITEMIDLIST lpid;
1366  INT len;
1367  LPWSTR title;
1368 
1369  TRACE("%p\n", lpbi);
1370 
1371  bi.hwndOwner = lpbi->hwndOwner;
1372  bi.pidlRoot = lpbi->pidlRoot;
1373  if (lpbi->pszDisplayName)
1374  bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) );
1375  else
1376  bi.pszDisplayName = NULL;
1377 
1378  if (lpbi->lpszTitle)
1379  {
1380  len = MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, NULL, 0 );
1381  title = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
1382  MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, title, len );
1383  }
1384  else
1385  title = NULL;
1386 
1387  bi.lpszTitle = title;
1388  bi.ulFlags = lpbi->ulFlags;
1389  bi.lpfn = lpbi->lpfn;
1390  bi.lParam = lpbi->lParam;
1391  bi.iImage = lpbi->iImage;
1392  lpid = SHBrowseForFolderW( &bi );
1393  if (bi.pszDisplayName)
1394  {
1396  lpbi->pszDisplayName, MAX_PATH, 0, NULL);
1398  }
1399  HeapFree(GetProcessHeap(), 0, title);
1400  lpbi->iImage = bi.iImage;
1401  return lpid;
1402 }
#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:595
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:1411
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:594

Referenced by test_click_make_new_folder_button(), and test_selection().

◆ SHBrowseForFolderW()

LPITEMIDLIST WINAPI SHBrowseForFolderW ( LPBROWSEINFOW  lpbi)

Definition at line 1411 of file brsfolder.c.

1412 {
1413  browse_info info;
1414  DWORD r;
1415  HRESULT hr;
1416 #ifdef __REACTOS__
1417  WORD wDlgId;
1418 #else
1419  const WCHAR * templateName;
1420  INITCOMMONCONTROLSEX icex;
1421 #endif
1422 
1423  info.hWnd = 0;
1424  info.pidlRet = NULL;
1425  info.lpBrowseInfo = lpbi;
1426  info.hwndTreeView = NULL;
1427 
1428 #ifdef __REACTOS__
1429  info.layout = NULL;
1430 #else
1431  icex.dwSize = sizeof( icex );
1432  icex.dwICC = ICC_TREEVIEW_CLASSES;
1433  InitCommonControlsEx( &icex );
1434 #endif
1435 
1436  hr = OleInitialize(NULL);
1437 
1438 #ifdef __REACTOS__
1439  if (lpbi->ulFlags & BIF_USENEWUI)
1440 #else
1441  if (lpbi->ulFlags & BIF_NEWDIALOGSTYLE)
1442 #endif
1443  wDlgId = IDD_BROWSE_FOR_FOLDER_NEW;
1444  else
1445  wDlgId = IDD_BROWSE_FOR_FOLDER;
1448  if (SUCCEEDED(hr))
1449  OleUninitialize();
1450  if (!r)
1451  {
1452  ILFree(info.pidlRet);
1453  return NULL;
1454  }
1455 
1456  return info.pidlRet;
1457 }
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
if SUCCEEDED(hr)
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_BROWSE_FOR_FOLDER
Definition: shresdef.h:402
#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
struct _test_info info[]
Definition: SetCursorPos.c:19
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define IDD_BROWSE_FOR_FOLDER_NEW
Definition: shresdef.h:403
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:1278
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:405
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:407
#define IDOK
Definition: winuser.h:824
#define BF_BOTTOM
Definition: winuser.h:457
#define IDC_BROWSE_FOR_FOLDER_TITLE
Definition: shresdef.h:408
#define IDC_BROWSE_FOR_FOLDER_FOLDER
Definition: shresdef.h:406
#define BF_RIGHT
Definition: winuser.h:456
#define BF_TOP
Definition: winuser.h:455
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:409
#define IDCANCEL
Definition: winuser.h:825
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:404
#define BF_LEFT
Definition: winuser.h:454

Definition at line 86 of file brsfolder.c.

Referenced by BrsFolder_OnCreate(), and BrsFolderDlgProc().

◆ swBrowseTemplateName

const WCHAR swBrowseTemplateName[]
static
Initial value:
= {
'S','H','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0}

Definition at line 1352 of file brsfolder.c.

◆ swNewBrowseTemplateName

const WCHAR swNewBrowseTemplateName[]
static
Initial value:
= {
'S','H','N','E','W','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0}

Definition at line 1354 of file brsfolder.c.

◆ szBrowseFolderInfo

const WCHAR szBrowseFolderInfo[]
static
Initial value:
= {
'_','_','W','I','N','E','_',
'B','R','S','F','O','L','D','E','R','D','L','G','_',
'I','N','F','O',0
}

Definition at line 120 of file brsfolder.c.

Referenced by BrsFolder_OnCreate(), and BrsFolderDlgProc().