mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 17:05:45 +00:00
[BASESRV]
- Remove the unneeded CallProcessCreated function since the same functionality is programmed and executed in CSRSRV when CsrInsertProcess is called via a call of CsrCreateProcess. - Remove some hacks in process creation. - In BaseSrvExitProcess, use the 'Reply = 2' value instead of the old hack 'ApiMessage->ApiNumber = 0xBABE'. [USER32/WINSRV] - Make SetLogonNotifyWindow call our 'RosSetLogonNotifyWindow' hack and explicitely mark it as a hack. - CsrSetLogonNotifyWindow --> RosSetLogonNotifyWindow to emphasize that it is a ReactOS-specific hack. svn path=/branches/ros-csrss/; revision=57694
This commit is contained in:
parent
f77f05cd9d
commit
cbc3e80b5a
6 changed files with 35 additions and 63 deletions
|
@ -33,6 +33,9 @@ typedef enum _USERSRV_API_NUMBER
|
||||||
// UserpConsoleHandleOperation, // Added in Win7
|
// UserpConsoleHandleOperation, // Added in Win7
|
||||||
// UserpGetSetShutdownBlockReason, // Added in Vista
|
// UserpGetSetShutdownBlockReason, // Added in Vista
|
||||||
|
|
||||||
|
/// HACK: ReactOS-specific
|
||||||
|
UserpRosSetLogonNotifyWindow,
|
||||||
|
|
||||||
UserpMaxApiNumber
|
UserpMaxApiNumber
|
||||||
} USERSRV_API_NUMBER, *PUSERSRV_API_NUMBER;
|
} USERSRV_API_NUMBER, *PUSERSRV_API_NUMBER;
|
||||||
|
|
||||||
|
@ -54,6 +57,7 @@ typedef struct
|
||||||
BOOL Register;
|
BOOL Register;
|
||||||
} CSRSS_REGISTER_LOGON_PROCESS, *PCSRSS_REGISTER_LOGON_PROCESS;
|
} CSRSS_REGISTER_LOGON_PROCESS, *PCSRSS_REGISTER_LOGON_PROCESS;
|
||||||
|
|
||||||
|
/// HACK: ReactOS-specific
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
HWND LogonNotifyWindow;
|
HWND LogonNotifyWindow;
|
||||||
|
@ -73,6 +77,8 @@ typedef struct _USER_API_MESSAGE
|
||||||
CSRSS_EXIT_REACTOS ExitReactosRequest;
|
CSRSS_EXIT_REACTOS ExitReactosRequest;
|
||||||
CSRSS_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest;
|
CSRSS_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest;
|
||||||
CSRSS_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest;
|
CSRSS_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest;
|
||||||
|
|
||||||
|
/// HACK: ReactOS-specific
|
||||||
CSRSS_SET_LOGON_NOTIFY_WINDOW SetLogonNotifyWindowRequest;
|
CSRSS_SET_LOGON_NOTIFY_WINDOW SetLogonNotifyWindowRequest;
|
||||||
} Data;
|
} Data;
|
||||||
} USER_API_MESSAGE, *PUSER_API_MESSAGE;
|
} USER_API_MESSAGE, *PUSER_API_MESSAGE;
|
||||||
|
|
|
@ -11,45 +11,14 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
// extern NTSTATUS CallProcessCreated(PCSR_PROCESS, PCSR_PROCESS); // TODO: Import it from csrsrv/init.c
|
|
||||||
// Remove it and correct csrsrv instead...
|
|
||||||
#if 0
|
|
||||||
NTSTATUS
|
|
||||||
CallProcessCreated(IN PCSR_PROCESS SourceProcessData,
|
|
||||||
IN PCSR_PROCESS TargetProcessData)
|
|
||||||
{
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
ULONG i;
|
|
||||||
PCSR_SERVER_DLL ServerDll;
|
|
||||||
|
|
||||||
DPRINT("CSR: %s called\n", __FUNCTION__);
|
|
||||||
|
|
||||||
/* Notify the Server DLLs */
|
|
||||||
for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
|
|
||||||
{
|
|
||||||
/* Get the current Server DLL */
|
|
||||||
ServerDll = CsrLoadedServerDll[i];
|
|
||||||
|
|
||||||
/* Make sure it's valid and that it has callback */
|
|
||||||
if ((ServerDll) && (ServerDll->NewProcessCallback))
|
|
||||||
{
|
|
||||||
Status = ServerDll->NewProcessCallback(SourceProcessData, TargetProcessData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CSR_API(BaseSrvCreateProcess)
|
CSR_API(BaseSrvCreateProcess)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PBASE_CREATE_PROCESS CreateProcessRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateProcessRequest;
|
PBASE_CREATE_PROCESS CreateProcessRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateProcessRequest;
|
||||||
HANDLE ProcessHandle, ThreadHandle;
|
HANDLE ProcessHandle, ThreadHandle;
|
||||||
PCSR_THREAD CsrThread;
|
PCSR_THREAD CsrThread;
|
||||||
PCSR_PROCESS Process; // , NewProcess;
|
PCSR_PROCESS Process;
|
||||||
ULONG /* Flags, */ VdmPower = 0, DebugFlags = 0;
|
ULONG Flags = 0, VdmPower = 0, DebugFlags = 0;
|
||||||
|
|
||||||
/* Get the current client thread */
|
/* Get the current client thread */
|
||||||
CsrThread = CsrGetClientThread();
|
CsrThread = CsrGetClientThread();
|
||||||
|
@ -58,7 +27,7 @@ CSR_API(BaseSrvCreateProcess)
|
||||||
Process = CsrThread->Process;
|
Process = CsrThread->Process;
|
||||||
|
|
||||||
/* Extract the flags out of the process handle */
|
/* Extract the flags out of the process handle */
|
||||||
// Flags = (ULONG_PTR)CreateProcessRequest->ProcessHandle & 3;
|
Flags = (ULONG_PTR)CreateProcessRequest->ProcessHandle & 3;
|
||||||
CreateProcessRequest->ProcessHandle = (HANDLE)((ULONG_PTR)CreateProcessRequest->ProcessHandle & ~3);
|
CreateProcessRequest->ProcessHandle = (HANDLE)((ULONG_PTR)CreateProcessRequest->ProcessHandle & ~3);
|
||||||
|
|
||||||
/* Duplicate the process handle */
|
/* Duplicate the process handle */
|
||||||
|
@ -107,7 +76,7 @@ CSR_API(BaseSrvCreateProcess)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert some flags. FIXME: More need conversion */
|
/* Flags conversion. FIXME: More need conversion */
|
||||||
if (CreateProcessRequest->CreationFlags & CREATE_NEW_PROCESS_GROUP)
|
if (CreateProcessRequest->CreationFlags & CREATE_NEW_PROCESS_GROUP)
|
||||||
{
|
{
|
||||||
DebugFlags |= CsrProcessCreateNewGroup;
|
DebugFlags |= CsrProcessCreateNewGroup;
|
||||||
|
@ -139,20 +108,6 @@ CSR_API(BaseSrvCreateProcess)
|
||||||
|
|
||||||
/* FIXME: VDM vodoo */
|
/* FIXME: VDM vodoo */
|
||||||
|
|
||||||
/* ReactOS Compatibility */
|
|
||||||
#if 0
|
|
||||||
Status = CsrLockProcessByClientId(CreateProcessRequest->ClientId.UniqueProcess, &NewProcess);
|
|
||||||
ASSERT(Status == STATUS_SUCCESS);
|
|
||||||
if (!(CreateProcessRequest->CreationFlags & (CREATE_NEW_CONSOLE | DETACHED_PROCESS)))
|
|
||||||
{
|
|
||||||
NewProcess->ParentConsole = Process->Console;
|
|
||||||
NewProcess->bInheritHandles = CreateProcessRequest->bInheritHandles;
|
|
||||||
}
|
|
||||||
RtlInitializeCriticalSection(&NewProcess->HandleTableLock);
|
|
||||||
CallProcessCreated(Process, NewProcess);
|
|
||||||
CsrUnlockProcess(NewProcess);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Return the result of this operation */
|
/* Return the result of this operation */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +161,8 @@ CSR_API(BaseSrvCreateThread)
|
||||||
/* Call CSRSRV to tell it about the new thread */
|
/* Call CSRSRV to tell it about the new thread */
|
||||||
Status = CsrCreateThread(CsrProcess,
|
Status = CsrCreateThread(CsrProcess,
|
||||||
ThreadHandle,
|
ThreadHandle,
|
||||||
&CreateThreadRequest->ClientId);
|
&CreateThreadRequest->ClientId,
|
||||||
|
TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unlock the process and return */
|
/* Unlock the process and return */
|
||||||
|
@ -232,8 +188,8 @@ CSR_API(BaseSrvExitProcess)
|
||||||
PCSR_THREAD CsrThread = CsrGetClientThread();
|
PCSR_THREAD CsrThread = CsrGetClientThread();
|
||||||
ASSERT(CsrThread != NULL);
|
ASSERT(CsrThread != NULL);
|
||||||
|
|
||||||
/* Set magic flag so we don't reply this message back */
|
/* Set the special reply value so we don't reply this message back */
|
||||||
ApiMessage->ApiNumber = 0xBABE;
|
*Reply = 2;
|
||||||
|
|
||||||
/* Remove the CSR_THREADs and CSR_PROCESS */
|
/* Remove the CSR_THREADs and CSR_PROCESS */
|
||||||
return CsrDestroyProcess(&CsrThread->ClientId,
|
return CsrDestroyProcess(&CsrThread->ClientId,
|
||||||
|
|
|
@ -74,26 +74,25 @@ BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
SetLogonNotifyWindow(HWND Wnd, HWINSTA WinSta)
|
SetLogonNotifyWindow(HWND Wnd, HWINSTA WinSta)
|
||||||
{
|
{
|
||||||
#if 0
|
/// HACK: Windows does not do this !! ReactOS-specific
|
||||||
/* Maybe we should call NtUserSetLogonNotifyWindow and let that one inform CSRSS??? */
|
/* Maybe we should call NtUserSetLogonNotifyWindow and let that one inform CSRSS??? */
|
||||||
CSR_API_MESSAGE Request;
|
USER_API_MESSAGE Request;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Request.Data.SetLogonNotifyWindowRequest.LogonNotifyWindow = Wnd;
|
Request.Data.SetLogonNotifyWindowRequest.LogonNotifyWindow = Wnd;
|
||||||
|
|
||||||
Status = CsrClientCallServer(&Request,
|
Status = CsrClientCallServer((PCSR_API_MESSAGE)&Request,
|
||||||
NULL,
|
NULL,
|
||||||
CSR_CREATE_API_NUMBER(CSR_GUI, SET_LOGON_NOTIFY_WINDOW),
|
CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpRosSetLogonNotifyWindow),
|
||||||
sizeof(CSR_API_MESSAGE));
|
sizeof(CSRSS_SET_LOGON_NOTIFY_WINDOW));
|
||||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
||||||
{
|
{
|
||||||
SetLastError(RtlNtStatusToDosError(Status));
|
SetLastError(RtlNtStatusToDosError(Status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
/// END HACK
|
||||||
|
|
||||||
return NtUserSetLogonNotifyWindow(Wnd);
|
return NtUserSetLogonNotifyWindow(Wnd);
|
||||||
#endif
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -40,6 +40,9 @@ PCSR_API_ROUTINE UserServerApiDispatchTable[UserpMaxApiNumber] =
|
||||||
// SrvCancelShutdown, // Added in Vista
|
// SrvCancelShutdown, // Added in Vista
|
||||||
// SrvConsoleHandleOperation, // Added in Win7
|
// SrvConsoleHandleOperation, // Added in Win7
|
||||||
// SrvGetSetShutdownBlockReason, // Added in Vista
|
// SrvGetSetShutdownBlockReason, // Added in Vista
|
||||||
|
|
||||||
|
/// HACK: ReactOS-specific
|
||||||
|
RosSetLogonNotifyWindow
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOLEAN UserServerApiServerValidTable[UserpMaxApiNumber] =
|
BOOLEAN UserServerApiServerValidTable[UserpMaxApiNumber] =
|
||||||
|
@ -58,6 +61,9 @@ BOOLEAN UserServerApiServerValidTable[UserpMaxApiNumber] =
|
||||||
// FALSE, // SrvConsoleHandleOperation
|
// FALSE, // SrvConsoleHandleOperation
|
||||||
// FALSE, // SrvGetSetShutdownBlockReason
|
// FALSE, // SrvGetSetShutdownBlockReason
|
||||||
|
|
||||||
|
/// HACK: ReactOS-specific
|
||||||
|
FALSE, // RosSetLogonNotifyWindow
|
||||||
|
|
||||||
// FALSE
|
// FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,6 +83,9 @@ PCHAR UserServerApiNameTable[UserpMaxApiNumber] =
|
||||||
// "SrvConsoleHandleOperation",
|
// "SrvConsoleHandleOperation",
|
||||||
// "SrvGetSetShutdownBlockReason",
|
// "SrvGetSetShutdownBlockReason",
|
||||||
|
|
||||||
|
/// HACK: ReactOS-specific
|
||||||
|
"RosSetLogonNotifyWindow",
|
||||||
|
|
||||||
// NULL
|
// NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,8 @@ CSR_API(SrvRegisterLogonProcess)
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSR_API(CsrSetLogonNotifyWindow)
|
/// HACK: ReactOS-specific
|
||||||
|
CSR_API(RosSetLogonNotifyWindow)
|
||||||
{
|
{
|
||||||
PCSRSS_SET_LOGON_NOTIFY_WINDOW SetLogonNotifyWindowRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.SetLogonNotifyWindowRequest;
|
PCSRSS_SET_LOGON_NOTIFY_WINDOW SetLogonNotifyWindowRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.SetLogonNotifyWindowRequest;
|
||||||
DWORD WindowCreator;
|
DWORD WindowCreator;
|
||||||
|
|
|
@ -53,11 +53,12 @@ Win32CsrHardError(IN PCSR_THREAD ThreadData,
|
||||||
|
|
||||||
/* shutdown.c */
|
/* shutdown.c */
|
||||||
CSR_API(SrvExitWindowsEx);
|
CSR_API(SrvExitWindowsEx);
|
||||||
CSR_API(CsrSetLogonNotifyWindow);
|
|
||||||
CSR_API(SrvRegisterLogonProcess);
|
|
||||||
// CSR_API(CsrRegisterSystemClasses);
|
// CSR_API(CsrRegisterSystemClasses);
|
||||||
|
|
||||||
CSR_API(SrvRegisterServicesProcess);
|
CSR_API(SrvRegisterServicesProcess);
|
||||||
|
CSR_API(SrvRegisterLogonProcess);
|
||||||
|
|
||||||
|
/// HACK: ReactOS-specific
|
||||||
|
CSR_API(RosSetLogonNotifyWindow);
|
||||||
|
|
||||||
|
|
||||||
/*****************************
|
/*****************************
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue