Author: ekohl Date: Wed Aug 30 14:53:37 2006 New Revision: 23801
URL: http://svn.reactos.org/svn/reactos?rev=23801&view=rev Log: - fix indentation and remove trailing whitespace - StartServiceA/W: terminate argument buffer with a double zero.
Modified: trunk/reactos/dll/win32/advapi32/service/scm.c
Modified: trunk/reactos/dll/win32/advapi32/service/scm.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service/... ============================================================================== --- trunk/reactos/dll/win32/advapi32/service/scm.c (original) +++ trunk/reactos/dll/win32/advapi32/service/scm.c Wed Aug 30 14:53:37 2006 @@ -442,8 +442,7 @@ if (!lpServiceNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpServiceName, -1, lpServiceNameW, len); } @@ -455,8 +454,7 @@ if (!lpDisplayNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpDisplayName, -1, lpDisplayNameW, len); } @@ -468,8 +466,7 @@ if (!lpBinaryPathNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpDisplayName, -1, lpBinaryPathNameW, len); } @@ -481,8 +478,7 @@ if (!lpLoadOrderGroupW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpLoadOrderGroup, -1, lpLoadOrderGroupW, len); } @@ -502,8 +498,7 @@ if (!lpDependenciesW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpDependencies, -1, lpDependenciesW, dwDependenciesLength); } @@ -515,8 +510,7 @@ if (!lpServiceStartNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpServiceStartName, -1, lpServiceStartNameW, len); } @@ -528,8 +522,7 @@ if (!lpPasswordW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpPassword, -1, lpPasswordW, len); } @@ -549,34 +542,26 @@ lpPasswordW);
cleanup: - if (lpServiceNameW !=NULL) - { - HeapFree(GetProcessHeap(), 0, lpServiceNameW); - } + if (lpServiceNameW !=NULL) + HeapFree(GetProcessHeap(), 0, lpServiceNameW); + if (lpDisplayNameW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpDisplayNameW); - } - if (lpBinaryPathNameW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); - } - if (lpLoadOrderGroupW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); - } - if (lpDependenciesW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpDependenciesW); - } - if (lpServiceStartNameW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpServiceStartNameW); - } - if (lpPasswordW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpPasswordW); - } + HeapFree(GetProcessHeap(), 0, lpDisplayNameW); + + if (lpBinaryPathNameW != NULL) + HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); + + if (lpLoadOrderGroupW != NULL) + HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); + + if (lpDependenciesW != NULL) + HeapFree(GetProcessHeap(), 0, lpDependenciesW); + + if (lpServiceStartNameW != NULL) + HeapFree(GetProcessHeap(), 0, lpServiceStartNameW); + + if (lpPasswordW != NULL) + HeapFree(GetProcessHeap(), 0, lpPasswordW);
return RetVal; } @@ -1982,6 +1967,7 @@ { dwBufSize += (strlen(lpServiceArgVectors[i]) + 1); } + dwBufSize++; DPRINT1("dwBufSize: %lu\n", dwBufSize);
lpBuffer = HeapAlloc(GetProcessHeap(), 0, dwBufSize); @@ -1997,6 +1983,7 @@ strcpy(lpStr, lpServiceArgVectors[i]); lpStr += (strlen(lpServiceArgVectors[i]) + 1); } + *lpStr = 0;
dwError = ScmrStartServiceA(BindingHandle, (unsigned int)hService, @@ -2038,6 +2025,7 @@ { dwBufSize += ((wcslen(lpServiceArgVectors[i]) + 1) * sizeof(WCHAR)); } + dwBufSize += sizeof(WCHAR); DPRINT1("dwBufSize: %lu\n", dwBufSize);
lpBuffer = HeapAlloc(GetProcessHeap(), 0, dwBufSize); @@ -2053,6 +2041,7 @@ wcscpy(lpStr, lpServiceArgVectors[i]); lpStr += (wcslen(lpServiceArgVectors[i]) + 1); } + *lpStr = 0;
dwError = ScmrStartServiceW(BindingHandle, (unsigned int)hService,