[ros-diffs] [cwittich] 41700: fix formatting

cwittich at svn.reactos.org cwittich at svn.reactos.org
Mon Jun 29 23:10:41 CEST 2009


Author: cwittich
Date: Tue Jun 30 01:10:40 2009
New Revision: 41700

URL: http://svn.reactos.org/svn/reactos?rev=41700&view=rev
Log:
fix formatting

Modified:
    trunk/reactos/base/system/smss/smapi.c

Modified: trunk/reactos/base/system/smss/smapi.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/smapi.c?rev=41700&r1=41699&r2=41700&view=diff
==============================================================================
--- trunk/reactos/base/system/smss/smapi.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/smss/smapi.c [iso-8859-1] Tue Jun 30 01:10:40 2009
@@ -20,9 +20,9 @@
 
 SMAPI(SmInvalid)
 {
-	DPRINT("SM: %s called\n",__FUNCTION__);
-	Request->SmHeader.Status = STATUS_NOT_IMPLEMENTED;
-	return STATUS_SUCCESS;
+    DPRINT("SM: %s called\n",__FUNCTION__);
+    Request->SmHeader.Status = STATUS_NOT_IMPLEMENTED;
+    return STATUS_SUCCESS;
 }
 
 /* SM API Table */
@@ -30,20 +30,20 @@
 
 SM_PORT_API SmApi [] =
 {
-	SmInvalid,	/* unused */
-	SmCompSes,	/* smapicomp.c */
-	SmInvalid,	/* obsolete */
-	SmInvalid,	/* unknown */
-	SmExecPgm,	/* smapiexec.c */
-	SmQryInfo	/* smapyqry.c */
+    SmInvalid,	/* unused */
+    SmCompSes,	/* smapicomp.c */
+    SmInvalid,	/* obsolete */
+    SmInvalid,	/* unknown */
+    SmExecPgm,	/* smapiexec.c */
+    SmQryInfo	/* smapyqry.c */
 };
 
 /* TODO: optimize this address computation (it should be done
  * with a macro) */
 PSM_CONNECT_DATA FASTCALL SmpGetConnectData (PSM_PORT_MESSAGE Request)
 {
-	PPORT_MESSAGE PortMessage = (PPORT_MESSAGE) Request;
-	return (PSM_CONNECT_DATA)(PortMessage + 1);
+    PPORT_MESSAGE PortMessage = (PPORT_MESSAGE) Request;
+    return (PSM_CONNECT_DATA)(PortMessage + 1);
 }
 
 NTSTATUS NTAPI
