ReactOS  0.4.15-dev-1070-ge1a01de
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 94 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 47 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 96 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 115 of file brsfolder.c.

116 {
117  return SHCONTF_FOLDERS | (ulFlags & BIF_BROWSEINCLUDEFILES ? SHCONTF_NONFOLDERS : 0);
118 }
#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 120 of file brsfolder.c.

122 {
123  if (!lpBrowseInfo->lpfn)
124  return;
125  lpBrowseInfo->lpfn( hWnd, msg, param, lpBrowseInfo->lParam );
126 }
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 481 of file brsfolder.c.

482 {
483  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
484  LPCITEMIDLIST pidl = lptvid->lpi;
485  BOOL bEnabled = TRUE;
487  HRESULT r;
488 
489  if ((lpBrowseInfo->ulFlags & BIF_BROWSEFORCOMPUTER) &&
490  !PIDLIsType(pidl, PT_COMP))
491  bEnabled = FALSE;
492  if (lpBrowseInfo->ulFlags & BIF_RETURNFSANCESTORS)
493  {
494  dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
495  r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
496  (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
497  if (FAILED(r) || !(dwAttributes & (SFGAO_FILESYSANCESTOR|SFGAO_FILESYSTEM)))
498  bEnabled = FALSE;
499  }
500 
501  dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSTEM;
502  r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
503  (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
504  if (FAILED(r) ||
505  ((dwAttributes & (SFGAO_FOLDER|SFGAO_FILESYSTEM)) != (SFGAO_FOLDER|SFGAO_FILESYSTEM)))
506  {
507  if (lpBrowseInfo->ulFlags & BIF_RETURNONLYFSDIRS)
508  bEnabled = FALSE;
510  }
511  else
513 
514  SendMessageW(info->hWnd, BFFM_ENABLEOK, 0, bEnabled);
515 }
#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:473
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:69
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:70
#define BIF_BROWSEFORCOMPUTER
Definition: shlobj.h:1157
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:386

Referenced by BrsFolder_Treeview_Changed().

◆ BrsFolder_FindItemByPidl()

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

Definition at line 1156 of file brsfolder.c.

1157 {
1158  TV_ITEMW item;
1159  TV_ITEMDATA *item_data;
1160  HRESULT hr;
1161 
1162  item.mask = TVIF_HANDLE | TVIF_PARAM;
1163  item.hItem = hItem;
1164  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
1165  item_data = (TV_ITEMDATA *)item.lParam;
1166 
1167  hr = IShellFolder_CompareIDs(item_data->lpsfParent, 0, item_data->lpifq, pidl);
1168  if(SUCCEEDED(hr) && !HRESULT_CODE(hr))
1169  return hItem;
1170 
1172 
1173  while (hItem)
1174  {
1175  HTREEITEM newItem = BrsFolder_FindItemByPidl(info, pidl, hItem);
1176  if (newItem)
1177  return newItem;
1179  }
1180  return NULL;
1181 }
HRESULT hr
Definition: shlfolder.c:183
#define TV_ITEMW
Definition: commctrl.h:3293
LPITEMIDLIST lpifq
Definition: brsfolder.c:71
#define TVGN_NEXT
Definition: commctrl.h:3449
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
HTREEITEM hItem
Definition: treelist.h:37
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:69
LONG HRESULT
Definition: typedefs.h:79
#define TVGN_CHILD
Definition: commctrl.h:3452
#define TVIF_HANDLE
Definition: commctrl.h:3266
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HRESULT_CODE(hr)
Definition: winerror.h:76
static HTREEITEM BrsFolder_FindItemByPidl(browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
Definition: brsfolder.c:1156
#define TVM_GETITEMW
Definition: commctrl.h:3482
#define TVIF_PARAM
Definition: commctrl.h:3264
#define SUCCEEDED(hr)
Definition: intsafe.h:49

Referenced by BrsFolder_OnChange().

◆ BrsFolder_NewFolder()

static HRESULT BrsFolder_NewFolder ( browse_info info)
static

Definition at line 833 of file brsfolder.c.

834 {
835  DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
836  IShellFolder *desktop, *cur;
837 #ifdef __REACTOS__
838  WCHAR wszNewFolder[25];
840 #else
841  ISFHelper *sfhelper;
842 #endif
844  HTREEITEM parent, added;
845  LPTV_ITEMDATA item_data;
846  LPITEMIDLIST new_item;
847  TVITEMW item;
848  HRESULT hr;
849  int len;
850 
851 #ifdef __REACTOS__
852  hr = SHGetDesktopFolder(&desktop);
853  if(FAILED(hr))
854  return hr;
855 
856  if (info->pidlRet)
857  {
858  hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur);
859  IShellFolder_Release(desktop);
860  if(FAILED(hr))
861  return hr;
862 
863  hr = SHGetPathFromIDListW(info->pidlRet, path);
864  }
865  else
866  {
867  cur = desktop;
869  }
870  if(FAILED(hr))
871  return hr;
872 
873  if (!LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, _countof(wszNewFolder)))
874  return E_FAIL;
875 
876  if (!PathYetAnotherMakeUniqueName(name, path, NULL, wszNewFolder))
877  return E_FAIL;
878 
879  len = strlenW(path);
880  if(len<MAX_PATH && name[len] == L'\\')
881  len++;
882 #else
883  if(!info->pidlRet) {
884  ERR("Make new folder button should be disabled\n");
885  return E_FAIL;
886  }
887 
888  /* Create new directory */
889  hr = SHGetDesktopFolder(&desktop);
890  if(FAILED(hr))
891  return hr;
892 
893  hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur);
894  IShellFolder_Release(desktop);
895  if(FAILED(hr))
896  return hr;
897 
898  hr = IShellFolder_QueryInterface(cur, &IID_ISFHelper, (void**)&sfhelper);
899  if(FAILED(hr))
900  return hr;
901 
902  if(!SHGetPathFromIDListW(info->pidlRet, name)) {
903  hr = E_FAIL;
904  goto cleanup;
905  }
906 
907  len = strlenW(name);
908  if(len<MAX_PATH)
909  name[len++] = '\\';
910  hr = ISFHelper_GetUniqueName(sfhelper, &name[len], MAX_PATH-len);
911  ISFHelper_Release(sfhelper);
912  if(FAILED(hr))
913  goto cleanup;
914 #endif
915 
916  hr = E_FAIL;
917  if(!CreateDirectoryW(name, NULL))
918  goto cleanup;
919 
920  /* Update parent of newly created directory */
922  if(!parent)
923  goto cleanup;
924 
925  SendMessageW(info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)parent);
926 
927  memset(&item, 0, sizeof(TVITEMW));
928  item.mask = TVIF_PARAM|TVIF_STATE;
929  item.hItem = parent;
930  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
931  item_data = (LPTV_ITEMDATA)item.lParam;
932  if(!item_data)
933  goto cleanup;
934 
935  if(item_data->pEnumIL)
936  IEnumIDList_Release(item_data->pEnumIL);
937  hr = IShellFolder_EnumObjects(cur, info->hwndTreeView, flags, &item_data->pEnumIL);
938  if(FAILED(hr))
939  goto cleanup;
940 
941  /* Update treeview */
942  if(!(item.state&TVIS_EXPANDEDONCE)) {
943  item.mask = TVIF_STATE;
944  item.state = TVIS_EXPANDEDONCE;
945  item.stateMask = TVIS_EXPANDEDONCE;
946  SendMessageW(info->hwndTreeView, TVM_SETITEMW, 0, (LPARAM)&item);
947  }
948 
949  hr = IShellFolder_ParseDisplayName(cur, NULL, NULL, name+len, NULL, &new_item, NULL);
950  if(FAILED(hr))
951  goto cleanup;
952 
953  added = InsertTreeViewItem(info, cur, new_item, item_data->lpifq, NULL, parent);
954  IShellFolder_Release(cur);
955  SHFree(new_item);
956 
958  return BrsFolder_Rename(info, added);
959 
960 cleanup:
961  return hr;
962 }
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:367
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:3415
LPITEMIDLIST lpifq
Definition: brsfolder.c:71
#define TVM_SORTCHILDREN
Definition: commctrl.h:3537
#define TVGN_CARET
Definition: commctrl.h:3457
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3281
#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:115
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
Definition: brsfolder.c:624
#define TVM_SETITEMW
Definition: commctrl.h:3489
#define FALSE
Definition: types.h:117
IEnumIDList * pEnumIL
Definition: brsfolder.c:72
smooth NULL
Definition: ftsmooth.c:416
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:3419
GLbitfield flags
Definition: glext.h:7161
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:110
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
#define shell32_hInstance
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
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:3265
char * cleanup(char *str)
Definition: wpickclick.c:99
#define TVM_GETITEMW
Definition: commctrl.h:3482
BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR shortname, LPCWSTR longname)
Definition: shellpath.c:368
#define TVIF_PARAM
Definition: commctrl.h:3264
#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 1183 of file brsfolder.c.

