Author: hbelusca
Date: Sun Mar 10 19:44:48 2013
New Revision: 58465
URL: http://svn.reactos.org/svn/reactos?rev=58465&view=rev
Log:
[CSRSRV]
Clarify this one, too.
Modified:
branches/ros-csrss/subsystems/win32/csrsrv/init.c
Modified: branches/ros-csrss/subsystems/win32/csrsrv/init.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/init.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/init.c [iso-8859-1] Sun Mar 10 19:44:48 2013
@@ -560,7 +560,7 @@
Status);
/* It's not fatal if the session ID isn't zero */
- if (SessionId) return Status;
+ if (SessionId != 0) return Status;
ASSERT(NT_SUCCESS(Status));
}
@@ -578,7 +578,7 @@
if (_stricmp(ParameterName, "ObjectDirectory") == 0)
{
/* Check if a session ID is specified */
- if (SessionId)
+ if (SessionId != 0)
{
DPRINT1("Sessions not yet implemented\n");
ASSERT(SessionId);
Author: hbelusca
Date: Sun Mar 10 19:37:33 2013
New Revision: 58464
URL: http://svn.reactos.org/svn/reactos?rev=58464&view=rev
Log:
[CSRSRV]
Clarify few parts of code; remove unneeded comments and DPRINTs; start documentation of the CsrCreateProcess routine.
[BASESRV-CONSRV-WINSRV]
Correct the sizes of the API tables.
[SM]
Correct the API names.
Modified:
branches/ros-csrss/base/system/smss/smloop.c
branches/ros-csrss/include/reactos/subsys/csr/csr.h
branches/ros-csrss/include/reactos/subsys/csr/csrmsg.h
branches/ros-csrss/include/reactos/subsys/csr/csrsrv.h
branches/ros-csrss/include/reactos/subsys/sm/smmsg.h
branches/ros-csrss/lib/smlib/smclient.c
branches/ros-csrss/subsystems/win/basesrv/init.c
branches/ros-csrss/subsystems/win32/csrsrv/api.c
branches/ros-csrss/subsystems/win32/csrsrv/api.h
branches/ros-csrss/subsystems/win32/csrsrv/init.c
branches/ros-csrss/subsystems/win32/csrsrv/procsup.c
branches/ros-csrss/subsystems/win32/csrsrv/server.c
branches/ros-csrss/subsystems/win32/csrsrv/session.c
branches/ros-csrss/subsystems/win32/csrsrv/thredsup.c
branches/ros-csrss/win32ss/user/consrv/handle.c
branches/ros-csrss/win32ss/user/consrv/init.c
branches/ros-csrss/win32ss/user/winsrv/init.c
Modified: branches/ros-csrss/base/system/smss/smloop.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/base/system/smss/smlo…
==============================================================================
--- branches/ros-csrss/base/system/smss/smloop.c [iso-8859-1] (original)
+++ branches/ros-csrss/base/system/smss/smloop.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -166,7 +166,7 @@
return STATUS_NOT_IMPLEMENTED;
}
-PSM_API_HANDLER SmpApiDispatch[SmMaxApiNumber] =
+PSM_API_HANDLER SmpApiDispatch[SmpMaxApiNumber - SmpCreateForeignSessionApi] =
{
SmpCreateForeignSession,
SmpSessionComplete,
@@ -401,13 +401,13 @@
RequestMsg.ReturnValue = STATUS_PENDING;
/* Check if the API is valid */
- if (RequestMsg.ApiNumber >= SmMaxApiNumber)
+ if (RequestMsg.ApiNumber >= SmpMaxApiNumber)
{
/* It isn't, fail */
DPRINT1("Invalid API: %lx\n", RequestMsg.ApiNumber);
Status = STATUS_NOT_IMPLEMENTED;
}
- else if ((RequestMsg.ApiNumber <= SmTerminateForeignSessionApi) &&
+ else if ((RequestMsg.ApiNumber <= SmpTerminateForeignSessionApi) &&
!(ClientContext->Subsystem))
{
/* It's valid, but doesn't have a subsystem with it */
Modified: branches/ros-csrss/include/reactos/subsys/csr/csr.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
==============================================================================
--- branches/ros-csrss/include/reactos/subsys/csr/csr.h [iso-8859-1] (original)
+++ branches/ros-csrss/include/reactos/subsys/csr/csr.h [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -11,17 +11,6 @@
#define _CSR_H
#include "csrmsg.h"
-
-/*
-BOOLEAN
-NTAPI
-CsrCaptureArguments(IN PCSR_THREAD CsrThread,
- IN PCSR_API_MESSAGE ApiMessage);
-
-VOID
-NTAPI
-CsrReleaseCapturedArguments(IN PCSR_API_MESSAGE ApiMessage);
-*/
NTSTATUS
NTAPI
Modified: branches/ros-csrss/include/reactos/subsys/csr/csrmsg.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
==============================================================================
--- branches/ros-csrss/include/reactos/subsys/csr/csrmsg.h [iso-8859-1] (original)
+++ branches/ros-csrss/include/reactos/subsys/csr/csrmsg.h [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -107,7 +107,7 @@
PORT_MESSAGE Header;
union
{
- CSR_CONNECTION_INFO ConnectionInfo; // Uniquely used in csrss/csrsrv for internal signaling (opening a new connection).
+ CSR_CONNECTION_INFO ConnectionInfo; // Uniquely used in CSRSRV for internal signaling (opening a new connection).
struct
{
PCSR_CAPTURE_BUFFER CsrCaptureData;
Modified: branches/ros-csrss/include/reactos/subsys/csr/csrsrv.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
==============================================================================
--- branches/ros-csrss/include/reactos/subsys/csr/csrsrv.h [iso-8859-1] (original)
+++ branches/ros-csrss/include/reactos/subsys/csr/csrsrv.h [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -247,19 +247,6 @@
/* PROTOTYPES ****************************************************************/
-///////////
-BOOLEAN
-NTAPI
-CsrCaptureArguments(IN PCSR_THREAD CsrThread,
- IN PCSR_API_MESSAGE ApiMessage);
-
-VOID
-NTAPI
-CsrReleaseCapturedArguments(IN PCSR_API_MESSAGE ApiMessage);
-//////////
-
-
-
NTSTATUS
NTAPI
CsrServerInitialization(IN ULONG ArgumentCount,
Modified: branches/ros-csrss/include/reactos/subsys/sm/smmsg.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
==============================================================================
--- branches/ros-csrss/include/reactos/subsys/sm/smmsg.h [iso-8859-1] (original)
+++ branches/ros-csrss/include/reactos/subsys/sm/smmsg.h [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -18,17 +18,21 @@
// in the checked build of SMSS, which is probably a close approximation. We add
// "p" to use the similar nomenclature seen/leaked out in the Base CSRSS APIs.
//
+// The enumeration finishes with an enumeratee holding the maximum API number.
+// Its name is based on BasepMaxApiNumber, UserpMaxApiNumber...
+//
//
typedef enum _SMSRV_API_NUMBER
{
- SmCreateForeignSessionApi,
- SmSessionCompleteApi,
- SmTerminateForeignSessionApi,
- SmExecPgmApi,
- SmLoadDeferedSubsystemApi,
- SmStartCsrApi,
- SmStopCsrApi,
- SmMaxApiNumber // Based on BasepMaxApiNumber, UserpMaxApiNumber...
+ SmpCreateForeignSessionApi,
+ SmpSessionCompleteApi,
+ SmpTerminateForeignSessionApi,
+ SmpExecPgmApi,
+ SmpLoadDeferedSubsystemApi,
+ SmpStartCsrApi,
+ SmpStopCsrApi,
+
+ SmpMaxApiNumber
} SMSRV_API_NUMBER;
//
@@ -108,7 +112,7 @@
#endif
//
-// There are the APIs that the SMSS Serve can send to a client (such as CSRSS)
+// There are the APIs that the SMSS Server can send to a client (such as CSRSS).
//
// These are called "SB" APIs.
//
@@ -117,6 +121,9 @@
// We add "p" to use the similar nomenclature seen/leaked out in the Base CSRSS
// APIs.
//
+// The enumeration finishes with an enumeratee holding the maximum API number.
+// Its name is based on BasepMaxApiNumber, UserpMaxApiNumber...
+//
//
typedef enum _SB_API_NUMBER
{
@@ -124,7 +131,8 @@
SbpTerminateSession,
SbpForeignSessionComplete,
SbpCreateProcess,
- SbpMaxApiNumber // Based on BasepMaxApiNumber, UserpMaxApiNumber...
+
+ SbpMaxApiNumber
} SB_API_NUMBER;
//
Modified: branches/ros-csrss/lib/smlib/smclient.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/lib/smlib/smclient.c?…
==============================================================================
--- branches/ros-csrss/lib/smlib/smclient.c [iso-8859-1] (original)
+++ branches/ros-csrss/lib/smlib/smclient.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -38,7 +38,7 @@
SmApiMsg.h.u1.s1.TotalLength = sizeof(SmApiMsg);
/* Initalize this specific API's parameters */
- SmApiMsg.ApiNumber = SmExecPgmApi;
+ SmApiMsg.ApiNumber = SmpExecPgmApi;
RtlCopyMemory(&SmApiMsg.u.ExecPgm.ProcessInformation,
ProcessInformation,
sizeof(SmApiMsg.u.ExecPgm.ProcessInformation));
@@ -144,7 +144,7 @@
SessionComplete->SessionStatus = SessionStatus;
/* Set the API Message Port Message header */
- ApiMessage.ApiNumber = SmSessionCompleteApi;
+ ApiMessage.ApiNumber = SmpSessionCompleteApi;
ApiMessage.h.u1.s1.DataLength = sizeof(SM_SESSION_COMPLETE_MSG) + 8;
ApiMessage.h.u1.s1.TotalLength = sizeof(SM_API_MSG);
ApiMessage.h.u2.ZeroInit = 0;
Modified: branches/ros-csrss/subsystems/win/basesrv/init.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
==============================================================================
--- branches/ros-csrss/subsystems/win/basesrv/init.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win/basesrv/init.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -23,7 +23,7 @@
PBASE_STATIC_SERVER_DATA BaseStaticServerData = NULL; // Data that we can share amongst processes. Initialized inside BaseSrvSharedHeap.
// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
-PCSR_API_ROUTINE BaseServerApiDispatchTable[BasepMaxApiNumber] =
+PCSR_API_ROUTINE BaseServerApiDispatchTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER] =
{
BaseSrvCreateProcess,
BaseSrvCreateThread,
@@ -57,7 +57,7 @@
// BaseSrvNlsGetUserInfo,
};
-BOOLEAN BaseServerApiServerValidTable[BasepMaxApiNumber] =
+BOOLEAN BaseServerApiServerValidTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER] =
{
TRUE, // BaseSrvCreateProcess
TRUE, // BaseSrvCreateThread
@@ -91,7 +91,7 @@
// FALSE, // BaseSrvNlsGetUserInfo
};
-PCHAR BaseServerApiNameTable[BasepMaxApiNumber] =
+PCHAR BaseServerApiNameTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER] =
{
"BaseCreateProcess",
"BaseCreateThread",
Modified: branches/ros-csrss/subsystems/win32/csrsrv/api.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/api.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/api.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -269,7 +269,7 @@
NTSTATUS Status;
/* Decrease the count, and see if we're out */
- if (!(_InterlockedDecrement(&CsrpStaticThreadCount)))
+ if (_InterlockedDecrement(&CsrpStaticThreadCount) == 0)
{
/* Check if we've still got space for a Dynamic Thread */
if (CsrpDynamicThreadTotal < CsrMaxApiRequestThreads)
@@ -879,8 +879,7 @@
*
* @param None
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -1010,7 +1009,7 @@
NTAPI
CsrConnectToUser(VOID)
{
-#if 0 // This code is OK, however it is ClientThreadSetup which sucks.
+#if 0 // FIXME: This code is OK, however it is ClientThreadSetup which sucks.
NTSTATUS Status;
ANSI_STRING DllName;
UNICODE_STRING TempName;
@@ -1074,7 +1073,9 @@
PCSR_THREAD CsrThread;
/* Save pointer to this thread in TEB */
+ CsrAcquireProcessLock();
CsrThread = CsrLocateThreadInProcess(NULL, &Teb->ClientId);
+ CsrReleaseProcessLock();
if (CsrThread) Teb->CsrClientThread = CsrThread;
/* Return it */
@@ -1099,7 +1100,6 @@
NTAPI
CsrQueryApiPort(VOID)
{
- DPRINT("CSRSRV: %s called\n", __FUNCTION__);
return CsrApiPort;
}
@@ -1309,7 +1309,6 @@
RtlFreeHeap(CsrHeap, 0, RemoteCaptureBuffer);
}
-
/*++
* @name CsrValidateMessageBuffer
* @implemented NT5.1
@@ -1404,36 +1403,6 @@
return FALSE;
}
-/*** This is what we have in consrv/server.c ***
-
-/\* Ensure that a captured buffer is safe to access *\/
-BOOL FASTCALL
-Win32CsrValidateBuffer(PCSR_PROCESS ProcessData, PVOID Buffer,
- SIZE_T NumElements, SIZE_T ElementSize)
-{
- /\* Check that the following conditions are true:
- * 1. The start of the buffer is somewhere within the process's
- * shared memory section view.
- * 2. The remaining space in the view is at least as large as the buffer.
- * (NB: Please don't try to "optimize" this by using multiplication
- * instead of division; remember that 2147483648 * 2 = 0.)
- * 3. The buffer is DWORD-aligned.
- *\/
- ULONG_PTR Offset = (BYTE *)Buffer - (BYTE *)ProcessData->ClientViewBase;
- if (Offset >= ProcessData->ClientViewBounds
- || NumElements > (ProcessData->ClientViewBounds - Offset) / ElementSize
- || (Offset & (sizeof(DWORD) - 1)) != 0)
- {
- DPRINT1("Invalid buffer %p(%u*%u); section view is %p(%u)\n",
- Buffer, NumElements, ElementSize,
- ProcessData->ClientViewBase, ProcessData->ClientViewBounds);
- return FALSE;
- }
- return TRUE;
-}
-
-***********************************************/
-
/*++
* @name CsrValidateMessageString
* @implemented NT5.1
Modified: branches/ros-csrss/subsystems/win32/csrsrv/api.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/api.h [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/api.h [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -64,7 +64,6 @@
extern RTL_CRITICAL_SECTION CsrProcessLock;
extern RTL_CRITICAL_SECTION CsrWaitListsLock;
extern HANDLE CsrObjectDirectory;
-extern PSB_API_ROUTINE CsrServerSbApiDispatch[5];
/****************************************************/
@@ -75,24 +74,19 @@
CSR_API(CsrSrvSetPriorityClass);
-/***
-
-BOOLEAN
-NTAPI
-CsrCaptureArguments(
- IN PCSR_THREAD CsrThread,
- IN PCSR_API_MESSAGE ApiMessage
-);
+NTSTATUS
+NTAPI
+CsrServerDllInitialization(IN PCSR_SERVER_DLL LoadedServerDll);
+
+
+BOOLEAN
+NTAPI
+CsrCaptureArguments(IN PCSR_THREAD CsrThread,
+ IN PCSR_API_MESSAGE ApiMessage);
VOID
NTAPI
CsrReleaseCapturedArguments(IN PCSR_API_MESSAGE ApiMessage);
-
-NTSTATUS
-NTAPI
-CsrServerDllInitialization(IN PCSR_SERVER_DLL LoadedServerDll);
-
-***/
NTSTATUS
NTAPI
@@ -115,16 +109,16 @@
VOID
NTAPI
-CsrRemoveProcess(IN PCSR_PROCESS CsrProcess);
-
-VOID
-NTAPI
CsrInsertProcess(IN PCSR_PROCESS ParentProcess OPTIONAL,
IN PCSR_PROCESS CsrProcess);
-NTSTATUS
-NTAPI
-CsrApiRequestThread(IN PVOID Parameter); // HANDLE ServerPort ??
+VOID
+NTAPI
+CsrRemoveProcess(IN PCSR_PROCESS CsrProcess);
+
+NTSTATUS
+NTAPI
+CsrApiRequestThread(IN PVOID Parameter);
VOID
NTAPI
Modified: branches/ros-csrss/subsystems/win32/csrsrv/init.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/init.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/init.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -48,8 +48,7 @@
*
* @param None.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -163,8 +162,7 @@
* @param ObjectDirectory
* Handle fo the Object Directory to protect.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -186,8 +184,7 @@
* @param DosDevicesSd
* Pointer to the Security Descriptor to return.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks Depending on the DOS Devices Protection Mode (set in the registry),
* regular users may or may not have full access to the directory.
@@ -403,8 +400,7 @@
* @param Session
* Session ID for which to create the directories.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -534,8 +530,7 @@
* @param Arguments
* Array of arguments.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -714,8 +709,7 @@
*
* @param None.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -777,7 +771,6 @@
if (ServerDll && ServerDll->NewProcessCallback)
{
/* Call the callback */
- DPRINT1("Call NewProcessCallback(NULL, 0x%p) called\n", CsrRootProcess);
ServerDll->NewProcessCallback(NULL, CsrRootProcess);
}
}
@@ -794,8 +787,7 @@
* @param LocalSystemSd
* Pointer to a pointer to the security descriptor to create.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -871,8 +863,7 @@
*
* @param None
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -960,7 +951,7 @@
* @implemented NT4
*
* The CsrServerInitialization routine is the native (not Server) entrypoint
- * of this Server DLL. It serves as the entrypoint for csrss.
+ * of this Server DLL. It serves as the entrypoint for CSRSS.
*
* @param ArgumentCount
* Number of arguments on the command line.
@@ -968,8 +959,7 @@
* @param Arguments
* Array of arguments from the command line.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -980,7 +970,6 @@
IN PCHAR Arguments[])
{
NTSTATUS Status = STATUS_SUCCESS;
- DPRINT("CSRSRV: %s called\n", __FUNCTION__);
/* Create the Init Event */
Status = NtCreateEvent(&CsrInitializationEvent,
Modified: branches/ros-csrss/subsystems/win32/csrsrv/procsup.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/procsup.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/procsup.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -41,7 +41,7 @@
*
* @return None.
*
- * @remarks The "Normal" Priority corresponds to the Normal Forground
+ * @remarks The "Normal" Priority corresponds to the Normal Foreground
* Priority (9) plus a boost of 4.
*
*--*/
@@ -69,7 +69,7 @@
*
* @return None.
*
- * @remarks The "Shutdown" Priority corresponds to the Normal Forground
+ * @remarks The "Shutdown" Priority corresponds to the Normal Foreground
* Priority (9) plus a boost of 6.
*
*--*/
@@ -264,7 +264,7 @@
/* Decrease reference count */
LockCount = --CsrProcess->ReferenceCount;
ASSERT(LockCount >= 0);
- if (!LockCount)
+ if (LockCount == 0)
{
/* Call the generic cleanup code */
DPRINT1("Should kill process: %p\n", CsrProcess);
@@ -345,8 +345,7 @@
*
* @param None.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -495,18 +494,25 @@
* @name CsrCreateProcess
* @implemented NT4
*
- * Do nothing for 500ms.
- *
- * @param ArgumentCount
- * Description of the parameter. Wrapped to more lines on ~70th
- * column.
- *
- * @param Arguments
- * Description of the parameter. Wrapped to more lines on ~70th
- * column.
- *
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * The CsrCreateProcess routine creates a CSR Process object for an NT Process.
+ *
+ * @param hProcess
+ * Handle to an existing NT Process to which to associate this
+ * CSR Process.
+ *
+ * @param hThread
+ * Handle to an existing NT Thread to which to create its
+ * corresponding CSR Thread for this CSR Process.
+ *
+ * @param ClientId
+ * Pointer to the Client ID structure of the NT Process to associate
+ * with this CSR Process.
+ *
+ * @param NtSession
+ * @param Flags
+ * @param DebugCid
+ *
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -597,7 +603,7 @@
}
/* Check if CreateProcess got CREATE_NEW_PROCESS_GROUP */
- if (!(Flags & CsrProcessCreateNewGroup))
+ if ((Flags & CsrProcessCreateNewGroup) == 0)
{
/* Create new data */
CsrProcess->ProcessGroupId = HandleToUlong(ClientId->UniqueProcess);
@@ -781,7 +787,7 @@
/* Decrease reference count */
LockCount = --CsrProcess->ReferenceCount;
ASSERT(LockCount >= 0);
- if (!LockCount)
+ if (LockCount == 0)
{
/* Call the generic cleanup code */
CsrProcessRefcountZero(CsrProcess);
@@ -891,16 +897,15 @@
* @name CsrGetProcessLuid
* @implemented NT4
*
- * Do nothing for 500ms.
+ * The CsrGetProcessLuid routine gets the LUID of the given process.
*
* @param hProcess
* Optional handle to the process whose LUID should be returned.
*
* @param Luid
- * Pointer to a LUID Pointer which will receive the CSR Process' LUID
- *
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * Pointer to a LUID Pointer which will receive the CSR Process' LUID.
+ *
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks If hProcess is not supplied, then the current thread's token will
* be used. If that too is missing, then the current process' token
@@ -1000,7 +1005,7 @@
* @param CsrThread
* Pointer to the CSR Thread to impersonate.
*
- * @return TRUE if impersonation succeeded, false otherwise.
+ * @return TRUE if impersonation succeeded, FALSE otherwise.
*
* @remarks Impersonation can be recursive.
*
@@ -1030,10 +1035,8 @@
if (!NT_SUCCESS(Status))
{
/* Failure */
-/*
DPRINT1("CSRSS: Can't impersonate client thread - Status = %lx\n", Status);
- if (Status != STATUS_BAD_IMPERSONATION_LEVEL) DbgBreakPoint();
-*/
+ // if (Status != STATUS_BAD_IMPERSONATION_LEVEL) DbgBreakPoint();
return FALSE;
}
@@ -1058,8 +1061,7 @@
* Optional pointer to a CSR Process pointer which will hold the
* CSR Process corresponding to the given Process ID.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks Locking a CSR Process is defined as acquiring an extra
* reference to it and returning with the Process Lock held.
@@ -1124,7 +1126,7 @@
*
* @param None.
*
- * @return TRUE if the reversion was succesful, false otherwise.
+ * @return TRUE if the reversion was succesful, FALSE otherwise.
*
* @remarks Impersonation can be recursive; as such, the impersonation token
* will only be deleted once the CSR Thread's impersonaton count
@@ -1145,11 +1147,11 @@
/* Make sure impersonation is on */
if (!CurrentThread->ImpersonationCount)
{
- // DPRINT1("CSRSS: CsrRevertToSelf called while not impersonating\n");
+ DPRINT1("CSRSS: CsrRevertToSelf called while not impersonating\n");
// DbgBreakPoint();
return FALSE;
}
- else if (--CurrentThread->ImpersonationCount > 0)
+ else if ((--CurrentThread->ImpersonationCount) > 0)
{
/* Success; impersonation count decreased but still not zero */
return TRUE;
@@ -1242,8 +1244,7 @@
* @param Flags
* Flags to send to the shutdown notification routine.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
Modified: branches/ros-csrss/subsystems/win32/csrsrv/server.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/server.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/server.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -55,8 +55,8 @@
* @name CsrServerDllInitialization
* @implemented NT4
*
- * The CsrServerDllInitialization is the initialization routine for
- * the this Server DLL.
+ * The CsrServerDllInitialization is the initialization routine
+ * for this Server DLL.
*
* @param LoadedServerDll
* Pointer to the CSR Server DLL structure representing this Server DLL.
@@ -86,18 +86,17 @@
* @name CsrLoadServerDll
* @implemented NT4
*
- * The CsrLoadServerDll routine loads a CSR Server DLL and calls its entrypoint
+ * The CsrLoadServerDll routine loads a CSR Server DLL and calls its entrypoint.
*
* @param DllString
* Pointer to the CSR Server DLL to load and call.
*
* @param EntryPoint
- * Pointer to the name of the server's initialization function. If
- * this parameter is NULL, the default ServerDllInitialize will be
- * assumed.
- *
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * Pointer to the name of the server's initialization function.
+ * If this parameter is NULL, the default ServerDllInitialize
+ * will be assumed.
+ *
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -119,8 +118,6 @@
PCSR_SERVER_DLL_INIT_CALLBACK ServerDllInitProcedure;
ULONG Response;
- DPRINT1("CsrLoadServerDll(%s, 0x%p, %lu)\n", DllString, EntryPoint, ServerId);
-
/* Check if it's beyond the maximum we support */
if (ServerId >= CSR_SERVER_DLL_MAX) return STATUS_TOO_MANY_NAMES;
@@ -225,15 +222,10 @@
CsrSrvSharedStaticServerData[ServerDll->ServerId] = ServerDll->SharedSection;
}
}
- else
- {
- /* Use shared failure code */
- goto LoadFailed;
- }
- }
- else
- {
-LoadFailed:
+ }
+
+ if (!NT_SUCCESS(Status))
+ {
/* Server Init failed, unload it */
if (hServerDll) LdrUnloadDll(hServerDll);
@@ -316,15 +308,14 @@
/*++
* @name CsrSrvCreateSharedSection
*
- * The CsrSrvCreateSharedSection creates the Shared Section that all CSR Server
- * DLLs and Clients can use to share data.
+ * The CsrSrvCreateSharedSection creates the Shared Section that all
+ * CSR Server DLLs and Clients can use to share data.
*
* @param ParameterValue
* Specially formatted string from our registry command-line which
* specifies various arguments for the shared section.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -445,8 +436,7 @@
* Pointer to the CSR Connection Info structure for the incoming
* connection.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -463,7 +453,6 @@
if (CsrProcess)
{
/* Map the section into this process */
- DPRINT("CSR Process Handle: %p. CSR Process: %p\n", CsrProcess->ProcessHandle, CsrProcess);
Status = NtMapViewOfSection(CsrSrvSharedSection,
CsrProcess->ProcessHandle,
&CsrSrvSharedSectionBase,
@@ -553,8 +542,8 @@
*
* @return STATUS_INVALID_PARAMETER.
*
- * @remarks CsrSrvSetPriorityClass does not use this stub because it must
- * return success.
+ * @remarks CsrSrvSetPriorityClass does not use this stub because
+ * it must return success.
*
*--*/
CSR_API(CsrSrvUnusedFunction)
@@ -621,12 +610,12 @@
NULL);
/* Check if this is Session 0, and the Debugger is Enabled */
- if ((NtCurrentPeb()->SessionId) && (NT_SUCCESS(Status)) &&
+ if ((NtCurrentPeb()->SessionId != 0) && (NT_SUCCESS(Status)) &&
(DebuggerInfo.KernelDebuggerEnabled))
{
/* Call the Unhandled Exception Filter */
- if ((Result = RtlUnhandledExceptionFilter(ExceptionInfo)) !=
- EXCEPTION_CONTINUE_EXECUTION)
+ Result = RtlUnhandledExceptionFilter(ExceptionInfo);
+ if (Result != EXCEPTION_CONTINUE_EXECUTION)
{
/* We're going to raise an error. Get Shutdown Privilege first */
Status = RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE,
Modified: branches/ros-csrss/subsystems/win32/csrsrv/session.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/session.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/session.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -18,23 +18,20 @@
RTL_CRITICAL_SECTION CsrNtSessionLock;
LIST_ENTRY CsrNtSessionList;
-// Does it exist a enumeration associated with it ?
-PSB_API_ROUTINE CsrServerSbApiDispatch[5] =
+PSB_API_ROUTINE CsrServerSbApiDispatch[SbpMaxApiNumber - SbpCreateSession] =
{
CsrSbCreateSession,
CsrSbTerminateSession,
CsrSbForeignSessionComplete,
- CsrSbCreateProcess,
- NULL
+ CsrSbCreateProcess
};
-PCHAR CsrServerSbApiName[5] =
+PCHAR CsrServerSbApiName[SbpMaxApiNumber - SbpCreateSession] =
{
"SbCreateSession",
"SbTerminateSession",
"SbForeignSessionComplete",
- "SbCreateProcess",
- "Unknown Csr Sb Api Number"
+ "SbCreateProcess"
};
/* PRIVATE FUNCTIONS **********************************************************/
@@ -55,8 +52,6 @@
NTAPI
CsrInitializeNtSessionList(VOID)
{
- DPRINT("CSRSRV: %s called\n", __FUNCTION__);
-
/* Initialize the Session List */
InitializeListHead(&CsrNtSessionList);
@@ -170,7 +165,7 @@
ASSERT(Session->ReferenceCount != 0);
/* Dereference the Session Object */
- if (!(--Session->ReferenceCount))
+ if ((--Session->ReferenceCount) == 0)
{
/* Remove it from the list */
RemoveEntryList(&Session->SessionLink);
@@ -537,8 +532,8 @@
}
/*
- * It's an API Message, check if it's within limits. If it's not, the
- * NT Behaviour is to set this to the Maximum API.
+ * It's an API Message, check if it's within limits. If it's not,
+ * the NT Behaviour is to set this to the Maximum API.
*/
if (ReceiveMsg.ApiNumber > SbpMaxApiNumber)
{
@@ -555,6 +550,9 @@
/* Call the API */
if (!CsrServerSbApiDispatch[ReceiveMsg.ApiNumber](&ReceiveMsg))
{
+ DPRINT1("CSRSS: %s Session Api called and failed\n",
+ CsrServerSbApiName[ReceiveMsg.ApiNumber]);
+
/* It failed, so return nothing */
ReplyMsg = NULL;
}
Modified: branches/ros-csrss/subsystems/win32/csrsrv/thredsup.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/thredsup.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/thredsup.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -14,8 +14,7 @@
#define NDEBUG
#include <debug.h>
-#define CsrHashThread(t) \
- (HandleToUlong(t)&(256 - 1))
+#define CsrHashThread(t) (HandleToUlong(t)&(256 - 1))
/* GLOBALS ********************************************************************/
@@ -215,7 +214,6 @@
if (Process) *Process = FoundThread->Process;
/* Return thread too */
-// DPRINT1("Found: %p %p\n", FoundThread, FoundThread->Process);
return FoundThread;
}
}
@@ -257,7 +255,6 @@
if (!CsrProcess) CsrProcess = CsrRootProcess;
/* Save the List pointers */
-// DPRINT1("Searching in: %p %d\n", CsrProcess, CsrProcess->ThreadCount);
ListHead = &CsrProcess->ThreadList;
NextEntry = ListHead->Flink;
@@ -275,7 +272,6 @@
}
/* Return what we found */
-// DPRINT1("Found: %p\n", FoundThread);
return FoundThread;
}
@@ -312,7 +308,6 @@
/* Hash the Thread */
i = CsrHashThread(Thread->ClientId.UniqueThread);
-// DPRINT1("TID %lx HASH: %lx\n", Thread->ClientId.UniqueThread, i);
/* Insert it there too */
InsertHeadList(&CsrThreadHashTable[i], &Thread->HashLinks);
@@ -377,10 +372,10 @@
if (CsrThread->HashLinks.Flink) RemoveEntryList(&CsrThread->HashLinks);
/* Check if this is the last Thread */
- if (!CsrThread->Process->ThreadCount)
+ if (CsrThread->Process->ThreadCount == 0)
{
/* Check if it's not already been marked for deletion */
- if (!(CsrThread->Process->Flags & CsrProcessLastThreadTerminated))
+ if ((CsrThread->Process->Flags & CsrProcessLastThreadTerminated) == 0)
{
/* Let everyone know this process is about to lose the thread */
CsrThread->Process->Flags |= CsrProcessLastThreadTerminated;
@@ -464,7 +459,7 @@
/* Decrease reference count */
LockCount = --CsrThread->ReferenceCount;
ASSERT(LockCount >= 0);
- if (!LockCount)
+ if (LockCount == 0)
{
/* Call the generic cleanup code */
CsrAcquireProcessLock();
@@ -551,8 +546,7 @@
* Pointer to the Client ID structure of the NT Thread to associate
* with this CSR Thread.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -567,7 +561,6 @@
PCSR_THREAD CsrThread;
PCSR_PROCESS CsrProcess;
KERNEL_USER_TIMES KernelTimes;
- DPRINT("CSRSRV: %s called\n", __FUNCTION__);
/* Get the Thread Create Time */
Status = NtQueryInformationThread(hThread,
@@ -602,7 +595,7 @@
CsrThread = CsrAllocateThread(CsrProcess);
if (!CsrThread)
{
- DPRINT1("CSRSRV:%s: out of memory!\n", __FUNCTION__);
+ DPRINT1("CSRSRV: %s: out of memory!\n", __FUNCTION__);
CsrUnlockProcess(CsrProcess);
return STATUS_NO_MEMORY;
}
@@ -654,8 +647,7 @@
* Pointer to the Client ID structure of the NT Thread to associate
* with this CSR Thread.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks None.
*
@@ -673,8 +665,6 @@
CLIENT_ID CurrentCid;
KERNEL_USER_TIMES KernelTimes;
- DPRINT("CSRSRV: %s called\n", __FUNCTION__);
-
if (HaveClient)
{
/* Get the current thread and CID */
@@ -690,7 +680,7 @@
/* Something is wrong if we get an empty thread back */
if (!CurrentThread)
{
- DPRINT1("CSRSRV:%s: invalid thread!\n", __FUNCTION__);
+ DPRINT1("CSRSRV: %s: invalid thread!\n", __FUNCTION__);
CsrReleaseProcessLock();
return STATUS_THREAD_IS_TERMINATING;
}
@@ -717,7 +707,7 @@
CsrThread = CsrAllocateThread(CsrProcess);
if (!CsrThread)
{
- DPRINT1("CSRSRV:%s: out of memory!\n", __FUNCTION__);
+ DPRINT1("CSRSRV: %s: out of memory!\n", __FUNCTION__);
CsrReleaseProcessLock();
return STATUS_NO_MEMORY;
}
@@ -762,7 +752,7 @@
/* Decrease reference count */
ASSERT(CsrThread->ReferenceCount > 0);
- if (!(--CsrThread->ReferenceCount))
+ if ((--CsrThread->ReferenceCount) == 0)
{
/* Call the generic cleanup code */
CsrThreadRefcountZero(CsrThread);
@@ -807,7 +797,7 @@
&ClientId);
/* Make sure we got one back, and that it's not already gone */
- if (!CsrThread || CsrThread->Flags & CsrThreadTerminated)
+ if (!CsrThread || (CsrThread->Flags & CsrThreadTerminated))
{
/* Release the lock and return failure */
CsrReleaseProcessLock();
@@ -856,8 +846,7 @@
* @param Flags
* Initial CSR Thread Flags to set to the CSR Thread.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks This routine is similar to CsrAddStaticServerThread, but it
* also creates an NT Thread instead of expecting one to already
@@ -937,8 +926,7 @@
* Optional pointer to a CSR Thread pointer which will hold the
* CSR Thread corresponding to the given Thread ID.
*
- * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL
- * otherwise.
+ * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
*
* @remarks Locking a CSR Thread is defined as acquiring an extra
* reference to it and returning with the Process Lock held.
@@ -975,7 +963,7 @@
/* Check for PID Match */
if ((CurrentThread->ClientId.UniqueThread == Tid) &&
- !(CurrentThread->Flags & CsrThreadTerminated))
+ (CurrentThread->Flags & CsrThreadTerminated) == 0)
{
/* Get out of here */
break;
Modified: branches/ros-csrss/win32ss/user/consrv/handle.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/h…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -666,7 +666,6 @@
/* If we don't need a console, then get out of here */
if (!ConnectInfo->ConsoleNeeded || !ProcessData->ConsoleApp) // In fact, it is for GUI apps.
{
- DPRINT("ConSrvConnect - No console needed\n");
return STATUS_SUCCESS;
}
Modified: branches/ros-csrss/win32ss/user/consrv/init.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/i…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/init.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/init.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -23,7 +23,7 @@
// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
// plus a little bit of Windows 7.
-PCSR_API_ROUTINE ConsoleServerApiDispatchTable[ConsolepMaxApiNumber] =
+PCSR_API_ROUTINE ConsoleServerApiDispatchTable[ConsolepMaxApiNumber - CONSRV_FIRST_API_NUMBER] =
{
SrvOpenConsole,
SrvGetConsoleInput,
@@ -114,7 +114,7 @@
SrvSetConsoleHistory,
};
-BOOLEAN ConsoleServerApiServerValidTable[ConsolepMaxApiNumber] =
+BOOLEAN ConsoleServerApiServerValidTable[ConsolepMaxApiNumber - CONSRV_FIRST_API_NUMBER] =
{
FALSE, // SrvOpenConsole,
FALSE, // SrvGetConsoleInput,
@@ -205,7 +205,7 @@
FALSE, // SrvSetConsoleHistory
};
-PCHAR ConsoleServerApiNameTable[ConsolepMaxApiNumber] =
+PCHAR ConsoleServerApiNameTable[ConsolepMaxApiNumber - CONSRV_FIRST_API_NUMBER] =
{
"OpenConsole",
"GetConsoleInput",
Modified: branches/ros-csrss/win32ss/user/winsrv/init.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/winsrv/i…
==============================================================================
--- branches/ros-csrss/win32ss/user/winsrv/init.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/winsrv/init.c [iso-8859-1] Sun Mar 10 19:37:33 2013
@@ -22,7 +22,7 @@
HANDLE UserServerHeap = NULL; // Our own heap.
// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
-PCSR_API_ROUTINE UserServerApiDispatchTable[UserpMaxApiNumber] =
+PCSR_API_ROUTINE UserServerApiDispatchTable[UserpMaxApiNumber - USERSRV_FIRST_API_NUMBER] =
{
SrvExitWindowsEx,
// SrvEndTask,
@@ -39,7 +39,7 @@
// SrvGetSetShutdownBlockReason, // Added in Vista
};
-BOOLEAN UserServerApiServerValidTable[UserpMaxApiNumber] =
+BOOLEAN UserServerApiServerValidTable[UserpMaxApiNumber - USERSRV_FIRST_API_NUMBER] =
{
FALSE, // SrvExitWindowsEx
// FALSE, // SrvEndTask
@@ -56,7 +56,7 @@
// FALSE, // SrvGetSetShutdownBlockReason
};
-PCHAR UserServerApiNameTable[UserpMaxApiNumber] =
+PCHAR UserServerApiNameTable[UserpMaxApiNumber - USERSRV_FIRST_API_NUMBER] =
{
"SrvExitWindowsEx",
// "SrvEndTask",