ClientFileNameU->MaximumLength = ModuleData.BaseDllName.MaximumLength;
ClientFileNameU->Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
- HEAP_ZERO_MEMORY,
- ClientFileNameU->MaximumLength);
+ HEAP_ZERO_MEMORY,
+ ClientFileNameU->MaximumLength);
Status = NtReadVirtualMemory(hProcess,
ModuleData.BaseDllName.Buffer,
ULONG nParam, UnicodeStringParameterMask, Size = 0;
NTSTATUS Status;
UNICODE_STRING TempStringU;
- PWSTR ParamString;
+ CHAR *ParamString;
UnicodeStringParameterMask = HardErrorMessage->UnicodeStringParameterMask;
/* Read all strings from client space */
- for (nParam = 0;
- nParam < HardErrorMessage->NumberOfParameters;
- nParam++, UnicodeStringParameterMask >>= 1)
+ for (nParam = 0;
+ nParam < HardErrorMessage->NumberOfParameters;
+ nParam++, UnicodeStringParameterMask >>= 1)
{
Parameters[nParam] = 0;
}
/* Zero terminate the string */
- ParamString[TempStringU.Length / sizeof(WCHAR)] = 0;
+ ParamString[TempStringU.Length] = 0;
+ ParamString[TempStringU.Length + 1] = 0;
DPRINT("ParamString=\'%S\'\n", ParamString);
Parameters[nParam] = (ULONG_PTR)ParamString;
UnicodeStringParameterMask = HardErrorMessage->UnicodeStringParameterMask;
/* Loop all parameters */
- for (nParam = 0;
- nParam < HardErrorMessage->NumberOfParameters;
- nParam++, UnicodeStringParameterMask >>= 1)
+ for (nParam = 0;
+ nParam < HardErrorMessage->NumberOfParameters;
+ nParam++, UnicodeStringParameterMask >>= 1)
{
/* Check if the current parameter is a string */
if (UnicodeStringParameterMask & 0x01)
NTSTATUS Status;
UNICODE_STRING FileNameU, TempStringU, FormatU;
ANSI_STRING FormatA;
- PRTL_MESSAGE_RESOURCE_ENTRY MessageResource;
+ PMESSAGE_RESOURCE_ENTRY MessageResource;
PWSTR FormatString;
- ULONG Size;
+ ULONG Size, ExceptionCode;
/* Get the file name of the client process */
CsrpGetClientFileName(&FileNameU, hProcess);
}
else
{
- RtlInitAnsiString(&FormatA, MessageResource->Text);
+ RtlInitAnsiString(&FormatA, (PCHAR)MessageResource->Text);
RtlAnsiStringToUnicodeString(&FormatU, &FormatA, TRUE);
}
}
/* Allocate a buffer for the caption */
CaptionStringU->Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
- HEAP_ZERO_MEMORY,
- CaptionStringU->MaximumLength);
+ HEAP_ZERO_MEMORY,
+ CaptionStringU->MaximumLength);
/* Append the file name, seperator and the caption text */
CaptionStringU->Length = 0;
/* 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];
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];
Status = RtlFindMessage(GetModuleHandleW(L"ntdll"),
(ULONG_PTR)RT_MESSAGETABLE,
LANG_NEUTRAL,
- Parameters[0],
+ ExceptionCode,
&MessageResource);
if (NT_SUCCESS(Status))
}
else
{
- RtlInitAnsiString(&FormatA, MessageResource->Text);
+ RtlInitAnsiString(&FormatA, (PCHAR)MessageResource->Text);
RtlAnsiStringToUnicodeString(&FormatU, &FormatA, TRUE);
}
+ FormatString = FormatU.Buffer;
}
else
{
}
/* 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,
Parameters[0],
Parameters[1],
Parameters[2],
- Parameters[3],
- Parameters[4]);
+ Parameters[3]);
Status = STATUS_SUCCESS;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
/* Set the message box type */
switch (ValidResponseOptions)
{
- case OptionAbortRetryIgnore:
- Type = MB_ABORTRETRYIGNORE;
- break;
- case OptionOk:
- Type = MB_OK;
- break;
- case OptionOkCancel:
- Type = MB_OKCANCEL;
- break;
- case OptionRetryCancel:
- Type = MB_RETRYCANCEL;
- break;
- case OptionYesNo:
- Type = MB_YESNO;
- break;
- case OptionYesNoCancel:
- Type = MB_YESNOCANCEL;
- break;
- case OptionShutdownSystem:
- Type = MB_RETRYCANCEL; // FIXME???
- break;
+ case OptionAbortRetryIgnore:
+ Type = MB_ABORTRETRYIGNORE;
+ break;
+ case OptionOk:
+ Type = MB_OK;
+ break;
+ case OptionOkCancel:
+ Type = MB_OKCANCEL;
+ break;
+ case OptionRetryCancel:
+ Type = MB_RETRYCANCEL;
+ break;
+ case OptionYesNo:
+ Type = MB_YESNO;
+ break;
+ case OptionYesNoCancel:
+ Type = MB_YESNOCANCEL;
+ break;
+ case OptionShutdownSystem:
+ Type = MB_RETRYCANCEL; // FIXME???
+ break;
/* Anything else is invalid */
- default:
- return ResponseNotHandled;
+ default:
+ return ResponseNotHandled;
}
/* Set severity */
Type |= MB_SYSTEMMODAL | MB_SETFOREGROUND;
- DPRINT("Text = '%S', Caption = '%S', Severity = %d, Type = 0x%lx\n",
+ DPRINT("Text = '%S', Caption = '%S', Severity = %d, Type = 0x%lx\n",
Text, Caption, Severity, Type);
/* Display a message box */
/* Return response value */
switch (MessageBoxResponse)
{
- case IDOK: return ResponseOk;
- case IDCANCEL: return ResponseCancel;
- case IDYES: return ResponseYes;
- case IDNO: return ResponseNo;
- case IDABORT: return ResponseAbort;
- case IDIGNORE: return ResponseIgnore;
- case IDRETRY: return ResponseRetry;
- case IDTRYAGAIN: return ResponseTryAgain;
- case IDCONTINUE: return ResponseContinue;
+ case IDOK: return ResponseOk;
+ case IDCANCEL: return ResponseCancel;
+ case IDYES: return ResponseYes;
+ case IDNO: return ResponseNo;
+ case IDABORT: return ResponseAbort;
+ case IDIGNORE: return ResponseIgnore;
+ case IDRETRY: return ResponseRetry;
+ case IDTRYAGAIN: return ResponseTryAgain;
+ case IDCONTINUE: return ResponseContinue;
}
return ResponseNotHandled;
if (!NT_SUCCESS(Status))
{
- return FALSE;
+ return FALSE;
}
/* Display the message box */