[NTOSKRNL] ExRaiseHardError(): Protect strings copy to user-mode space inside a SEH...
[reactos.git] / ntoskrnl / ex / harderr.c
1 /*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/ex/harderr.c
5 * PURPOSE: Error Functions and Status/Exception Dispatching/Raising
6 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
7 */
8
9 /* INCLUDES *****************************************************************/
10
11 #include <ntoskrnl.h>
12 #define NDEBUG
13 #include <debug.h>
14
15 #define TAG_ERR ' rrE'
16
17 /* GLOBALS ****************************************************************/
18
19 BOOLEAN ExReadyForErrors = FALSE;
20 PVOID ExpDefaultErrorPort = NULL;
21 PEPROCESS ExpDefaultErrorPortProcess = NULL;
22
23 /* FUNCTIONS ****************************************************************/
24
25 /*++
26 * @name ExpSystemErrorHandler
27 *
28 * For now it's a stub
29 *
30 * @param ErrorStatus
31 * FILLME
32 *
33 * @param NumberOfParameters
34 * FILLME
35 *
36 * @param UnicodeStringParameterMask
37 * FILLME
38 *
39 * @param Parameters
40 * FILLME
41 *
42 * @param ValidResponseOptions
43 * FILLME
44 *
45 * @param Response
46 * FILLME
47 *
48 * @return None
49 *
50 * @remarks None
51 *
52 *--*/
53 NTSTATUS
54 NTAPI
55 ExpSystemErrorHandler(IN NTSTATUS ErrorStatus,
56 IN ULONG NumberOfParameters,
57 IN ULONG UnicodeStringParameterMask,
58 IN PULONG_PTR Parameters,
59 IN BOOLEAN Shutdown)
60 {
61 ULONG_PTR BugCheckParameters[MAXIMUM_HARDERROR_PARAMETERS] = {0, 0, 0, 0};
62 ULONG i;
63
64 /* Sanity check */
65 ASSERT(NumberOfParameters <= MAXIMUM_HARDERROR_PARAMETERS);
66
67 /*
68 * KeBugCheck expects MAXIMUM_HARDERROR_PARAMETERS parameters,
69 * but we might get called with less, so use a local buffer here.
70 */
71 for (i = 0; i < NumberOfParameters; i++)
72 {
73 /* Copy them over */
74 BugCheckParameters[i] = Parameters[i];
75 }
76
77 /* FIXME: STUB */
78 KeBugCheckEx(FATAL_UNHANDLED_HARD_ERROR,
79 ErrorStatus,
80 (ULONG_PTR)BugCheckParameters,
81 0,
82 0);
83 return STATUS_SUCCESS;
84 }
85
86 /*++
87 * @name ExpRaiseHardError
88 * @implemented
89 *
90 * See ExRaiseHardError and NtRaiseHardError, same parameters.
91 *
92 * This function performs the central work for both ExRaiseHardError
93 * and NtRaiseHardError. ExRaiseHardError is the service for kernel-mode
94 * that copies the parameters to user-mode, and NtRaiseHardError is the
95 * service for both kernel-mode and user-mode that performs parameters
96 * validation and capture if necessary.
97 *
98 *--*/
99 NTSTATUS
100 NTAPI
101 ExpRaiseHardError(IN NTSTATUS ErrorStatus,
102 IN ULONG NumberOfParameters,
103 IN ULONG UnicodeStringParameterMask,
104 IN PULONG_PTR Parameters,
105 IN ULONG ValidResponseOptions,
106 OUT PULONG Response)
107 {
108 NTSTATUS Status;
109 PEPROCESS Process = PsGetCurrentProcess();
110 PETHREAD Thread = PsGetCurrentThread();
111 UCHAR Buffer[PORT_MAXIMUM_MESSAGE_LENGTH];
112 PHARDERROR_MSG Message = (PHARDERROR_MSG)Buffer;
113 HANDLE PortHandle;
114 KPROCESSOR_MODE PreviousMode = KeGetPreviousMode();
115
116 PAGED_CODE();
117
118 /* Check if this error will shutdown the system */
119 if (ValidResponseOptions == OptionShutdownSystem)
120 {
121 /*
122 * Check if we have the privileges.
123 *
124 * NOTE: In addition to the Shutdown privilege we also check whether
125 * the caller has the Tcb privilege. The purpose is to allow only
126 * SYSTEM processes to "shutdown" the system on hard errors (BSOD)
127 * while forbidding regular processes to do so. This behaviour differs
128 * from Windows, where any user-mode process, as soon as it has the
129 * Shutdown privilege, can trigger a hard-error BSOD.
130 */
131 if (!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode) ||
132 !SeSinglePrivilegeCheck(SeShutdownPrivilege, PreviousMode))
133 {
134 /* No rights */
135 *Response = ResponseNotHandled;
136 return STATUS_PRIVILEGE_NOT_HELD;
137 }
138
139 /* Don't handle any new hard errors */
140 ExReadyForErrors = FALSE;
141 }
142
143 /* Check if hard errors are not disabled */
144 if (!Thread->HardErrorsAreDisabled)
145 {
146 /* Check if we can't do errors anymore, and this is serious */
147 if (!ExReadyForErrors && NT_ERROR(ErrorStatus))
148 {
149 /* Use the system handler */
150 ExpSystemErrorHandler(ErrorStatus,
151 NumberOfParameters,
152 UnicodeStringParameterMask,
153 Parameters,
154 (PreviousMode != KernelMode) ? TRUE : FALSE);
155 }
156 }
157
158 /*
159 * Enable hard error processing if it is enabled for the process
160 * or if the exception status forces it.
161 */
162 if ((Process->DefaultHardErrorProcessing & SEM_FAILCRITICALERRORS) ||
163 (ErrorStatus & HARDERROR_OVERRIDE_ERRORMODE))
164 {
165 /* Check if we have an exception port */
166 if (Process->ExceptionPort)
167 {
168 /* Use the port */
169 PortHandle = Process->ExceptionPort;
170 }
171 else
172 {
173 /* Use our default system port */
174 PortHandle = ExpDefaultErrorPort;
175 }
176 }
177 else
178 {
179 /* Don't process the error */
180 PortHandle = NULL;
181 }
182
183 /* If hard errors are disabled, do nothing */
184 if (Thread->HardErrorsAreDisabled) PortHandle = NULL;
185
186 /*
187 * If this is not the system thread, check whether hard errors are
188 * disabled for this thread on user-mode side, and if so, do nothing.
189 */
190 if (!Thread->SystemThread && (PortHandle != NULL))
191 {
192 /* Check if we have a TEB */
193 PTEB Teb = PsGetCurrentThread()->Tcb.Teb;
194 if (Teb)
195 {
196 _SEH2_TRY
197 {
198 if (Teb->HardErrorMode & RTL_SEM_FAILCRITICALERRORS)
199 {
200 PortHandle = NULL;
201 }
202 }
203 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
204 {
205 NOTHING;
206 }
207 _SEH2_END;
208 }
209 }
210
211 /* Now check if we have a port */
212 if (PortHandle == NULL)
213 {
214 /* Just return to caller */
215 *Response = ResponseReturnToCaller;
216 return STATUS_SUCCESS;
217 }
218
219 /* Check if this is the default process */
220 if (Process == ExpDefaultErrorPortProcess)
221 {
222 /* We can't handle the error, check if this is critical */
223 if (NT_ERROR(ErrorStatus))
224 {
225 /* It is, invoke the system handler */
226 ExpSystemErrorHandler(ErrorStatus,
227 NumberOfParameters,
228 UnicodeStringParameterMask,
229 Parameters,
230 (PreviousMode != KernelMode) ? TRUE : FALSE);
231
232 /* If we survived, return to caller */
233 *Response = ResponseReturnToCaller;
234 return STATUS_SUCCESS;
235 }
236 }
237
238 /* Setup the LPC Message */
239 Message->h.u1.Length = (sizeof(HARDERROR_MSG) << 16) |
240 (sizeof(HARDERROR_MSG) - sizeof(PORT_MESSAGE));
241 Message->h.u2.ZeroInit = 0;
242 Message->h.u2.s2.Type = LPC_ERROR_EVENT;
243 Message->Status = ErrorStatus & ~HARDERROR_OVERRIDE_ERRORMODE;
244 Message->ValidResponseOptions = ValidResponseOptions;
245 Message->UnicodeStringParameterMask = UnicodeStringParameterMask;
246 Message->NumberOfParameters = NumberOfParameters;
247 KeQuerySystemTime(&Message->ErrorTime);
248
249 /* Copy the parameters */
250 if (Parameters) RtlMoveMemory(&Message->Parameters,
251 Parameters,
252 sizeof(ULONG_PTR) * NumberOfParameters);
253
254 /* Send the LPC Message */
255 Status = LpcRequestWaitReplyPort(PortHandle,
256 (PPORT_MESSAGE)Message,
257 (PPORT_MESSAGE)Message);
258 if (NT_SUCCESS(Status))
259 {
260 /* Check what kind of response we got */
261 if ((Message->Response != ResponseReturnToCaller) &&
262 (Message->Response != ResponseNotHandled) &&
263 (Message->Response != ResponseAbort) &&
264 (Message->Response != ResponseCancel) &&
265 (Message->Response != ResponseIgnore) &&
266 (Message->Response != ResponseNo) &&
267 (Message->Response != ResponseOk) &&
268 (Message->Response != ResponseRetry) &&
269 (Message->Response != ResponseYes) &&
270 (Message->Response != ResponseTryAgain) &&
271 (Message->Response != ResponseContinue))
272 {
273 /* Reset to a default one */
274 Message->Response = ResponseReturnToCaller;
275 }
276
277 /* Set the response */
278 *Response = Message->Response;
279 }
280 else
281 {
282 /* Set the response */
283 *Response = ResponseReturnToCaller;
284 }
285
286 /* Return status */
287 return Status;
288 }
289
290 /*++
291 * @name ExRaiseAccessViolation
292 * @implemented
293 *
294 * The ExRaiseAccessViolation routine can be used with structured exception
295 * handling to throw a driver-determined exception for a memory access
296 * violation that occurs when a driver processes I/O requests.
297 * See: http://msdn.microsoft.com/library/en-us/Kernel_r/hh/Kernel_r/k102_71b4c053-599c-4a6d-8a59-08aae6bdc534.xml.asp?frame=true
298 * http://www.osronline.com/ddkx/kmarch/k102_814i.htm
299 *
300 * @return None
301 *
302 * @remarks None
303 *
304 *--*/
305 VOID
306 NTAPI
307 ExRaiseAccessViolation(VOID)
308 {
309 /* Raise the Right Status */
310 RtlRaiseStatus(STATUS_ACCESS_VIOLATION);
311 }
312
313 /*++
314 * @name ExRaiseDatatypeMisalignment
315 * @implemented
316 *
317 * ExRaiseDatatypeMisalignment raises an exception with the exception
318 * code set to STATUS_DATATYPE_MISALIGNMENT
319 * See: MSDN / DDK
320 * http://www.osronline.com/ddkx/kmarch/k102_814i.htm
321 *
322 * @return None
323 *
324 * @remarks None
325 *
326 *--*/
327 VOID
328 NTAPI
329 ExRaiseDatatypeMisalignment(VOID)
330 {
331 /* Raise the Right Status */
332 RtlRaiseStatus(STATUS_DATATYPE_MISALIGNMENT);
333 }
334
335 /*++
336 * @name ExSystemExceptionFilter
337 * @implemented
338 *
339 * TODO: Add description
340 *
341 * @return FILLME
342 *
343 * @remarks None
344 *
345 *--*/
346 LONG
347 NTAPI
348 ExSystemExceptionFilter(VOID)
349 {
350 return KeGetPreviousMode() != KernelMode ?
351 EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
352 }
353
354 /*++
355 * @name ExRaiseHardError
356 * @implemented
357 *
358 * See NtRaiseHardError and ExpRaiseHardError.
359 *
360 * @param ErrorStatus
361 * Error Code
362 *
363 * @param NumberOfParameters
364 * Number of optional parameters in Parameters array
365 *
366 * @param UnicodeStringParameterMask
367 * Optional string parameter (can be only one per error code)
368 *
369 * @param Parameters
370 * Array of ULONG parameters for use in error message string
371 *
372 * @param ValidResponseOptions
373 * See HARDERROR_RESPONSE_OPTION for possible values description
374 *
375 * @param Response
376 * Pointer to HARDERROR_RESPONSE enumeration
377 *
378 * @return Status
379 *
380 *--*/
381 NTSTATUS
382 NTAPI
383 ExRaiseHardError(IN NTSTATUS ErrorStatus,
384 IN ULONG NumberOfParameters,
385 IN ULONG UnicodeStringParameterMask,
386 IN PULONG_PTR Parameters,
387 IN ULONG ValidResponseOptions,
388 OUT PULONG Response)
389 {
390 NTSTATUS Status;
391 SIZE_T Size;
392 UNICODE_STRING CapturedParams[MAXIMUM_HARDERROR_PARAMETERS];
393 ULONG i;
394 PVOID UserData = NULL;
395 PHARDERROR_USER_PARAMETERS UserParams;
396 PWSTR BufferBase;
397 ULONG SafeResponse;
398
399 PAGED_CODE();
400
401 /* Check if we have parameters */
402 if (Parameters)
403 {
404 /* Check if we have strings */
405 if (UnicodeStringParameterMask)
406 {
407 /* Calculate the required size */
408 Size = FIELD_OFFSET(HARDERROR_USER_PARAMETERS, Buffer[0]);
409
410 /* Loop each parameter */
411 for (i = 0; i < NumberOfParameters; i++)
412 {
413 /* Check if it's part of the mask */
414 if (UnicodeStringParameterMask & (1 << i))
415 {
416 /* Copy it */
417 RtlMoveMemory(&CapturedParams[i],
418 (PVOID)Parameters[i],
419 sizeof(UNICODE_STRING));
420
421 /* Increase the size */
422 Size += CapturedParams[i].MaximumLength;
423 }
424 }
425
426 /* Allocate the user data region */
427 Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
428 &UserData,
429 0,
430 &Size,
431 MEM_COMMIT,
432 PAGE_READWRITE);
433 if (!NT_SUCCESS(Status)) return Status;
434
435 /* Set the pointers to our data */
436 UserParams = UserData;
437 BufferBase = UserParams->Buffer;
438
439 /* Enter SEH block as we are writing to user-mode space */
440 _SEH2_TRY
441 {
442 /* Loop parameters again */
443 for (i = 0; i < NumberOfParameters; i++)
444 {
445 /* Check if we are in the mask */
446 if (UnicodeStringParameterMask & (1 << i))
447 {
448 /* Update the base */
449 UserParams->Parameters[i] = (ULONG_PTR)&UserParams->Strings[i];
450
451 /* Copy the string buffer */
452 RtlMoveMemory(BufferBase,
453 CapturedParams[i].Buffer,
454 CapturedParams[i].MaximumLength);
455
456 /* Set buffer */
457 CapturedParams[i].Buffer = BufferBase;
458
459 /* Copy the string structure */
460 UserParams->Strings[i] = CapturedParams[i];
461
462 /* Update the pointer */
463 BufferBase += CapturedParams[i].MaximumLength;
464 }
465 else
466 {
467 /* No need to copy any strings */
468 UserParams->Parameters[i] = Parameters[i];
469 }
470 }
471 }
472 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
473 {
474 /* Return the exception code */
475 Status = _SEH2_GetExceptionCode();
476 DPRINT1("ExRaiseHardError - Exception when writing data to user-mode, Status 0x%08lx\n", Status);
477 }
478 _SEH2_END;
479 }
480 else
481 {
482 /* Just keep the data as is */
483 UserData = Parameters;
484 }
485 }
486
487 /* Now call the worker function */
488 Status = ExpRaiseHardError(ErrorStatus,
489 NumberOfParameters,
490 UnicodeStringParameterMask,
491 UserData,
492 ValidResponseOptions,
493 &SafeResponse);
494
495 /* Check if we had done user-mode allocation */
496 if ((UserData) && (UserData != Parameters))
497 {
498 /* We did! Delete it */
499 Size = 0;
500 ZwFreeVirtualMemory(NtCurrentProcess(),
501 &UserData,
502 &Size,
503 MEM_RELEASE);
504 }
505
506 /* Return status and the response */
507 *Response = SafeResponse;
508 return Status;
509 }
510
511 /*++
512 * @name NtRaiseHardError
513 * @implemented
514 *
515 * This function sends HARDERROR_MSG LPC message to a hard-error listener,
516 * typically CSRSS.EXE. See NtSetDefaultHardErrorPort for more information.
517 * See also: http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/Error/NtRaiseHardError.html
518 *
519 * @param ErrorStatus
520 * Error Code
521 *
522 * @param NumberOfParameters
523 * Number of optional parameters in Parameters array
524 *
525 * @param UnicodeStringParameterMask
526 * Optional string parameter (can be only one per error code)
527 *
528 * @param Parameters
529 * Array of ULONG_PTR parameters for use in error message string
530 *
531 * @param ValidResponseOptions
532 * See HARDERROR_RESPONSE_OPTION for possible values description
533 *
534 * @param Response
535 * Pointer to HARDERROR_RESPONSE enumeration
536 *
537 * @return Status
538 *
539 * @remarks NtRaiseHardError constitutes an easy way to display messages
540 * in GUI without loading any Win32 API libraries.
541 *
542 *--*/
543 NTSTATUS
544 NTAPI
545 NtRaiseHardError(IN NTSTATUS ErrorStatus,
546 IN ULONG NumberOfParameters,
547 IN ULONG UnicodeStringParameterMask,
548 IN PULONG_PTR Parameters,
549 IN ULONG ValidResponseOptions,
550 OUT PULONG Response)
551 {
552 NTSTATUS Status = STATUS_SUCCESS;
553 PULONG_PTR SafeParams = NULL;
554 ULONG SafeResponse;
555 UNICODE_STRING SafeString;
556 ULONG i;
557 ULONG ParamSize = 0;
558 KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
559
560 /* Validate parameter count */
561 if (NumberOfParameters > MAXIMUM_HARDERROR_PARAMETERS)
562 {
563 /* Fail */
564 return STATUS_INVALID_PARAMETER_2;
565 }
566
567 /* Make sure we have some at least */
568 if ((Parameters != NULL) && (NumberOfParameters == 0))
569 {
570 /* Fail */
571 return STATUS_INVALID_PARAMETER_2;
572 }
573
574 /* Check if we were called from user-mode */
575 if (PreviousMode != KernelMode)
576 {
577 /* First validate the responses */
578 switch (ValidResponseOptions)
579 {
580 /* Check all valid cases */
581 case OptionAbortRetryIgnore:
582 case OptionOk:
583 case OptionOkCancel:
584 case OptionRetryCancel:
585 case OptionYesNo:
586 case OptionYesNoCancel:
587 case OptionShutdownSystem:
588 case OptionOkNoWait:
589 case OptionCancelTryContinue:
590 break;
591
592 /* Anything else is invalid */
593 default:
594 return STATUS_INVALID_PARAMETER_4;
595 }
596
597 /* Check if we have parameters */
598 if (Parameters)
599 {
600 /* Calculate size of the parameters */
601 ParamSize = sizeof(ULONG_PTR) * NumberOfParameters;
602
603 /* Allocate a safe buffer */
604 SafeParams = ExAllocatePoolWithTag(PagedPool, ParamSize, TAG_ERR);
605 if (!SafeParams)
606 {
607 return STATUS_INSUFFICIENT_RESOURCES;
608 }
609 }
610
611 /* Enter SEH Block */
612 _SEH2_TRY
613 {
614 /* Validate the response pointer */
615 ProbeForWriteUlong(Response);
616
617 /* Check if we have parameters */
618 if (Parameters)
619 {
620 /* Validate the parameter pointers */
621 ProbeForRead(Parameters, ParamSize, sizeof(ULONG_PTR));
622
623 /* Copy them */
624 RtlCopyMemory(SafeParams, Parameters, ParamSize);
625
626 /* Now check if there's strings in it */
627 if (UnicodeStringParameterMask)
628 {
629 /* Loop every string */
630 for (i = 0; i < NumberOfParameters; i++)
631 {
632 /* Check if this parameter is a string */
633 if (UnicodeStringParameterMask & (1 << i))
634 {
635 /* Probe the structure */
636 ProbeForRead((PVOID)SafeParams[i],
637 sizeof(UNICODE_STRING),
638 sizeof(ULONG_PTR));
639
640 /* Capture it */
641 RtlCopyMemory(&SafeString,
642 (PVOID)SafeParams[i],
643 sizeof(UNICODE_STRING));
644
645 /* Probe the buffer */
646 ProbeForRead(SafeString.Buffer,
647 SafeString.MaximumLength,
648 sizeof(UCHAR));
649 }
650 }
651 }
652 }
653 }
654 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
655 {
656 /* Free captured buffer */
657 if (SafeParams) ExFreePoolWithTag(SafeParams, TAG_ERR);
658
659 /* Return the exception code */
660 _SEH2_YIELD(return _SEH2_GetExceptionCode());
661 }
662 _SEH2_END;
663
664 /* Call the system function directly, because we probed */
665 ExpRaiseHardError(ErrorStatus,
666 NumberOfParameters,
667 UnicodeStringParameterMask,
668 SafeParams,
669 ValidResponseOptions,
670 &SafeResponse);
671 }
672 else
673 {
674 /* Reuse variable */
675 SafeParams = Parameters;
676
677 /*
678 * Call the Executive Function. It will probe and copy pointers to
679 * user-mode
680 */
681 ExRaiseHardError(ErrorStatus,
682 NumberOfParameters,
683 UnicodeStringParameterMask,
684 SafeParams,
685 ValidResponseOptions,
686 &SafeResponse);
687 }
688
689 /* Check if we were called in user-mode */
690 if (PreviousMode != KernelMode)
691 {
692 /* That means we have a buffer to free */
693 if (SafeParams) ExFreePoolWithTag(SafeParams, TAG_ERR);
694
695 /* Enter SEH Block for return */
696 _SEH2_TRY
697 {
698 /* Return the response */
699 *Response = SafeResponse;
700 }
701 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
702 {
703 /* Get the exception code */
704 Status = _SEH2_GetExceptionCode();
705 }
706 _SEH2_END;
707 }
708 else
709 {
710 /* Return the response */
711 *Response = SafeResponse;
712 }
713
714 /* Return status */
715 return Status;
716 }
717
718 /*++
719 * @name NtSetDefaultHardErrorPort
720 * @implemented
721 *
722 * NtSetDefaultHardErrorPort is typically called only once. After the call,
723 * the kernel sets a BOOLEAN flag named ExReadyForErrors to TRUE, and all other
724 * attempts to change the default port fail with STATUS_UNSUCCESSFUL error code.
725 * See: http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/Error/NtSetDefaultHardErrorPort.html
726 * https://web.archive.org/web/20070716133753/http://www.windowsitlibrary.com/Content/356/08/2.html
727 *
728 * @param PortHandle
729 * Handle to named port object
730 *
731 * @return Status
732 *
733 * @remarks Privileges: SE_TCB_PRIVILEGE
734 *
735 *--*/
736 NTSTATUS
737 NTAPI
738 NtSetDefaultHardErrorPort(IN HANDLE PortHandle)
739 {
740 KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
741 NTSTATUS Status = STATUS_UNSUCCESSFUL;
742
743 /* Check if we have the privileges */
744 if (!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode))
745 {
746 DPRINT1("NtSetDefaultHardErrorPort: Caller requires "
747 "the SeTcbPrivilege privilege!\n");
748 return STATUS_PRIVILEGE_NOT_HELD;
749 }
750
751 /* Only called once during bootup, make sure we weren't called yet */
752 if (!ExReadyForErrors)
753 {
754 /* Reference the hard-error port */
755 Status = ObReferenceObjectByHandle(PortHandle,
756 0,
757 LpcPortObjectType,
758 PreviousMode,
759 (PVOID*)&ExpDefaultErrorPort,
760 NULL);
761 if (NT_SUCCESS(Status))
762 {
763 /* Keep also a reference to the process handling the hard errors */
764 ExpDefaultErrorPortProcess = PsGetCurrentProcess();
765 ObReferenceObject(ExpDefaultErrorPortProcess);
766 ExReadyForErrors = TRUE;
767 Status = STATUS_SUCCESS;
768 }
769 }
770
771 /* Return status to caller */
772 return Status;
773 }
774
775 VOID
776 __cdecl
777 _purecall(VOID)
778 {
779 /* Not supported in Kernel Mode */
780 RtlRaiseStatus(STATUS_NOT_IMPLEMENTED);
781 }
782
783 /* EOF */