@@ -60,46 +60,46 @@
  */
 static NTSTATUS
 SmpCallbackServer (PSM_PORT_MESSAGE Request,
-		   PSM_CLIENT_DATA ClientData)
-{
-	NTSTATUS          Status = STATUS_SUCCESS;
-	PSM_CONNECT_DATA  ConnectData = SmpGetConnectData (Request);
-	UNICODE_STRING    CallbackPortName;
-	ULONG             CallbackPortNameLength = SM_SB_NAME_MAX_LENGTH; /* TODO: compute length */
-	SB_CONNECT_DATA   SbConnectData;
-	ULONG             SbConnectDataLength = sizeof SbConnectData;
-	SECURITY_QUALITY_OF_SERVICE SecurityQos;
-
-	DPRINT("SM: %s called\n", __FUNCTION__);
-
-	if (	((USHORT)-1 == ConnectData->SubSystemId) ||
-		(IMAGE_SUBSYSTEM_NATIVE  == ConnectData->SubSystemId))
-	{
-		DPRINT("SM: %s: we do not need calling back SM!\n",
-				__FUNCTION__);
-		return STATUS_SUCCESS;
-	}
-	RtlCopyMemory (ClientData->SbApiPortName,
-		       ConnectData->SbName,
-		       CallbackPortNameLength);
-	RtlInitUnicodeString (& CallbackPortName,
-			      ClientData->SbApiPortName);
+           PSM_CLIENT_DATA ClientData)
+{
+    NTSTATUS          Status = STATUS_SUCCESS;
+    PSM_CONNECT_DATA  ConnectData = SmpGetConnectData (Request);
+    UNICODE_STRING    CallbackPortName;
+    ULONG             CallbackPortNameLength = SM_SB_NAME_MAX_LENGTH; /* TODO: compute length */
+    SB_CONNECT_DATA   SbConnectData;
+    ULONG             SbConnectDataLength = sizeof SbConnectData;
+    SECURITY_QUALITY_OF_SERVICE SecurityQos;
+
+    DPRINT("SM: %s called\n", __FUNCTION__);
+
+    if (	((USHORT)-1 == ConnectData->SubSystemId) ||
+        (IMAGE_SUBSYSTEM_NATIVE  == ConnectData->SubSystemId))
+    {
+        DPRINT("SM: %s: we do not need calling back SM!\n",
+                __FUNCTION__);
+        return STATUS_SUCCESS;
+    }
+    RtlCopyMemory (ClientData->SbApiPortName,
+               ConnectData->SbName,
+               CallbackPortNameLength);
+    RtlInitUnicodeString (& CallbackPortName,
+                  ClientData->SbApiPortName);
 
     SecurityQos.Length              = sizeof (SecurityQos);
     SecurityQos.ImpersonationLevel  = SecurityIdentification;
     SecurityQos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING;
     SecurityQos.EffectiveOnly       = TRUE;
 
-	SbConnectData.SmApiMax = (sizeof SmApi / sizeof SmApi[0]);
-	Status = NtConnectPort (& ClientData->SbApiPort,
-				& CallbackPortName,
-				&SecurityQos,
-				NULL,
-				NULL,
-				NULL,
-				& SbConnectData,
-				& SbConnectDataLength);
-	return Status;
+    SbConnectData.SmApiMax = (sizeof SmApi / sizeof SmApi[0]);
+    Status = NtConnectPort (& ClientData->SbApiPort,
+                & CallbackPortName,
+                &SecurityQos,
+                NULL,
+                NULL,
+                NULL,
+                & SbConnectData,
+                & SbConnectDataLength);
+    return Status;
 }
 
 /**********************************************************************
@@ -112,62 +112,62 @@
 VOID NTAPI
 SmpApiConnectedThread(PVOID pConnectedPort)
 {
-	NTSTATUS	Status = STATUS_SUCCESS;
-	PPORT_MESSAGE	Reply = NULL;
-	SM_PORT_MESSAGE	Request;
-	HANDLE          ConnectedPort = * (PHANDLE) pConnectedPort;
-
-	DPRINT("SM: %s called\n", __FUNCTION__);
-	RtlZeroMemory(&Request, sizeof(SM_PORT_MESSAGE));
-
-	while (TRUE)
-	{
-		DPRINT("SM: %s: waiting for message\n",__FUNCTION__);
-
-		Status = NtReplyWaitReceivePort(ConnectedPort,
-						NULL,
-						Reply,
-						(PPORT_MESSAGE) & Request);
-		if (NT_SUCCESS(Status))
-		{
-			DPRINT("SM: %s: message received (type=%d)\n",
-				__FUNCTION__,
-				Request.Header.u2.s2.Type);
-
-			switch (Request.Header.u2.s2.Type)
-			{
-			case LPC_CONNECTION_REQUEST:
-				SmpHandleConnectionRequest (&Request);
-				Reply = NULL;
-				break;
-			case LPC_DEBUG_EVENT:
+    NTSTATUS	Status = STATUS_SUCCESS;
+    PPORT_MESSAGE	Reply = NULL;
+    SM_PORT_MESSAGE	Request;
+    HANDLE          ConnectedPort = * (PHANDLE) pConnectedPort;
+
+    DPRINT("SM: %s called\n", __FUNCTION__);
+    RtlZeroMemory(&Request, sizeof(SM_PORT_MESSAGE));
+
+    while (TRUE)
+    {
+        DPRINT("SM: %s: waiting for message\n",__FUNCTION__);
+
+        Status = NtReplyWaitReceivePort(ConnectedPort,
+                        NULL,
+                        Reply,
+                        (PPORT_MESSAGE) & Request);
+        if (NT_SUCCESS(Status))
+        {
+            DPRINT("SM: %s: message received (type=%d)\n",
+                __FUNCTION__,
+                Request.Header.u2.s2.Type);
+
+            switch (Request.Header.u2.s2.Type)
+            {
+            case LPC_CONNECTION_REQUEST:
+                SmpHandleConnectionRequest (&Request);
+                Reply = NULL;
+                break;
+            case LPC_DEBUG_EVENT:
 //				DbgSsHandleKmApiMsg (&Request, 0);
-				Reply = NULL;
-				break;
-			case LPC_PORT_CLOSED:
-			      Reply = NULL;
-			      continue;
-			default:
-				if ((Request.SmHeader.ApiIndex) &&
-					(Request.SmHeader.ApiIndex < (sizeof SmApi / sizeof SmApi[0])))
-				{
-					Status = SmApi[Request.SmHeader.ApiIndex](&Request);
-				      	Reply = (PPORT_MESSAGE) & Request;
-				} else {
-					Request.SmHeader.Status = STATUS_NOT_IMPLEMENTED;
-					Reply = (PPORT_MESSAGE) & Request;
-				}
-			}
-		} else {
-			/* LPC failed */
-			DPRINT1("SM: %s: NtReplyWaitReceivePort() failed (Status=0x%08lx)\n",
-				__FUNCTION__, Status);
-			break;
-		}
-	}
-	NtClose (ConnectedPort);
-	DPRINT("SM: %s done\n", __FUNCTION__);
-	NtTerminateThread (NtCurrentThread(), Status);
+                Reply = NULL;
+                break;
+            case LPC_PORT_CLOSED:
+                  Reply = NULL;
+                  continue;
+            default:
+                if ((Request.SmHeader.ApiIndex) &&
+                    (Request.SmHeader.ApiIndex < (sizeof SmApi / sizeof SmApi[0])))
+                {
+                    Status = SmApi[Request.SmHeader.ApiIndex](&Request);
+                        Reply = (PPORT_MESSAGE) & Request;
+                } else {
+                    Request.SmHeader.Status = STATUS_NOT_IMPLEMENTED;
+                    Reply = (PPORT_MESSAGE) & Request;
+                }
+            }
+        } else {
+            /* LPC failed */
+            DPRINT1("SM: %s: NtReplyWaitReceivePort() failed (Status=0x%08lx)\n",
+                __FUNCTION__, Status);
+            break;
+        }
+    }
+    NtClose (ConnectedPort);
+    DPRINT("SM: %s done\n", __FUNCTION__);
+    NtTerminateThread (NtCurrentThread(), Status);
 }
 
 /**********************************************************************
@@ -183,106 +183,106 @@
 NTSTATUS NTAPI
 SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request)
 {
-	PSM_CONNECT_DATA ConnectData = SmpGetConnectData (Request);
-	NTSTATUS         Status = STATUS_SUCCESS;
-	BOOL             Accept = FALSE;
-	PSM_CLIENT_DATA  ClientData = NULL;
-	HANDLE           hClientDataApiPort = (HANDLE) 0;
-	PHANDLE          ClientDataApiPort = & hClientDataApiPort;
-	HANDLE           hClientDataApiPortThread = (HANDLE) 0;
-	PHANDLE          ClientDataApiPortThread = & hClientDataApiPortThread;
-	PVOID            Context = NULL;
-
-	DPRINT("SM: %s called:\n  SubSystemID=%d\n  SbName=\"%S\"\n",
-			__FUNCTION__, ConnectData->SubSystemId, ConnectData->SbName);
-
-	if(sizeof (SM_CONNECT_DATA) == Request->Header.u1.s1.DataLength)
-	{
-		if(IMAGE_SUBSYSTEM_UNKNOWN == ConnectData->SubSystemId)
-		{
-			/*
-			 * This is not a call to register an image set,
-			 * but a simple connection request from a process
-			 * that will use the SM API.
-			 */
-			DPRINT("SM: %s: simple request\n", __FUNCTION__);
-			ClientDataApiPort = & hClientDataApiPort;
-			ClientDataApiPortThread = & hClientDataApiPortThread;
-			Accept = TRUE;
-		} else {
-			DPRINT("SM: %s: request to register an image set\n", __FUNCTION__);
-			/*
-			 *  Reject GUIs classes: only odd subsystem IDs are
-			 *  allowed to register here (tty mode images).
-			 */
-			if(1 == (ConnectData->SubSystemId % 2))
-			{
-				DPRINT("SM: %s: id = %d\n", __FUNCTION__, ConnectData->SubSystemId);
-				/*
-				 * SmBeginClientInitialization/2 will succeed only if there
-				 * is a candidate client ready.
-				 */
-				Status = SmBeginClientInitialization (Request, & ClientData);
-				if(STATUS_SUCCESS == Status)
-				{
-					DPRINT("SM: %s: ClientData = %p\n",
-						__FUNCTION__, ClientData);
-					/*
-					 * OK: the client is an environment subsystem
-					 * willing to manage a free image type.
-					 */
-					ClientDataApiPort = & ClientData->ApiPort;
-					ClientDataApiPortThread = & ClientData->ApiPortThread;
-					/*
-					 * Call back the candidate environment subsystem
-					 * server (use the port name sent in in the
-					 * connection request message).
-					 */
-					Status = SmpCallbackServer (Request, ClientData);
-					if(NT_SUCCESS(Status))
-					{
-						DPRINT("SM: %s: SmpCallbackServer OK\n",
-							__FUNCTION__);
-						Accept = TRUE;
-					} else {
-						DPRINT("SM: %s: SmpCallbackServer failed (Status=%08lx)\n",
-							__FUNCTION__, Status);
-						Status = SmDestroyClient (ConnectData->SubSystemId);
-					}
-				}
-			}
-		}
-	}
-	DPRINT("SM: %s: before NtAcceptConnectPort\n", __FUNCTION__);
-
-	Status = NtAcceptConnectPort (ClientDataApiPort,
-				      Context,
-				      (PPORT_MESSAGE) Request,
-				      Accept,
-				      NULL,
-				      NULL);
-
-	if(Accept)
-	{
-		if(!NT_SUCCESS(Status))
-		{
-			DPRINT1("SM: %s: NtAcceptConnectPort() failed (Status=0x%08lx)\n",
-				__FUNCTION__, Status);
-			return Status;
-		} else {
-			DPRINT("SM: %s: completing connection request\n", __FUNCTION__);
-			Status = NtCompleteConnectPort (*ClientDataApiPort);
-			if (!NT_SUCCESS(Status))
-			{
-				DPRINT1("SM: %s: NtCompleteConnectPort() failed (Status=0x%08lx)\n",
-					__FUNCTION__, Status);
-				return Status;
-			}
-		}
-		Status = STATUS_SUCCESS;
-	}
-	DPRINT("SM: %s done\n", __FUNCTION__);
-	return Status;
+    PSM_CONNECT_DATA ConnectData = SmpGetConnectData (Request);
+    NTSTATUS         Status = STATUS_SUCCESS;
+    BOOL             Accept = FALSE;
+    PSM_CLIENT_DATA  ClientData = NULL;
+    HANDLE           hClientDataApiPort = (HANDLE) 0;
+    PHANDLE          ClientDataApiPort = & hClientDataApiPort;
+    HANDLE           hClientDataApiPortThread = (HANDLE) 0;
+    PHANDLE          ClientDataApiPortThread = & hClientDataApiPortThread;
+    PVOID            Context = NULL;
+
+    DPRINT("SM: %s called:\n  SubSystemID=%d\n  SbName=\"%S\"\n",
+            __FUNCTION__, ConnectData->SubSystemId, ConnectData->SbName);
+
+    if(sizeof (SM_CONNECT_DATA) == Request->Header.u1.s1.DataLength)
+    {
+        if(IMAGE_SUBSYSTEM_UNKNOWN == ConnectData->SubSystemId)
+        {
+            /*
+             * This is not a call to register an image set,
+             * but a simple connection request from a process
+             * that will use the SM API.
+             */
+            DPRINT("SM: %s: simple request\n", __FUNCTION__);
+            ClientDataApiPort = & hClientDataApiPort;
+            ClientDataApiPortThread = & hClientDataApiPortThread;
+            Accept = TRUE;
+        } else {
+            DPRINT("SM: %s: request to register an image set\n", __FUNCTION__);
+            /*
+             *  Reject GUIs classes: only odd subsystem IDs are
+             *  allowed to register here (tty mode images).
+             */
+            if(1 == (ConnectData->SubSystemId % 2))
+            {
+                DPRINT("SM: %s: id = %d\n", __FUNCTION__, ConnectData->SubSystemId);
+                /*
+                 * SmBeginClientInitialization/2 will succeed only if there
+                 * is a candidate client ready.
+                 */
+                Status = SmBeginClientInitialization (Request, & ClientData);
+                if(STATUS_SUCCESS == Status)
+                {
+                    DPRINT("SM: %s: ClientData = %p\n",
+                        __FUNCTION__, ClientData);
+                    /*
+                     * OK: the client is an environment subsystem
+                     * willing to manage a free image type.
+                     */
+                    ClientDataApiPort = & ClientData->ApiPort;
+                    ClientDataApiPortThread = & ClientData->ApiPortThread;
+                    /*
+                     * Call back the candidate environment subsystem
+                     * server (use the port name sent in in the
+                     * connection request message).
+                     */
+                    Status = SmpCallbackServer (Request, ClientData);
+                    if(NT_SUCCESS(Status))
+                    {
+                        DPRINT("SM: %s: SmpCallbackServer OK\n",
+                            __FUNCTION__);
+                        Accept = TRUE;
+                    } else {
+                        DPRINT("SM: %s: SmpCallbackServer failed (Status=%08lx)\n",
+                            __FUNCTION__, Status);
+                        Status = SmDestroyClient (ConnectData->SubSystemId);
+                    }
+                }
+            }
+        }
+    }
+    DPRINT("SM: %s: before NtAcceptConnectPort\n", __FUNCTION__);
+
+    Status = NtAcceptConnectPort (ClientDataApiPort,
+                      Context,
+                      (PPORT_MESSAGE) Request,
+                      Accept,
+                      NULL,
+                      NULL);
+
+    if(Accept)
+    {
+        if(!NT_SUCCESS(Status))
+        {
+            DPRINT1("SM: %s: NtAcceptConnectPort() failed (Status=0x%08lx)\n",
+                __FUNCTION__, Status);
+            return Status;
+        } else {
+            DPRINT("SM: %s: completing connection request\n", __FUNCTION__);
+            Status = NtCompleteConnectPort (*ClientDataApiPort);
+            if (!NT_SUCCESS(Status))
+            {
+                DPRINT1("SM: %s: NtCompleteConnectPort() failed (Status=0x%08lx)\n",
+                    __FUNCTION__, Status);
+                return Status;
+            }
+        }
+        Status = STATUS_SUCCESS;
+    }
+    DPRINT("SM: %s done\n", __FUNCTION__);
+    return Status;
 }
 
 
