mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 17:14:32 +00:00
- Synchronize with trunk's revision r57633.
[WIN32CSR/BOOTDATA] - Finally get rid of win32csr, being replaced by winsrv and consrv. - Remove it from the subsystem command-line. [WINSRV] - Move a hack from win32csr to winsrv. svn path=/branches/ros-csrss/; revision=57635
This commit is contained in:
parent
43c7fc0c8d
commit
9dcdf10c6c
46 changed files with 532 additions and 856 deletions
|
@ -1239,7 +1239,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Kmode",0x000
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=consrv:ConServerDllInitialization,2 ServerDll=win32csr:Win32CsrInitialization,4 ProfileControl=Off MaxRequestThreads=16"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=consrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16"
|
||||||
|
|
||||||
; WOW Support
|
; WOW Support
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
||||||
|
|
|
@ -794,7 +794,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Kmode",0x000
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=consrv:ConServerDllInitialization,2 ServerDll=win32csr:Win32CsrInitialization,4 ProfileControl=Off MaxRequestThreads=16"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=consrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16"
|
||||||
|
|
||||||
; WOW Support
|
; WOW Support
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
||||||
|
|
|
@ -1239,7 +1239,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Kmode",0x000
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=consrv:ConServerDllInitialization,2 ServerDll=win32csr:Win32CsrInitialization,4 ProfileControl=Off MaxRequestThreads=16"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=consrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16"
|
||||||
|
|
||||||
; WOW Support
|
; WOW Support
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
||||||
|
|
|
@ -40,6 +40,8 @@ PKWIN32_DELETEMETHOD_CALLOUT ExpWindowStationObjectDelete = NULL;
|
||||||
PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpWindowStationObjectOkToClose = NULL;
|
PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpWindowStationObjectOkToClose = NULL;
|
||||||
PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpDesktopObjectOkToClose = NULL;
|
PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpDesktopObjectOkToClose = NULL;
|
||||||
PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete = NULL;
|
PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete = NULL;
|
||||||
|
PKWIN32_OPENMETHOD_CALLOUT ExpDesktopObjectOpen = NULL;
|
||||||
|
PKWIN32_CLOSEMETHOD_CALLOUT ExpDesktopObjectClose = NULL;
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
|
@ -133,6 +135,44 @@ ExpDesktopDelete(PVOID DeletedObject)
|
||||||
ExpDesktopObjectDelete(&Parameters);
|
ExpDesktopObjectDelete(&Parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
ExpDesktopOpen(IN OB_OPEN_REASON Reason,
|
||||||
|
IN PEPROCESS Process OPTIONAL,
|
||||||
|
IN PVOID ObjectBody,
|
||||||
|
IN ACCESS_MASK GrantedAccess,
|
||||||
|
IN ULONG HandleCount)
|
||||||
|
{
|
||||||
|
WIN32_OPENMETHOD_PARAMETERS Parameters;
|
||||||
|
|
||||||
|
Parameters.OpenReason = Reason;
|
||||||
|
Parameters.Process = Process;
|
||||||
|
Parameters.Object = ObjectBody;
|
||||||
|
Parameters.GrantedAccess = GrantedAccess;
|
||||||
|
Parameters.HandleCount = HandleCount;
|
||||||
|
|
||||||
|
return ExpDesktopObjectOpen(&Parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
ExpDesktopClose(IN PEPROCESS Process OPTIONAL,
|
||||||
|
IN PVOID Object,
|
||||||
|
IN ACCESS_MASK GrantedAccess,
|
||||||
|
IN ULONG ProcessHandleCount,
|
||||||
|
IN ULONG SystemHandleCount)
|
||||||
|
{
|
||||||
|
WIN32_CLOSEMETHOD_PARAMETERS Parameters;
|
||||||
|
|
||||||
|
Parameters.Process = Process;
|
||||||
|
Parameters.Object = Object;
|
||||||
|
Parameters.AccessMask = GrantedAccess;
|
||||||
|
Parameters.ProcessHandleCount = ProcessHandleCount;
|
||||||
|
Parameters.SystemHandleCount = SystemHandleCount;
|
||||||
|
|
||||||
|
ExpDesktopObjectClose(&Parameters);
|
||||||
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
INIT_FUNCTION
|
INIT_FUNCTION
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -169,6 +209,8 @@ ExpWin32kInit(VOID)
|
||||||
ObjectTypeInitializer.DeleteProcedure = ExpDesktopDelete;
|
ObjectTypeInitializer.DeleteProcedure = ExpDesktopDelete;
|
||||||
ObjectTypeInitializer.ParseProcedure = NULL;
|
ObjectTypeInitializer.ParseProcedure = NULL;
|
||||||
ObjectTypeInitializer.OkayToCloseProcedure = ExpDesktopOkToClose;
|
ObjectTypeInitializer.OkayToCloseProcedure = ExpDesktopOkToClose;
|
||||||
|
ObjectTypeInitializer.OpenProcedure = ExpDesktopOpen;
|
||||||
|
ObjectTypeInitializer.CloseProcedure = ExpDesktopClose;
|
||||||
ObCreateObjectType(&Name,
|
ObCreateObjectType(&Name,
|
||||||
&ObjectTypeInitializer,
|
&ObjectTypeInitializer,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -23,6 +23,8 @@ extern PKWIN32_DELETEMETHOD_CALLOUT ExpWindowStationObjectDelete;
|
||||||
extern PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpWindowStationObjectOkToClose;
|
extern PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpWindowStationObjectOkToClose;
|
||||||
extern PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpDesktopObjectOkToClose;
|
extern PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpDesktopObjectOkToClose;
|
||||||
extern PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete;
|
extern PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete;
|
||||||
|
extern PKWIN32_OPENMETHOD_CALLOUT ExpDesktopObjectOpen;
|
||||||
|
extern PKWIN32_CLOSEMETHOD_CALLOUT ExpDesktopObjectClose;
|
||||||
extern PKWIN32_POWEREVENT_CALLOUT PopEventCallout;
|
extern PKWIN32_POWEREVENT_CALLOUT PopEventCallout;
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS *********************************************************/
|
/* PRIVATE FUNCTIONS *********************************************************/
|
||||||
|
@ -121,6 +123,8 @@ PsEstablishWin32Callouts(IN PWIN32_CALLOUTS_FPNS CalloutData)
|
||||||
ExpWindowStationObjectOkToClose = CalloutData->WindowStationOkToCloseProcedure;
|
ExpWindowStationObjectOkToClose = CalloutData->WindowStationOkToCloseProcedure;
|
||||||
ExpDesktopObjectOkToClose = CalloutData->DesktopOkToCloseProcedure;
|
ExpDesktopObjectOkToClose = CalloutData->DesktopOkToCloseProcedure;
|
||||||
ExpDesktopObjectDelete = CalloutData->DesktopDeleteProcedure;
|
ExpDesktopObjectDelete = CalloutData->DesktopDeleteProcedure;
|
||||||
|
ExpDesktopObjectOpen = CalloutData->DesktopOpenProcedure;
|
||||||
|
ExpDesktopObjectClose = CalloutData->DesktopCloseProcedure;
|
||||||
PopEventCallout = CalloutData->PowerEventCallout;
|
PopEventCallout = CalloutData->PowerEventCallout;
|
||||||
KeGdiFlushUserBatch = CalloutData->BatchFlushRoutine;
|
KeGdiFlushUserBatch = CalloutData->BatchFlushRoutine;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ add_subdirectory(gdi/gdi32)
|
||||||
add_subdirectory(reactx)
|
add_subdirectory(reactx)
|
||||||
add_subdirectory(user/consrv)
|
add_subdirectory(user/consrv)
|
||||||
add_subdirectory(user/user32)
|
add_subdirectory(user/user32)
|
||||||
add_subdirectory(user/win32csr)
|
|
||||||
add_subdirectory(user/winsrv)
|
add_subdirectory(user/winsrv)
|
||||||
|
|
||||||
spec2def(win32k.sys win32k.spec ADD_IMPORTLIB)
|
spec2def(win32k.sys win32k.spec ADD_IMPORTLIB)
|
||||||
|
|
|
@ -32,16 +32,16 @@ IntCreatePrimarySurface(VOID)
|
||||||
SURFOBJ *pso;
|
SURFOBJ *pso;
|
||||||
PDESKTOP rpDesk;
|
PDESKTOP rpDesk;
|
||||||
|
|
||||||
|
/* Create surface */
|
||||||
|
pso = &PDEVOBJ_pSurface(gppdevPrimary)->SurfObj;
|
||||||
|
SurfSize = pso->sizlBitmap;
|
||||||
|
|
||||||
/* Attach monitor */
|
/* Attach monitor */
|
||||||
UserAttachMonitor((HDEV)gppdevPrimary);
|
UserAttachMonitor((HDEV)gppdevPrimary);
|
||||||
|
|
||||||
DPRINT("IntCreatePrimarySurface, gppdevPrimary=%p, gppdevPrimary->pSurface = %p\n",
|
DPRINT("IntCreatePrimarySurface, gppdevPrimary=%p, gppdevPrimary->pSurface = %p\n",
|
||||||
gppdevPrimary, gppdevPrimary->pSurface);
|
gppdevPrimary, gppdevPrimary->pSurface);
|
||||||
|
|
||||||
/* Create surface */
|
|
||||||
pso = &PDEVOBJ_pSurface(gppdevPrimary)->SurfObj;
|
|
||||||
SurfSize = pso->sizlBitmap;
|
|
||||||
|
|
||||||
/* Put the pointer in the center of the screen */
|
/* Put the pointer in the center of the screen */
|
||||||
gpsi->ptCursor.x = pso->sizlBitmap.cx / 2;
|
gpsi->ptCursor.x = pso->sizlBitmap.cx / 2;
|
||||||
gpsi->ptCursor.y = pso->sizlBitmap.cy / 2;
|
gpsi->ptCursor.y = pso->sizlBitmap.cy / 2;
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
/* Win32 headers */
|
/* Win32 headers */
|
||||||
/* FIXME: Defines in winbase.h that we need... */
|
/* FIXME: Defines in winbase.h that we need... */
|
||||||
typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
|
typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
|
||||||
|
#define MAKEINTATOM(i) (LPWSTR)((ULONG_PTR)((WORD)(i)))
|
||||||
#define WINBASEAPI
|
#define WINBASEAPI
|
||||||
#define STARTF_USESIZE 2
|
#define STARTF_USESIZE 2
|
||||||
#define STARTF_USEPOSITION 4
|
#define STARTF_USEPOSITION 4
|
||||||
|
|
|
@ -257,7 +257,7 @@ NtUserCreateAcceleratorTable(
|
||||||
RETURN( (HACCEL) NULL );
|
RETURN( (HACCEL) NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
Accel = UserCreateObject(gHandleTable, NULL, (PHANDLE)&hAccel, otAccel, sizeof(ACCELERATOR_TABLE));
|
Accel = UserCreateObject(gHandleTable, NULL, NULL, (PHANDLE)&hAccel, otAccel, sizeof(ACCELERATOR_TABLE));
|
||||||
|
|
||||||
if (Accel == NULL)
|
if (Accel == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,6 +130,9 @@ co_IntClientLoadLibrary(PUNICODE_STRING pstrLibName,
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
ULONG_PTR pLibNameBuffer = 0, pInitFuncBuffer = 0;
|
ULONG_PTR pLibNameBuffer = 0, pInitFuncBuffer = 0;
|
||||||
|
|
||||||
|
/* Do not allow the desktop thread to do callback to user mode */
|
||||||
|
ASSERT(PsGetCurrentThreadWin32Thread() != gptiDesktopThread);
|
||||||
|
|
||||||
TRACE("co_IntClientLoadLibrary: %S, %S, %d, %d\n", pstrLibName->Buffer, pstrLibName->Buffer, Unload, ApiHook);
|
TRACE("co_IntClientLoadLibrary: %S, %S, %d, %d\n", pstrLibName->Buffer, pstrLibName->Buffer, Unload, ApiHook);
|
||||||
|
|
||||||
/* Calculate the size of the argument */
|
/* Calculate the size of the argument */
|
||||||
|
@ -236,6 +239,9 @@ co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Do not allow the desktop thread to do callback to user mode */
|
||||||
|
ASSERT(PsGetCurrentThreadWin32Thread() != gptiDesktopThread);
|
||||||
|
|
||||||
Arguments.Callback = CompletionCallback;
|
Arguments.Callback = CompletionCallback;
|
||||||
Arguments.Wnd = hWnd;
|
Arguments.Wnd = hWnd;
|
||||||
Arguments.Msg = Msg;
|
Arguments.Msg = Msg;
|
||||||
|
@ -281,6 +287,9 @@ co_IntCallWindowProc(WNDPROC Proc,
|
||||||
ULONG ArgumentLength;
|
ULONG ArgumentLength;
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
|
|
||||||
|
/* Do not allow the desktop thread to do callback to user mode */
|
||||||
|
ASSERT(PsGetCurrentThreadWin32Thread() != gptiDesktopThread);
|
||||||
|
|
||||||
if (0 < lParamBufferSize)
|
if (0 < lParamBufferSize)
|
||||||
{
|
{
|
||||||
ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS) + lParamBufferSize;
|
ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS) + lParamBufferSize;
|
||||||
|
@ -364,6 +373,9 @@ co_IntLoadSysMenuTemplate()
|
||||||
PVOID ResultPointer;
|
PVOID ResultPointer;
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
|
|
||||||
|
/* Do not allow the desktop thread to do callback to user mode */
|
||||||
|
ASSERT(PsGetCurrentThreadWin32Thread() != gptiDesktopThread);
|
||||||
|
|
||||||
ResultPointer = NULL;
|
ResultPointer = NULL;
|
||||||
ResultLength = sizeof(LRESULT);
|
ResultLength = sizeof(LRESULT);
|
||||||
|
|
||||||
|
@ -394,6 +406,8 @@ co_IntLoadSysMenuTemplate()
|
||||||
return (HMENU)Result;
|
return (HMENU)Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern HCURSOR gDesktopCursor;
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
co_IntLoadDefaultCursors(VOID)
|
co_IntLoadDefaultCursors(VOID)
|
||||||
{
|
{
|
||||||
|
@ -402,8 +416,11 @@ co_IntLoadDefaultCursors(VOID)
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
BOOL DefaultCursor = TRUE;
|
BOOL DefaultCursor = TRUE;
|
||||||
|
|
||||||
|
/* Do not allow the desktop thread to do callback to user mode */
|
||||||
|
ASSERT(PsGetCurrentThreadWin32Thread() != gptiDesktopThread);
|
||||||
|
|
||||||
ResultPointer = NULL;
|
ResultPointer = NULL;
|
||||||
ResultLength = sizeof(LRESULT);
|
ResultLength = sizeof(HCURSOR);
|
||||||
|
|
||||||
UserLeaveCo();
|
UserLeaveCo();
|
||||||
|
|
||||||
|
@ -415,6 +432,9 @@ co_IntLoadDefaultCursors(VOID)
|
||||||
|
|
||||||
UserEnterCo();
|
UserEnterCo();
|
||||||
|
|
||||||
|
/* HACK: The desktop class doen't have a proper cursor yet, so set it here */
|
||||||
|
gDesktopCursor = *((HCURSOR*)ResultPointer);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -448,6 +468,8 @@ co_IntCallHookProc(INT HookId,
|
||||||
UINT lParamSize = 0;
|
UINT lParamSize = 0;
|
||||||
|
|
||||||
ASSERT(Proc);
|
ASSERT(Proc);
|
||||||
|
/* Do not allow the desktop thread to do callback to user mode */
|
||||||
|
ASSERT(PsGetCurrentThreadWin32Thread() != gptiDesktopThread);
|
||||||
|
|
||||||
pti = PsGetCurrentThreadWin32Thread();
|
pti = PsGetCurrentThreadWin32Thread();
|
||||||
if (pti->TIF_flags & TIF_INCLEANUP)
|
if (pti->TIF_flags & TIF_INCLEANUP)
|
||||||
|
@ -834,6 +856,9 @@ co_IntClientThreadSetup(VOID)
|
||||||
ULONG ArgumentLength, ResultLength;
|
ULONG ArgumentLength, ResultLength;
|
||||||
PVOID Argument, ResultPointer;
|
PVOID Argument, ResultPointer;
|
||||||
|
|
||||||
|
/* Do not allow the desktop thread to do callback to user mode */
|
||||||
|
ASSERT(PsGetCurrentThreadWin32Thread() != gptiDesktopThread);
|
||||||
|
|
||||||
ArgumentLength = ResultLength = 0;
|
ArgumentLength = ResultLength = 0;
|
||||||
Argument = ResultPointer = NULL;
|
Argument = ResultPointer = NULL;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ CreateCallProc(IN PDESKTOP Desktop,
|
||||||
|
|
||||||
NewCallProc = (PCALLPROCDATA)UserCreateObject(gHandleTable,
|
NewCallProc = (PCALLPROCDATA)UserCreateObject(gHandleTable,
|
||||||
Desktop,
|
Desktop,
|
||||||
|
NULL,
|
||||||
&Handle,
|
&Handle,
|
||||||
otCallProc,
|
otCallProc,
|
||||||
sizeof(CALLPROCDATA));
|
sizeof(CALLPROCDATA));
|
||||||
|
|
|
@ -641,9 +641,17 @@ IntReferenceClass(IN OUT PCLS BaseClass,
|
||||||
PCLS Class;
|
PCLS Class;
|
||||||
ASSERT(BaseClass->pclsBase == BaseClass);
|
ASSERT(BaseClass->pclsBase == BaseClass);
|
||||||
|
|
||||||
Class = IntGetClassForDesktop(BaseClass,
|
if (Desktop != NULL)
|
||||||
ClassLink,
|
{
|
||||||
Desktop);
|
Class = IntGetClassForDesktop(BaseClass,
|
||||||
|
ClassLink,
|
||||||
|
Desktop);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Class = BaseClass;
|
||||||
|
}
|
||||||
|
|
||||||
if (Class != NULL)
|
if (Class != NULL)
|
||||||
{
|
{
|
||||||
Class->cWndReferenceCount++;
|
Class->cWndReferenceCount++;
|
||||||
|
@ -1286,13 +1294,16 @@ FoundClass:
|
||||||
}
|
}
|
||||||
|
|
||||||
PCLS
|
PCLS
|
||||||
IntGetAndReferenceClass(PUNICODE_STRING ClassName, HINSTANCE hInstance)
|
IntGetAndReferenceClass(PUNICODE_STRING ClassName, HINSTANCE hInstance, BOOL bDesktopThread)
|
||||||
{
|
{
|
||||||
PCLS *ClassLink, Class = NULL;
|
PCLS *ClassLink, Class = NULL;
|
||||||
RTL_ATOM ClassAtom;
|
RTL_ATOM ClassAtom;
|
||||||
PTHREADINFO pti;
|
PTHREADINFO pti;
|
||||||
|
|
||||||
pti = PsGetCurrentThreadWin32Thread();
|
if (bDesktopThread)
|
||||||
|
pti = gptiDesktopThread;
|
||||||
|
else
|
||||||
|
pti = PsGetCurrentThreadWin32Thread();
|
||||||
|
|
||||||
if ( !(pti->ppi->W32PF_flags & W32PF_CLASSESREGISTERED ))
|
if ( !(pti->ppi->W32PF_flags & W32PF_CLASSESREGISTERED ))
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ IntDereferenceClass(IN OUT PCLS Class,
|
||||||
IN PPROCESSINFO pi);
|
IN PPROCESSINFO pi);
|
||||||
|
|
||||||
PCLS
|
PCLS
|
||||||
IntGetAndReferenceClass(PUNICODE_STRING ClassName, HINSTANCE hInstance);
|
IntGetAndReferenceClass(PUNICODE_STRING ClassName, HINSTANCE hInstance, BOOL bDesktopThread);
|
||||||
|
|
||||||
BOOL FASTCALL UserRegisterSystemClasses(VOID);
|
BOOL FASTCALL UserRegisterSystemClasses(VOID);
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,7 @@ IntSynthesizeDib(
|
||||||
|
|
||||||
/* Create the clipboard data */
|
/* Create the clipboard data */
|
||||||
pClipboardData = (PCLIPBOARDDATA)UserCreateObject(gHandleTable,
|
pClipboardData = (PCLIPBOARDDATA)UserCreateObject(gHandleTable,
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&hMem,
|
&hMem,
|
||||||
otClipBoardData,
|
otClipBoardData,
|
||||||
|
@ -293,7 +294,7 @@ IntAddSynthesizedFormats(PWINSTATION_OBJECT pWinStaObj)
|
||||||
PCLIPBOARDDATA pMemObj;
|
PCLIPBOARDDATA pMemObj;
|
||||||
HANDLE hMem;
|
HANDLE hMem;
|
||||||
|
|
||||||
pMemObj = (PCLIPBOARDDATA)UserCreateObject(gHandleTable, NULL, &hMem, otClipBoardData,
|
pMemObj = (PCLIPBOARDDATA)UserCreateObject(gHandleTable, NULL, NULL, &hMem, otClipBoardData,
|
||||||
sizeof(CLIPBOARDDATA) + sizeof(LCID));
|
sizeof(CLIPBOARDDATA) + sizeof(LCID));
|
||||||
if (pMemObj)
|
if (pMemObj)
|
||||||
{
|
{
|
||||||
|
@ -1080,7 +1081,7 @@ NtUserConvertMemHandle(
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
/* Create Clipboard data object */
|
/* Create Clipboard data object */
|
||||||
pMemObj = UserCreateObject(gHandleTable, NULL, &hMem, otClipBoardData, sizeof(CLIPBOARDDATA) + cbData);
|
pMemObj = UserCreateObject(gHandleTable, NULL, NULL, &hMem, otClipBoardData, sizeof(CLIPBOARDDATA) + cbData);
|
||||||
if (!pMemObj)
|
if (!pMemObj)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
|
|
@ -93,74 +93,4 @@ co_CsrNotify(IN OUT PCSR_API_MESSAGE ApiMessage,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
APIENTRY
|
|
||||||
CsrInsertObject(HANDLE ObjectHandle,
|
|
||||||
ACCESS_MASK DesiredAccess,
|
|
||||||
PHANDLE Handle)
|
|
||||||
{
|
|
||||||
NTSTATUS Status;
|
|
||||||
HANDLE CsrProcessHandle;
|
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
CLIENT_ID Cid;
|
|
||||||
|
|
||||||
/* Put CSR'S CID */
|
|
||||||
Cid.UniqueProcess = CsrProcess->UniqueProcessId;
|
|
||||||
Cid.UniqueThread = 0;
|
|
||||||
|
|
||||||
/* Empty Attributes */
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* Get a Handle to Csrss */
|
|
||||||
Status = ZwOpenProcess(&CsrProcessHandle,
|
|
||||||
PROCESS_DUP_HANDLE,
|
|
||||||
&ObjectAttributes,
|
|
||||||
&Cid);
|
|
||||||
|
|
||||||
if ((NT_SUCCESS(Status)))
|
|
||||||
{
|
|
||||||
/* Duplicate the Handle */
|
|
||||||
Status = ZwDuplicateObject(NtCurrentProcess(),
|
|
||||||
ObjectHandle,
|
|
||||||
CsrProcessHandle,
|
|
||||||
Handle,
|
|
||||||
DesiredAccess,
|
|
||||||
OBJ_INHERIT,
|
|
||||||
0);
|
|
||||||
|
|
||||||
/* Close our handle to CSRSS */
|
|
||||||
ZwClose(CsrProcessHandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
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->Pcb);
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = ZwClose(Handle);
|
|
||||||
|
|
||||||
if (CsrProcess != OldProcess)
|
|
||||||
{
|
|
||||||
KeDetachProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -209,7 +209,7 @@ IntCreateCurIconHandle()
|
||||||
PCURICON_OBJECT CurIcon;
|
PCURICON_OBJECT CurIcon;
|
||||||
HANDLE hCurIcon;
|
HANDLE hCurIcon;
|
||||||
|
|
||||||
CurIcon = UserCreateObject(gHandleTable, NULL, &hCurIcon, otCursorIcon, sizeof(CURICON_OBJECT));
|
CurIcon = UserCreateObject(gHandleTable, NULL, NULL, &hCurIcon, otCursorIcon, sizeof(CURICON_OBJECT));
|
||||||
|
|
||||||
if (!CurIcon)
|
if (!CurIcon)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,11 +11,17 @@
|
||||||
#include <win32k.h>
|
#include <win32k.h>
|
||||||
DBG_DEFAULT_CHANNEL(UserDesktop);
|
DBG_DEFAULT_CHANNEL(UserDesktop);
|
||||||
|
|
||||||
static
|
static NTSTATUS
|
||||||
VOID
|
UserInitializeDesktop(PDESKTOP pdesk, PUNICODE_STRING DesktopName, PWINSTATION_OBJECT pwinsta);
|
||||||
IntFreeDesktopHeap(
|
|
||||||
IN OUT PDESKTOP Desktop
|
static NTSTATUS
|
||||||
);
|
IntMapDesktopView(IN PDESKTOP pdesk);
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
IntUnmapDesktopView(IN PDESKTOP pdesk);
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
IntFreeDesktopHeap(IN PDESKTOP pdesk);
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
@ -23,6 +29,8 @@ IntFreeDesktopHeap(
|
||||||
PDESKTOP InputDesktop = NULL;
|
PDESKTOP InputDesktop = NULL;
|
||||||
HDESK InputDesktopHandle = NULL;
|
HDESK InputDesktopHandle = NULL;
|
||||||
HDC ScreenDeviceContext = NULL;
|
HDC ScreenDeviceContext = NULL;
|
||||||
|
PTHREADINFO gptiDesktopThread;
|
||||||
|
HCURSOR gDesktopCursor = NULL;
|
||||||
|
|
||||||
/* OBJECT CALLBACKS **********************************************************/
|
/* OBJECT CALLBACKS **********************************************************/
|
||||||
|
|
||||||
|
@ -112,17 +120,16 @@ IntDesktopObjectParse(IN PVOID ParseObject,
|
||||||
sizeof(DESKTOP),
|
sizeof(DESKTOP),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
(PVOID)&Desktop);
|
(PVOID*)&Desktop);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
/* Initialize shell hook window list and set the parent */
|
/* Initialize the desktop */
|
||||||
RtlZeroMemory(Desktop, sizeof(DESKTOP));
|
Status = UserInitializeDesktop(Desktop, RemainingName, WinStaObject);
|
||||||
InitializeListHead(&Desktop->ShellHookWindows);
|
if (!NT_SUCCESS(Status))
|
||||||
Desktop->rpwinstaParent = (PWINSTATION_OBJECT)ParseObject;
|
{
|
||||||
|
ObDereferenceObject(Desktop);
|
||||||
/* Put the desktop on the window station's list of associated desktops */
|
return Status;
|
||||||
InsertTailList(&Desktop->rpwinstaParent->DesktopListHead,
|
}
|
||||||
&Desktop->ListEntry);
|
|
||||||
|
|
||||||
/* Set the desktop object and return success */
|
/* Set the desktop object and return success */
|
||||||
*Object = Desktop;
|
*Object = Desktop;
|
||||||
|
@ -133,22 +140,29 @@ IntDesktopObjectParse(IN PVOID ParseObject,
|
||||||
VOID APIENTRY
|
VOID APIENTRY
|
||||||
IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters)
|
IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters)
|
||||||
{
|
{
|
||||||
PDESKTOP Desktop = (PDESKTOP)Parameters->Object;
|
PDESKTOP pdesk = (PDESKTOP)Parameters->Object;
|
||||||
|
|
||||||
TRACE("Deleting desktop object 0x%p\n", Desktop);
|
TRACE("Deleting desktop object 0x%p\n", pdesk);
|
||||||
|
|
||||||
|
ASSERT(pdesk->pDeskInfo->spwnd->spwndChild == NULL);
|
||||||
|
|
||||||
|
if (pdesk->pDeskInfo->spwnd)
|
||||||
|
co_UserDestroyWindow(pdesk->pDeskInfo->spwnd);
|
||||||
|
|
||||||
|
if (pdesk->spwndMessage)
|
||||||
|
co_UserDestroyWindow(pdesk->spwndMessage);
|
||||||
|
|
||||||
/* Remove the desktop from the window station's list of associcated desktops */
|
/* Remove the desktop from the window station's list of associcated desktops */
|
||||||
RemoveEntryList(&Desktop->ListEntry);
|
RemoveEntryList(&pdesk->ListEntry);
|
||||||
|
|
||||||
IntFreeDesktopHeap(Desktop);
|
/* Free the heap */
|
||||||
|
IntFreeDesktopHeap(pdesk);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
IntDesktopOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters)
|
IntDesktopOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters)
|
||||||
{
|
{
|
||||||
PTHREADINFO pti;
|
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
|
||||||
|
|
||||||
pti = PsGetCurrentThreadWin32Thread();
|
|
||||||
|
|
||||||
if( pti == NULL)
|
if( pti == NULL)
|
||||||
{
|
{
|
||||||
|
@ -166,6 +180,29 @@ IntDesktopOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters)
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS NTAPI IntDesktopObjectOpen(PWIN32_OPENMETHOD_PARAMETERS Parameters)
|
||||||
|
{
|
||||||
|
PPROCESSINFO ppi = PsGetProcessWin32Process(Parameters->Process);
|
||||||
|
if (ppi == NULL)
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
|
return IntMapDesktopView((PDESKTOP)Parameters->Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS NTAPI IntDesktopObjectClose(PWIN32_CLOSEMETHOD_PARAMETERS Parameters)
|
||||||
|
{
|
||||||
|
PPROCESSINFO ppi = PsGetProcessWin32Process(Parameters->Process);
|
||||||
|
if (ppi == NULL)
|
||||||
|
{
|
||||||
|
/* This happens when the process leaks desktop handles.
|
||||||
|
* At this point the PPROCESSINFO is already destroyed */
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IntUnmapDesktopView((PDESKTOP)Parameters->Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
INIT_FUNCTION
|
INIT_FUNCTION
|
||||||
|
@ -596,8 +633,66 @@ DesktopWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *lRe
|
||||||
case WM_SYSCOLORCHANGE:
|
case WM_SYSCOLORCHANGE:
|
||||||
co_UserRedrawWindow(Wnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN);
|
co_UserRedrawWindow(Wnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
case WM_SETCURSOR:
|
||||||
|
{
|
||||||
|
PCURICON_OBJECT pcurOld, pcurNew;
|
||||||
|
pcurNew = UserGetCurIconObject(gDesktopCursor);
|
||||||
|
if (!pcurNew)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
pcurOld = UserSetCursor(pcurNew, FALSE);
|
||||||
|
if (pcurOld)
|
||||||
|
{
|
||||||
|
UserDereferenceObject(pcurOld);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return FALSE; // Not processed so go with callback.
|
return TRUE; /* We are done. Do not do any callbacks to user mode */
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
UserMessageWindowProc(PWND pwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
|
||||||
|
{
|
||||||
|
*lResult = 0;
|
||||||
|
|
||||||
|
switch(Msg)
|
||||||
|
{
|
||||||
|
case WM_NCCREATE:
|
||||||
|
pwnd->fnid |= FNID_MESSAGEWND;
|
||||||
|
*lResult = (LRESULT)TRUE;
|
||||||
|
break;
|
||||||
|
case WM_DESTROY:
|
||||||
|
pwnd->fnid |= FNID_DESTROY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE; /* We are done. Do not do any callbacks to user mode */
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID NTAPI DesktopThreadMain()
|
||||||
|
{
|
||||||
|
BOOL Ret;
|
||||||
|
MSG Msg;
|
||||||
|
|
||||||
|
gptiDesktopThread = PsGetCurrentThreadWin32Thread();
|
||||||
|
|
||||||
|
UserEnterExclusive();
|
||||||
|
|
||||||
|
/* Register system classes. This thread does not belong to any desktop so the
|
||||||
|
classes will be allocated from the shared heap */
|
||||||
|
UserRegisterSystemClasses();
|
||||||
|
|
||||||
|
while(TRUE)
|
||||||
|
{
|
||||||
|
Ret = co_IntGetPeekMessage(&Msg, 0, 0, 0, PM_REMOVE, TRUE);
|
||||||
|
if (Ret)
|
||||||
|
{
|
||||||
|
IntDispatchMessage(&Msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UserLeave();
|
||||||
}
|
}
|
||||||
|
|
||||||
HDC FASTCALL
|
HDC FASTCALL
|
||||||
|
@ -813,6 +908,8 @@ BOOL IntDeRegisterShellHookWindow(HWND hWnd)
|
||||||
static VOID
|
static VOID
|
||||||
IntFreeDesktopHeap(IN OUT PDESKTOP Desktop)
|
IntFreeDesktopHeap(IN OUT PDESKTOP Desktop)
|
||||||
{
|
{
|
||||||
|
/* FIXME: Disable until unmapping works in mm */
|
||||||
|
#if 0
|
||||||
if (Desktop->pheapDesktop != NULL)
|
if (Desktop->pheapDesktop != NULL)
|
||||||
{
|
{
|
||||||
MmUnmapViewInSessionSpace(Desktop->pheapDesktop);
|
MmUnmapViewInSessionSpace(Desktop->pheapDesktop);
|
||||||
|
@ -824,6 +921,7 @@ IntFreeDesktopHeap(IN OUT PDESKTOP Desktop)
|
||||||
ObDereferenceObject(Desktop->hsectionDesktop);
|
ObDereferenceObject(Desktop->hsectionDesktop);
|
||||||
Desktop->hsectionDesktop = NULL;
|
Desktop->hsectionDesktop = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
|
@ -1030,6 +1128,61 @@ IntPaintDesktop(HDC hDC)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
UserInitializeDesktop(PDESKTOP pdesk, PUNICODE_STRING DesktopName, PWINSTATION_OBJECT pwinsta)
|
||||||
|
{
|
||||||
|
PVOID DesktopHeapSystemBase = NULL;
|
||||||
|
ULONG_PTR HeapSize = 400 * 1024;
|
||||||
|
SIZE_T DesktopInfoSize;
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
|
TRACE("UserInitializeDesktop desktop 0x%p with name %wZ\n", pdesk, DesktopName);
|
||||||
|
|
||||||
|
RtlZeroMemory(pdesk, sizeof(DESKTOP));
|
||||||
|
|
||||||
|
/* Link the desktop with the parent window station */
|
||||||
|
pdesk->rpwinstaParent = pwinsta;
|
||||||
|
InsertTailList(&pwinsta->DesktopListHead, &pdesk->ListEntry);
|
||||||
|
|
||||||
|
/* Create the desktop heap */
|
||||||
|
pdesk->hsectionDesktop = NULL;
|
||||||
|
pdesk->pheapDesktop = UserCreateHeap(&pdesk->hsectionDesktop,
|
||||||
|
&DesktopHeapSystemBase,
|
||||||
|
HeapSize);
|
||||||
|
if (pdesk->pheapDesktop == NULL)
|
||||||
|
{
|
||||||
|
ERR("Failed to create desktop heap!\n");
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create DESKTOPINFO */
|
||||||
|
DesktopInfoSize = sizeof(DESKTOPINFO) + DesktopName->Length + sizeof(WCHAR);
|
||||||
|
pdesk->pDeskInfo = RtlAllocateHeap(pdesk->pheapDesktop,
|
||||||
|
HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY,
|
||||||
|
DesktopInfoSize);
|
||||||
|
if (pdesk->pDeskInfo == NULL)
|
||||||
|
{
|
||||||
|
ERR("Failed to create the DESKTOP structure!\n");
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize the DESKTOPINFO */
|
||||||
|
pdesk->pDeskInfo->pvDesktopBase = DesktopHeapSystemBase;
|
||||||
|
pdesk->pDeskInfo->pvDesktopLimit = (PVOID)((ULONG_PTR)DesktopHeapSystemBase + HeapSize);
|
||||||
|
RtlCopyMemory(pdesk->pDeskInfo->szDesktopName,
|
||||||
|
DesktopName->Buffer,
|
||||||
|
DesktopName->Length + sizeof(WCHAR));
|
||||||
|
for (i = 0; i < NB_HOOKS; i++)
|
||||||
|
{
|
||||||
|
InitializeListHead(&pdesk->pDeskInfo->aphkStart[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
InitializeListHead(&pdesk->ShellHookWindows);
|
||||||
|
InitializeListHead(&pdesk->PtiList);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* SYSCALLS *******************************************************************/
|
/* SYSCALLS *******************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1073,43 +1226,35 @@ NtUserCreateDesktop(
|
||||||
DWORD dwFlags,
|
DWORD dwFlags,
|
||||||
ACCESS_MASK dwDesiredAccess)
|
ACCESS_MASK dwDesiredAccess)
|
||||||
{
|
{
|
||||||
PDESKTOP DesktopObject;
|
PDESKTOP pdesk = NULL;
|
||||||
UNICODE_STRING DesktopName;
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
HDESK Desktop;
|
HDESK hdesk;
|
||||||
CSR_API_MESSAGE Request;
|
|
||||||
PVOID DesktopHeapSystemBase = NULL;
|
|
||||||
SIZE_T DesktopInfoSize;
|
|
||||||
BOOLEAN Context;
|
BOOLEAN Context;
|
||||||
ULONG_PTR HeapSize = 400 * 1024; /* FIXME: Windows uses 200KB by default */
|
|
||||||
UNICODE_STRING ClassName;
|
UNICODE_STRING ClassName;
|
||||||
LARGE_STRING WindowName;
|
LARGE_STRING WindowName;
|
||||||
BOOL NoHooks = FALSE;
|
BOOL NoHooks = FALSE;
|
||||||
PWND pWnd = NULL;
|
PWND pWnd = NULL;
|
||||||
CREATESTRUCTW Cs;
|
CREATESTRUCTW Cs;
|
||||||
INT i;
|
|
||||||
PTHREADINFO ptiCurrent;
|
PTHREADINFO ptiCurrent;
|
||||||
|
PCLS pcls;
|
||||||
|
|
||||||
DECLARE_RETURN(HDESK);
|
DECLARE_RETURN(HDESK);
|
||||||
|
|
||||||
TRACE("Enter NtUserCreateDesktop\n");
|
TRACE("Enter NtUserCreateDesktop\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
ptiCurrent = PsGetCurrentThreadWin32Thread();
|
ptiCurrent = PsGetCurrentThreadWin32Thread();
|
||||||
if (ptiCurrent)
|
ASSERT(ptiCurrent);
|
||||||
{
|
ASSERT(gptiDesktopThread);
|
||||||
|
|
||||||
/* Turn off hooks when calling any CreateWindowEx from inside win32k. */
|
/* Turn off hooks when calling any CreateWindowEx from inside win32k. */
|
||||||
NoHooks = (ptiCurrent->TIF_flags & TIF_DISABLEHOOKS);
|
NoHooks = (ptiCurrent->TIF_flags & TIF_DISABLEHOOKS);
|
||||||
ptiCurrent->TIF_flags |= TIF_DISABLEHOOKS;
|
ptiCurrent->TIF_flags |= TIF_DISABLEHOOKS;
|
||||||
ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags;
|
ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags;
|
||||||
}
|
|
||||||
/*else
|
|
||||||
{ERR("NtUserCreateDesktop: No ptiCurrent\n");}*/
|
|
||||||
DesktopName.Buffer = NULL;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to open already existing desktop
|
* Try to open already existing desktop
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Status = ObOpenObjectByName(
|
Status = ObOpenObjectByName(
|
||||||
ObjectAttributes,
|
ObjectAttributes,
|
||||||
ExDesktopObjectType,
|
ExDesktopObjectType,
|
||||||
|
@ -1117,143 +1262,99 @@ NtUserCreateDesktop(
|
||||||
NULL,
|
NULL,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
(PVOID)&Context,
|
(PVOID)&Context,
|
||||||
(HANDLE*)&Desktop);
|
(HANDLE*)&hdesk);
|
||||||
if (!NT_SUCCESS(Status)) RETURN(NULL);
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ERR("ObOpenObjectByName failed to open/create desktop\n");
|
||||||
|
SetLastNtError(Status);
|
||||||
|
RETURN(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* In case the object was not created (eg if it existed), return now */
|
/* In case the object was not created (eg if it existed), return now */
|
||||||
if (Context == FALSE)
|
if (Context == FALSE)
|
||||||
{
|
{
|
||||||
TRACE("NtUserCreateDesktop opened desktop %wZ\n", ObjectAttributes->ObjectName);
|
TRACE("NtUserCreateDesktop opened desktop %wZ\n", ObjectAttributes->ObjectName);
|
||||||
RETURN( Desktop);
|
RETURN( hdesk);
|
||||||
}
|
|
||||||
|
|
||||||
/* Capture desktop name */
|
|
||||||
_SEH2_TRY
|
|
||||||
{
|
|
||||||
ProbeForRead( ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 1);
|
|
||||||
|
|
||||||
Status = IntSafeCopyUnicodeStringTerminateNULL(&DesktopName, ObjectAttributes->ObjectName);
|
|
||||||
}
|
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
||||||
{
|
|
||||||
Status = _SEH2_GetExceptionCode();
|
|
||||||
}
|
|
||||||
_SEH2_END
|
|
||||||
|
|
||||||
if (! NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
ERR("Failed reading Object Attributes from user space.\n");
|
|
||||||
SetLastNtError(Status);
|
|
||||||
RETURN( NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reference the desktop */
|
/* Reference the desktop */
|
||||||
Status = ObReferenceObjectByHandle(Desktop,
|
Status = ObReferenceObjectByHandle(hdesk,
|
||||||
0,
|
0,
|
||||||
ExDesktopObjectType,
|
ExDesktopObjectType,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
(PVOID)&DesktopObject,
|
(PVOID*)&pdesk,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR("Failed to reference desktop object\n");
|
ERR("Failed to reference desktop object\n");
|
||||||
|
SetLastNtError(Status);
|
||||||
RETURN(NULL);
|
RETURN(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("NtUserCreateDesktop created desktop 0x%p with name %wZ\n", DesktopObject, &DesktopName);
|
if (!ptiCurrent->rpdesk) IntSetThreadDesktop(hdesk,FALSE);
|
||||||
|
|
||||||
DesktopObject->hsectionDesktop = NULL;
|
/* Get the desktop window class. The thread desktop does not belong to any desktop
|
||||||
DesktopObject->pheapDesktop = UserCreateHeap(&DesktopObject->hsectionDesktop,
|
* so the classes created there (including the desktop class) are allocated in the shared heap
|
||||||
&DesktopHeapSystemBase,
|
* It would cause problems if we used a class that belongs to the caller
|
||||||
HeapSize);
|
|
||||||
if (DesktopObject->pheapDesktop == NULL)
|
|
||||||
{
|
|
||||||
ObDereferenceObject(DesktopObject);
|
|
||||||
ERR("Failed to create desktop heap!\n");
|
|
||||||
RETURN(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
DesktopInfoSize = sizeof(DESKTOPINFO) + DesktopName.Length + sizeof(WCHAR);
|
|
||||||
|
|
||||||
DesktopObject->pDeskInfo = RtlAllocateHeap(DesktopObject->pheapDesktop,
|
|
||||||
HEAP_NO_SERIALIZE,
|
|
||||||
DesktopInfoSize);
|
|
||||||
|
|
||||||
if (DesktopObject->pDeskInfo == NULL)
|
|
||||||
{
|
|
||||||
ObDereferenceObject(DesktopObject);
|
|
||||||
ERR("Failed to create the DESKTOP structure!\n");
|
|
||||||
RETURN(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlZeroMemory(DesktopObject->pDeskInfo,
|
|
||||||
DesktopInfoSize);
|
|
||||||
|
|
||||||
DesktopObject->pDeskInfo->pvDesktopBase = DesktopHeapSystemBase;
|
|
||||||
DesktopObject->pDeskInfo->pvDesktopLimit = (PVOID)((ULONG_PTR)DesktopHeapSystemBase + HeapSize);
|
|
||||||
RtlCopyMemory(DesktopObject->pDeskInfo->szDesktopName,
|
|
||||||
DesktopName.Buffer,
|
|
||||||
DesktopName.Length + sizeof(WCHAR));
|
|
||||||
|
|
||||||
/* Initialize some local (to win32k) desktop state. */
|
|
||||||
InitializeListHead(&DesktopObject->PtiList);
|
|
||||||
DesktopObject->ActiveMessageQueue = NULL;
|
|
||||||
|
|
||||||
/* Setup Global Hooks. */
|
|
||||||
for (i = 0; i < NB_HOOKS; i++)
|
|
||||||
{
|
|
||||||
InitializeListHead(&DesktopObject->pDeskInfo->aphkStart[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create a handle for CSRSS and notify CSRSS for Creating Desktop Background Windows and Threads.
|
|
||||||
*/
|
*/
|
||||||
Request.ApiNumber = CSR_CREATE_API_NUMBER(CSR_GUI, CREATE_DESKTOP);
|
ClassName.Buffer = WC_DESKTOP;
|
||||||
Status = CsrInsertObject(Desktop,
|
|
||||||
GENERIC_ALL,
|
|
||||||
(HANDLE*)&Request.Data.CreateDesktopRequest.DesktopHandle);
|
|
||||||
if (! NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
ERR("Failed to create desktop handle for CSRSS\n");
|
|
||||||
ZwClose(Desktop);
|
|
||||||
SetLastNtError(Status);
|
|
||||||
RETURN( NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = co_CsrNotify((PCSR_API_MESSAGE)&Request,
|
|
||||||
sizeof(CSR_API_MESSAGE));
|
|
||||||
if (! NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
CsrCloseHandle(Request.Data.CreateDesktopRequest.DesktopHandle);
|
|
||||||
ERR("Failed to notify CSRSS about new desktop\n");
|
|
||||||
ZwClose(Desktop);
|
|
||||||
SetLastNtError(Status);
|
|
||||||
RETURN( NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ptiCurrent && !ptiCurrent->rpdesk) IntSetThreadDesktop(Desktop,FALSE);
|
|
||||||
|
|
||||||
ClassName.Buffer = ((PWSTR)((ULONG_PTR)(WORD)(gpsi->atomSysClass[ICLS_HWNDMESSAGE])));
|
|
||||||
ClassName.Length = 0;
|
ClassName.Length = 0;
|
||||||
RtlZeroMemory(&WindowName, sizeof(WindowName));
|
pcls = IntGetAndReferenceClass(&ClassName, 0, TRUE);
|
||||||
|
if (pcls == NULL)
|
||||||
|
{
|
||||||
|
ASSERT(FALSE);
|
||||||
|
RETURN(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlZeroMemory(&WindowName, sizeof(WindowName));
|
||||||
RtlZeroMemory(&Cs, sizeof(Cs));
|
RtlZeroMemory(&Cs, sizeof(Cs));
|
||||||
Cs.cx = Cs.cy = 100;
|
Cs.x = UserGetSystemMetrics(SM_XVIRTUALSCREEN),
|
||||||
|
Cs.y = UserGetSystemMetrics(SM_YVIRTUALSCREEN),
|
||||||
|
Cs.cx = UserGetSystemMetrics(SM_CXVIRTUALSCREEN),
|
||||||
|
Cs.cy = UserGetSystemMetrics(SM_CYVIRTUALSCREEN),
|
||||||
Cs.style = WS_POPUP|WS_CLIPCHILDREN;
|
Cs.style = WS_POPUP|WS_CLIPCHILDREN;
|
||||||
Cs.hInstance = hModClient; // hModuleWin; // Server side winproc! Leave it to Timo to not pass on notes!
|
Cs.hInstance = hModClient; // hModuleWin; // Server side winproc!
|
||||||
Cs.lpszName = (LPCWSTR) &WindowName;
|
Cs.lpszName = (LPCWSTR) &WindowName;
|
||||||
Cs.lpszClass = (LPCWSTR) &ClassName;
|
Cs.lpszClass = (LPCWSTR) &ClassName;
|
||||||
|
|
||||||
pWnd = co_UserCreateWindowEx(&Cs, &ClassName, &WindowName, NULL);
|
/* Use IntCreateWindow instead of co_UserCreateWindowEx cause the later expects a thread with a desktop */
|
||||||
if (!pWnd)
|
pWnd = IntCreateWindow(&Cs, &WindowName, pcls, NULL, NULL, NULL, pdesk);
|
||||||
|
if (pWnd == NULL)
|
||||||
{
|
{
|
||||||
ERR("Failed to create Message window handle\n");
|
ERR("Failed to create desktop window for the new desktop\n");
|
||||||
|
RETURN(NULL);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
pdesk->DesktopWindow = pWnd->head.h;
|
||||||
|
pdesk->pDeskInfo->spwnd = pWnd;
|
||||||
|
pWnd->fnid = FNID_DESKTOP;
|
||||||
|
|
||||||
|
ClassName.Buffer = MAKEINTATOM(gpsi->atomSysClass[ICLS_HWNDMESSAGE]);
|
||||||
|
ClassName.Length = 0;
|
||||||
|
pcls = IntGetAndReferenceClass(&ClassName, 0, TRUE);
|
||||||
|
if (pcls == NULL)
|
||||||
{
|
{
|
||||||
DesktopObject->spwndMessage = pWnd;
|
ASSERT(FALSE);
|
||||||
|
RETURN(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RtlZeroMemory(&WindowName, sizeof(WindowName));
|
||||||
|
RtlZeroMemory(&Cs, sizeof(Cs));
|
||||||
|
Cs.cx = Cs.cy = 100;
|
||||||
|
Cs.style = WS_POPUP|WS_CLIPCHILDREN;
|
||||||
|
Cs.hInstance = hModClient; // hModuleWin; // Server side winproc!
|
||||||
|
Cs.lpszName = (LPCWSTR) &WindowName;
|
||||||
|
Cs.lpszClass = (LPCWSTR) &ClassName;
|
||||||
|
pWnd = IntCreateWindow(&Cs, &WindowName, pcls, NULL, NULL, NULL, pdesk);
|
||||||
|
if (pWnd == NULL)
|
||||||
|
{
|
||||||
|
ERR("Failed to create message window for the new desktop\n");
|
||||||
|
RETURN(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
pdesk->spwndMessage = pWnd;
|
||||||
|
pWnd->fnid = FNID_MESSAGEWND;
|
||||||
|
|
||||||
/* Now,,,
|
/* Now,,,
|
||||||
if !(WinStaObject->Flags & WSF_NOIO) is (not set) for desktop input output mode (see wiki)
|
if !(WinStaObject->Flags & WSF_NOIO) is (not set) for desktop input output mode (see wiki)
|
||||||
Create Tooltip. Saved in DesktopObject->spwndTooltip.
|
Create Tooltip. Saved in DesktopObject->spwndTooltip.
|
||||||
|
@ -1262,14 +1363,18 @@ NtUserCreateDesktop(
|
||||||
The rest is same as message window.
|
The rest is same as message window.
|
||||||
http://msdn.microsoft.com/en-us/library/bb760250(VS.85).aspx
|
http://msdn.microsoft.com/en-us/library/bb760250(VS.85).aspx
|
||||||
*/
|
*/
|
||||||
RETURN( Desktop);
|
RETURN( hdesk);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
if(DesktopName.Buffer != NULL)
|
if (pdesk != NULL)
|
||||||
{
|
{
|
||||||
ExFreePoolWithTag(DesktopName.Buffer, TAG_STRING);
|
ObDereferenceObject(pdesk);
|
||||||
}
|
}
|
||||||
if (!NoHooks && ptiCurrent)
|
if (_ret_ == NULL && hdesk != NULL)
|
||||||
|
{
|
||||||
|
ObCloseHandle(hdesk, UserMode);
|
||||||
|
}
|
||||||
|
if (!NoHooks)
|
||||||
{
|
{
|
||||||
ptiCurrent->TIF_flags &= ~TIF_DISABLEHOOKS;
|
ptiCurrent->TIF_flags &= ~TIF_DISABLEHOOKS;
|
||||||
ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags;
|
ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags;
|
||||||
|
|
|
@ -73,6 +73,7 @@ extern PDESKTOP InputDesktop;
|
||||||
extern HDESK InputDesktopHandle;
|
extern HDESK InputDesktopHandle;
|
||||||
extern PCLS DesktopWindowClass;
|
extern PCLS DesktopWindowClass;
|
||||||
extern HDC ScreenDeviceContext;
|
extern HDC ScreenDeviceContext;
|
||||||
|
extern PTHREADINFO gptiDesktopThread;
|
||||||
|
|
||||||
typedef struct _SHELL_HOOK_WINDOW
|
typedef struct _SHELL_HOOK_WINDOW
|
||||||
{
|
{
|
||||||
|
@ -104,6 +105,12 @@ IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters);
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
IntDesktopOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters);
|
IntDesktopOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters);
|
||||||
|
|
||||||
|
NTSTATUS NTAPI
|
||||||
|
IntDesktopObjectOpen(PWIN32_OPENMETHOD_PARAMETERS Parameters);
|
||||||
|
|
||||||
|
NTSTATUS NTAPI
|
||||||
|
IntDesktopObjectClose(PWIN32_CLOSEMETHOD_PARAMETERS Parameters);
|
||||||
|
|
||||||
HDC FASTCALL
|
HDC FASTCALL
|
||||||
IntGetScreenDC(VOID);
|
IntGetScreenDC(VOID);
|
||||||
|
|
||||||
|
@ -283,4 +290,6 @@ PWND FASTCALL IntGetThreadDesktopWindow(PTHREADINFO);
|
||||||
PWND FASTCALL co_GetDesktopWindow(PWND);
|
PWND FASTCALL co_GetDesktopWindow(PWND);
|
||||||
BOOL FASTCALL IntPaintDesktop(HDC);
|
BOOL FASTCALL IntPaintDesktop(HDC);
|
||||||
BOOL FASTCALL DesktopWindowProc(PWND, UINT, WPARAM, LPARAM, LRESULT *);
|
BOOL FASTCALL DesktopWindowProc(PWND, UINT, WPARAM, LPARAM, LRESULT *);
|
||||||
|
BOOL FASTCALL UserMessageWindowProc(PWND pwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *lResult);
|
||||||
|
VOID NTAPI DesktopThreadMain();
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -378,7 +378,7 @@ NtUserSetWinEventHook(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Creator, pti is set here.
|
// Creator, pti is set here.
|
||||||
pEH = UserCreateObject(gHandleTable, NULL, &Handle, otEvent, sizeof(EVENTHOOK));
|
pEH = UserCreateObject(gHandleTable, NULL, NULL, &Handle, otEvent, sizeof(EVENTHOOK));
|
||||||
if (pEH)
|
if (pEH)
|
||||||
{
|
{
|
||||||
InsertTailList(&GlobalEvents->Events, &pEH->Chain);
|
InsertTailList(&GlobalEvents->Events, &pEH->Chain);
|
||||||
|
|
|
@ -1569,7 +1569,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
|
||||||
}
|
}
|
||||||
ObDereferenceObject(WinStaObj);
|
ObDereferenceObject(WinStaObj);
|
||||||
|
|
||||||
Hook = UserCreateObject(gHandleTable, NULL, (PHANDLE)&Handle, otHook, sizeof(HOOK));
|
Hook = UserCreateObject(gHandleTable, NULL, NULL, (PHANDLE)&Handle, otHook, sizeof(HOOK));
|
||||||
|
|
||||||
if (!Hook)
|
if (!Hook)
|
||||||
{
|
{
|
||||||
|
|
|
@ -304,6 +304,7 @@ CreateSystemThreads(UINT Type)
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case 0: RawInputThreadMain(); break;
|
case 0: RawInputThreadMain(); break;
|
||||||
|
case 1: DesktopThreadMain(); break;
|
||||||
default: ERR("Wrong type: %x\n", Type);
|
default: ERR("Wrong type: %x\n", Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ UserLoadKbdFile(PUNICODE_STRING pwszKLID)
|
||||||
L"Control\\Keyboard Layouts\\";
|
L"Control\\Keyboard Layouts\\";
|
||||||
|
|
||||||
/* Create keyboard layout file object */
|
/* Create keyboard layout file object */
|
||||||
pkf = UserCreateObject(gHandleTable, NULL, NULL, otKBDfile, sizeof(KBDFILE));
|
pkf = UserCreateObject(gHandleTable, NULL, NULL, NULL, otKBDfile, sizeof(KBDFILE));
|
||||||
if (!pkf)
|
if (!pkf)
|
||||||
{
|
{
|
||||||
ERR("Failed to create object!\n");
|
ERR("Failed to create object!\n");
|
||||||
|
@ -206,7 +206,7 @@ UserLoadKbdLayout(PUNICODE_STRING pwszKLID, HKL hKL)
|
||||||
PKL pKl;
|
PKL pKl;
|
||||||
|
|
||||||
/* Create keyboard layout object */
|
/* Create keyboard layout object */
|
||||||
pKl = UserCreateObject(gHandleTable, NULL, NULL, otKBDlayout, sizeof(KL));
|
pKl = UserCreateObject(gHandleTable, NULL, NULL, NULL, otKBDlayout, sizeof(KL));
|
||||||
if (!pKl)
|
if (!pKl)
|
||||||
{
|
{
|
||||||
ERR("Failed to create object!\n");
|
ERR("Failed to create object!\n");
|
||||||
|
|
|
@ -304,6 +304,7 @@ UserCreateThreadInfo(struct _ETHREAD *Thread)
|
||||||
if (ptiCurrent->KeyboardLayout)
|
if (ptiCurrent->KeyboardLayout)
|
||||||
UserReferenceObject(ptiCurrent->KeyboardLayout);
|
UserReferenceObject(ptiCurrent->KeyboardLayout);
|
||||||
ptiCurrent->TIF_flags &= ~TIF_INCLEANUP;
|
ptiCurrent->TIF_flags &= ~TIF_INCLEANUP;
|
||||||
|
ptiCurrent->pcti = &ptiCurrent->cti;
|
||||||
|
|
||||||
/* Initialize the CLIENTINFO */
|
/* Initialize the CLIENTINFO */
|
||||||
pci = (PCLIENTINFO)pTeb->Win32ClientInfo;
|
pci = (PCLIENTINFO)pTeb->Win32ClientInfo;
|
||||||
|
@ -624,14 +625,16 @@ DriverEntry(
|
||||||
DPRINT("Win32k hInstance 0x%p!\n",hModuleWin);
|
DPRINT("Win32k hInstance 0x%p!\n",hModuleWin);
|
||||||
|
|
||||||
/* Register Object Manager Callbacks */
|
/* Register Object Manager Callbacks */
|
||||||
CalloutData.WindowStationParseProcedure = IntWinStaObjectParse;
|
|
||||||
CalloutData.WindowStationDeleteProcedure = IntWinStaObjectDelete;
|
|
||||||
CalloutData.DesktopDeleteProcedure = IntDesktopObjectDelete;
|
|
||||||
CalloutData.ProcessCallout = Win32kProcessCallback;
|
CalloutData.ProcessCallout = Win32kProcessCallback;
|
||||||
CalloutData.ThreadCallout = Win32kThreadCallback;
|
CalloutData.ThreadCallout = Win32kThreadCallback;
|
||||||
CalloutData.BatchFlushRoutine = NtGdiFlushUserBatch;
|
CalloutData.WindowStationParseProcedure = IntWinStaObjectParse;
|
||||||
CalloutData.DesktopOkToCloseProcedure = IntDesktopOkToClose;
|
CalloutData.WindowStationDeleteProcedure = IntWinStaObjectDelete;
|
||||||
CalloutData.WindowStationOkToCloseProcedure = IntWinstaOkToClose;
|
CalloutData.WindowStationOkToCloseProcedure = IntWinstaOkToClose;
|
||||||
|
CalloutData.DesktopOkToCloseProcedure = IntDesktopOkToClose;
|
||||||
|
CalloutData.DesktopDeleteProcedure = IntDesktopObjectDelete;
|
||||||
|
CalloutData.DesktopCloseProcedure = IntDesktopObjectClose;
|
||||||
|
CalloutData.DesktopOpenProcedure = IntDesktopObjectOpen;
|
||||||
|
CalloutData.BatchFlushRoutine = NtGdiFlushUserBatch;
|
||||||
|
|
||||||
/* Register our per-process and per-thread structures. */
|
/* Register our per-process and per-thread structures. */
|
||||||
PsEstablishWin32Callouts((PWIN32_CALLOUTS_FPNS)&CalloutData);
|
PsEstablishWin32Callouts((PWIN32_CALLOUTS_FPNS)&CalloutData);
|
||||||
|
|
|
@ -249,7 +249,8 @@ IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar)
|
||||||
PPROCESSINFO CurrentWin32Process;
|
PPROCESSINFO CurrentWin32Process;
|
||||||
|
|
||||||
Menu = (PMENU_OBJECT)UserCreateObject( gHandleTable,
|
Menu = (PMENU_OBJECT)UserCreateObject( gHandleTable,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
Handle,
|
Handle,
|
||||||
otMenu,
|
otMenu,
|
||||||
sizeof(MENU_OBJECT));
|
sizeof(MENU_OBJECT));
|
||||||
|
@ -360,8 +361,9 @@ IntCloneMenu(PMENU_OBJECT Source)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Menu = (PMENU_OBJECT)UserCreateObject( gHandleTable,
|
Menu = (PMENU_OBJECT)UserCreateObject( gHandleTable,
|
||||||
NULL,
|
NULL,
|
||||||
&hMenu,
|
NULL,
|
||||||
|
&hMenu,
|
||||||
otMenu,
|
otMenu,
|
||||||
sizeof(MENU_OBJECT));
|
sizeof(MENU_OBJECT));
|
||||||
if(!Menu)
|
if(!Menu)
|
||||||
|
|
|
@ -714,6 +714,13 @@ IntDispatchMessage(PMSG pMsg)
|
||||||
pMsg->lParam,
|
pMsg->lParam,
|
||||||
&retval);
|
&retval);
|
||||||
break;
|
break;
|
||||||
|
case FNID_MESSAGEWND:
|
||||||
|
DoCallBack = !UserMessageWindowProc( Window,
|
||||||
|
pMsg->message,
|
||||||
|
pMsg->wParam,
|
||||||
|
pMsg->lParam,
|
||||||
|
&retval);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1307,6 +1314,9 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
|
||||||
case FNID_DESKTOP:
|
case FNID_DESKTOP:
|
||||||
DoCallBack = !DesktopWindowProc(Window, Msg, wParam, lParam,(LRESULT*)&Result);
|
DoCallBack = !DesktopWindowProc(Window, Msg, wParam, lParam,(LRESULT*)&Result);
|
||||||
break;
|
break;
|
||||||
|
case FNID_MESSAGEWND:
|
||||||
|
DoCallBack = !UserMessageWindowProc(Window, Msg, wParam, lParam,(LRESULT*)&Result);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (!DoCallBack)
|
if (!DoCallBack)
|
||||||
{
|
{
|
||||||
|
@ -1590,6 +1600,9 @@ co_IntSendMessageWithCallBack( HWND hWnd,
|
||||||
case FNID_DESKTOP:
|
case FNID_DESKTOP:
|
||||||
DoCallBack = !DesktopWindowProc(Window, Msg, wParam, lParamPacked, (LRESULT*)&Result);
|
DoCallBack = !DesktopWindowProc(Window, Msg, wParam, lParamPacked, (LRESULT*)&Result);
|
||||||
break;
|
break;
|
||||||
|
case FNID_MESSAGEWND:
|
||||||
|
DoCallBack = !UserMessageWindowProc(Window, Msg, wParam, lParam,(LRESULT*)&Result);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2233,6 +2246,16 @@ NtUserMessageCall( HWND hWnd,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case FNID_MESSAGEWND:
|
||||||
|
{
|
||||||
|
Window = UserGetWindowObject(hWnd);
|
||||||
|
if (Window)
|
||||||
|
{
|
||||||
|
Ret = !UserMessageWindowProc(Window, Msg, wParam, lParam,&lResult);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case FNID_DEFWINDOWPROC:
|
case FNID_DEFWINDOWPROC:
|
||||||
/* Validate input */
|
/* Validate input */
|
||||||
if (hWnd)
|
if (hWnd)
|
||||||
|
|
|
@ -32,7 +32,7 @@ static
|
||||||
PMONITOR
|
PMONITOR
|
||||||
IntCreateMonitorObject()
|
IntCreateMonitorObject()
|
||||||
{
|
{
|
||||||
return UserCreateObject(gHandleTable, NULL, NULL, otMonitor, sizeof(MONITOR));
|
return UserCreateObject(gHandleTable, NULL, NULL, NULL, otMonitor, sizeof(MONITOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IntDestroyMonitorObject
|
/* IntDestroyMonitorObject
|
||||||
|
|
|
@ -101,7 +101,7 @@ IntTopLevelWindowFromPoint(INT x, INT y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Window has not been found */
|
/* Window has not been found */
|
||||||
return NULL;
|
return pwndDesktop;
|
||||||
}
|
}
|
||||||
|
|
||||||
PCURICON_OBJECT
|
PCURICON_OBJECT
|
||||||
|
|
|
@ -298,4 +298,13 @@ UserSetCursor(PCURICON_OBJECT NewCursor,
|
||||||
DWORD APIENTRY IntGetQueueStatus(DWORD);
|
DWORD APIENTRY IntGetQueueStatus(DWORD);
|
||||||
|
|
||||||
UINT lParamMemorySize(UINT Msg, WPARAM wParam, LPARAM lParam);
|
UINT lParamMemorySize(UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
co_IntGetPeekMessage( PMSG pMsg,
|
||||||
|
HWND hWnd,
|
||||||
|
UINT MsgFilterMin,
|
||||||
|
UINT MsgFilterMax,
|
||||||
|
UINT RemoveMsg,
|
||||||
|
BOOL bGMSG );
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -315,20 +315,24 @@ PVOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
UserCreateObject( PUSER_HANDLE_TABLE ht,
|
UserCreateObject( PUSER_HANDLE_TABLE ht,
|
||||||
PDESKTOP pDesktop,
|
PDESKTOP pDesktop,
|
||||||
|
PTHREADINFO pti,
|
||||||
HANDLE* h,
|
HANDLE* h,
|
||||||
USER_OBJECT_TYPE type,
|
USER_OBJECT_TYPE type,
|
||||||
ULONG size)
|
ULONG size)
|
||||||
{
|
{
|
||||||
HANDLE hi;
|
HANDLE hi;
|
||||||
PVOID Object;
|
PVOID Object;
|
||||||
PTHREADINFO pti;
|
|
||||||
PPROCESSINFO ppi;
|
PPROCESSINFO ppi;
|
||||||
BOOL dt;
|
BOOL dt;
|
||||||
PDESKTOP rpdesk = pDesktop;
|
PDESKTOP rpdesk = pDesktop;
|
||||||
|
|
||||||
pti = GetW32ThreadInfo();
|
/* We could get the desktop for the new object from the pti however this is
|
||||||
ppi = pti->ppi;
|
* not always the case for example when creating a new desktop window for
|
||||||
|
* the desktop thread*/
|
||||||
|
|
||||||
|
if (!pti) pti = GetW32ThreadInfo();
|
||||||
if (!pDesktop) rpdesk = pti->rpdesk;
|
if (!pDesktop) rpdesk = pti->rpdesk;
|
||||||
|
ppi = pti->ppi;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,7 @@ extern PUSER_HANDLE_TABLE gHandleTable;
|
||||||
VOID FASTCALL UserReferenceObject(PVOID obj);
|
VOID FASTCALL UserReferenceObject(PVOID obj);
|
||||||
PVOID FASTCALL UserReferenceObjectByHandle(HANDLE handle, USER_OBJECT_TYPE type);
|
PVOID FASTCALL UserReferenceObjectByHandle(HANDLE handle, USER_OBJECT_TYPE type);
|
||||||
BOOL FASTCALL UserDereferenceObject(PVOID obj);
|
BOOL FASTCALL UserDereferenceObject(PVOID obj);
|
||||||
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, struct _DESKTOP* pDesktop, HANDLE* h,USER_OBJECT_TYPE type , ULONG size);
|
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, struct _DESKTOP* pDesktop, PTHREADINFO pti, HANDLE* h,USER_OBJECT_TYPE type , ULONG size);
|
||||||
BOOL FASTCALL UserDeleteObject(HANDLE h, USER_OBJECT_TYPE type );
|
BOOL FASTCALL UserDeleteObject(HANDLE h, USER_OBJECT_TYPE type );
|
||||||
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, USER_OBJECT_TYPE type );
|
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, USER_OBJECT_TYPE type );
|
||||||
PVOID UserGetObjectNoErr(PUSER_HANDLE_TABLE, HANDLE, USER_OBJECT_TYPE);
|
PVOID UserGetObjectNoErr(PUSER_HANDLE_TABLE, HANDLE, USER_OBJECT_TYPE);
|
||||||
|
|
|
@ -184,7 +184,8 @@ NtUserCallOneParam(
|
||||||
if (count == 0) count = 8;
|
if (count == 0) count = 8;
|
||||||
|
|
||||||
psmwp = (PSMWP) UserCreateObject( gHandleTable,
|
psmwp = (PSMWP) UserCreateObject( gHandleTable,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
(PHANDLE)&hDwp,
|
(PHANDLE)&hDwp,
|
||||||
otSMWP,
|
otSMWP,
|
||||||
sizeof(SMWP));
|
sizeof(SMWP));
|
||||||
|
|
|
@ -56,7 +56,7 @@ CreateTimer(VOID)
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
PTIMER Ret = NULL;
|
PTIMER Ret = NULL;
|
||||||
|
|
||||||
Ret = UserCreateObject(gHandleTable, NULL, &Handle, otTimer, sizeof(TIMER));
|
Ret = UserCreateObject(gHandleTable, NULL, NULL, &Handle, otTimer, sizeof(TIMER));
|
||||||
if (Ret)
|
if (Ret)
|
||||||
{
|
{
|
||||||
Ret->head.h = Handle;
|
Ret->head.h = Handle;
|
||||||
|
|
|
@ -1661,7 +1661,8 @@ PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
|
||||||
PCLS Class,
|
PCLS Class,
|
||||||
PWND ParentWindow,
|
PWND ParentWindow,
|
||||||
PWND OwnerWindow,
|
PWND OwnerWindow,
|
||||||
PVOID acbiBuffer)
|
PVOID acbiBuffer,
|
||||||
|
PDESKTOP pdeskCreated)
|
||||||
{
|
{
|
||||||
PWND pWnd = NULL;
|
PWND pWnd = NULL;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
|
@ -1670,7 +1671,7 @@ PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
|
||||||
BOOL MenuChanged;
|
BOOL MenuChanged;
|
||||||
BOOL bUnicodeWindow;
|
BOOL bUnicodeWindow;
|
||||||
|
|
||||||
pti = PsGetCurrentThreadWin32Thread();
|
pti = pdeskCreated ? gptiDesktopThread : GetW32ThreadInfo();
|
||||||
|
|
||||||
if (!(Cs->dwExStyle & WS_EX_LAYOUTRTL))
|
if (!(Cs->dwExStyle & WS_EX_LAYOUTRTL))
|
||||||
{
|
{
|
||||||
|
@ -1690,8 +1691,7 @@ PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
|
||||||
*/
|
*/
|
||||||
if ( Class->fnid != FNID_DIALOG )
|
if ( Class->fnid != FNID_DIALOG )
|
||||||
{
|
{
|
||||||
PPROCESSINFO ppi = PsGetCurrentProcessWin32Process();
|
if (pti->ppi->dwLayout & LAYOUT_RTL)
|
||||||
if (ppi->dwLayout & LAYOUT_RTL)
|
|
||||||
{
|
{
|
||||||
Cs->dwExStyle |= WS_EX_LAYOUTRTL;
|
Cs->dwExStyle |= WS_EX_LAYOUTRTL;
|
||||||
}
|
}
|
||||||
|
@ -1713,7 +1713,8 @@ PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
|
||||||
|
|
||||||
/* Allocate the new window */
|
/* Allocate the new window */
|
||||||
pWnd = (PWND) UserCreateObject( gHandleTable,
|
pWnd = (PWND) UserCreateObject( gHandleTable,
|
||||||
pti->rpdesk,
|
pdeskCreated ? pdeskCreated : pti->rpdesk,
|
||||||
|
pti,
|
||||||
(PHANDLE)&hWnd,
|
(PHANDLE)&hWnd,
|
||||||
otWindow,
|
otWindow,
|
||||||
sizeof(WND) + Class->cbwndExtra);
|
sizeof(WND) + Class->cbwndExtra);
|
||||||
|
@ -1723,14 +1724,14 @@ PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
|
||||||
goto AllocError;
|
goto AllocError;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Created object with handle %X\n", hWnd);
|
TRACE("Created window object with handle %X\n", hWnd);
|
||||||
|
|
||||||
if (NULL == pti->rpdesk->DesktopWindow)
|
if (pdeskCreated && pdeskCreated->DesktopWindow == NULL )
|
||||||
{ /* HACK: Helper for win32csr/desktopbg.c */
|
{ /* HACK: Helper for win32csr/desktopbg.c */
|
||||||
/* If there is no desktop window yet, we must be creating it */
|
/* If there is no desktop window yet, we must be creating it */
|
||||||
TRACE("CreateWindow setting desktop.\n");
|
TRACE("CreateWindow setting desktop.\n");
|
||||||
pti->rpdesk->DesktopWindow = hWnd;
|
pdeskCreated->DesktopWindow = hWnd;
|
||||||
pti->rpdesk->pDeskInfo->spwnd = pWnd;
|
pdeskCreated->pDeskInfo->spwnd = pWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2010,7 +2011,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
||||||
pCbtCreate = NULL;
|
pCbtCreate = NULL;
|
||||||
|
|
||||||
/* Get the class and reference it */
|
/* Get the class and reference it */
|
||||||
Class = IntGetAndReferenceClass(ClassName, Cs->hInstance);
|
Class = IntGetAndReferenceClass(ClassName, Cs->hInstance, FALSE);
|
||||||
if(!Class)
|
if(!Class)
|
||||||
{
|
{
|
||||||
ERR("Failed to find class %wZ\n", ClassName);
|
ERR("Failed to find class %wZ\n", ClassName);
|
||||||
|
@ -2059,7 +2060,8 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
||||||
Class,
|
Class,
|
||||||
ParentWindow,
|
ParentWindow,
|
||||||
OwnerWindow,
|
OwnerWindow,
|
||||||
acbiBuffer);
|
acbiBuffer,
|
||||||
|
NULL);
|
||||||
if(!Window)
|
if(!Window)
|
||||||
{
|
{
|
||||||
ERR("IntCreateWindow failed!\n");
|
ERR("IntCreateWindow failed!\n");
|
||||||
|
@ -2540,12 +2542,15 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWND Window)
|
||||||
|
|
||||||
TRACE("co_UserDestroyWindow \n");
|
TRACE("co_UserDestroyWindow \n");
|
||||||
|
|
||||||
/* Check for owner thread */
|
/* Check for owner thread */
|
||||||
if ( (Window->head.pti->pEThread != PsGetCurrentThread()) ||
|
if ( Window->head.pti != PsGetCurrentThreadWin32Thread())
|
||||||
Window->head.pti != PsGetCurrentThreadWin32Thread() )
|
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_ACCESS_DENIED);
|
/* Check if we are destroying the desktop window */
|
||||||
return FALSE;
|
if (! ((Window->head.rpdesk->dwDTFlags & DF_DESTROYED) && Window == Window->head.rpdesk->pDeskInfo->spwnd))
|
||||||
|
{
|
||||||
|
EngSetLastError(ERROR_ACCESS_DENIED);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If window was created successfully and it is hooked */
|
/* If window was created successfully and it is hooked */
|
||||||
|
|
|
@ -47,7 +47,13 @@ VOID FASTCALL IntGetWindowBorderMeasures(PWND WindowObject, UINT *cx, UINT *cy);
|
||||||
BOOL FASTCALL IntShowOwnedPopups( PWND owner, BOOL fShow );
|
BOOL FASTCALL IntShowOwnedPopups( PWND owner, BOOL fShow );
|
||||||
LRESULT FASTCALL IntDefWindowProc( PWND Window, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi);
|
LRESULT FASTCALL IntDefWindowProc( PWND Window, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi);
|
||||||
VOID FASTCALL IntNotifyWinEvent(DWORD, PWND, LONG, LONG, DWORD);
|
VOID FASTCALL IntNotifyWinEvent(DWORD, PWND, LONG, LONG, DWORD);
|
||||||
PWND FASTCALL co_UserCreateWindowEx(CREATESTRUCTW*, PUNICODE_STRING, PLARGE_STRING, PVOID);
|
PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
|
||||||
|
PLARGE_STRING WindowName,
|
||||||
|
PCLS Class,
|
||||||
|
PWND ParentWindow,
|
||||||
|
PWND OwnerWindow,
|
||||||
|
PVOID acbiBuffer,
|
||||||
|
PDESKTOP pdeskCreated);
|
||||||
BOOL FASTCALL IntEnableWindow(HWND,BOOL);
|
BOOL FASTCALL IntEnableWindow(HWND,BOOL);
|
||||||
BOOL FASTCALL IntIsWindowVisible(PWND);
|
BOOL FASTCALL IntIsWindowVisible(PWND);
|
||||||
DWORD FASTCALL GetNCHitEx(PWND,POINT);
|
DWORD FASTCALL GetNCHitEx(PWND,POINT);
|
||||||
|
|
|
@ -229,10 +229,7 @@ co_IntInitializeDesktopGraphics(VOID)
|
||||||
{
|
{
|
||||||
TEXTMETRICW tmw;
|
TEXTMETRICW tmw;
|
||||||
UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY");
|
UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY");
|
||||||
if (! IntCreatePrimarySurface())
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
ScreenDeviceContext = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, FALSE);
|
ScreenDeviceContext = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, FALSE);
|
||||||
if (NULL == ScreenDeviceContext)
|
if (NULL == ScreenDeviceContext)
|
||||||
{
|
{
|
||||||
|
@ -241,6 +238,11 @@ co_IntInitializeDesktopGraphics(VOID)
|
||||||
}
|
}
|
||||||
GreSetDCOwner(ScreenDeviceContext, GDI_OBJ_HMGR_PUBLIC);
|
GreSetDCOwner(ScreenDeviceContext, GDI_OBJ_HMGR_PUBLIC);
|
||||||
|
|
||||||
|
if (! IntCreatePrimarySurface())
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Setup the cursor */
|
/* Setup the cursor */
|
||||||
co_IntLoadDefaultCursors();
|
co_IntLoadDefaultCursors();
|
||||||
|
|
||||||
|
|
|
@ -2137,21 +2137,23 @@ User32SetupDefaultCursors(PVOID Arguments,
|
||||||
ULONG ArgumentLength)
|
ULONG ArgumentLength)
|
||||||
{
|
{
|
||||||
BOOL *DefaultCursor = (BOOL*)Arguments;
|
BOOL *DefaultCursor = (BOOL*)Arguments;
|
||||||
LRESULT Result = TRUE;
|
HCURSOR hCursor;
|
||||||
|
|
||||||
if(*DefaultCursor)
|
if(*DefaultCursor)
|
||||||
{
|
{
|
||||||
/* set default cursor */
|
/* set default cursor */
|
||||||
SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW));
|
hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
|
||||||
|
SetCursor(hCursor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* FIXME load system cursor scheme */
|
/* FIXME load system cursor scheme */
|
||||||
SetCursor(0);
|
SetCursor(0);
|
||||||
SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW));
|
hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
|
||||||
|
SetCursor(hCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
|
return(ZwCallbackReturn(&hCursor, sizeof(HCURSOR), STATUS_SUCCESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL get_icon_size(HICON hIcon, SIZE *size)
|
BOOL get_icon_size(HICON hIcon, SIZE *size)
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
|
|
||||||
include_directories(
|
|
||||||
BEFORE .
|
|
||||||
${REACTOS_SOURCE_DIR}/subsystems/win32/csrsrv/include
|
|
||||||
${REACTOS_SOURCE_DIR}/include/reactos/subsys
|
|
||||||
${REACTOS_SOURCE_DIR}/include/reactos/drivers
|
|
||||||
${REACTOS_SOURCE_DIR}/win32ss/include)
|
|
||||||
|
|
||||||
spec2def(win32csr.dll win32csr.spec)
|
|
||||||
|
|
||||||
list(APPEND SOURCE
|
|
||||||
desktopbg.c
|
|
||||||
dllmain.c
|
|
||||||
win32csr.rc
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/win32csr.def)
|
|
||||||
|
|
||||||
add_library(win32csr SHARED ${SOURCE})
|
|
||||||
|
|
||||||
target_link_libraries(win32csr
|
|
||||||
win32ksys
|
|
||||||
${PSEH_LIB})
|
|
||||||
|
|
||||||
set_module_type(win32csr win32dll)
|
|
||||||
|
|
||||||
add_importlibs(win32csr psapi msvcrt kernel32 ntdll csrsrv)
|
|
||||||
add_delay_importlibs(win32csr user32 gdi32 advapi32)
|
|
||||||
|
|
||||||
add_pch(win32csr w32csr.h)
|
|
||||||
|
|
||||||
add_dependencies(win32csr bugcodes)
|
|
||||||
add_cd_file(TARGET win32csr DESTINATION reactos/system32 FOR all)
|
|
|
@ -1,349 +0,0 @@
|
||||||
/*
|
|
||||||
* win32ss/user/win32csr/desktopbg.c
|
|
||||||
*
|
|
||||||
* Desktop background window functions
|
|
||||||
*
|
|
||||||
* ReactOS Operating System
|
|
||||||
*
|
|
||||||
* Looks as a hax fix to a problem of not having a proper class window proc support
|
|
||||||
* which ReactOS has now.
|
|
||||||
*
|
|
||||||
* Notes on reason why this is here:
|
|
||||||
* http://www.reactos.org/archives/public/ros-kernel/2003-November/000538.html
|
|
||||||
* http://www.reactos.org/archives/public/ros-kernel/2003-November/000545.html
|
|
||||||
* http://www.reactos.org/archives/public/ros-kernel/2003-November/000586.html
|
|
||||||
* http://www.reactos.org/archives/public/ros-kernel/2003-November/000674.html
|
|
||||||
* Revision 6908 Move desktop window proc from WIN32K to CSRSS
|
|
||||||
* Bugs 42, 48 and 57.
|
|
||||||
*
|
|
||||||
* http://www.reactos.org/archives/public/ros-kernel/2003-December/001186.html
|
|
||||||
*
|
|
||||||
|
|
||||||
Now this is used to start Desktops Threads with TEB support.
|
|
||||||
These first three are Application, Winlogon and ScreenSaver desktops.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "win32csr.h"
|
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#define DESKTOP_WINDOW_ATOM 32769
|
|
||||||
|
|
||||||
#define PM_SHOW_DESKTOP 1
|
|
||||||
#define PM_HIDE_DESKTOP 2
|
|
||||||
|
|
||||||
typedef struct tagDTBG_THREAD_DATA
|
|
||||||
{
|
|
||||||
HDESK Desktop;
|
|
||||||
HANDLE Event;
|
|
||||||
NTSTATUS Status;
|
|
||||||
} DTBG_THREAD_DATA, *PDTBG_THREAD_DATA;
|
|
||||||
|
|
||||||
typedef struct tagPRIVATE_NOTIFY_DESKTOP
|
|
||||||
{
|
|
||||||
NMHDR hdr;
|
|
||||||
struct /* PM_SHOW_DESKTOP */
|
|
||||||
{
|
|
||||||
int Width;
|
|
||||||
int Height;
|
|
||||||
} ShowDesktop;
|
|
||||||
} PRIVATE_NOTIFY_DESKTOP, *PPRIVATE_NOTIFY_DESKTOP;
|
|
||||||
|
|
||||||
static BOOL BgInitialized = FALSE;
|
|
||||||
static HWND VisibleDesktopWindow = NULL;
|
|
||||||
#if 0
|
|
||||||
static
|
|
||||||
LRESULT
|
|
||||||
CALLBACK
|
|
||||||
DtbgWindowProc(HWND Wnd,
|
|
||||||
UINT Msg,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam)
|
|
||||||
{
|
|
||||||
PAINTSTRUCT PS;
|
|
||||||
|
|
||||||
switch (Msg)
|
|
||||||
{
|
|
||||||
case WM_ERASEBKGND:
|
|
||||||
PaintDesktop((HDC)wParam);
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
case WM_PAINT:
|
|
||||||
if (BeginPaint(Wnd, &PS))
|
|
||||||
EndPaint(Wnd, &PS);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case WM_SETCURSOR:
|
|
||||||
return (LRESULT)SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW));
|
|
||||||
|
|
||||||
case WM_NCCREATE:
|
|
||||||
return (LRESULT)TRUE;
|
|
||||||
|
|
||||||
case WM_CREATE:
|
|
||||||
NtUserSetWindowFNID(Wnd, FNID_DESKTOP); // Anti-ReactOS hack!
|
|
||||||
case WM_CLOSE:
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case WM_DISPLAYCHANGE:
|
|
||||||
MoveWindow(Wnd, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_NOTIFY:
|
|
||||||
{
|
|
||||||
PPRIVATE_NOTIFY_DESKTOP nmh = (PPRIVATE_NOTIFY_DESKTOP)lParam;
|
|
||||||
|
|
||||||
/* Use WM_NOTIFY for private messages since
|
|
||||||
* it can't be sent between processes!
|
|
||||||
*/
|
|
||||||
switch (nmh->hdr.code)
|
|
||||||
{
|
|
||||||
case PM_SHOW_DESKTOP:
|
|
||||||
{
|
|
||||||
LRESULT Result;
|
|
||||||
|
|
||||||
Result = !SetWindowPos(Wnd, NULL, 0, 0,
|
|
||||||
nmh->ShowDesktop.Width,
|
|
||||||
nmh->ShowDesktop.Height,
|
|
||||||
SWP_NOACTIVATE | SWP_NOZORDER |
|
|
||||||
SWP_SHOWWINDOW);
|
|
||||||
|
|
||||||
UpdateWindow(Wnd);
|
|
||||||
VisibleDesktopWindow = Wnd;
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
case PM_HIDE_DESKTOP:
|
|
||||||
{
|
|
||||||
LRESULT Result;
|
|
||||||
|
|
||||||
Result = !SetWindowPos(Wnd, NULL, 0, 0, 0, 0,
|
|
||||||
SWP_NOACTIVATE | SWP_NOZORDER |
|
|
||||||
SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW);
|
|
||||||
|
|
||||||
UpdateWindow(Wnd);
|
|
||||||
VisibleDesktopWindow = NULL;
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
DPRINT("Unknown notification code 0x%x sent to the desktop window!\n",
|
|
||||||
nmh->hdr.code);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
return DefWindowProcW(Wnd, Msg, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
BOOL
|
|
||||||
FASTCALL
|
|
||||||
DtbgInit(VOID)
|
|
||||||
{
|
|
||||||
WNDCLASSEXW Class;
|
|
||||||
ATOM ClassAtom;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create the desktop window class
|
|
||||||
*/
|
|
||||||
Class.cbSize = sizeof(WNDCLASSEXW);
|
|
||||||
Class.style = 0; // Local Class
|
|
||||||
Class.lpfnWndProc = DtbgWindowProc;
|
|
||||||
Class.cbClsExtra = 0;
|
|
||||||
Class.cbWndExtra = 0;
|
|
||||||
Class.hInstance = (HINSTANCE)GetModuleHandleW(NULL);
|
|
||||||
Class.hIcon = NULL;
|
|
||||||
Class.hCursor = NULL;
|
|
||||||
Class.hbrBackground = GetSysColorBrush(COLOR_BACKGROUND);
|
|
||||||
Class.lpszMenuName = NULL;
|
|
||||||
Class.lpszClassName = (LPCWSTR)DESKTOP_WINDOW_ATOM;
|
|
||||||
ClassAtom = RegisterClassExW(&Class);
|
|
||||||
|
|
||||||
if (ClassAtom == INVALID_ATOM)
|
|
||||||
{
|
|
||||||
DPRINT1("Unable to register desktop background class (error %d)\n",
|
|
||||||
GetLastError());
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
VisibleDesktopWindow = NULL;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
static
|
|
||||||
DWORD
|
|
||||||
WINAPI
|
|
||||||
DtbgDesktopThread(PVOID Data)
|
|
||||||
{
|
|
||||||
HWND BackgroundWnd;
|
|
||||||
MSG msg;
|
|
||||||
PDTBG_THREAD_DATA ThreadData = (PDTBG_THREAD_DATA)Data;
|
|
||||||
|
|
||||||
DPRINT("DtbgDesktopThread\n");
|
|
||||||
|
|
||||||
if (!SetThreadDesktop(ThreadData->Desktop))
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to set thread desktop\n");
|
|
||||||
ThreadData->Status = STATUS_UNSUCCESSFUL;
|
|
||||||
SetEvent(ThreadData->Event);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
BackgroundWnd = CreateWindowW((LPCWSTR)DESKTOP_WINDOW_ATOM,
|
|
||||||
L"",
|
|
||||||
WS_POPUP | WS_CLIPCHILDREN,
|
|
||||||
GetSystemMetrics(SM_XVIRTUALSCREEN),
|
|
||||||
GetSystemMetrics(SM_YVIRTUALSCREEN),
|
|
||||||
GetSystemMetrics(SM_CXVIRTUALSCREEN),
|
|
||||||
GetSystemMetrics(SM_CYVIRTUALSCREEN),
|
|
||||||
NULL, NULL,
|
|
||||||
(HINSTANCE)GetModuleHandleW(L"user32.dll"), // Run in win32k/user32.
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (NULL == BackgroundWnd)
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to create desktop background window\n");
|
|
||||||
ThreadData->Status = STATUS_UNSUCCESSFUL;
|
|
||||||
SetEvent(ThreadData->Event);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
DPRINT("BackgroundWnd 0x%p\n",BackgroundWnd);
|
|
||||||
|
|
||||||
ThreadData->Status = STATUS_SUCCESS;
|
|
||||||
SetEvent(ThreadData->Event);
|
|
||||||
|
|
||||||
while (GetMessageW(&msg, NULL, 0, 0))
|
|
||||||
{
|
|
||||||
if (msg.message == WM_QUIT)
|
|
||||||
{
|
|
||||||
DPRINT1("DtbgDesktopThread WM_QUIT\n");
|
|
||||||
}
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessageW(&msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
DPRINT1("DtbgDesktopThread Exit\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSR_API(CsrCreateDesktop)
|
|
||||||
{
|
|
||||||
DTBG_THREAD_DATA ThreadData;
|
|
||||||
HANDLE ThreadHandle;
|
|
||||||
|
|
||||||
DPRINT("CsrCreateDesktop\n");
|
|
||||||
|
|
||||||
if (!BgInitialized)
|
|
||||||
{
|
|
||||||
BgInitialized = TRUE;
|
|
||||||
|
|
||||||
// if (!DtbgInit())
|
|
||||||
// return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The desktop handle we got from win32k is in
|
|
||||||
* the scope of CSRSS so we can just use it.
|
|
||||||
*/
|
|
||||||
ThreadData.Desktop = ApiMessage->Data.CreateDesktopRequest.DesktopHandle;
|
|
||||||
|
|
||||||
ThreadData.Event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
|
||||||
|
|
||||||
if (NULL == ThreadData.Event)
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to create event (error %d)\n", GetLastError());
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadHandle = CreateThread(NULL,
|
|
||||||
0,
|
|
||||||
DtbgDesktopThread,
|
|
||||||
(PVOID)&ThreadData,
|
|
||||||
0,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (NULL == ThreadHandle)
|
|
||||||
{
|
|
||||||
CloseHandle(ThreadData.Event);
|
|
||||||
DPRINT1("Failed to create desktop window thread.\n");
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseHandle(ThreadHandle);
|
|
||||||
|
|
||||||
WaitForSingleObject(ThreadData.Event, INFINITE);
|
|
||||||
CloseHandle(ThreadData.Event);
|
|
||||||
|
|
||||||
return ThreadData.Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSR_API(CsrShowDesktop)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
PRIVATE_NOTIFY_DESKTOP nmh;
|
|
||||||
DPRINT("CsrShowDesktop\n");
|
|
||||||
|
|
||||||
nmh.hdr.hwndFrom = ApiMessage->Data.ShowDesktopRequest.DesktopWindow;
|
|
||||||
nmh.hdr.idFrom = 0;
|
|
||||||
nmh.hdr.code = PM_SHOW_DESKTOP;
|
|
||||||
|
|
||||||
nmh.ShowDesktop.Width = (int)ApiMessage->Data.ShowDesktopRequest.Width;
|
|
||||||
nmh.ShowDesktop.Height = (int)ApiMessage->Data.ShowDesktopRequest.Height;
|
|
||||||
|
|
||||||
if (SendMessageW(ApiMessage->Data.ShowDesktopRequest.DesktopWindow,
|
|
||||||
WM_NOTIFY,
|
|
||||||
(WPARAM)nmh.hdr.hwndFrom,
|
|
||||||
(LPARAM)&nmh))
|
|
||||||
{
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSR_API(CsrHideDesktop)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
PRIVATE_NOTIFY_DESKTOP nmh;
|
|
||||||
DPRINT("CsrHideDesktop\n");
|
|
||||||
|
|
||||||
nmh.hdr.hwndFrom = ApiMessage->Data.ShowDesktopRequest.DesktopWindow;
|
|
||||||
nmh.hdr.idFrom = 0;
|
|
||||||
nmh.hdr.code = PM_HIDE_DESKTOP;
|
|
||||||
|
|
||||||
if (SendMessageW(ApiMessage->Data.ShowDesktopRequest.DesktopWindow,
|
|
||||||
WM_NOTIFY,
|
|
||||||
(WPARAM)nmh.hdr.hwndFrom,
|
|
||||||
(LPARAM)&nmh))
|
|
||||||
{
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
FASTCALL
|
|
||||||
DtbgIsDesktopVisible(VOID)
|
|
||||||
{
|
|
||||||
VisibleDesktopWindow = GetDesktopWindow(); // DESKTOPWNDPROC
|
|
||||||
|
|
||||||
if (VisibleDesktopWindow != NULL &&
|
|
||||||
!IsWindowVisible(VisibleDesktopWindow))
|
|
||||||
{
|
|
||||||
VisibleDesktopWindow = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return VisibleDesktopWindow != NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
|
|
@ -1,13 +0,0 @@
|
||||||
/* $Id: desktopbg.h 47315 2010-05-23 00:51:29Z jmorlan $
|
|
||||||
*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: subsys/csrss/include/destkopbg.h
|
|
||||||
* PURPOSE: CSRSS internal desktop background window interface
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
BOOL FASTCALL DtbgIsDesktopVisible(VOID);
|
|
||||||
|
|
||||||
/* EOF */
|
|
|
@ -1,130 +0,0 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: subsys/csrss/win32csr/dllmain.c
|
|
||||||
* PURPOSE: Initialization
|
|
||||||
* PROGRAMMERS: Dmitry Philippov (shedon@mail.ru)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* INCLUDES ******************************************************************/
|
|
||||||
|
|
||||||
#include "win32csr.h"
|
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
|
||||||
|
|
||||||
HANDLE Win32CsrApiHeap;
|
|
||||||
HINSTANCE Win32CsrDllHandle = NULL;
|
|
||||||
|
|
||||||
PCSR_API_ROUTINE Win32CsrApiDefinitions[3] =
|
|
||||||
{
|
|
||||||
CsrCreateDesktop,
|
|
||||||
CsrShowDesktop,
|
|
||||||
CsrHideDesktop,
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOLEAN Win32CsrApiServerValidTable[3] =
|
|
||||||
{
|
|
||||||
FALSE,
|
|
||||||
FALSE,
|
|
||||||
FALSE
|
|
||||||
};
|
|
||||||
|
|
||||||
PCHAR Win32CsrApiNameTable[3] =
|
|
||||||
{
|
|
||||||
"CsrCreateDesktop",
|
|
||||||
"CsrShowDesktop",
|
|
||||||
"CsrHideDesktop",
|
|
||||||
};
|
|
||||||
|
|
||||||
static HHOOK hhk = NULL;
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
|
||||||
|
|
||||||
LRESULT
|
|
||||||
CALLBACK
|
|
||||||
KeyboardHookProc(
|
|
||||||
int nCode,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam)
|
|
||||||
{
|
|
||||||
return CallNextHookEx(hhk, nCode, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
DllMain(HANDLE hDll,
|
|
||||||
DWORD dwReason,
|
|
||||||
LPVOID lpReserved)
|
|
||||||
{
|
|
||||||
if (DLL_PROCESS_ATTACH == dwReason)
|
|
||||||
{
|
|
||||||
Win32CsrDllHandle = hDll;
|
|
||||||
//
|
|
||||||
// HACK HACK HACK ReactOS to BOOT! Initialization BUG ALERT! See bug 5655.
|
|
||||||
//
|
|
||||||
hhk = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProc, NULL, 0);
|
|
||||||
// BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT!
|
|
||||||
// BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT!
|
|
||||||
// BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT!
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
WINAPI
|
|
||||||
PrivateCsrssManualGuiCheck(LONG Check)
|
|
||||||
{
|
|
||||||
NtUserCallOneParam(Check, ONEPARAM_ROUTINE_CSRSS_GUICHECK);
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD
|
|
||||||
WINAPI
|
|
||||||
CreateSystemThreads(PVOID pParam)
|
|
||||||
{
|
|
||||||
NtUserCallOneParam((DWORD)pParam, ONEPARAM_ROUTINE_CREATESYSTEMTHREADS);
|
|
||||||
DPRINT1("This thread should not terminate!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSR_SERVER_DLL_INIT(Win32CsrInitialization)
|
|
||||||
{
|
|
||||||
HANDLE ServerThread;
|
|
||||||
CLIENT_ID ClientId;
|
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
Win32CsrApiHeap = RtlGetProcessHeap();
|
|
||||||
|
|
||||||
NtUserInitialize(0, NULL, NULL);
|
|
||||||
|
|
||||||
PrivateCsrssManualGuiCheck(0);
|
|
||||||
|
|
||||||
/* Setup the DLL Object */
|
|
||||||
LoadedServerDll->ApiBase = 4;
|
|
||||||
LoadedServerDll->HighestApiSupported = 3;
|
|
||||||
LoadedServerDll->DispatchTable = Win32CsrApiDefinitions;
|
|
||||||
LoadedServerDll->ValidTable = Win32CsrApiServerValidTable;
|
|
||||||
LoadedServerDll->NameTable = Win32CsrApiNameTable;
|
|
||||||
// LoadedServerDll->SizeOfProcessData = 0;
|
|
||||||
// LoadedServerDll->ConnectCallback = NULL;
|
|
||||||
// LoadedServerDll->DisconnectCallback = NULL;
|
|
||||||
// LoadedServerDll->HardErrorCallback = Win32CsrHardError;
|
|
||||||
// LoadedServerDll->NewProcessCallback = NULL;
|
|
||||||
// LoadedServerDll->DisconnectCallback = NULL;
|
|
||||||
|
|
||||||
/* Start Raw Input Threads */
|
|
||||||
Status = RtlCreateUserThread(NtCurrentProcess(), NULL, TRUE, 0, 0, 0, (PTHREAD_START_ROUTINE)CreateSystemThreads, (PVOID)0, &ServerThread, &ClientId);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
NtResumeThread(ServerThread, NULL);
|
|
||||||
NtClose(ServerThread);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
DPRINT1("Cannot start Raw Input Thread!\n");
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
|
|
@ -1,40 +0,0 @@
|
||||||
/* $Id: win32csr.h 55699 2012-02-19 06:44:09Z ion $
|
|
||||||
*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: subsys/csrss/win32csr/win32csr.h
|
|
||||||
* PURPOSE: Interface to win32csr.dll
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
/* PSDK/NDK Headers */
|
|
||||||
#define WIN32_NO_STATUS
|
|
||||||
#include <windows.h>
|
|
||||||
#define NTOS_MODE_USER
|
|
||||||
#include <ndk/ntndk.h>
|
|
||||||
|
|
||||||
/* External Winlogon Header */
|
|
||||||
#include <winlogon.h>
|
|
||||||
|
|
||||||
/* CSRSS Header */
|
|
||||||
#include <csr/csrsrv.h>
|
|
||||||
|
|
||||||
/* Internal CSRSS Headers */
|
|
||||||
#include <win/winmsg.h>
|
|
||||||
#include <desktopbg.h>
|
|
||||||
|
|
||||||
/* Public Win32K Headers */
|
|
||||||
#include <ntuser.h>
|
|
||||||
|
|
||||||
#include <commctrl.h>
|
|
||||||
|
|
||||||
extern HANDLE Win32CsrApiHeap;
|
|
||||||
extern HINSTANCE Win32CsrDllHandle;
|
|
||||||
|
|
||||||
/* desktopbg.c */
|
|
||||||
CSR_API(CsrCreateDesktop);
|
|
||||||
CSR_API(CsrShowDesktop);
|
|
||||||
CSR_API(CsrHideDesktop);
|
|
||||||
|
|
||||||
/* EOF */
|
|
|
@ -1,5 +0,0 @@
|
||||||
#define REACTOS_VERSION_DLL
|
|
||||||
#define REACTOS_STR_FILE_DESCRIPTION "CSRSS subsystem usermode code\0"
|
|
||||||
#define REACTOS_STR_INTERNAL_NAME "win32csr\0"
|
|
||||||
#define REACTOS_STR_ORIGINAL_FILENAME "win32csr.dll\0"
|
|
||||||
#include <reactos/version.rc>
|
|
|
@ -1 +0,0 @@
|
||||||
@ stdcall Win32CsrInitialization(ptr)
|
|
|
@ -141,6 +141,9 @@ CsrpCaptureStringParameters(
|
||||||
UNICODE_STRING TempStringU, ParamStringU;
|
UNICODE_STRING TempStringU, ParamStringU;
|
||||||
ANSI_STRING TempStringA;
|
ANSI_STRING TempStringA;
|
||||||
|
|
||||||
|
if (SizeOfAllUnicodeStrings)
|
||||||
|
*SizeOfAllUnicodeStrings = 0;
|
||||||
|
|
||||||
/* Read all strings from client space */
|
/* Read all strings from client space */
|
||||||
for (nParam = 0; nParam < HardErrorMessage->NumberOfParameters; nParam++)
|
for (nParam = 0; nParam < HardErrorMessage->NumberOfParameters; nParam++)
|
||||||
{
|
{
|
||||||
|
@ -227,7 +230,9 @@ CsrpCaptureStringParameters(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
*SizeOfAllUnicodeStrings = Size;
|
if (SizeOfAllUnicodeStrings)
|
||||||
|
*SizeOfAllUnicodeStrings = Size;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -356,6 +356,28 @@ PrivateCsrssManualGuiCheck(LONG Check)
|
||||||
NtUserCallOneParam(Check, ONEPARAM_ROUTINE_CSRSS_GUICHECK);
|
NtUserCallOneParam(Check, ONEPARAM_ROUTINE_CSRSS_GUICHECK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HHOOK hhk = NULL;
|
||||||
|
|
||||||
|
/*** HACK from win32csr... ***/
|
||||||
|
LRESULT
|
||||||
|
CALLBACK
|
||||||
|
KeyboardHookProc(int nCode,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam)
|
||||||
|
{
|
||||||
|
return CallNextHookEx(hhk, nCode, wParam, lParam);
|
||||||
|
}
|
||||||
|
/*** END - HACK from win32csr... ***/
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
WINAPI
|
||||||
|
CreateSystemThreads(PVOID pParam)
|
||||||
|
{
|
||||||
|
NtUserCallOneParam((DWORD)pParam, ONEPARAM_ROUTINE_CREATESYSTEMTHREADS);
|
||||||
|
DPRINT1("This thread should not terminate!\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
CSR_SERVER_DLL_INIT(UserServerDllInitialization)
|
CSR_SERVER_DLL_INIT(UserServerDllInitialization)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -378,6 +400,13 @@ CSR_SERVER_DLL_INIT(UserServerDllInitialization)
|
||||||
return Status;
|
return Status;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*** From win32csr... ***/
|
||||||
|
HANDLE ServerThread;
|
||||||
|
CLIENT_ID ClientId;
|
||||||
|
NTSTATUS Status;
|
||||||
|
UINT i;
|
||||||
|
/*** END - From win32csr... ***/
|
||||||
|
|
||||||
/* Initialize memory */
|
/* Initialize memory */
|
||||||
UserSrvHeap = RtlGetProcessHeap(); // Initialize our own heap.
|
UserSrvHeap = RtlGetProcessHeap(); // Initialize our own heap.
|
||||||
// BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap.
|
// BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap.
|
||||||
|
@ -399,6 +428,21 @@ CSR_SERVER_DLL_INIT(UserServerDllInitialization)
|
||||||
// LoadedServerDll->NewProcessCallback = Win32CsrDuplicateHandleTable;
|
// LoadedServerDll->NewProcessCallback = Win32CsrDuplicateHandleTable;
|
||||||
LoadedServerDll->HardErrorCallback = Win32CsrHardError;
|
LoadedServerDll->HardErrorCallback = Win32CsrHardError;
|
||||||
|
|
||||||
|
/*** From win32csr... ***/
|
||||||
|
/* Start the Raw Input Thread and the Desktop Thread */
|
||||||
|
for (i = 0; i < 2; ++i)
|
||||||
|
{
|
||||||
|
Status = RtlCreateUserThread(NtCurrentProcess(), NULL, TRUE, 0, 0, 0, (PTHREAD_START_ROUTINE)CreateSystemThreads, (PVOID)i, &ServerThread, &ClientId);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
NtResumeThread(ServerThread, NULL);
|
||||||
|
NtClose(ServerThread);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DPRINT1("Cannot start Raw Input Thread!\n");
|
||||||
|
}
|
||||||
|
/*** END - From win32csr... ***/
|
||||||
|
|
||||||
/* All done */
|
/* All done */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -422,6 +466,18 @@ DllMain(IN HANDLE hDll,
|
||||||
if (DLL_PROCESS_ATTACH == dwReason)
|
if (DLL_PROCESS_ATTACH == dwReason)
|
||||||
{
|
{
|
||||||
DllHandle = hDll;
|
DllHandle = hDll;
|
||||||
|
|
||||||
|
/*** HACK from win32csr... ***/
|
||||||
|
|
||||||
|
//
|
||||||
|
// HACK HACK HACK ReactOS to BOOT! Initialization BUG ALERT! See bug 5655.
|
||||||
|
//
|
||||||
|
hhk = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProc, NULL, 0);
|
||||||
|
// BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT!
|
||||||
|
// BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT!
|
||||||
|
// BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT!
|
||||||
|
|
||||||
|
/*** END - HACK from win32csr... ***/
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -471,7 +471,7 @@ NotifyTopLevelWindows(PNOTIFY_CONTEXT Context)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Taken from win32ss/user/win32csr/desktopbg.c ***/
|
/*** Taken from win32ss/user/consrv/console.c ***/
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
DtbgIsDesktopVisible(VOID)
|
DtbgIsDesktopVisible(VOID)
|
||||||
{
|
{
|
||||||
|
@ -485,9 +485,7 @@ DtbgIsDesktopVisible(VOID)
|
||||||
|
|
||||||
return VisibleDesktopWindow != NULL;
|
return VisibleDesktopWindow != NULL;
|
||||||
}
|
}
|
||||||
/****************************************************/
|
|
||||||
|
|
||||||
/*** Taken from win32ss/user/consrv/console.c ***/
|
|
||||||
/* TODO: Find another way to do it. */
|
/* TODO: Find another way to do it. */
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
ConioConsoleCtrlEventTimeout(DWORD Event, PCSR_PROCESS ProcessData, DWORD Timeout)
|
ConioConsoleCtrlEventTimeout(DWORD Event, PCSR_PROCESS ProcessData, DWORD Timeout)
|
||||||
|
|
Loading…
Reference in a new issue