mirror of
https://github.com/reactos/reactos.git
synced 2024-10-21 00:18:26 +00:00
7851c1a1c2
- Start to implement NtUserConsoleControl to allow the console server define Console Window Class atom. - In UserInitialize, initialize the current thread by a call to UserCreateThreadInfo. - In UserCreateThreadInfo, set the TIF_CSRSSTHREAD flag for threads created by CSRSS. - In NtUserQueryWindow, when querying the process/thread ID associated to a given window, check whether the window was created by CSRSS and if so, if this is a Console window, get the process/thread ID of the associated console process (console leader process), instead of the CID of CSRSS. [CONSRV] - Introduce the concept of console leader process (to be used as the process owning the console window). - Introduce extra console window information to store the PID and TID of the console leader process via new internal flags to be used by GetWindowLong. - Effectively set the console window console leader CID at its creation. - Improve CsrInitConsole to set a console leader process to the console being created. This fixes http://jira.reactos.org/browse/CORE-122 in this branch. [CONSRV-WIN32K] Fix various code misspellings. svn path=/branches/ros-csrss/; revision=58107
105 lines
2.5 KiB
C
105 lines
2.5 KiB
C
#pragma once
|
|
|
|
#define DECLARE_RETURN(type) type _ret_
|
|
#define RETURN(value) { _ret_ = value; goto _cleanup_; }
|
|
#define CLEANUP /*unreachable*/ ASSERT(FALSE); _cleanup_
|
|
#define END_CLEANUP return _ret_;
|
|
|
|
|
|
#define UserEnterCo UserEnterExclusive
|
|
#define UserLeaveCo UserLeave
|
|
|
|
extern BOOL gbInitialized;
|
|
extern PSERVERINFO gpsi;
|
|
extern PTHREADINFO gptiCurrent;
|
|
extern PPROCESSINFO gppiList;
|
|
extern PPROCESSINFO ppiScrnSaver;
|
|
extern PPROCESSINFO gppiInputProvider;
|
|
extern PEPROCESS gpepCSRSS;
|
|
extern ATOM gaGuiConsoleWndClass;
|
|
extern ATOM gaTuiConsoleWndClass;
|
|
|
|
INIT_FUNCTION NTSTATUS NTAPI InitUserImpl(VOID);
|
|
VOID FASTCALL CleanupUserImpl(VOID);
|
|
VOID FASTCALL UserEnterShared(VOID);
|
|
VOID FASTCALL UserEnterExclusive(VOID);
|
|
VOID FASTCALL UserLeave(VOID);
|
|
BOOL FASTCALL UserIsEntered(VOID);
|
|
BOOL FASTCALL UserIsEnteredExclusive(VOID);
|
|
|
|
/* User heap */
|
|
extern HANDLE GlobalUserHeap;
|
|
|
|
PWIN32HEAP
|
|
UserCreateHeap(OUT PSECTION_OBJECT *SectionObject,
|
|
IN OUT PVOID *SystemBase,
|
|
IN SIZE_T HeapSize);
|
|
|
|
static __inline PVOID
|
|
UserHeapAlloc(SIZE_T Bytes)
|
|
{
|
|
return RtlAllocateHeap(GlobalUserHeap,
|
|
HEAP_NO_SERIALIZE,
|
|
Bytes);
|
|
}
|
|
|
|
static __inline BOOL
|
|
UserHeapFree(PVOID lpMem)
|
|
{
|
|
return RtlFreeHeap(GlobalUserHeap,
|
|
HEAP_NO_SERIALIZE,
|
|
lpMem);
|
|
}
|
|
|
|
static __inline PVOID
|
|
UserHeapReAlloc(PVOID lpMem,
|
|
SIZE_T Bytes)
|
|
{
|
|
#if 0
|
|
/* NOTE: ntoskrnl doesn't export RtlReAllocateHeap... */
|
|
return RtlReAllocateHeap(GlobalUserHeap,
|
|
HEAP_NO_SERIALIZE,
|
|
lpMem,
|
|
Bytes);
|
|
#else
|
|
SIZE_T PrevSize;
|
|
PVOID pNew;
|
|
|
|
PrevSize = RtlSizeHeap(GlobalUserHeap,
|
|
HEAP_NO_SERIALIZE,
|
|
lpMem);
|
|
|
|
if (PrevSize == Bytes)
|
|
return lpMem;
|
|
|
|
pNew = RtlAllocateHeap(GlobalUserHeap,
|
|
HEAP_NO_SERIALIZE,
|
|
Bytes);
|
|
if (pNew != NULL)
|
|
{
|
|
if (PrevSize < Bytes)
|
|
Bytes = PrevSize;
|
|
|
|
RtlCopyMemory(pNew,
|
|
lpMem,
|
|
Bytes);
|
|
|
|
RtlFreeHeap(GlobalUserHeap,
|
|
HEAP_NO_SERIALIZE,
|
|
lpMem);
|
|
}
|
|
|
|
return pNew;
|
|
#endif
|
|
}
|
|
|
|
static __inline PVOID
|
|
UserHeapAddressToUser(PVOID lpMem)
|
|
{
|
|
PPROCESSINFO W32Process = PsGetCurrentProcessWin32Process();
|
|
return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
|
|
(ULONG_PTR)W32Process->HeapMappings.UserMapping);
|
|
}
|
|
|
|
/* EOF */
|