Stop using get_ptr after moved to stdex
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
5b023215f5
commit
d807e150ba
@ -687,10 +687,12 @@ static _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage,
|
|||||||
template<class _Traits, class _Ax>
|
template<class _Traits, class _Ax>
|
||||||
static DWORD FormatMessageA(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<char, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
|
static DWORD FormatMessageA(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<char, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
|
||||||
{
|
{
|
||||||
std::unique_ptr<CHAR[], winstd::LocalFree_delete<CHAR[]> > lpBuffer;
|
LPSTR lpBuffer;
|
||||||
DWORD dwResult = FormatMessageA(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPSTR>((LPSTR*)get_ptr(lpBuffer)), 0, Arguments);
|
DWORD dwResult = FormatMessageA(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPSTR>(&lpBuffer), 0, Arguments);
|
||||||
if (dwResult)
|
if (dwResult) {
|
||||||
str.assign(lpBuffer.get(), dwResult);
|
str.assign(lpBuffer, dwResult);
|
||||||
|
LocalFree(lpBuffer);
|
||||||
|
}
|
||||||
return dwResult;
|
return dwResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,10 +704,12 @@ static DWORD FormatMessageA(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_
|
|||||||
template<class _Traits, class _Ax>
|
template<class _Traits, class _Ax>
|
||||||
static DWORD FormatMessageW(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
|
static DWORD FormatMessageW(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
|
||||||
{
|
{
|
||||||
std::unique_ptr<WCHAR[], winstd::LocalFree_delete<WCHAR[]> > lpBuffer;
|
LPWSTR lpBuffer;
|
||||||
DWORD dwResult = FormatMessageW(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPWSTR>((LPWSTR*)get_ptr(lpBuffer)), 0, Arguments);
|
DWORD dwResult = FormatMessageW(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPWSTR>(&lpBuffer), 0, Arguments);
|
||||||
if (dwResult)
|
if (dwResult) {
|
||||||
str.assign(lpBuffer.get(), dwResult);
|
str.assign(lpBuffer, dwResult);
|
||||||
|
LocalFree(lpBuffer);
|
||||||
|
}
|
||||||
return dwResult;
|
return dwResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user