diff --git a/include/WinStd/Win.h b/include/WinStd/Win.h index 4935c954..bf985649 100644 --- a/include/WinStd/Win.h +++ b/include/WinStd/Win.h @@ -702,12 +702,12 @@ static _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ c template static _Success_(return != 0) int LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string &sBuffer) noexcept { - // Get read-only pointer to string resource. - LPCSTR pszStr; - int i = LoadStringA(hInstance, uID, reinterpret_cast(&pszStr), 0); + // Get read-only pointer to string resource. Works with LoadStringW only. + LPCWSTR pszStr; + int i = LoadStringW(hInstance, uID, reinterpret_cast(&pszStr), 0); if (i) { - sBuffer.assign(pszStr, i); - return i; + i = wcsnlen_s(pszStr, i); + return WideCharToMultiByte(CP_ACP, 0, pszStr, i, sBuffer, NULL, NULL); } else return 0; }