1184 {
1185  BOOL ret = TRUE;
1186 
1187  TRACE("(%p)->(%p, %p, 0x%08x)\n", info, pidls[0], pidls[1], event);
1188 
1189  switch (event)
1190  {
1191  case SHCNE_RMDIR:
1192  case SHCNE_DELETE:
1193  {
1194  HTREEITEM handle_root = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_ROOT, 0);
1195  HTREEITEM handle_item = BrsFolder_FindItemByPidl(info, pidls[0], handle_root);
1196 
1197  if (handle_item)
1198  SendMessageW(info->hwndTreeView, TVM_DELETEITEM, 0, (LPARAM)handle_item);
1199 
1200  break;
1201  }
1202  }
1203  return ret;
1204 }
#define SHCNE_RMDIR
Definition: shlobj.h:1733
#define TRUE
Definition: types.h:120
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TVGN_ROOT
Definition: commctrl.h:3448
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define TVM_DELETEITEM
Definition: commctrl.h:3410
struct _cl_event * event
Definition: glext.h:7739
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
#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:1156

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnCommand()

static BOOL BrsFolder_OnCommand ( browse_info info,
UINT  id 
)
static

Definition at line 964 of file brsfolder.c.

965 {
966  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
967 #ifdef __REACTOS__
969 #endif
970 
971  switch (id)
972  {
973  case IDOK:
974 #ifdef __REACTOS__
975  /* Get the text */
977  StrTrimW(szPath, L" \t");
978 
979  /* The original pidl is owned by the treeview and will be free'd. */
981  {
982  /* It's valid path */
983  info->pidlRet = ILCreateFromPathW(szPath);
984  }
985  else
986  {
987  info->pidlRet = ILClone(info->pidlRet);
988  }
989 #endif
990  if (info->pidlRet == NULL) /* A null pidl would mean a cancel */
991  info->pidlRet = _ILCreateDesktop();
992  pdump( info->pidlRet );
993  if (lpBrowseInfo->pszDisplayName)
994  SHGetPathFromIDListW( info->pidlRet, lpBrowseInfo->pszDisplayName );
995  EndDialog( info->hWnd, 1 );
996  return TRUE;
997 
998  case IDCANCEL:
999  EndDialog( info->hWnd, 0 );
1000  return TRUE;
1001 
1004  return TRUE;
1005  }
1006  return FALSE;
1007 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:387
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
smooth NULL
Definition: ftsmooth.c:416
__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:833
LPCWSTR szPath
Definition: env.c:35
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248
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:386

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnCreate()

static BOOL BrsFolder_OnCreate ( HWND  hWnd,
browse_info info 
)
static

Definition at line 751 of file brsfolder.c.

752 {
753  LPITEMIDLIST computer_pidl;
754  SHChangeNotifyEntry ntreg;
755  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
756 
757  info->hWnd = hWnd;
759 
760  if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
761  FIXME("flags BIF_NEWDIALOGSTYLE partially implemented\n");
762  if (lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS)
763  FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS);
764 
765  if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
766  {
767  RECT rcWnd;
768 
770 
771  /* TODO: Windows allows shrinking the windows a bit */
772  GetWindowRect(hWnd, &rcWnd);
773  info->szMin.cx = rcWnd.right - rcWnd.left;
774  info->szMin.cy = rcWnd.bottom - rcWnd.top;
775  }
776  else
777  {
778  info->layout = NULL;
779  }
780 
781  if (lpBrowseInfo->lpszTitle)
783  else
785 
786  if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT)
787  || (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
789 
790  /* Hide "Make New Folder" Button? */
791  if ((lpBrowseInfo->ulFlags & BIF_NONEWFOLDERBUTTON)
792  || !(lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
794 
795  /* Hide the editbox? */
796  if (!(lpBrowseInfo->ulFlags & BIF_EDITBOX))
797  {
800  }
801 
803  if (info->hwndTreeView)
804  {
806 
807  /* Resize the treeview if there's not editbox */
808  if ((lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
809  && !(lpBrowseInfo->ulFlags & BIF_EDITBOX))
810  {
811  RECT rc;
812  GetClientRect(info->hwndTreeView, &rc);
813  SetWindowPos(info->hwndTreeView, HWND_TOP, 0, 0,
814  rc.right, rc.bottom + 40, SWP_NOMOVE);
815  }
816  }
817  else
818  ERR("treeview control missing!\n");
819 
820  /* Register for change notifications */
821  SHGetFolderLocation(NULL, CSIDL_DESKTOP, NULL, 0, &computer_pidl);
822 
823  ntreg.pidl = computer_pidl;
824  ntreg.fRecursive = TRUE;
825 
827 
828  browsefolder_callback( info->lpBrowseInfo, hWnd, BFFM_INITIALIZED, 0 );
829 
830  return TRUE;
831 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:387
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:389
#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:94
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
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
#define IDC_BROWSE_FOR_FOLDER_TITLE
Definition: shresdef.h:390
#define SHCNE_ALLEVENTS
Definition: shlobj.h:1753
#define FIXME(fmt,...)
Definition: debug.h:111
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1774
smooth NULL
Definition: ftsmooth.c:416
#define SHV_CHANGE_NOTIFY
Definition: brsfolder.c:47
#define IDC_BROWSE_FOR_FOLDER_FOLDER
Definition: shresdef.h:388
static LAYOUT_DATA * LayoutInit(HWND hwnd, const LAYOUT_INFO *layout_info, int layout_count)
Definition: brsfolder.c:128
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)
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1725
#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:120
static void InitializeTreeView(browse_info *info)
Definition: brsfolder.c:199
#define SUPPORTEDFLAGS
Definition: brsfolder.c:96
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:391
static const WCHAR szBrowseFolderInfo[]
Definition: brsfolder.c:109
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)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static const LAYOUT_INFO g_layout_info[]
Definition: brsfolder.c:81
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:386

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnDestroy()

static INT BrsFolder_OnDestroy ( browse_info info)
static

Definition at line 1142 of file brsfolder.c.

1143 {
1144  if (info->layout)
1145  {
1146  SHFree(info->layout);
1147  info->layout = NULL;
1148  }
1149 
1150  SHChangeNotifyDeregister(info->hNotify);
1151 
1152  return 0;
1153 }
smooth NULL
Definition: ftsmooth.c:416
EXTERN_C BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)
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 712 of file brsfolder.c.

713 {
714  NMTREEVIEWW *pnmtv = (NMTREEVIEWW *)lpnmh;
715 
716  TRACE("%p %x %p msg=%x\n", info, CtlID, lpnmh, pnmtv->hdr.code);
717 
719  return 0;
720 
721  switch (pnmtv->hdr.code)
722  {
723  case TVN_DELETEITEMA:
724  case TVN_DELETEITEMW:
725  return BrsFolder_Treeview_Delete( info, pnmtv );
726 
727  case TVN_ITEMEXPANDINGA:
728  case TVN_ITEMEXPANDINGW:
729  return BrsFolder_Treeview_Expand( info, pnmtv );
730 
731  case TVN_SELCHANGEDA:
732  case TVN_SELCHANGEDW:
733  return BrsFolder_Treeview_Changed( info, pnmtv );
734 
735  case TVN_ENDLABELEDITA:
736  case TVN_ENDLABELEDITW:
738 
739  case TVN_KEYDOWN:
741 
742  default:
743  WARN("unhandled (%d)\n", pnmtv->hdr.code);
744  break;
745  }
746 
747  return 0;
748 }
static LRESULT BrsFolder_Treeview_Expand(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:532
#define TVN_DELETEITEMA
Definition: commctrl.h:3703
#define WARN(fmt,...)
Definition: debug.h:112
static HRESULT BrsFolder_Treeview_Changed(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:567
#define TVN_SELCHANGEDA
Definition: commctrl.h:3643
UINT code
Definition: winuser.h:3134
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3708
UINT_PTR idFrom
Definition: winuser.h:3133
#define TVN_ITEMEXPANDINGW
Definition: commctrl.h:3696
#define TVN_SELCHANGEDW
Definition: commctrl.h:3644
#define TVN_DELETEITEMW
Definition: commctrl.h:3704
#define TRACE(s)
Definition: solgame.cpp:4
#define TVN_ENDLABELEDITA
Definition: commctrl.h:3707
static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydown)
Definition: brsfolder.c:665
static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv)
Definition: brsfolder.c:584
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:391
#define TVN_KEYDOWN
Definition: commctrl.h:3709
static LRESULT BrsFolder_Treeview_Delete(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:517
#define TVN_ITEMEXPANDINGA
Definition: commctrl.h:3695

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnSetExpanded()

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

Definition at line 1009 of file brsfolder.c.

1011 {
1012  LPITEMIDLIST pidlSelection = selection;
1013  LPCITEMIDLIST pidlCurrent, pidlRoot;
1014  TVITEMEXW item;
1015  BOOL bResult = FALSE;
1016 
1017  memset(&item, 0, sizeof(item));
1018 
1019  /* If 'selection' is a string, convert to a Shell ID List. */
1020  if (is_str) {
1021  IShellFolder *psfDesktop;
1022  HRESULT hr;
1023 
1024  hr = SHGetDesktopFolder(&psfDesktop);
1025  if (FAILED(hr))
1026  goto done;
1027 
1028  hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL,
1029  selection, NULL, &pidlSelection, NULL);
1030  IShellFolder_Release(psfDesktop);
1031  if (FAILED(hr))
1032  goto done;
1033  }
1034 #ifdef __REACTOS__
1035  if (_ILIsDesktop(pidlSelection))
1036  {
1037  item.hItem = TVI_ROOT;
1038  bResult = TRUE;
1039  goto done;
1040  }
1041 #endif
1042 
1043  /* Move pidlCurrent behind the SHITEMIDs in pidlSelection, which are the root of
1044  * the sub-tree currently displayed. */
1045  pidlRoot = info->lpBrowseInfo->pidlRoot;
1046  pidlCurrent = pidlSelection;
1047  while (!_ILIsEmpty(pidlRoot) && _ILIsEqualSimple(pidlRoot, pidlCurrent)) {
1048  pidlRoot = ILGetNext(pidlRoot);
1049  pidlCurrent = ILGetNext(pidlCurrent);
1050  }
1051 
1052  /* The given ID List is not part of the SHBrowseForFolder's current sub-tree. */
1053  if (!_ILIsEmpty(pidlRoot))
1054  goto done;
1055 
1056  /* Initialize item to point to the first child of the root folder. */
1057  item.mask = TVIF_PARAM;
1058  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_ROOT, 0);
1059 
1060  if (item.hItem)
1061  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CHILD,
1062  (LPARAM)item.hItem);
1063 
1064  /* Walk the tree along the nodes corresponding to the remaining ITEMIDLIST */
1065  while (item.hItem && !_ILIsEmpty(pidlCurrent)) {
1066  LPTV_ITEMDATA pItemData;
1067 
1068  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
1069  pItemData = (LPTV_ITEMDATA)item.lParam;
1070 
1071  if (_ILIsEqualSimple(pItemData->lpi, pidlCurrent)) {
1072  pidlCurrent = ILGetNext(pidlCurrent);
1073  if (!_ILIsEmpty(pidlCurrent)) {
1074  /* Only expand current node and move on to its first child,
1075  * if we didn't already reach the last SHITEMID */
1076  SendMessageW(info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)item.hItem);
1077  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CHILD,
1078  (LPARAM)item.hItem);
1079  }
1080  } else {
1081  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_NEXT,
1082  (LPARAM)item.hItem);
1083  }
1084  }
1085 
1086  if (_ILIsEmpty(pidlCurrent) && item.hItem)
1087  bResult = TRUE;
1088 
1089 done:
1090  if (pidlSelection && pidlSelection != selection)
1091  ILFree(pidlSelection);
1092 
1093  if (pItem)
1094  *pItem = item.hItem;
1095 
1096  return bResult;
1097 }
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:3415
#define TRUE
Definition: types.h:120
#define TVGN_NEXT
Definition: commctrl.h:3449
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
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:3448
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
if(!(yy_init))
Definition: macro.lex.yy.c:714
LONG HRESULT
Definition: typedefs.h:79
#define TVE_EXPAND
Definition: commctrl.h:3419
#define TVI_ROOT
Definition: commctrl.h:3364
#define TVGN_CHILD
Definition: commctrl.h:3452
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TVM_GETITEMW
Definition: commctrl.h:3482
#define TVIF_PARAM
Definition: commctrl.h:3264
LPITEMIDLIST lpi
Definition: brsfolder.c:70
#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 1111 of file brsfolder.c.

