From beaa51b49de0f09c38d18ef9ad5a90793672b754 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Sun, 5 Apr 2015 20:01:36 +0000 Subject: [PATCH] Support for file read&write of AL::TLS::CConfigData added. --- atlwin.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/atlwin.h b/atlwin.h index 1a5261f..651303b 100644 --- a/atlwin.h +++ b/atlwin.h @@ -101,7 +101,10 @@ inline int GetWindowTextA(__in HWND hWnd, __out ATL::CAtlStringA &sValue) if (iResult > 0) { // Prepare the buffer and read the string data into it. LPSTR szBuffer = sValue.GetBuffer(iResult++); - if (!szBuffer) return 0; + if (!szBuffer) { + SetLastError(ERROR_OUTOFMEMORY); + return 0; + } iResult = ::GetWindowTextA(hWnd, szBuffer, iResult); sValue.ReleaseBuffer(iResult); return iResult; @@ -122,7 +125,10 @@ inline int GetWindowTextW(__in HWND hWnd, __out ATL::CAtlStringW &sValue) if (iResult > 0) { // Prepare the buffer and read the string data into it. LPWSTR szBuffer = sValue.GetBuffer(iResult++); - if (!szBuffer) return 0; + if (!szBuffer) { + SetLastError(ERROR_OUTOFMEMORY); + return 0; + } iResult = ::GetWindowTextW(hWnd, szBuffer, iResult); sValue.ReleaseBuffer(iResult); return iResult;