Author: ion
Date: Thu Jul 20 18:53:47 2006
New Revision: 23192
URL:
http://svn.reactos.org/svn/reactos?rev=23192&view=rev
Log:
- 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.
Modified:
trunk/reactos/include/ndk/psfuncs.h
trunk/reactos/ntoskrnl/io/iomgr/util.c
trunk/reactos/ntoskrnl/ntoskrnl.def
trunk/reactos/ntoskrnl/ps/process.c
trunk/reactos/ntoskrnl/ps/thread.c
trunk/reactos/subsystems/win32/win32k/eng/driverobj.c
trunk/reactos/subsystems/win32/win32k/include/desktop.h
trunk/reactos/subsystems/win32/win32k/include/object.h
trunk/reactos/subsystems/win32/win32k/include/userfuncs.h
trunk/reactos/subsystems/win32/win32k/misc/usrheap.c
trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
trunk/reactos/subsystems/win32/win32k/ntuser/caret.c
trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c
trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
trunk/reactos/subsystems/win32/win32k/ntuser/guicheck.c
trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
trunk/reactos/subsystems/win32/win32k/ntuser/input.c
trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c
trunk/reactos/subsystems/win32/win32k/ntuser/menu.c
trunk/reactos/subsystems/win32/win32k/ntuser/message.c
trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
trunk/reactos/subsystems/win32/win32k/ntuser/timer.c
trunk/reactos/subsystems/win32/win32k/ntuser/useratom.c
trunk/reactos/subsystems/win32/win32k/ntuser/window.c
trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c
trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
trunk/reactos/subsystems/win32/win32k/objects/text.c
trunk/reactos/subsystems/win32/win32k/w32k.h
Modified: trunk/reactos/include/ndk/psfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/psfuncs.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/psfuncs.h (original)
+++ trunk/reactos/include/ndk/psfuncs.h Thu Jul 20 18:53:47 2006
@@ -32,13 +32,13 @@
//
struct _W32THREAD*
NTAPI
-PsGetWin32Thread(
+PsGetCurrentThreadWin32Thread(
VOID
);
struct _W32PROCESS*
NTAPI
-PsGetWin32Process(
+PsGetCurrentProcessWin32Process(
VOID
);
Modified: trunk/reactos/ntoskrnl/io/iomgr/util.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/util.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/util.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/util.c Thu Jul 20 18:53:47 2006
@@ -76,6 +76,25 @@
/* Return support for WDM 1.10 (Windows 2000) */
if (MajorVersion <= 1 && MinorVersion <= 0x10) return TRUE;
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);
+ }
}
/*
Modified: trunk/reactos/ntoskrnl/ntoskrnl.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.def?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl.def (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl.def Thu Jul 20 18:53:47 2006
@@ -897,10 +897,12 @@
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 @@
PsGetThreadTeb@4
PsGetThreadWin32Thread@4
PsGetVersion@16
-PsGetWin32Thread@0
-PsGetWin32Process@0
PsImpersonateClient@20
PsInitialSystemProcess DATA
PsIsProcessBeingDebugged@4
Modified: trunk/reactos/ntoskrnl/ps/process.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/process.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/process.c (original)
+++ trunk/reactos/ntoskrnl/ps/process.c Thu Jul 20 18:53:47 2006
@@ -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 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 @@
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,80 +175,56 @@
PEPROCESS
NTAPI
-PsGetNextProcess(PEPROCESS OldProcess)
-{
- PEPROCESS NextProcess;
- NTSTATUS Status;
+PsGetNextProcess(IN PEPROCESS OldProcess)
+{
+ 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)
- {
- /* 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);
- }
- else
- {
- NextProcess = NULL;
- break;
- }
-
- /* Reference the Process */
- Status = ObReferenceObjectByPointer(NextProcess,
- PROCESS_ALL_ACCESS,
- PsProcessType,
- KernelMode);
-
- /* Exit the loop if the reference worked, keep going if there's an error */
- if (NT_SUCCESS(Status)) break;
+ /* Check if we're already starting somewhere */
+ if (OldProcess)
+ {
+ /* Start where we left off */
+ Entry = OldProcess->ActiveProcessLinks.Flink;
+ }
+ else
+ {
+ /* Start at the beginning */
+ Entry = PsActiveProcessHead.Flink;
+ }
+
+ /* Set the list head and start looping */
+ ListHead = &PsActiveProcessHead;
+ while (ListHead != Entry)
+ {
+ /* Get the Thread */
+ FoundProcess = CONTAINING_RECORD(Entry, EPROCESS, ActiveProcessLinks);
+
+ /* 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
NTAPI
PspCreateProcess(OUT PHANDLE ProcessHandle,
IN ACCESS_MASK DesiredAccess,
- IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
- IN HANDLE ParentProcess OPTIONAL,
+ IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
+ IN HANDLE ParentProcess OPTIONAL,
IN DWORD Flags,
- IN HANDLE SectionHandle OPTIONAL,
- IN HANDLE DebugPort OPTIONAL,
+ IN HANDLE SectionHandle OPTIONAL,
+ IN HANDLE DebugPort OPTIONAL,
IN HANDLE ExceptionPort OPTIONAL,
IN BOOLEAN InJob)
{
@@ -288,11 +264,7 @@
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))
@@ -309,7 +281,7 @@
{
/* We have no parent */
Parent = NULL;
-#ifdef CONFIG_SMP
+#ifdef CONFIG_SMP
/*
* FIXME: Only the boot cpu is initialized in the early boot phase.
*/
@@ -333,15 +305,15 @@
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 @@
{
/* Ineherit PID and Hard Error Processing */
Process->InheritedFromUniqueProcessId = Parent->UniqueProcessId;
- Process->DefaultHardErrorProcessing = Parent->DefaultHardErrorProcessing;
+ Process->DefaultHardErrorProcessing = Parent->
+ DefaultHardErrorProcessing;
}
else
{
@@ -374,11 +347,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
/* 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,20 +501,15 @@
}
#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;
CidEntry.GrantedAccess = 0;
Process->UniqueProcessId = ExCreateHandle(PspCidTable, &CidEntry);
- if(!Process->UniqueProcessId)
- {
- DPRINT1("Failed to create CID handle\n");
+ if (!Process->UniqueProcessId)
+ {
Status = STATUS_INSUFFICIENT_RESOURCES;
goto CleanupWithRef;
}
@@ -566,11 +520,7 @@
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 @@
1,
(PVOID*)&Process,
&hProcess);
+ if (!NT_SUCCESS(Status)) goto Cleanup;
/* FIXME: Compute Quantum and Priority */
@@ -594,32 +545,34 @@
* FIXME: ObGetObjectSecurity(Process, &SecurityDescriptor)
* SeAccessCheck
*/
- ObReferenceObject(Process); // <- Act as if we called ObGetObjectSecurity
-
- /* Check for success */
- if (NT_SUCCESS(Status))
- {
- /* Set the Creation Time */
- KeQuerySystemTime(&Process->CreateTime);
-
- /* Protect against bad user-mode pointer */
- _SEH_TRY
- {
- /* Save the process handle */
- *ProcessHandle = hProcess;
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- }
+
+ /* 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
+ {
+ /* Save the process handle */
+ *ProcessHandle = hProcess;
+ }
+ _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 @@
*/
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 @@
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 @@
/* 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 @@
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 @@
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;
@@ -735,40 +689,20 @@
/* Unlock the Entry */
ExUnlockHandleTableEntry(PspCidTable, CidEntry);
}
-
+
/* Return to caller */
KeLeaveCriticalRegion();
return Status;
}
/*
- * 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
+ * @implemented
+ */
+LARGE_INTEGER
+NTAPI
PsGetProcessExitTime(VOID)
{
- LARGE_INTEGER Li;
- Li.QuadPart = PsGetCurrentProcess()->ExitTime.QuadPart;
- return Li;
+ return PsGetCurrentProcess()->ExitTime;
}
/*
@@ -920,16 +854,12 @@
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 @@
STDCALL
PsIsProcessBeingDebugged(PEPROCESS Process)
{
- return FALSE; //Process->IsProcessBeingDebugged;
+ return Process->DebugPort != NULL;
}
/*
@@ -1037,27 +967,27 @@
{
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;
+ if (!NT_SUCCESS(Status)) return Status;
}
/* Make sure there's a parent process */
- if(!ParentProcess)
+ if (!ParentProcess)
{
/* Can't create System Processes like this */
Status = STATUS_INVALID_PARAMETER;
@@ -1087,12 +1017,12 @@
NTAPI
NtCreateProcess(OUT PHANDLE ProcessHandle,
IN ACCESS_MASK DesiredAccess,
- IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
+ IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN HANDLE ParentProcess,
IN BOOLEAN InheritObjectTable,
- IN HANDLE SectionHandle OPTIONAL,
- IN HANDLE DebugPort OPTIONAL,
- IN HANDLE ExceptionPort OPTIONAL)
+ IN HANDLE SectionHandle OPTIONAL,
+ IN HANDLE DebugPort OPTIONAL,
+ IN HANDLE ExceptionPort OPTIONAL)
{
ULONG Flags = 0;
@@ -1123,7 +1053,7 @@
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 @@
PETHREAD Thread = NULL;
PEPROCESS Process = NULL;
NTSTATUS Status = STATUS_SUCCESS;
-
+ ACCESS_STATE AccessState;
+ AUX_DATA AuxData;
PAGED_CODE();
- PreviousMode = KeGetPreviousMode();
-
- /* Probe the paraemeters */
- if(PreviousMode != KernelMode)
- {
+ /* 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 @@
}
_SEH_HANDLE
{
+ /* Get the exception code */
Status = _SEH_GetExceptionCode();
}
_SEH_END;
-
- if(!NT_SUCCESS(Status)) return Status;
+ 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, n object name and a client id */
- return STATUS_INVALID_PARAMETER_MIX;
+ /* 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))
+ {
+ /* 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 @@
Status = ObOpenObjectByName(ObjectAttributes,
PsProcessType,
PreviousMode,
- NULL,
- DesiredAccess,
+ &AccessState,
+ 0,
NULL,
&hProcess);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Could not open object by name\n");
- }
- }
- else if (ClientId != NULL)
+ /* Get rid of the access state */
+ SeDeleteAccessState(&AccessState);
+ }
+ 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 @@
&Process);
}
- if(!NT_SUCCESS(Status))
- {
- DPRINT1("Failure to find process\n");
+ /* Check if we didn't find anything */
+ if (!NT_SUCCESS(Status))
+ {
+ /* 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 @@
return STATUS_INVALID_PARAMETER_MIX;
}
- /* Write back the handle */
- if(NT_SUCCESS(Status))
- {
+ /* 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 */
Modified: trunk/reactos/ntoskrnl/ps/thread.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/thread.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/thread.c (original)
+++ trunk/reactos/ntoskrnl/ps/thread.c Thu Jul 20 18:53:47 2006
@@ -618,6 +618,16 @@
/*
* @implemented
*/
+struct _W32THREAD*
+NTAPI
+PsGetCurrentThreadWin32Thread(VOID)
+{
+ return PsGetCurrentThread()->Tcb.Win32Thread;
+}
+
+/*
+ * @implemented
+ */
VOID
NTAPI
PsSetThreadWin32Thread(IN PETHREAD Thread,
Modified: trunk/reactos/subsystems/win32/win32k/eng/driverobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/driverobj.c (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/driverobj.c Thu Jul 20 18:53:47 2006
@@ -44,16 +44,16 @@
{
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 @@
/* 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 @@
}
/* Free the DRIVEROBJ */
- IntEngLockProcessDriverObjs(PsGetWin32Process());
+ IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
RemoveEntryList(&DrvObjInt->ListEntry);
- IntEngUnLockProcessDriverObjs(PsGetWin32Process());
+ IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process());
EngFreeMem(DrvObjInt);
return TRUE;
Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/desktop.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/desktop.h Thu Jul 20 18:53:47 2006
@@ -200,10 +200,10 @@
HANDLE hDesktopHeap;
ULONG_PTR Delta = 0;
- ASSERT(PsGetWin32Thread()->Desktop != NULL);
- hDesktopHeap = PsGetWin32Thread()->Desktop->hDesktopHeap;
-
- Mapping = PsGetWin32Process()->HeapMappings.Next;
+ ASSERT(PsGetCurrentThreadWin32Thread()->Desktop != NULL);
+ hDesktopHeap = PsGetCurrentThreadWin32Thread()->Desktop->hDesktopHeap;
+
+ Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;
while (Mapping != NULL)
{
if (Mapping->UserMapping == (PVOID)hDesktopHeap)
@@ -224,7 +224,7 @@
{
PW32HEAP_USER_MAPPING Mapping;
- Mapping = PsGetWin32Process()->HeapMappings.Next;
+ Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;
while (Mapping != NULL)
{
if (Mapping->KernelMapping == (PVOID)Desktop->hKernelHeap)
Modified: trunk/reactos/subsystems/win32/win32k/include/object.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/object.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/object.h Thu Jul 20 18:53:47 2006
@@ -80,7 +80,7 @@
PUSER_REFERENCE_ENTRY ref; \
\
ASSERT(_obj_); \
- t = PsGetWin32Thread(); \
+ t = PsGetCurrentThreadWin32Thread(); \
ASSERT(t); \
e = t->ReferencesList.Next; \
ASSERT(e); \
@@ -95,7 +95,7 @@
PW32THREAD t; \
\
ASSERT(_obj_); \
- t = PsGetWin32Thread(); \
+ t = PsGetCurrentThreadWin32Thread(); \
ASSERT(t); \
ASSERT(_ref_); \
(_ref_)->obj = _obj_; \
@@ -113,7 +113,7 @@
PUSER_REFERENCE_ENTRY ref; \
\
ASSERT(_obj_); \
- t = PsGetWin32Thread(); \
+ t = PsGetCurrentThreadWin32Thread(); \
ASSERT(t); \
e = PopEntryList(&t->ReferencesList); \
ASSERT(e); \
Modified: trunk/reactos/subsystems/win32/win32k/include/userfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/userfuncs.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/userfuncs.h Thu Jul 20 18:53:47 2006
@@ -43,7 +43,7 @@
ASSERT(FALSE); \
} \
\
- e = PsGetWin32Thread()->ReferencesList.Next; \
+ e = PsGetCurrentThreadWin32Thread()->ReferencesList.Next; \
while (e) \
{ \
PUSER_REFERENCE_ENTRY ref = CONTAINING_RECORD(e, USER_REFERENCE_ENTRY, Entry); \
Modified: trunk/reactos/subsystems/win32/win32k/misc/usrheap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/mi…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/misc/usrheap.c (original)
+++ trunk/reactos/subsystems/win32/win32k/misc/usrheap.c Thu Jul 20 18:53:47 2006
@@ -34,7 +34,7 @@
NTSTATUS Status;
SIZE_T Delta = (SIZE_T)((ULONG_PTR)(*CommitAddress) - (ULONG_PTR)Base);
- W32Process = PsGetWin32Process();
+ W32Process = PsGetCurrentProcessWin32Process();
if (W32Process != NULL)
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/callback.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/callback.c Thu Jul 20 18:53:47 2006
@@ -59,7 +59,7 @@
return NULL;
}
- W32Thread = PsGetWin32Thread();
+ W32Thread = PsGetCurrentThreadWin32Thread();
ASSERT(W32Thread);
/* insert the callback memory into the thread's callback list */
@@ -79,7 +79,7 @@
Mem = ((PINT_CALLBACK_HEADER)Data - 1);
- W32Thread = PsGetWin32Thread();
+ W32Thread = PsGetCurrentThreadWin32Thread();
ASSERT(W32Thread);
/* remove the memory block from the thread's callback list */
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/caret.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/caret.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/caret.c Thu Jul 20 18:53:47 2006
@@ -61,7 +61,7 @@
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 @@
PWINSTATION_OBJECT WinStaObject;
UINT Ret;
- WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
+ WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
Ret = WinStaObject->CaretBlinkRate;
if(!Ret)
@@ -172,7 +172,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
RETURN(FALSE);
}
- ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
+ ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
if (ThreadQueue->CaretInfo->Visible)
{
@@ -381,7 +381,7 @@
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))
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c Thu Jul 20 18:53:47 2006
@@ -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 @@
CHECK_LOCK
tempClipboardWindow = hWnd;
- ClipboardThread = PsGetWin32Thread();
+ ClipboardThread = PsGetCurrentThreadWin32Thread();
return TRUE;
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c Thu Jul 20 18:53:47 2006
@@ -334,7 +334,7 @@
PW32PROCESS Win32Process;
PCURICON_PROCESS Current;
- Win32Process = PsGetWin32Process();
+ Win32Process = PsGetCurrentProcessWin32Process();
LIST_FOR_EACH(Current, &CurIcon->ProcessList, CURICON_PROCESS, ListEntry)
{
@@ -430,7 +430,7 @@
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)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c Thu Jul 20 18:53:47 2006
@@ -572,7 +572,7 @@
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 @@
*/
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 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 @@
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 @@
* 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 @@
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 @@
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 @@
BOOL MapHeap;
MapHeap = (PsGetCurrentProcess() != PsInitialSystemProcess);
- W32Thread = PsGetWin32Thread();
+ W32Thread = PsGetCurrentThreadWin32Thread();
if (W32Thread->Desktop != DesktopObject)
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c Thu Jul 20 18:53:47 2006
@@ -42,7 +42,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
ASSERT_REFS_CO(Window);
- ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
+ ThreadQueue =
(PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
if (Window->Style & (WS_MINIMIZE | WS_DISABLED))
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/guicheck.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/guicheck.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/guicheck.c Thu Jul 20 18:53:47 2006
@@ -79,7 +79,7 @@
{
PW32PROCESS W32Data;
- W32Data = PsGetWin32Process();
+ W32Data = PsGetCurrentProcessWin32Process();
if (Create)
{
if (! (W32Data->Flags & W32PF_CREATEDWINORDC) && !
(W32Data->Flags & W32PF_MANUALGUICHECK))
@@ -106,7 +106,7 @@
DPRINT("Enter NtUserManualGuiCheck\n");
UserEnterExclusive();
- W32Data = PsGetWin32Process();
+ W32Data = PsGetCurrentProcessWin32Process();
if (0 == Check)
{
W32Data->Flags |= W32PF_MANUALGUICHECK;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/hook.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/hook.c Thu Jul 20 18:53:47 2006
@@ -290,7 +290,7 @@
ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
- Win32Thread = PsGetWin32Thread();
+ Win32Thread = PsGetCurrentThreadWin32Thread();
if (NULL == Win32Thread)
{
Table = NULL;
@@ -343,7 +343,7 @@
}
else
{
- IntReleaseHookChain(MsqGetHooks(PsGetWin32Thread()->MessageQueue), HookId,
WinStaObj);
+ IntReleaseHookChain(MsqGetHooks(PsGetCurrentThreadWin32Thread()->MessageQueue),
HookId, WinStaObj);
IntReleaseHookChain(GlobalHooks, HookId, WinStaObj);
ObDereferenceObject(WinStaObj);
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/input.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c Thu Jul 20 18:53:47 2006
@@ -1003,7 +1003,7 @@
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 @@
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 @@
DPRINT("Enter NtUserSendInput\n");
UserEnterExclusive();
- W32Thread = PsGetWin32Thread();
+ W32Thread = PsGetCurrentThreadWin32Thread();
ASSERT(W32Thread);
if(!W32Thread->Desktop)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c Thu Jul 20 18:53:47 2006
@@ -430,8 +430,8 @@
pwszBuff,
cchBuff,
wFlags,
- PsGetWin32Thread() ?
- PsGetWin32Thread()->KeyboardLayout : 0 );
+ PsGetCurrentThreadWin32Thread() ?
+
PsGetCurrentThreadWin32Thread()->KeyboardLayout : 0 );
}
return ToUnicodeResult;
@@ -716,7 +716,7 @@
DWORD ScanCode = 0;
- keyLayout = PsGetWin32Thread()->KeyboardLayout;
+ keyLayout = PsGetCurrentThreadWin32Thread()->KeyboardLayout;
if( !keyLayout )
return FALSE;
@@ -726,7 +726,7 @@
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 @@
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 @@
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 @@
DPRINT("Enter NtUserMapVirtualKeyEx\n");
UserEnterExclusive();
- keyLayout = PsGetWin32Thread() ? PsGetWin32Thread()->KeyboardLayout : 0;
+ keyLayout = PsGetCurrentThreadWin32Thread() ?
PsGetCurrentThreadWin32Thread()->KeyboardLayout : 0;
if( !keyLayout )
RETURN(0);
@@ -1049,8 +1049,8 @@
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 @@
PKBDTABLES layout;
if (!dwThreadId)
- W32Thread = PsGetWin32Thread();
+ W32Thread = PsGetCurrentThreadWin32Thread();
else
{
Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread);//fixme: deref
thread
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/menu.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/menu.c Thu Jul 20 18:53:47 2006
@@ -352,7 +352,7 @@
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 @@
Menu->MenuItemList = NULL;
/* Insert menu item into process menu handle list */
- InsertTailList(&PsGetWin32Process()->MenuListHead, &Menu->ListEntry);
+ InsertTailList(&PsGetCurrentProcessWin32Process()->MenuListHead,
&Menu->ListEntry);
IntCloneMenuItems(Menu, Source);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/message.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c Thu Jul 20 18:53:47 2006
@@ -663,7 +663,7 @@
/* 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 @@
;
/* 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 @@
NTSTATUS Status;
USER_MESSAGE Msg;
- ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
+ ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
do
{
@@ -1176,7 +1176,7 @@
if (WM_QUIT == Msg)
{
- MsqPostQuitMessage(PsGetWin32Thread()->MessageQueue, wParam);
+ MsqPostQuitMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, wParam);
}
else if (Wnd == HWND_BROADCAST)
{
@@ -1221,7 +1221,7 @@
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 @@
UserRefObjectCo(Window, &Ref);
- Win32Thread = PsGetWin32Thread();
+ Win32Thread = PsGetCurrentThreadWin32Thread();
if (NULL != Win32Thread &&
Window->MessageQueue == Win32Thread->MessageQueue)
@@ -1507,7 +1507,7 @@
return 0;
}
- if(Window->MessageQueue != PsGetWin32Thread()->MessageQueue)
+ if(Window->MessageQueue != PsGetCurrentThreadWin32Thread()->MessageQueue)
{
Result = UserPostMessage(hWnd, Msg, wParam, lParam);
}
@@ -1556,8 +1556,8 @@
/* 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 @@
DPRINT("Enter NtUserGetQueueStatus\n");
UserEnterExclusive();
- Queue = PsGetWin32Thread()->MessageQueue;
+ Queue = PsGetCurrentThreadWin32Thread()->MessageQueue;
Result = MAKELONG(Queue->QueueBits, Queue->ChangedBits);
if (ClearChanges)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c Thu Jul 20 18:53:47 2006
@@ -23,7 +23,7 @@
if( !pmPrimitiveMessageQueue )
{
PW32THREAD pThread;
- pThread = PsGetWin32Thread();
+ pThread = PsGetCurrentThreadWin32Thread();
if( pThread && pThread->MessageQueue )
{
pmPrimitiveMessageQueue = pThread->MessageQueue;
@@ -182,7 +182,7 @@
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 @@
case ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING:
{
BOOL Enable;
- PW32PROCESS Process = PsGetWin32Process();
+ PW32PROCESS Process = PsGetCurrentProcessWin32Process();
if(Process != NULL)
{
@@ -1244,7 +1244,7 @@
case SPI_SETWORKAREA:
{
RECT *rc;
- PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
+ PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
if(!Desktop)
{
@@ -1260,7 +1260,7 @@
}
case SPI_GETWORKAREA:
{
- PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
+ PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
if(!Desktop)
{
@@ -1898,7 +1898,7 @@
GetW32ProcessInfo(VOID)
{
PW32PROCESSINFO pi;
- PW32PROCESS W32Process = PsGetWin32Process();
+ PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
if (W32Process == NULL)
{
@@ -1938,7 +1938,7 @@
{
PTEB Teb;
PW32THREADINFO ti;
- PW32THREAD W32Thread = PsGetWin32Thread();
+ PW32THREAD W32Thread = PsGetCurrentThreadWin32Thread();
if (W32Thread == NULL)
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c Thu Jul 20 18:53:47 2006
@@ -71,7 +71,7 @@
PUSER_MESSAGE_QUEUE MessageQueue;
HANDLE MessageEventHandle;
- Win32Thread = PsGetWin32Thread();
+ Win32Thread = PsGetCurrentThreadWin32Thread();
if (Win32Thread == NULL || Win32Thread->MessageQueue == NULL)
return 0;
@@ -88,7 +88,7 @@
PW32THREAD Win32Thread;
PUSER_MESSAGE_QUEUE MessageQueue;
- Win32Thread = PsGetWin32Thread();
+ Win32Thread = PsGetCurrentThreadWin32Thread();
if (Win32Thread == NULL || Win32Thread->MessageQueue == NULL)
return FALSE;
@@ -206,12 +206,12 @@
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 @@
USER_REFERENCE_ENTRY Ref;
if( !IntGetScreenDC() ||
- PsGetWin32Thread()->MessageQueue == W32kGetPrimitiveMessageQueue() )
+ PsGetCurrentThreadWin32Thread()->MessageQueue ==
W32kGetPrimitiveMessageQueue() )
{
RETURN(FALSE);
}
@@ -1051,7 +1051,7 @@
KeInitializeEvent(&CompletionEvent, NotificationEvent, FALSE);
- ThreadQueue = PsGetWin32Thread()->MessageQueue;
+ ThreadQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
ASSERT(ThreadQueue != MessageQueue);
Timeout.QuadPart = (LONGLONG) uTimeout * (LONGLONG) -10000;
@@ -1540,7 +1540,7 @@
LPARAM Ret;
PUSER_MESSAGE_QUEUE MessageQueue;
- MessageQueue = PsGetWin32Thread()->MessageQueue;
+ MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
if(!MessageQueue)
{
return 0;
@@ -1557,7 +1557,7 @@
{
PUSER_MESSAGE_QUEUE MessageQueue;
- MessageQueue = PsGetWin32Thread()->MessageQueue;
+ MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
if(!MessageQueue)
{
return 0;
@@ -1808,7 +1808,7 @@
Msg->lParam = (LPARAM) Timer->TimerFunc;
KeQueryTickCount(&LargeTickCount);
Msg->time = LargeTickCount.u.LowPart;
- IntGetCursorLocation(PsGetWin32Thread()->Desktop->WindowStation,
+ IntGetCursorLocation(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
&Msg->pt);
if (Restart)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c Thu Jul 20 18:53:47 2006
@@ -656,7 +656,7 @@
(MsgFilterMin > WM_PAINT || MsgFilterMax < WM_PAINT))
return FALSE;
- Message->hwnd = IntFindWindowToRepaint(UserGetDesktopWindow(),
PsGetWin32Thread());
+ Message->hwnd = IntFindWindowToRepaint(UserGetDesktopWindow(),
PsGetCurrentThreadWin32Thread());
if (Message->hwnd == NULL)
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/timer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/timer.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/timer.c Thu Jul 20 18:53:47 2006
@@ -83,7 +83,7 @@
HintIndex = ++IDEvent;
IntUnlockWindowlessTimerBitmap();
Ret = IDEvent;
- MessageQueue = PsGetWin32Thread()->MessageQueue;
+ MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
}
else
{
@@ -151,7 +151,7 @@
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");
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/useratom.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/useratom.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/useratom.c Thu Jul 20 18:53:47 2006
@@ -36,12 +36,12 @@
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 @@
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)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c Thu Jul 20 18:53:47 2006
@@ -714,7 +714,7 @@
if(bRevert)
{
- W32Thread = PsGetWin32Thread();
+ W32Thread = PsGetCurrentThreadWin32Thread();
if(!W32Thread->Desktop)
return NULL;
@@ -1426,7 +1426,7 @@
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 @@
/* 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 @@
RETURN(NULL);
}
- WinSta = PsGetWin32Thread()->Desktop->WindowStation;
+ WinSta = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
//FIXME: Reference thread/desktop instead
ObReferenceObjectByPointer(WinSta, KernelMode, ExWindowStationObjectType, 0);
@@ -1531,10 +1531,10 @@
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 @@
IntSetMenu(Window, hMenu, &MenuChanged);
}
- Window->MessageQueue = PsGetWin32Thread()->MessageQueue;
+ Window->MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
IntReferenceMessageQueue(Window->MessageQueue);
Window->Parent = ParentWindow;
@@ -1664,7 +1664,7 @@
}
/* 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 @@
continue;
}
- if (IntWndBelongsToThread(Child, PsGetWin32Thread()))
+ if (IntWndBelongsToThread(Child, PsGetCurrentThreadWin32Thread()))
{
USER_REFERENCE_ENTRY ChildRef;
UserRefObjectCo(Child, &ChildRef);//temp hack?
@@ -2277,7 +2277,7 @@
}
/* Destroy the window storage */
- co_UserFreeWindow(Window, PsGetWin32Process(), PsGetWin32Thread(), TRUE);
+ co_UserFreeWindow(Window, PsGetCurrentProcessWin32Process(),
PsGetCurrentThreadWin32Thread(), TRUE);
return TRUE;
}
@@ -4456,7 +4456,7 @@
//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)
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c Thu Jul 20 18:53:47 2006
@@ -263,7 +263,7 @@
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 @@
{
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);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c Thu Jul 20 18:53:47 2006
@@ -894,7 +894,7 @@
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 @@
* just a temporary hack, this will be gone soon
*/
- if(PsGetWin32Thread() != NULL && PsGetWin32Thread()->Desktop != NULL)
- {
- WinStaObj = PsGetWin32Thread()->Desktop->WindowStation;
+ if(PsGetCurrentThreadWin32Thread() != NULL &&
PsGetCurrentThreadWin32Thread()->Desktop != NULL)
+ {
+ WinStaObj = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
ObReferenceObjectByPointer(WinStaObj, KernelMode, ExWindowStationObjectType, 0);
}
else if(PsGetCurrentProcess() != CsrProcess)
@@ -1045,7 +1045,7 @@
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 @@
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);
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c Thu Jul 20 18:53:47 2006
@@ -340,7 +340,7 @@
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 @@
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 */
Modified: trunk/reactos/subsystems/win32/win32k/objects/text.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/text.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/text.c Thu Jul 20 18:53:47 2006
@@ -363,7 +363,7 @@
if (Characteristics & FR_PRIVATE)
{
- PW32PROCESS Win32Process = PsGetWin32Process();
+ PW32PROCESS Win32Process = PsGetCurrentProcessWin32Process();
IntLockProcessPrivateFonts(Win32Process);
InsertTailList(&Win32Process->PrivateFontListHead,
&Entry->ListEntry);
IntUnLockProcessPrivateFonts(Win32Process);
@@ -983,7 +983,7 @@
PFONTGDI Font;
/* Search the process local list */
- Win32Process = PsGetWin32Process();
+ Win32Process = PsGetCurrentProcessWin32Process();
IntLockProcessPrivateFonts(Win32Process);
Font = FindFaceNameInList(FaceName, &Win32Process->PrivateFontListHead);
IntUnLockProcessPrivateFonts(Win32Process);
@@ -1391,7 +1391,7 @@
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 @@
TextObj->Font = NULL;
/* First search private fonts */
- Win32Process = PsGetWin32Process();
+ Win32Process = PsGetCurrentProcessWin32Process();
IntLockProcessPrivateFonts(Win32Process);
FindBestFontFromList(&TextObj->Font, &MatchScore,
&TextObj->logfont, &FaceName,
Modified: trunk/reactos/subsystems/win32/win32k/w32k.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/w3…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/w32k.h (original)
+++ trunk/reactos/subsystems/win32/win32k/w32k.h Thu Jul 20 18:53:47 2006
@@ -138,7 +138,7 @@
UserHeapAddressToUser(PVOID lpMem)
{
return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
- (ULONG_PTR)PsGetWin32Process()->HeapMappings.UserMapping);
+
(ULONG_PTR)PsGetCurrentProcessWin32Process()->HeapMappings.UserMapping);
}
#endif /* __W32K_H */