1111  {
1112  LPWSTR selectionW = NULL;
1113  BOOL result = FALSE;
1114  int length;
1115 
1116  if (!is_str)
1117  return BrsFolder_OnSetSelectionW(info, selection, is_str);
1118 
1119  if ((length = MultiByteToWideChar(CP_ACP, 0, selection, -1, NULL, 0)) &&
1120  (selectionW = HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR))) &&
1121  MultiByteToWideChar(CP_ACP, 0, selection, -1, selectionW, length))
1122  {
1123  result = BrsFolder_OnSetSelectionW(info, selectionW, is_str);
1124  }
1125 
1126  HeapFree(GetProcessHeap(), 0, selectionW);
1127  return result;
1128 }
#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
smooth NULL
Definition: ftsmooth.c:416
static BOOL BrsFolder_OnSetSelectionW(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1099
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184
GLuint64EXT * result
Definition: glext.h:11304
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnSetSelectionW()

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

Definition at line 1099 of file brsfolder.c.

1099  {
1100  HTREEITEM hItem;
1101  BOOL bResult;
1102 
1103  if (!selection) return FALSE;
1104 
1105  bResult = BrsFolder_OnSetExpanded(info, selection, is_str, &hItem);
1106  if (bResult)
1107  SendMessageW(info->hwndTreeView, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem );
1108  return bResult;
1109 }
#define TVM_SELECTITEM
Definition: commctrl.h:3474
#define TVGN_CARET
Definition: commctrl.h:3457
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:1009
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 1130 of file brsfolder.c.

1131 {
1132  if ((info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE) && !(pos->flags & SWP_NOSIZE))
1133  {
1134  if (pos->cx < info->szMin.cx)
1135  pos->cx = info->szMin.cx;
1136  if (pos->cy < info->szMin.cy)
1137  pos->cy = info->szMin.cy;
1138  }
1139  return 0;
1140 }
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1150
#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 624 of file brsfolder.c.

625 {
627  SendMessageW(info->hwndTreeView, TVM_EDITLABELW, 0, (LPARAM)rename);
628  return S_OK;
629 }
#define TVM_SELECTITEM
Definition: commctrl.h:3474
#define TVGN_CARET
Definition: commctrl.h:3457
_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:3496
#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 567 of file brsfolder.c.

568 {
569  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
571 
572  ILFree(info->pidlRet);
573  info->pidlRet = ILClone(lptvid->lpifq);
574 
575  if (GetName(lptvid->lpsfParent, lptvid->lpi, SHGDN_NORMAL, name))
577 
578  browsefolder_callback( info->lpBrowseInfo, info->hWnd, BFFM_SELCHANGED,
579  (LPARAM)info->pidlRet );
581  return S_OK;
582 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:387
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:71
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
Definition: brsfolder.c:337
static void BrsFolder_CheckValidSelection(browse_info *info, LPTV_ITEMDATA lptvid)
Definition: brsfolder.c:481
LPARAM lParam
Definition: commctrl.h:3321
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:69
TVITEMW itemNew
Definition: commctrl.h:3634
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:120
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:70

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

518 {
519  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA)pnmtv->itemOld.lParam;
520 
521  TRACE("TVN_DELETEITEMA/W %p\n", lptvid);
522 
523  IShellFolder_Release(lptvid->lpsfParent);
524  if (lptvid->pEnumIL)
525  IEnumIDList_Release(lptvid->pEnumIL);
526  SHFree(lptvid->lpi);
527  SHFree(lptvid->lpifq);
528  SHFree(lptvid);
529  return 0;
530 }
TVITEMW itemOld
Definition: commctrl.h:3633
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:71
LPARAM lParam
Definition: commctrl.h:3321
IEnumIDList * pEnumIL
Definition: brsfolder.c:72
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:69
#define TRACE(s)
Definition: solgame.cpp:4
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
LPITEMIDLIST lpi
Definition: brsfolder.c:70

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Expand()

static LRESULT BrsFolder_Treeview_Expand ( browse_info info,
NMTREEVIEWW pnmtv 
)
static

Definition at line 532 of file brsfolder.c.

533 {
534  IShellFolder *lpsf2 = NULL;
535  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
536  HRESULT r;
537 
538  TRACE("TVN_ITEMEXPANDINGA/W\n");
539 
540  if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))
541  return 0;
542 
543  if (!_ILIsEmpty(lptvid->lpi)) {
544  r = IShellFolder_BindToObject( lptvid->lpsfParent, lptvid->lpi, 0,
545  &IID_IShellFolder, (void**)&lpsf2 );
546  } else {
547  lpsf2 = lptvid->lpsfParent;
548  IShellFolder_AddRef(lpsf2);
549  r = S_OK;
550  }
551 
552  if (SUCCEEDED(r))
553  {
554  FillTreeView( info, lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem, lptvid->pEnumIL);
555  IShellFolder_Release( lpsf2 );
556  }
557 
558  /* My Computer is already sorted and trying to do a simple text
559  * sort will only mess things up */
560  if (!_ILIsMyComputer(lptvid->lpi))
561  SendMessageW( info->hwndTreeView, TVM_SORTCHILDREN,
562  FALSE, (LPARAM)pnmtv->itemNew.hItem );
563 
564  return 0;
565 }
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:256
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:71
#define TVM_SORTCHILDREN
Definition: commctrl.h:3537
BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
Definition: pidl.c:1920
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LPARAM lParam
Definition: commctrl.h:3321
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3281
#define FALSE
Definition: types.h:117
IEnumIDList * pEnumIL
Definition: brsfolder.c:72
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:69
TVITEMW itemNew
Definition: commctrl.h:3634
#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 *)
HTREEITEM hItem
Definition: commctrl.h:3313
UINT state
Definition: commctrl.h:3314
LPITEMIDLIST lpi
Definition: brsfolder.c:70
#define SUCCEEDED(hr)
Definition: intsafe.h:49

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Keydown()

