Win: Trim trailing zeros in LoadStringW
When resources are compiled with /n (default), all strings are zero terminated and LoadStringW returns number of characters including this terminator. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
bbe3da0303
commit
d3f8439118
@ -726,6 +726,7 @@ static _Success_(return != 0) int LoadStringW(_In_opt_ HINSTANCE hInstance, _In_
|
|||||||
LPCWSTR pszStr;
|
LPCWSTR pszStr;
|
||||||
int i = LoadStringW(hInstance, uID, reinterpret_cast<LPWSTR>(&pszStr), 0);
|
int i = LoadStringW(hInstance, uID, reinterpret_cast<LPWSTR>(&pszStr), 0);
|
||||||
if (i) {
|
if (i) {
|
||||||
|
i = wcsnlen_s(pszStr, i);
|
||||||
sBuffer.assign(pszStr, i);
|
sBuffer.assign(pszStr, i);
|
||||||
return i;
|
return i;
|
||||||
} else
|
} else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user