KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_UNSUCCESSFUL;
- /* Check if we have the Privilege */
+ /* Check if we have the privileges */
if (!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode))
{
DPRINT1("NtSetDefaultHardErrorPort: Caller requires "
/* Only called once during bootup, make sure we weren't called yet */
if (!ExReadyForErrors)
{
- /* Reference the port */
+ /* Reference the hard-error port */
Status = ObReferenceObjectByHandle(PortHandle,
0,
LpcPortObjectType,
NULL);
if (NT_SUCCESS(Status))
{
- /* Save the data */
+ /* Keep also a reference to the process handling the hard errors */
ExpDefaultErrorPortProcess = PsGetCurrentProcess();
+ ObReferenceObject(ExpDefaultErrorPortProcess);
ExReadyForErrors = TRUE;
+ Status = STATUS_SUCCESS;
}
}
#define NDEBUG
#include <debug.h>
+/* PRIVATE FUNCTIONS *********************************************************/
+
+VOID
+NTAPI
+ExShutdownSystem(VOID)
+{
+ /* Dereference the hard-error port and process objects */
+ if (ExpDefaultErrorPort)
+ {
+ ObDereferenceObject(ExpDefaultErrorPort);
+ ExpDefaultErrorPort = NULL;
+ }
+ if (ExpDefaultErrorPortProcess)
+ {
+ ObDereferenceObject(ExpDefaultErrorPortProcess);
+ ExpDefaultErrorPortProcess = NULL;
+ }
+}
+
/* FUNCTIONS *****************************************************************/
/*
extern ULONG ExCriticalWorkerThreads;
extern ULONG ExDelayedWorkerThreads;
+extern PVOID ExpDefaultErrorPort;
+extern PEPROCESS ExpDefaultErrorPortProcess;
+
/*
* NT/Cm Version Info variables
*/
extern PEPROCESS ExpDebuggerProcessAttach;
extern PEPROCESS ExpDebuggerProcessKill;
extern ULONG_PTR ExpDebuggerPageIn;
+
VOID NTAPI ExpDebuggerWorker(IN PVOID Context);
// #endif /* _WINKD_ */
IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
+VOID
+NTAPI
+ExShutdownSystem(VOID);
+
BOOLEAN
NTAPI
ExpInitializeEventImplementation(VOID);
DPRINT("Configuration Manager shutting down\n");
CmShutdownSystem();
+ /* Shut down the Executive */
+ DPRINT("Executive shutting down\n");
+ ExShutdownSystem();
+
/* Note that modified pages should be written here (MiShutdownSystem) */
/* Flush all user files before we start shutting down IO */