static LRESULT BrsFolder_Treeview_Keydown ( browse_info info,
LPNMTVKEYDOWN  keydown 
)
static

Definition at line 665 of file brsfolder.c.

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

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Rename()

static LRESULT BrsFolder_Treeview_Rename ( browse_info info,
NMTVDISPINFOW pnmtv 
)
static

Definition at line 584 of file brsfolder.c.

585 {
586  LPTV_ITEMDATA item_data;
587  WCHAR old_path[MAX_PATH], new_path[MAX_PATH], *p;
588  NMTREEVIEWW nmtv;
589  TVITEMW item;
590 
591  if(!pnmtv->item.pszText)
592  return 0;
593 
594  item.mask = TVIF_HANDLE|TVIF_PARAM;
595  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);
596  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
597  item_data = (LPTV_ITEMDATA)item.lParam;
598 
599  SHGetPathFromIDListW(item_data->lpifq, old_path);
600  if(!(p = strrchrW(old_path, '\\')))
601  return 0;
602  p = new_path+(p-old_path+1);
603  memcpy(new_path, old_path, (p-new_path)*sizeof(WCHAR));
604  strcpyW(p, pnmtv->item.pszText);
605 
606  if(!MoveFileW(old_path, new_path))
607  return 0;
608 
609  SHFree(item_data->lpifq);
610  SHFree(item_data->lpi);
611  item_data->lpifq = SHSimpleIDListFromPathW(new_path);
612  IShellFolder_ParseDisplayName(item_data->lpsfParent, NULL, NULL,
613  pnmtv->item.pszText, NULL, &item_data->lpi, NULL);
614 
615  item.mask = TVIF_HANDLE|TVIF_TEXT;
616  item.pszText = pnmtv->item.pszText;
617  SendMessageW(info->hwndTreeView, TVM_SETITEMW, 0, (LPARAM)&item);
618 
619  nmtv.itemNew.lParam = item.lParam;
621  return 0;
622 }
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:71
#define TVGN_CARET
Definition: commctrl.h:3457
static HRESULT BrsFolder_Treeview_Changed(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:567
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
LPARAM lParam
Definition: commctrl.h:3321
LPWSTR pszText
Definition: commctrl.h:3316
#define TVM_SETITEMW
Definition: commctrl.h:3489
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1044
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:69
TVITEMW itemNew
Definition: commctrl.h:3634
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:3266
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
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:3262
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
TVITEMW item
Definition: commctrl.h:3668
#define TVM_GETITEMW
Definition: commctrl.h:3482
#define TVIF_PARAM
Definition: commctrl.h:3264
GLfloat GLfloat p
Definition: glext.h:8902
LPITEMIDLIST lpi
Definition: brsfolder.c:70

Referenced by BrsFolder_OnNotify().

◆ BrsFolderDlgProc()

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

Definition at line 1209 of file brsfolder.c.

1211 {
1212  browse_info *info;
1213 
1214  TRACE("hwnd=%p msg=%04x 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam );
1215 
1216  if (msg == WM_INITDIALOG)
1217  return BrsFolder_OnCreate( hWnd, (browse_info*) lParam );
1218 
1220 
1221  switch (msg)
1222  {
1223  case WM_NOTIFY:
1225 
1226  case WM_COMMAND:
1227  return BrsFolder_OnCommand( info, wParam );
1228 
1229  case WM_WINDOWPOSCHANGING:
1231 
1232  case WM_SIZE:
1233  if (info->layout) /* new style dialogs */
1235  return 0;
1236 
1237  case BFFM_SETSTATUSTEXTA:
1238  TRACE("Set status %s\n", debugstr_a((LPSTR)lParam));
1240  break;
1241 
1242  case BFFM_SETSTATUSTEXTW:
1243  TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam));
1245  break;
1246 
1247  case BFFM_ENABLEOK:
1248  TRACE("Enable %ld\n", lParam);
1249  EnableWindow(GetDlgItem(hWnd, 1), lParam != 0);
1250  break;
1251 
1252  case BFFM_SETOKTEXT: /* unicode only */
1253  TRACE("Set OK text %s\n", debugstr_w((LPWSTR)lParam));
1255  break;
1256 
1257  case BFFM_SETSELECTIONA:
1259 
1260  case BFFM_SETSELECTIONW:
1262 
1263  case BFFM_SETEXPANDED: /* unicode only */
1265 
1266  case SHV_CHANGE_NOTIFY:
1268 
1269  case WM_DESTROY:
1270  return BrsFolder_OnDestroy(info);
1271  }
1272  return FALSE;
1273 }
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:389
static BOOL BrsFolder_OnSetSelectionA(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1111
#define LAYOUT_INFO_COUNT
Definition: brsfolder.c:94
static LRESULT BrsFolder_OnChange(browse_info *info, const LPCITEMIDLIST *pidls, LONG event)
Definition: brsfolder.c:1183
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
struct _test_info info[]
Definition: SetCursorPos.c:19
static LRESULT BrsFolder_OnNotify(browse_info *info, UINT CtlID, LPNMHDR lpnmh)
Definition: brsfolder.c:712
#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
smooth NULL
Definition: ftsmooth.c:416
#define SHV_CHANGE_NOTIFY
Definition: brsfolder.c:47
#define BFFM_SETSELECTIONW
Definition: shlobj.h:1173
static BOOL BrsFolder_OnSetSelectionW(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1099
#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:157
#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:1009
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
static LRESULT BrsFolder_OnWindowPosChanging(browse_info *info, WINDOWPOS *pos)
Definition: brsfolder.c:1130
#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:1142
static BOOL BrsFolder_OnCommand(browse_info *info, UINT id)
Definition: brsfolder.c:964
#define BFFM_SETSTATUSTEXTA
Definition: shlobj.h:1170
unsigned int UINT
Definition: ndis.h:50
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static BOOL BrsFolder_OnCreate(HWND hWnd, browse_info *info)
Definition: brsfolder.c:751
#define msg(x)
Definition: auth_time.c:54
static const WCHAR szBrowseFolderInfo[]
Definition: brsfolder.c:109
#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
static const LAYOUT_INFO g_layout_info[]
Definition: brsfolder.c:81
#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 419 of file brsfolder.c.

421 {
422  LPITEMIDLIST pidlTemp = 0;
423  ULONG ulFetched;
424  HRESULT hr;
425  HWND hwnd = GetParent( info->hwndTreeView );
426 
427  TRACE("%p %p %p %p\n",lpsf, pidl, hParent, lpe);
428 
429  /* No IEnumIDList -> No children */
430  if (!lpe) return;
431 
432  SetCapture( hwnd );
434 
435  while (S_OK == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))
436  {
437  ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER;
438  IEnumIDList* pEnumIL = NULL;
439  IShellFolder* pSFChild = NULL;
440  IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulAttrs);
441  if (ulAttrs & SFGAO_FOLDER)
442  {
443  hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild);
444  if (SUCCEEDED(hr))
445  {
446  DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
447  hr = IShellFolder_EnumObjects(pSFChild, hwnd, flags, &pEnumIL);
448  if (hr == S_OK)
449  {
450  if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) ||
451  FAILED(IEnumIDList_Reset(pEnumIL)))
452  {
453  IEnumIDList_Release(pEnumIL);
454  pEnumIL = NULL;
455  }
456  }
457  IShellFolder_Release(pSFChild);
458  }
459  }
460 
461  if (!InsertTreeViewItem(info, lpsf, pidlTemp, pidl, pEnumIL, hParent))
462  goto done;
463  SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */
464  pidlTemp=NULL;
465  }
466 
467 done:
468  ReleaseCapture();
470  SHFree(pidlTemp);
471 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
Definition: brsfolder.c:367
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:115
smooth NULL
Definition: ftsmooth.c:416
#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)
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
#define SUCCEEDED(hr)
Definition: intsafe.h:49

