diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec index 49474dfda0d..76e8d485c0f 100644 --- a/dlls/shell32/shell32.spec +++ b/dlls/shell32/shell32.spec @@ -101,7 +101,7 @@ init Shell32LibMain 93 stub Win32CreateDirectory 94 stub Win32RemoveDirectory 95 stdcall SHLogILFromFSIL (ptr) SHLogILFromFSIL - 96 stdcall StrRetToStrN (long long long long) StrRetToStrN + 96 stdcall StrRetToStrN (long long long long) StrRetToStrNAW 97 stdcall SHWaitForFileToOpen (long long long) SHWaitForFileToOpen 98 stdcall SHGetRealIDL (long long long) SHGetRealIDL 99 stdcall SetAppStartingCursor (long long) SetAppStartingCursor diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index 9565d1e4c9e..6b1268d2922 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -909,30 +909,57 @@ HRESULT WINAPI IsUserAdmin(void) * NOTES * the pidl is for STRRET OFFSET */ -HRESULT WINAPI StrRetToStrN (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) -{ TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); +HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) +{ + TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); switch (src->uType) - { case STRRET_WSTR: + { + case STRRET_WSTR: WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL); SHFree(src->u.pOleStr); break; case STRRET_CSTRA: - if (VERSION_OsIsUnicode()) - lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len); - else - lstrcpynA((LPSTR)dest, src->u.cStr, len); + lstrcpynA((LPSTR)dest, src->u.cStr, len); + break; + + case STRRET_OFFSETA: + lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); + break; + + default: + FIXME("unknown type!\n"); + if (len) + { + *(LPSTR)dest = '\0'; + } + return(FALSE); + } + return S_OK; +} + +HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) +{ + TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); + + switch (src->uType) + { + case STRRET_WSTR: + lstrcpynW((LPWSTR)dest, src->u.pOleStr, len); + SHFree(src->u.pOleStr); + break; + + case STRRET_CSTRA: + lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len); break; case STRRET_OFFSETA: if (pidl) - { if(VERSION_OsIsUnicode()) - lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); - else - lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); - break; + { + lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); } + break; default: FIXME("unknown type!\n"); @@ -941,7 +968,13 @@ HRESULT WINAPI StrRetToStrN (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST } return(FALSE); } - return(TRUE); + return S_OK; +} +HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) +{ + if(VERSION_OsIsUnicode()) + return StrRetToStrNW (dest, len, src, pidl); + return StrRetToStrNA (dest, len, src, pidl); } /*************************************************************************