Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
b74beada
Commit
b74beada
authored
Apr 26, 2003
by
Rolf Kalbermatter
Committed by
Alexandre Julliard
Apr 26, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some typos and a memory leak in SHFileOperationA.
parent
69361e08
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
27 deletions
+23
-27
shlfileop.c
dlls/shell32/shlfileop.c
+23
-27
No files found.
dlls/shell32/shlfileop.c
View file @
b74beada
...
...
@@ -613,7 +613,7 @@ LPWSTR SHFileStrCpyCatW(LPWSTR pTo, LPCWSTR pFrom, LPCWSTR pCatStr)
lstrcpyW
(
&
pTo
[
i_len
+
1
],
pCatStr
);
}
pToFile
=
StrRChrW
(
pTo
,
NULL
,
'\\'
);
/* !!
termination of the new string-group */
/*
termination of the new string-group */
pTo
[(
lstrlenW
(
pTo
))
+
1
]
=
'\0'
;
}
return
pToFile
;
...
...
@@ -644,9 +644,9 @@ BOOL SHELL_FileNamesMatch(LPCWSTR pszFiles1, LPCWSTR pszFiles2, BOOL bOnlySrc)
/*************************************************************************
*
* SHName
(s)
Translate HelperFunction for SHFileOperationA
* SHNameTranslate HelperFunction for SHFileOperationA
*
* Translates a list of 0 terminated ASCI strings into Unicode. If *wString
* Translates a list of 0 terminated ASCI
I
strings into Unicode. If *wString
* is NULL, only the necessary size of the string is determined and returned,
* otherwise the ASCII strings are copied into it and the buffer is increased
* to point to the location after the final 0 termination char.
...
...
@@ -690,42 +690,38 @@ DWORD SHNameTranslate(LPWSTR* wString, LPCWSTR* pWToFrom, BOOL more)
DWORD
WINAPI
SHFileOperationA
(
LPSHFILEOPSTRUCTA
lpFileOp
)
{
SHFILEOPSTRUCTW
nFileOp
=
*
((
LPSHFILEOPSTRUCTW
)
lpFileOp
);
DWORD
retCode
=
0
,
size
=
0
;
LPWSTR
wString
=
NULL
;
/* we change this in SHNameTranslate */
DWORD
retCode
=
0
,
size
;
LPWSTR
ForFree
=
NULL
,
/* we change wString in SHNameTranslate and can't use it for freeing */
wString
=
NULL
;
/* we change this in SHNameTranslate */
TRACE
(
"SHFileOperationA"
);
if
(
FO_DELETE
==
(
nFileOp
.
wFunc
&
FO_MASK
))
nFileOp
.
pTo
=
NULL
;
/* we need a NULL or a valid pointer for translation */
if
(
!
(
nFileOp
.
fFlags
&
FOF_SIMPLEPROGRESS
))
nFileOp
.
lpszProgressTitle
=
NULL
;
/* we need a NULL or a valid pointer for translation */
do
while
(
1
)
/* every loop calculate size, second translate also, if we have storage for this */
{
if
(
size
)
{
wString
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
if
(
!
wString
)
{
retCode
=
ERROR_OUTOFMEMORY
;
nFileOp
.
fAnyOperationsAborted
=
TRUE
;
SetLastError
(
retCode
);
return
retCode
;
}
}
size
=
SHNameTranslate
(
&
wString
,
&
nFileOp
.
lpszProgressTitle
,
FALSE
);
/* no loop */
size
+=
SHNameTranslate
(
&
wString
,
&
nFileOp
.
pFrom
,
TRUE
);
/* internal loop */
size
+=
SHNameTranslate
(
&
wString
,
&
nFileOp
.
pTo
,
TRUE
);
/* internal loop */
/* first loop only for calculate size, no translation, we hav a NULL-pointer */
}
while
(
!
wString
);
/* second loop calculate size, also translation. We have a valid pointer */
retCode
=
SHFileOperationW
(
&
nFileOp
);
if
(
wString
)
HeapFree
(
GetProcessHeap
(),
0
,
wString
);
if
(
retCode
)
{
nFileOp
.
fAnyOperationsAborted
=
TRUE
;
if
(
ForFree
)
{
retCode
=
SHFileOperationW
(
&
nFileOp
);
HeapFree
(
GetProcessHeap
(),
0
,
ForFree
);
/* we can not use wString, it was changed */
break
;
}
else
{
wString
=
ForFree
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
if
(
ForFree
)
continue
;
retCode
=
ERROR_OUTOFMEMORY
;
nFileOp
.
fAnyOperationsAborted
=
TRUE
;
SetLastError
(
retCode
);
return
retCode
;
}
}
lpFileOp
->
hNameMappings
=
nFileOp
.
hNameMappings
;
lpFileOp
->
fAnyOperationsAborted
=
nFileOp
.
fAnyOperationsAborted
;
return
retCode
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment