mirror of
https://github.com/modernw/App-Installer-For-Windows-8.x-Reset.git
synced 2026-06-14 03:16:38 +10:00
try to fix bugs.
This commit is contained in:
@@ -20,6 +20,32 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
LPWSTR AllocWideString (const std::wstring &str)
|
||||||
|
{
|
||||||
|
size_t size = (str.length () + 1) * sizeof (WCHAR);
|
||||||
|
LPWSTR buf = (LPWSTR)CoTaskMemAlloc (size);
|
||||||
|
if (!buf) return nullptr;
|
||||||
|
ZeroMemory (buf, size);
|
||||||
|
wcscpy (buf, str.c_str ());
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
// 测试用
|
||||||
|
LPWSTR AllocWideString (LPCWSTR str)
|
||||||
|
{
|
||||||
|
if (!str) return nullptr;
|
||||||
|
size_t size = (wcslen (str) + 1) * sizeof (WCHAR);
|
||||||
|
LPWSTR buf = (LPWSTR)CoTaskMemAlloc (size);
|
||||||
|
if (!buf) return nullptr;
|
||||||
|
ZeroMemory (buf, size);
|
||||||
|
wcscpy (buf, str);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
#define _wcsdup AllocWideString
|
||||||
|
#define free CoTaskMemFree
|
||||||
|
#define malloc CoTaskMemAlloc
|
||||||
|
#define realloc CoTaskMemRealloc
|
||||||
|
#define calloc(_cnt_, _size_) CoTaskMemAlloc (_cnt_ * _size_)
|
||||||
|
|
||||||
const std::wstring g_swMsResUriProtocolName = L"ms-resource:";
|
const std::wstring g_swMsResUriProtocolName = L"ms-resource:";
|
||||||
const size_t g_cbMsResPNameLength = lstrlenW (g_swMsResUriProtocolName.c_str ());
|
const size_t g_cbMsResPNameLength = lstrlenW (g_swMsResUriProtocolName.c_str ());
|
||||||
std::wstring g_swExcept = L"";
|
std::wstring g_swExcept = L"";
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ typedef class prifile
|
|||||||
{
|
{
|
||||||
LPWSTR lpstr = nullptr;
|
LPWSTR lpstr = nullptr;
|
||||||
reltask release ([&lpstr] () {
|
reltask release ([&lpstr] () {
|
||||||
if (lpstr) free (lpstr);
|
if (lpstr) PriFormatFreeString (lpstr);
|
||||||
lpstr = nullptr;
|
lpstr = nullptr;
|
||||||
});
|
});
|
||||||
lpstr = GetPriResource (m_hPriFile, resname.c_str ());
|
lpstr = GetPriResource (m_hPriFile, resname.c_str ());
|
||||||
|
|||||||
@@ -127,6 +127,7 @@
|
|||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PRIFORMATCLI_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PRIFORMATCLI_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
|||||||
Reference in New Issue
Block a user