[0.4.8][SERVICES] RChangeServiceConfig2A(): Zero-Initialize InfoW variable CORE-14521
authorJoachim Henze <Joachim.Henze@reactos.org>
Fri, 4 Mar 2022 22:58:19 +0000 (23:58 +0100)
committerJoachim Henze <Joachim.Henze@reactos.org>
Fri, 4 Mar 2022 22:58:19 +0000 (23:58 +0100)
This lets forward NULL Info.psd/Info.psd->lpDescription/Info.psfa,
instead of an uninitialized value.

Currently this branch does not show the bug CORE-14521, but that is just because
it doesn't use the more mean "advapi32 : service" test of 0.4.10.

If we would port back the newer test from 0.4.9-dev-555-g 3c1b7834e15b652076c21d2d4ed8232d522b971a
, then we would see it hanging as well.

fix picked from 0.4.10-dev-627-g e3a1c2c81b2e1167552cbb8f8ca1d774e025ccd7
-------
I also muted a forgotten DPRINT1, like it was done during 0.4.10-dev'ing on master
and fixed some whitespace indentation, like it was done during 0.4.9-dev'ing on master

base/system/services/rpcserver.c

index a4718aa..e214620 100644 (file)
@@ -1239,36 +1239,36 @@ RControlService(
 
     if (dwError == ERROR_SUCCESS)
     {
-            if (dwControl == SERVICE_CONTROL_STOP ||
-                dwControl == SERVICE_CONTROL_PAUSE ||
-                dwControl == SERVICE_CONTROL_CONTINUE)
+        if (dwControl == SERVICE_CONTROL_STOP ||
+            dwControl == SERVICE_CONTROL_PAUSE ||
+            dwControl == SERVICE_CONTROL_CONTINUE)
+        {
+            /* Log a successful send control */
+
+            switch (dwControl)
             {
-                /* Log a successful send control */
+                case SERVICE_CONTROL_STOP:
+                    uID = IDS_SERVICE_STOP;
+                    break;
 
-                switch (dwControl)
-                {
-                    case SERVICE_CONTROL_STOP:
-                        uID = IDS_SERVICE_STOP;
-                        break;
+                case SERVICE_CONTROL_PAUSE:
+                    uID = IDS_SERVICE_PAUSE;
+                    break;
 
-                    case SERVICE_CONTROL_PAUSE:
-                        uID = IDS_SERVICE_PAUSE;
-                        break;
-
-                    case SERVICE_CONTROL_CONTINUE:
-                        uID = IDS_SERVICE_RESUME;
-                        break;
-                }
-                LoadStringW(GetModuleHandle(NULL), uID, szLogBuffer, 80);
+                case SERVICE_CONTROL_CONTINUE:
+                    uID = IDS_SERVICE_RESUME;
+                    break;
+            }
+            LoadStringW(GetModuleHandle(NULL), uID, szLogBuffer, 80);
 
-                lpLogStrings[0] = lpService->lpDisplayName;
-                lpLogStrings[1] = szLogBuffer;
+            lpLogStrings[0] = lpService->lpDisplayName;
+            lpLogStrings[1] = szLogBuffer;
 
-                ScmLogEvent(EVENT_SERVICE_CONTROL_SUCCESS,
-                            EVENTLOG_INFORMATION_TYPE,
-                            2,
-                            lpLogStrings);
-            }
+            ScmLogEvent(EVENT_SERVICE_CONTROL_SUCCESS,
+                        EVENTLOG_INFORMATION_TYPE,
+                        2,
+                        lpLogStrings);
+        }
     }
 
     return dwError;
@@ -2463,7 +2463,6 @@ RCreateServiceW(
                 goto done;
         }
 
-DPRINT1("\n");
         /* Write the security descriptor */
         dwError = ScmWriteSecurityDescriptor(hServiceKey,
                                              lpService->pSecurityDescriptor);
@@ -5011,7 +5010,7 @@ RChangeServiceConfig2A(
     SC_RPC_HANDLE hService,
     SC_RPC_CONFIG_INFOA Info)
 {
-    SC_RPC_CONFIG_INFOW InfoW;
+    SC_RPC_CONFIG_INFOW InfoW = { 0 };
     DWORD dwRet, dwLength;
     PVOID ptr = NULL;