◆ GetIcon()

static int GetIcon ( LPCITEMIDLIST  lpi,
UINT  uFlags 
)
static

Definition at line 292 of file brsfolder.c.

293 {
294  SHFILEINFOW sfi;
295  SHGetFileInfoW((LPCWSTR)lpi, 0 ,&sfi, sizeof(SHFILEINFOW), uFlags);
296  return sfi.iIcon;
297 }
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:413

Referenced by DECLARE_INTERFACE_(), and GetNormalAndSelectedIcons().

◆ GetName()

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

Definition at line 337 of file brsfolder.c.

338 {
340  STRRET str;
341 
342  TRACE("%p %p %x %p\n", lpsf, lpi, dwFlags, lpFriendlyName);
343  if (SUCCEEDED(IShellFolder_GetDisplayNameOf(lpsf, lpi, dwFlags, &str)))
344  bSuccess = StrRetToStrNW(lpFriendlyName, MAX_PATH, &str, lpi);
345  else
346  bSuccess = FALSE;
347 
348  TRACE("-- %s\n", debugstr_w(lpFriendlyName));
349  return bSuccess;
350 }
#define TRUE
Definition: types.h:120
static BOOLEAN bSuccess
Definition: drive.cpp:419
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#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
#define SUCCEEDED(hr)
Definition: intsafe.h:49

