Use wine_get_dos_file_name instead of GetFullPathName.
This commit is contained in:
parent
cdf02acdca
commit
e4d2ef4559
|
@ -796,12 +796,15 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_GetDisplayNameOf(IShellFolder2* i
|
||||||
{
|
{
|
||||||
if (!pidl->mkid.cb) {
|
if (!pidl->mkid.cb) {
|
||||||
lpName->uType = STRRET_CSTR;
|
lpName->uType = STRRET_CSTR;
|
||||||
|
if (This->m_dwPathMode == PATHMODE_UNIX) {
|
||||||
strcpy(lpName->u.cStr, This->m_pszPath);
|
strcpy(lpName->u.cStr, This->m_pszPath);
|
||||||
if (This->m_dwPathMode == PATHMODE_DOS) {
|
} else {
|
||||||
char path[MAX_PATH];
|
WCHAR *pwszDosPath = wine_get_dos_file_name(This->m_pszPath);
|
||||||
GetFullPathNameA(lpName->u.cStr, MAX_PATH, path, NULL);
|
if (!pwszDosPath)
|
||||||
PathRemoveBackslashA(path);
|
return HRESULT_FROM_WIN32(GetLastError());
|
||||||
strcpy(lpName->u.cStr, path);
|
PathRemoveBackslashW(pwszDosPath);
|
||||||
|
WideCharToMultiByte(CP_UNIXCP, 0, pwszDosPath, -1, lpName->u.cStr, MAX_PATH, NULL, NULL);
|
||||||
|
HeapFree(GetProcessHeap(), 0, pwszDosPath);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
IShellFolder *pSubFolder;
|
IShellFolder *pSubFolder;
|
||||||
|
@ -835,8 +838,8 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_SetNameOf(IShellFolder2* iface, H
|
||||||
{
|
{
|
||||||
UnixFolder *This = ADJUST_THIS(UnixFolder, IShellFolder2, iface);
|
UnixFolder *This = ADJUST_THIS(UnixFolder, IShellFolder2, iface);
|
||||||
|
|
||||||
char szSrc[FILENAME_MAX], szDest[FILENAME_MAX], szDosDest[MAX_PATH];
|
char szSrc[FILENAME_MAX], szDest[FILENAME_MAX];
|
||||||
WCHAR wszDosDest[MAX_PATH];
|
WCHAR *pwszDosDest;
|
||||||
int cBasePathLen = lstrlenA(This->m_pszPath);
|
int cBasePathLen = lstrlenA(This->m_pszPath);
|
||||||
struct stat statDest;
|
struct stat statDest;
|
||||||
LPITEMIDLIST pidlSrc, pidlDest;
|
LPITEMIDLIST pidlSrc, pidlDest;
|
||||||
|
@ -885,10 +888,9 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_SetNameOf(IShellFolder2* iface, H
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
/* Build a pidl for the path of the renamed file */
|
/* Build a pidl for the path of the renamed file */
|
||||||
if (!GetFullPathNameA(szDest, MAX_PATH, szDosDest, NULL) ||
|
pwszDosDest = wine_get_dos_file_name(szDest);
|
||||||
!MultiByteToWideChar(CP_UNIXCP, 0, szDosDest, -1, wszDosDest, MAX_PATH) ||
|
if (!pwszDosDest || !UNIXFS_path_to_pidl(This, pwszDosDest, &pidlDest)) {
|
||||||
!UNIXFS_path_to_pidl(This, wszDosDest, &pidlDest))
|
HeapFree(GetProcessHeap(), 0, pwszDosDest);
|
||||||
{
|
|
||||||
rename(szDest, szSrc); /* Undo the renaming */
|
rename(szDest, szSrc); /* Undo the renaming */
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -903,8 +905,9 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_SetNameOf(IShellFolder2* iface, H
|
||||||
ILFree(pidlDest);
|
ILFree(pidlDest);
|
||||||
|
|
||||||
if (ppidlOut)
|
if (ppidlOut)
|
||||||
_ILCreateFromPathW(wszDosDest, ppidlOut);
|
_ILCreateFromPathW(pwszDosDest, ppidlOut);
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, pwszDosDest);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue