[NTOS:KE/EX] Add minimal EMS (headless) support for bugcheck.

In particular, the HeadlessGlobals->InBugCheck flag MUST be set prior
to displaying the blue-screen, because the HDL global lock function
would trigger a (nested) BSoD otherwise.

Regarding the unimplemented HeadlessCmdSendBlueScreenData:
it sends to the management console an XML description of the bugcheck.
An example can be seen in this issue report:
https://github.com/cloud-hypervisor/cloud-hypervisor/issues/3168

For more information, please consult:
https://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/windowsserver2003emssacxml.doc
This commit is contained in:
Hermès Bélusca-Maïto 2024-12-12 21:26:25 +01:00
parent b15dcb5cf6
commit 3abb21080d
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 24 additions and 2 deletions

View file

@ -450,8 +450,15 @@ HdlspDispatch(IN HEADLESS_CMD Command,
case HeadlessCmdGetLine:
break;
case HeadlessCmdStartBugCheck:
{
HeadlessGlobals->InBugCheck = TRUE;
HeadlessGlobals->ProcessingCmd = FALSE;
Status = STATUS_SUCCESS;
break;
}
case HeadlessCmdDoBugCheckProcessing:
break;
@ -518,7 +525,10 @@ HdlspDispatch(IN HEADLESS_CMD Command,
}
case HeadlessCmdSendBlueScreenData:
// TODO: Send XML description of bugcheck.
// InputBuffer points to the BugCheckCode.
break;
case HeadlessCmdQueryGUID:
break;

View file

@ -615,8 +615,20 @@ KiDisplayBlueScreen(IN ULONG MessageId,
IN PCHAR HardErrMessage OPTIONAL,
IN PCHAR Message)
{
ULONG BugCheckCode = (ULONG)KiBugCheckData[0];
BOOLEAN Enable = TRUE;
CHAR AnsiName[107];
/* Enable headless support for bugcheck */
HeadlessDispatch(HeadlessCmdStartBugCheck,
NULL, 0, NULL, NULL);
HeadlessDispatch(HeadlessCmdEnableTerminal,
&Enable, sizeof(Enable),
NULL, NULL);
HeadlessDispatch(HeadlessCmdSendBlueScreenData,
&BugCheckCode, sizeof(BugCheckCode),
NULL, NULL);
/* Check if bootvid is installed */
if (InbvIsBootDriverInstalled())
{
@ -664,7 +676,7 @@ KiDisplayBlueScreen(IN ULONG MessageId,
if (MessageId == BUGCODE_PSS_MESSAGE)
{
/* It is, so get the bug code string as well */
KeGetBugMessageText((ULONG)KiBugCheckData[0], NULL);
KeGetBugMessageText(BugCheckCode, NULL);
InbvDisplayString("\r\n\r\n");
}
@ -683,7 +695,7 @@ KiDisplayBlueScreen(IN ULONG MessageId,
RtlStringCbPrintfA(AnsiName,
sizeof(AnsiName),
"\r\n\r\n*** STOP: 0x%08lX (0x%p,0x%p,0x%p,0x%p)\r\n\r\n",
(ULONG)KiBugCheckData[0],
BugCheckCode,
(PVOID)KiBugCheckData[1],
(PVOID)KiBugCheckData[2],
(PVOID)KiBugCheckData[3],