[RAPPS] Fix CAB codepage handling (#7165)

- MultiByteToWide parameter bug.
- Use CP_UTF8 to convert cab filenames if the UTF attribute is set.
This commit is contained in:
Whindmar Saksit 2024-07-22 16:20:31 +02:00 committed by GitHub
parent 7f0e8a3697
commit a45d375f60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -47,7 +47,7 @@ MultiByteToWide(const CStringA &szSource, CStringW &szDest, UINT Codepage)
return FALSE;
// do the actual conversion
sz = MultiByteToWideChar(CP_UTF8, 0, szSource, -1, szDest.GetBuffer(sz), sz);
sz = MultiByteToWideChar(Codepage, 0, szSource, -1, szDest.GetBuffer(sz), sz);
szDest.ReleaseBuffer();
return sz != 0;
@ -160,7 +160,8 @@ FNFDINOTIFY(fnNotify)
// Append the destination directory to the file name.
MultiByteToWide(pND->OutputDir, szExtractDir, CP_UTF8);
MultiByteToWide(pfdin->psz1, szCabFileName, CP_ACP);
UINT codepage = (pfdin->attribs & _A_NAME_IS_UTF) ? CP_UTF8 : CP_ACP;
MultiByteToWide(pfdin->psz1, szCabFileName, codepage);
if (!NotifyFileExtractCallback(szCabFileName, pfdin->cb, pfdin->attribs,
pND->Callback, pND->CallerCookie))