kernel32: Handle memory allocation failure in ReadConsoleA.
This commit is contained in:
parent
00ff2ed81e
commit
2451d263de
|
@ -1607,6 +1607,12 @@ BOOL WINAPI ReadConsoleA(HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfC
|
|||
DWORD ncr = 0;
|
||||
BOOL ret;
|
||||
|
||||
if (!ptr)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((ret = ReadConsoleW(hConsoleInput, ptr, nNumberOfCharsToRead, &ncr, NULL)))
|
||||
ncr = WideCharToMultiByte(GetConsoleCP(), 0, ptr, ncr, lpBuffer, nNumberOfCharsToRead, NULL, NULL);
|
||||
|
||||
|
|
Loading…
Reference in New Issue