- added stubs for NtSuspendProcess and NtResumeProcess

- the ProcessDebugPort information class is read-only on NT5.1+

svn path=/trunk/; revision=14862
This commit is contained in:
Thomas Bluemel 2005-04-29 16:41:52 +00:00
parent aff5e61f45
commit 827c16db5f
8 changed files with 106 additions and 87 deletions

View File

@ -70,7 +70,7 @@
#define PROCESS_SET_QUOTA (0x0100L)
#define PROCESS_SET_INFORMATION (0x0200L)
#define PROCESS_QUERY_INFORMATION (0x0400L)
#define PROCESS_SET_PORT (0x0800L)
#define PROCESS_SUSPEND_RESUME (0x0800L)
#define PROCESS_ALL_ACCESS (0x1f0fffL)

View File

@ -3713,6 +3713,20 @@ ZwResumeThread(
IN HANDLE ThreadHandle,
OUT PULONG SuspendCount OPTIONAL
);
NTSTATUS
STDCALL
NtResumeProcess(
IN HANDLE ProcessHandle
);
NTSTATUS
STDCALL
ZwResumeProcess(
IN HANDLE ProcessHandle
);
/*
* FUNCTION: Writes the content of a registry key to ascii file
* ARGUMENTS:
@ -4879,6 +4893,18 @@ ZwSuspendThread(
OUT PULONG PreviousSuspendCount OPTIONAL
);
NTSTATUS
STDCALL
NtSuspendProcess(
IN HANDLE ProcessHandle
);
NTSTATUS
STDCALL
ZwSuspendProcess(
IN HANDLE ProcessHandle
);
/*
* FUNCTION: Terminates the execution of a thread.
* ARGUMENTS:

View File

@ -215,6 +215,7 @@ NtRequestPort@8
NtRequestWaitReplyPort@12
NtResetEvent@8
NtRestoreKey@12
NtResumeProcess@4
NtResumeThread@8
NtSaveKey@8
NtSetContextThread@8
@ -251,6 +252,7 @@ NtShutdownSystem@4
NtSignalAndWaitForSingleObject@16
NtStartProfile@4
NtStopProfile@4
NtSuspendProcess@4
NtSuspendThread@8
NtSystemDebugControl@24
NtTerminateJobObject@8
@ -843,6 +845,7 @@ ZwRequestPort@8
ZwRequestWaitReplyPort@12
ZwResetEvent@8
ZwRestoreKey@12
ZwResumeProcess@4
ZwResumeThread@8
ZwSaveKey@8
ZwSetContextThread@8
@ -878,6 +881,7 @@ ZwShutdownSystem@4
ZwSignalAndWaitForSingleObject@16
ZwStartProfile@4
ZwStopProfile@4
ZwSuspendProcess@4
ZwSuspendThread@8
ZwSystemDebugControl@24
ZwTerminateProcess@8

View File

@ -22,7 +22,7 @@ static GENERIC_MAPPING PiProcessMapping = {
STANDARD_RIGHTS_WRITE | PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD |
PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_DUP_HANDLE |
PROCESS_TERMINATE | PROCESS_SET_QUOTA | PROCESS_SET_INFORMATION |
PROCESS_SET_PORT,
PROCESS_SUSPEND_RESUME,
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
PROCESS_ALL_ACCESS};

View File

@ -16,7 +16,6 @@
/* GLOBALS ******************************************************************/
static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
{
ICI_SQ_SAME( sizeof(PROCESS_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ), /* ProcessBasicInformation */
@ -26,7 +25,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
ICI_SQ_SAME( sizeof(KERNEL_USER_TIMES), sizeof(ULONG), ICIF_QUERY ), /* ProcessTimes */
ICI_SQ_SAME( sizeof(KPRIORITY), sizeof(ULONG), ICIF_SET ), /* ProcessBasePriority */
ICI_SQ_SAME( sizeof(ULONG), sizeof(ULONG), ICIF_SET ), /* ProcessRaisePriority */
ICI_SQ_SAME( sizeof(HANDLE), sizeof(ULONG), ICIF_QUERY | ICIF_SET ), /* ProcessDebugPort */
ICI_SQ_SAME( sizeof(HANDLE), sizeof(ULONG), ICIF_QUERY ), /* ProcessDebugPort */
ICI_SQ_SAME( sizeof(HANDLE), sizeof(ULONG), ICIF_SET ), /* ProcessExceptionPort */
ICI_SQ_SAME( sizeof(PROCESS_ACCESS_TOKEN), sizeof(ULONG), ICIF_SET ), /* ProcessAccessToken */
ICI_SQ_SAME( 0 /* FIXME */, sizeof(ULONG), ICIF_QUERY | ICIF_SET ), /* ProcessLdtInformation */
@ -672,8 +671,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
Access = PROCESS_SET_INFORMATION | PROCESS_SET_SESSIONID;
break;
case ProcessExceptionPort:
case ProcessDebugPort:
Access = PROCESS_SET_INFORMATION | PROCESS_SET_PORT;
Access = PROCESS_SET_INFORMATION | PROCESS_SUSPEND_RESUME;
break;
default:
@ -700,87 +698,6 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
Status = STATUS_NOT_IMPLEMENTED;
break;
case ProcessDebugPort:
{
HANDLE PortHandle = NULL;
/* make a safe copy of the buffer on the stack */
_SEH_TRY
{
PortHandle = *(PHANDLE)ProcessInformation;
Status = (PortHandle != NULL ? STATUS_SUCCESS : STATUS_INVALID_PARAMETER);
}
_SEH_HANDLE
{
Status = _SEH_GetExceptionCode();
}
_SEH_END;
if(NT_SUCCESS(Status))
{
PEPORT DebugPort;
/* in case we had success reading from the buffer, verify the provided
* LPC port handle
*/
Status = ObReferenceObjectByHandle(PortHandle,
0,
LpcPortObjectType,
PreviousMode,
(PVOID)&DebugPort,
NULL);
if(NT_SUCCESS(Status))
{
/* lock the process to be thread-safe! */
Status = PsLockProcess(Process, FALSE);
if(NT_SUCCESS(Status))
{
/*
* according to "NT Native API" documentation, setting the debug
* port is only permitted once!
*/
if(Process->DebugPort == NULL)
{
/* keep the reference to the handle! */
Process->DebugPort = DebugPort;
if(Process->Peb)
{
/* we're now debugging the process, so set the flag in the PEB
structure. However, to access it we need to attach to the
process so we're sure we're in the right context! */
KeAttachProcess(&Process->Pcb);
_SEH_TRY
{
Process->Peb->BeingDebugged = TRUE;
}
_SEH_HANDLE
{
DPRINT1("Trying to set the Peb->BeingDebugged field of process 0x%x failed, exception: 0x%x\n", Process, _SEH_GetExceptionCode());
}
_SEH_END;
KeDetachProcess();
}
Status = STATUS_SUCCESS;
}
else
{
ObDereferenceObject(DebugPort);
Status = STATUS_PORT_ALREADY_SET;
}
PsUnlockProcess(Process);
}
else
{
ObDereferenceObject(DebugPort);
}
}
}
break;
}
case ProcessExceptionPort:
{
HANDLE PortHandle = NULL;
@ -988,6 +905,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
case ProcessWx86Information:
case ProcessHandleCount:
case ProcessWow64Information:
case ProcessDebugPort:
default:
Status = STATUS_INVALID_INFO_CLASS;
}

View File

@ -173,4 +173,72 @@ NtSuspendThread(IN HANDLE ThreadHandle,
return Status;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtSuspendProcess(IN HANDLE ProcessHandle)
{
KPROCESSOR_MODE PreviousMode;
PEPROCESS Process;
NTSTATUS Status;
PAGED_CODE();
PreviousMode = ExGetPreviousMode();
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_SUSPEND_RESUME,
PsProcessType,
PreviousMode,
(PVOID*)&Process,
NULL);
if (NT_SUCCESS(Status))
{
/* FIXME */
Status = STATUS_NOT_IMPLEMENTED;
DPRINT1("NtSuspendProcess not yet implemented!\n");
ObDereferenceObject(Process);
}
return Status;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtResumeProcess(IN HANDLE ProcessHandle)
{
KPROCESSOR_MODE PreviousMode;
PEPROCESS Process;
NTSTATUS Status;
PAGED_CODE();
PreviousMode = ExGetPreviousMode();
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_SUSPEND_RESUME,
PsProcessType,
PreviousMode,
(PVOID*)&Process,
NULL);
if (NT_SUCCESS(Status))
{
/* FIXME */
Status = STATUS_NOT_IMPLEMENTED;
DPRINT1("NtResumeProcess not yet implemented!\n");
ObDereferenceObject(Process);
}
return Status;
}
/* EOF */

View File

@ -166,6 +166,7 @@ NtRequestPort 2
NtRequestWaitReplyPort 3
NtResetEvent 2
NtRestoreKey 3
NtResumeProcess 1
NtResumeThread 2
NtSaveKey 2
NtSaveKeyEx 3
@ -206,6 +207,7 @@ NtShutdownSystem 1
NtSignalAndWaitForSingleObject 4
NtStartProfile 1
NtStopProfile 1
NtSuspendProcess 1
NtSuspendThread 2
NtSystemDebugControl 6
NtTerminateJobObject 2

View File

@ -368,6 +368,7 @@ typedef DWORD FLONG;
#define PROCESS_SET_QUOTA 256
#define PROCESS_SET_INFORMATION 512
#define PROCESS_QUERY_INFORMATION 1024
#define PROCESS_SUSPEND_RESUME 2048
#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xFFF)
#define THREAD_TERMINATE 1
#define THREAD_SUSPEND_RESUME 2