mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[SHELL32]
- partial Wine sync, fixes crashing shlfileop winetest: Use the current directory when copying to an empty destination. Fix a memory leak in SHFileOperationW. Vincent Povirk <vincent at codeweavers dot com> svn path=/trunk/; revision=46098
This commit is contained in:
parent
e277aa50f4
commit
8e7d72058b
1 changed files with 22 additions and 0 deletions
|
@ -1087,6 +1087,20 @@ static HRESULT copy_files(FILE_OPERATION *op, const FILE_LIST *flFrom, FILE_LIST
|
|||
if (flFrom->bAnyDontExist)
|
||||
return ERROR_SHELL_INTERNAL_FILE_NOT_FOUND;
|
||||
|
||||
if (flTo->dwNumFiles == 0)
|
||||
{
|
||||
/* If the destination is empty, SHFileOperation should use the current directory */
|
||||
WCHAR curdir[MAX_PATH+1];
|
||||
|
||||
GetCurrentDirectoryW(MAX_PATH, curdir);
|
||||
curdir[lstrlenW(curdir)+1] = 0;
|
||||
|
||||
destroy_file_list(flTo);
|
||||
ZeroMemory(flTo, sizeof(FILE_LIST));
|
||||
parse_file_list(flTo, curdir);
|
||||
fileDest = &flTo->feFiles[0];
|
||||
}
|
||||
|
||||
if (op->req->fFlags & FOF_MULTIDESTFILES)
|
||||
{
|
||||
if (flFrom->bAnyFromWildcard)
|
||||
|
@ -1097,6 +1111,14 @@ static HRESULT copy_files(FILE_OPERATION *op, const FILE_LIST *flFrom, FILE_LIST
|
|||
if (flFrom->dwNumFiles != 1 && !IsAttribDir(fileDest->attributes))
|
||||
return ERROR_CANCELLED;
|
||||
|
||||
/* Free all but the first entry. */
|
||||
for (i = 1; i < flTo->dwNumFiles; i++)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFilename);
|
||||
HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFullPath);
|
||||
}
|
||||
|
||||
flTo->dwNumFiles = 1;
|
||||
}
|
||||
else if (IsAttribDir(fileDest->attributes))
|
||||
|
|
Loading…
Reference in a new issue