mirror of
https://github.com/reactos/reactos.git
synced 2025-06-05 09:20:30 +00:00
1. removed window station/desktop hacks from ntoskrnl
2. implemented window station/desktop inheritance on thread/process startup 3. implemented process locking 4. fixed some fields in the EPROCESS structure svn path=/trunk/; revision=11712
This commit is contained in:
parent
76bd18b75f
commit
b7100ed2fc
37 changed files with 838 additions and 606 deletions
|
@ -524,7 +524,7 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
WCHAR DesktopName[1];
|
HDESK DesktopHandle;
|
||||||
} CSRSS_CREATE_DESKTOP_REQUEST, *PCSRSS_CREATE_DESKTOP_REQUEST;
|
} CSRSS_CREATE_DESKTOP_REQUEST, *PCSRSS_CREATE_DESKTOP_REQUEST;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: mmtypes.h,v 1.19 2004/07/17 03:04:45 ion Exp $ */
|
/* $Id: mmtypes.h,v 1.20 2004/11/20 16:46:04 weiden Exp $ */
|
||||||
|
|
||||||
#ifndef _INCLUDE_DDK_MMTYPES_H
|
#ifndef _INCLUDE_DDK_MMTYPES_H
|
||||||
#define _INCLUDE_DDK_MMTYPES_H
|
#define _INCLUDE_DDK_MMTYPES_H
|
||||||
|
@ -106,4 +106,36 @@ typedef enum _MEMORY_CACHING_TYPE
|
||||||
MmMaximumCacheType
|
MmMaximumCacheType
|
||||||
} MEMORY_CACHING_TYPE;
|
} MEMORY_CACHING_TYPE;
|
||||||
|
|
||||||
|
typedef struct _MMWSL *PMMWSL;
|
||||||
|
|
||||||
|
typedef struct _MMSUPPORT_FLAGS {
|
||||||
|
ULONG SessionSpace : 1;
|
||||||
|
ULONG BeingTrimmed : 1;
|
||||||
|
ULONG SessionLeader : 1;
|
||||||
|
ULONG TrimHard : 1;
|
||||||
|
ULONG WorkingSetHard : 1;
|
||||||
|
ULONG AddressSpaceBeingDeleted : 1;
|
||||||
|
ULONG Available : 10;
|
||||||
|
ULONG AllowWorkingSetAdjustment : 8;
|
||||||
|
ULONG MemoryPriority : 8;
|
||||||
|
} MMSUPPORT_FLAGS, *PMMSUPPORT_FLAGS;
|
||||||
|
|
||||||
|
typedef struct _MMSUPPORT
|
||||||
|
{
|
||||||
|
LARGE_INTEGER LastTrimTime;
|
||||||
|
MMSUPPORT_FLAGS Flags;
|
||||||
|
ULONG PageFaultCount;
|
||||||
|
ULONG PeakWorkingSetSize;
|
||||||
|
ULONG WorkingSetSize;
|
||||||
|
ULONG MinimumWorkingSetSize;
|
||||||
|
ULONG MaximumWorkingSetSize;
|
||||||
|
PMMWSL VmWorkingSetList;
|
||||||
|
LIST_ENTRY WorkingSetExpansionLinks;
|
||||||
|
ULONG Claim;
|
||||||
|
ULONG NextEstimationSlot;
|
||||||
|
ULONG NextAgingSlot;
|
||||||
|
ULONG EstimatedAvailable;
|
||||||
|
ULONG GrowthSinceLastEstimate;
|
||||||
|
} MMSUPPORT, *PMMSUPPORT;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,8 +31,6 @@ typedef struct _W32PROCESS
|
||||||
FAST_MUTEX CursorIconListLock;
|
FAST_MUTEX CursorIconListLock;
|
||||||
LIST_ENTRY CursorIconListHead;
|
LIST_ENTRY CursorIconListHead;
|
||||||
struct _KBDTABLES* KeyboardLayout;
|
struct _KBDTABLES* KeyboardLayout;
|
||||||
struct _WINSTATION_OBJECT* WindowStation;
|
|
||||||
HANDLE hWindowStation;
|
|
||||||
ULONG Flags;
|
ULONG Flags;
|
||||||
WORD GDIObjects;
|
WORD GDIObjects;
|
||||||
WORD UserObjects;
|
WORD UserObjects;
|
||||||
|
|
|
@ -1231,8 +1231,7 @@ extern IMPORTED ULONG NtBuildNumber;
|
||||||
#define ProcessWow64Information 26
|
#define ProcessWow64Information 26
|
||||||
/* ReactOS private. */
|
/* ReactOS private. */
|
||||||
#define ProcessImageFileName 27
|
#define ProcessImageFileName 27
|
||||||
#define ProcessDesktop 28
|
#define MaxProcessInfoClass 28
|
||||||
#define MaxProcessInfoClass 29
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* thread query / set information class
|
* thread query / set information class
|
||||||
|
|
|
@ -35,16 +35,23 @@ POBJECT_TYPE EXPORTED ExWindowStationObjectType = NULL;
|
||||||
POBJECT_TYPE EXPORTED ExDesktopObjectType = NULL;
|
POBJECT_TYPE EXPORTED ExDesktopObjectType = NULL;
|
||||||
|
|
||||||
static GENERIC_MAPPING ExpWindowStationMapping = {
|
static GENERIC_MAPPING ExpWindowStationMapping = {
|
||||||
FILE_GENERIC_READ,
|
STANDARD_RIGHTS_READ | WINSTA_ENUMDESKTOPS | WINSTA_ENUMERATE | WINSTA_READATTRIBUTES | WINSTA_READSCREEN,
|
||||||
FILE_GENERIC_WRITE,
|
STANDARD_RIGHTS_WRITE | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | WINSTA_WRITEATTRIBUTES,
|
||||||
FILE_GENERIC_EXECUTE,
|
STANDARD_RIGHTS_EXECUTE | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS,
|
||||||
FILE_ALL_ACCESS };
|
STANDARD_RIGHTS_REQUIRED | WINSTA_ACCESSCLIPBOARD | WINSTA_ACCESSGLOBALATOMS | WINSTA_CREATEDESKTOP |
|
||||||
|
WINSTA_ENUMDESKTOPS | WINSTA_ENUMERATE | WINSTA_EXITWINDOWS |
|
||||||
|
WINSTA_READATTRIBUTES | WINSTA_READSCREEN | WINSTA_WRITEATTRIBUTES
|
||||||
|
};
|
||||||
|
|
||||||
static GENERIC_MAPPING ExpDesktopMapping = {
|
static GENERIC_MAPPING ExpDesktopMapping = {
|
||||||
FILE_GENERIC_READ,
|
STANDARD_RIGHTS_READ | DESKTOP_ENUMERATE | DESKTOP_READOBJECTS,
|
||||||
FILE_GENERIC_WRITE,
|
STANDARD_RIGHTS_WRITE | DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_HOOKCONTROL |
|
||||||
FILE_GENERIC_EXECUTE,
|
DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD | DESKTOP_WRITEOBJECTS,
|
||||||
FILE_ALL_ACCESS };
|
STANDARD_RIGHTS_EXECUTE | DESKTOP_SWITCHDESKTOP,
|
||||||
|
STANDARD_RIGHTS_REQUIRED | DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE |
|
||||||
|
DESKTOP_HOOKCONTROL | DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD |
|
||||||
|
DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS
|
||||||
|
};
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,19 @@ ULONG PagefileUsage;
|
||||||
ULONG PagefileLimit;
|
ULONG PagefileLimit;
|
||||||
} EPROCESS_QUOTA_BLOCK, *PEPROCESS_QUOTA_BLOCK;
|
} EPROCESS_QUOTA_BLOCK, *PEPROCESS_QUOTA_BLOCK;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* header mess....
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _PAGEFAULT_HISTORY
|
||||||
|
{
|
||||||
|
ULONG CurrentIndex;
|
||||||
|
ULONG MaxIndex;
|
||||||
|
KSPIN_LOCK SpinLock;
|
||||||
|
PVOID Reserved;
|
||||||
|
struct _PROCESS_WS_WATCH_INFORMATION WatchInfo[1];
|
||||||
|
} PAGEFAULT_HISTORY, *PPAGEFAULT_HISTORY;
|
||||||
|
|
||||||
#endif /* __USE_W32API */
|
#endif /* __USE_W32API */
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: ps.h,v 1.74 2004/11/11 22:23:52 ion Exp $
|
/* $Id: ps.h,v 1.75 2004/11/20 16:46:05 weiden Exp $
|
||||||
*
|
*
|
||||||
* FILE: ntoskrnl/ke/kthread.c
|
* FILE: ntoskrnl/ke/kthread.c
|
||||||
* PURPOSE: Process manager definitions
|
* PURPOSE: Process manager definitions
|
||||||
|
@ -283,6 +283,27 @@ typedef struct _KPROCESS
|
||||||
|
|
||||||
typedef struct _KPROCESS *PKPROCESS;
|
typedef struct _KPROCESS *PKPROCESS;
|
||||||
|
|
||||||
|
typedef struct _HARDWARE_PTE_X86 {
|
||||||
|
ULONG Valid : 1;
|
||||||
|
ULONG Write : 1;
|
||||||
|
ULONG Owner : 1;
|
||||||
|
ULONG WriteThrough : 1;
|
||||||
|
ULONG CacheDisable : 1;
|
||||||
|
ULONG Accessed : 1;
|
||||||
|
ULONG Dirty : 1;
|
||||||
|
ULONG LargePage : 1;
|
||||||
|
ULONG Global : 1;
|
||||||
|
ULONG CopyOnWrite : 1;
|
||||||
|
ULONG Prototype : 1;
|
||||||
|
ULONG reserved : 1;
|
||||||
|
ULONG PageFrameNumber : 20;
|
||||||
|
} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
|
||||||
|
|
||||||
|
typedef struct _WOW64_PROCESS
|
||||||
|
{
|
||||||
|
PVOID Wow64;
|
||||||
|
} WOW64_PROCESS, *PWOW64_PROCESS;
|
||||||
|
|
||||||
#endif /* __USE_W32API */
|
#endif /* __USE_W32API */
|
||||||
|
|
||||||
struct _EPROCESS
|
struct _EPROCESS
|
||||||
|
@ -306,7 +327,7 @@ struct _EPROCESS
|
||||||
/* Time of process exit. */
|
/* Time of process exit. */
|
||||||
TIME ExitTime; /* 088 */
|
TIME ExitTime; /* 088 */
|
||||||
/* Unknown. */
|
/* Unknown. */
|
||||||
PVOID LockOwner; /* 090 */
|
PKTHREAD LockOwner; /* 090 */
|
||||||
/* Process id. */
|
/* Process id. */
|
||||||
ULONG UniqueProcessId; /* 094 */
|
ULONG UniqueProcessId; /* 094 */
|
||||||
/* Unknown. */
|
/* Unknown. */
|
||||||
|
@ -325,30 +346,15 @@ struct _EPROCESS
|
||||||
ULONG PeakVirtualSize; /* 0BC */
|
ULONG PeakVirtualSize; /* 0BC */
|
||||||
/* Unknown. */
|
/* Unknown. */
|
||||||
LARGE_INTEGER VirtualSize; /* 0C0 */
|
LARGE_INTEGER VirtualSize; /* 0C0 */
|
||||||
struct
|
|
||||||
{
|
MMSUPPORT Vm;
|
||||||
ULONG LastTrimTime;
|
LIST_ENTRY SessionProcessLinks;
|
||||||
ULONG LastTrimFaultCount;
|
struct _EPORT *DebugPort;
|
||||||
ULONG PageFaultCount;
|
struct _EPORT *ExceptionPort;
|
||||||
ULONG PeakWorkingSetSize;
|
HANDLE_TABLE HandleTable;
|
||||||
ULONG WorkingSetSize;
|
|
||||||
ULONG MinimumWorkingSetSize;
|
|
||||||
ULONG MaximumWorkingSetSize;
|
|
||||||
ULONG VmWorkingSetList;
|
|
||||||
LIST_ENTRY WorkingSetExpansionList;
|
|
||||||
UCHAR AllowWorkingSetAdjustment;
|
|
||||||
UCHAR AddressSpaceBeingDeleted;
|
|
||||||
UCHAR ForegroundPrioritySwitch;
|
|
||||||
UCHAR MemoryPriority;
|
|
||||||
} Vm;
|
|
||||||
PVOID LastProtoPteFault;
|
|
||||||
struct _EPORT* DebugPort;
|
|
||||||
struct _EPORT* ExceptionPort;
|
|
||||||
PVOID ObjectTable;
|
|
||||||
PVOID Token;
|
PVOID Token;
|
||||||
/* FAST_MUTEX WorkingSetLock; */
|
FAST_MUTEX WorkingSetLock;
|
||||||
KMUTEX WorkingSetLock;
|
ULONG WorkingSetPage;
|
||||||
PVOID WorkingSetPage;
|
|
||||||
UCHAR ProcessOutswapEnabled;
|
UCHAR ProcessOutswapEnabled;
|
||||||
UCHAR ProcessOutswapped;
|
UCHAR ProcessOutswapped;
|
||||||
UCHAR AddressSpaceInitialized;
|
UCHAR AddressSpaceInitialized;
|
||||||
|
@ -360,14 +366,15 @@ struct _EPROCESS
|
||||||
UCHAR ForkWasSuccessful;
|
UCHAR ForkWasSuccessful;
|
||||||
UCHAR MmAgressiveWsTrimMask;
|
UCHAR MmAgressiveWsTrimMask;
|
||||||
PKEVENT VmOperationEvent;
|
PKEVENT VmOperationEvent;
|
||||||
PVOID PageDirectoryPte;
|
PVOID PaeTop;
|
||||||
ULONG LastFaultCount;
|
ULONG LastFaultCount;
|
||||||
|
ULONG ModifiedPageCount;
|
||||||
PVOID VadRoot;
|
PVOID VadRoot;
|
||||||
PVOID VadHint;
|
PVOID VadHint;
|
||||||
PVOID CloneRoot;
|
PVOID CloneRoot;
|
||||||
ULONG NumberOfPrivatePages;
|
ULONG NumberOfPrivatePages;
|
||||||
ULONG NumberOfLockedPages;
|
ULONG NumberOfLockedPages;
|
||||||
USHORT NextProcessColour;
|
USHORT NextPageColor;
|
||||||
UCHAR ExitProcessCalled;
|
UCHAR ExitProcessCalled;
|
||||||
UCHAR CreateProcessReported;
|
UCHAR CreateProcessReported;
|
||||||
HANDLE SectionHandle;
|
HANDLE SectionHandle;
|
||||||
|
@ -375,14 +382,20 @@ struct _EPROCESS
|
||||||
PVOID SectionBaseAddress;
|
PVOID SectionBaseAddress;
|
||||||
PEPROCESS_QUOTA_BLOCK QuotaBlock;
|
PEPROCESS_QUOTA_BLOCK QuotaBlock;
|
||||||
NTSTATUS LastThreadExitStatus;
|
NTSTATUS LastThreadExitStatus;
|
||||||
PVOID WorkingSetWatch;
|
PPAGEFAULT_HISTORY WorkingSetWatch;
|
||||||
|
HANDLE Win32WindowStation;
|
||||||
HANDLE InheritedFromUniqueProcessId;
|
HANDLE InheritedFromUniqueProcessId;
|
||||||
ACCESS_MASK GrantedAccess;
|
ULONG GrantedAccess;
|
||||||
ULONG DefaultHardErrorProcessing;
|
ULONG DefaultHardErrorProcessing;
|
||||||
PVOID LdtInformation;
|
PVOID LdtInformation;
|
||||||
ULONG VadFreeHint;
|
PVOID VadFreeHint;
|
||||||
PVOID VdmObjects;
|
PVOID VdmObjects;
|
||||||
KMUTANT ProcessMutant;
|
PVOID DeviceObjects;
|
||||||
|
ULONG SessionId;
|
||||||
|
LIST_ENTRY PhysicalVadList;
|
||||||
|
HARDWARE_PTE_X86 PageDirectoryPte;
|
||||||
|
ULONGLONG Filler;
|
||||||
|
ULONG PaePageDirectoryPage;
|
||||||
CHAR ImageFileName[16];
|
CHAR ImageFileName[16];
|
||||||
ULONG VmTrimFaultValue;
|
ULONG VmTrimFaultValue;
|
||||||
UCHAR SetTimerResolution;
|
UCHAR SetTimerResolution;
|
||||||
|
@ -390,29 +403,31 @@ struct _EPROCESS
|
||||||
UCHAR SubSystemMinorVersion;
|
UCHAR SubSystemMinorVersion;
|
||||||
UCHAR SubSystemMajorVersion;
|
UCHAR SubSystemMajorVersion;
|
||||||
USHORT SubSystemVersion;
|
USHORT SubSystemVersion;
|
||||||
struct _W32PROCESS* Win32Process;
|
struct _W32PROCESS *Win32Process;
|
||||||
HANDLE Win32WindowStation;
|
struct _EJOB *Job;
|
||||||
|
ULONG JobStatus;
|
||||||
|
LIST_ENTRY JobLinks;
|
||||||
|
PVOID LockedPagesList;
|
||||||
|
struct _EPORT *SecurityPort;
|
||||||
|
PWOW64_PROCESS Wow64;
|
||||||
|
LARGE_INTEGER ReadOperationCount;
|
||||||
|
LARGE_INTEGER WriteOperationCount;
|
||||||
|
LARGE_INTEGER OtherOperationCount;
|
||||||
|
LARGE_INTEGER ReadTransferCount;
|
||||||
|
LARGE_INTEGER WriteTransferCount;
|
||||||
|
LARGE_INTEGER OtherTransferCount;
|
||||||
|
ULONG CommitChargeLimit;
|
||||||
|
ULONG CommitChargePeak;
|
||||||
|
LIST_ENTRY ThreadListHead;
|
||||||
|
PRTL_BITMAP VadPhysicalPagesBitMap;
|
||||||
|
ULONG VadPhysicalPages;
|
||||||
|
KSPIN_LOCK AweLock;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Added by David Welch (welch@mcmail.com)
|
* FIXME - ReactOS specified - remove the following fields ASAP!!!
|
||||||
*/
|
*/
|
||||||
HANDLE Win32Desktop;
|
|
||||||
MADDRESS_SPACE AddressSpace;
|
MADDRESS_SPACE AddressSpace;
|
||||||
HANDLE_TABLE HandleTable;
|
|
||||||
LIST_ENTRY ProcessListEntry;
|
LIST_ENTRY ProcessListEntry;
|
||||||
|
|
||||||
/*
|
|
||||||
* Added by Philip Susi for list of threads in process
|
|
||||||
*/
|
|
||||||
LIST_ENTRY ThreadListHead;
|
|
||||||
|
|
||||||
/* Added by Alex Ionescu (alex@relsoft.net)*/
|
|
||||||
ULONG SessionId;
|
|
||||||
struct _EPORT* SecurityPort;
|
|
||||||
|
|
||||||
struct _EJOB* Job;
|
|
||||||
UINT JobStatus;
|
|
||||||
|
|
||||||
FAST_MUTEX TebLock;
|
FAST_MUTEX TebLock;
|
||||||
PVOID TebBlock;
|
PVOID TebBlock;
|
||||||
PVOID TebLastAllocated;
|
PVOID TebLastAllocated;
|
||||||
|
@ -651,6 +666,8 @@ NTSTATUS PsCreateCidHandle(PVOID Object, POBJECT_TYPE ObjectType, PHANDLE Handle
|
||||||
NTSTATUS PsDeleteCidHandle(HANDLE CidHandle, POBJECT_TYPE ObjectType);
|
NTSTATUS PsDeleteCidHandle(HANDLE CidHandle, POBJECT_TYPE ObjectType);
|
||||||
PCID_OBJECT PsLockCidHandle(HANDLE CidHandle, POBJECT_TYPE ObjectType);
|
PCID_OBJECT PsLockCidHandle(HANDLE CidHandle, POBJECT_TYPE ObjectType);
|
||||||
VOID PsUnlockCidObject(PCID_OBJECT CidObject);
|
VOID PsUnlockCidObject(PCID_OBJECT CidObject);
|
||||||
|
NTSTATUS PsLockProcess(PEPROCESS Process, BOOL Timeout);
|
||||||
|
VOID PsUnlockProcess(PEPROCESS Process);
|
||||||
|
|
||||||
#define ETHREAD_TO_KTHREAD(pEThread) (&(pEThread)->Tcb)
|
#define ETHREAD_TO_KTHREAD(pEThread) (&(pEThread)->Tcb)
|
||||||
#define KTHREAD_TO_ETHREAD(pKThread) (CONTAINING_RECORD((pKThread), ETHREAD, Tcb))
|
#define KTHREAD_TO_ETHREAD(pKThread) (CONTAINING_RECORD((pKThread), ETHREAD, Tcb))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: create.c,v 1.85 2004/11/10 02:51:00 ion Exp $
|
/* $Id: create.c,v 1.86 2004/11/20 16:46:05 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -387,6 +387,12 @@ PiDeleteThread(PVOID ObjectBody)
|
||||||
|
|
||||||
PsDeleteCidHandle(Thread->Cid.UniqueThread, PsThreadType);
|
PsDeleteCidHandle(Thread->Cid.UniqueThread, PsThreadType);
|
||||||
|
|
||||||
|
if(Thread->Tcb.Win32Thread != NULL)
|
||||||
|
{
|
||||||
|
/* Free the W32THREAD structure if present */
|
||||||
|
ExFreePool (Thread->Tcb.Win32Thread);
|
||||||
|
}
|
||||||
|
|
||||||
KeReleaseThread(ETHREAD_TO_KTHREAD(Thread));
|
KeReleaseThread(ETHREAD_TO_KTHREAD(Thread));
|
||||||
|
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: kill.c,v 1.83 2004/11/13 22:27:15 hbirr Exp $
|
/* $Id: kill.c,v 1.84 2004/11/20 16:46:05 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
extern KSPIN_LOCK PiThreadLock;
|
extern KSPIN_LOCK PiThreadLock;
|
||||||
|
|
||||||
VOID PsTerminateCurrentThread(NTSTATUS ExitStatus);
|
VOID PsTerminateCurrentThread(NTSTATUS ExitStatus);
|
||||||
|
NTSTATUS STDCALL NtCallTerminatePorts(PETHREAD Thread);
|
||||||
|
|
||||||
#define TAG_TERMINATE_APC TAG('T', 'A', 'P', 'C')
|
#define TAG_TERMINATE_APC TAG('T', 'A', 'P', 'C')
|
||||||
|
|
||||||
|
@ -136,11 +137,13 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus)
|
||||||
KeQuerySystemTime((PLARGE_INTEGER)&CurrentThread->ExitTime);
|
KeQuerySystemTime((PLARGE_INTEGER)&CurrentThread->ExitTime);
|
||||||
KeCancelTimer(&CurrentThread->Tcb.Timer);
|
KeCancelTimer(&CurrentThread->Tcb.Timer);
|
||||||
|
|
||||||
|
KeReleaseSpinLock(&PiThreadLock, oldIrql);
|
||||||
|
|
||||||
|
PsLockProcess(CurrentProcess, FALSE);
|
||||||
/* Remove the thread from the thread list of its process */
|
/* Remove the thread from the thread list of its process */
|
||||||
RemoveEntryList(&CurrentThread->ThreadListEntry);
|
RemoveEntryList(&CurrentThread->ThreadListEntry);
|
||||||
Last = IsListEmpty(&CurrentProcess->ThreadListHead);
|
Last = IsListEmpty(&CurrentProcess->ThreadListHead);
|
||||||
|
PsUnlockProcess(CurrentProcess);
|
||||||
KeReleaseSpinLock(&PiThreadLock, oldIrql);
|
|
||||||
|
|
||||||
/* Notify subsystems of the thread termination */
|
/* Notify subsystems of the thread termination */
|
||||||
PspRunCreateThreadNotifyRoutines(CurrentThread, FALSE);
|
PspRunCreateThreadNotifyRoutines(CurrentThread, FALSE);
|
||||||
|
@ -188,6 +191,9 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus)
|
||||||
/* The last thread shall close the door on exit */
|
/* The last thread shall close the door on exit */
|
||||||
if(Last)
|
if(Last)
|
||||||
{
|
{
|
||||||
|
/* save the last thread exit status */
|
||||||
|
CurrentProcess->LastThreadExitStatus = ExitStatus;
|
||||||
|
|
||||||
PspRunCreateProcessNotifyRoutines(CurrentProcess, FALSE);
|
PspRunCreateProcessNotifyRoutines(CurrentProcess, FALSE);
|
||||||
PsTerminateWin32Process(CurrentProcess);
|
PsTerminateWin32Process(CurrentProcess);
|
||||||
PiTerminateProcess(CurrentProcess, ExitStatus);
|
PiTerminateProcess(CurrentProcess, ExitStatus);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: process.c,v 1.151 2004/11/13 22:27:15 hbirr Exp $
|
/* $Id: process.c,v 1.152 2004/11/20 16:46:05 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -26,6 +26,7 @@ POBJECT_TYPE EXPORTED PsProcessType = NULL;
|
||||||
LIST_ENTRY PsProcessListHead;
|
LIST_ENTRY PsProcessListHead;
|
||||||
static KSPIN_LOCK PsProcessListLock;
|
static KSPIN_LOCK PsProcessListLock;
|
||||||
static ULONG PiNextProcessUniqueId = 0; /* TODO */
|
static ULONG PiNextProcessUniqueId = 0; /* TODO */
|
||||||
|
static LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
|
||||||
|
|
||||||
static GENERIC_MAPPING PiProcessMapping = {PROCESS_READ,
|
static GENERIC_MAPPING PiProcessMapping = {PROCESS_READ,
|
||||||
PROCESS_WRITE,
|
PROCESS_WRITE,
|
||||||
|
@ -245,6 +246,8 @@ PsInitProcessManagment(VOID)
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
ShortPsLockDelay.QuadPart = -100LL;
|
||||||
|
PsLockTimeout.QuadPart = -10000000LL; /* one second */
|
||||||
/*
|
/*
|
||||||
* Register the process object type
|
* Register the process object type
|
||||||
*/
|
*/
|
||||||
|
@ -315,6 +318,10 @@ PsInitProcessManagment(VOID)
|
||||||
&PsInitialSystemProcess->AddressSpace);
|
&PsInitialSystemProcess->AddressSpace);
|
||||||
ObCreateHandleTable(NULL,FALSE,PsInitialSystemProcess);
|
ObCreateHandleTable(NULL,FALSE,PsInitialSystemProcess);
|
||||||
|
|
||||||
|
KeInitializeEvent(&PsInitialSystemProcess->LockEvent, SynchronizationEvent, FALSE);
|
||||||
|
PsInitialSystemProcess->LockCount = 0;
|
||||||
|
PsInitialSystemProcess->LockOwner = NULL;
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
KProcess->DirectoryTableBase =
|
KProcess->DirectoryTableBase =
|
||||||
(LARGE_INTEGER)(LONGLONG)(ULONG)MmGetPageDirectory();
|
(LARGE_INTEGER)(LONGLONG)(ULONG)MmGetPageDirectory();
|
||||||
|
@ -329,7 +336,6 @@ PsInitProcessManagment(VOID)
|
||||||
PsInitialSystemProcess->UniqueProcessId =
|
PsInitialSystemProcess->UniqueProcessId =
|
||||||
InterlockedIncrement((LONG *)&PiNextProcessUniqueId); /* TODO */
|
InterlockedIncrement((LONG *)&PiNextProcessUniqueId); /* TODO */
|
||||||
PsInitialSystemProcess->Win32WindowStation = (HANDLE)0;
|
PsInitialSystemProcess->Win32WindowStation = (HANDLE)0;
|
||||||
PsInitialSystemProcess->Win32Desktop = (HANDLE)0;
|
|
||||||
|
|
||||||
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
||||||
InsertHeadList(&PsProcessListHead,
|
InsertHeadList(&PsProcessListHead,
|
||||||
|
@ -418,6 +424,12 @@ PiDeleteProcess(PVOID ObjectBody)
|
||||||
KeWaitForSingleObject(&Context.Event, Executive, KernelMode, FALSE, NULL);
|
KeWaitForSingleObject(&Context.Event, Executive, KernelMode, FALSE, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(((PEPROCESS)ObjectBody)->Win32Process != NULL)
|
||||||
|
{
|
||||||
|
/* delete the W32PROCESS structure if there's one associated */
|
||||||
|
ExFreePool (((PEPROCESS)ObjectBody)->Win32Process);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
|
@ -694,47 +706,13 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
ObCreateHandleTable(pParentProcess,
|
ObCreateHandleTable(pParentProcess,
|
||||||
InheritObjectTable,
|
InheritObjectTable,
|
||||||
Process);
|
Process);
|
||||||
MmCopyMmInfo(pParentProcess, Process);
|
MmCopyMmInfo(ParentProcess, Process);
|
||||||
if (pParentProcess->Win32WindowStation != (HANDLE)0)
|
|
||||||
{
|
KeInitializeEvent(&Process->LockEvent, SynchronizationEvent, FALSE);
|
||||||
/* Always duplicate the process window station. */
|
Process->LockCount = 0;
|
||||||
Process->Win32WindowStation = 0;
|
Process->LockOwner = NULL;
|
||||||
Status = ObDuplicateObject(pParentProcess,
|
|
||||||
Process,
|
Process->Win32WindowStation = (HANDLE)0;
|
||||||
pParentProcess->Win32WindowStation,
|
|
||||||
&Process->Win32WindowStation,
|
|
||||||
0,
|
|
||||||
FALSE,
|
|
||||||
DUPLICATE_SAME_ACCESS);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
KEBUGCHECK(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Process->Win32WindowStation = (HANDLE)0;
|
|
||||||
}
|
|
||||||
if (pParentProcess->Win32Desktop != (HANDLE)0)
|
|
||||||
{
|
|
||||||
/* Always duplicate the process window station. */
|
|
||||||
Process->Win32Desktop = 0;
|
|
||||||
Status = ObDuplicateObject(pParentProcess,
|
|
||||||
Process,
|
|
||||||
pParentProcess->Win32Desktop,
|
|
||||||
&Process->Win32Desktop,
|
|
||||||
0,
|
|
||||||
FALSE,
|
|
||||||
DUPLICATE_SAME_ACCESS);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
KEBUGCHECK(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Process->Win32Desktop = (HANDLE)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
||||||
InsertHeadList(&PsProcessListHead, &Process->ProcessListEntry);
|
InsertHeadList(&PsProcessListHead, &Process->ProcessListEntry);
|
||||||
|
@ -1381,11 +1359,6 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
||||||
case ProcessWow64Information:
|
case ProcessWow64Information:
|
||||||
default:
|
default:
|
||||||
Status = STATUS_INVALID_INFO_CLASS;
|
Status = STATUS_INVALID_INFO_CLASS;
|
||||||
|
|
||||||
case ProcessDesktop:
|
|
||||||
Process->Win32Desktop = *(PHANDLE)ProcessInformation;
|
|
||||||
Status = STATUS_SUCCESS;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
return(Status);
|
return(Status);
|
||||||
|
@ -2151,4 +2124,76 @@ PsReturnProcessPagedPoolQuota(
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
PsLockProcess(PEPROCESS Process, BOOL Timeout)
|
||||||
|
{
|
||||||
|
ULONG Attempts = 0;
|
||||||
|
PKTHREAD PrevLockOwner;
|
||||||
|
NTSTATUS Status = STATUS_UNSUCCESSFUL;
|
||||||
|
PLARGE_INTEGER Delay = (Timeout ? &PsLockTimeout : NULL);
|
||||||
|
PKTHREAD CallingThread = KeGetCurrentThread();
|
||||||
|
|
||||||
|
KeEnterCriticalRegion();
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
if(Process->Pcb.State == PROCESS_STATE_TERMINATED)
|
||||||
|
{
|
||||||
|
KeLeaveCriticalRegion();
|
||||||
|
return STATUS_PROCESS_IS_TERMINATING;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME - why don't we have InterlockedCompareExchangePointer in ntoskrnl?! */
|
||||||
|
PrevLockOwner = (PKTHREAD)InterlockedCompareExchange((LONG*)&Process->LockOwner, (LONG)CallingThread, (LONG)NULL);
|
||||||
|
if(PrevLockOwner == NULL || PrevLockOwner == CallingThread)
|
||||||
|
{
|
||||||
|
/* we got the lock or already locked it */
|
||||||
|
if(InterlockedIncrement((LONG*)&Process->LockCount) == 1)
|
||||||
|
{
|
||||||
|
KeClearEvent(&Process->LockEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(++Attempts > 2)
|
||||||
|
{
|
||||||
|
Status = KeWaitForSingleObject(&Process->LockEvent,
|
||||||
|
Executive,
|
||||||
|
KernelMode,
|
||||||
|
FALSE,
|
||||||
|
Delay);
|
||||||
|
if(Status == STATUS_TIMEOUT)
|
||||||
|
{
|
||||||
|
KeLeaveCriticalRegion();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KeDelayExecutionThread(KernelMode, FALSE, &ShortPsLockDelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
PsUnlockProcess(PEPROCESS Process)
|
||||||
|
{
|
||||||
|
assert(Process->LockOwner == KeGetCurrentThread());
|
||||||
|
|
||||||
|
if(InterlockedDecrement((LONG*)&Process->LockCount) == 0)
|
||||||
|
{
|
||||||
|
/* FIXME - why don't we have InterlockedExchangePointer in ntoskrnl?! */
|
||||||
|
InterlockedExchange((LONG*)&Process->LockOwner, (LONG)NULL);
|
||||||
|
KeSetEvent(&Process->LockEvent, IO_NO_INCREMENT, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
KeLeaveCriticalRegion();
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: win32.c,v 1.9 2004/09/28 15:02:29 weiden Exp $
|
/* $Id: win32.c,v 1.10 2004/11/20 16:46:05 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -100,17 +100,20 @@ PsInitWin32Thread (PETHREAD Thread)
|
||||||
|
|
||||||
if (Process->Win32Process == NULL)
|
if (Process->Win32Process == NULL)
|
||||||
{
|
{
|
||||||
|
/* FIXME - lock the process */
|
||||||
Process->Win32Process = ExAllocatePool (NonPagedPool,
|
Process->Win32Process = ExAllocatePool (NonPagedPool,
|
||||||
PspWin32ProcessSize);
|
PspWin32ProcessSize);
|
||||||
|
|
||||||
if (Process->Win32Process == NULL)
|
if (Process->Win32Process == NULL)
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
|
|
||||||
RtlZeroMemory (Process->Win32Process,
|
RtlZeroMemory (Process->Win32Process,
|
||||||
PspWin32ProcessSize);
|
PspWin32ProcessSize);
|
||||||
|
/* FIXME - unlock the process */
|
||||||
|
|
||||||
if (PspWin32ProcessCallback != NULL)
|
if (PspWin32ProcessCallback != NULL)
|
||||||
{
|
{
|
||||||
PspWin32ProcessCallback (Process, TRUE);
|
PspWin32ProcessCallback (Process, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +148,8 @@ PsTerminateWin32Process (PEPROCESS Process)
|
||||||
PspWin32ProcessCallback (Process, FALSE);
|
PspWin32ProcessCallback (Process, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool (Process->Win32Process);
|
/* don't delete the W32PROCESS structure at this point, wait until the
|
||||||
|
EPROCESS structure is being freed */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,7 +163,8 @@ PsTerminateWin32Thread (PETHREAD Thread)
|
||||||
PspWin32ThreadCallback (Thread, FALSE);
|
PspWin32ThreadCallback (Thread, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool (Thread->Tcb.Win32Thread);
|
/* don't delete the W32THREAD structure at this point, wait until the
|
||||||
|
ETHREAD structure is being freed */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: desktopbg.c,v 1.10 2004/09/24 15:07:38 navaraf Exp $
|
/* $Id: desktopbg.c,v 1.11 2004/11/20 16:46:05 weiden Exp $
|
||||||
*
|
*
|
||||||
* reactos/subsys/csrss/win32csr/desktopbg.c
|
* reactos/subsys/csrss/win32csr/desktopbg.c
|
||||||
*
|
*
|
||||||
|
@ -140,22 +140,8 @@ static BOOL FASTCALL
|
||||||
DtbgInit()
|
DtbgInit()
|
||||||
{
|
{
|
||||||
WNDCLASSEXW Class;
|
WNDCLASSEXW Class;
|
||||||
HWINSTA WindowStation;
|
|
||||||
ATOM ClassAtom;
|
ATOM ClassAtom;
|
||||||
|
|
||||||
/* Attach to window station */
|
|
||||||
WindowStation = OpenWindowStationW(L"WinSta0", FALSE, GENERIC_ALL);
|
|
||||||
if (NULL == WindowStation)
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to open window station\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (! SetProcessWindowStation(WindowStation))
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to set process window station\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the desktop window class
|
* Create the desktop window class
|
||||||
*/
|
*/
|
||||||
|
@ -229,7 +215,6 @@ DtbgDesktopThread(PVOID Data)
|
||||||
|
|
||||||
CSR_API(CsrCreateDesktop)
|
CSR_API(CsrCreateDesktop)
|
||||||
{
|
{
|
||||||
HDESK Desktop;
|
|
||||||
DTBG_THREAD_DATA ThreadData;
|
DTBG_THREAD_DATA ThreadData;
|
||||||
HANDLE ThreadHandle;
|
HANDLE ThreadHandle;
|
||||||
|
|
||||||
|
@ -247,16 +232,11 @@ CSR_API(CsrCreateDesktop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Desktop = OpenDesktopW(Request->Data.CreateDesktopRequest.DesktopName,
|
/*
|
||||||
0, FALSE, GENERIC_ALL);
|
* the desktop handle we got from win32k is in the scope of CSRSS so we can just use it
|
||||||
if (NULL == Desktop)
|
*/
|
||||||
{
|
ThreadData.Desktop = Request->Data.CreateDesktopRequest.DesktopHandle;
|
||||||
DPRINT1("Failed to open desktop %S\n",
|
|
||||||
Request->Data.CreateDesktopRequest.DesktopName);
|
|
||||||
return Reply->Status = STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadData.Desktop = Desktop;
|
|
||||||
ThreadData.Event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
ThreadData.Event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||||
if (NULL == ThreadData.Event)
|
if (NULL == ThreadData.Event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: guiconsole.c,v 1.21 2004/09/26 15:55:53 weiden Exp $
|
/* $Id: guiconsole.c,v 1.22 2004/11/20 16:46:05 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -875,31 +875,8 @@ GuiConsoleGuiThread(PVOID Data)
|
||||||
static BOOL FASTCALL
|
static BOOL FASTCALL
|
||||||
GuiInit(VOID)
|
GuiInit(VOID)
|
||||||
{
|
{
|
||||||
HDESK Desktop;
|
|
||||||
NTSTATUS Status;
|
|
||||||
WNDCLASSEXW wc;
|
WNDCLASSEXW wc;
|
||||||
|
|
||||||
Desktop = OpenDesktopW(L"Default", 0, FALSE, GENERIC_ALL);
|
|
||||||
if (NULL == Desktop)
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to open desktop\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
Status = NtSetInformationProcess(NtCurrentProcess(),
|
|
||||||
ProcessDesktop,
|
|
||||||
&Desktop,
|
|
||||||
sizeof(Desktop));
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Cannot set default desktop.\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (! SetThreadDesktop(Desktop))
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to set thread desktop\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL == NotifyWnd)
|
if (NULL == NotifyWnd)
|
||||||
{
|
{
|
||||||
PrivateCsrssManualGuiCheck(+1);
|
PrivateCsrssManualGuiCheck(+1);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: winlogon.c,v 1.36 2004/11/20 15:55:45 ekohl Exp $
|
/* $Id: winlogon.c,v 1.37 2004/11/20 16:46:05 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -555,7 +555,6 @@ WinMain(HINSTANCE hInstance,
|
||||||
LSA_OPERATIONAL_MODE Mode;
|
LSA_OPERATIONAL_MODE Mode;
|
||||||
ULONG AuthenticationPackage;
|
ULONG AuthenticationPackage;
|
||||||
#endif
|
#endif
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
hAppInstance = hInstance;
|
hAppInstance = hInstance;
|
||||||
|
|
||||||
|
@ -598,14 +597,6 @@ WinMain(HINSTANCE hInstance,
|
||||||
* Switch to winlogon desktop
|
* Switch to winlogon desktop
|
||||||
*/
|
*/
|
||||||
/* FIXME: Do start up in the application desktop for now. */
|
/* FIXME: Do start up in the application desktop for now. */
|
||||||
Status = NtSetInformationProcess(NtCurrentProcess(),
|
|
||||||
ProcessDesktop,
|
|
||||||
&WLSession->ApplicationDesktop,
|
|
||||||
sizeof(HDESK));
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DbgPrint("WL: Cannot set default desktop for winlogon.\n");
|
|
||||||
}
|
|
||||||
SetThreadDesktop(WLSession->ApplicationDesktop);
|
SetThreadDesktop(WLSession->ApplicationDesktop);
|
||||||
if(!SwitchDesktop(WLSession->ApplicationDesktop))
|
if(!SwitchDesktop(WLSession->ApplicationDesktop))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: csr.h,v 1.1 2004/05/28 21:33:41 gvg Exp $
|
/* $Id: csr.h,v 1.2 2004/11/20 16:46:05 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -10,8 +10,12 @@
|
||||||
#ifndef CSR_H_INCLUDED
|
#ifndef CSR_H_INCLUDED
|
||||||
#define CSR_H_INCLUDED
|
#define CSR_H_INCLUDED
|
||||||
|
|
||||||
|
extern PEPROCESS CsrProcess;
|
||||||
|
|
||||||
extern NTSTATUS FASTCALL CsrInit(void);
|
extern NTSTATUS FASTCALL CsrInit(void);
|
||||||
extern NTSTATUS FASTCALL CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply);
|
extern NTSTATUS FASTCALL CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply);
|
||||||
|
extern NTSTATUS FASTCALL CsrCloseHandle(HANDLE Handle);
|
||||||
|
extern NTSTATUS STDCALL CsrInsertObject(PVOID, PACCESS_STATE, ACCESS_MASK, ULONG, PVOID*, PHANDLE);
|
||||||
|
|
||||||
#endif /* CSR_H_INCLUDED */
|
#endif /* CSR_H_INCLUDED */
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,12 @@ IntValidateDesktopHandle(
|
||||||
ACCESS_MASK DesiredAccess,
|
ACCESS_MASK DesiredAccess,
|
||||||
PDESKTOP_OBJECT *Object);
|
PDESKTOP_OBJECT *Object);
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
IntParseDesktopPath(PEPROCESS Process,
|
||||||
|
PUNICODE_STRING DesktopPath,
|
||||||
|
HWINSTA *hWinSta,
|
||||||
|
HDESK *hDesktop);
|
||||||
|
|
||||||
#define IntIsActiveDesktop(Desktop) \
|
#define IntIsActiveDesktop(Desktop) \
|
||||||
((Desktop)->WindowStation->ActiveDesktop == (Desktop))
|
((Desktop)->WindowStation->ActiveDesktop == (Desktop))
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ typedef struct _MENU_ITEM
|
||||||
|
|
||||||
typedef struct _MENU_OBJECT
|
typedef struct _MENU_OBJECT
|
||||||
{
|
{
|
||||||
PW32PROCESS W32Process;
|
PEPROCESS Process;
|
||||||
LIST_ENTRY ListEntry;
|
LIST_ENTRY ListEntry;
|
||||||
FAST_MUTEX MenuItemsLock;
|
FAST_MUTEX MenuItemsLock;
|
||||||
PMENU_ITEM MenuItemList;
|
PMENU_ITEM MenuItemList;
|
||||||
|
|
|
@ -129,7 +129,7 @@ typedef struct _WINDOW_OBJECT
|
||||||
(hWnd == HWND_BROADCAST || hWnd == HWND_TOPMOST)
|
(hWnd == HWND_BROADCAST || hWnd == HWND_TOPMOST)
|
||||||
|
|
||||||
#define IntGetWindowObject(hWnd) \
|
#define IntGetWindowObject(hWnd) \
|
||||||
IntGetProcessWindowObject(PsGetWin32Process(), hWnd)
|
IntGetProcessWindowObject(PsGetWin32Thread(), hWnd)
|
||||||
|
|
||||||
#define IntReferenceWindowObject(WndObj) \
|
#define IntReferenceWindowObject(WndObj) \
|
||||||
ObmReferenceObjectByPointer(WndObj, otWindow)
|
ObmReferenceObjectByPointer(WndObj, otWindow)
|
||||||
|
@ -161,7 +161,7 @@ typedef struct _WINDOW_OBJECT
|
||||||
|
|
||||||
|
|
||||||
PWINDOW_OBJECT FASTCALL
|
PWINDOW_OBJECT FASTCALL
|
||||||
IntGetProcessWindowObject(PW32PROCESS ProcessData, HWND hWnd);
|
IntGetProcessWindowObject(PW32THREAD Thread, HWND hWnd);
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntIsWindow(HWND hWnd);
|
IntIsWindow(HWND hWnd);
|
||||||
|
|
|
@ -7,12 +7,6 @@
|
||||||
#include <internal/ps.h>
|
#include <internal/ps.h>
|
||||||
#include "msgqueue.h"
|
#include "msgqueue.h"
|
||||||
|
|
||||||
#define PROCESS_WINDOW_STATION() \
|
|
||||||
((HWINSTA)(IoGetCurrentProcess()->Win32WindowStation))
|
|
||||||
|
|
||||||
#define SET_PROCESS_WINDOW_STATION(WinSta) \
|
|
||||||
((IoGetCurrentProcess()->Win32WindowStation) = (PVOID)(WinSta))
|
|
||||||
|
|
||||||
#define WINSTA_ROOT_NAME L"\\Windows\\WindowStations"
|
#define WINSTA_ROOT_NAME L"\\Windows\\WindowStations"
|
||||||
#define WINSTA_ROOT_NAME_LENGTH 23
|
#define WINSTA_ROOT_NAME_LENGTH 23
|
||||||
|
|
||||||
|
@ -51,6 +45,8 @@ IntGetFullWindowStationName(
|
||||||
IN PUNICODE_STRING WinStaName,
|
IN PUNICODE_STRING WinStaName,
|
||||||
IN OPTIONAL PUNICODE_STRING DesktopName);
|
IN OPTIONAL PUNICODE_STRING DesktopName);
|
||||||
|
|
||||||
|
PWINSTATION_OBJECT FASTCALL IntGetWinStaObj(VOID);
|
||||||
|
|
||||||
#endif /* _WIN32K_WINSTA_H */
|
#endif /* _WIN32K_WINSTA_H */
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -16,12 +16,15 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dllmain.c,v 1.81 2004/11/16 16:27:48 blight Exp $
|
/* $Id: dllmain.c,v 1.82 2004/11/20 16:46:05 weiden Exp $
|
||||||
*
|
*
|
||||||
* Entry Point for win32k.sys
|
* Entry Point for win32k.sys
|
||||||
*/
|
*/
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
#include <roscfg.h>
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <win32k/debug1.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
#ifdef __USE_W32API
|
#ifdef __USE_W32API
|
||||||
typedef NTSTATUS (STDCALL *PW32_PROCESS_CALLBACK)(
|
typedef NTSTATUS (STDCALL *PW32_PROCESS_CALLBACK)(
|
||||||
|
@ -51,18 +54,11 @@ Win32kProcessCallback (struct _EPROCESS *Process,
|
||||||
BOOLEAN Create)
|
BOOLEAN Create)
|
||||||
{
|
{
|
||||||
PW32PROCESS Win32Process;
|
PW32PROCESS Win32Process;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
DbgPrint ("Win32kProcessCallback() called\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Win32Process = Process->Win32Process;
|
Win32Process = Process->Win32Process;
|
||||||
if (Create)
|
if (Create)
|
||||||
{
|
{
|
||||||
#if 0
|
DPRINT("Creating W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql());
|
||||||
DbgPrint (" Create process\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
InitializeListHead(&Win32Process->ClassListHead);
|
InitializeListHead(&Win32Process->ClassListHead);
|
||||||
ExInitializeFastMutex(&Win32Process->ClassListLock);
|
ExInitializeFastMutex(&Win32Process->ClassListLock);
|
||||||
|
@ -77,31 +73,14 @@ Win32kProcessCallback (struct _EPROCESS *Process,
|
||||||
ExInitializeFastMutex(&Win32Process->CursorIconListLock);
|
ExInitializeFastMutex(&Win32Process->CursorIconListLock);
|
||||||
|
|
||||||
Win32Process->KeyboardLayout = W32kGetDefaultKeyLayout();
|
Win32Process->KeyboardLayout = W32kGetDefaultKeyLayout();
|
||||||
Win32Process->WindowStation = NULL;
|
|
||||||
if (Process->Win32WindowStation != NULL)
|
|
||||||
{
|
|
||||||
Status =
|
|
||||||
IntValidateWindowStationHandle(Process->Win32WindowStation,
|
|
||||||
UserMode,
|
|
||||||
GENERIC_ALL,
|
|
||||||
&Win32Process->WindowStation);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DbgPrint("Win32K: Failed to reference a window station for "
|
|
||||||
"process.\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* setup process flags */
|
/* setup process flags */
|
||||||
Win32Process->Flags = 0;
|
Win32Process->Flags = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if 0
|
DPRINT("Destroying W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql());
|
||||||
DbgPrint (" Destroy process\n");
|
IntRemoveProcessWndProcHandles((HANDLE)Process->UniqueProcessId);
|
||||||
DbgPrint (" IRQ level: %lu\n", KeGetCurrentIrql ());
|
|
||||||
#endif
|
|
||||||
IntRemoveProcessWndProcHandles((HANDLE)Process->UniqueProcessId);
|
|
||||||
IntCleanupMenus(Process, Win32Process);
|
IntCleanupMenus(Process, Win32Process);
|
||||||
IntCleanupCurIcons(Process, Win32Process);
|
IntCleanupCurIcons(Process, Win32Process);
|
||||||
CleanupMonitorImpl();
|
CleanupMonitorImpl();
|
||||||
|
@ -129,19 +108,63 @@ Win32kThreadCallback (struct _ETHREAD *Thread,
|
||||||
{
|
{
|
||||||
struct _EPROCESS *Process;
|
struct _EPROCESS *Process;
|
||||||
PW32THREAD Win32Thread;
|
PW32THREAD Win32Thread;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
DbgPrint ("Win32kThreadCallback() called\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Process = Thread->ThreadsProcess;
|
Process = Thread->ThreadsProcess;
|
||||||
Win32Thread = Thread->Tcb.Win32Thread;
|
Win32Thread = Thread->Tcb.Win32Thread;
|
||||||
if (Create)
|
if (Create)
|
||||||
{
|
{
|
||||||
#if 0
|
HWINSTA hWinSta = NULL;
|
||||||
DbgPrint (" Create thread\n");
|
HDESK hDesk = NULL;
|
||||||
#endif
|
NTSTATUS Status;
|
||||||
|
PUNICODE_STRING DesktopPath;
|
||||||
|
PRTL_USER_PROCESS_PARAMETERS ProcessParams = (Process->Peb ? Process->Peb->ProcessParameters : NULL);
|
||||||
|
|
||||||
|
DPRINT("Creating W32 thread TID:%d at IRQ level: %lu\n", Thread->Cid.UniqueThread, KeGetCurrentIrql());
|
||||||
|
|
||||||
|
/*
|
||||||
|
* inherit the thread desktop and process window station (if not yet inherited) from the process startup
|
||||||
|
* info structure. See documentation of CreateProcess()
|
||||||
|
*/
|
||||||
|
DesktopPath = (ProcessParams ? ((ProcessParams->DesktopInfo.Length > 0) ? &ProcessParams->DesktopInfo : NULL) : NULL);
|
||||||
|
Status = IntParseDesktopPath(Process,
|
||||||
|
DesktopPath,
|
||||||
|
&hWinSta,
|
||||||
|
&hDesk);
|
||||||
|
if(NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
if(hWinSta != NULL)
|
||||||
|
{
|
||||||
|
if(Process != CsrProcess)
|
||||||
|
{
|
||||||
|
HWINSTA hProcessWinSta = (HWINSTA)InterlockedCompareExchangePointer((PVOID)&Process->Win32WindowStation, (PVOID)hWinSta, NULL);
|
||||||
|
if(hProcessWinSta != NULL)
|
||||||
|
{
|
||||||
|
/* our process is already assigned to a different window station, we don't need the handle anymore */
|
||||||
|
NtClose(hWinSta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NtClose(hWinSta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Win32Thread->hDesktop = hDesk;
|
||||||
|
|
||||||
|
Status = ObReferenceObjectByHandle(hDesk,
|
||||||
|
0,
|
||||||
|
ExDesktopObjectType,
|
||||||
|
KernelMode,
|
||||||
|
(PVOID*)&Win32Thread->Desktop,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Unable to reference thread desktop handle 0x%x\n", hDesk);
|
||||||
|
Win32Thread->Desktop = NULL;
|
||||||
|
NtClose(hDesk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Win32Thread->IsExiting = FALSE;
|
Win32Thread->IsExiting = FALSE;
|
||||||
IntDestroyCaret(Win32Thread);
|
IntDestroyCaret(Win32Thread);
|
||||||
|
@ -152,31 +175,10 @@ Win32kThreadCallback (struct _ETHREAD *Thread,
|
||||||
ExInitializeFastMutex(&Win32Thread->WindowListLock);
|
ExInitializeFastMutex(&Win32Thread->WindowListLock);
|
||||||
InitializeListHead(&Win32Thread->W32CallbackListHead);
|
InitializeListHead(&Win32Thread->W32CallbackListHead);
|
||||||
ExInitializeFastMutex(&Win32Thread->W32CallbackListLock);
|
ExInitializeFastMutex(&Win32Thread->W32CallbackListLock);
|
||||||
|
|
||||||
/* By default threads get assigned their process's desktop. */
|
|
||||||
Win32Thread->Desktop = NULL;
|
|
||||||
Win32Thread->hDesktop = NULL;
|
|
||||||
if (Process->Win32Desktop != NULL)
|
|
||||||
{
|
|
||||||
Status = ObReferenceObjectByHandle(Process->Win32Desktop,
|
|
||||||
GENERIC_ALL,
|
|
||||||
ExDesktopObjectType,
|
|
||||||
UserMode,
|
|
||||||
(PVOID*)&Win32Thread->Desktop,
|
|
||||||
NULL);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DbgPrint("Win32K: Failed to reference a desktop for thread.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
Win32Thread->hDesktop = Process->Win32Desktop;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if 0
|
DPRINT("Destroying W32 thread TID:%d at IRQ level: %lu\n", Thread->Cid.UniqueThread, KeGetCurrentIrql());
|
||||||
DbgPrint (" Destroy thread\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Win32Thread->IsExiting = TRUE;
|
Win32Thread->IsExiting = TRUE;
|
||||||
HOOK_DestroyThreadHooks(Thread);
|
HOOK_DestroyThreadHooks(Thread);
|
||||||
|
@ -186,6 +188,10 @@ Win32kThreadCallback (struct _ETHREAD *Thread,
|
||||||
IntBlockInput(Win32Thread, FALSE);
|
IntBlockInput(Win32Thread, FALSE);
|
||||||
MsqDestroyMessageQueue(Win32Thread->MessageQueue);
|
MsqDestroyMessageQueue(Win32Thread->MessageQueue);
|
||||||
IntCleanupThreadCallbacks(Win32Thread);
|
IntCleanupThreadCallbacks(Win32Thread);
|
||||||
|
if(Win32Thread->Desktop != NULL)
|
||||||
|
{
|
||||||
|
ObDereferenceObject(Win32Thread->Desktop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -215,7 +221,7 @@ DllMain (
|
||||||
1);
|
1);
|
||||||
if (Result == FALSE)
|
if (Result == FALSE)
|
||||||
{
|
{
|
||||||
DbgPrint("Adding system services failed!\n");
|
DPRINT1("Adding system services failed!\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,49 +238,49 @@ DllMain (
|
||||||
Status = InitWindowStationImpl();
|
Status = InitWindowStationImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize window station implementation!\n");
|
DPRINT1("Failed to initialize window station implementation!\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = InitClassImpl();
|
Status = InitClassImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize window class implementation!\n");
|
DPRINT1("Failed to initialize window class implementation!\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = InitDesktopImpl();
|
Status = InitDesktopImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize desktop implementation!\n");
|
DPRINT1("Failed to initialize desktop implementation!\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = InitWindowImpl();
|
Status = InitWindowImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize window implementation!\n");
|
DPRINT1("Failed to initialize window implementation!\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = InitMenuImpl();
|
Status = InitMenuImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize menu implementation!\n");
|
DPRINT1("Failed to initialize menu implementation!\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = InitInputImpl();
|
Status = InitInputImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize input implementation.\n");
|
DPRINT1("Failed to initialize input implementation.\n");
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = InitKeyboardImpl();
|
Status = InitKeyboardImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize keyboard implementation.\n");
|
DPRINT1("Failed to initialize keyboard implementation.\n");
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,28 +294,28 @@ DllMain (
|
||||||
Status = MsqInitializeImpl();
|
Status = MsqInitializeImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize message queue implementation.\n");
|
DPRINT1("Failed to initialize message queue implementation.\n");
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = InitTimerImpl();
|
Status = InitTimerImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize timer implementation.\n");
|
DPRINT1("Failed to initialize timer implementation.\n");
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = InitAcceleratorImpl();
|
Status = InitAcceleratorImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize accelerator implementation.\n");
|
DPRINT1("Failed to initialize accelerator implementation.\n");
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = InitGuiCheckImpl();
|
Status = InitGuiCheckImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize GUI check implementation.\n");
|
DPRINT1("Failed to initialize GUI check implementation.\n");
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: caret.c,v 1.14 2004/08/04 22:31:17 weiden Exp $
|
/* $Id: caret.c,v 1.15 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -54,18 +54,7 @@ BOOL FASTCALL
|
||||||
IntSetCaretBlinkTime(UINT uMSeconds)
|
IntSetCaretBlinkTime(UINT uMSeconds)
|
||||||
{
|
{
|
||||||
/* Don't save the new value to the registry! */
|
/* Don't save the new value to the registry! */
|
||||||
NTSTATUS Status;
|
PWINSTATION_OBJECT WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastNtError(Status);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* windows doesn't do this check */
|
/* windows doesn't do this check */
|
||||||
if((uMSeconds < MIN_CARETBLINKRATE) || (uMSeconds > MAX_CARETBLINKRATE))
|
if((uMSeconds < MIN_CARETBLINKRATE) || (uMSeconds > MAX_CARETBLINKRATE))
|
||||||
|
@ -77,7 +66,6 @@ IntSetCaretBlinkTime(UINT uMSeconds)
|
||||||
|
|
||||||
WinStaObject->CaretBlinkRate = uMSeconds;
|
WinStaObject->CaretBlinkRate = uMSeconds;
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,19 +139,10 @@ IntQueryCaretBlinkRate(VOID)
|
||||||
UINT FASTCALL
|
UINT FASTCALL
|
||||||
IntGetCaretBlinkTime(VOID)
|
IntGetCaretBlinkTime(VOID)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
UINT Ret;
|
UINT Ret;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastNtError(Status);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ret = WinStaObject->CaretBlinkRate;
|
Ret = WinStaObject->CaretBlinkRate;
|
||||||
if(!Ret)
|
if(!Ret)
|
||||||
|
@ -178,7 +157,6 @@ IntGetCaretBlinkTime(VOID)
|
||||||
Ret = DEFAULT_CARETBLINKRATE;
|
Ret = DEFAULT_CARETBLINKRATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: class.c,v 1.59 2004/06/21 20:56:53 hbirr Exp $
|
/* $Id: class.c,v 1.60 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -99,21 +99,10 @@ ClassReferenceClassByName(
|
||||||
BOOL Found;
|
BOOL Found;
|
||||||
RTL_ATOM ClassAtom;
|
RTL_ATOM ClassAtom;
|
||||||
|
|
||||||
if (!ClassName)
|
if (!ClassName || !PsGetWin32Thread()->Desktop)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
PROCESS_WINDOW_STATION(),
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
|
||||||
PROCESS_WINDOW_STATION());
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = RtlLookupAtomInAtomTable(
|
Status = RtlLookupAtomInAtomTable(
|
||||||
WinStaObject->AtomTable,
|
WinStaObject->AtomTable,
|
||||||
|
@ -122,12 +111,10 @@ ClassReferenceClassByName(
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Found = ClassReferenceClassByAtom(Class, ClassAtom, hInstance);
|
Found = ClassReferenceClassByAtom(Class, ClassAtom, hInstance);
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
|
|
||||||
return Found;
|
return Found;
|
||||||
}
|
}
|
||||||
|
@ -205,14 +192,13 @@ IntGetClassName(struct _WINDOW_OBJECT *WindowObject, LPWSTR lpClassName,
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
if(!PsGetWin32Thread()->Desktop)
|
||||||
KernelMode, 0, &WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
|
||||||
PROCESS_WINDOW_STATION());
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
|
|
||||||
Length = 0;
|
Length = 0;
|
||||||
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
||||||
WindowObject->Class->Atom, NULL, NULL, NULL, &Length);
|
WindowObject->Class->Atom, NULL, NULL, NULL, &Length);
|
||||||
|
@ -233,7 +219,6 @@ IntGetClassName(struct _WINDOW_OBJECT *WindowObject, LPWSTR lpClassName,
|
||||||
/* FIXME: Check buffer size before doing this! */
|
/* FIXME: Check buffer size before doing this! */
|
||||||
*(lpClassName + Length) = 0;
|
*(lpClassName + Length) = 0;
|
||||||
ExFreePool(Name);
|
ExFreePool(Name);
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
|
|
||||||
return Length;
|
return Length;
|
||||||
}
|
}
|
||||||
|
@ -426,18 +411,8 @@ NtUserRegisterClassExWOW(
|
||||||
return (RTL_ATOM)0;
|
return (RTL_ATOM)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("About to open window station handle (0x%X)\n",
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
PROCESS_WINDOW_STATION());
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
|
||||||
PROCESS_WINDOW_STATION());
|
|
||||||
return((RTL_ATOM)0);
|
|
||||||
}
|
|
||||||
if (ClassName->Length)
|
if (ClassName->Length)
|
||||||
{
|
{
|
||||||
DPRINT("NtUserRegisterClassExWOW(%S)\n", ClassName->Buffer);
|
DPRINT("NtUserRegisterClassExWOW(%S)\n", ClassName->Buffer);
|
||||||
|
@ -447,7 +422,6 @@ NtUserRegisterClassExWOW(
|
||||||
&Atom);
|
&Atom);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
DPRINT("Failed adding class name (%S) to atom table\n",
|
DPRINT("Failed adding class name (%S) to atom table\n",
|
||||||
ClassName->Buffer);
|
ClassName->Buffer);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
|
@ -465,14 +439,12 @@ NtUserRegisterClassExWOW(
|
||||||
{
|
{
|
||||||
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Atom);
|
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Atom);
|
||||||
}
|
}
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
DPRINT("Failed creating window class object\n");
|
DPRINT("Failed creating window class object\n");
|
||||||
return((RTL_ATOM)0);
|
return((RTL_ATOM)0);
|
||||||
}
|
}
|
||||||
IntLockProcessClasses(PsGetWin32Process());
|
IntLockProcessClasses(PsGetWin32Process());
|
||||||
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
|
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
|
||||||
IntUnLockProcessClasses(PsGetWin32Process());
|
IntUnLockProcessClasses(PsGetWin32Process());
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
return(Atom);
|
return(Atom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,32 +640,21 @@ NtUserUnregisterClass(
|
||||||
HINSTANCE hInstance,
|
HINSTANCE hInstance,
|
||||||
DWORD Unknown)
|
DWORD Unknown)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
|
||||||
PWNDCLASS_OBJECT Class;
|
PWNDCLASS_OBJECT Class;
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
|
|
||||||
DPRINT("NtUserUnregisterClass(%S)\n", ClassNameOrAtom);
|
DPRINT("NtUserUnregisterClass(%S)\n", ClassNameOrAtom);
|
||||||
|
|
||||||
if (!ClassNameOrAtom)
|
if (!ClassNameOrAtom || !PsGetWin32Thread()->Desktop)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
PROCESS_WINDOW_STATION(),
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ClassReferenceClassByNameOrAtom(&Class, ClassNameOrAtom, hInstance))
|
if (!ClassReferenceClassByNameOrAtom(&Class, ClassNameOrAtom, hInstance))
|
||||||
{
|
{
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
|
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -701,7 +662,6 @@ NtUserUnregisterClass(
|
||||||
if (Class->hInstance && Class->hInstance != hInstance)
|
if (Class->hInstance && Class->hInstance != hInstance)
|
||||||
{
|
{
|
||||||
ClassDereferenceObject(Class);
|
ClassDereferenceObject(Class);
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
|
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -712,7 +672,6 @@ NtUserUnregisterClass(
|
||||||
IntUnLockClassWindows(Class);
|
IntUnLockClassWindows(Class);
|
||||||
/* Dereference the ClassReferenceClassByNameOrAtom() call */
|
/* Dereference the ClassReferenceClassByNameOrAtom() call */
|
||||||
ObmDereferenceObject(Class);
|
ObmDereferenceObject(Class);
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
SetLastWin32Error(ERROR_CLASS_HAS_WINDOWS);
|
SetLastWin32Error(ERROR_CLASS_HAS_WINDOWS);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -728,8 +687,6 @@ NtUserUnregisterClass(
|
||||||
/* Free the object */
|
/* Free the object */
|
||||||
ClassDereferenceObject(Class);
|
ClassDereferenceObject(Class);
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: csr.c,v 1.2 2004/07/12 20:09:35 gvg Exp $
|
/* $Id: csr.c,v 1.3 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
static HANDLE WindowsApiPort = NULL;
|
static HANDLE WindowsApiPort = NULL;
|
||||||
static PEPROCESS CsrProcess = NULL;
|
PEPROCESS CsrProcess = NULL;
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
CsrInit(void)
|
CsrInit(void)
|
||||||
|
@ -76,4 +76,60 @@ CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply)
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
CsrInsertObject(PVOID Object,
|
||||||
|
PACCESS_STATE PassedAccessState,
|
||||||
|
ACCESS_MASK DesiredAccess,
|
||||||
|
ULONG AdditionalReferences,
|
||||||
|
PVOID* ReferencedObject,
|
||||||
|
PHANDLE Handle)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
PEPROCESS OldProcess;
|
||||||
|
|
||||||
|
/* Switch to the process in which the handle is valid */
|
||||||
|
OldProcess = PsGetCurrentProcess();
|
||||||
|
if (CsrProcess != OldProcess)
|
||||||
|
{
|
||||||
|
KeAttachProcess(CsrProcess);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = ObInsertObject(Object,
|
||||||
|
PassedAccessState,
|
||||||
|
DesiredAccess,
|
||||||
|
AdditionalReferences,
|
||||||
|
ReferencedObject,
|
||||||
|
Handle);
|
||||||
|
|
||||||
|
if (CsrProcess != OldProcess)
|
||||||
|
{
|
||||||
|
KeDetachProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
CsrCloseHandle(HANDLE Handle)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
PEPROCESS OldProcess;
|
||||||
|
|
||||||
|
/* Switch to the process in which the handle is valid */
|
||||||
|
OldProcess = PsGetCurrentProcess();
|
||||||
|
if (CsrProcess != OldProcess)
|
||||||
|
{
|
||||||
|
KeAttachProcess(CsrProcess);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = ZwClose(Handle);
|
||||||
|
|
||||||
|
if (CsrProcess != OldProcess)
|
||||||
|
{
|
||||||
|
KeDetachProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Id: desktop.c,v 1.23 2004/11/06 22:28:11 gvg Exp $
|
* $Id: desktop.c,v 1.24 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -66,6 +66,179 @@ CleanupDesktopImpl(VOID)
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
IntParseDesktopPath(PEPROCESS Process,
|
||||||
|
PUNICODE_STRING DesktopPath,
|
||||||
|
HWINSTA *hWinSta,
|
||||||
|
HDESK *hDesktop)
|
||||||
|
{
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
UNICODE_STRING WinSta, Desktop, FullName;
|
||||||
|
BOOL DesktopPresent = FALSE;
|
||||||
|
BOOL WinStaPresent = FALSE;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
ASSERT(hWinSta);
|
||||||
|
|
||||||
|
*hWinSta = NULL;
|
||||||
|
|
||||||
|
if(hDesktop != NULL)
|
||||||
|
{
|
||||||
|
*hDesktop = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&WinSta, NULL);
|
||||||
|
RtlInitUnicodeString(&Desktop, NULL);
|
||||||
|
|
||||||
|
if(DesktopPath != NULL && DesktopPath->Buffer != NULL && DesktopPath->Length > sizeof(WCHAR))
|
||||||
|
{
|
||||||
|
PWCHAR c = DesktopPath->Buffer;
|
||||||
|
USHORT wl = 0;
|
||||||
|
USHORT l = DesktopPath->Length;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parse the desktop path string which can be in the form "WinSta\Desktop"
|
||||||
|
* or just "Desktop". In latter case WinSta0 will be used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
while(l > 0)
|
||||||
|
{
|
||||||
|
if(*c == L'\\')
|
||||||
|
{
|
||||||
|
wl = (ULONG_PTR)c - (ULONG_PTR)DesktopPath->Buffer;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
l -= sizeof(WCHAR);
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(wl > 0)
|
||||||
|
{
|
||||||
|
WinSta.Length = wl;
|
||||||
|
WinSta.MaximumLength = wl + sizeof(WCHAR);
|
||||||
|
WinSta.Buffer = DesktopPath->Buffer;
|
||||||
|
|
||||||
|
WinStaPresent = TRUE;
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Desktop.Length = DesktopPath->Length - wl;
|
||||||
|
if(wl > 0)
|
||||||
|
{
|
||||||
|
Desktop.Length -= sizeof(WCHAR);
|
||||||
|
}
|
||||||
|
if(Desktop.Length > 0)
|
||||||
|
{
|
||||||
|
Desktop.MaximumLength = Desktop.Length + sizeof(WCHAR);
|
||||||
|
Desktop.Buffer = ((wl > 0) ? c : DesktopPath->Buffer);
|
||||||
|
DesktopPresent = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!WinStaPresent)
|
||||||
|
{
|
||||||
|
/* search the process handle table for (inherited) window station
|
||||||
|
handles, use a more appropriate one than WinSta0 if possible. */
|
||||||
|
Status = ObFindHandleForObject(Process,
|
||||||
|
NULL,
|
||||||
|
ExWindowStationObjectType,
|
||||||
|
NULL,
|
||||||
|
(PHANDLE)hWinSta);
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* we had no luck searching for opened handles, use WinSta0 now */
|
||||||
|
RtlInitUnicodeString(&WinSta, L"WinSta0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!DesktopPresent && hDesktop != NULL)
|
||||||
|
{
|
||||||
|
/* search the process handle table for (inherited) desktop
|
||||||
|
handles, use a more appropriate one than Default if possible. */
|
||||||
|
Status = ObFindHandleForObject(Process,
|
||||||
|
NULL,
|
||||||
|
ExDesktopObjectType,
|
||||||
|
NULL,
|
||||||
|
(PHANDLE)hDesktop);
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* we had no luck searching for opened handles, use Desktop now */
|
||||||
|
RtlInitUnicodeString(&Desktop, L"Default");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*hWinSta == NULL)
|
||||||
|
{
|
||||||
|
if(!IntGetFullWindowStationName(&FullName, &WinSta, NULL))
|
||||||
|
{
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* open the window station */
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&FullName,
|
||||||
|
OBJ_CASE_INSENSITIVE,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
Status = ObOpenObjectByName(&ObjectAttributes,
|
||||||
|
ExWindowStationObjectType,
|
||||||
|
NULL,
|
||||||
|
UserMode,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
(HANDLE*)hWinSta);
|
||||||
|
|
||||||
|
RtlFreeUnicodeString(&FullName);
|
||||||
|
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
DPRINT("Failed to reference window station %wZ PID: %d!\n", &WinSta, PsGetCurrentProcessId());
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hDesktop != NULL && *hDesktop == NULL)
|
||||||
|
{
|
||||||
|
if(!IntGetFullWindowStationName(&FullName, &WinSta, &Desktop))
|
||||||
|
{
|
||||||
|
NtClose(*hWinSta);
|
||||||
|
*hWinSta = NULL;
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* open the desktop object */
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&FullName,
|
||||||
|
OBJ_CASE_INSENSITIVE,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
Status = ObOpenObjectByName(&ObjectAttributes,
|
||||||
|
ExDesktopObjectType,
|
||||||
|
NULL,
|
||||||
|
UserMode,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
(HANDLE*)hDesktop);
|
||||||
|
|
||||||
|
RtlFreeUnicodeString(&FullName);
|
||||||
|
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
*hDesktop = NULL;
|
||||||
|
NtClose(*hWinSta);
|
||||||
|
*hWinSta = NULL;
|
||||||
|
SetLastNtError(Status);
|
||||||
|
DPRINT("Failed to reference desktop %wZ PID: %d!\n", &Desktop, PsGetCurrentProcessId());
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IntValidateDesktopHandle
|
* IntValidateDesktopHandle
|
||||||
*
|
*
|
||||||
|
@ -323,16 +496,18 @@ NtUserCreateDesktop(
|
||||||
CSRSS_API_REQUEST Request;
|
CSRSS_API_REQUEST Request;
|
||||||
CSRSS_API_REPLY Reply;
|
CSRSS_API_REPLY Reply;
|
||||||
|
|
||||||
|
DPRINT1("CreateDesktop: %wZ\n", lpszDesktopName);
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(
|
Status = IntValidateWindowStationHandle(
|
||||||
hWindowStation,
|
hWindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0, /* FIXME - WINSTA_CREATEDESKTOP */
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
|
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed validation of window station handle (0x%X)\n",
|
DPRINT1("Failed validation of window station handle (0x%X), cannot create desktop %wZ\n",
|
||||||
hWindowStation);
|
hWindowStation, lpszDesktopName);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -428,14 +603,28 @@ NtUserCreateDesktop(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a handle for CSRSS and notify CSRSS
|
||||||
|
*/
|
||||||
Request.Type = CSRSS_CREATE_DESKTOP;
|
Request.Type = CSRSS_CREATE_DESKTOP;
|
||||||
memcpy(Request.Data.CreateDesktopRequest.DesktopName, lpszDesktopName->Buffer,
|
Status = CsrInsertObject((PVOID)DesktopObject,
|
||||||
lpszDesktopName->Length);
|
NULL,
|
||||||
Request.Data.CreateDesktopRequest.DesktopName[lpszDesktopName->Length / sizeof(WCHAR)] = L'\0';
|
GENERIC_ALL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
(HANDLE*)&Request.Data.CreateDesktopRequest.DesktopHandle);
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to create desktop handle for CSRSS\n");
|
||||||
|
ZwClose(Desktop);
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Status = CsrNotify(&Request, &Reply);
|
Status = CsrNotify(&Request, &Reply);
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
CsrCloseHandle(Request.Data.CreateDesktopRequest.DesktopHandle);
|
||||||
DPRINT1("Failed to notify CSRSS about new desktop\n");
|
DPRINT1("Failed to notify CSRSS about new desktop\n");
|
||||||
ZwClose(Desktop);
|
ZwClose(Desktop);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
|
@ -485,15 +674,15 @@ NtUserOpenDesktop(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(
|
Status = IntValidateWindowStationHandle(
|
||||||
PROCESS_WINDOW_STATION(),
|
PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Failed validation of window station handle (0x%X)\n",
|
DPRINT1("Failed validation of window station handle (0x%X)\n",
|
||||||
PROCESS_WINDOW_STATION());
|
PsGetCurrentProcess()->Win32WindowStation);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -508,7 +697,7 @@ NtUserOpenDesktop(
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
ObDereferenceObject(WinStaObject);
|
||||||
|
|
||||||
DPRINT("Trying to open desktop station (%wZ)\n", &DesktopName);
|
DPRINT1("Trying to open desktop (%wZ)\n", &DesktopName);
|
||||||
|
|
||||||
/* Initialize ObjectAttributes for the desktop object */
|
/* Initialize ObjectAttributes for the desktop object */
|
||||||
InitializeObjectAttributes(
|
InitializeObjectAttributes(
|
||||||
|
@ -1026,13 +1215,6 @@ NtUserSetThreadDesktop(HDESK hDesktop)
|
||||||
}
|
}
|
||||||
|
|
||||||
W32Thread = PsGetWin32Thread();
|
W32Thread = PsGetWin32Thread();
|
||||||
/* Check for setting the same desktop as before. */
|
|
||||||
if (DesktopObject == W32Thread->Desktop)
|
|
||||||
{
|
|
||||||
W32Thread->hDesktop = hDesktop;
|
|
||||||
ObDereferenceObject(DesktopObject);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: Should check here to see if the thread has any windows. */
|
/* FIXME: Should check here to see if the thread has any windows. */
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: hook.c,v 1.9 2004/09/28 15:02:30 weiden Exp $
|
/* $Id: hook.c,v 1.10 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -289,7 +289,7 @@ HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
|
||||||
Result = IntCallHookProc(HookId, Code, wParam, lParam, Hook->Proc,
|
Result = IntCallHookProc(HookId, Code, wParam, lParam, Hook->Proc,
|
||||||
Hook->Ansi, &Hook->ModuleName);
|
Hook->Ansi, &Hook->ModuleName);
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObj);
|
&WinStaObj);
|
||||||
|
@ -319,7 +319,7 @@ HOOK_DestroyThreadHooks(PETHREAD Thread)
|
||||||
|
|
||||||
if (NULL != GlobalHooks)
|
if (NULL != GlobalHooks)
|
||||||
{
|
{
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObj);
|
&WinStaObj);
|
||||||
|
@ -367,7 +367,7 @@ NtUserCallNextHookEx(
|
||||||
PWINSTATION_OBJECT WinStaObj;
|
PWINSTATION_OBJECT WinStaObj;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObj);
|
&WinStaObj);
|
||||||
|
@ -509,7 +509,7 @@ NtUserSetWindowsHookEx(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObj);
|
&WinStaObj);
|
||||||
|
@ -613,7 +613,7 @@ NtUserUnhookWindowsHookEx(
|
||||||
PHOOK HookObj;
|
PHOOK HookObj;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObj);
|
&WinStaObj);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: hotkey.c,v 1.10 2004/05/25 15:52:44 navaraf Exp $
|
/* $Id: hotkey.c,v 1.11 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -114,9 +114,8 @@ UnregisterWindowHotKeys(PWINDOW_OBJECT Window)
|
||||||
PHOT_KEY_ITEM HotKeyItem;
|
PHOT_KEY_ITEM HotKeyItem;
|
||||||
PWINSTATION_OBJECT WinStaObject = NULL;
|
PWINSTATION_OBJECT WinStaObject = NULL;
|
||||||
|
|
||||||
if(Window->OwnerThread && Window->OwnerThread->ThreadsProcess &&
|
if(Window->OwnerThread && Window->OwnerThread->ThreadsProcess)
|
||||||
Window->OwnerThread->ThreadsProcess->Win32Process)
|
WinStaObject = Window->OwnerThread->Tcb.Win32Thread->Desktop->WindowStation;
|
||||||
WinStaObject = Window->OwnerThread->ThreadsProcess->Win32Process->WindowStation;
|
|
||||||
|
|
||||||
if(!WinStaObject)
|
if(!WinStaObject)
|
||||||
return;
|
return;
|
||||||
|
@ -148,8 +147,8 @@ UnregisterThreadHotKeys(struct _ETHREAD *Thread)
|
||||||
PHOT_KEY_ITEM HotKeyItem;
|
PHOT_KEY_ITEM HotKeyItem;
|
||||||
PWINSTATION_OBJECT WinStaObject = NULL;
|
PWINSTATION_OBJECT WinStaObject = NULL;
|
||||||
|
|
||||||
if(Thread->ThreadsProcess && Thread->ThreadsProcess->Win32Process)
|
if(Thread->Tcb.Win32Thread && Thread->Tcb.Win32Thread->Desktop)
|
||||||
WinStaObject = Thread->ThreadsProcess->Win32Process->WindowStation;
|
WinStaObject = Thread->Tcb.Win32Thread->Desktop->WindowStation;
|
||||||
|
|
||||||
if(!WinStaObject)
|
if(!WinStaObject)
|
||||||
return;
|
return;
|
||||||
|
@ -230,7 +229,7 @@ NtUserRegisterHotKey(HWND hWnd,
|
||||||
|
|
||||||
|
|
||||||
if(HotKeyThread->ThreadsProcess && HotKeyThread->ThreadsProcess->Win32Process)
|
if(HotKeyThread->ThreadsProcess && HotKeyThread->ThreadsProcess->Win32Process)
|
||||||
WinStaObject = HotKeyThread->ThreadsProcess->Win32Process->WindowStation;
|
WinStaObject = HotKeyThread->Tcb.Win32Thread->Desktop->WindowStation;
|
||||||
|
|
||||||
if(!WinStaObject)
|
if(!WinStaObject)
|
||||||
{
|
{
|
||||||
|
@ -285,7 +284,7 @@ NtUserUnregisterHotKey(HWND hWnd,
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Window->OwnerThread->ThreadsProcess && Window->OwnerThread->ThreadsProcess->Win32Process)
|
if(Window->OwnerThread->ThreadsProcess && Window->OwnerThread->ThreadsProcess->Win32Process)
|
||||||
WinStaObject = Window->OwnerThread->ThreadsProcess->Win32Process->WindowStation;
|
WinStaObject = Window->OwnerThread->Tcb.Win32Thread->Desktop->WindowStation;
|
||||||
|
|
||||||
if(!WinStaObject)
|
if(!WinStaObject)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: menu.c,v 1.55 2004/05/13 20:21:27 navaraf Exp $
|
/* $Id: menu.c,v 1.56 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -135,16 +135,15 @@ PMENU_OBJECT FASTCALL
|
||||||
IntGetMenuObject(HMENU hMenu)
|
IntGetMenuObject(HMENU hMenu)
|
||||||
{
|
{
|
||||||
PMENU_OBJECT MenuObject;
|
PMENU_OBJECT MenuObject;
|
||||||
PW32PROCESS W32Process = PsGetWin32Process();
|
PW32THREAD W32Thread = PsGetWin32Thread();
|
||||||
|
|
||||||
if(!W32Process)
|
if(!W32Thread)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS Status = ObmReferenceObjectByHandle(W32Process->
|
NTSTATUS Status = ObmReferenceObjectByHandle(W32Thread->Desktop->WindowStation->HandleTable,
|
||||||
WindowStation->HandleTable, hMenu, otMenu,
|
hMenu, otMenu, (PVOID*)&MenuObject);
|
||||||
(PVOID*)&MenuObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -225,6 +224,9 @@ IntDestroyMenuObject(PMENU_OBJECT MenuObject,
|
||||||
{
|
{
|
||||||
if(MenuObject)
|
if(MenuObject)
|
||||||
{
|
{
|
||||||
|
PWINSTATION_OBJECT WindowStation;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* remove all menu items */
|
/* remove all menu items */
|
||||||
IntLockMenuItems(MenuObject);
|
IntLockMenuItems(MenuObject);
|
||||||
IntDeleteMenuItems(MenuObject, bRecurse); /* do not destroy submenus */
|
IntDeleteMenuItems(MenuObject, bRecurse); /* do not destroy submenus */
|
||||||
|
@ -232,14 +234,23 @@ IntDestroyMenuObject(PMENU_OBJECT MenuObject,
|
||||||
|
|
||||||
if(RemoveFromProcess)
|
if(RemoveFromProcess)
|
||||||
{
|
{
|
||||||
IntLockProcessMenus(MenuObject->W32Process);
|
IntLockProcessMenus(MenuObject->Process->Win32Process);
|
||||||
RemoveEntryList(&MenuObject->ListEntry);
|
RemoveEntryList(&MenuObject->ListEntry);
|
||||||
IntUnLockProcessMenus(MenuObject->W32Process);
|
IntUnLockProcessMenus(MenuObject->Process->Win32Process);
|
||||||
}
|
}
|
||||||
|
|
||||||
ObmCloseHandle(MenuObject->W32Process->WindowStation->HandleTable, MenuObject->MenuInfo.Self);
|
Status = ObReferenceObjectByHandle(MenuObject->Process->Win32WindowStation,
|
||||||
|
0,
|
||||||
return TRUE;
|
ExWindowStationObjectType,
|
||||||
|
KernelMode,
|
||||||
|
(PVOID*)&WindowStation,
|
||||||
|
NULL);
|
||||||
|
if(NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ObmCloseHandle(WindowStation->HandleTable, MenuObject->MenuInfo.Self);
|
||||||
|
ObDereferenceObject(WindowStation);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -248,10 +259,10 @@ PMENU_OBJECT FASTCALL
|
||||||
IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar)
|
IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar)
|
||||||
{
|
{
|
||||||
PMENU_OBJECT MenuObject;
|
PMENU_OBJECT MenuObject;
|
||||||
PW32PROCESS Win32Process = PsGetWin32Process();
|
PW32THREAD Win32Thread = PsGetWin32Thread();
|
||||||
|
|
||||||
MenuObject = (PMENU_OBJECT)ObmCreateObject(
|
MenuObject = (PMENU_OBJECT)ObmCreateObject(
|
||||||
Win32Process->WindowStation->HandleTable, Handle,
|
Win32Thread->Desktop->WindowStation->HandleTable, Handle,
|
||||||
otMenu, sizeof(MENU_OBJECT));
|
otMenu, sizeof(MENU_OBJECT));
|
||||||
|
|
||||||
if(!MenuObject)
|
if(!MenuObject)
|
||||||
|
@ -260,7 +271,7 @@ IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuObject->W32Process = Win32Process;
|
MenuObject->Process = PsGetCurrentProcess();
|
||||||
MenuObject->RtoL = FALSE; /* default */
|
MenuObject->RtoL = FALSE; /* default */
|
||||||
MenuObject->MenuInfo.cbSize = sizeof(MENUINFO); /* not used */
|
MenuObject->MenuInfo.cbSize = sizeof(MENUINFO); /* not used */
|
||||||
MenuObject->MenuInfo.fMask = 0; /* not used */
|
MenuObject->MenuInfo.fMask = 0; /* not used */
|
||||||
|
@ -284,9 +295,9 @@ IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar)
|
||||||
ExInitializeFastMutex(&MenuObject->MenuItemsLock);
|
ExInitializeFastMutex(&MenuObject->MenuItemsLock);
|
||||||
|
|
||||||
/* Insert menu item into process menu handle list */
|
/* Insert menu item into process menu handle list */
|
||||||
IntLockProcessMenus(Win32Process);
|
IntLockProcessMenus(PsGetWin32Process());
|
||||||
InsertTailList(&Win32Process->MenuListHead, &MenuObject->ListEntry);
|
InsertTailList(&PsGetWin32Process()->MenuListHead, &MenuObject->ListEntry);
|
||||||
IntUnLockProcessMenus(Win32Process);
|
IntUnLockProcessMenus(PsGetWin32Process());
|
||||||
|
|
||||||
return MenuObject;
|
return MenuObject;
|
||||||
}
|
}
|
||||||
|
@ -363,18 +374,17 @@ IntCloneMenu(PMENU_OBJECT Source)
|
||||||
{
|
{
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
PMENU_OBJECT MenuObject;
|
PMENU_OBJECT MenuObject;
|
||||||
PW32PROCESS Process = PsGetWin32Process();
|
|
||||||
|
|
||||||
if(!Source)
|
if(!Source)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
MenuObject = (PMENU_OBJECT)ObmCreateObject(
|
MenuObject = (PMENU_OBJECT)ObmCreateObject(
|
||||||
Process->WindowStation->HandleTable, &Handle,
|
PsGetWin32Thread()->Desktop->WindowStation->HandleTable, &Handle,
|
||||||
otMenu, sizeof(MENU_OBJECT));
|
otMenu, sizeof(MENU_OBJECT));
|
||||||
if(!MenuObject)
|
if(!MenuObject)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
MenuObject->W32Process = Process;
|
MenuObject->Process = PsGetCurrentProcess();
|
||||||
MenuObject->RtoL = Source->RtoL;
|
MenuObject->RtoL = Source->RtoL;
|
||||||
MenuObject->MenuInfo.cbSize = sizeof(MENUINFO); /* not used */
|
MenuObject->MenuInfo.cbSize = sizeof(MENUINFO); /* not used */
|
||||||
MenuObject->MenuInfo.fMask = Source->MenuInfo.fMask;
|
MenuObject->MenuInfo.fMask = Source->MenuInfo.fMask;
|
||||||
|
@ -396,9 +406,9 @@ IntCloneMenu(PMENU_OBJECT Source)
|
||||||
ExInitializeFastMutex(&MenuObject->MenuItemsLock);
|
ExInitializeFastMutex(&MenuObject->MenuItemsLock);
|
||||||
|
|
||||||
/* Insert menu item into process menu handle list */
|
/* Insert menu item into process menu handle list */
|
||||||
IntLockProcessMenus(Process);
|
IntLockProcessMenus(PsGetWin32Process());
|
||||||
InsertTailList(&Process->MenuListHead, &MenuObject->ListEntry);
|
InsertTailList(&PsGetWin32Process()->MenuListHead, &MenuObject->ListEntry);
|
||||||
IntUnLockProcessMenus(Process);
|
IntUnLockProcessMenus(PsGetWin32Process());
|
||||||
|
|
||||||
IntCloneMenuItems(MenuObject, Source);
|
IntCloneMenuItems(MenuObject, Source);
|
||||||
|
|
||||||
|
@ -1328,7 +1338,7 @@ NtUserCreateMenu(BOOL PopupMenu)
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
|
|
||||||
NTSTATUS Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
NTSTATUS Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
|
@ -1387,7 +1397,7 @@ NtUserDestroyMenu(
|
||||||
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if(MenuObject->W32Process != PsGetWin32Process())
|
if(MenuObject->Process != PsGetCurrentProcess())
|
||||||
{
|
{
|
||||||
IntReleaseMenuObject(MenuObject);
|
IntReleaseMenuObject(MenuObject);
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: message.c,v 1.74 2004/09/28 15:02:30 weiden Exp $
|
/* $Id: message.c,v 1.75 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -1126,7 +1126,7 @@ NtUserPostMessage(HWND Wnd,
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
CurInfo = IntGetSysCursorInfo(PsGetWin32Process()->WindowStation);
|
CurInfo = IntGetSysCursorInfo(PsGetWin32Thread()->Desktop->WindowStation);
|
||||||
KernelModeMsg.pt.x = CurInfo->x;
|
KernelModeMsg.pt.x = CurInfo->x;
|
||||||
KernelModeMsg.pt.y = CurInfo->y;
|
KernelModeMsg.pt.y = CurInfo->y;
|
||||||
KeQueryTickCount(&LargeTickCount);
|
KeQueryTickCount(&LargeTickCount);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: metric.c,v 1.22 2004/10/04 19:23:31 jc Exp $
|
/* $Id: metric.c,v 1.23 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -68,7 +68,7 @@ NtUserGetSystemMetrics(ULONG Index)
|
||||||
case SM_SWAPBUTTON:
|
case SM_SWAPBUTTON:
|
||||||
{
|
{
|
||||||
PSYSTEM_CURSORINFO CurInfo;
|
PSYSTEM_CURSORINFO CurInfo;
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: misc.c,v 1.87 2004/10/19 08:25:25 gvg Exp $
|
/* $Id: misc.c,v 1.88 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -215,7 +215,7 @@ NtUserCallOneParam(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
DWORD Result;
|
DWORD Result;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
|
@ -265,7 +265,7 @@ NtUserCallOneParam(
|
||||||
|
|
||||||
if(!Param)
|
if(!Param)
|
||||||
return (DWORD)FALSE;
|
return (DWORD)FALSE;
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
|
@ -686,7 +686,7 @@ IntSystemParametersInfo(
|
||||||
{
|
{
|
||||||
PSYSTEM_CURSORINFO CurInfo;
|
PSYSTEM_CURSORINFO CurInfo;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
|
@ -1038,7 +1038,7 @@ NtUserGetDoubleClickTime(VOID)
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
PSYSTEM_CURSORINFO CurInfo;
|
PSYSTEM_CURSORINFO CurInfo;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
|
|
|
@ -91,7 +91,7 @@ IntCreateMonitorObject()
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
PMONITOR_OBJECT Monitor;
|
PMONITOR_OBJECT Monitor;
|
||||||
|
|
||||||
Monitor = ObmCreateObject(PsGetWin32Process()->WindowStation->HandleTable, &Handle, otMonitor, sizeof (MONITOR_OBJECT));
|
Monitor = ObmCreateObject(PsGetWin32Thread()->Desktop->WindowStation->HandleTable, &Handle, otMonitor, sizeof (MONITOR_OBJECT));
|
||||||
if (Monitor == NULL)
|
if (Monitor == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -141,7 +141,7 @@ IntGetMonitorObject(IN HMONITOR hMonitor)
|
||||||
PMONITOR_OBJECT Monitor;
|
PMONITOR_OBJECT Monitor;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable, hMonitor, otMonitor, (PVOID *)&Monitor);
|
Status = ObmReferenceObjectByHandle(PsGetWin32Thread()->Desktop->WindowStation->HandleTable, hMonitor, otMonitor, (PVOID *)&Monitor);
|
||||||
if (!NT_SUCCESS(Status) || Monitor == NULL)
|
if (!NT_SUCCESS(Status) || Monitor == NULL)
|
||||||
{
|
{
|
||||||
/* FIXME: SetLastNtError( status ); ? */
|
/* FIXME: SetLastNtError( status ); ? */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: msgqueue.c,v 1.107 2004/09/28 15:02:30 weiden Exp $
|
/* $Id: msgqueue.c,v 1.108 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -175,18 +175,15 @@ MsqIsDblClk(LPMSG Msg, BOOL Remove)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
PSYSTEM_CURSORINFO CurInfo;
|
PSYSTEM_CURSORINFO CurInfo;
|
||||||
NTSTATUS Status;
|
|
||||||
LONG dX, dY;
|
LONG dX, dY;
|
||||||
BOOL Res;
|
BOOL Res;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
if (PsGetWin32Thread()->Desktop == NULL)
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
|
|
||||||
CurInfo = IntGetSysCursorInfo(WinStaObject);
|
CurInfo = IntGetSysCursorInfo(WinStaObject);
|
||||||
Res = (Msg->hwnd == (HWND)CurInfo->LastClkWnd) &&
|
Res = (Msg->hwnd == (HWND)CurInfo->LastClkWnd) &&
|
||||||
((Msg->time - CurInfo->LastBtnDown) < CurInfo->DblClickSpeed);
|
((Msg->time - CurInfo->LastBtnDown) < CurInfo->DblClickSpeed);
|
||||||
|
@ -220,7 +217,6 @@ MsqIsDblClk(LPMSG Msg, BOOL Remove)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
return Res;
|
return Res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,7 +612,7 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
PW32THREAD Win32Thread;
|
PW32THREAD Win32Thread;
|
||||||
PW32PROCESS Win32Process;
|
PWINSTATION_OBJECT WinSta;
|
||||||
MSG Mesg;
|
MSG Mesg;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
@ -634,14 +630,8 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Win32Process = ((PETHREAD)Thread)->ThreadsProcess->Win32Process;
|
WinSta = Win32Thread->Desktop->WindowStation;
|
||||||
if (Win32Process == NULL || Win32Process->WindowStation == NULL)
|
Status = ObmReferenceObjectByHandle(WinSta->HandleTable,
|
||||||
{
|
|
||||||
ObDereferenceObject ((PETHREAD)Thread);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = ObmReferenceObjectByHandle(Win32Process->WindowStation->HandleTable,
|
|
||||||
hWnd, otWindow, (PVOID*)&Window);
|
hWnd, otWindow, (PVOID*)&Window);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,16 +36,14 @@ IntAddAtom(LPWSTR AtomName)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
RTL_ATOM Atom;
|
RTL_ATOM Atom;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
if (PsGetWin32Thread()->Desktop == NULL)
|
||||||
KernelMode, 0, &WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return (RTL_ATOM)0;
|
return (RTL_ATOM)0;
|
||||||
}
|
}
|
||||||
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
Status = RtlAddAtomToAtomTable(WinStaObject->AtomTable,
|
Status = RtlAddAtomToAtomTable(WinStaObject->AtomTable,
|
||||||
AtomName, &Atom);
|
AtomName, &Atom);
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
|
@ -61,18 +59,16 @@ IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Size = nSize;
|
ULONG Size = nSize;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
if (PsGetWin32Thread()->Desktop == NULL)
|
||||||
KernelMode, 0, &WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
||||||
nAtom, NULL, NULL, lpBuffer, &Size);
|
nAtom, NULL, NULL, lpBuffer, &Size);
|
||||||
if (Size < nSize)
|
if (Size < nSize)
|
||||||
*(lpBuffer + Size) = 0;
|
*(lpBuffer + Size) = 0;
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: window.c,v 1.248 2004/11/15 23:10:42 gvg Exp $
|
/* $Id: window.c,v 1.249 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -106,18 +106,21 @@ IntIsWindow(HWND hWnd)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PWINDOW_OBJECT FASTCALL
|
PWINDOW_OBJECT FASTCALL
|
||||||
IntGetProcessWindowObject(PW32PROCESS ProcessData, HWND hWnd)
|
IntGetProcessWindowObject(PW32THREAD Thread, HWND hWnd)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT WindowObject;
|
PWINDOW_OBJECT WindowObject;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = ObmReferenceObjectByHandle(ProcessData->WindowStation->HandleTable,
|
if(Thread->Desktop != NULL)
|
||||||
hWnd, otWindow, (PVOID*)&WindowObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
return NULL;
|
Status = ObmReferenceObjectByHandle(Thread->Desktop->WindowStation->HandleTable,
|
||||||
|
hWnd, otWindow, (PVOID*)&WindowObject);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
return WindowObject;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return WindowObject;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,13 +331,13 @@ static LRESULT IntDestroyWindow(PWINDOW_OBJECT Window,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset shell window handles */
|
/* reset shell window handles */
|
||||||
if(ProcessData->WindowStation)
|
if(ThreadData->Desktop)
|
||||||
{
|
{
|
||||||
if (Window->Self == ProcessData->WindowStation->ShellWindow)
|
if (Window->Self == ThreadData->Desktop->WindowStation->ShellWindow)
|
||||||
ProcessData->WindowStation->ShellWindow = NULL;
|
ThreadData->Desktop->WindowStation->ShellWindow = NULL;
|
||||||
|
|
||||||
if (Window->Self == ProcessData->WindowStation->ShellListView)
|
if (Window->Self == ThreadData->Desktop->WindowStation->ShellListView)
|
||||||
ProcessData->WindowStation->ShellListView = NULL;
|
ThreadData->Desktop->WindowStation->ShellListView = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unregister hot keys */
|
/* Unregister hot keys */
|
||||||
|
@ -378,7 +381,7 @@ static LRESULT IntDestroyWindow(PWINDOW_OBJECT Window,
|
||||||
IntUnlinkWindow(Window);
|
IntUnlinkWindow(Window);
|
||||||
|
|
||||||
IntReferenceWindowObject(Window);
|
IntReferenceWindowObject(Window);
|
||||||
ObmCloseHandle(ProcessData->WindowStation->HandleTable, Window->Self);
|
ObmCloseHandle(ThreadData->Desktop->WindowStation->HandleTable, Window->Self);
|
||||||
|
|
||||||
IntDestroyScrollBars(Window);
|
IntDestroyScrollBars(Window);
|
||||||
|
|
||||||
|
@ -613,15 +616,15 @@ PMENU_OBJECT FASTCALL
|
||||||
IntGetSystemMenu(PWINDOW_OBJECT WindowObject, BOOL bRevert, BOOL RetMenu)
|
IntGetSystemMenu(PWINDOW_OBJECT WindowObject, BOOL bRevert, BOOL RetMenu)
|
||||||
{
|
{
|
||||||
PMENU_OBJECT MenuObject, NewMenuObject, SysMenuObject, ret = NULL;
|
PMENU_OBJECT MenuObject, NewMenuObject, SysMenuObject, ret = NULL;
|
||||||
PW32PROCESS W32Process;
|
PW32THREAD W32Thread;
|
||||||
HMENU NewMenu, SysMenu;
|
HMENU NewMenu, SysMenu;
|
||||||
ROSMENUITEMINFO ItemInfo;
|
ROSMENUITEMINFO ItemInfo;
|
||||||
|
|
||||||
if(bRevert)
|
if(bRevert)
|
||||||
{
|
{
|
||||||
W32Process = PsGetWin32Process();
|
W32Thread = PsGetWin32Thread();
|
||||||
|
|
||||||
if(!W32Process->WindowStation)
|
if(!W32Thread->Desktop)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if(WindowObject->SystemMenu)
|
if(WindowObject->SystemMenu)
|
||||||
|
@ -635,10 +638,10 @@ IntGetSystemMenu(PWINDOW_OBJECT WindowObject, BOOL bRevert, BOOL RetMenu)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(W32Process->WindowStation->SystemMenuTemplate)
|
if(W32Thread->Desktop->WindowStation->SystemMenuTemplate)
|
||||||
{
|
{
|
||||||
/* clone system menu */
|
/* clone system menu */
|
||||||
MenuObject = IntGetMenuObject(W32Process->WindowStation->SystemMenuTemplate);
|
MenuObject = IntGetMenuObject(W32Thread->Desktop->WindowStation->SystemMenuTemplate);
|
||||||
if(!MenuObject)
|
if(!MenuObject)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -1415,7 +1418,7 @@ IntCreateWindowEx(DWORD dwExStyle,
|
||||||
BOOL MenuChanged;
|
BOOL MenuChanged;
|
||||||
BOOL ClassFound;
|
BOOL ClassFound;
|
||||||
PWSTR ClassNameString;
|
PWSTR ClassNameString;
|
||||||
|
DPRINT1("PsGetWin32Thread()->Desktop == 0x%x\n", PsGetWin32Thread()->Desktop);
|
||||||
ParentWindowHandle = PsGetWin32Thread()->Desktop->DesktopWindow;
|
ParentWindowHandle = PsGetWin32Thread()->Desktop->DesktopWindow;
|
||||||
OwnerWindowHandle = NULL;
|
OwnerWindowHandle = NULL;
|
||||||
|
|
||||||
|
@ -1487,27 +1490,22 @@ IntCreateWindowEx(DWORD dwExStyle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the window station. */
|
/* Check the window station. */
|
||||||
DPRINT("IoGetCurrentProcess() %X\n", IoGetCurrentProcess());
|
if (PsGetWin32Thread()->Desktop == NULL)
|
||||||
DPRINT("PROCESS_WINDOW_STATION %X\n", PROCESS_WINDOW_STATION());
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
ClassDereferenceObject(ClassObject);
|
ClassDereferenceObject(ClassObject);
|
||||||
if (NULL != ParentWindow)
|
if (NULL != ParentWindow)
|
||||||
{
|
{
|
||||||
IntReleaseWindowObject(ParentWindow);
|
IntReleaseWindowObject(ParentWindow);
|
||||||
}
|
}
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
DPRINT("Thread is not attached to a desktop! Cannot create window!\n");
|
||||||
PROCESS_WINDOW_STATION());
|
|
||||||
return (HWND)0;
|
return (HWND)0;
|
||||||
}
|
}
|
||||||
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
|
ObReferenceObjectByPointer(WinStaObject, KernelMode, ExWindowStationObjectType, 0);
|
||||||
|
|
||||||
/* Create the window object. */
|
/* Create the window object. */
|
||||||
WindowObject = (PWINDOW_OBJECT)
|
WindowObject = (PWINDOW_OBJECT)
|
||||||
ObmCreateObject(PsGetWin32Process()->WindowStation->HandleTable, &Handle,
|
ObmCreateObject(PsGetWin32Thread()->Desktop->WindowStation->HandleTable, &Handle,
|
||||||
otWindow, sizeof(WINDOW_OBJECT) + ClassObject->cbWndExtra
|
otWindow, sizeof(WINDOW_OBJECT) + ClassObject->cbWndExtra
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -2872,7 +2870,7 @@ NtUserGetShellWindow()
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
HWND Ret;
|
HWND Ret;
|
||||||
|
|
||||||
NTSTATUS Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
NTSTATUS Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
|
@ -2904,7 +2902,7 @@ NtUserSetShellWindowEx(HWND hwndShell, HWND hwndListView)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
|
|
||||||
NTSTATUS Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
NTSTATUS Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
|
@ -3255,7 +3253,6 @@ LONG STDCALL
|
||||||
NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
|
NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT WindowObject, Parent;
|
PWINDOW_OBJECT WindowObject, Parent;
|
||||||
PW32PROCESS Process;
|
|
||||||
PWINSTATION_OBJECT WindowStation;
|
PWINSTATION_OBJECT WindowStation;
|
||||||
LONG OldValue;
|
LONG OldValue;
|
||||||
STYLESTRUCT Style;
|
STYLESTRUCT Style;
|
||||||
|
@ -3296,8 +3293,7 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
|
||||||
/*
|
/*
|
||||||
* Remove extended window style bit WS_EX_TOPMOST for shell windows.
|
* Remove extended window style bit WS_EX_TOPMOST for shell windows.
|
||||||
*/
|
*/
|
||||||
Process = WindowObject->OwnerThread->ThreadsProcess->Win32Process;
|
WindowStation = WindowObject->OwnerThread->Tcb.Win32Thread->Desktop->WindowStation;
|
||||||
WindowStation = Process->WindowStation;
|
|
||||||
if(WindowStation)
|
if(WindowStation)
|
||||||
{
|
{
|
||||||
if (hWnd == WindowStation->ShellWindow || hWnd == WindowStation->ShellListView)
|
if (hWnd == WindowStation->ShellWindow || hWnd == WindowStation->ShellListView)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: winpos.c,v 1.122 2004/11/15 23:10:42 gvg Exp $
|
/* $Id: winpos.c,v 1.123 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -1193,7 +1193,7 @@ WinPosShowWindow(HWND Wnd, INT Cmd)
|
||||||
// HRGN VisibleRgn;
|
// HRGN VisibleRgn;
|
||||||
|
|
||||||
Status =
|
Status =
|
||||||
ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
|
ObmReferenceObjectByHandle(PsGetWin32Thread()->Desktop->WindowStation->HandleTable,
|
||||||
Wnd,
|
Wnd,
|
||||||
otWindow,
|
otWindow,
|
||||||
(PVOID*)&Window);
|
(PVOID*)&Window);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Id: winsta.c,v 1.65 2004/08/20 22:38:49 gvg Exp $
|
* $Id: winsta.c,v 1.66 2004/11/20 16:46:06 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -85,7 +85,7 @@ CleanupWindowStationImpl(VOID)
|
||||||
/*
|
/*
|
||||||
* IntGetFullWindowStationName
|
* IntGetFullWindowStationName
|
||||||
*
|
*
|
||||||
* Get a full desktop object name from a name specified in
|
* Get a full window station object name from a name specified in
|
||||||
* NtUserCreateWindowStation, NtUserOpenWindowStation, NtUserCreateDesktop
|
* NtUserCreateWindowStation, NtUserOpenWindowStation, NtUserCreateDesktop
|
||||||
* or NtUserOpenDesktop.
|
* or NtUserOpenDesktop.
|
||||||
*
|
*
|
||||||
|
@ -478,7 +478,7 @@ NtUserOpenWindowStation(
|
||||||
|
|
||||||
Status = ObOpenObjectByName(
|
Status = ObOpenObjectByName(
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
ExDesktopObjectType,
|
ExWindowStationObjectType,
|
||||||
NULL,
|
NULL,
|
||||||
UserMode,
|
UserMode,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
|
@ -783,7 +783,48 @@ NtUserSetObjectInformation(
|
||||||
HWINSTA STDCALL
|
HWINSTA STDCALL
|
||||||
NtUserGetProcessWindowStation(VOID)
|
NtUserGetProcessWindowStation(VOID)
|
||||||
{
|
{
|
||||||
return PROCESS_WINDOW_STATION();
|
if(PsGetCurrentProcess() != CsrProcess)
|
||||||
|
{
|
||||||
|
return PsGetCurrentProcess()->Win32WindowStation;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* FIXME - get the pointer to the window station by querying the parent of
|
||||||
|
the desktop of the calling thread (which is a window station),
|
||||||
|
then use ObFindHandleForObject() to find a suitable handle */
|
||||||
|
DPRINT1("CSRSS called NtUserGetProcessWindowStation()!!! returned NULL!\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PWINSTATION_OBJECT FASTCALL
|
||||||
|
IntGetWinStaObj(VOID)
|
||||||
|
{
|
||||||
|
PWINSTATION_OBJECT WinStaObj;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* just a temporary hack, this will be gone soon
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(PsGetWin32Thread()->Desktop != NULL)
|
||||||
|
{
|
||||||
|
WinStaObj = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
|
ObReferenceObjectByPointer(WinStaObj, KernelMode, ExWindowStationObjectType, 0);
|
||||||
|
}
|
||||||
|
else if(PsGetCurrentProcess() != CsrProcess)
|
||||||
|
{
|
||||||
|
NTSTATUS Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
|
KernelMode,
|
||||||
|
0,
|
||||||
|
&WinStaObj);
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return WinStaObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -805,42 +846,43 @@ NtUserGetProcessWindowStation(VOID)
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserSetProcessWindowStation(HWINSTA hWindowStation)
|
NtUserSetProcessWindowStation(HWINSTA hWindowStation)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT Object;
|
HANDLE hOld;
|
||||||
PW32PROCESS Win32Process;
|
PWINSTATION_OBJECT NewWinSta;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("About to set process window station with handle (0x%X)\n",
|
DPRINT("About to set process window station with handle (0x%X)\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
|
|
||||||
|
if(PsGetCurrentProcess() == CsrProcess)
|
||||||
|
{
|
||||||
|
DPRINT1("CSRSS is not allowed to change it's window station!!!\n");
|
||||||
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(
|
Status = IntValidateWindowStationHandle(
|
||||||
hWindowStation,
|
hWindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&Object);
|
&NewWinSta);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
|
SetLastNtError(Status);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Win32Process = PsGetWin32Process();
|
/*
|
||||||
if (Win32Process == NULL)
|
* FIXME - don't allow changing the window station if there are threads that are attached to desktops and own gui objects
|
||||||
{
|
*/
|
||||||
ObDereferenceObject(Object);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Win32Process->WindowStation != NULL)
|
|
||||||
ObDereferenceObject(Win32Process->WindowStation);
|
|
||||||
Win32Process->WindowStation = Object;
|
|
||||||
}
|
|
||||||
|
|
||||||
SET_PROCESS_WINDOW_STATION(hWindowStation);
|
/* FIXME - dereference the old window station, etc... */
|
||||||
|
hOld = InterlockedExchangePointer(&PsGetCurrentProcess()->Win32WindowStation, hWindowStation);
|
||||||
|
|
||||||
DPRINT("IoGetCurrentProcess()->Win32WindowStation 0x%X\n",
|
DPRINT("PsGetCurrentProcess()->Win32WindowStation 0x%X\n",
|
||||||
IoGetCurrentProcess()->Win32WindowStation);
|
PsGetCurrentProcess()->Win32WindowStation);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: cursoricon.c,v 1.64 2004/08/07 00:25:10 navaraf Exp $ */
|
/* $Id: cursoricon.c,v 1.65 2004/11/20 16:46:06 weiden Exp $ */
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
PCURICON_OBJECT FASTCALL
|
PCURICON_OBJECT FASTCALL
|
||||||
|
@ -371,20 +371,20 @@ IntCleanupCurIcons(struct _EPROCESS *Process, PW32PROCESS Win32Process)
|
||||||
PCURICON_OBJECT Current;
|
PCURICON_OBJECT Current;
|
||||||
PLIST_ENTRY CurrentEntry, NextEntry;
|
PLIST_ENTRY CurrentEntry, NextEntry;
|
||||||
|
|
||||||
if(!(WinStaObject = Win32Process->WindowStation))
|
WinStaObject = IntGetWinStaObj();
|
||||||
return;
|
if(WinStaObject != NULL)
|
||||||
|
|
||||||
IntLockProcessCursorIcons(Win32Process);
|
|
||||||
CurrentEntry = Win32Process->CursorIconListHead.Flink;
|
|
||||||
while(CurrentEntry != &Win32Process->CursorIconListHead)
|
|
||||||
{
|
{
|
||||||
NextEntry = CurrentEntry->Flink;
|
CurrentEntry = Win32Process->CursorIconListHead.Flink;
|
||||||
Current = CONTAINING_RECORD(CurrentEntry, CURICON_OBJECT, ListEntry);
|
while(CurrentEntry != &Win32Process->CursorIconListHead)
|
||||||
RemoveEntryList(&Current->ListEntry);
|
{
|
||||||
IntDestroyCurIconObject(WinStaObject, Current->Self, FALSE);
|
NextEntry = CurrentEntry->Flink;
|
||||||
CurrentEntry = NextEntry;
|
Current = CONTAINING_RECORD(CurrentEntry, CURICON_OBJECT, ListEntry);
|
||||||
|
RemoveEntryList(&Current->ListEntry);
|
||||||
|
IntDestroyCurIconObject(WinStaObject, Current->Self, FALSE);
|
||||||
|
CurrentEntry = NextEntry;
|
||||||
|
}
|
||||||
|
ObDereferenceObject(WinStaObject);
|
||||||
}
|
}
|
||||||
IntUnLockProcessCursorIcons(Win32Process);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -400,14 +400,9 @@ NtUserCreateCursorIconHandle(PICONINFO IconInfo, BOOL Indirect)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE Ret;
|
HANDLE Ret;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if(WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
|
||||||
return (HANDLE)0;
|
return (HANDLE)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,14 +470,9 @@ NtUserGetCursorIconInfo(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
BOOL Ret = FALSE;
|
BOOL Ret = FALSE;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if(WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,14 +527,9 @@ NtUserGetCursorIconSize(
|
||||||
BOOL Ret = FALSE;
|
BOOL Ret = FALSE;
|
||||||
SIZE SafeSize;
|
SIZE SafeSize;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if(WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,14 +614,9 @@ NtUserGetCursorInfo(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if(WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,15 +656,9 @@ NtUserClipCursor(
|
||||||
RECT Rect;
|
RECT Rect;
|
||||||
PWINDOW_OBJECT DesktopWindow = NULL;
|
PWINDOW_OBJECT DesktopWindow = NULL;
|
||||||
|
|
||||||
NTSTATUS Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if (WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
DPRINT1("Validation of window station handle (0x%X) failed\n",
|
|
||||||
PROCESS_WINDOW_STATION());
|
|
||||||
SetLastNtError(Status);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,16 +713,10 @@ NtUserDestroyCursorIcon(
|
||||||
DWORD Unknown)
|
DWORD Unknown)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if(WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -777,17 +745,11 @@ NtUserFindExistingCursorIcon(
|
||||||
{
|
{
|
||||||
PCURICON_OBJECT CurIconObject;
|
PCURICON_OBJECT CurIconObject;
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
NTSTATUS Status;
|
|
||||||
HANDLE Ret = (HANDLE)0;
|
HANDLE Ret = (HANDLE)0;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if(WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,11 +786,8 @@ NtUserGetClipCursor(
|
||||||
if(!lpRect)
|
if(!lpRect)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if (WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||||
PROCESS_WINDOW_STATION());
|
PROCESS_WINDOW_STATION());
|
||||||
|
@ -877,15 +836,10 @@ NtUserSetCursor(
|
||||||
PCURICON_OBJECT CurIconObject;
|
PCURICON_OBJECT CurIconObject;
|
||||||
HICON OldCursor = (HCURSOR)0;
|
HICON OldCursor = (HCURSOR)0;
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if(WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
|
||||||
return (HCURSOR)0;
|
return (HCURSOR)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -918,14 +872,9 @@ NtUserSetCursorIconContents(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
BOOL Ret = FALSE;
|
BOOL Ret = FALSE;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if(WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -992,14 +941,9 @@ NtUserSetCursorIconData(
|
||||||
POINT SafeHotspot;
|
POINT SafeHotspot;
|
||||||
BOOL Ret = FALSE;
|
BOOL Ret = FALSE;
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if(WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1091,7 +1035,6 @@ NtUserDrawIconEx(
|
||||||
{
|
{
|
||||||
PCURICON_OBJECT CurIconObject;
|
PCURICON_OBJECT CurIconObject;
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
NTSTATUS Status;
|
|
||||||
HBITMAP hbmMask, hbmColor;
|
HBITMAP hbmMask, hbmColor;
|
||||||
BITMAP bmpMask, bmpColor;
|
BITMAP bmpMask, bmpColor;
|
||||||
BOOL DoFlickerFree;
|
BOOL DoFlickerFree;
|
||||||
|
@ -1105,14 +1048,9 @@ NtUserDrawIconEx(
|
||||||
INT nStretchMode;
|
INT nStretchMode;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
WinStaObject = IntGetWinStaObj();
|
||||||
KernelMode,
|
if(WinStaObject == NULL)
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue