shell32: Fixed handling of null-terminated file list in SHFileOperation.
This commit is contained in:
parent
c29b7c3524
commit
b222001def
|
@ -791,29 +791,19 @@ static DWORD count_wildcard_files(LPCWSTR szWildFile)
|
||||||
static DWORD count_files(LPCWSTR szFileList)
|
static DWORD count_files(LPCWSTR szFileList)
|
||||||
{
|
{
|
||||||
DWORD dwCount = 0;
|
DWORD dwCount = 0;
|
||||||
LPCWSTR p = szFileList;
|
LPCWSTR str = szFileList;
|
||||||
LPCWSTR q = p + 1;
|
|
||||||
LPCWSTR str = p;
|
|
||||||
|
|
||||||
/* test empty list */
|
/* test empty list */
|
||||||
if (!szFileList[0] && !szFileList[1])
|
if (!szFileList[0]) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* p,q search: stop when we reach double null terminator */
|
while (*str)
|
||||||
while (*p || *q)
|
|
||||||
{
|
|
||||||
if (!*q)
|
|
||||||
{
|
{
|
||||||
if (StrPBrkW(str, wWildcardChars))
|
if (StrPBrkW(str, wWildcardChars))
|
||||||
dwCount += count_wildcard_files(str);
|
dwCount += count_wildcard_files(str);
|
||||||
else
|
else
|
||||||
dwCount++;
|
dwCount++;
|
||||||
|
|
||||||
str = q + 1;
|
str += lstrlenW(str) + 1;
|
||||||
}
|
|
||||||
|
|
||||||
p++;
|
|
||||||
q++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return dwCount;
|
return dwCount;
|
||||||
|
|
Loading…
Reference in New Issue