mirror of
https://github.com/modernw/AppInstallerForWin8.git
synced 2026-04-11 16:57:18 +10:00
Updates for WebUI:
· [Important] Fixed the destruction issue with PriReader (caused by incorrect pointer types leading to unexecuted object destruction tasks). · [Important] Added a program execution selection interface for packages containing multiple applications (still using WebUI). Issue: Since the selection window is set to close when losing focus, checking the "Launch when ready" option after successful installation causes the pop-up window to disappear when a Toast notification appears (due to focus loss). Currently, the selection window can only be displayed by clicking a button. · [Optimization] Reduced the creation of PriReader objects to lower memory and storage consumption. (Translated by DeepSeek)
This commit is contained in:
@@ -31,4 +31,33 @@ LPSTR StreamToBase64 (HISTREAM ifile)
|
||||
if (!lpszStr) return NULL;
|
||||
lstrcpyA (lpszStr, res.c_str ());
|
||||
return lpszStr;
|
||||
}
|
||||
}
|
||||
|
||||
LPWSTR StreamToBase64W (HISTREAM ifile)
|
||||
{
|
||||
if (!ifile) return NULL;
|
||||
IStream *pStream = (IStream *)ifile;
|
||||
LARGE_INTEGER liZero = {};
|
||||
pStream->Seek (liZero, STREAM_SEEK_SET, nullptr);
|
||||
STATSTG statstg;
|
||||
pStream->Stat (&statstg, STATFLAG_NONAME);
|
||||
ULARGE_INTEGER uliSize = statstg.cbSize;
|
||||
std::vector<BYTE> buffer (uliSize.QuadPart);
|
||||
ULONG bytesRead;
|
||||
pStream->Read (buffer.data (), static_cast<ULONG>(buffer.size ()), &bytesRead);
|
||||
DWORD base64Size = 0;
|
||||
if (!CryptBinaryToStringW (buffer.data (), bytesRead, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, nullptr, &base64Size))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
std::vector <WCHAR> base64Buffer (base64Size);
|
||||
if (!CryptBinaryToStringW (buffer.data (), bytesRead, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, base64Buffer.data (), &base64Size))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
std::wstring res = std::wstring (base64Buffer.begin (), base64Buffer.end ());
|
||||
LPWSTR lpszStr = (LPWSTR)calloc (res.capacity (), sizeof (WCHAR));
|
||||
if (!lpszStr) return NULL;
|
||||
lstrcpyW (lpszStr, res.c_str ());
|
||||
return lpszStr;
|
||||
}
|
||||
|
||||
@@ -14,3 +14,5 @@ typedef HANDLE HISTREAM;
|
||||
typedef char *LPSTR;
|
||||
|
||||
extern "C" BASE64IMG_API LPSTR StreamToBase64 (HISTREAM ifile);
|
||||
|
||||
extern "C" BASE64IMG_API LPWSTR StreamToBase64W (HISTREAM ifile);
|
||||
|
||||
Reference in New Issue
Block a user