Author: tkreuzer Date: Sat May 15 03:05:09 2010 New Revision: 47213
URL: http://svn.reactos.org/svn/reactos?rev=47213&view=rev Log: [WIN32CSR] Fix display of harderror message box for STATUS_UNHANDLED_EXCEPTION
Modified: trunk/reactos/subsystems/win32/csrss/win32csr/harderror.c
Modified: trunk/reactos/subsystems/win32/csrss/win32csr/harderror.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win3... ============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/harderror.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/harderror.c [iso-8859-1] Sat May 15 03:05:09 2010 @@ -223,7 +223,7 @@ ANSI_STRING FormatA; PRTL_MESSAGE_RESOURCE_ENTRY MessageResource; PWSTR FormatString; - ULONG Size; + ULONG Size, ExceptionCode;
/* Get the file name of the client process */ CsrpGetClientFileName(&FileNameU, hProcess); @@ -310,8 +310,10 @@ /* Check if this is an exception message */ if (Message->Status == STATUS_UNHANDLED_EXCEPTION) { + ExceptionCode = Parameters[0]; + /* Handle special cases */ - if (Parameters[0] == STATUS_ACCESS_VIOLATION) + if (ExceptionCode == STATUS_ACCESS_VIOLATION) { Parameters[0] = Parameters[1]; Parameters[1] = Parameters[3]; @@ -319,7 +321,7 @@ else Parameters[2] = (ULONG_PTR)L"read"; MessageResource = NULL; } - else if (Parameters[0] == STATUS_IN_PAGE_ERROR) + else if (ExceptionCode == STATUS_IN_PAGE_ERROR) { Parameters[0] = Parameters[1]; Parameters[1] = Parameters[3]; @@ -339,7 +341,7 @@ Status = RtlFindMessage(GetModuleHandleW(L"ntdll"), (ULONG_PTR)RT_MESSAGETABLE, LANG_NEUTRAL, - Parameters[0], + ExceptionCode, &MessageResource);
if (NT_SUCCESS(Status)) @@ -356,6 +358,7 @@ RtlInitAnsiString(&FormatA, MessageResource->Text); RtlAnsiStringToUnicodeString(&FormatU, &FormatA, TRUE); } + FormatString = FormatU.Buffer; } else { @@ -368,9 +371,8 @@ }
/* Calculate length of text buffer */ - TextStringU->MaximumLength = wcslen(FormatString) * sizeof(WCHAR) + - SizeOfStrings + 42 * sizeof(WCHAR); - + TextStringU->MaximumLength = FormatU.Length + SizeOfStrings + 42 * sizeof(WCHAR); + /* Allocate a buffer for the text */ TextStringU->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY,