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>
|
||||
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;
|
||||
DWORD dwResult = FormatMessageA(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPSTR>((LPSTR*)get_ptr(lpBuffer)), 0, Arguments);
|
||||
if (dwResult)
|
||||
str.assign(lpBuffer.get(), dwResult);
|
||||
LPSTR lpBuffer;
|
||||
DWORD dwResult = FormatMessageA(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPSTR>(&lpBuffer), 0, Arguments);
|
||||
if (dwResult) {
|
||||
str.assign(lpBuffer, dwResult);
|
||||
LocalFree(lpBuffer);
|
||||
}
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
@ -702,10 +704,12 @@ static DWORD FormatMessageA(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_
|
||||
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)
|
||||
{
|
||||
std::unique_ptr<WCHAR[], winstd::LocalFree_delete<WCHAR[]> > lpBuffer;
|
||||
DWORD dwResult = FormatMessageW(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPWSTR>((LPWSTR*)get_ptr(lpBuffer)), 0, Arguments);
|
||||
if (dwResult)
|
||||
str.assign(lpBuffer.get(), dwResult);
|
||||
LPWSTR lpBuffer;
|
||||
DWORD dwResult = FormatMessageW(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPWSTR>(&lpBuffer), 0, Arguments);
|
||||
if (dwResult) {
|
||||
str.assign(lpBuffer, dwResult);
|
||||
LocalFree(lpBuffer);
|
||||
}
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user