@@ -303,16 +303,16 @@
   NTSTATUS           Status = STATUS_SUCCESS;
 
   InitializeObjectAttributes(&ObjectAttributes,
-			     &UnicodeString,
-			     0,
-			     NULL,
-			     NULL);
+                 &UnicodeString,
+                 0,
+                 NULL,
+                 NULL);
 
   Status = NtCreatePort(&SmApiPort,
-			&ObjectAttributes,
-			sizeof(SM_CONNECT_DATA),
-			sizeof(SM_PORT_MESSAGE),
-			0);
+            &ObjectAttributes,
+            sizeof(SM_CONNECT_DATA),
+            sizeof(SM_PORT_MESSAGE),
+            0);
   if (!NT_SUCCESS(Status))
     {
       return(Status);
@@ -323,22 +323,22 @@
    * port \SmApiPort
    */
   RtlCreateUserThread(NtCurrentProcess(),
-		      NULL,
-		      FALSE,
-		      0,
-		      0,
-		      0,
-		      (PTHREAD_START_ROUTINE)SmpApiConnectedThread,
-		      &SmApiPort,
-		      NULL,
-		      NULL);
-
-    //
-    // On NT LPC, we need a second thread to handle incoming connections
-    // generated by incoming requests, otherwise the thread handling
-    // the request will be busy sending the LPC message, without any other
-    // thread being busy to receive the LPC message.
-    //
+              NULL,
+              FALSE,
+              0,
+              0,
+              0,
+              (PTHREAD_START_ROUTINE)SmpApiConnectedThread,
+              &SmApiPort,
+              NULL,
+              NULL);
+
+    /*
+    * On NT LPC, we need a second thread to handle incoming connections
+     * generated by incoming requests, otherwise the thread handling
+     * the request will be busy sending the LPC message, without any other
+     * thread being busy to receive the LPC message.
+     */
     Status = RtlCreateUserThread(NtCurrentProcess(),
                                  NULL,
                                  FALSE,



More information about the Ros-diffs mailing list