https://git.reactos.org/?p=reactos.git;a=commitdiff;h=78b78d6e735a69f497c62…
commit 78b78d6e735a69f497c6277f6dfdb10d55505802
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Sun Nov 5 12:09:42 2017 +0200
[SHELL32] SHBrowseForFolderW: Fix creating directories in the desktop and in drives
like C: CORE-13925
---
dll/win32/shell32/wine/brsfolder.c | 49 +++++++++++++++++++++++++-------------
1 file changed, 33 insertions(+), 16 deletions(-)
diff --git a/dll/win32/shell32/wine/brsfolder.c b/dll/win32/shell32/wine/brsfolder.c
index 36608314e2..499e040ef3 100644
--- a/dll/win32/shell32/wine/brsfolder.c
+++ b/dll/win32/shell32/wine/brsfolder.c
@@ -748,35 +748,52 @@ static HRESULT BrsFolder_NewFolder(browse_info *info)
HRESULT hr;
int len;
- if(!info->pidlRet) {
- ERR("Make new folder button should be disabled\n");
- return E_FAIL;
- }
-
- /* Create new directory */
+#ifdef __REACTOS__
hr = SHGetDesktopFolder(&desktop);
if(FAILED(hr))
return hr;
- hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder,
(void**)&cur);
- IShellFolder_Release(desktop);
- if(FAILED(hr))
- return hr;
-#ifdef __REACTOS__
- hr = SHGetPathFromIDListW(info->pidlRet, path);
+ if (info->pidlRet)
+ {
+ hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0,
&IID_IShellFolder, (void**)&cur);
+ IShellFolder_Release(desktop);
+ if(FAILED(hr))
+ return hr;
+
+ hr = SHGetPathFromIDListW(info->pidlRet, path);
+ }
+ else
+ {
+ cur = desktop;
+ hr = SHGetFolderPathW(NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT,
path);
+ }
if(FAILED(hr))
return hr;
- len = strlenW(path);
- if(len<MAX_PATH)
- len++;
-
if (!LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder,
_countof(wszNewFolder)))
return E_FAIL;
if (!PathYetAnotherMakeUniqueName(name, path, NULL, wszNewFolder))
return E_FAIL;
+
+ len = strlenW(path);
+ if(len<MAX_PATH && name[len] == L'\\')
+ len++;
#else
+ if(!info->pidlRet) {
+ ERR("Make new folder button should be disabled\n");
+ return E_FAIL;
+ }
+
+ /* Create new directory */
+ hr = SHGetDesktopFolder(&desktop);
+ if(FAILED(hr))
+ return hr;
+
+ hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder,
(void**)&cur);
+ IShellFolder_Release(desktop);
+ if(FAILED(hr))
+ return hr;
hr = IShellFolder_QueryInterface(cur, &IID_ISFHelper, (void**)&sfhelper);
if(FAILED(hr))