Referenced by BrsFolder_Treeview_Changed(), and InsertTreeViewItem().

◆ GetNormalAndSelectedIcons()

static void GetNormalAndSelectedIcons ( LPITEMIDLIST  lpifq,
LPTVITEMW  lpTV_ITEM 
)
static

Definition at line 299 of file brsfolder.c.

300 {
301  LPITEMIDLIST pidlDesktop = NULL;
302  DWORD flags;
303 
304  TRACE("%p %p\n",lpifq, lpTV_ITEM);
305 
306  if (!lpifq)
307  {
308  pidlDesktop = _ILCreateDesktop();
309  lpifq = pidlDesktop;
310  }
311 
313  lpTV_ITEM->iImage = GetIcon( lpifq, flags );
314 
316  lpTV_ITEM->iSelectedImage = GetIcon( lpifq, flags );
317 
318  if (pidlDesktop)
319  ILFree( pidlDesktop );
320 }
#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:3318
#define SHGFI_SMALLICON
Definition: shellapi.h:174
#define SHGFI_PIDL
Definition: shellapi.h:178
smooth NULL
Definition: ftsmooth.c:416
#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:292
int iSelectedImage
Definition: commctrl.h:3319
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by InsertTreeViewItem().

◆ InitializeTreeView()

static void InitializeTreeView ( browse_info info)
static

