mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
1. a few previous mode fixes
2. implemented NtSetDefaultHardErrorPort() with help of pseudo code from windowsitlibrary.com svn path=/trunk/; revision=13576
This commit is contained in:
parent
36e7b406b5
commit
f0222daf5d
3 changed files with 51 additions and 8 deletions
|
@ -107,13 +107,16 @@ NtAlertResumeThread(IN HANDLE ThreadHandle,
|
|||
NTSTATUS STDCALL
|
||||
NtAlertThread (IN HANDLE ThreadHandle)
|
||||
{
|
||||
KPROCESSOR_MODE PreviousMode;
|
||||
PETHREAD Thread;
|
||||
NTSTATUS Status;
|
||||
|
||||
PreviousMode = ExGetPreviousMode();
|
||||
|
||||
Status = ObReferenceObjectByHandle(ThreadHandle,
|
||||
THREAD_SUSPEND_RESUME,
|
||||
PsThreadType,
|
||||
ExGetPreviousMode(),
|
||||
PreviousMode,
|
||||
(PVOID*)&Thread,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -125,7 +128,7 @@ NtAlertThread (IN HANDLE ThreadHandle)
|
|||
* ZwAlertThread was called?
|
||||
* -Gunnar
|
||||
*/
|
||||
KeAlertThread((PKTHREAD)Thread, UserMode);
|
||||
KeAlertThread((PKTHREAD)Thread, PreviousMode);
|
||||
|
||||
ObDereferenceObject(Thread);
|
||||
return(STATUS_SUCCESS);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id:$
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -517,13 +517,16 @@ NtQueueApcThread(HANDLE ThreadHandle,
|
|||
|
||||
PKAPC Apc;
|
||||
PETHREAD Thread;
|
||||
KPROCESSOR_MODE PreviousMode;
|
||||
NTSTATUS Status;
|
||||
|
||||
PreviousMode = ExGetPreviousMode();
|
||||
|
||||
/* Get ETHREAD from Handle */
|
||||
Status = ObReferenceObjectByHandle(ThreadHandle,
|
||||
THREAD_SET_CONTEXT,
|
||||
PsThreadType,
|
||||
KeGetPreviousMode(),
|
||||
PreviousMode,
|
||||
(PVOID)&Thread,
|
||||
NULL);
|
||||
|
||||
|
@ -552,7 +555,7 @@ NtQueueApcThread(HANDLE ThreadHandle,
|
|||
KiFreeApcRoutine,
|
||||
NULL,
|
||||
ApcRoutine,
|
||||
UserMode,
|
||||
PreviousMode,
|
||||
NormalContext);
|
||||
if (!KeInsertQueueApc(Apc, SystemArgument1, SystemArgument2, IO_NO_INCREMENT)) {
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id:$
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -15,6 +15,10 @@
|
|||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
BOOLEAN ExReadyForErrors = FALSE;
|
||||
PEPORT ExpDefaultErrorPort = NULL;
|
||||
PEPROCESS ExpDefaultErrorPortProcess = NULL;
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
@ -54,8 +58,41 @@ NtRaiseHardError(IN NTSTATUS Status,
|
|||
NTSTATUS STDCALL
|
||||
NtSetDefaultHardErrorPort(IN HANDLE PortHandle)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return(STATUS_NOT_IMPLEMENTED);
|
||||
KPROCESSOR_MODE PreviousMode;
|
||||
NTSTATUS Status;
|
||||
|
||||
PreviousMode = ExGetPreviousMode();
|
||||
|
||||
if(!SeSinglePrivilegeCheck(SeTcbPrivilege,
|
||||
PreviousMode))
|
||||
{
|
||||
DPRINT1("NtSetDefaultHardErrorPort: Caller requires the SeTcbPrivilege privilege!\n");
|
||||
return STATUS_PRIVILEGE_NOT_HELD;
|
||||
}
|
||||
|
||||
/* serialization shouldn't be required here as it usually is just called once
|
||||
during startup */
|
||||
|
||||
if(!ExReadyForErrors)
|
||||
{
|
||||
Status = ObReferenceObjectByHandle(PortHandle,
|
||||
0,
|
||||
LpcPortObjectType,
|
||||
PreviousMode,
|
||||
(PVOID*)&ExpDefaultErrorPort,
|
||||
NULL);
|
||||
if(NT_SUCCESS(Status))
|
||||
{
|
||||
ExpDefaultErrorPortProcess = PsGetCurrentProcess();
|
||||
ExReadyForErrors = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue