mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
1. object type names are stored in ntoskrnl's image (which is nonpaged memory), so there's no need to allocate and copy them to new memory
2. fixed PsLookupThreadByThreadId() prototype 3. renamed the process list to PsActiveProcessHead and use fast mutexes to serialize access to it svn path=/trunk/; revision=13623
This commit is contained in:
parent
e376d4e01d
commit
6d97eb3b0f
20 changed files with 101 additions and 90 deletions
|
@ -403,7 +403,7 @@ NTSTATUS STDCALL PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
|||
OUT struct _ETHREAD **Thread);
|
||||
/* OUT PETHREAD *Thread); */
|
||||
|
||||
NTSTATUS STDCALL PsLookupThreadByThreadId(IN PVOID ThreadId,
|
||||
NTSTATUS STDCALL PsLookupThreadByThreadId(IN HANDLE ThreadId,
|
||||
OUT struct _ETHREAD **Thread);
|
||||
/* OUT PETHREAD *Thread); */
|
||||
|
||||
|
|
|
@ -862,20 +862,20 @@ DbgThreadListCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
|
|||
ULONG
|
||||
DbgProcessListCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
|
||||
{
|
||||
extern LIST_ENTRY PsProcessListHead;
|
||||
extern LIST_ENTRY PsActiveProcessHead;
|
||||
PLIST_ENTRY current_entry;
|
||||
PEPROCESS current;
|
||||
ULONG i = 1;
|
||||
|
||||
if (PsProcessListHead.Flink == NULL)
|
||||
if (PsActiveProcessHead.Flink == NULL)
|
||||
{
|
||||
DbgPrint("No processes.\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
DbgPrint("Process list: ");
|
||||
current_entry = PsProcessListHead.Flink;
|
||||
while (current_entry != &PsProcessListHead)
|
||||
current_entry = PsActiveProcessHead.Flink;
|
||||
while (current_entry != &PsActiveProcessHead)
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry, EPROCESS, ProcessListEntry);
|
||||
DbgPrint("%d %.8s", current->UniqueProcessId,
|
||||
|
|
|
@ -49,7 +49,7 @@ ExpInitializeCallbacks(VOID)
|
|||
ExCallbackObjectType = ExAllocatePoolWithTag(NonPagedPool, sizeof(OBJECT_TYPE), CALLBACK_TAG);
|
||||
|
||||
/* Initialize name */
|
||||
RtlRosInitUnicodeStringFromLiteral(&ExCallbackObjectType->TypeName,L"Callback");
|
||||
RtlInitUnicodeString(&ExCallbackObjectType->TypeName, L"Callback");
|
||||
|
||||
/* Create the Object Type */
|
||||
ExCallbackObjectType->Tag = CALLBACK_TAG;
|
||||
|
|
|
@ -295,7 +295,7 @@ ExpWin32kInit(VOID)
|
|||
ExWindowStationObjectType->OkayToClose = NULL;
|
||||
ExWindowStationObjectType->Create = ExpWinStaObjectCreate;
|
||||
ExWindowStationObjectType->DuplicationNotify = NULL;
|
||||
RtlRosInitUnicodeStringFromLiteral(&ExWindowStationObjectType->TypeName, L"WindowStation");
|
||||
RtlInitUnicodeString(&ExWindowStationObjectType->TypeName, L"WindowStation");
|
||||
|
||||
ObpCreateTypeObject(ExWindowStationObjectType);
|
||||
|
||||
|
@ -325,7 +325,7 @@ ExpWin32kInit(VOID)
|
|||
ExDesktopObjectType->OkayToClose = NULL;
|
||||
ExDesktopObjectType->Create = ExpDesktopObjectCreate;
|
||||
ExDesktopObjectType->DuplicationNotify = NULL;
|
||||
RtlRosInitUnicodeStringFromLiteral(&ExDesktopObjectType->TypeName, L"Desktop");
|
||||
RtlInitUnicodeString(&ExDesktopObjectType->TypeName, L"Desktop");
|
||||
|
||||
ObpCreateTypeObject(ExDesktopObjectType);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ IopInitDriverImplementation(VOID)
|
|||
IoDriverObjectType->OkayToClose = NULL;
|
||||
IoDriverObjectType->Create = IopCreateDriver;
|
||||
IoDriverObjectType->DuplicationNotify = NULL;
|
||||
RtlRosInitUnicodeStringFromLiteral(&IoDriverObjectType->TypeName, L"Driver");
|
||||
RtlInitUnicodeString(&IoDriverObjectType->TypeName, L"Driver");
|
||||
|
||||
ObpCreateTypeObject(IoDriverObjectType);
|
||||
|
||||
|
|
|
@ -410,7 +410,7 @@ IoInit (VOID)
|
|||
IoDeviceObjectType->Create = IopCreateDevice;
|
||||
IoDeviceObjectType->DuplicationNotify = NULL;
|
||||
|
||||
RtlRosInitUnicodeStringFromLiteral(&IoDeviceObjectType->TypeName, L"Device");
|
||||
RtlInitUnicodeString(&IoDeviceObjectType->TypeName, L"Device");
|
||||
|
||||
ObpCreateTypeObject(IoDeviceObjectType);
|
||||
|
||||
|
@ -439,7 +439,7 @@ IoInit (VOID)
|
|||
IoFileObjectType->Create = IopCreateFile;
|
||||
IoFileObjectType->DuplicationNotify = NULL;
|
||||
|
||||
RtlRosInitUnicodeStringFromLiteral(&IoFileObjectType->TypeName, L"File");
|
||||
RtlInitUnicodeString(&IoFileObjectType->TypeName, L"File");
|
||||
|
||||
ObpCreateTypeObject(IoFileObjectType);
|
||||
|
||||
|
@ -453,7 +453,7 @@ IoInit (VOID)
|
|||
IoAdapterObjectType->PeakObjects = 0;
|
||||
IoAdapterObjectType->PeakHandles = 0;
|
||||
IoDeviceObjectType->Mapping = &IopFileMapping;
|
||||
RtlRosInitUnicodeStringFromLiteral(&IoAdapterObjectType->TypeName, L"Adapter");
|
||||
RtlInitUnicodeString(&IoAdapterObjectType->TypeName, L"Adapter");
|
||||
ObpCreateTypeObject(IoAdapterObjectType);
|
||||
|
||||
/*
|
||||
|
|
|
@ -106,7 +106,7 @@ static PETHREAD GspRunThread; /* NULL means run all threads */
|
|||
static PETHREAD GspDbgThread;
|
||||
static PETHREAD GspEnumThread;
|
||||
|
||||
extern LIST_ENTRY PsProcessListHead;
|
||||
extern LIST_ENTRY PsActiveProcessHead;
|
||||
|
||||
/* Number of Registers. */
|
||||
#define NUMREGS 16
|
||||
|
@ -652,12 +652,14 @@ GspFindThread(PCHAR Data,
|
|||
}
|
||||
else
|
||||
{
|
||||
ULONG ThreadId;
|
||||
ULONG uThreadId;
|
||||
HANDLE ThreadId;
|
||||
PCHAR ptr = &Data[0];
|
||||
|
||||
GspHex2Long (&ptr, (PLONG) &ThreadId);
|
||||
GspHex2Long (&ptr, (PULONG) &uThreadId);
|
||||
ThreadId = (HANDLE)uThreadId;
|
||||
|
||||
if (!NT_SUCCESS (PsLookupThreadByThreadId ((PVOID) ThreadId, &ThreadInfo)))
|
||||
if (!NT_SUCCESS (PsLookupThreadByThreadId (ThreadId, &ThreadInfo)))
|
||||
{
|
||||
*Thread = NULL;
|
||||
return FALSE;
|
||||
|
@ -745,8 +747,8 @@ GspQuery(PCHAR Request)
|
|||
|
||||
/* Get first thread id */
|
||||
GspEnumThread = NULL;
|
||||
AProcess = PsProcessListHead.Flink;
|
||||
while(AProcess != &PsProcessListHead)
|
||||
AProcess = PsActiveProcessHead.Flink;
|
||||
while(AProcess != &PsActiveProcessHead)
|
||||
{
|
||||
Process = CONTAINING_RECORD(AProcess, EPROCESS, ProcessListEntry);
|
||||
AThread = Process->ThreadListHead.Flink;
|
||||
|
@ -791,7 +793,7 @@ GspQuery(PCHAR Request)
|
|||
{
|
||||
PETHREAD Thread = NULL;
|
||||
AProcess = Process->ProcessListEntry.Flink;
|
||||
while(AProcess != &PsProcessListHead)
|
||||
while(AProcess != &PsActiveProcessHead)
|
||||
{
|
||||
Process = CONTAINING_RECORD(AProcess, EPROCESS, ProcessListEntry);
|
||||
AThread = Process->ThreadListHead.Flink;
|
||||
|
|
|
@ -33,11 +33,11 @@ static GENERIC_MAPPING ExpPortMapping = {
|
|||
NTSTATUS INIT_FUNCTION
|
||||
LpcpInitSystem (VOID)
|
||||
{
|
||||
/* Allocate Memory for the LPC Object */
|
||||
LpcPortObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
|
||||
RtlZeroMemory (LpcPortObjectType, sizeof (OBJECT_TYPE));
|
||||
/* Allocate Memory for the LPC Object */
|
||||
LpcPortObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
|
||||
RtlZeroMemory (LpcPortObjectType, sizeof (OBJECT_TYPE));
|
||||
|
||||
RtlRosInitUnicodeStringFromLiteral(&LpcPortObjectType->TypeName,L"Port");
|
||||
RtlInitUnicodeString(&LpcPortObjectType->TypeName,L"Port");
|
||||
|
||||
LpcPortObjectType->Tag = TAG('L', 'P', 'R', 'T');
|
||||
LpcPortObjectType->PeakObjects = 0;
|
||||
|
|
|
@ -2127,7 +2127,7 @@ MmInitSectionImplementation(VOID)
|
|||
{
|
||||
MmSectionObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
|
||||
|
||||
RtlRosInitUnicodeStringFromLiteral(&MmSectionObjectType->TypeName, L"Section");
|
||||
RtlInitUnicodeString(&MmSectionObjectType->TypeName, L"Section");
|
||||
|
||||
MmSectionObjectType->Tag = TAG('S', 'E', 'C', 'T');
|
||||
MmSectionObjectType->TotalObjects = 0;
|
||||
|
|
|
@ -391,7 +391,7 @@ ObInit(VOID)
|
|||
ObDirectoryType->Create = ObpCreateDirectory;
|
||||
ObDirectoryType->DuplicationNotify = NULL;
|
||||
|
||||
RtlRosInitUnicodeStringFromLiteral(&ObDirectoryType->TypeName,
|
||||
RtlInitUnicodeString(&ObDirectoryType->TypeName,
|
||||
L"Directory");
|
||||
|
||||
/* create 'type' object type*/
|
||||
|
@ -416,7 +416,7 @@ ObInit(VOID)
|
|||
ObTypeObjectType->Create = NULL;
|
||||
ObTypeObjectType->DuplicationNotify = NULL;
|
||||
|
||||
RtlRosInitUnicodeStringFromLiteral(&ObTypeObjectType->TypeName,
|
||||
RtlInitUnicodeString(&ObTypeObjectType->TypeName,
|
||||
L"ObjectType");
|
||||
|
||||
/* Create security descriptor */
|
||||
|
|
|
@ -180,8 +180,8 @@ ObInitSymbolicLinkImplementation (VOID)
|
|||
ObSymbolicLinkType->Create = ObpCreateSymbolicLink;
|
||||
ObSymbolicLinkType->DuplicationNotify = NULL;
|
||||
|
||||
RtlRosInitUnicodeStringFromLiteral(&ObSymbolicLinkType->TypeName,
|
||||
L"SymbolicLink");
|
||||
RtlInitUnicodeString(&ObSymbolicLinkType->TypeName,
|
||||
L"SymbolicLink");
|
||||
|
||||
ObpCreateTypeObject(ObSymbolicLinkType);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/* $Id:$
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ps/job.c
|
||||
* PURPOSE: Job Native Functions
|
||||
*
|
||||
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
||||
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net) (stubs)
|
||||
* Thomas Weidenmueller <w3seek@reactos.com>
|
||||
*/
|
||||
|
||||
/* Note: Jobs are only supported on Win2K+ */
|
||||
|
@ -74,7 +75,7 @@ PsInitJobManagment(VOID)
|
|||
PsJobType->Create = NULL;
|
||||
PsJobType->DuplicationNotify = NULL;
|
||||
|
||||
RtlRosInitUnicodeStringFromLiteral(&PsJobType->TypeName, L"Job");
|
||||
RtlInitUnicodeString(&PsJobType->TypeName, L"Job");
|
||||
|
||||
ObpCreateTypeObject(PsJobType);
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ PEPROCESS EXPORTED PsInitialSystemProcess = NULL;
|
|||
|
||||
POBJECT_TYPE EXPORTED PsProcessType = NULL;
|
||||
|
||||
LIST_ENTRY PsProcessListHead;
|
||||
static KSPIN_LOCK PsProcessListLock;
|
||||
LIST_ENTRY PsActiveProcessHead;
|
||||
FAST_MUTEX PspActiveProcessMutex;
|
||||
static LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
|
||||
|
||||
static GENERIC_MAPPING PiProcessMapping = {STANDARD_RIGHTS_READ | PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
|
||||
|
@ -101,7 +101,6 @@ PsExitSpecialApc(PKAPC Apc,
|
|||
PEPROCESS
|
||||
PsGetNextProcess(PEPROCESS OldProcess)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PEPROCESS NextProcess;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
@ -119,13 +118,13 @@ PsGetNextProcess(PEPROCESS OldProcess)
|
|||
return PsInitialSystemProcess;
|
||||
}
|
||||
|
||||
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
||||
NextProcess = OldProcess;
|
||||
while (1)
|
||||
{
|
||||
if (NextProcess->ProcessListEntry.Blink == &PsProcessListHead)
|
||||
if (NextProcess->ProcessListEntry.Blink == &PsActiveProcessHead)
|
||||
{
|
||||
NextProcess = CONTAINING_RECORD(PsProcessListHead.Blink,
|
||||
NextProcess = CONTAINING_RECORD(PsActiveProcessHead.Blink,
|
||||
EPROCESS,
|
||||
ProcessListEntry);
|
||||
}
|
||||
|
@ -154,7 +153,7 @@ PsGetNextProcess(PEPROCESS OldProcess)
|
|||
}
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
||||
ObDereferenceObject(OldProcess);
|
||||
|
||||
return(NextProcess);
|
||||
|
@ -281,14 +280,13 @@ PsOpenTokenOfProcess(HANDLE ProcessHandle,
|
|||
VOID
|
||||
PiKillMostProcesses(VOID)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PLIST_ENTRY current_entry;
|
||||
PEPROCESS current;
|
||||
|
||||
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
||||
|
||||
current_entry = PsProcessListHead.Flink;
|
||||
while (current_entry != &PsProcessListHead)
|
||||
current_entry = PsActiveProcessHead.Flink;
|
||||
while (current_entry != &PsActiveProcessHead)
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry, EPROCESS,
|
||||
ProcessListEntry);
|
||||
|
@ -301,7 +299,7 @@ PiKillMostProcesses(VOID)
|
|||
}
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,7 +307,6 @@ VOID INIT_FUNCTION
|
|||
PsInitProcessManagment(VOID)
|
||||
{
|
||||
PKPROCESS KProcess;
|
||||
KIRQL oldIrql;
|
||||
NTSTATUS Status;
|
||||
|
||||
ShortPsLockDelay.QuadPart = -100LL;
|
||||
|
@ -339,12 +336,12 @@ PsInitProcessManagment(VOID)
|
|||
PsProcessType->Create = NULL;
|
||||
PsProcessType->DuplicationNotify = NULL;
|
||||
|
||||
RtlRosInitUnicodeStringFromLiteral(&PsProcessType->TypeName, L"Process");
|
||||
RtlInitUnicodeString(&PsProcessType->TypeName, L"Process");
|
||||
|
||||
ObpCreateTypeObject(PsProcessType);
|
||||
|
||||
InitializeListHead(&PsProcessListHead);
|
||||
KeInitializeSpinLock(&PsProcessListLock);
|
||||
InitializeListHead(&PsActiveProcessHead);
|
||||
ExInitializeFastMutex(&PspActiveProcessMutex);
|
||||
|
||||
RtlZeroMemory(PiProcessNotifyRoutine, sizeof(PiProcessNotifyRoutine));
|
||||
RtlZeroMemory(PiLoadImageNotifyRoutine, sizeof(PiLoadImageNotifyRoutine));
|
||||
|
@ -412,11 +409,9 @@ PsInitProcessManagment(VOID)
|
|||
|
||||
PsInitialSystemProcess->Win32WindowStation = (HANDLE)0;
|
||||
|
||||
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
||||
InsertHeadList(&PsProcessListHead,
|
||||
InsertHeadList(&PsActiveProcessHead,
|
||||
&PsInitialSystemProcess->ProcessListEntry);
|
||||
InitializeListHead(&PsInitialSystemProcess->ThreadListHead);
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
|
||||
SepCreateSystemProcessToken(PsInitialSystemProcess);
|
||||
}
|
||||
|
@ -424,7 +419,6 @@ PsInitProcessManagment(VOID)
|
|||
VOID STDCALL
|
||||
PiDeleteProcessWorker(PVOID pContext)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PDEL_CONTEXT Context;
|
||||
PEPROCESS CurrentProcess;
|
||||
PEPROCESS Process;
|
||||
|
@ -440,9 +434,9 @@ PiDeleteProcessWorker(PVOID pContext)
|
|||
KeAttachProcess(&Process->Pcb);
|
||||
}
|
||||
|
||||
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
||||
RemoveEntryList(&Process->ProcessListEntry);
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
||||
|
||||
/* KDB hook */
|
||||
KDB_DELETEPROCESS_HOOK(Process);
|
||||
|
@ -657,7 +651,6 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
|||
PEPROCESS Process;
|
||||
PEPROCESS pParentProcess;
|
||||
PKPROCESS KProcess;
|
||||
KIRQL oldIrql;
|
||||
PVOID LdrStartupAddr;
|
||||
PVOID BaseAddress;
|
||||
PMEMORY_AREA MemoryArea;
|
||||
|
@ -863,10 +856,10 @@ exitdereferenceobjects:
|
|||
|
||||
Process->Win32WindowStation = (HANDLE)0;
|
||||
|
||||
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
||||
InsertHeadList(&PsProcessListHead, &Process->ProcessListEntry);
|
||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
||||
InsertHeadList(&PsActiveProcessHead, &Process->ProcessListEntry);
|
||||
InitializeListHead(&Process->ThreadListHead);
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
||||
|
||||
ExInitializeFastMutex(&Process->TebLock);
|
||||
Process->Pcb.State = PROCESS_STATE_ACTIVE;
|
||||
|
@ -1261,14 +1254,13 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
|
|||
}
|
||||
else
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PLIST_ENTRY current_entry;
|
||||
PEPROCESS current;
|
||||
NTSTATUS Status;
|
||||
|
||||
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
||||
current_entry = PsProcessListHead.Flink;
|
||||
while (current_entry != &PsProcessListHead)
|
||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
||||
current_entry = PsActiveProcessHead.Flink;
|
||||
while (current_entry != &PsActiveProcessHead)
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry, EPROCESS,
|
||||
ProcessListEntry);
|
||||
|
@ -1285,7 +1277,7 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
|
|||
PsProcessType,
|
||||
UserMode);
|
||||
}
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = ObCreateHandle(PsGetCurrentProcess(),
|
||||
|
@ -1301,7 +1293,7 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
|
|||
}
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
||||
DPRINT("NtOpenProcess() = STATUS_UNSUCCESSFUL\n");
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
@ -2093,6 +2085,27 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ProcessPriorityClass:
|
||||
{
|
||||
PROCESS_PRIORITY_CLASS ppc;
|
||||
|
||||
_SEH_TRY
|
||||
{
|
||||
ppc = *(PPROCESS_PRIORITY_CLASS)ProcessInformation;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
Status = _SEH_GetExceptionCode();
|
||||
}
|
||||
_SEH_END;
|
||||
|
||||
if(NT_SUCCESS(Status))
|
||||
{
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ProcessLdtInformation:
|
||||
case ProcessLdtSize:
|
||||
|
@ -2100,7 +2113,6 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
|||
case ProcessWorkingSetWatch:
|
||||
case ProcessUserModeIOPL:
|
||||
case ProcessEnableAlignmentFaultFixup:
|
||||
case ProcessPriorityClass:
|
||||
case ProcessAffinityMask:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
@ -2143,7 +2155,6 @@ PiQuerySystemProcessInformation(PVOID Buffer,
|
|||
return STATUS_NOT_IMPLEMENTED;
|
||||
|
||||
#if 0
|
||||
KIRQL OldIrql;
|
||||
PLIST_ENTRY CurrentEntryP;
|
||||
PEPROCESS CurrentP;
|
||||
PLIST_ENTRY CurrentEntryT;
|
||||
|
@ -2160,16 +2171,15 @@ PiQuerySystemProcessInformation(PVOID Buffer,
|
|||
|
||||
|
||||
/* Lock the process list. */
|
||||
KeAcquireSpinLock(&PsProcessListLock,
|
||||
&OldIrql);
|
||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
||||
|
||||
/*
|
||||
* Scan the process list. Since the
|
||||
* list is circular, the guard is false
|
||||
* after the last process.
|
||||
*/
|
||||
for ( CurrentEntryP = PsProcessListHead.Flink;
|
||||
(CurrentEntryP != & PsProcessListHead);
|
||||
for ( CurrentEntryP = PsActiveProcessHead.Flink;
|
||||
(CurrentEntryP != & PsActiveProcessHead);
|
||||
CurrentEntryP = CurrentEntryP->Flink
|
||||
)
|
||||
{
|
||||
|
@ -2305,9 +2315,8 @@ PiQuerySystemProcessInformation(PVOID Buffer,
|
|||
/*
|
||||
* Unlock the process list.
|
||||
*/
|
||||
KeReleaseSpinLock (
|
||||
& PsProcessListLock,
|
||||
OldIrql
|
||||
ExReleaseFastMutex (
|
||||
& PspActiveProcessMutex
|
||||
);
|
||||
/*
|
||||
* Return the proper error status code,
|
||||
|
@ -2541,14 +2550,13 @@ NTSTATUS STDCALL
|
|||
PsLookupProcessByProcessId(IN HANDLE ProcessId,
|
||||
OUT PEPROCESS *Process)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PLIST_ENTRY current_entry;
|
||||
PEPROCESS current;
|
||||
|
||||
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
||||
|
||||
current_entry = PsProcessListHead.Flink;
|
||||
while (current_entry != &PsProcessListHead)
|
||||
current_entry = PsActiveProcessHead.Flink;
|
||||
while (current_entry != &PsActiveProcessHead)
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry,
|
||||
EPROCESS,
|
||||
|
@ -2557,13 +2565,13 @@ PsLookupProcessByProcessId(IN HANDLE ProcessId,
|
|||
{
|
||||
*Process = current;
|
||||
ObReferenceObject(current);
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
||||
|
||||
return(STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
extern LIST_ENTRY PsProcessListHead;
|
||||
extern LIST_ENTRY PsActiveProcessHead;
|
||||
|
||||
POBJECT_TYPE EXPORTED PsThreadType = NULL;
|
||||
|
||||
|
@ -287,8 +287,8 @@ VOID PsDumpThreads(BOOLEAN IncludeSystem)
|
|||
PETHREAD Thread;
|
||||
ULONG nThreads = 0;
|
||||
|
||||
AProcess = PsProcessListHead.Flink;
|
||||
while(AProcess != &PsProcessListHead)
|
||||
AProcess = PsActiveProcessHead.Flink;
|
||||
while(AProcess != &PsActiveProcessHead)
|
||||
{
|
||||
Process = CONTAINING_RECORD(AProcess, EPROCESS, ProcessListEntry);
|
||||
/* FIXME - skip suspended, ... processes? */
|
||||
|
@ -767,7 +767,7 @@ PsInitThreadManagment(VOID)
|
|||
PsThreadType->Create = NULL;
|
||||
PsThreadType->DuplicationNotify = NULL;
|
||||
|
||||
RtlRosInitUnicodeStringFromLiteral(&PsThreadType->TypeName, L"Thread");
|
||||
RtlInitUnicodeString(&PsThreadType->TypeName, L"Thread");
|
||||
|
||||
ObpCreateTypeObject(PsThreadType);
|
||||
|
||||
|
@ -1088,12 +1088,12 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
|||
* @implemented
|
||||
*/
|
||||
NTSTATUS STDCALL
|
||||
PsLookupThreadByThreadId(IN PVOID ThreadId,
|
||||
PsLookupThreadByThreadId(IN HANDLE ThreadId,
|
||||
OUT PETHREAD *Thread)
|
||||
{
|
||||
PCID_OBJECT CidObject;
|
||||
|
||||
CidObject = PsLockCidHandle((HANDLE)ThreadId, PsThreadType);
|
||||
CidObject = PsLockCidHandle(ThreadId, PsThreadType);
|
||||
if(CidObject != NULL)
|
||||
{
|
||||
*Thread = CidObject->Obj.Thread;
|
||||
|
|
|
@ -1138,7 +1138,7 @@ NtUserGetThreadDesktop(DWORD dwThreadId, DWORD Unknown1)
|
|||
return 0;
|
||||
}
|
||||
|
||||
Status = PsLookupThreadByThreadId((PVOID)dwThreadId, &Thread);
|
||||
Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
|
|
|
@ -460,7 +460,7 @@ NtUserSetWindowsHookEx(
|
|||
}
|
||||
Mod = NULL;
|
||||
Global = FALSE;
|
||||
if (! NT_SUCCESS(PsLookupThreadByThreadId((PVOID) ThreadId, &Thread)))
|
||||
if (! NT_SUCCESS(PsLookupThreadByThreadId((HANDLE) ThreadId, &Thread)))
|
||||
{
|
||||
DPRINT1("Invalid thread id 0x%x\n", ThreadId);
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
|
|
|
@ -1173,7 +1173,7 @@ NtUserPostThreadMessage(DWORD idThread,
|
|||
NTSTATUS Status;
|
||||
PMSGMEMORY MsgMemoryEntry;
|
||||
|
||||
Status = PsLookupThreadByThreadId((void *)idThread,&peThread);
|
||||
Status = PsLookupThreadByThreadId((HANDLE)idThread,&peThread);
|
||||
|
||||
if( Status == STATUS_SUCCESS ) {
|
||||
pThread = peThread->Tcb.Win32Thread;
|
||||
|
|
|
@ -1179,7 +1179,7 @@ NtUserGetGUIThreadInfo(
|
|||
|
||||
if(idThread)
|
||||
{
|
||||
Status = PsLookupThreadByThreadId((PVOID)idThread, &Thread);
|
||||
Status = PsLookupThreadByThreadId((HANDLE)idThread, &Thread);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||
|
|
|
@ -1164,7 +1164,7 @@ NtUserBuildHwndList(
|
|||
PLIST_ENTRY Current;
|
||||
PWINDOW_OBJECT Window;
|
||||
|
||||
Status = PsLookupThreadByThreadId((PVOID)dwThreadId, &Thread);
|
||||
Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
|
|
|
@ -3306,7 +3306,7 @@ NTKERNELAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
PsLookupThreadByThreadId (
|
||||
IN PVOID UniqueThreadId,
|
||||
IN HANDLE UniqueThreadId,
|
||||
OUT PETHREAD *Thread
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue