- 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:
Alex Ionescu 2006-07-20 14:53:47 +00:00
parent 18726a1fac
commit 502215cb1c
33 changed files with 356 additions and 369 deletions

View file

@ -32,13 +32,13 @@ Author:
//
struct _W32THREAD*
NTAPI
PsGetWin32Thread(
PsGetCurrentThreadWin32Thread(
VOID
);
struct _W32PROCESS*
NTAPI
PsGetWin32Process(
PsGetCurrentProcessWin32Process(
VOID
);

View file

@ -78,6 +78,25 @@ IoIsWdmVersionAvailable(IN UCHAR MajorVersion,
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
*/

View file

@ -897,10 +897,12 @@ PsEstablishWin32Callouts@4
PsGetContextThread@12
PsGetCurrentProcess@0=KeGetCurrentProcess@0
PsGetCurrentProcessId@0
PsGetCurrentProcessWin32Process@0
PsGetCurrentProcessSessionId@0
PsGetCurrentThread@0=KeGetCurrentThread@0
PsGetCurrentThreadId@0
PsGetCurrentThreadPreviousMode@0
PsGetCurrentThreadWin32Thread@0
PsGetCurrentThreadStackBase@0
PsGetCurrentThreadStackLimit@0
PsGetJobLock@4
@ -931,8 +933,6 @@ PsGetThreadSessionId@4
PsGetThreadTeb@4
PsGetThreadWin32Thread@4
PsGetVersion@16
PsGetWin32Thread@0
PsGetWin32Process@0
PsImpersonateClient@20
PsInitialSystemProcess DATA
PsIsProcessBeingDebugged@4

View file

@ -13,11 +13,7 @@
#define NDEBUG
#include <internal/debug.h>
#define LockEvent Spare0[0]
#define LockCount Spare0[1]
#define LockOwner Spare0[2]
/* GLOBALS ******************************************************************/
/* GLOBALS *******************************************************************/
PEPROCESS PsInitialSystemProcess = NULL;
PEPROCESS PsIdleProcess = NULL;
@ -26,31 +22,16 @@ extern PHANDLE_TABLE PspCidTable;
extern POBJECT_TYPE DbgkDebugObjectType;
EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
ULONG PsMinimumWorkingSet, PsMaximumWorkingSet;
LIST_ENTRY PsActiveProcessHead;
FAST_MUTEX PspActiveProcessMutex;
#if 1
LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
/* INTERNAL FUNCTIONS *****************************************************************/
NTSTATUS
NTAPI
PspDeleteLdt(PEPROCESS Process)
{
/* FIXME */
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
PspDeleteVdmObjects(PEPROCESS Process)
{
/* FIXME */
return STATUS_SUCCESS;
}
#define LockEvent Spare0[0]
#define LockCount Spare0[1]
#define LockOwner Spare0[2]
NTSTATUS
NTAPI
PsLockProcess(PEPROCESS Process, BOOLEAN Timeout)
@ -126,6 +107,25 @@ PsUnlockProcess(PEPROCESS Process)
KeLeaveCriticalRegion();
}
#endif
/* PRIVATE FUNCTIONS *********************************************************/
NTSTATUS
NTAPI
PspDeleteLdt(PEPROCESS Process)
{
/* FIXME */
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
PspDeleteVdmObjects(PEPROCESS Process)
{
/* FIXME */
return STATUS_SUCCESS;
}
PETHREAD
NTAPI
@ -175,69 +175,45 @@ PsGetNextProcessThread(IN PEPROCESS Process,
PEPROCESS
NTAPI
PsGetNextProcess(PEPROCESS OldProcess)
PsGetNextProcess(IN PEPROCESS OldProcess)
{
PEPROCESS NextProcess;
NTSTATUS Status;
PLIST_ENTRY Entry, ListHead;
PEPROCESS FoundProcess = NULL;
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 */
ExAcquireFastMutex(&PspActiveProcessMutex);
/* Start at the previous process */
NextProcess = OldProcess;
/* Loop until we fail */
while (1)
/* Check if we're already starting somewhere */
if (OldProcess)
{
/* Get the Process Link */
PLIST_ENTRY Flink = (NextProcess == PsIdleProcess ? PsActiveProcessHead.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);
/* Start where we left off */
Entry = OldProcess->ActiveProcessLinks.Flink;
}
else
{
NextProcess = NULL;
break;
/* Start at the beginning */
Entry = PsActiveProcessHead.Flink;
}
/* Reference the Process */
Status = ObReferenceObjectByPointer(NextProcess,
PROCESS_ALL_ACCESS,
PsProcessType,
KernelMode);
/* Set the list head and start looping */
ListHead = &PsActiveProcessHead;
while (ListHead != Entry)
{
/* Get the Thread */
FoundProcess = CONTAINING_RECORD(Entry, EPROCESS, ActiveProcessLinks);
/* Exit the loop if the reference worked, keep going if there's an error */
if (NT_SUCCESS(Status)) break;
/* Reference the thread. FIXME: Race, use ObSafeReferenceObject */
ObReferenceObject(FoundProcess);
break;
}
/* Release the lock */
ExReleaseFastMutex(&PspActiveProcessMutex);
/* Reference the Process we had referenced earlier */
ObDereferenceObject(OldProcess);
return(NextProcess);
if (OldProcess) ObDereferenceObject(OldProcess);
return FoundProcess;
}
NTSTATUS
@ -288,11 +264,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
PreviousMode,
(PVOID*)&Parent,
NULL);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to reference the parent process: Status: 0x%x\n", Status);
return Status;
}
if (!NT_SUCCESS(Status)) return Status;
/* If this process should be in a job but the parent isn't */
if ((InJob) && (!Parent->Job))
@ -333,15 +305,15 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
0,
0,
(PVOID*)&Process);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to create process object, Status: 0x%x\n", Status);
goto Cleanup;
}
if (!NT_SUCCESS(Status)) goto Cleanup;
/* Clean up the Object */
RtlZeroMemory(Process, sizeof(EPROCESS));
/* Initialize pushlock and rundown protection */
ExInitializeRundownProtection(&Process->RundownProtect);
Process->ProcessLock.Value = 0;
/* Setup the Thread List Head */
InitializeListHead(&Process->ThreadListHead);
@ -356,7 +328,8 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
{
/* Ineherit PID and Hard Error Processing */
Process->InheritedFromUniqueProcessId = Parent->UniqueProcessId;
Process->DefaultHardErrorProcessing = Parent->DefaultHardErrorProcessing;
Process->DefaultHardErrorProcessing = Parent->
DefaultHardErrorProcessing;
}
else
{
@ -374,11 +347,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
PreviousMode,
(PVOID*)&SectionObject,
NULL);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to reference process image section: Status: 0x%x\n", Status);
goto CleanupWithRef;
}
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
}
else
{
@ -386,14 +355,14 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
if (Parent != PsInitialSystemProcess)
{
/* It's not, so acquire the process rundown */
// FIXME
ExAcquireRundownProtection(&Process->RundownProtect);
/* If the parent has a section, use it */
SectionObject = Parent->SectionObject;
if (SectionObject) ObReferenceObject(SectionObject);
/* Release process rundown */
// FIXME
ExReleaseRundownProtection(&Process->RundownProtect);
/* If we don't have a section object */
if (!SectionObject)
@ -418,17 +387,17 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
PreviousMode,
(PVOID*)&DebugObject,
NULL);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to reference the debug port: Status: 0x%x\n", Status);
goto CleanupWithRef;
}
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
/* Save the debug object */
Process->DebugPort = DebugObject;
/* 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
{
@ -446,11 +415,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
PreviousMode,
(PVOID*)&ExceptionPortObject,
NULL);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to reference the exception port: Status: 0x%x\n", Status);
goto CleanupWithRef;
}
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
/* Save the exception port */
Process->ExceptionPort = ExceptionPortObject;
@ -460,10 +425,12 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
Process->SectionObject = SectionObject;
/* Setup the Lock Event */
#if 1
Process->LockEvent = ExAllocatePoolWithTag(PagedPool,
sizeof(KEVENT),
TAG('P', 's', 'L', 'k'));
KeInitializeEvent(Process->LockEvent, SynchronizationEvent, FALSE);
#endif
/* Set default exit code */
Process->ExitStatus = STATUS_TIMEOUT;
@ -490,22 +457,14 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
/* Duplicate Parent Token */
Status = PspInitializeProcessSecurity(Process, Parent);
if (!NT_SUCCESS(Status))
{
DPRINT1("PspInitializeProcessSecurity failed (Status %x)\n", Status);
goto CleanupWithRef;
}
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
/* Set default priority class */
Process->PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL;
/* Create the Process' Address Space */
Status = MmCreateProcessAddressSpace(Process, (PROS_SECTION_OBJECT)SectionObject);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to create Address Space\n");
goto CleanupWithRef;
}
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
/* Check for parent again */
#if 0
@ -542,12 +501,8 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
}
#endif
/* Check if we have a section object */
if (SectionObject)
{
/* Map the System Dll */
PspMapSystemDll(Process, NULL);
}
/* Check if we have a section object and map the system DLL */
if (SectionObject) PspMapSystemDll(Process, NULL);
/* Create a handle for the Process */
CidEntry.Object = Process;
@ -555,7 +510,6 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
Process->UniqueProcessId = ExCreateHandle(PspCidTable, &CidEntry);
if (!Process->UniqueProcessId)
{
DPRINT1("Failed to create CID handle\n");
Status = STATUS_INSUFFICIENT_RESOURCES;
goto CleanupWithRef;
}
@ -566,11 +520,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
if (Parent)
{
Status = MmCreatePeb(Process);
if (!NT_SUCCESS(Status))
{
DPRINT("NtCreateProcess() Peb creation failed: Status %x\n",Status);
goto CleanupWithRef;
}
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
}
/* The process can now be activated */
@ -587,6 +537,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
1,
(PVOID*)&Process,
&hProcess);
if (!NT_SUCCESS(Status)) goto Cleanup;
/* FIXME: Compute Quantum and Priority */
@ -594,14 +545,16 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
* FIXME: ObGetObjectSecurity(Process, &SecurityDescriptor)
* SeAccessCheck
*/
ObReferenceObject(Process); // <- Act as if we called ObGetObjectSecurity
/* Check for success */
if (NT_SUCCESS(Status))
{
/* Sanity check */
ASSERT(IsListEmpty(&Process->ThreadListHead));
/* Set the Creation Time */
KeQuerySystemTime(&Process->CreateTime);
/* Set the granted access */
Process->GrantedAccess = PROCESS_ALL_ACCESS;
/* Protect against bad user-mode pointer */
_SEH_TRY
{
@ -610,16 +563,16 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
}
_SEH_HANDLE
{
/* Get the exception code */
Status = _SEH_GetExceptionCode();
}
_SEH_END;
}
CleanupWithRef:
/*
* Dereference the process. For failures, kills the process and does
* cleanup present in PspDeleteProcess. For success, kills the extra
* reference added by ObGetObjectSecurity
* reference added by ObInsertObject.
*/
ObDereferenceObject(Process);
@ -638,10 +591,11 @@ Cleanup:
*/
NTSTATUS
NTAPI
PsCreateSystemProcess(PHANDLE ProcessHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
PsCreateSystemProcess(OUT PHANDLE ProcessHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
/* Call the internal API */
return PspCreateProcess(ProcessHandle,
DesiredAccess,
ObjectAttributes,
@ -668,8 +622,8 @@ PsLookupProcessByProcessId(IN HANDLE ProcessId,
KeEnterCriticalRegion();
/* Get the CID Handle Entry */
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
ProcessId)))
CidEntry = ExMapHandleToPointer(PspCidTable, ProcessId);
if (CidEntry)
{
/* Get the Process */
FoundProcess = CidEntry->Object;
@ -677,7 +631,7 @@ PsLookupProcessByProcessId(IN HANDLE ProcessId,
/* Make sure it's really a process */
if (FoundProcess->Pcb.Header.Type == ProcessObject)
{
/* Reference and return it */
/* FIXME: Safe Reference and return it */
ObReferenceObject(FoundProcess);
*Process = FoundProcess;
Status = STATUS_SUCCESS;
@ -708,8 +662,8 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
KeEnterCriticalRegion();
/* Get the CID Handle Entry */
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
Cid->UniqueThread)))
CidEntry = ExMapHandleToPointer(PspCidTable, Cid->UniqueThread);
if (CidEntry)
{
/* Get the Process */
FoundThread = CidEntry->Object;
@ -718,7 +672,7 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
if ((FoundThread->Tcb.DispatcherHeader.Type == ThreadObject) &&
(FoundThread->Cid.UniqueProcess == Cid->UniqueProcess))
{
/* Reference and return it */
/* FIXME: Safe Reference and return it */
ObReferenceObject(FoundThread);
*Thread = FoundThread;
Status = STATUS_SUCCESS;
@ -742,33 +696,13 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
}
/*
* FUNCTION: Returns a pointer to the current process
*
* @implemented
*/
PEPROCESS STDCALL
IoGetCurrentProcess(VOID)
{
if (PsGetCurrentThread() == NULL ||
PsGetCurrentThread()->Tcb.ApcState.Process == NULL)
{
return(PsInitialSystemProcess);
}
else
{
return(PEPROCESS)(PsGetCurrentThread()->Tcb.ApcState.Process);
}
}
/*
* @implemented
*/
LARGE_INTEGER STDCALL
LARGE_INTEGER
NTAPI
PsGetProcessExitTime(VOID)
{
LARGE_INTEGER Li;
Li.QuadPart = PsGetCurrentProcess()->ExitTime.QuadPart;
return Li;
return PsGetCurrentProcess()->ExitTime;
}
/*
@ -920,16 +854,12 @@ PsGetProcessSessionId(PEPROCESS Process)
return (HANDLE)Process->Session;
}
struct _W32THREAD*
STDCALL
PsGetWin32Thread(VOID)
{
return(PsGetCurrentThread()->Tcb.Win32Thread);
}
/*
* @implemented
*/
struct _W32PROCESS*
STDCALL
PsGetWin32Process(VOID)
NTAPI
PsGetCurrentProcessWin32Process(VOID)
{
return (struct _W32PROCESS*)PsGetCurrentProcess()->Win32Process;
}
@ -961,7 +891,7 @@ BOOLEAN
STDCALL
PsIsProcessBeingDebugged(PEPROCESS Process)
{
return FALSE; //Process->IsProcessBeingDebugged;
return Process->DebugPort != NULL;
}
/*
@ -1037,22 +967,22 @@ NtCreateProcessEx(OUT PHANDLE ProcessHandle,
{
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
/* Check parameters */
/* Check if we came from user mode */
if(PreviousMode != KernelMode)
{
_SEH_TRY
{
/* Probe process handle */
ProbeForWriteHandle(ProcessHandle);
}
_SEH_HANDLE
{
/* Get exception code */
Status = _SEH_GetExceptionCode();
}
_SEH_END;
if (!NT_SUCCESS(Status)) return Status;
}
@ -1123,7 +1053,7 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN PCLIENT_ID ClientId)
{
KPROCESSOR_MODE PreviousMode;
KPROCESSOR_MODE PreviousMode = KeGetPreviousMode();
CLIENT_ID SafeClientId;
ULONG Attributes = 0;
HANDLE hProcess;
@ -1131,30 +1061,32 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
PETHREAD Thread = NULL;
PEPROCESS Process = NULL;
NTSTATUS Status = STATUS_SUCCESS;
ACCESS_STATE AccessState;
AUX_DATA AuxData;
PAGED_CODE();
PreviousMode = KeGetPreviousMode();
/* Probe the paraemeters */
/* Check if we were called from user mode */
if (PreviousMode != KernelMode)
{
/* Enter SEH for probing */
_SEH_TRY
{
/* Probe the thread handle */
ProbeForWriteHandle(ProcessHandle);
if(ClientId != NULL)
/* Check for a CID structure */
if (ClientId)
{
ProbeForRead(ClientId,
sizeof(CLIENT_ID),
sizeof(ULONG));
/* Probe and capture it */
ProbeForRead(ClientId, sizeof(CLIENT_ID), sizeof(ULONG));
SafeClientId = *ClientId;
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,
sizeof(OBJECT_ATTRIBUTES),
sizeof(ULONG));
@ -1163,22 +1095,47 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
}
_SEH_HANDLE
{
/* Get the exception code */
Status = _SEH_GetExceptionCode();
}
_SEH_END;
if (!NT_SUCCESS(Status)) return Status;
}
else
{
/* Otherwise just get the data directly */
HasObjectName = (ObjectAttributes->ObjectName != NULL);
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 */
return STATUS_INVALID_PARAMETER_MIX;
/* Did he want full access? */
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 */
@ -1188,25 +1145,21 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
Status = ObOpenObjectByName(ObjectAttributes,
PsProcessType,
PreviousMode,
NULL,
DesiredAccess,
&AccessState,
0,
NULL,
&hProcess);
if (!NT_SUCCESS(Status))
{
DPRINT1("Could not open object by name\n");
/* Get rid of the access state */
SeDeleteAccessState(&AccessState);
}
}
else if (ClientId != NULL)
else if (ClientId)
{
/* Open by Thread ID */
if (ClientId->UniqueThread)
{
/* Get the Process */
Status = PsLookupProcessThreadByCid(ClientId,
&Process,
&Thread);
Status = PsLookupProcessThreadByCid(ClientId, &Process, &Thread);
}
else
{
@ -1215,24 +1168,25 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
&Process);
}
/* Check if we didn't find anything */
if (!NT_SUCCESS(Status))
{
DPRINT1("Failure to find process\n");
/* Get rid of the access state and return */
SeDeleteAccessState(&AccessState);
return Status;
}
/* Open the Process Object */
Status = ObOpenObjectByPointer(Process,
Attributes,
NULL,
DesiredAccess,
&AccessState,
0,
PsProcessType,
PreviousMode,
&hProcess);
if(!NT_SUCCESS(Status))
{
DPRINT1("Failure to open process\n");
}
/* Delete the access state */
SeDeleteAccessState(&AccessState);
/* Dereference the thread if we used it */
if (Thread) ObDereferenceObject(Thread);
@ -1246,20 +1200,24 @@ NtOpenProcess(OUT PHANDLE ProcessHandle,
return STATUS_INVALID_PARAMETER_MIX;
}
/* Write back the handle */
/* Check for success */
if (NT_SUCCESS(Status))
{
/* Use SEH for write back */
_SEH_TRY
{
/* Write back the handle */
*ProcessHandle = hProcess;
}
_SEH_HANDLE
{
/* Get the exception code */
Status = _SEH_GetExceptionCode();
}
_SEH_END;
}
/* Return status */
return Status;
}
/* EOF */

View file

@ -615,6 +615,16 @@ PsSetThreadHardErrorsAreDisabled(IN PETHREAD Thread,
Thread->HardErrorsAreDisabled = HardErrorsAreDisabled;
}
/*
* @implemented
*/
struct _W32THREAD*
NTAPI
PsGetCurrentThreadWin32Thread(VOID)
{
return PsGetCurrentThread()->Tcb.Win32Thread;
}
/*
* @implemented
*/

View file

@ -44,16 +44,16 @@ IntEngCleanupDriverObjs(struct _EPROCESS *Process,
{
PDRIVERGDI DrvObjInt;
IntEngLockProcessDriverObjs(PsGetWin32Process());
IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
while (!IsListEmpty(&Win32Process->DriverObjListHead))
{
DrvObjInt = CONTAINING_RECORD(Win32Process->DriverObjListHead.Flink,
DRIVERGDI, ListEntry);
IntEngUnLockProcessDriverObjs(PsGetWin32Process());
IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
EngDeleteDriverObj((HDRVOBJ)(&DrvObjInt->DriverObj), TRUE, FALSE);
IntEngLockProcessDriverObjs(PsGetWin32Process());
IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
}
IntEngUnLockProcessDriverObjs(PsGetWin32Process());
IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
}
@ -88,9 +88,9 @@ EngCreateDriverObj(
/* fill internal object */
ExInitializeFastMutex(&DrvObjInt->Lock);
IntEngLockProcessDriverObjs(PsGetWin32Process());
InsertTailList(&PsGetWin32Process()->DriverObjListHead, &DrvObjInt->ListEntry);
IntEngUnLockProcessDriverObjs(PsGetWin32Process());
IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
InsertTailList(&PsGetCurrentProcessWin32Process()->DriverObjListHead, &DrvObjInt->ListEntry);
IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
return (HDRVOBJ)DrvObjUser;
}
@ -129,9 +129,9 @@ EngDeleteDriverObj(
}
/* Free the DRIVEROBJ */
IntEngLockProcessDriverObjs(PsGetWin32Process());
IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
RemoveEntryList(&DrvObjInt->ListEntry);
IntEngUnLockProcessDriverObjs(PsGetWin32Process());
IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
EngFreeMem(DrvObjInt);
return TRUE;

View file

@ -200,10 +200,10 @@ DesktopHeapGetUserDelta(VOID)
HANDLE hDesktopHeap;
ULONG_PTR Delta = 0;
ASSERT(PsGetWin32Thread()->Desktop != NULL);
hDesktopHeap = PsGetWin32Thread()->Desktop->hDesktopHeap;
ASSERT(PsGetCurrentThreadWin32Thread()->Desktop != NULL);
hDesktopHeap = PsGetCurrentThreadWin32Thread()->Desktop->hDesktopHeap;
Mapping = PsGetWin32Process()->HeapMappings.Next;
Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;
while (Mapping != NULL)
{
if (Mapping->UserMapping == (PVOID)hDesktopHeap)
@ -224,7 +224,7 @@ DesktopHeapAddressToUser(IN PDESKTOP Desktop,
{
PW32HEAP_USER_MAPPING Mapping;
Mapping = PsGetWin32Process()->HeapMappings.Next;
Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;
while (Mapping != NULL)
{
if (Mapping->KernelMapping == (PVOID)Desktop->hKernelHeap)

View file

@ -80,7 +80,7 @@ typedef struct _USER_REFERENCE_ENTRY
PUSER_REFERENCE_ENTRY ref; \
\
ASSERT(_obj_); \
t = PsGetWin32Thread(); \
t = PsGetCurrentThreadWin32Thread(); \
ASSERT(t); \
e = t->ReferencesList.Next; \
ASSERT(e); \
@ -95,7 +95,7 @@ typedef struct _USER_REFERENCE_ENTRY
PW32THREAD t; \
\
ASSERT(_obj_); \
t = PsGetWin32Thread(); \
t = PsGetCurrentThreadWin32Thread(); \
ASSERT(t); \
ASSERT(_ref_); \
(_ref_)->obj = _obj_; \
@ -113,7 +113,7 @@ typedef struct _USER_REFERENCE_ENTRY
PUSER_REFERENCE_ENTRY ref; \
\
ASSERT(_obj_); \
t = PsGetWin32Thread(); \
t = PsGetCurrentThreadWin32Thread(); \
ASSERT(t); \
e = PopEntryList(&t->ReferencesList); \
ASSERT(e); \

View file

@ -43,7 +43,7 @@ PMENU_OBJECT FASTCALL UserGetMenuObject(HMENU hMenu);
ASSERT(FALSE); \
} \
\
e = PsGetWin32Thread()->ReferencesList.Next; \
e = PsGetCurrentThreadWin32Thread()->ReferencesList.Next; \
while (e) \
{ \
PUSER_REFERENCE_ENTRY ref = CONTAINING_RECORD(e, USER_REFERENCE_ENTRY, Entry); \

View file

@ -34,7 +34,7 @@ IntUserHeapCommitRoutine(IN PVOID Base,
NTSTATUS Status;
SIZE_T Delta = (SIZE_T)((ULONG_PTR)(*CommitAddress) - (ULONG_PTR)Base);
W32Process = PsGetWin32Process();
W32Process = PsGetCurrentProcessWin32Process();
if (W32Process != NULL)
{

View file

@ -59,7 +59,7 @@ IntCbAllocateMemory(ULONG Size)
return NULL;
}
W32Thread = PsGetWin32Thread();
W32Thread = PsGetCurrentThreadWin32Thread();
ASSERT(W32Thread);
/* insert the callback memory into the thread's callback list */
@ -79,7 +79,7 @@ IntCbFreeMemory(PVOID Data)
Mem = ((PINT_CALLBACK_HEADER)Data - 1);
W32Thread = PsGetWin32Thread();
W32Thread = PsGetCurrentThreadWin32Thread();
ASSERT(W32Thread);
/* remove the memory block from the thread's callback list */

View file

@ -61,7 +61,7 @@ BOOL FASTCALL
IntSetCaretBlinkTime(UINT uMSeconds)
{
/* 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 */
if((uMSeconds < MIN_CARETBLINKRATE) || (uMSeconds > MAX_CARETBLINKRATE))
@ -149,7 +149,7 @@ IntGetCaretBlinkTime(VOID)
PWINSTATION_OBJECT WinStaObject;
UINT Ret;
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
Ret = WinStaObject->CaretBlinkRate;
if(!Ret)
@ -172,7 +172,7 @@ BOOL FASTCALL
co_IntSetCaretPos(int X, int Y)
{
PUSER_MESSAGE_QUEUE ThreadQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
if(ThreadQueue->CaretInfo->hWnd)
{
@ -195,7 +195,7 @@ BOOL FASTCALL
IntSwitchCaretShowing(PVOID Info)
{
PUSER_MESSAGE_QUEUE ThreadQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
if(ThreadQueue->CaretInfo->hWnd)
{
@ -213,7 +213,7 @@ VOID FASTCALL
co_IntDrawCaret(HWND hWnd)
{
PUSER_MESSAGE_QUEUE ThreadQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
if(ThreadQueue->CaretInfo->hWnd && ThreadQueue->CaretInfo->Visible &&
ThreadQueue->CaretInfo->Showing)
@ -238,7 +238,7 @@ BOOL FASTCALL co_UserHideCaret(PWINDOW_OBJECT Window OPTIONAL)
return FALSE;
}
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
if(Window && ThreadQueue->CaretInfo->hWnd != Window->hSelf)
{
@ -271,7 +271,7 @@ BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT Window OPTIONAL)
return FALSE;
}
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
if(Window && ThreadQueue->CaretInfo->hWnd != Window->hSelf)
{
@ -321,7 +321,7 @@ NtUserCreateCaret(
RETURN(FALSE);
}
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
if (ThreadQueue->CaretInfo->Visible)
{
@ -381,7 +381,7 @@ NtUserGetCaretPos(
DPRINT("Enter NtUserGetCaretPos\n");
UserEnterShared();
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
Status = MmCopyToCaller(lpPoint, &(ThreadQueue->CaretInfo->Pos), sizeof(POINT));
if(!NT_SUCCESS(Status))

View file

@ -30,7 +30,7 @@
#include <debug.h>
#define CHECK_LOCK \
if (ClipboardThread && ClipboardThread != PsGetWin32Thread()) \
if (ClipboardThread && ClipboardThread != PsGetCurrentThreadWin32Thread()) \
{ \
SetLastWin32Error(ERROR_LOCKED); \
return FALSE; \
@ -68,7 +68,7 @@ NtUserOpenClipboard(HWND hWnd, DWORD Unknown1)
CHECK_LOCK
tempClipboardWindow = hWnd;
ClipboardThread = PsGetWin32Thread();
ClipboardThread = PsGetCurrentThreadWin32Thread();
return TRUE;
}

View file

@ -334,7 +334,7 @@ ReferenceCurIconByProcess(PCURICON_OBJECT CurIcon)
PW32PROCESS Win32Process;
PCURICON_PROCESS Current;
Win32Process = PsGetWin32Process();
Win32Process = PsGetCurrentProcessWin32Process();
LIST_FOR_EACH(Current, &CurIcon->ProcessList, CURICON_PROCESS, ListEntry)
{
@ -430,7 +430,7 @@ IntDestroyCurIconObject(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT CurIcon, BOOL
HBITMAP bmpMask, bmpColor;
BOOLEAN Ret;
PCURICON_PROCESS Current = NULL;
PW32PROCESS W32Process = PsGetWin32Process();
PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
/* Private objects can only be destroyed by their own process */
if (NULL == CurIcon->hModule)

View file

@ -572,7 +572,7 @@ PWINDOW_OBJECT FASTCALL UserGetDesktopWindow(VOID)
HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID)
{
PDESKTOP_OBJECT pdo = PsGetWin32Thread()->Desktop;
PDESKTOP_OBJECT pdo = PsGetCurrentThreadWin32Thread()->Desktop;
if (NULL == pdo)
{
DPRINT1("Thread doesn't have a desktop\n");
@ -753,7 +753,7 @@ VOID co_IntShellHookNotify(WPARAM Message, LPARAM lParam)
*/
BOOL IntRegisterShellHookWindow(HWND hWnd)
{
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
PSHELL_HOOK_WINDOW Entry;
DPRINT("IntRegisterShellHookWindow\n");
@ -784,7 +784,7 @@ BOOL IntRegisterShellHookWindow(HWND hWnd)
*/
BOOL IntDeRegisterShellHookWindow(HWND hWnd)
{
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
PSHELL_HOOK_WINDOW Current;
LIST_FOR_EACH(Current, &Desktop->ShellHookWindows, SHELL_HOOK_WINDOW, ListEntry)
@ -1326,7 +1326,7 @@ NtUserPaintDesktop(HDC hDC)
COLORREF color_old;
UINT align_old;
int mode_old;
PWINSTATION_OBJECT WinSta = PsGetWin32Thread()->Desktop->WindowStation;
PWINSTATION_OBJECT WinSta = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
DECLARE_RETURN(BOOL);
UserEnterExclusive();
@ -1557,7 +1557,7 @@ NtUserSwitchDesktop(HDESK hDesktop)
* is the logon application itself
*/
if((DesktopObject->WindowStation->Flags & WSS_LOCKED) &&
LogonProcess != NULL && LogonProcess != PsGetWin32Process())
LogonProcess != NULL && LogonProcess != PsGetCurrentProcessWin32Process())
{
ObDereferenceObject(DesktopObject);
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)
{
PW32THREADINFO ti;
PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetWin32Process()->HeapMappings.Next;
PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetCurrentProcessWin32Process()->HeapMappings.Next;
NTSTATUS Status = STATUS_SUCCESS;
/* unmap if we're the last thread using the desktop */
@ -1735,7 +1735,7 @@ static NTSTATUS
IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
{
PW32THREADINFO ti;
PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetWin32Process()->HeapMappings.Next;
PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetCurrentProcessWin32Process()->HeapMappings.Next;
PVOID UserBase = NULL;
ULONG ViewSize = 0;
LARGE_INTEGER Offset;
@ -1813,7 +1813,7 @@ IntSetThreadDesktop(IN PDESKTOP_OBJECT DesktopObject,
BOOL MapHeap;
MapHeap = (PsGetCurrentProcess() != PsInitialSystemProcess);
W32Thread = PsGetWin32Thread();
W32Thread = PsGetCurrentThreadWin32Thread();
if (W32Thread->Desktop != DesktopObject)
{

View file

@ -42,7 +42,7 @@ HWND FASTCALL
IntGetThreadFocusWindow()
{
PUSER_MESSAGE_QUEUE ThreadQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
return ThreadQueue != NULL ? ThreadQueue->FocusWindow : 0;
}
@ -267,7 +267,7 @@ co_IntSetActiveWindow(PWINDOW_OBJECT Window OPTIONAL)
if (Window)
ASSERT_REFS_CO(Window);
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
ASSERT(ThreadQueue != 0);
if (Window != 0)
@ -307,7 +307,7 @@ co_IntSetFocusWindow(PWINDOW_OBJECT Window)
ASSERT_REFS_CO(Window);
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
ASSERT(ThreadQueue != 0);
hWndPrev = ThreadQueue->FocusWindow;
@ -361,7 +361,7 @@ CLEANUP:
HWND FASTCALL UserGetActiveWindow()
{
PUSER_MESSAGE_QUEUE ThreadQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
return( ThreadQueue ? ThreadQueue->ActiveWindow : 0);
}
@ -407,7 +407,7 @@ NtUserSetActiveWindow(HWND hWnd)
DPRINT("(%wZ)\n", &Window->WindowName);
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
if (Window->MessageQueue != ThreadQueue)
{
@ -444,7 +444,7 @@ NtUserGetCapture(VOID)
DPRINT("Enter NtUserGetCapture\n");
UserEnterShared();
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
RETURN( ThreadQueue ? ThreadQueue->CaptureWindow : 0);
CLEANUP:
@ -467,7 +467,7 @@ NtUserSetCapture(HWND hWnd)
DPRINT("Enter NtUserSetCapture(%x)\n", hWnd);
UserEnterExclusive();
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
if((Window = UserGetWindowObject(hWnd)))
{
@ -510,7 +510,7 @@ HWND FASTCALL co_UserSetFocus(PWINDOW_OBJECT Window OPTIONAL)
ASSERT_REFS_CO(Window);
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
if (Window->Style & (WS_MINIMIZE | WS_DISABLED))
{

View file

@ -79,7 +79,7 @@ co_IntGraphicsCheck(BOOL Create)
{
PW32PROCESS W32Data;
W32Data = PsGetWin32Process();
W32Data = PsGetCurrentProcessWin32Process();
if (Create)
{
if (! (W32Data->Flags & W32PF_CREATEDWINORDC) && ! (W32Data->Flags & W32PF_MANUALGUICHECK))
@ -106,7 +106,7 @@ NtUserManualGuiCheck(LONG Check)
DPRINT("Enter NtUserManualGuiCheck\n");
UserEnterExclusive();
W32Data = PsGetWin32Process();
W32Data = PsGetCurrentProcessWin32Process();
if (0 == Check)
{
W32Data->Flags |= W32PF_MANUALGUICHECK;

View file

@ -290,7 +290,7 @@ co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
Win32Thread = PsGetWin32Thread();
Win32Thread = PsGetCurrentThreadWin32Thread();
if (NULL == Win32Thread)
{
Table = NULL;
@ -343,7 +343,7 @@ co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
}
else
{
IntReleaseHookChain(MsqGetHooks(PsGetWin32Thread()->MessageQueue), HookId, WinStaObj);
IntReleaseHookChain(MsqGetHooks(PsGetCurrentThreadWin32Thread()->MessageQueue), HookId, WinStaObj);
IntReleaseHookChain(GlobalHooks, HookId, WinStaObj);
ObDereferenceObject(WinStaObj);
}

View file

@ -1003,7 +1003,7 @@ NtUserBlockInput(
DPRINT("Enter NtUserBlockInput\n");
UserEnterExclusive();
RETURN( IntBlockInput(PsGetWin32Thread(), BlockIt));
RETURN( IntBlockInput(PsGetCurrentThreadWin32Thread(), BlockIt));
CLEANUP:
DPRINT("Leave NtUserBlockInput, ret=%i\n",_ret_);
@ -1062,7 +1062,7 @@ IntMouseInput(MOUSEINPUT *mi)
ASSERT(mi);
#if 0
WinSta = PsGetWin32Process()->WindowStation;
WinSta = PsGetCurrentProcessWin32Process()->WindowStation;
#else
/* 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
@ -1288,7 +1288,7 @@ NtUserSendInput(
DPRINT("Enter NtUserSendInput\n");
UserEnterExclusive();
W32Thread = PsGetWin32Thread();
W32Thread = PsGetCurrentThreadWin32Thread();
ASSERT(W32Thread);
if(!W32Thread->Desktop)

View file

@ -430,8 +430,8 @@ int STDCALL ToUnicodeEx( UINT wVirtKey,
pwszBuff,
cchBuff,
wFlags,
PsGetWin32Thread() ?
PsGetWin32Thread()->KeyboardLayout : 0 );
PsGetCurrentThreadWin32Thread() ?
PsGetCurrentThreadWin32Thread()->KeyboardLayout : 0 );
}
return ToUnicodeResult;
@ -716,7 +716,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
DWORD ScanCode = 0;
keyLayout = PsGetWin32Thread()->KeyboardLayout;
keyLayout = PsGetCurrentThreadWin32Thread()->KeyboardLayout;
if( !keyLayout )
return FALSE;
@ -726,7 +726,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
ScanCode = (lpMsg->lParam >> 16) & 0xff;
/* All messages have to contain the cursor point. */
IntGetCursorLocation(PsGetWin32Thread()->Desktop->WindowStation,
IntGetCursorLocation(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
&NewMsg.pt);
UState = ToUnicodeInner(lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff,
@ -763,14 +763,14 @@ IntTranslateKbdMessage(LPMSG lpMsg,
NewMsg.wParam = dead_char;
NewMsg.lParam = lpMsg->lParam;
dead_char = 0;
MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
MsqPostMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
}
NewMsg.hwnd = lpMsg->hwnd;
NewMsg.wParam = wp[0];
NewMsg.lParam = 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;
}
else if (UState == -1)
@ -781,7 +781,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
NewMsg.wParam = wp[0];
NewMsg.lParam = lpMsg->lParam;
dead_char = wp[0];
MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
MsqPostMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
Result = TRUE;
}
@ -957,7 +957,7 @@ NtUserMapVirtualKeyEx( UINT Code, UINT Type, DWORD keyboardId, HKL dwhkl )
DPRINT("Enter NtUserMapVirtualKeyEx\n");
UserEnterExclusive();
keyLayout = PsGetWin32Thread() ? PsGetWin32Thread()->KeyboardLayout : 0;
keyLayout = PsGetCurrentThreadWin32Thread() ? PsGetCurrentThreadWin32Thread()->KeyboardLayout : 0;
if( !keyLayout )
RETURN(0);
@ -1049,8 +1049,8 @@ NtUserGetKeyNameText( LONG lParam, LPWSTR lpString, int nSize )
DPRINT("Enter NtUserGetKeyNameText\n");
UserEnterShared();
keyLayout = PsGetWin32Thread() ?
PsGetWin32Thread()->KeyboardLayout : 0;
keyLayout = PsGetCurrentThreadWin32Thread() ?
PsGetCurrentThreadWin32Thread()->KeyboardLayout : 0;
if( !keyLayout || nSize < 1 )
RETURN(0);
@ -1275,7 +1275,7 @@ UserGetKeyboardLayout(
PKBDTABLES layout;
if (!dwThreadId)
W32Thread = PsGetWin32Thread();
W32Thread = PsGetCurrentThreadWin32Thread();
else
{
Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread);//fixme: deref thread

View file

@ -352,7 +352,7 @@ IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar)
Menu->MenuItemList = NULL;
/* Insert menu item into process menu handle list */
InsertTailList(&PsGetWin32Process()->MenuListHead, &Menu->ListEntry);
InsertTailList(&PsGetCurrentProcessWin32Process()->MenuListHead, &Menu->ListEntry);
return Menu;
}
@ -456,7 +456,7 @@ IntCloneMenu(PMENU_OBJECT Source)
Menu->MenuItemList = NULL;
/* Insert menu item into process menu handle list */
InsertTailList(&PsGetWin32Process()->MenuListHead, &Menu->ListEntry);
InsertTailList(&PsGetCurrentProcessWin32Process()->MenuListHead, &Menu->ListEntry);
IntCloneMenuItems(Menu, Source);

View file

@ -663,7 +663,7 @@ co_IntPeekMessage(PUSER_MESSAGE Msg,
/* The queues and order in which they are checked are documented in the MSDN
article on GetMessage() */
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
/* Inspect RemoveMsg flags */
/* 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. */
if (IntGetPaintMessage(hWnd, MsgFilterMin, MsgFilterMax, PsGetWin32Thread(), &Msg->Msg, RemoveMessages))
if (IntGetPaintMessage(hWnd, MsgFilterMin, MsgFilterMax, PsGetCurrentThreadWin32Thread(), &Msg->Msg, RemoveMessages))
{
Msg->FreeLParam = FALSE;
return TRUE;
@ -922,7 +922,7 @@ co_IntWaitMessage(HWND Wnd,
NTSTATUS Status;
USER_MESSAGE Msg;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
do
{
@ -1176,7 +1176,7 @@ UserPostMessage(HWND Wnd,
if (WM_QUIT == Msg)
{
MsqPostQuitMessage(PsGetWin32Thread()->MessageQueue, wParam);
MsqPostQuitMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, wParam);
}
else if (Wnd == HWND_BROADCAST)
{
@ -1221,7 +1221,7 @@ UserPostMessage(HWND Wnd,
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
}
IntGetCursorLocation(PsGetWin32Thread()->Desktop->WindowStation,
IntGetCursorLocation(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
&KernelModeMsg.pt);
KeQueryTickCount(&LargeTickCount);
KernelModeMsg.time = LargeTickCount.u.LowPart;
@ -1362,7 +1362,7 @@ co_IntSendMessageTimeoutSingle(HWND hWnd,
UserRefObjectCo(Window, &Ref);
Win32Thread = PsGetWin32Thread();
Win32Thread = PsGetCurrentThreadWin32Thread();
if (NULL != Win32Thread &&
Window->MessageQueue == Win32Thread->MessageQueue)
@ -1507,7 +1507,7 @@ co_IntPostOrSendMessage(HWND hWnd,
return 0;
}
if(Window->MessageQueue != PsGetWin32Thread()->MessageQueue)
if(Window->MessageQueue != PsGetCurrentThreadWin32Thread()->MessageQueue)
{
Result = UserPostMessage(hWnd, Msg, wParam, lParam);
}
@ -1556,8 +1556,8 @@ co_IntDoSendMessage(HWND hWnd,
/* FIXME: Check for an exiting window. */
/* See if the current thread can handle the message */
if (HWND_BROADCAST != hWnd && NULL != PsGetWin32Thread() &&
Window->MessageQueue == PsGetWin32Thread()->MessageQueue)
if (HWND_BROADCAST != hWnd && NULL != PsGetCurrentThreadWin32Thread() &&
Window->MessageQueue == PsGetCurrentThreadWin32Thread()->MessageQueue)
{
/* Gather the information usermode needs to call the window proc directly */
Info.HandledByKernel = FALSE;
@ -1737,7 +1737,7 @@ NtUserGetQueueStatus(BOOL ClearChanges)
DPRINT("Enter NtUserGetQueueStatus\n");
UserEnterExclusive();
Queue = PsGetWin32Thread()->MessageQueue;
Queue = PsGetCurrentThreadWin32Thread()->MessageQueue;
Result = MAKELONG(Queue->QueueBits, Queue->ChangedBits);
if (ClearChanges)

View file

@ -23,7 +23,7 @@ VOID W32kRegisterPrimitiveMessageQueue(VOID)
if( !pmPrimitiveMessageQueue )
{
PW32THREAD pThread;
pThread = PsGetWin32Thread();
pThread = PsGetCurrentThreadWin32Thread();
if( pThread && pThread->MessageQueue )
{
pmPrimitiveMessageQueue = pThread->MessageQueue;
@ -182,7 +182,7 @@ NtUserCallOneParam(
if (Routine == ONEPARAM_ROUTINE_SHOWCURSOR)
{
PWINSTATION_OBJECT WinSta = PsGetWin32Thread()->Desktop->WindowStation;
PWINSTATION_OBJECT WinSta = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
PSYSTEM_CURSORINFO CurInfo;
HDC Screen;
@ -416,7 +416,7 @@ NtUserCallOneParam(
case ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING:
{
BOOL Enable;
PW32PROCESS Process = PsGetWin32Process();
PW32PROCESS Process = PsGetCurrentProcessWin32Process();
if(Process != NULL)
{
@ -1244,7 +1244,7 @@ IntSystemParametersInfo(
case SPI_SETWORKAREA:
{
RECT *rc;
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
if(!Desktop)
{
@ -1260,7 +1260,7 @@ IntSystemParametersInfo(
}
case SPI_GETWORKAREA:
{
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
if(!Desktop)
{
@ -1898,7 +1898,7 @@ PW32PROCESSINFO
GetW32ProcessInfo(VOID)
{
PW32PROCESSINFO pi;
PW32PROCESS W32Process = PsGetWin32Process();
PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
if (W32Process == NULL)
{
@ -1938,7 +1938,7 @@ GetW32ThreadInfo(VOID)
{
PTEB Teb;
PW32THREADINFO ti;
PW32THREAD W32Thread = PsGetWin32Thread();
PW32THREAD W32Thread = PsGetCurrentThreadWin32Thread();
if (W32Thread == NULL)
{

View file

@ -71,7 +71,7 @@ IntMsqSetWakeMask(DWORD WakeMask)
PUSER_MESSAGE_QUEUE MessageQueue;
HANDLE MessageEventHandle;
Win32Thread = PsGetWin32Thread();
Win32Thread = PsGetCurrentThreadWin32Thread();
if (Win32Thread == NULL || Win32Thread->MessageQueue == NULL)
return 0;
@ -88,7 +88,7 @@ IntMsqClearWakeMask(VOID)
PW32THREAD Win32Thread;
PUSER_MESSAGE_QUEUE MessageQueue;
Win32Thread = PsGetWin32Thread();
Win32Thread = PsGetCurrentThreadWin32Thread();
if (Win32Thread == NULL || Win32Thread->MessageQueue == NULL)
return FALSE;
@ -206,12 +206,12 @@ MsqIsDblClk(LPMSG Msg, BOOL Remove)
LONG dX, dY;
BOOL Res;
if (PsGetWin32Thread()->Desktop == NULL)
if (PsGetCurrentThreadWin32Thread()->Desktop == NULL)
{
return FALSE;
}
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
CurInfo = IntGetSysCursorInfo(WinStaObject);
Res = (Msg->hwnd == (HWND)CurInfo->LastClkWnd) &&
@ -480,7 +480,7 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
USER_REFERENCE_ENTRY Ref;
if( !IntGetScreenDC() ||
PsGetWin32Thread()->MessageQueue == W32kGetPrimitiveMessageQueue() )
PsGetCurrentThreadWin32Thread()->MessageQueue == W32kGetPrimitiveMessageQueue() )
{
RETURN(FALSE);
}
@ -1051,7 +1051,7 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
KeInitializeEvent(&CompletionEvent, NotificationEvent, FALSE);
ThreadQueue = PsGetWin32Thread()->MessageQueue;
ThreadQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
ASSERT(ThreadQueue != MessageQueue);
Timeout.QuadPart = (LONGLONG) uTimeout * (LONGLONG) -10000;
@ -1540,7 +1540,7 @@ MsqSetMessageExtraInfo(LPARAM lParam)
LPARAM Ret;
PUSER_MESSAGE_QUEUE MessageQueue;
MessageQueue = PsGetWin32Thread()->MessageQueue;
MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
if(!MessageQueue)
{
return 0;
@ -1557,7 +1557,7 @@ MsqGetMessageExtraInfo(VOID)
{
PUSER_MESSAGE_QUEUE MessageQueue;
MessageQueue = PsGetWin32Thread()->MessageQueue;
MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
if(!MessageQueue)
{
return 0;
@ -1808,7 +1808,7 @@ MsqGetTimerMessage(PUSER_MESSAGE_QUEUE MessageQueue,
Msg->lParam = (LPARAM) Timer->TimerFunc;
KeQueryTickCount(&LargeTickCount);
Msg->time = LargeTickCount.u.LowPart;
IntGetCursorLocation(PsGetWin32Thread()->Desktop->WindowStation,
IntGetCursorLocation(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
&Msg->pt);
if (Restart)

View file

@ -656,7 +656,7 @@ IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax,
(MsgFilterMin > WM_PAINT || MsgFilterMax < WM_PAINT))
return FALSE;
Message->hwnd = IntFindWindowToRepaint(UserGetDesktopWindow(), PsGetWin32Thread());
Message->hwnd = IntFindWindowToRepaint(UserGetDesktopWindow(), PsGetCurrentThreadWin32Thread());
if (Message->hwnd == NULL)
{

View file

@ -83,7 +83,7 @@ IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL S
HintIndex = ++IDEvent;
IntUnlockWindowlessTimerBitmap();
Ret = IDEvent;
MessageQueue = PsGetWin32Thread()->MessageQueue;
MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
}
else
{
@ -151,7 +151,7 @@ IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer)
DPRINT("IntKillTimer wnd %x id %p systemtimer %s\n",
Wnd, IDEvent, SystemTimer ? "TRUE" : "FALSE");
if (! MsqKillTimer(PsGetWin32Thread()->MessageQueue, Wnd,
if (! MsqKillTimer(PsGetCurrentThreadWin32Thread()->MessageQueue, Wnd,
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
{
DPRINT1("Unable to locate timer in message queue\n");

View file

@ -36,12 +36,12 @@ IntAddAtom(LPWSTR AtomName)
NTSTATUS Status = STATUS_SUCCESS;
RTL_ATOM Atom;
if (PsGetWin32Thread()->Desktop == NULL)
if (PsGetCurrentThreadWin32Thread()->Desktop == NULL)
{
SetLastNtError(Status);
return (RTL_ATOM)0;
}
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
Status = RtlAddAtomToAtomTable(WinStaObject->AtomTable,
AtomName, &Atom);
if (!NT_SUCCESS(Status))
@ -59,12 +59,12 @@ IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize)
NTSTATUS Status = STATUS_SUCCESS;
ULONG Size = nSize;
if (PsGetWin32Thread()->Desktop == NULL)
if (PsGetCurrentThreadWin32Thread()->Desktop == NULL)
{
SetLastNtError(Status);
return 0;
}
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
nAtom, NULL, NULL, lpBuffer, &Size);
if (Size < nSize)

View file

@ -714,7 +714,7 @@ IntGetSystemMenu(PWINDOW_OBJECT Window, BOOL bRevert, BOOL RetMenu)
if(bRevert)
{
W32Thread = PsGetWin32Thread();
W32Thread = PsGetCurrentThreadWin32Thread();
if(!W32Thread->Desktop)
return NULL;
@ -1426,7 +1426,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
BOOL HasOwner;
USER_REFERENCE_ENTRY ParentRef, Ref;
ParentWindowHandle = PsGetWin32Thread()->Desktop->DesktopWindow;
ParentWindowHandle = PsGetCurrentThreadWin32Thread()->Desktop->DesktopWindow;
OwnerWindowHandle = NULL;
if (hWndParent == HWND_MESSAGE)
@ -1470,7 +1470,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
/* Check the window station. */
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");
RETURN( (HWND)0);
@ -1508,7 +1508,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
RETURN(NULL);
}
WinSta = PsGetWin32Thread()->Desktop->WindowStation;
WinSta = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
//FIXME: Reference thread/desktop instead
ObReferenceObjectByPointer(WinSta, KernelMode, ExWindowStationObjectType, 0);
@ -1531,10 +1531,10 @@ co_IntCreateWindowEx(DWORD dwExStyle,
ObDereferenceObject(WinSta);
if (NULL == PsGetWin32Thread()->Desktop->DesktopWindow)
if (NULL == PsGetCurrentThreadWin32Thread()->Desktop->DesktopWindow)
{
/* 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);
}
Window->MessageQueue = PsGetWin32Thread()->MessageQueue;
Window->MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
IntReferenceMessageQueue(Window->MessageQueue);
Window->Parent = ParentWindow;
@ -1664,7 +1664,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
}
/* 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. */
if (dwStyle & CS_OWNDC)
@ -2245,7 +2245,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
continue;
}
if (IntWndBelongsToThread(Child, PsGetWin32Thread()))
if (IntWndBelongsToThread(Child, PsGetCurrentThreadWin32Thread()))
{
USER_REFERENCE_ENTRY ChildRef;
UserRefObjectCo(Child, &ChildRef);//temp hack?
@ -2277,7 +2277,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
}
/* Destroy the window storage */
co_UserFreeWindow(Window, PsGetWin32Process(), PsGetWin32Thread(), TRUE);
co_UserFreeWindow(Window, PsGetCurrentProcessWin32Process(), PsGetCurrentThreadWin32Thread(), TRUE);
return TRUE;
}
@ -4456,7 +4456,7 @@ NtUserWindowFromPoint(LONG X, LONG Y)
//its possible this referencing is useless, thou it shouldnt hurt...
UserRefObjectCo(DesktopWindow, &Ref);
Hit = co_WinPosWindowFromPoint(DesktopWindow, PsGetWin32Thread()->MessageQueue, &pt, &Window);
Hit = co_WinPosWindowFromPoint(DesktopWindow, PsGetCurrentThreadWin32Thread()->MessageQueue, &pt, &Window);
if(Window)
{

View file

@ -263,7 +263,7 @@ WinPosInitInternalPos(PWINDOW_OBJECT Window, POINT *pt, PRECT RestoreRect)
if (Window->InternalPos == NULL)
{
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;
if(Parent)
@ -417,7 +417,7 @@ WinPosFillMinMaxInfoStruct(PWINDOW_OBJECT Window, MINMAXINFO *Info)
{
UINT XInc, YInc;
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);

View file

@ -894,7 +894,7 @@ UserGetProcessWindowStation(VOID)
else
{
DPRINT1("Should use ObFindHandleForObject\n");
Status = ObOpenObjectByPointer(PsGetWin32Thread()->Desktop->WindowStation,
Status = ObOpenObjectByPointer(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
0,
NULL,
WINSTA_ALL_ACCESS,
@ -942,9 +942,9 @@ IntGetWinStaObj(VOID)
* 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);
}
else if(PsGetCurrentProcess() != CsrProcess)
@ -1045,7 +1045,7 @@ NtUserLockWindowStation(HWINSTA hWindowStation)
DPRINT("About to set process window station with handle (0x%X)\n",
hWindowStation);
if(PsGetWin32Process() != LogonProcess)
if(PsGetCurrentProcessWin32Process() != LogonProcess)
{
DPRINT1("Unauthorized process attempted to lock the window station!\n");
SetLastWin32Error(ERROR_ACCESS_DENIED);
@ -1090,7 +1090,7 @@ NtUserUnlockWindowStation(HWINSTA hWindowStation)
DPRINT("About to set process window station with handle (0x%X)\n",
hWindowStation);
if(PsGetWin32Process() != LogonProcess)
if(PsGetCurrentProcessWin32Process() != LogonProcess)
{
DPRINT1("Unauthorized process attempted to unlock the window station!\n");
SetLastWin32Error(ERROR_ACCESS_DENIED);

View file

@ -340,7 +340,7 @@ GDIOBJ_AllocObj(PGDI_HANDLE_TABLE HandleTable, ULONG ObjectType)
ULONG Attempts = 0;
#endif
W32Process = PsGetWin32Process();
W32Process = PsGetCurrentProcessWin32Process();
/* HACK HACK HACK: simplest-possible quota implementation - don't allow a process
to take too many GDI objects, itself. */
if ( W32Process && W32Process->GDIObjects >= 0x2710 )
@ -521,7 +521,7 @@ LockHandle:
if(GdiHdr->Locks == 0)
{
BOOL Ret;
PW32PROCESS W32Process = PsGetWin32Process();
PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
ULONG Type = Entry->Type << 16;
/* Clear the type field so when unlocking the handle it gets finally deleted and increment reuse counter */

View file

@ -363,7 +363,7 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
if (Characteristics & FR_PRIVATE)
{
PW32PROCESS Win32Process = PsGetWin32Process();
PW32PROCESS Win32Process = PsGetCurrentProcessWin32Process();
IntLockProcessPrivateFonts(Win32Process);
InsertTailList(&Win32Process->PrivateFontListHead, &Entry->ListEntry);
IntUnLockProcessPrivateFonts(Win32Process);
@ -983,7 +983,7 @@ FindFaceNameInLists(PUNICODE_STRING FaceName)
PFONTGDI Font;
/* Search the process local list */
Win32Process = PsGetWin32Process();
Win32Process = PsGetCurrentProcessWin32Process();
IntLockProcessPrivateFonts(Win32Process);
Font = FindFaceNameInList(FaceName, &Win32Process->PrivateFontListHead);
IntUnLockProcessPrivateFonts(Win32Process);
@ -1391,7 +1391,7 @@ NtGdiGetFontFamilyInfo(HDC Dc,
IntUnLockGlobalFonts;
/* Enumerate font families in the process local list */
Win32Process = PsGetWin32Process();
Win32Process = PsGetCurrentProcessWin32Process();
IntLockProcessPrivateFonts(Win32Process);
if (! GetFontFamilyInfoForList(&LogFont, Info, &Count, Size,
&Win32Process->PrivateFontListHead))
@ -3880,7 +3880,7 @@ TextIntRealizeFont(HFONT FontHandle)
TextObj->Font = NULL;
/* First search private fonts */
Win32Process = PsGetWin32Process();
Win32Process = PsGetCurrentProcessWin32Process();
IntLockProcessPrivateFonts(Win32Process);
FindBestFontFromList(&TextObj->Font, &MatchScore,
&TextObj->logfont, &FaceName,

View file

@ -138,7 +138,7 @@ static __inline PVOID
UserHeapAddressToUser(PVOID lpMem)
{
return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
(ULONG_PTR)PsGetWin32Process()->HeapMappings.UserMapping);
(ULONG_PTR)PsGetCurrentProcessWin32Process()->HeapMappings.UserMapping);
}
#endif /* __W32K_H */