Author: gadamopoulos Date: Wed Feb 23 14:24:57 2011 New Revision: 50876 URL: http://svn.reactos.org/svn/reactos?rev=50876&view=rev Log: [kernel32] - Add some debug prints - Fix some cases where we didn't check for the return value of CsrAllocateCaptureBuffer
Modified: trunk/reactos/dll/win32/kernel32/misc/console.c Modified: trunk/reactos/dll/win32/kernel32/misc/console.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/console.c?rev=50876&r1=50875&r2=50876&view=diff ============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] Wed Feb 23 14:24:57 2011 @@ -384,6 +384,7 @@ CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode)); if (!CaptureBuffer) { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } @@ -466,6 +467,7 @@ CaptureBuffer = CsrAllocateCaptureBuffer(1, TargetBufferLength); if (!CaptureBuffer) { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); RtlFreeHeap(GetProcessHeap(), 0, Request); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return 0; @@ -594,6 +596,7 @@ CaptureBuffer = CsrAllocateCaptureBuffer(1, ExeNameBufferLength); if (!CaptureBuffer) { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return 0; } @@ -849,6 +852,7 @@ HistoryLength); if (!CaptureBuffer) { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return 0; } @@ -927,6 +931,7 @@ CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode)); if (!CaptureBuffer) { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return 0; } @@ -1318,6 +1323,7 @@ CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode)); if (!CaptureBuffer) { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } @@ -1696,6 +1702,7 @@ CaptureBuffer = CsrAllocateCaptureBuffer(1, nNumberOfCharsToRead * CharSize); if (CaptureBuffer == NULL) { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } @@ -2052,6 +2059,12 @@ /* Allocate a Capture Buffer */ DPRINT("IntPeekConsoleInput: %lx %p\n", Size, lpNumberOfEventsRead); CaptureBuffer = CsrAllocateCaptureBuffer(1, Size); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } /* Allocate space in the Buffer */ CsrCaptureMessageBuffer(CaptureBuffer, @@ -2281,6 +2294,12 @@ /* Allocate a Capture Buffer */ DPRINT("IntWriteConsoleInput: %lx %p\n", Size, lpNumberOfEventsWritten); CaptureBuffer = CsrAllocateCaptureBuffer(1, Size); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } /* Allocate space in the Buffer */ CsrCaptureMessageBuffer(CaptureBuffer, @@ -2389,6 +2408,12 @@ /* Allocate a Capture Buffer */ DPRINT("IntReadConsoleOutput: %lx %p\n", Size, lpReadRegion); CaptureBuffer = CsrAllocateCaptureBuffer(1, Size); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed with size 0x%x!\n", Size); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } /* Allocate space in the Buffer */ CsrCaptureMessageBuffer(CaptureBuffer, @@ -2505,6 +2530,12 @@ /* Allocate a Capture Buffer */ DPRINT("IntWriteConsoleOutput: %lx %p\n", Size, lpWriteRegion); CaptureBuffer = CsrAllocateCaptureBuffer(1, Size); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } /* Allocate space in the Buffer */ CsrCaptureMessageBuffer(CaptureBuffer, @@ -3561,6 +3592,7 @@ CaptureBuffer = CsrAllocateCaptureBuffer(1, Request.Data.GetTitleRequest.Length); if (CaptureBuffer == NULL) { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return 0; } @@ -3652,6 +3684,7 @@ CaptureBuffer = CsrAllocateCaptureBuffer(1, Request.Data.SetTitleRequest.Length); if (CaptureBuffer == NULL) { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } @@ -3866,6 +3899,7 @@ CaptureBuffer = CsrAllocateCaptureBuffer(1, dwProcessCount * sizeof(DWORD)); if (CaptureBuffer == NULL) { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; }