mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 00:41:36 +00:00
[SHELL32]
* Fix another comment. * Fix a cch/cb bug. * Make use of the DSA_DestroyCallback function instead of messing around with the internals of the DSA. CORE-8564 svn path=/branches/shell-experiments/; revision=64646
This commit is contained in:
parent
bd7fc320f2
commit
e052b025f2
|
@ -970,12 +970,12 @@ static DWORD _ConvertAtoW(PCSTR strSrc, PCWSTR* pStrDest, BOOL isList)
|
|||
sizeA = lstrlenA(strSrc) + 1;
|
||||
}
|
||||
|
||||
// Measure the
|
||||
// Measure the needed allocation size.
|
||||
int sizeW = MultiByteToWideChar(CP_ACP, 0, strSrc, sizeA, NULL, 0);
|
||||
if (!sizeW)
|
||||
return GetLastError();
|
||||
|
||||
PWSTR strDest = (PWSTR) HeapAlloc(GetProcessHeap(), 0, sizeW);
|
||||
PWSTR strDest = (PWSTR) HeapAlloc(GetProcessHeap(), 0, sizeW * sizeof(WCHAR));
|
||||
if (!strDest)
|
||||
return ERROR_OUTOFMEMORY;
|
||||
|
||||
|
@ -1739,7 +1739,16 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define SHDSA_GetItemCount(hdsa) (*(int*)(hdsa))
|
||||
// Used by SHFreeNameMappings
|
||||
static int CALLBACK _DestroyCallback(void *p, void *pData)
|
||||
{
|
||||
LPSHNAMEMAPPINGW lp = (SHNAMEMAPPINGW *)p;
|
||||
|
||||
SHFree(lp->pszOldPath);
|
||||
SHFree(lp->pszNewPath);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHFreeNameMappings [shell32.246]
|
||||
|
@ -1757,16 +1766,7 @@ void WINAPI SHFreeNameMappings(HANDLE hNameMapping)
|
|||
{
|
||||
if (hNameMapping)
|
||||
{
|
||||
int i = SHDSA_GetItemCount((HDSA)hNameMapping) - 1;
|
||||
|
||||
for (; i>= 0; i--)
|
||||
{
|
||||
LPSHNAMEMAPPINGW lp = (SHNAMEMAPPINGW *)DSA_GetItemPtr((HDSA)hNameMapping, i);
|
||||
|
||||
SHFree(lp->pszOldPath);
|
||||
SHFree(lp->pszNewPath);
|
||||
}
|
||||
DSA_Destroy((HDSA)hNameMapping);
|
||||
DSA_DestroyCallback((HDSA) hNameMapping, _DestroyCallback, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue