mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:43:01 +00:00
- Simplify PsGetNextProcess so it works like PsGetNextProcessThread.
- Reformat and annotate parts of process.c - Remove PsGetWin32Process, PsGetWin32Thread and implement/export the real functions PsGetCurrentProcessWin32Process, PsGetCurrentThreadWin32Thread, change win32k to use them. - Initailize and use process rundown. - Set corrent GrantedAccess. - Remove an extra incorrect reference we were adding to processes. - Implement PsIsProcessBeingDebugged. - Make the same changes to NtOpenProcess that we did previously to NtOpenThread. svn path=/trunk/; revision=23192
This commit is contained in:
parent
18726a1fac
commit
502215cb1c
33 changed files with 356 additions and 369 deletions
|
@ -32,13 +32,13 @@ Author:
|
||||||
//
|
//
|
||||||
struct _W32THREAD*
|
struct _W32THREAD*
|
||||||
NTAPI
|
NTAPI
|
||||||
PsGetWin32Thread(
|
PsGetCurrentThreadWin32Thread(
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
struct _W32PROCESS*
|
struct _W32PROCESS*
|
||||||
NTAPI
|
NTAPI
|
||||||
PsGetWin32Process(
|
PsGetCurrentProcessWin32Process(
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,25 @@ IoIsWdmVersionAvailable(IN UCHAR MajorVersion,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
PEPROCESS
|
||||||
|
NTAPI
|
||||||
|
IoGetCurrentProcess(VOID)
|
||||||
|
{
|
||||||
|
/* FIXME: Completely broken */
|
||||||
|
if (PsGetCurrentThread() == NULL ||
|
||||||
|
PsGetCurrentThread()->Tcb.ApcState.Process == NULL)
|
||||||
|
{
|
||||||
|
return(PsInitialSystemProcess);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return(PEPROCESS)(PsGetCurrentThread()->Tcb.ApcState.Process);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -897,10 +897,12 @@ PsEstablishWin32Callouts@4
|
||||||
PsGetContextThread@12
|
PsGetContextThread@12
|
||||||
PsGetCurrentProcess@0=KeGetCurrentProcess@0
|
PsGetCurrentProcess@0=KeGetCurrentProcess@0
|
||||||
PsGetCurrentProcessId@0
|
PsGetCurrentProcessId@0
|
||||||
|
PsGetCurrentProcessWin32Process@0
|
||||||
PsGetCurrentProcessSessionId@0
|
PsGetCurrentProcessSessionId@0
|
||||||
PsGetCurrentThread@0=KeGetCurrentThread@0
|
PsGetCurrentThread@0=KeGetCurrentThread@0
|
||||||
PsGetCurrentThreadId@0
|
PsGetCurrentThreadId@0
|
||||||
PsGetCurrentThreadPreviousMode@0
|
PsGetCurrentThreadPreviousMode@0
|
||||||
|
PsGetCurrentThreadWin32Thread@0
|
||||||
PsGetCurrentThreadStackBase@0
|
PsGetCurrentThreadStackBase@0
|
||||||
PsGetCurrentThreadStackLimit@0
|
PsGetCurrentThreadStackLimit@0
|
||||||
PsGetJobLock@4
|
PsGetJobLock@4
|
||||||
|
@ -931,8 +933,6 @@ PsGetThreadSessionId@4
|
||||||
PsGetThreadTeb@4
|
PsGetThreadTeb@4
|
||||||
PsGetThreadWin32Thread@4
|
PsGetThreadWin32Thread@4
|
||||||
PsGetVersion@16
|
PsGetVersion@16
|
||||||
PsGetWin32Thread@0
|
|
||||||
PsGetWin32Process@0
|
|
||||||
PsImpersonateClient@20
|
PsImpersonateClient@20
|
||||||
PsInitialSystemProcess DATA
|
PsInitialSystemProcess DATA
|
||||||
PsIsProcessBeingDebugged@4
|
PsIsProcessBeingDebugged@4
|
||||||
|
|
|
@ -13,11 +13,7 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
#define LockEvent Spare0[0]
|
/* GLOBALS *******************************************************************/
|
||||||
#define LockCount Spare0[1]
|
|
||||||
#define LockOwner Spare0[2]
|
|
||||||
|
|
||||||
/* GLOBALS ******************************************************************/
|
|
||||||
|
|
||||||
PEPROCESS PsInitialSystemProcess = NULL;
|
PEPROCESS PsInitialSystemProcess = NULL;
|
||||||
PEPROCESS PsIdleProcess = NULL;
|
PEPROCESS PsIdleProcess = NULL;
|
||||||
|
@ -26,31 +22,16 @@ extern PHANDLE_TABLE PspCidTable;
|
||||||
extern POBJECT_TYPE DbgkDebugObjectType;
|
extern POBJECT_TYPE DbgkDebugObjectType;
|
||||||
|
|
||||||
EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
|
EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
|
||||||
|
|
||||||
ULONG PsMinimumWorkingSet, PsMaximumWorkingSet;
|
ULONG PsMinimumWorkingSet, PsMaximumWorkingSet;
|
||||||
|
|
||||||
LIST_ENTRY PsActiveProcessHead;
|
LIST_ENTRY PsActiveProcessHead;
|
||||||
FAST_MUTEX PspActiveProcessMutex;
|
FAST_MUTEX PspActiveProcessMutex;
|
||||||
|
|
||||||
|
#if 1
|
||||||
LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
|
LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
|
||||||
|
#define LockEvent Spare0[0]
|
||||||
/* INTERNAL FUNCTIONS *****************************************************************/
|
#define LockCount Spare0[1]
|
||||||
|
#define LockOwner Spare0[2]
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
PspDeleteLdt(PEPROCESS Process)
|
|
||||||
{
|
|
||||||
/* FIXME */
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
PspDeleteVdmObjects(PEPROCESS Process)
|
|
||||||
{
|
|
||||||
/* FIXME */
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
PsLockProcess(PEPROCESS Process, BOOLEAN Timeout)
|
PsLockProcess(PEPROCESS Process, BOOLEAN Timeout)
|
||||||
|
@ -126,6 +107,25 @@ PsUnlockProcess(PEPROCESS Process)
|
||||||
|
|
||||||
KeLeaveCriticalRegion();
|
KeLeaveCriticalRegion();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* PRIVATE FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
PspDeleteLdt(PEPROCESS Process)
|
||||||
|
{
|
||||||
|
/* FIXME */
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
PspDeleteVdmObjects(PEPROCESS Process)
|
||||||
|
{
|
||||||
|
/* FIXME */
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
PETHREAD
|
PETHREAD
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -175,69 +175,45 @@ PsGetNextProcessThread(IN PEPROCESS Process,
|
||||||
|
|
||||||
PEPROCESS
|
PEPROCESS
|
||||||
NTAPI
|
NTAPI
|
||||||
PsGetNextProcess(PEPROCESS OldProcess)
|
PsGetNextProcess(IN PEPROCESS OldProcess)
|
||||||
{
|
{
|
||||||
PEPROCESS NextProcess;
|
PLIST_ENTRY Entry, ListHead;
|
||||||
NTSTATUS Status;
|
PEPROCESS FoundProcess = NULL;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Check if we have a previous process */
|
|
||||||
if (OldProcess == NULL)
|
|
||||||
{
|
|
||||||
/* We don't, start with the Idle Process */
|
|
||||||
Status = ObReferenceObjectByPointer(PsIdleProcess,
|
|
||||||
PROCESS_ALL_ACCESS,
|
|
||||||
PsProcessType,
|
|
||||||
KernelMode);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("PsGetNextProcess(): ObReferenceObjectByPointer failed for PsIdleProcess\n");
|
|
||||||
KEBUGCHECK(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return PsIdleProcess;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Acquire the Active Process Lock */
|
/* Acquire the Active Process Lock */
|
||||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
ExAcquireFastMutex(&PspActiveProcessMutex);
|
||||||
|
|
||||||
/* Start at the previous process */
|
/* Check if we're already starting somewhere */
|
||||||
NextProcess = OldProcess;
|
if (OldProcess)
|
||||||
|
|
||||||
/* Loop until we fail */
|
|
||||||
while (1)
|
|
||||||
{
|
{
|
||||||
/* Get the Process Link */
|
/* Start where we left off */
|
||||||
PLIST_ENTRY Flink = (NextProcess == PsIdleProcess ? PsActiveProcessHead.Flink :
|
Entry = OldProcess->ActiveProcessLinks.Flink;
|
||||||
NextProcess->ActiveProcessLinks.Flink);
|
|
||||||
|
|
||||||
/* Move to the next Process if we're not back at the beginning */
|
|
||||||
if (Flink != &PsActiveProcessHead)
|
|
||||||
{
|
|
||||||
NextProcess = CONTAINING_RECORD(Flink, EPROCESS, ActiveProcessLinks);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NextProcess = NULL;
|
/* Start at the beginning */
|
||||||
break;
|
Entry = PsActiveProcessHead.Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reference the Process */
|
/* Set the list head and start looping */
|
||||||
Status = ObReferenceObjectByPointer(NextProcess,
|
ListHead = &PsActiveProcessHead;
|
||||||
PROCESS_ALL_ACCESS,
|
while (ListHead != Entry)
|
||||||
PsProcessType,
|
{
|
||||||
KernelMode);
|
/* Get the Thread */
|
||||||
|
FoundProcess = CONTAINING_RECORD(Entry, EPROCESS, ActiveProcessLinks);
|
||||||
|
|
||||||
/* Exit the loop if the reference worked, keep going if there's an error */
|
/* Reference the thread. FIXME: Race, use ObSafeReferenceObject */
|
||||||
if (NT_SUCCESS(Status)) break;
|
ObReferenceObject(FoundProcess);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release the lock */
|
/* Release the lock */
|
||||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
ExReleaseFastMutex(&PspActiveProcessMutex);
|
||||||
|
|
||||||
/* Reference the Process we had referenced earlier */
|
/* Reference the Process we had referenced earlier */
|
||||||
ObDereferenceObject(OldProcess);
|
if (OldProcess) ObDereferenceObject(OldProcess);
|
||||||
return(NextProcess);
|
return FoundProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -288,11 +264,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
PreviousMode,
|
PreviousMode,
|
||||||
(PVOID*)&Parent,
|
(PVOID*)&Parent,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
{
|
|
||||||
DPRINT1("Failed to reference the parent process: Status: 0x%x\n", Status);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If this process should be in a job but the parent isn't */
|
/* If this process should be in a job but the parent isn't */
|
||||||
if ((InJob) && (!Parent->Job))
|
if ((InJob) && (!Parent->Job))
|
||||||
|
@ -333,15 +305,15 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
(PVOID*)&Process);
|
(PVOID*)&Process);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto Cleanup;
|
||||||
{
|
|
||||||
DPRINT1("Failed to create process object, Status: 0x%x\n", Status);
|
|
||||||
goto Cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clean up the Object */
|
/* Clean up the Object */
|
||||||
RtlZeroMemory(Process, sizeof(EPROCESS));
|
RtlZeroMemory(Process, sizeof(EPROCESS));
|
||||||
|
|
||||||
|
/* Initialize pushlock and rundown protection */
|
||||||
|
ExInitializeRundownProtection(&Process->RundownProtect);
|
||||||
|
Process->ProcessLock.Value = 0;
|
||||||
|
|
||||||
/* Setup the Thread List Head */
|
/* Setup the Thread List Head */
|
||||||
InitializeListHead(&Process->ThreadListHead);
|
InitializeListHead(&Process->ThreadListHead);
|
||||||
|
|
||||||
|
@ -356,7 +328,8 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
{
|
{
|
||||||
/* Ineherit PID and Hard Error Processing */
|
/* Ineherit PID and Hard Error Processing */
|
||||||
Process->InheritedFromUniqueProcessId = Parent->UniqueProcessId;
|
Process->InheritedFromUniqueProcessId = Parent->UniqueProcessId;
|
||||||
Process->DefaultHardErrorProcessing = Parent->DefaultHardErrorProcessing;
|
Process->DefaultHardErrorProcessing = Parent->
|
||||||
|
DefaultHardErrorProcessing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -374,11 +347,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
PreviousMode,
|
PreviousMode,
|
||||||
(PVOID*)&SectionObject,
|
(PVOID*)&SectionObject,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
|
||||||
{
|
|
||||||
DPRINT1("Failed to reference process image section: Status: 0x%x\n", Status);
|
|
||||||
goto CleanupWithRef;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -386,14 +355,14 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
if (Parent != PsInitialSystemProcess)
|
if (Parent != PsInitialSystemProcess)
|
||||||
{
|
{
|
||||||
/* It's not, so acquire the process rundown */
|
/* It's not, so acquire the process rundown */
|
||||||
// FIXME
|
ExAcquireRundownProtection(&Process->RundownProtect);
|
||||||
|
|
||||||
/* If the parent has a section, use it */
|
/* If the parent has a section, use it */
|
||||||
SectionObject = Parent->SectionObject;
|
SectionObject = Parent->SectionObject;
|
||||||
if (SectionObject) ObReferenceObject(SectionObject);
|
if (SectionObject) ObReferenceObject(SectionObject);
|
||||||
|
|
||||||
/* Release process rundown */
|
/* Release process rundown */
|
||||||
// FIXME
|
ExReleaseRundownProtection(&Process->RundownProtect);
|
||||||
|
|
||||||
/* If we don't have a section object */
|
/* If we don't have a section object */
|
||||||
if (!SectionObject)
|
if (!SectionObject)
|
||||||
|
@ -418,17 +387,17 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
PreviousMode,
|
PreviousMode,
|
||||||
(PVOID*)&DebugObject,
|
(PVOID*)&DebugObject,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
|
||||||
{
|
|
||||||
DPRINT1("Failed to reference the debug port: Status: 0x%x\n", Status);
|
|
||||||
goto CleanupWithRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save the debug object */
|
/* Save the debug object */
|
||||||
Process->DebugPort = DebugObject;
|
Process->DebugPort = DebugObject;
|
||||||
|
|
||||||
/* Check if the caller doesn't want the debug stuff inherited */
|
/* Check if the caller doesn't want the debug stuff inherited */
|
||||||
if (Flags & PS_NO_DEBUG_INHERIT) InterlockedOr((PLONG)&Process->Flags, 2);
|
if (Flags & PS_NO_DEBUG_INHERIT)
|
||||||
|
{
|
||||||
|
/* Set the process flag */
|
||||||
|
InterlockedOr((PLONG)&Process->Flags, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -446,11 +415,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
PreviousMode,
|
PreviousMode,
|
||||||
(PVOID*)&ExceptionPortObject,
|
(PVOID*)&ExceptionPortObject,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
|
||||||
{
|
|
||||||
DPRINT1("Failed to reference the exception port: Status: 0x%x\n", Status);
|
|
||||||
goto CleanupWithRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save the exception port */
|
/* Save the exception port */
|
||||||
Process->ExceptionPort = ExceptionPortObject;
|
Process->ExceptionPort = ExceptionPortObject;
|
||||||
|
@ -460,10 +425,12 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
Process->SectionObject = SectionObject;
|
Process->SectionObject = SectionObject;
|
||||||
|
|
||||||
/* Setup the Lock Event */
|
/* Setup the Lock Event */
|
||||||
|
#if 1
|
||||||
Process->LockEvent = ExAllocatePoolWithTag(PagedPool,
|
Process->LockEvent = ExAllocatePoolWithTag(PagedPool,
|
||||||
sizeof(KEVENT),
|
sizeof(KEVENT),
|
||||||
TAG('P', 's', 'L', 'k'));
|
TAG('P', 's', 'L', 'k'));
|
||||||
KeInitializeEvent(Process->LockEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent(Process->LockEvent, SynchronizationEvent, FALSE);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set default exit code */
|
/* Set default exit code */
|
||||||
Process->ExitStatus = STATUS_TIMEOUT;
|
Process->ExitStatus = STATUS_TIMEOUT;
|
||||||
|
@ -490,22 +457,14 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
|
|
||||||
/* Duplicate Parent Token */
|
/* Duplicate Parent Token */
|
||||||
Status = PspInitializeProcessSecurity(Process, Parent);
|
Status = PspInitializeProcessSecurity(Process, Parent);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
|
||||||
{
|
|
||||||
DPRINT1("PspInitializeProcessSecurity failed (Status %x)\n", Status);
|
|
||||||
goto CleanupWithRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set default priority class */
|
/* Set default priority class */
|
||||||
Process->PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL;
|
Process->PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL;
|
||||||
|
|
||||||
/* Create the Process' Address Space */
|
/* Create the Process' Address Space */
|
||||||
Status = MmCreateProcessAddressSpace(Process, (PROS_SECTION_OBJECT)SectionObject);
|
Status = MmCreateProcessAddressSpace(Process, (PROS_SECTION_OBJECT)SectionObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
|
||||||
{
|
|
||||||
DPRINT1("Failed to create Address Space\n");
|
|
||||||
goto CleanupWithRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for parent again */
|
/* Check for parent again */
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -542,12 +501,8 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check if we have a section object */
|
/* Check if we have a section object and map the system DLL */
|
||||||
if (SectionObject)
|
if (SectionObject) PspMapSystemDll(Process, NULL);
|
||||||
{
|
|
||||||
/* Map the System Dll */
|
|
||||||
PspMapSystemDll(Process, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a handle for the Process */
|
/* Create a handle for the Process */
|
||||||
CidEntry.Object = Process;
|
CidEntry.Object = Process;
|
||||||
|
@ -555,7 +510,6 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
Process->UniqueProcessId = ExCreateHandle(PspCidTable, &CidEntry);
|
Process->UniqueProcessId = ExCreateHandle(PspCidTable, &CidEntry);
|
||||||
if (!Process->UniqueProcessId)
|
if (!Process->UniqueProcessId)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to create CID handle\n");
|
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
goto CleanupWithRef;
|
goto CleanupWithRef;
|
||||||
}
|
}
|
||||||
|
@ -566,11 +520,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
if (Parent)
|
if (Parent)
|
||||||
{
|
{
|
||||||
Status = MmCreatePeb(Process);
|
Status = MmCreatePeb(Process);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
|
||||||
{
|
|
||||||
DPRINT("NtCreateProcess() Peb creation failed: Status %x\n",Status);
|
|
||||||
goto CleanupWithRef;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The process can now be activated */
|
/* The process can now be activated */
|
||||||
|
@ -587,6 +537,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
1,
|
1,
|
||||||
(PVOID*)&Process,
|
(PVOID*)&Process,
|
||||||
&hProcess);
|
&hProcess);
|
||||||
|
if (!NT_SUCCESS(Status)) goto Cleanup;
|
||||||
|
|
||||||
/* FIXME: Compute Quantum and Priority */
|
/* FIXME: Compute Quantum and Priority */
|
||||||
|
|
||||||
|
@ -594,14 +545,16 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
* FIXME: ObGetObjectSecurity(Process, &SecurityDescriptor)
|
* FIXME: ObGetObjectSecurity(Process, &SecurityDescriptor)
|
||||||
* SeAccessCheck
|
* SeAccessCheck
|
||||||
*/
|
*/
|
||||||
ObReferenceObject(Process); // <- Act as if we called ObGetObjectSecurity
|
|
||||||
|
|
||||||
/* Check for success */
|
/* Sanity check */
|
||||||
if (NT_SUCCESS(Status))
|
ASSERT(IsListEmpty(&Process->ThreadListHead));
|
||||||
{
|
|
||||||
/* Set the Creation Time */
|
/* Set the Creation Time */
|
||||||
KeQuerySystemTime(&Process->CreateTime);
|
KeQuerySystemTime(&Process->CreateTime);
|
||||||
|
|
||||||
|
/* Set the granted access */
|
||||||
|
Process->GrantedAccess = PROCESS_ALL_ACCESS;
|
||||||
|
|
||||||
/* Protect against bad user-mode pointer */
|
/* Protect against bad user-mode pointer */
|
||||||
_SEH_TRY
|
_SEH_TRY
|
||||||
{
|
{
|
||||||
|
@ -610,16 +563,16 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
}
|
}
|
||||||
_SEH_HANDLE
|
_SEH_HANDLE
|
||||||
{
|
{
|
||||||
|
/* Get the exception code */
|
||||||
Status = _SEH_GetExceptionCode();
|
Status = _SEH_GetExceptionCode();
|
||||||
}
|
}
|
||||||
_SEH_END;
|
_SEH_END;
|
||||||
}
|
|
||||||
|
|
||||||
CleanupWithRef:
|
CleanupWithRef:
|
||||||
/*
|
/*
|
||||||
* Dereference the process. For failures, kills the process and does
|
* Dereference the process. For failures, kills the process and does
|
||||||
* cleanup present in PspDeleteProcess. For success, kills the extra
|
* cleanup present in PspDeleteProcess. For success, kills the extra
|
||||||
* reference added by ObGetObjectSecurity
|
* reference added by ObInsertObject.
|
||||||
*/
|
*/
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
|
|
||||||
|
@ -638,10 +591,11 @@ Cleanup:
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
PsCreateSystemProcess(PHANDLE ProcessHandle,
|
PsCreateSystemProcess(OUT PHANDLE ProcessHandle,
|
||||||
ACCESS_MASK DesiredAccess,
|
IN ACCESS_MASK DesiredAccess,
|
||||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
||||||
{
|
{
|
||||||
|
/* Call the internal API */
|
||||||
return PspCreateProcess(ProcessHandle,
|
return PspCreateProcess(ProcessHandle,
|
||||||
DesiredAccess,
|
DesiredAccess,
|
||||||
ObjectAttributes,
|
ObjectAttributes,
|
||||||
|
@ -668,8 +622,8 @@ PsLookupProcessByProcessId(IN HANDLE ProcessId,
|
||||||
KeEnterCriticalRegion();
|
KeEnterCriticalRegion();
|
||||||
|
|
||||||
/* Get the CID Handle Entry */
|
/* Get the CID Handle Entry */
|
||||||
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
|
CidEntry = ExMapHandleToPointer(PspCidTable, ProcessId);
|
||||||
ProcessId)))
|
if (CidEntry)
|
||||||
{
|
{
|
||||||
/* Get the Process */
|
/* Get the Process */
|
||||||
FoundProcess = CidEntry->Object;
|
FoundProcess = CidEntry->Object;
|
||||||
|
@ -677,7 +631,7 @@ PsLookupProcessByProcessId(IN HANDLE ProcessId,
|
||||||
/* Make sure it's really a process */
|
/* Make sure it's really a process */
|
||||||
if (FoundProcess->Pcb.Header.Type == ProcessObject)
|
if (FoundProcess->Pcb.Header.Type == ProcessObject)
|
||||||
{
|
{
|
||||||
/* Reference and return it */
|
/* FIXME: Safe Reference and return it */
|
||||||
ObReferenceObject(FoundProcess);
|
ObReferenceObject(FoundProcess);
|
||||||
*Process = FoundProcess;
|
*Process = FoundProcess;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -708,8 +662,8 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
||||||
KeEnterCriticalRegion();
|
KeEnterCriticalRegion();
|
||||||
|
|
||||||
/* Get the CID Handle Entry */
|
/* Get the CID Handle Entry */
|
||||||
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
|
CidEntry = ExMapHandleToPointer(PspCidTable, Cid->UniqueThread);
|
||||||
Cid->UniqueThread)))
|
if (CidEntry)
|
||||||
{
|
{
|
||||||
/* Get the Process */
|
/* Get the Process */
|
||||||
FoundThread = CidEntry->Object;
|
FoundThread = CidEntry->Object;
|
||||||
|
@ -718,7 +672,7 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
||||||
if ((FoundThread->Tcb.DispatcherHeader.Type == ThreadObject) &&
|
if ((FoundThread->Tcb.DispatcherHeader.Type == ThreadObject) &&
|
||||||
(FoundThread->Cid.UniqueProcess == Cid->UniqueProcess))
|
(FoundThread->Cid.UniqueProcess == Cid->UniqueProcess))
|
||||||
{
|
{
|
||||||
/* Reference and return it */
|
/* FIXME: Safe Reference and return it */
|
||||||
ObReferenceObject(FoundThread);
|
ObReferenceObject(FoundThread);
|
||||||
*Thread = FoundThread;
|
*Thread = FoundThread;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -742,33 +696,13 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Returns a pointer to the current process
|
|
||||||
*
|
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
PEPROCESS STDCALL
|
LARGE_INTEGER
|
||||||
IoGetCurrentProcess(VOID)
|
NTAPI
|
||||||
{
|
|
||||||
if (PsGetCurrentThread() == NULL ||
|
|
||||||
PsGetCurrentThread()->Tcb.ApcState.Process == NULL)
|
|
||||||
{
|
|
||||||
return(PsInitialSystemProcess);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return(PEPROCESS)(PsGetCurrentThread()->Tcb.ApcState.Process);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
LARGE_INTEGER STDCALL
|
|
||||||
PsGetProcessExitTime(VOID)
|
PsGetProcessExitTime(VOID)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER Li;
|
return PsGetCurrentProcess()->ExitTime;
|
||||||
Li.QuadPart = PsGetCurrentProcess()->ExitTime.QuadPart;
|
|
||||||
return Li;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -920,16 +854,12 @@ PsGetProcessSessionId(PEPROCESS Process)
|
||||||
return (HANDLE)Process->Session;
|
return (HANDLE)Process->Session;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct _W32THREAD*
|
/*
|
||||||
STDCALL
|
* @implemented
|
||||||
PsGetWin32Thread(VOID)
|
*/
|
||||||
{
|
|
||||||
return(PsGetCurrentThread()->Tcb.Win32Thread);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct _W32PROCESS*
|
struct _W32PROCESS*
|
||||||
STDCALL
|
NTAPI
|
||||||
PsGetWin32Process(VOID)
|
PsGetCurrentProcessWin32Process(VOID)
|
||||||
{
|
{
|
||||||
return (struct _W32PROCESS*)PsGetCurrentProcess()->Win32Process;
|
return (struct _W32PROCESS*)PsGetCurrentProcess()->Win32Process;
|
||||||
}
|
}
|
||||||
|
@ -961,7 +891,7 @@ BOOLEAN
|
||||||
STDCALL
|
STDCALL
|
||||||
PsIsProcessBeingDebugged(PEPROCESS Process)
|
PsIsProcessBeingDebugged(PEPROCESS Process)
|
||||||
{
|
{
|
||||||
return FALSE; //Process->IsProcessBeingDebugged;
|
return Process->DebugPort != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1037,22 +967,22 @@ NtCreateProcessEx(OUT PHANDLE ProcessHandle,
|
||||||
{
|
{
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Check parameters */
|
/* Check if we came from user mode */
|
||||||
if(PreviousMode != KernelMode)
|
if(PreviousMode != KernelMode)
|
||||||
{
|
{
|
||||||
_SEH_TRY
|
_SEH_TRY
|
||||||
{
|
{
|
||||||
|
/* Probe process handle */
|
||||||
ProbeForWriteHandle(ProcessHandle);
|
ProbeForWriteHandle(ProcessHandle);
|
||||||
}
|
}
|
||||||
_SEH_HANDLE
|
_SEH_HANDLE
|
||||||
{
|
{
|
||||||
|
/* Get exception code */
|
||||||
Status = _SEH_GetExceptionCode();
|
Status = _SEH_GetExceptionCode();
|
||||||
}
|
}
|
||||||
_SEH_END;
|
_SEH_END;
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1123,7 +1053,7 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
|
||||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||||
IN PCLIENT_ID ClientId)
|
IN PCLIENT_ID ClientId)
|
||||||
{
|
{
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode = KeGetPreviousMode();
|
||||||
CLIENT_ID SafeClientId;
|
CLIENT_ID SafeClientId;
|
||||||
ULONG Attributes = 0;
|
ULONG Attributes = 0;
|
||||||
HANDLE hProcess;
|
HANDLE hProcess;
|
||||||
|
@ -1131,30 +1061,32 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
|
||||||
PETHREAD Thread = NULL;
|
PETHREAD Thread = NULL;
|
||||||
PEPROCESS Process = NULL;
|
PEPROCESS Process = NULL;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
ACCESS_STATE AccessState;
|
||||||
|
AUX_DATA AuxData;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = KeGetPreviousMode();
|
/* Check if we were called from user mode */
|
||||||
|
|
||||||
/* Probe the paraemeters */
|
|
||||||
if (PreviousMode != KernelMode)
|
if (PreviousMode != KernelMode)
|
||||||
{
|
{
|
||||||
|
/* Enter SEH for probing */
|
||||||
_SEH_TRY
|
_SEH_TRY
|
||||||
{
|
{
|
||||||
|
/* Probe the thread handle */
|
||||||
ProbeForWriteHandle(ProcessHandle);
|
ProbeForWriteHandle(ProcessHandle);
|
||||||
|
|
||||||
if(ClientId != NULL)
|
/* Check for a CID structure */
|
||||||
|
if (ClientId)
|
||||||
{
|
{
|
||||||
ProbeForRead(ClientId,
|
/* Probe and capture it */
|
||||||
sizeof(CLIENT_ID),
|
ProbeForRead(ClientId, sizeof(CLIENT_ID), sizeof(ULONG));
|
||||||
sizeof(ULONG));
|
|
||||||
|
|
||||||
SafeClientId = *ClientId;
|
SafeClientId = *ClientId;
|
||||||
ClientId = &SafeClientId;
|
ClientId = &SafeClientId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* just probe the object attributes structure, don't capture it
|
/*
|
||||||
completely. This is done later if necessary */
|
* Just probe the object attributes structure, don't capture it
|
||||||
|
* completely. This is done later if necessary
|
||||||
|
*/
|
||||||
ProbeForRead(ObjectAttributes,
|
ProbeForRead(ObjectAttributes,
|
||||||
sizeof(OBJECT_ATTRIBUTES),
|
sizeof(OBJECT_ATTRIBUTES),
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
|
@ -1163,22 +1095,47 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
|
||||||
}
|
}
|
||||||
_SEH_HANDLE
|
_SEH_HANDLE
|
||||||
{
|
{
|
||||||
|
/* Get the exception code */
|
||||||
Status = _SEH_GetExceptionCode();
|
Status = _SEH_GetExceptionCode();
|
||||||
}
|
}
|
||||||
_SEH_END;
|
_SEH_END;
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Otherwise just get the data directly */
|
||||||
HasObjectName = (ObjectAttributes->ObjectName != NULL);
|
HasObjectName = (ObjectAttributes->ObjectName != NULL);
|
||||||
Attributes = ObjectAttributes->Attributes;
|
Attributes = ObjectAttributes->Attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasObjectName && ClientId != NULL)
|
/* Can't pass both, fail */
|
||||||
|
if ((HasObjectName) && (ClientId)) return STATUS_INVALID_PARAMETER_MIX;
|
||||||
|
|
||||||
|
/* Create an access state */
|
||||||
|
Status = SeCreateAccessState(&AccessState,
|
||||||
|
&AuxData,
|
||||||
|
DesiredAccess,
|
||||||
|
&PsProcessType->TypeInfo.GenericMapping);
|
||||||
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
|
/* Check if this is a debugger */
|
||||||
|
if (SeSinglePrivilegeCheck(SeDebugPrivilege, PreviousMode))
|
||||||
{
|
{
|
||||||
/* can't pass both, n object name and a client id */
|
/* Did he want full access? */
|
||||||
return STATUS_INVALID_PARAMETER_MIX;
|
if (AccessState.RemainingDesiredAccess & MAXIMUM_ALLOWED)
|
||||||
|
{
|
||||||
|
/* Give it to him */
|
||||||
|
AccessState.PreviouslyGrantedAccess |= PROCESS_ALL_ACCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Otherwise just give every other access he could want */
|
||||||
|
AccessState.PreviouslyGrantedAccess |=
|
||||||
|
AccessState.RemainingDesiredAccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The caller desires nothing else now */
|
||||||
|
AccessState.RemainingDesiredAccess = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open by name if one was given */
|
/* Open by name if one was given */
|
||||||
|
@ -1188,25 +1145,21 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
|
||||||
Status = ObOpenObjectByName(ObjectAttributes,
|
Status = ObOpenObjectByName(ObjectAttributes,
|
||||||
PsProcessType,
|
PsProcessType,
|
||||||
PreviousMode,
|
PreviousMode,
|
||||||
NULL,
|
&AccessState,
|
||||||
DesiredAccess,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
&hProcess);
|
&hProcess);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
/* Get rid of the access state */
|
||||||
{
|
SeDeleteAccessState(&AccessState);
|
||||||
DPRINT1("Could not open object by name\n");
|
|
||||||
}
|
}
|
||||||
}
|
else if (ClientId)
|
||||||
else if (ClientId != NULL)
|
|
||||||
{
|
{
|
||||||
/* Open by Thread ID */
|
/* Open by Thread ID */
|
||||||
if (ClientId->UniqueThread)
|
if (ClientId->UniqueThread)
|
||||||
{
|
{
|
||||||
/* Get the Process */
|
/* Get the Process */
|
||||||
Status = PsLookupProcessThreadByCid(ClientId,
|
Status = PsLookupProcessThreadByCid(ClientId, &Process, &Thread);
|
||||||
&Process,
|
|
||||||
&Thread);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1215,24 +1168,25 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
|
||||||
&Process);
|
&Process);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if we didn't find anything */
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failure to find process\n");
|
/* Get rid of the access state and return */
|
||||||
|
SeDeleteAccessState(&AccessState);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the Process Object */
|
/* Open the Process Object */
|
||||||
Status = ObOpenObjectByPointer(Process,
|
Status = ObOpenObjectByPointer(Process,
|
||||||
Attributes,
|
Attributes,
|
||||||
NULL,
|
&AccessState,
|
||||||
DesiredAccess,
|
0,
|
||||||
PsProcessType,
|
PsProcessType,
|
||||||
PreviousMode,
|
PreviousMode,
|
||||||
&hProcess);
|
&hProcess);
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
/* Delete the access state */
|
||||||
DPRINT1("Failure to open process\n");
|
SeDeleteAccessState(&AccessState);
|
||||||
}
|
|
||||||
|
|
||||||
/* Dereference the thread if we used it */
|
/* Dereference the thread if we used it */
|
||||||
if (Thread) ObDereferenceObject(Thread);
|
if (Thread) ObDereferenceObject(Thread);
|
||||||
|
@ -1246,20 +1200,24 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
|
||||||
return STATUS_INVALID_PARAMETER_MIX;
|
return STATUS_INVALID_PARAMETER_MIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write back the handle */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
/* Use SEH for write back */
|
||||||
_SEH_TRY
|
_SEH_TRY
|
||||||
{
|
{
|
||||||
|
/* Write back the handle */
|
||||||
*ProcessHandle = hProcess;
|
*ProcessHandle = hProcess;
|
||||||
}
|
}
|
||||||
_SEH_HANDLE
|
_SEH_HANDLE
|
||||||
{
|
{
|
||||||
|
/* Get the exception code */
|
||||||
Status = _SEH_GetExceptionCode();
|
Status = _SEH_GetExceptionCode();
|
||||||
}
|
}
|
||||||
_SEH_END;
|
_SEH_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -615,6 +615,16 @@ PsSetThreadHardErrorsAreDisabled(IN PETHREAD Thread,
|
||||||
Thread->HardErrorsAreDisabled = HardErrorsAreDisabled;
|
Thread->HardErrorsAreDisabled = HardErrorsAreDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
struct _W32THREAD*
|
||||||
|
NTAPI
|
||||||
|
PsGetCurrentThreadWin32Thread(VOID)
|
||||||
|
{
|
||||||
|
return PsGetCurrentThread()->Tcb.Win32Thread;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -44,16 +44,16 @@ IntEngCleanupDriverObjs(struct _EPROCESS *Process,
|
||||||
{
|
{
|
||||||
PDRIVERGDI DrvObjInt;
|
PDRIVERGDI DrvObjInt;
|
||||||
|
|
||||||
IntEngLockProcessDriverObjs(PsGetWin32Process());
|
IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
|
||||||
while (!IsListEmpty(&Win32Process->DriverObjListHead))
|
while (!IsListEmpty(&Win32Process->DriverObjListHead))
|
||||||
{
|
{
|
||||||
DrvObjInt = CONTAINING_RECORD(Win32Process->DriverObjListHead.Flink,
|
DrvObjInt = CONTAINING_RECORD(Win32Process->DriverObjListHead.Flink,
|
||||||
DRIVERGDI, ListEntry);
|
DRIVERGDI, ListEntry);
|
||||||
IntEngUnLockProcessDriverObjs(PsGetWin32Process());
|
IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
|
||||||
EngDeleteDriverObj((HDRVOBJ)(&DrvObjInt->DriverObj), TRUE, FALSE);
|
EngDeleteDriverObj((HDRVOBJ)(&DrvObjInt->DriverObj), TRUE, FALSE);
|
||||||
IntEngLockProcessDriverObjs(PsGetWin32Process());
|
IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
|
||||||
}
|
}
|
||||||
IntEngUnLockProcessDriverObjs(PsGetWin32Process());
|
IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,9 +88,9 @@ EngCreateDriverObj(
|
||||||
|
|
||||||
/* fill internal object */
|
/* fill internal object */
|
||||||
ExInitializeFastMutex(&DrvObjInt->Lock);
|
ExInitializeFastMutex(&DrvObjInt->Lock);
|
||||||
IntEngLockProcessDriverObjs(PsGetWin32Process());
|
IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
|
||||||
InsertTailList(&PsGetWin32Process()->DriverObjListHead, &DrvObjInt->ListEntry);
|
InsertTailList(&PsGetCurrentProcessWin32Process()->DriverObjListHead, &DrvObjInt->ListEntry);
|
||||||
IntEngUnLockProcessDriverObjs(PsGetWin32Process());
|
IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
|
||||||
|
|
||||||
return (HDRVOBJ)DrvObjUser;
|
return (HDRVOBJ)DrvObjUser;
|
||||||
}
|
}
|
||||||
|
@ -129,9 +129,9 @@ EngDeleteDriverObj(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the DRIVEROBJ */
|
/* Free the DRIVEROBJ */
|
||||||
IntEngLockProcessDriverObjs(PsGetWin32Process());
|
IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
|
||||||
RemoveEntryList(&DrvObjInt->ListEntry);
|
RemoveEntryList(&DrvObjInt->ListEntry);
|
||||||
IntEngUnLockProcessDriverObjs(PsGetWin32Process());
|
IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
|
||||||
EngFreeMem(DrvObjInt);
|
EngFreeMem(DrvObjInt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -200,10 +200,10 @@ DesktopHeapGetUserDelta(VOID)
|
||||||
HANDLE hDesktopHeap;
|
HANDLE hDesktopHeap;
|
||||||
ULONG_PTR Delta = 0;
|
ULONG_PTR Delta = 0;
|
||||||
|
|
||||||
ASSERT(PsGetWin32Thread()->Desktop != NULL);
|
ASSERT(PsGetCurrentThreadWin32Thread()->Desktop != NULL);
|
||||||
hDesktopHeap = PsGetWin32Thread()->Desktop->hDesktopHeap;
|
hDesktopHeap = PsGetCurrentThreadWin32Thread()->Desktop->hDesktopHeap;
|
||||||
|
|
||||||
Mapping = PsGetWin32Process()->HeapMappings.Next;
|
Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;
|
||||||
while (Mapping != NULL)
|
while (Mapping != NULL)
|
||||||
{
|
{
|
||||||
if (Mapping->UserMapping == (PVOID)hDesktopHeap)
|
if (Mapping->UserMapping == (PVOID)hDesktopHeap)
|
||||||
|
@ -224,7 +224,7 @@ DesktopHeapAddressToUser(IN PDESKTOP Desktop,
|
||||||
{
|
{
|
||||||
PW32HEAP_USER_MAPPING Mapping;
|
PW32HEAP_USER_MAPPING Mapping;
|
||||||
|
|
||||||
Mapping = PsGetWin32Process()->HeapMappings.Next;
|
Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;
|
||||||
while (Mapping != NULL)
|
while (Mapping != NULL)
|
||||||
{
|
{
|
||||||
if (Mapping->KernelMapping == (PVOID)Desktop->hKernelHeap)
|
if (Mapping->KernelMapping == (PVOID)Desktop->hKernelHeap)
|
||||||
|
|
|
@ -80,7 +80,7 @@ typedef struct _USER_REFERENCE_ENTRY
|
||||||
PUSER_REFERENCE_ENTRY ref; \
|
PUSER_REFERENCE_ENTRY ref; \
|
||||||
\
|
\
|
||||||
ASSERT(_obj_); \
|
ASSERT(_obj_); \
|
||||||
t = PsGetWin32Thread(); \
|
t = PsGetCurrentThreadWin32Thread(); \
|
||||||
ASSERT(t); \
|
ASSERT(t); \
|
||||||
e = t->ReferencesList.Next; \
|
e = t->ReferencesList.Next; \
|
||||||
ASSERT(e); \
|
ASSERT(e); \
|
||||||
|
@ -95,7 +95,7 @@ typedef struct _USER_REFERENCE_ENTRY
|
||||||
PW32THREAD t; \
|
PW32THREAD t; \
|
||||||
\
|
\
|
||||||
ASSERT(_obj_); \
|
ASSERT(_obj_); \
|
||||||
t = PsGetWin32Thread(); \
|
t = PsGetCurrentThreadWin32Thread(); \
|
||||||
ASSERT(t); \
|
ASSERT(t); \
|
||||||
ASSERT(_ref_); \
|
ASSERT(_ref_); \
|
||||||
(_ref_)->obj = _obj_; \
|
(_ref_)->obj = _obj_; \
|
||||||
|
@ -113,7 +113,7 @@ typedef struct _USER_REFERENCE_ENTRY
|
||||||
PUSER_REFERENCE_ENTRY ref; \
|
PUSER_REFERENCE_ENTRY ref; \
|
||||||
\
|
\
|
||||||
ASSERT(_obj_); \
|
ASSERT(_obj_); \
|
||||||
t = PsGetWin32Thread(); \
|
t = PsGetCurrentThreadWin32Thread(); \
|
||||||
ASSERT(t); \
|
ASSERT(t); \
|
||||||
e = PopEntryList(&t->ReferencesList); \
|
e = PopEntryList(&t->ReferencesList); \
|
||||||
ASSERT(e); \
|
ASSERT(e); \
|
||||||
|
|
|
@ -43,7 +43,7 @@ PMENU_OBJECT FASTCALL UserGetMenuObject(HMENU hMenu);
|
||||||
ASSERT(FALSE); \
|
ASSERT(FALSE); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
e = PsGetWin32Thread()->ReferencesList.Next; \
|
e = PsGetCurrentThreadWin32Thread()->ReferencesList.Next; \
|
||||||
while (e) \
|
while (e) \
|
||||||
{ \
|
{ \
|
||||||
PUSER_REFERENCE_ENTRY ref = CONTAINING_RECORD(e, USER_REFERENCE_ENTRY, Entry); \
|
PUSER_REFERENCE_ENTRY ref = CONTAINING_RECORD(e, USER_REFERENCE_ENTRY, Entry); \
|
||||||
|
|
|
@ -34,7 +34,7 @@ IntUserHeapCommitRoutine(IN PVOID Base,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
SIZE_T Delta = (SIZE_T)((ULONG_PTR)(*CommitAddress) - (ULONG_PTR)Base);
|
SIZE_T Delta = (SIZE_T)((ULONG_PTR)(*CommitAddress) - (ULONG_PTR)Base);
|
||||||
|
|
||||||
W32Process = PsGetWin32Process();
|
W32Process = PsGetCurrentProcessWin32Process();
|
||||||
|
|
||||||
if (W32Process != NULL)
|
if (W32Process != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,7 @@ IntCbAllocateMemory(ULONG Size)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
W32Thread = PsGetWin32Thread();
|
W32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
ASSERT(W32Thread);
|
ASSERT(W32Thread);
|
||||||
|
|
||||||
/* insert the callback memory into the thread's callback list */
|
/* insert the callback memory into the thread's callback list */
|
||||||
|
@ -79,7 +79,7 @@ IntCbFreeMemory(PVOID Data)
|
||||||
|
|
||||||
Mem = ((PINT_CALLBACK_HEADER)Data - 1);
|
Mem = ((PINT_CALLBACK_HEADER)Data - 1);
|
||||||
|
|
||||||
W32Thread = PsGetWin32Thread();
|
W32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
ASSERT(W32Thread);
|
ASSERT(W32Thread);
|
||||||
|
|
||||||
/* remove the memory block from the thread's callback list */
|
/* remove the memory block from the thread's callback list */
|
||||||
|
|
|
@ -61,7 +61,7 @@ BOOL FASTCALL
|
||||||
IntSetCaretBlinkTime(UINT uMSeconds)
|
IntSetCaretBlinkTime(UINT uMSeconds)
|
||||||
{
|
{
|
||||||
/* Don't save the new value to the registry! */
|
/* Don't save the new value to the registry! */
|
||||||
PWINSTATION_OBJECT WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
PWINSTATION_OBJECT WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
|
||||||
|
|
||||||
/* windows doesn't do this check */
|
/* windows doesn't do this check */
|
||||||
if((uMSeconds < MIN_CARETBLINKRATE) || (uMSeconds > MAX_CARETBLINKRATE))
|
if((uMSeconds < MIN_CARETBLINKRATE) || (uMSeconds > MAX_CARETBLINKRATE))
|
||||||
|
@ -149,7 +149,7 @@ IntGetCaretBlinkTime(VOID)
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
UINT Ret;
|
UINT Ret;
|
||||||
|
|
||||||
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
|
||||||
|
|
||||||
Ret = WinStaObject->CaretBlinkRate;
|
Ret = WinStaObject->CaretBlinkRate;
|
||||||
if(!Ret)
|
if(!Ret)
|
||||||
|
@ -172,7 +172,7 @@ BOOL FASTCALL
|
||||||
co_IntSetCaretPos(int X, int Y)
|
co_IntSetCaretPos(int X, int Y)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if(ThreadQueue->CaretInfo->hWnd)
|
if(ThreadQueue->CaretInfo->hWnd)
|
||||||
{
|
{
|
||||||
|
@ -195,7 +195,7 @@ BOOL FASTCALL
|
||||||
IntSwitchCaretShowing(PVOID Info)
|
IntSwitchCaretShowing(PVOID Info)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if(ThreadQueue->CaretInfo->hWnd)
|
if(ThreadQueue->CaretInfo->hWnd)
|
||||||
{
|
{
|
||||||
|
@ -213,7 +213,7 @@ VOID FASTCALL
|
||||||
co_IntDrawCaret(HWND hWnd)
|
co_IntDrawCaret(HWND hWnd)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if(ThreadQueue->CaretInfo->hWnd && ThreadQueue->CaretInfo->Visible &&
|
if(ThreadQueue->CaretInfo->hWnd && ThreadQueue->CaretInfo->Visible &&
|
||||||
ThreadQueue->CaretInfo->Showing)
|
ThreadQueue->CaretInfo->Showing)
|
||||||
|
@ -238,7 +238,7 @@ BOOL FASTCALL co_UserHideCaret(PWINDOW_OBJECT Window OPTIONAL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if(Window && ThreadQueue->CaretInfo->hWnd != Window->hSelf)
|
if(Window && ThreadQueue->CaretInfo->hWnd != Window->hSelf)
|
||||||
{
|
{
|
||||||
|
@ -271,7 +271,7 @@ BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT Window OPTIONAL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if(Window && ThreadQueue->CaretInfo->hWnd != Window->hSelf)
|
if(Window && ThreadQueue->CaretInfo->hWnd != Window->hSelf)
|
||||||
{
|
{
|
||||||
|
@ -321,7 +321,7 @@ NtUserCreateCaret(
|
||||||
RETURN(FALSE);
|
RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if (ThreadQueue->CaretInfo->Visible)
|
if (ThreadQueue->CaretInfo->Visible)
|
||||||
{
|
{
|
||||||
|
@ -381,7 +381,7 @@ NtUserGetCaretPos(
|
||||||
DPRINT("Enter NtUserGetCaretPos\n");
|
DPRINT("Enter NtUserGetCaretPos\n");
|
||||||
UserEnterShared();
|
UserEnterShared();
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
Status = MmCopyToCaller(lpPoint, &(ThreadQueue->CaretInfo->Pos), sizeof(POINT));
|
Status = MmCopyToCaller(lpPoint, &(ThreadQueue->CaretInfo->Pos), sizeof(POINT));
|
||||||
if(!NT_SUCCESS(Status))
|
if(!NT_SUCCESS(Status))
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#define CHECK_LOCK \
|
#define CHECK_LOCK \
|
||||||
if (ClipboardThread && ClipboardThread != PsGetWin32Thread()) \
|
if (ClipboardThread && ClipboardThread != PsGetCurrentThreadWin32Thread()) \
|
||||||
{ \
|
{ \
|
||||||
SetLastWin32Error(ERROR_LOCKED); \
|
SetLastWin32Error(ERROR_LOCKED); \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
|
@ -68,7 +68,7 @@ NtUserOpenClipboard(HWND hWnd, DWORD Unknown1)
|
||||||
CHECK_LOCK
|
CHECK_LOCK
|
||||||
|
|
||||||
tempClipboardWindow = hWnd;
|
tempClipboardWindow = hWnd;
|
||||||
ClipboardThread = PsGetWin32Thread();
|
ClipboardThread = PsGetCurrentThreadWin32Thread();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -334,7 +334,7 @@ ReferenceCurIconByProcess(PCURICON_OBJECT CurIcon)
|
||||||
PW32PROCESS Win32Process;
|
PW32PROCESS Win32Process;
|
||||||
PCURICON_PROCESS Current;
|
PCURICON_PROCESS Current;
|
||||||
|
|
||||||
Win32Process = PsGetWin32Process();
|
Win32Process = PsGetCurrentProcessWin32Process();
|
||||||
|
|
||||||
LIST_FOR_EACH(Current, &CurIcon->ProcessList, CURICON_PROCESS, ListEntry)
|
LIST_FOR_EACH(Current, &CurIcon->ProcessList, CURICON_PROCESS, ListEntry)
|
||||||
{
|
{
|
||||||
|
@ -430,7 +430,7 @@ IntDestroyCurIconObject(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT CurIcon, BOOL
|
||||||
HBITMAP bmpMask, bmpColor;
|
HBITMAP bmpMask, bmpColor;
|
||||||
BOOLEAN Ret;
|
BOOLEAN Ret;
|
||||||
PCURICON_PROCESS Current = NULL;
|
PCURICON_PROCESS Current = NULL;
|
||||||
PW32PROCESS W32Process = PsGetWin32Process();
|
PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
|
||||||
|
|
||||||
/* Private objects can only be destroyed by their own process */
|
/* Private objects can only be destroyed by their own process */
|
||||||
if (NULL == CurIcon->hModule)
|
if (NULL == CurIcon->hModule)
|
||||||
|
|
|
@ -572,7 +572,7 @@ PWINDOW_OBJECT FASTCALL UserGetDesktopWindow(VOID)
|
||||||
|
|
||||||
HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID)
|
HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID)
|
||||||
{
|
{
|
||||||
PDESKTOP_OBJECT pdo = PsGetWin32Thread()->Desktop;
|
PDESKTOP_OBJECT pdo = PsGetCurrentThreadWin32Thread()->Desktop;
|
||||||
if (NULL == pdo)
|
if (NULL == pdo)
|
||||||
{
|
{
|
||||||
DPRINT1("Thread doesn't have a desktop\n");
|
DPRINT1("Thread doesn't have a desktop\n");
|
||||||
|
@ -753,7 +753,7 @@ VOID co_IntShellHookNotify(WPARAM Message, LPARAM lParam)
|
||||||
*/
|
*/
|
||||||
BOOL IntRegisterShellHookWindow(HWND hWnd)
|
BOOL IntRegisterShellHookWindow(HWND hWnd)
|
||||||
{
|
{
|
||||||
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
|
PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
|
||||||
PSHELL_HOOK_WINDOW Entry;
|
PSHELL_HOOK_WINDOW Entry;
|
||||||
|
|
||||||
DPRINT("IntRegisterShellHookWindow\n");
|
DPRINT("IntRegisterShellHookWindow\n");
|
||||||
|
@ -784,7 +784,7 @@ BOOL IntRegisterShellHookWindow(HWND hWnd)
|
||||||
*/
|
*/
|
||||||
BOOL IntDeRegisterShellHookWindow(HWND hWnd)
|
BOOL IntDeRegisterShellHookWindow(HWND hWnd)
|
||||||
{
|
{
|
||||||
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
|
PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
|
||||||
PSHELL_HOOK_WINDOW Current;
|
PSHELL_HOOK_WINDOW Current;
|
||||||
|
|
||||||
LIST_FOR_EACH(Current, &Desktop->ShellHookWindows, SHELL_HOOK_WINDOW, ListEntry)
|
LIST_FOR_EACH(Current, &Desktop->ShellHookWindows, SHELL_HOOK_WINDOW, ListEntry)
|
||||||
|
@ -1326,7 +1326,7 @@ NtUserPaintDesktop(HDC hDC)
|
||||||
COLORREF color_old;
|
COLORREF color_old;
|
||||||
UINT align_old;
|
UINT align_old;
|
||||||
int mode_old;
|
int mode_old;
|
||||||
PWINSTATION_OBJECT WinSta = PsGetWin32Thread()->Desktop->WindowStation;
|
PWINSTATION_OBJECT WinSta = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
|
||||||
DECLARE_RETURN(BOOL);
|
DECLARE_RETURN(BOOL);
|
||||||
|
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
@ -1557,7 +1557,7 @@ NtUserSwitchDesktop(HDESK hDesktop)
|
||||||
* is the logon application itself
|
* is the logon application itself
|
||||||
*/
|
*/
|
||||||
if((DesktopObject->WindowStation->Flags & WSS_LOCKED) &&
|
if((DesktopObject->WindowStation->Flags & WSS_LOCKED) &&
|
||||||
LogonProcess != NULL && LogonProcess != PsGetWin32Process())
|
LogonProcess != NULL && LogonProcess != PsGetCurrentProcessWin32Process())
|
||||||
{
|
{
|
||||||
ObDereferenceObject(DesktopObject);
|
ObDereferenceObject(DesktopObject);
|
||||||
DPRINT1("Switching desktop 0x%x denied because the work station is locked!\n", hDesktop);
|
DPRINT1("Switching desktop 0x%x denied because the work station is locked!\n", hDesktop);
|
||||||
|
@ -1691,7 +1691,7 @@ static NTSTATUS
|
||||||
IntUnmapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
|
IntUnmapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
|
||||||
{
|
{
|
||||||
PW32THREADINFO ti;
|
PW32THREADINFO ti;
|
||||||
PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetWin32Process()->HeapMappings.Next;
|
PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetCurrentProcessWin32Process()->HeapMappings.Next;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
/* unmap if we're the last thread using the desktop */
|
/* unmap if we're the last thread using the desktop */
|
||||||
|
@ -1735,7 +1735,7 @@ static NTSTATUS
|
||||||
IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
|
IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
|
||||||
{
|
{
|
||||||
PW32THREADINFO ti;
|
PW32THREADINFO ti;
|
||||||
PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetWin32Process()->HeapMappings.Next;
|
PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetCurrentProcessWin32Process()->HeapMappings.Next;
|
||||||
PVOID UserBase = NULL;
|
PVOID UserBase = NULL;
|
||||||
ULONG ViewSize = 0;
|
ULONG ViewSize = 0;
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
|
@ -1813,7 +1813,7 @@ IntSetThreadDesktop(IN PDESKTOP_OBJECT DesktopObject,
|
||||||
BOOL MapHeap;
|
BOOL MapHeap;
|
||||||
|
|
||||||
MapHeap = (PsGetCurrentProcess() != PsInitialSystemProcess);
|
MapHeap = (PsGetCurrentProcess() != PsInitialSystemProcess);
|
||||||
W32Thread = PsGetWin32Thread();
|
W32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
|
|
||||||
if (W32Thread->Desktop != DesktopObject)
|
if (W32Thread->Desktop != DesktopObject)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,7 @@ HWND FASTCALL
|
||||||
IntGetThreadFocusWindow()
|
IntGetThreadFocusWindow()
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
return ThreadQueue != NULL ? ThreadQueue->FocusWindow : 0;
|
return ThreadQueue != NULL ? ThreadQueue->FocusWindow : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ co_IntSetActiveWindow(PWINDOW_OBJECT Window OPTIONAL)
|
||||||
if (Window)
|
if (Window)
|
||||||
ASSERT_REFS_CO(Window);
|
ASSERT_REFS_CO(Window);
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
ASSERT(ThreadQueue != 0);
|
ASSERT(ThreadQueue != 0);
|
||||||
|
|
||||||
if (Window != 0)
|
if (Window != 0)
|
||||||
|
@ -307,7 +307,7 @@ co_IntSetFocusWindow(PWINDOW_OBJECT Window)
|
||||||
|
|
||||||
ASSERT_REFS_CO(Window);
|
ASSERT_REFS_CO(Window);
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
ASSERT(ThreadQueue != 0);
|
ASSERT(ThreadQueue != 0);
|
||||||
|
|
||||||
hWndPrev = ThreadQueue->FocusWindow;
|
hWndPrev = ThreadQueue->FocusWindow;
|
||||||
|
@ -361,7 +361,7 @@ CLEANUP:
|
||||||
HWND FASTCALL UserGetActiveWindow()
|
HWND FASTCALL UserGetActiveWindow()
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
return( ThreadQueue ? ThreadQueue->ActiveWindow : 0);
|
return( ThreadQueue ? ThreadQueue->ActiveWindow : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ NtUserSetActiveWindow(HWND hWnd)
|
||||||
|
|
||||||
DPRINT("(%wZ)\n", &Window->WindowName);
|
DPRINT("(%wZ)\n", &Window->WindowName);
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if (Window->MessageQueue != ThreadQueue)
|
if (Window->MessageQueue != ThreadQueue)
|
||||||
{
|
{
|
||||||
|
@ -444,7 +444,7 @@ NtUserGetCapture(VOID)
|
||||||
DPRINT("Enter NtUserGetCapture\n");
|
DPRINT("Enter NtUserGetCapture\n");
|
||||||
UserEnterShared();
|
UserEnterShared();
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
RETURN( ThreadQueue ? ThreadQueue->CaptureWindow : 0);
|
RETURN( ThreadQueue ? ThreadQueue->CaptureWindow : 0);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
|
@ -467,7 +467,7 @@ NtUserSetCapture(HWND hWnd)
|
||||||
DPRINT("Enter NtUserSetCapture(%x)\n", hWnd);
|
DPRINT("Enter NtUserSetCapture(%x)\n", hWnd);
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if((Window = UserGetWindowObject(hWnd)))
|
if((Window = UserGetWindowObject(hWnd)))
|
||||||
{
|
{
|
||||||
|
@ -510,7 +510,7 @@ HWND FASTCALL co_UserSetFocus(PWINDOW_OBJECT Window OPTIONAL)
|
||||||
|
|
||||||
ASSERT_REFS_CO(Window);
|
ASSERT_REFS_CO(Window);
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if (Window->Style & (WS_MINIMIZE | WS_DISABLED))
|
if (Window->Style & (WS_MINIMIZE | WS_DISABLED))
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,7 +79,7 @@ co_IntGraphicsCheck(BOOL Create)
|
||||||
{
|
{
|
||||||
PW32PROCESS W32Data;
|
PW32PROCESS W32Data;
|
||||||
|
|
||||||
W32Data = PsGetWin32Process();
|
W32Data = PsGetCurrentProcessWin32Process();
|
||||||
if (Create)
|
if (Create)
|
||||||
{
|
{
|
||||||
if (! (W32Data->Flags & W32PF_CREATEDWINORDC) && ! (W32Data->Flags & W32PF_MANUALGUICHECK))
|
if (! (W32Data->Flags & W32PF_CREATEDWINORDC) && ! (W32Data->Flags & W32PF_MANUALGUICHECK))
|
||||||
|
@ -106,7 +106,7 @@ NtUserManualGuiCheck(LONG Check)
|
||||||
DPRINT("Enter NtUserManualGuiCheck\n");
|
DPRINT("Enter NtUserManualGuiCheck\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
W32Data = PsGetWin32Process();
|
W32Data = PsGetCurrentProcessWin32Process();
|
||||||
if (0 == Check)
|
if (0 == Check)
|
||||||
{
|
{
|
||||||
W32Data->Flags |= W32PF_MANUALGUICHECK;
|
W32Data->Flags |= W32PF_MANUALGUICHECK;
|
||||||
|
|
|
@ -290,7 +290,7 @@ co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
|
ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
|
||||||
|
|
||||||
Win32Thread = PsGetWin32Thread();
|
Win32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
if (NULL == Win32Thread)
|
if (NULL == Win32Thread)
|
||||||
{
|
{
|
||||||
Table = NULL;
|
Table = NULL;
|
||||||
|
@ -343,7 +343,7 @@ co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IntReleaseHookChain(MsqGetHooks(PsGetWin32Thread()->MessageQueue), HookId, WinStaObj);
|
IntReleaseHookChain(MsqGetHooks(PsGetCurrentThreadWin32Thread()->MessageQueue), HookId, WinStaObj);
|
||||||
IntReleaseHookChain(GlobalHooks, HookId, WinStaObj);
|
IntReleaseHookChain(GlobalHooks, HookId, WinStaObj);
|
||||||
ObDereferenceObject(WinStaObj);
|
ObDereferenceObject(WinStaObj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1003,7 +1003,7 @@ NtUserBlockInput(
|
||||||
DPRINT("Enter NtUserBlockInput\n");
|
DPRINT("Enter NtUserBlockInput\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
RETURN( IntBlockInput(PsGetWin32Thread(), BlockIt));
|
RETURN( IntBlockInput(PsGetCurrentThreadWin32Thread(), BlockIt));
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserBlockInput, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserBlockInput, ret=%i\n",_ret_);
|
||||||
|
@ -1062,7 +1062,7 @@ IntMouseInput(MOUSEINPUT *mi)
|
||||||
ASSERT(mi);
|
ASSERT(mi);
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
WinSta = PsGetWin32Process()->WindowStation;
|
WinSta = PsGetCurrentProcessWin32Process()->WindowStation;
|
||||||
#else
|
#else
|
||||||
/* FIXME - ugly hack but as long as we're using this dumb callback from the
|
/* FIXME - ugly hack but as long as we're using this dumb callback from the
|
||||||
mouse class driver, we can't access the window station from the calling
|
mouse class driver, we can't access the window station from the calling
|
||||||
|
@ -1288,7 +1288,7 @@ NtUserSendInput(
|
||||||
DPRINT("Enter NtUserSendInput\n");
|
DPRINT("Enter NtUserSendInput\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
W32Thread = PsGetWin32Thread();
|
W32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
ASSERT(W32Thread);
|
ASSERT(W32Thread);
|
||||||
|
|
||||||
if(!W32Thread->Desktop)
|
if(!W32Thread->Desktop)
|
||||||
|
|
|
@ -430,8 +430,8 @@ int STDCALL ToUnicodeEx( UINT wVirtKey,
|
||||||
pwszBuff,
|
pwszBuff,
|
||||||
cchBuff,
|
cchBuff,
|
||||||
wFlags,
|
wFlags,
|
||||||
PsGetWin32Thread() ?
|
PsGetCurrentThreadWin32Thread() ?
|
||||||
PsGetWin32Thread()->KeyboardLayout : 0 );
|
PsGetCurrentThreadWin32Thread()->KeyboardLayout : 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ToUnicodeResult;
|
return ToUnicodeResult;
|
||||||
|
@ -716,7 +716,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
|
||||||
DWORD ScanCode = 0;
|
DWORD ScanCode = 0;
|
||||||
|
|
||||||
|
|
||||||
keyLayout = PsGetWin32Thread()->KeyboardLayout;
|
keyLayout = PsGetCurrentThreadWin32Thread()->KeyboardLayout;
|
||||||
if( !keyLayout )
|
if( !keyLayout )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
|
||||||
ScanCode = (lpMsg->lParam >> 16) & 0xff;
|
ScanCode = (lpMsg->lParam >> 16) & 0xff;
|
||||||
|
|
||||||
/* All messages have to contain the cursor point. */
|
/* All messages have to contain the cursor point. */
|
||||||
IntGetCursorLocation(PsGetWin32Thread()->Desktop->WindowStation,
|
IntGetCursorLocation(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
|
||||||
&NewMsg.pt);
|
&NewMsg.pt);
|
||||||
|
|
||||||
UState = ToUnicodeInner(lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff,
|
UState = ToUnicodeInner(lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff,
|
||||||
|
@ -763,14 +763,14 @@ IntTranslateKbdMessage(LPMSG lpMsg,
|
||||||
NewMsg.wParam = dead_char;
|
NewMsg.wParam = dead_char;
|
||||||
NewMsg.lParam = lpMsg->lParam;
|
NewMsg.lParam = lpMsg->lParam;
|
||||||
dead_char = 0;
|
dead_char = 0;
|
||||||
MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
|
MsqPostMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
NewMsg.hwnd = lpMsg->hwnd;
|
NewMsg.hwnd = lpMsg->hwnd;
|
||||||
NewMsg.wParam = wp[0];
|
NewMsg.wParam = wp[0];
|
||||||
NewMsg.lParam = lpMsg->lParam;
|
NewMsg.lParam = lpMsg->lParam;
|
||||||
DPRINT( "CHAR='%c' %04x %08x\n", wp[0], wp[0], lpMsg->lParam );
|
DPRINT( "CHAR='%c' %04x %08x\n", wp[0], wp[0], lpMsg->lParam );
|
||||||
MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
|
MsqPostMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
|
||||||
Result = TRUE;
|
Result = TRUE;
|
||||||
}
|
}
|
||||||
else if (UState == -1)
|
else if (UState == -1)
|
||||||
|
@ -781,7 +781,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
|
||||||
NewMsg.wParam = wp[0];
|
NewMsg.wParam = wp[0];
|
||||||
NewMsg.lParam = lpMsg->lParam;
|
NewMsg.lParam = lpMsg->lParam;
|
||||||
dead_char = wp[0];
|
dead_char = wp[0];
|
||||||
MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
|
MsqPostMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
|
||||||
Result = TRUE;
|
Result = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,7 +957,7 @@ NtUserMapVirtualKeyEx( UINT Code, UINT Type, DWORD keyboardId, HKL dwhkl )
|
||||||
DPRINT("Enter NtUserMapVirtualKeyEx\n");
|
DPRINT("Enter NtUserMapVirtualKeyEx\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
keyLayout = PsGetWin32Thread() ? PsGetWin32Thread()->KeyboardLayout : 0;
|
keyLayout = PsGetCurrentThreadWin32Thread() ? PsGetCurrentThreadWin32Thread()->KeyboardLayout : 0;
|
||||||
|
|
||||||
if( !keyLayout )
|
if( !keyLayout )
|
||||||
RETURN(0);
|
RETURN(0);
|
||||||
|
@ -1049,8 +1049,8 @@ NtUserGetKeyNameText( LONG lParam, LPWSTR lpString, int nSize )
|
||||||
DPRINT("Enter NtUserGetKeyNameText\n");
|
DPRINT("Enter NtUserGetKeyNameText\n");
|
||||||
UserEnterShared();
|
UserEnterShared();
|
||||||
|
|
||||||
keyLayout = PsGetWin32Thread() ?
|
keyLayout = PsGetCurrentThreadWin32Thread() ?
|
||||||
PsGetWin32Thread()->KeyboardLayout : 0;
|
PsGetCurrentThreadWin32Thread()->KeyboardLayout : 0;
|
||||||
|
|
||||||
if( !keyLayout || nSize < 1 )
|
if( !keyLayout || nSize < 1 )
|
||||||
RETURN(0);
|
RETURN(0);
|
||||||
|
@ -1275,7 +1275,7 @@ UserGetKeyboardLayout(
|
||||||
PKBDTABLES layout;
|
PKBDTABLES layout;
|
||||||
|
|
||||||
if (!dwThreadId)
|
if (!dwThreadId)
|
||||||
W32Thread = PsGetWin32Thread();
|
W32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread);//fixme: deref thread
|
Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread);//fixme: deref thread
|
||||||
|
|
|
@ -352,7 +352,7 @@ IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar)
|
||||||
Menu->MenuItemList = NULL;
|
Menu->MenuItemList = NULL;
|
||||||
|
|
||||||
/* Insert menu item into process menu handle list */
|
/* Insert menu item into process menu handle list */
|
||||||
InsertTailList(&PsGetWin32Process()->MenuListHead, &Menu->ListEntry);
|
InsertTailList(&PsGetCurrentProcessWin32Process()->MenuListHead, &Menu->ListEntry);
|
||||||
|
|
||||||
return Menu;
|
return Menu;
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ IntCloneMenu(PMENU_OBJECT Source)
|
||||||
Menu->MenuItemList = NULL;
|
Menu->MenuItemList = NULL;
|
||||||
|
|
||||||
/* Insert menu item into process menu handle list */
|
/* Insert menu item into process menu handle list */
|
||||||
InsertTailList(&PsGetWin32Process()->MenuListHead, &Menu->ListEntry);
|
InsertTailList(&PsGetCurrentProcessWin32Process()->MenuListHead, &Menu->ListEntry);
|
||||||
|
|
||||||
IntCloneMenuItems(Menu, Source);
|
IntCloneMenuItems(Menu, Source);
|
||||||
|
|
||||||
|
|
|
@ -663,7 +663,7 @@ co_IntPeekMessage(PUSER_MESSAGE Msg,
|
||||||
/* The queues and order in which they are checked are documented in the MSDN
|
/* The queues and order in which they are checked are documented in the MSDN
|
||||||
article on GetMessage() */
|
article on GetMessage() */
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
/* Inspect RemoveMsg flags */
|
/* Inspect RemoveMsg flags */
|
||||||
/* FIXME: The only flag we process is PM_REMOVE - processing of others must still be implemented */
|
/* FIXME: The only flag we process is PM_REMOVE - processing of others must still be implemented */
|
||||||
|
@ -739,7 +739,7 @@ CheckMessages:
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Check for paint messages. */
|
/* Check for paint messages. */
|
||||||
if (IntGetPaintMessage(hWnd, MsgFilterMin, MsgFilterMax, PsGetWin32Thread(), &Msg->Msg, RemoveMessages))
|
if (IntGetPaintMessage(hWnd, MsgFilterMin, MsgFilterMax, PsGetCurrentThreadWin32Thread(), &Msg->Msg, RemoveMessages))
|
||||||
{
|
{
|
||||||
Msg->FreeLParam = FALSE;
|
Msg->FreeLParam = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -922,7 +922,7 @@ co_IntWaitMessage(HWND Wnd,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
USER_MESSAGE Msg;
|
USER_MESSAGE Msg;
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -1176,7 +1176,7 @@ UserPostMessage(HWND Wnd,
|
||||||
|
|
||||||
if (WM_QUIT == Msg)
|
if (WM_QUIT == Msg)
|
||||||
{
|
{
|
||||||
MsqPostQuitMessage(PsGetWin32Thread()->MessageQueue, wParam);
|
MsqPostQuitMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, wParam);
|
||||||
}
|
}
|
||||||
else if (Wnd == HWND_BROADCAST)
|
else if (Wnd == HWND_BROADCAST)
|
||||||
{
|
{
|
||||||
|
@ -1221,7 +1221,7 @@ UserPostMessage(HWND Wnd,
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
IntGetCursorLocation(PsGetWin32Thread()->Desktop->WindowStation,
|
IntGetCursorLocation(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
|
||||||
&KernelModeMsg.pt);
|
&KernelModeMsg.pt);
|
||||||
KeQueryTickCount(&LargeTickCount);
|
KeQueryTickCount(&LargeTickCount);
|
||||||
KernelModeMsg.time = LargeTickCount.u.LowPart;
|
KernelModeMsg.time = LargeTickCount.u.LowPart;
|
||||||
|
@ -1362,7 +1362,7 @@ co_IntSendMessageTimeoutSingle(HWND hWnd,
|
||||||
|
|
||||||
UserRefObjectCo(Window, &Ref);
|
UserRefObjectCo(Window, &Ref);
|
||||||
|
|
||||||
Win32Thread = PsGetWin32Thread();
|
Win32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
|
|
||||||
if (NULL != Win32Thread &&
|
if (NULL != Win32Thread &&
|
||||||
Window->MessageQueue == Win32Thread->MessageQueue)
|
Window->MessageQueue == Win32Thread->MessageQueue)
|
||||||
|
@ -1507,7 +1507,7 @@ co_IntPostOrSendMessage(HWND hWnd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Window->MessageQueue != PsGetWin32Thread()->MessageQueue)
|
if(Window->MessageQueue != PsGetCurrentThreadWin32Thread()->MessageQueue)
|
||||||
{
|
{
|
||||||
Result = UserPostMessage(hWnd, Msg, wParam, lParam);
|
Result = UserPostMessage(hWnd, Msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
@ -1556,8 +1556,8 @@ co_IntDoSendMessage(HWND hWnd,
|
||||||
/* FIXME: Check for an exiting window. */
|
/* FIXME: Check for an exiting window. */
|
||||||
|
|
||||||
/* See if the current thread can handle the message */
|
/* See if the current thread can handle the message */
|
||||||
if (HWND_BROADCAST != hWnd && NULL != PsGetWin32Thread() &&
|
if (HWND_BROADCAST != hWnd && NULL != PsGetCurrentThreadWin32Thread() &&
|
||||||
Window->MessageQueue == PsGetWin32Thread()->MessageQueue)
|
Window->MessageQueue == PsGetCurrentThreadWin32Thread()->MessageQueue)
|
||||||
{
|
{
|
||||||
/* Gather the information usermode needs to call the window proc directly */
|
/* Gather the information usermode needs to call the window proc directly */
|
||||||
Info.HandledByKernel = FALSE;
|
Info.HandledByKernel = FALSE;
|
||||||
|
@ -1737,7 +1737,7 @@ NtUserGetQueueStatus(BOOL ClearChanges)
|
||||||
DPRINT("Enter NtUserGetQueueStatus\n");
|
DPRINT("Enter NtUserGetQueueStatus\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
Queue = PsGetWin32Thread()->MessageQueue;
|
Queue = PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
Result = MAKELONG(Queue->QueueBits, Queue->ChangedBits);
|
Result = MAKELONG(Queue->QueueBits, Queue->ChangedBits);
|
||||||
if (ClearChanges)
|
if (ClearChanges)
|
||||||
|
|
|
@ -23,7 +23,7 @@ VOID W32kRegisterPrimitiveMessageQueue(VOID)
|
||||||
if( !pmPrimitiveMessageQueue )
|
if( !pmPrimitiveMessageQueue )
|
||||||
{
|
{
|
||||||
PW32THREAD pThread;
|
PW32THREAD pThread;
|
||||||
pThread = PsGetWin32Thread();
|
pThread = PsGetCurrentThreadWin32Thread();
|
||||||
if( pThread && pThread->MessageQueue )
|
if( pThread && pThread->MessageQueue )
|
||||||
{
|
{
|
||||||
pmPrimitiveMessageQueue = pThread->MessageQueue;
|
pmPrimitiveMessageQueue = pThread->MessageQueue;
|
||||||
|
@ -182,7 +182,7 @@ NtUserCallOneParam(
|
||||||
|
|
||||||
if (Routine == ONEPARAM_ROUTINE_SHOWCURSOR)
|
if (Routine == ONEPARAM_ROUTINE_SHOWCURSOR)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinSta = PsGetWin32Thread()->Desktop->WindowStation;
|
PWINSTATION_OBJECT WinSta = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
|
||||||
PSYSTEM_CURSORINFO CurInfo;
|
PSYSTEM_CURSORINFO CurInfo;
|
||||||
|
|
||||||
HDC Screen;
|
HDC Screen;
|
||||||
|
@ -416,7 +416,7 @@ NtUserCallOneParam(
|
||||||
case ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING:
|
case ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING:
|
||||||
{
|
{
|
||||||
BOOL Enable;
|
BOOL Enable;
|
||||||
PW32PROCESS Process = PsGetWin32Process();
|
PW32PROCESS Process = PsGetCurrentProcessWin32Process();
|
||||||
|
|
||||||
if(Process != NULL)
|
if(Process != NULL)
|
||||||
{
|
{
|
||||||
|
@ -1244,7 +1244,7 @@ IntSystemParametersInfo(
|
||||||
case SPI_SETWORKAREA:
|
case SPI_SETWORKAREA:
|
||||||
{
|
{
|
||||||
RECT *rc;
|
RECT *rc;
|
||||||
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
|
PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
|
||||||
|
|
||||||
if(!Desktop)
|
if(!Desktop)
|
||||||
{
|
{
|
||||||
|
@ -1260,7 +1260,7 @@ IntSystemParametersInfo(
|
||||||
}
|
}
|
||||||
case SPI_GETWORKAREA:
|
case SPI_GETWORKAREA:
|
||||||
{
|
{
|
||||||
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
|
PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
|
||||||
|
|
||||||
if(!Desktop)
|
if(!Desktop)
|
||||||
{
|
{
|
||||||
|
@ -1898,7 +1898,7 @@ PW32PROCESSINFO
|
||||||
GetW32ProcessInfo(VOID)
|
GetW32ProcessInfo(VOID)
|
||||||
{
|
{
|
||||||
PW32PROCESSINFO pi;
|
PW32PROCESSINFO pi;
|
||||||
PW32PROCESS W32Process = PsGetWin32Process();
|
PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
|
||||||
|
|
||||||
if (W32Process == NULL)
|
if (W32Process == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1938,7 +1938,7 @@ GetW32ThreadInfo(VOID)
|
||||||
{
|
{
|
||||||
PTEB Teb;
|
PTEB Teb;
|
||||||
PW32THREADINFO ti;
|
PW32THREADINFO ti;
|
||||||
PW32THREAD W32Thread = PsGetWin32Thread();
|
PW32THREAD W32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
|
|
||||||
if (W32Thread == NULL)
|
if (W32Thread == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,7 +71,7 @@ IntMsqSetWakeMask(DWORD WakeMask)
|
||||||
PUSER_MESSAGE_QUEUE MessageQueue;
|
PUSER_MESSAGE_QUEUE MessageQueue;
|
||||||
HANDLE MessageEventHandle;
|
HANDLE MessageEventHandle;
|
||||||
|
|
||||||
Win32Thread = PsGetWin32Thread();
|
Win32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
if (Win32Thread == NULL || Win32Thread->MessageQueue == NULL)
|
if (Win32Thread == NULL || Win32Thread->MessageQueue == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ IntMsqClearWakeMask(VOID)
|
||||||
PW32THREAD Win32Thread;
|
PW32THREAD Win32Thread;
|
||||||
PUSER_MESSAGE_QUEUE MessageQueue;
|
PUSER_MESSAGE_QUEUE MessageQueue;
|
||||||
|
|
||||||
Win32Thread = PsGetWin32Thread();
|
Win32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
if (Win32Thread == NULL || Win32Thread->MessageQueue == NULL)
|
if (Win32Thread == NULL || Win32Thread->MessageQueue == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -206,12 +206,12 @@ MsqIsDblClk(LPMSG Msg, BOOL Remove)
|
||||||
LONG dX, dY;
|
LONG dX, dY;
|
||||||
BOOL Res;
|
BOOL Res;
|
||||||
|
|
||||||
if (PsGetWin32Thread()->Desktop == NULL)
|
if (PsGetCurrentThreadWin32Thread()->Desktop == NULL)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
|
||||||
|
|
||||||
CurInfo = IntGetSysCursorInfo(WinStaObject);
|
CurInfo = IntGetSysCursorInfo(WinStaObject);
|
||||||
Res = (Msg->hwnd == (HWND)CurInfo->LastClkWnd) &&
|
Res = (Msg->hwnd == (HWND)CurInfo->LastClkWnd) &&
|
||||||
|
@ -480,7 +480,7 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
|
||||||
USER_REFERENCE_ENTRY Ref;
|
USER_REFERENCE_ENTRY Ref;
|
||||||
|
|
||||||
if( !IntGetScreenDC() ||
|
if( !IntGetScreenDC() ||
|
||||||
PsGetWin32Thread()->MessageQueue == W32kGetPrimitiveMessageQueue() )
|
PsGetCurrentThreadWin32Thread()->MessageQueue == W32kGetPrimitiveMessageQueue() )
|
||||||
{
|
{
|
||||||
RETURN(FALSE);
|
RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
@ -1051,7 +1051,7 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
|
||||||
|
|
||||||
KeInitializeEvent(&CompletionEvent, NotificationEvent, FALSE);
|
KeInitializeEvent(&CompletionEvent, NotificationEvent, FALSE);
|
||||||
|
|
||||||
ThreadQueue = PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
ASSERT(ThreadQueue != MessageQueue);
|
ASSERT(ThreadQueue != MessageQueue);
|
||||||
|
|
||||||
Timeout.QuadPart = (LONGLONG) uTimeout * (LONGLONG) -10000;
|
Timeout.QuadPart = (LONGLONG) uTimeout * (LONGLONG) -10000;
|
||||||
|
@ -1540,7 +1540,7 @@ MsqSetMessageExtraInfo(LPARAM lParam)
|
||||||
LPARAM Ret;
|
LPARAM Ret;
|
||||||
PUSER_MESSAGE_QUEUE MessageQueue;
|
PUSER_MESSAGE_QUEUE MessageQueue;
|
||||||
|
|
||||||
MessageQueue = PsGetWin32Thread()->MessageQueue;
|
MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
if(!MessageQueue)
|
if(!MessageQueue)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1557,7 +1557,7 @@ MsqGetMessageExtraInfo(VOID)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE MessageQueue;
|
PUSER_MESSAGE_QUEUE MessageQueue;
|
||||||
|
|
||||||
MessageQueue = PsGetWin32Thread()->MessageQueue;
|
MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
if(!MessageQueue)
|
if(!MessageQueue)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1808,7 +1808,7 @@ MsqGetTimerMessage(PUSER_MESSAGE_QUEUE MessageQueue,
|
||||||
Msg->lParam = (LPARAM) Timer->TimerFunc;
|
Msg->lParam = (LPARAM) Timer->TimerFunc;
|
||||||
KeQueryTickCount(&LargeTickCount);
|
KeQueryTickCount(&LargeTickCount);
|
||||||
Msg->time = LargeTickCount.u.LowPart;
|
Msg->time = LargeTickCount.u.LowPart;
|
||||||
IntGetCursorLocation(PsGetWin32Thread()->Desktop->WindowStation,
|
IntGetCursorLocation(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
|
||||||
&Msg->pt);
|
&Msg->pt);
|
||||||
|
|
||||||
if (Restart)
|
if (Restart)
|
||||||
|
|
|
@ -656,7 +656,7 @@ IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax,
|
||||||
(MsgFilterMin > WM_PAINT || MsgFilterMax < WM_PAINT))
|
(MsgFilterMin > WM_PAINT || MsgFilterMax < WM_PAINT))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Message->hwnd = IntFindWindowToRepaint(UserGetDesktopWindow(), PsGetWin32Thread());
|
Message->hwnd = IntFindWindowToRepaint(UserGetDesktopWindow(), PsGetCurrentThreadWin32Thread());
|
||||||
|
|
||||||
if (Message->hwnd == NULL)
|
if (Message->hwnd == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,7 +83,7 @@ IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL S
|
||||||
HintIndex = ++IDEvent;
|
HintIndex = ++IDEvent;
|
||||||
IntUnlockWindowlessTimerBitmap();
|
IntUnlockWindowlessTimerBitmap();
|
||||||
Ret = IDEvent;
|
Ret = IDEvent;
|
||||||
MessageQueue = PsGetWin32Thread()->MessageQueue;
|
MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -151,7 +151,7 @@ IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer)
|
||||||
DPRINT("IntKillTimer wnd %x id %p systemtimer %s\n",
|
DPRINT("IntKillTimer wnd %x id %p systemtimer %s\n",
|
||||||
Wnd, IDEvent, SystemTimer ? "TRUE" : "FALSE");
|
Wnd, IDEvent, SystemTimer ? "TRUE" : "FALSE");
|
||||||
|
|
||||||
if (! MsqKillTimer(PsGetWin32Thread()->MessageQueue, Wnd,
|
if (! MsqKillTimer(PsGetCurrentThreadWin32Thread()->MessageQueue, Wnd,
|
||||||
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
|
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
|
||||||
{
|
{
|
||||||
DPRINT1("Unable to locate timer in message queue\n");
|
DPRINT1("Unable to locate timer in message queue\n");
|
||||||
|
|
|
@ -36,12 +36,12 @@ IntAddAtom(LPWSTR AtomName)
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
RTL_ATOM Atom;
|
RTL_ATOM Atom;
|
||||||
|
|
||||||
if (PsGetWin32Thread()->Desktop == NULL)
|
if (PsGetCurrentThreadWin32Thread()->Desktop == NULL)
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return (RTL_ATOM)0;
|
return (RTL_ATOM)0;
|
||||||
}
|
}
|
||||||
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
|
||||||
Status = RtlAddAtomToAtomTable(WinStaObject->AtomTable,
|
Status = RtlAddAtomToAtomTable(WinStaObject->AtomTable,
|
||||||
AtomName, &Atom);
|
AtomName, &Atom);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -59,12 +59,12 @@ IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize)
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
ULONG Size = nSize;
|
ULONG Size = nSize;
|
||||||
|
|
||||||
if (PsGetWin32Thread()->Desktop == NULL)
|
if (PsGetCurrentThreadWin32Thread()->Desktop == NULL)
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
|
||||||
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
||||||
nAtom, NULL, NULL, lpBuffer, &Size);
|
nAtom, NULL, NULL, lpBuffer, &Size);
|
||||||
if (Size < nSize)
|
if (Size < nSize)
|
||||||
|
|
|
@ -714,7 +714,7 @@ IntGetSystemMenu(PWINDOW_OBJECT Window, BOOL bRevert, BOOL RetMenu)
|
||||||
|
|
||||||
if(bRevert)
|
if(bRevert)
|
||||||
{
|
{
|
||||||
W32Thread = PsGetWin32Thread();
|
W32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
|
|
||||||
if(!W32Thread->Desktop)
|
if(!W32Thread->Desktop)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1426,7 +1426,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
|
||||||
BOOL HasOwner;
|
BOOL HasOwner;
|
||||||
USER_REFERENCE_ENTRY ParentRef, Ref;
|
USER_REFERENCE_ENTRY ParentRef, Ref;
|
||||||
|
|
||||||
ParentWindowHandle = PsGetWin32Thread()->Desktop->DesktopWindow;
|
ParentWindowHandle = PsGetCurrentThreadWin32Thread()->Desktop->DesktopWindow;
|
||||||
OwnerWindowHandle = NULL;
|
OwnerWindowHandle = NULL;
|
||||||
|
|
||||||
if (hWndParent == HWND_MESSAGE)
|
if (hWndParent == HWND_MESSAGE)
|
||||||
|
@ -1470,7 +1470,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
|
||||||
|
|
||||||
/* Check the window station. */
|
/* Check the window station. */
|
||||||
ti = GetW32ThreadInfo();
|
ti = GetW32ThreadInfo();
|
||||||
if (ti == NULL || PsGetWin32Thread()->Desktop == NULL)
|
if (ti == NULL || PsGetCurrentThreadWin32Thread()->Desktop == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("Thread is not attached to a desktop! Cannot create window!\n");
|
DPRINT1("Thread is not attached to a desktop! Cannot create window!\n");
|
||||||
RETURN( (HWND)0);
|
RETURN( (HWND)0);
|
||||||
|
@ -1508,7 +1508,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
|
||||||
RETURN(NULL);
|
RETURN(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
WinSta = PsGetWin32Thread()->Desktop->WindowStation;
|
WinSta = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
|
||||||
|
|
||||||
//FIXME: Reference thread/desktop instead
|
//FIXME: Reference thread/desktop instead
|
||||||
ObReferenceObjectByPointer(WinSta, KernelMode, ExWindowStationObjectType, 0);
|
ObReferenceObjectByPointer(WinSta, KernelMode, ExWindowStationObjectType, 0);
|
||||||
|
@ -1531,10 +1531,10 @@ co_IntCreateWindowEx(DWORD dwExStyle,
|
||||||
|
|
||||||
ObDereferenceObject(WinSta);
|
ObDereferenceObject(WinSta);
|
||||||
|
|
||||||
if (NULL == PsGetWin32Thread()->Desktop->DesktopWindow)
|
if (NULL == PsGetCurrentThreadWin32Thread()->Desktop->DesktopWindow)
|
||||||
{
|
{
|
||||||
/* If there is no desktop window yet, we must be creating it */
|
/* If there is no desktop window yet, we must be creating it */
|
||||||
PsGetWin32Thread()->Desktop->DesktopWindow = hWnd;
|
PsGetCurrentThreadWin32Thread()->Desktop->DesktopWindow = hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1562,7 +1562,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
|
||||||
IntSetMenu(Window, hMenu, &MenuChanged);
|
IntSetMenu(Window, hMenu, &MenuChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
Window->MessageQueue = PsGetWin32Thread()->MessageQueue;
|
Window->MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
|
||||||
IntReferenceMessageQueue(Window->MessageQueue);
|
IntReferenceMessageQueue(Window->MessageQueue);
|
||||||
Window->Parent = ParentWindow;
|
Window->Parent = ParentWindow;
|
||||||
|
|
||||||
|
@ -1664,7 +1664,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the window into the thread's window list. */
|
/* Insert the window into the thread's window list. */
|
||||||
InsertTailList (&PsGetWin32Thread()->WindowListHead, &Window->ThreadListEntry);
|
InsertTailList (&PsGetCurrentThreadWin32Thread()->WindowListHead, &Window->ThreadListEntry);
|
||||||
|
|
||||||
/* Allocate a DCE for this window. */
|
/* Allocate a DCE for this window. */
|
||||||
if (dwStyle & CS_OWNDC)
|
if (dwStyle & CS_OWNDC)
|
||||||
|
@ -2245,7 +2245,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IntWndBelongsToThread(Child, PsGetWin32Thread()))
|
if (IntWndBelongsToThread(Child, PsGetCurrentThreadWin32Thread()))
|
||||||
{
|
{
|
||||||
USER_REFERENCE_ENTRY ChildRef;
|
USER_REFERENCE_ENTRY ChildRef;
|
||||||
UserRefObjectCo(Child, &ChildRef);//temp hack?
|
UserRefObjectCo(Child, &ChildRef);//temp hack?
|
||||||
|
@ -2277,7 +2277,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy the window storage */
|
/* Destroy the window storage */
|
||||||
co_UserFreeWindow(Window, PsGetWin32Process(), PsGetWin32Thread(), TRUE);
|
co_UserFreeWindow(Window, PsGetCurrentProcessWin32Process(), PsGetCurrentThreadWin32Thread(), TRUE);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -4456,7 +4456,7 @@ NtUserWindowFromPoint(LONG X, LONG Y)
|
||||||
//its possible this referencing is useless, thou it shouldnt hurt...
|
//its possible this referencing is useless, thou it shouldnt hurt...
|
||||||
UserRefObjectCo(DesktopWindow, &Ref);
|
UserRefObjectCo(DesktopWindow, &Ref);
|
||||||
|
|
||||||
Hit = co_WinPosWindowFromPoint(DesktopWindow, PsGetWin32Thread()->MessageQueue, &pt, &Window);
|
Hit = co_WinPosWindowFromPoint(DesktopWindow, PsGetCurrentThreadWin32Thread()->MessageQueue, &pt, &Window);
|
||||||
|
|
||||||
if(Window)
|
if(Window)
|
||||||
{
|
{
|
||||||
|
|
|
@ -263,7 +263,7 @@ WinPosInitInternalPos(PWINDOW_OBJECT Window, POINT *pt, PRECT RestoreRect)
|
||||||
if (Window->InternalPos == NULL)
|
if (Window->InternalPos == NULL)
|
||||||
{
|
{
|
||||||
RECT WorkArea;
|
RECT WorkArea;
|
||||||
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop; /* Or rather get it from the window? */
|
PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop; /* Or rather get it from the window? */
|
||||||
|
|
||||||
Parent = Window->Parent;
|
Parent = Window->Parent;
|
||||||
if(Parent)
|
if(Parent)
|
||||||
|
@ -417,7 +417,7 @@ WinPosFillMinMaxInfoStruct(PWINDOW_OBJECT Window, MINMAXINFO *Info)
|
||||||
{
|
{
|
||||||
UINT XInc, YInc;
|
UINT XInc, YInc;
|
||||||
RECT WorkArea;
|
RECT WorkArea;
|
||||||
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop; /* Or rather get it from the window? */
|
PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop; /* Or rather get it from the window? */
|
||||||
|
|
||||||
IntGetDesktopWorkArea(Desktop, &WorkArea);
|
IntGetDesktopWorkArea(Desktop, &WorkArea);
|
||||||
|
|
||||||
|
|
|
@ -894,7 +894,7 @@ UserGetProcessWindowStation(VOID)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT1("Should use ObFindHandleForObject\n");
|
DPRINT1("Should use ObFindHandleForObject\n");
|
||||||
Status = ObOpenObjectByPointer(PsGetWin32Thread()->Desktop->WindowStation,
|
Status = ObOpenObjectByPointer(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
WINSTA_ALL_ACCESS,
|
WINSTA_ALL_ACCESS,
|
||||||
|
@ -942,9 +942,9 @@ IntGetWinStaObj(VOID)
|
||||||
* just a temporary hack, this will be gone soon
|
* just a temporary hack, this will be gone soon
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(PsGetWin32Thread() != NULL && PsGetWin32Thread()->Desktop != NULL)
|
if(PsGetCurrentThreadWin32Thread() != NULL && PsGetCurrentThreadWin32Thread()->Desktop != NULL)
|
||||||
{
|
{
|
||||||
WinStaObj = PsGetWin32Thread()->Desktop->WindowStation;
|
WinStaObj = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
|
||||||
ObReferenceObjectByPointer(WinStaObj, KernelMode, ExWindowStationObjectType, 0);
|
ObReferenceObjectByPointer(WinStaObj, KernelMode, ExWindowStationObjectType, 0);
|
||||||
}
|
}
|
||||||
else if(PsGetCurrentProcess() != CsrProcess)
|
else if(PsGetCurrentProcess() != CsrProcess)
|
||||||
|
@ -1045,7 +1045,7 @@ NtUserLockWindowStation(HWINSTA hWindowStation)
|
||||||
DPRINT("About to set process window station with handle (0x%X)\n",
|
DPRINT("About to set process window station with handle (0x%X)\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
|
|
||||||
if(PsGetWin32Process() != LogonProcess)
|
if(PsGetCurrentProcessWin32Process() != LogonProcess)
|
||||||
{
|
{
|
||||||
DPRINT1("Unauthorized process attempted to lock the window station!\n");
|
DPRINT1("Unauthorized process attempted to lock the window station!\n");
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
|
@ -1090,7 +1090,7 @@ NtUserUnlockWindowStation(HWINSTA hWindowStation)
|
||||||
DPRINT("About to set process window station with handle (0x%X)\n",
|
DPRINT("About to set process window station with handle (0x%X)\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
|
|
||||||
if(PsGetWin32Process() != LogonProcess)
|
if(PsGetCurrentProcessWin32Process() != LogonProcess)
|
||||||
{
|
{
|
||||||
DPRINT1("Unauthorized process attempted to unlock the window station!\n");
|
DPRINT1("Unauthorized process attempted to unlock the window station!\n");
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
|
|
|
@ -340,7 +340,7 @@ GDIOBJ_AllocObj(PGDI_HANDLE_TABLE HandleTable, ULONG ObjectType)
|
||||||
ULONG Attempts = 0;
|
ULONG Attempts = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
W32Process = PsGetWin32Process();
|
W32Process = PsGetCurrentProcessWin32Process();
|
||||||
/* HACK HACK HACK: simplest-possible quota implementation - don't allow a process
|
/* HACK HACK HACK: simplest-possible quota implementation - don't allow a process
|
||||||
to take too many GDI objects, itself. */
|
to take too many GDI objects, itself. */
|
||||||
if ( W32Process && W32Process->GDIObjects >= 0x2710 )
|
if ( W32Process && W32Process->GDIObjects >= 0x2710 )
|
||||||
|
@ -521,7 +521,7 @@ LockHandle:
|
||||||
if(GdiHdr->Locks == 0)
|
if(GdiHdr->Locks == 0)
|
||||||
{
|
{
|
||||||
BOOL Ret;
|
BOOL Ret;
|
||||||
PW32PROCESS W32Process = PsGetWin32Process();
|
PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
|
||||||
ULONG Type = Entry->Type << 16;
|
ULONG Type = Entry->Type << 16;
|
||||||
|
|
||||||
/* Clear the type field so when unlocking the handle it gets finally deleted and increment reuse counter */
|
/* Clear the type field so when unlocking the handle it gets finally deleted and increment reuse counter */
|
||||||
|
|
|
@ -363,7 +363,7 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
|
||||||
|
|
||||||
if (Characteristics & FR_PRIVATE)
|
if (Characteristics & FR_PRIVATE)
|
||||||
{
|
{
|
||||||
PW32PROCESS Win32Process = PsGetWin32Process();
|
PW32PROCESS Win32Process = PsGetCurrentProcessWin32Process();
|
||||||
IntLockProcessPrivateFonts(Win32Process);
|
IntLockProcessPrivateFonts(Win32Process);
|
||||||
InsertTailList(&Win32Process->PrivateFontListHead, &Entry->ListEntry);
|
InsertTailList(&Win32Process->PrivateFontListHead, &Entry->ListEntry);
|
||||||
IntUnLockProcessPrivateFonts(Win32Process);
|
IntUnLockProcessPrivateFonts(Win32Process);
|
||||||
|
@ -983,7 +983,7 @@ FindFaceNameInLists(PUNICODE_STRING FaceName)
|
||||||
PFONTGDI Font;
|
PFONTGDI Font;
|
||||||
|
|
||||||
/* Search the process local list */
|
/* Search the process local list */
|
||||||
Win32Process = PsGetWin32Process();
|
Win32Process = PsGetCurrentProcessWin32Process();
|
||||||
IntLockProcessPrivateFonts(Win32Process);
|
IntLockProcessPrivateFonts(Win32Process);
|
||||||
Font = FindFaceNameInList(FaceName, &Win32Process->PrivateFontListHead);
|
Font = FindFaceNameInList(FaceName, &Win32Process->PrivateFontListHead);
|
||||||
IntUnLockProcessPrivateFonts(Win32Process);
|
IntUnLockProcessPrivateFonts(Win32Process);
|
||||||
|
@ -1391,7 +1391,7 @@ NtGdiGetFontFamilyInfo(HDC Dc,
|
||||||
IntUnLockGlobalFonts;
|
IntUnLockGlobalFonts;
|
||||||
|
|
||||||
/* Enumerate font families in the process local list */
|
/* Enumerate font families in the process local list */
|
||||||
Win32Process = PsGetWin32Process();
|
Win32Process = PsGetCurrentProcessWin32Process();
|
||||||
IntLockProcessPrivateFonts(Win32Process);
|
IntLockProcessPrivateFonts(Win32Process);
|
||||||
if (! GetFontFamilyInfoForList(&LogFont, Info, &Count, Size,
|
if (! GetFontFamilyInfoForList(&LogFont, Info, &Count, Size,
|
||||||
&Win32Process->PrivateFontListHead))
|
&Win32Process->PrivateFontListHead))
|
||||||
|
@ -3880,7 +3880,7 @@ TextIntRealizeFont(HFONT FontHandle)
|
||||||
TextObj->Font = NULL;
|
TextObj->Font = NULL;
|
||||||
|
|
||||||
/* First search private fonts */
|
/* First search private fonts */
|
||||||
Win32Process = PsGetWin32Process();
|
Win32Process = PsGetCurrentProcessWin32Process();
|
||||||
IntLockProcessPrivateFonts(Win32Process);
|
IntLockProcessPrivateFonts(Win32Process);
|
||||||
FindBestFontFromList(&TextObj->Font, &MatchScore,
|
FindBestFontFromList(&TextObj->Font, &MatchScore,
|
||||||
&TextObj->logfont, &FaceName,
|
&TextObj->logfont, &FaceName,
|
||||||
|
|
|
@ -138,7 +138,7 @@ static __inline PVOID
|
||||||
UserHeapAddressToUser(PVOID lpMem)
|
UserHeapAddressToUser(PVOID lpMem)
|
||||||
{
|
{
|
||||||
return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
|
return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
|
||||||
(ULONG_PTR)PsGetWin32Process()->HeapMappings.UserMapping);
|
(ULONG_PTR)PsGetCurrentProcessWin32Process()->HeapMappings.UserMapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __W32K_H */
|
#endif /* __W32K_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue