mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[SHELL32] Implement PathResolveA function (#3771)
- Follow-up of #3762. - Add PathResolveA implementation by ANSI/Unicode string conversion. CORE-12665
This commit is contained in:
parent
0ffbbab5a2
commit
561fa8d29b
1 changed files with 42 additions and 2 deletions
|
@ -631,8 +631,48 @@ VOID WINAPI PathQualifyAW(LPVOID pszPath)
|
|||
|
||||
BOOL WINAPI PathResolveA(LPSTR path, LPCSTR *dirs, DWORD flags)
|
||||
{
|
||||
FIXME("(%s,%p,0x%08x),stub!\n", debugstr_a(path), dirs, flags);
|
||||
return FALSE;
|
||||
BOOL ret = FALSE;
|
||||
LPWSTR *dirsW = NULL;
|
||||
DWORD iDir, cDirs, cbDirs;
|
||||
WCHAR pathW[MAX_PATH];
|
||||
|
||||
TRACE("PathResolveA(%s,%p,0x%08x)\n", debugstr_a(path), dirs, flags);
|
||||
|
||||
if (dirs)
|
||||
{
|
||||
for (cDirs = 0; dirs[cDirs]; ++cDirs)
|
||||
;
|
||||
|
||||
cbDirs = (cDirs + 1) * sizeof(LPWSTR);
|
||||
dirsW = SHAlloc(cbDirs);
|
||||
if (!dirsW)
|
||||
goto Cleanup;
|
||||
|
||||
ZeroMemory(dirsW, cbDirs);
|
||||
for (iDir = 0; iDir < cDirs; ++iDir)
|
||||
{
|
||||
__SHCloneStrAtoW(&dirsW[iDir], dirs[iDir]);
|
||||
if (dirsW[iDir] == NULL)
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
SHAnsiToUnicode(path, pathW, _countof(pathW));
|
||||
|
||||
ret = PathResolveW(pathW, (LPCWSTR*)dirsW, flags);
|
||||
if (ret)
|
||||
SHUnicodeToAnsi(pathW, path, MAX_PATH);
|
||||
|
||||
Cleanup:
|
||||
if (dirsW)
|
||||
{
|
||||
for (iDir = 0; iDir < cDirs; ++iDir)
|
||||
{
|
||||
SHFree(dirsW[iDir]);
|
||||
}
|
||||
SHFree(dirsW);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI PathResolveW(LPWSTR path, LPCWSTR *dirs, DWORD flags)
|
||||
|
|
Loading…
Reference in a new issue