Definition at line 199 of file brsfolder.c.

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

370 {
371  TVITEMW tvi;
372  TVINSERTSTRUCTW tvins;
373  WCHAR szBuff[MAX_PATH];
374  LPTV_ITEMDATA lptvid=0;
375 
377 
378  tvi.cChildren= pEnumIL ? 1 : 0;
379  tvi.mask |= TVIF_CHILDREN;
380 
381  if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff))
382  return NULL;
383 
384  lptvid = SHAlloc( sizeof(TV_ITEMDATA) );
385  if (!lptvid)
386  return NULL;
387 
388  tvi.pszText = szBuff;
389  tvi.cchTextMax = MAX_PATH;
390  tvi.lParam = (LPARAM)lptvid;
391 
392  IShellFolder_AddRef(lpsf);
393  lptvid->lpsfParent = lpsf;
394  lptvid->lpi = ILClone(pidl);
395  lptvid->lpifq = pidlParent ? ILCombine(pidlParent, pidl) : ILClone(pidl);
396  lptvid->pEnumIL = pEnumIL;
397  GetNormalAndSelectedIcons(lptvid->lpifq, &tvi);
398 
399  tvins.u.item = tvi;
400  tvins.hInsertAfter = NULL;
401  tvins.hParent = hParent;
402 
403  return TreeView_InsertItem( info->hwndTreeView, &tvins );
404 }
int cchTextMax
Definition: commctrl.h:3317
HTREEITEM hParent
Definition: commctrl.h:3389
static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
Definition: brsfolder.c:299
LPITEMIDLIST lpifq
Definition: brsfolder.c:71
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
Definition: brsfolder.c:337
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
LPARAM lParam
Definition: commctrl.h:3321
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3267
UINT mask
Definition: commctrl.h:3312
LPWSTR pszText
Definition: commctrl.h:3316
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3408
#define TVIF_CHILDREN
Definition: commctrl.h:3268
HTREEITEM hInsertAfter
Definition: commctrl.h:3390
IEnumIDList * pEnumIL
Definition: brsfolder.c:72
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:69
int cChildren
Definition: commctrl.h:3320
__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:3262
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define TVIF_IMAGE
Definition: commctrl.h:3263
#define TVIF_PARAM
Definition: commctrl.h:3264
LPITEMIDLIST lpi
Definition: brsfolder.c:70
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 128 of file brsfolder.c.

129 {
130  LAYOUT_DATA *data;
131  RECT rcWnd;
132  int i;
133 
134  GetClientRect(hwnd, &rcWnd);
135  data = SHAlloc(sizeof(LAYOUT_DATA)*layout_count);
136  for (i = 0; i < layout_count; i++)
137  {
138  RECT r;
139  HWND hItem = GetDlgItem(hwnd, layout_info[i].iItemId);
140 
141  if (hItem == NULL)
142  ERR("Item %d not found\n", i);
143  GetWindowRect(hItem, &r);
145 
146  data[i].left = r.left;
147  data[i].right = rcWnd.right - r.right;
148  data[i].width = r.right - r.left;
149 
150  data[i].top = r.top;
151  data[i].bottom = rcWnd.bottom - r.bottom;
152  data[i].height = r.bottom - r.top;
153  }
154  return data;
155 }
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
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
smooth NULL
Definition: ftsmooth.c:416
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)
#define HWND_DESKTOP
Definition: winuser.h:1195
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 157 of file brsfolder.c.

158 {
159  RECT rcWnd;
160  int i;
161 
162  GetClientRect(hwnd, &rcWnd);
163  for (i = 0; i < layout_count; i++)
164  {
165  RECT r;
166  HWND hItem = GetDlgItem(hwnd, layout_info[i].iItemId);
167 
168  GetWindowRect(hItem, &r);
170 
171  if (layout_info[i].dwAnchor & BF_RIGHT)
172  {
173  r.right = rcWnd.right - data[i].right;
174  if (!(layout_info[i].dwAnchor & BF_LEFT))
175  r.left = r.right - data[i].width;
176  }
177 
178  if (layout_info[i].dwAnchor & BF_BOTTOM)
179  {
180  r.bottom = rcWnd.bottom - data[i].bottom;
181  if (!(layout_info[i].dwAnchor & BF_TOP))
182  r.top = r.bottom - data[i].height;
183  }
184 
185  SetWindowPos(hItem, NULL, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER);
186  }
187 }
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
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
smooth NULL
Definition: ftsmooth.c:416
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)
#define BF_TOP
Definition: winuser.h:455
#define HWND_DESKTOP
Definition: winuser.h:1195
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 473 of file brsfolder.c.

474 {
476  if (!data)
477  return FALSE;
478  return (data->type == type);
479 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2176
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define FALSE
Definition: types.h:117
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by BrsFolder_CheckValidSelection().

◆ SHBrowseForFolderA()

LPITEMIDLIST WINAPI SHBrowseForFolderA ( LPBROWSEINFOA  lpbi)

Definition at line 1286 of file brsfolder.c.

1287 {
1288  BROWSEINFOW bi;
1289  LPITEMIDLIST lpid;
1290  INT len;
1291  LPWSTR title;
1292 
1293  TRACE("%p\n", lpbi);
1294 
1295  bi.hwndOwner = lpbi->hwndOwner;
1296  bi.pidlRoot = lpbi->pidlRoot;
1297  if (lpbi->pszDisplayName)
1298  bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) );
1299  else
1300  bi.pszDisplayName = NULL;
1301 
1302  if (lpbi->lpszTitle)
1303  {
1304  len = MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, NULL, 0 );
1305  title = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
1306  MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, title, len );
1307  }
1308  else
1309  title = NULL;
1310 
1311  bi.lpszTitle = title;
1312  bi.ulFlags = lpbi->ulFlags;
1313  bi.lpfn = lpbi->lpfn;
1314  bi.lParam = lpbi->lParam;
1315  bi.iImage = lpbi->iImage;
1316  lpid = SHBrowseForFolderW( &bi );
1317  if (bi.pszDisplayName)
1318  {
1320  lpbi->pszDisplayName, MAX_PATH, 0, NULL);
1322  }
1323  HeapFree(GetProcessHeap(), 0, title);
1324  lpbi->iImage = bi.iImage;
1325  return lpid;
1326 }
#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
smooth NULL
Definition: ftsmooth.c:416
LPCWSTR lpszTitle
Definition: shlobj.h:1130
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
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:1335
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 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:483

Referenced by test_click_make_new_folder_button(), and test_selection().

◆ SHBrowseForFolderW()

LPITEMIDLIST WINAPI SHBrowseForFolderW ( LPBROWSEINFOW  lpbi)

Definition at line 1335 of file brsfolder.c.

1336 {
1337  browse_info info;
1338  DWORD r;
1339  HRESULT hr;
1340 #ifdef __REACTOS__
1341  WORD wDlgId;
1342 #else
1343  const WCHAR * templateName;
1344  INITCOMMONCONTROLSEX icex;
1345 #endif
1346 
1347  info.hWnd = 0;
1348  info.pidlRet = NULL;
1349  info.lpBrowseInfo = lpbi;
1350  info.hwndTreeView = NULL;
1351 
1352 #ifndef __REACTOS__
1353  icex.dwSize = sizeof( icex );
1354  icex.dwICC = ICC_TREEVIEW_CLASSES;
1355  InitCommonControlsEx( &icex );
1356 #endif
1357 
1358  hr = OleInitialize(NULL);
1359 
1360  if (lpbi->ulFlags & BIF_NEWDIALOGSTYLE)
1361  wDlgId = IDD_BROWSE_FOR_FOLDER_NEW;
1362  else
1363  wDlgId = IDD_BROWSE_FOR_FOLDER;
1366  if (SUCCEEDED(hr))
1367  OleUninitialize();
1368  if (!r)
1369  {
1370  ILFree(info.pidlRet);
1371  return NULL;
1372  }
1373 
1374  return info.pidlRet;
1375 }
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
struct _test_info info[]
Definition: SetCursorPos.c:19
#define ICC_TREEVIEW_CLASSES
Definition: commctrl.h:59
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_BROWSE_FOR_FOLDER
Definition: shresdef.h:384
#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
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define IDD_BROWSE_FOR_FOLDER_NEW
Definition: shresdef.h:385
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
UINT ulFlags
Definition: shlobj.h:1131
#define shell32_hInstance
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static INT_PTR CALLBACK BrsFolderDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: brsfolder.c:1209
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
#define SUCCEEDED(hr)
Definition: intsafe.h:49

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:387
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:389
#define IDOK
Definition: winuser.h:824
#define BF_BOTTOM
Definition: winuser.h:457
#define IDC_BROWSE_FOR_FOLDER_TITLE
Definition: shresdef.h:390
#define IDC_BROWSE_FOR_FOLDER_FOLDER
Definition: shresdef.h:388
#define BF_RIGHT
Definition: winuser.h:456
#define BF_TOP
Definition: winuser.h:455
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:391
#define IDCANCEL
Definition: winuser.h:825
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:386
#define BF_LEFT
Definition: winuser.h:454

Definition at line 81 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 1276 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 1278 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 109 of file brsfolder.c.

Referenced by BrsFolder_OnCreate(), and BrsFolderDlgProc().