Author: ekohl Date: Thu Aug 23 20:24:00 2012 New Revision: 57146
URL: http://svn.reactos.org/svn/reactos?rev=57146&view=rev Log: [ADVAPI32/SERVICES] Little improvements to advapi32.dll / services.exe. Patch by Hermes Belusca. See issue #7239 for more details.
Modified: trunk/reactos/base/system/services/rpcserver.c trunk/reactos/dll/win32/advapi32/service/scm.c trunk/reactos/include/reactos/idl/svcctl.idl
Modified: trunk/reactos/base/system/services/rpcserver.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcser... ============================================================================== --- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original) +++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Thu Aug 23 20:24:00 2012 @@ -1955,7 +1955,7 @@
if (lpPassword != NULL) { - /* FIXME: Write password */ + /* FIXME: Decrypt and write password */ }
done: @@ -2293,7 +2293,7 @@
if (lpPassword != NULL) { - /* FIXME: Write password */ + /* FIXME: Decrypt and write password */ }
dwError = ScmCreateServiceHandle(lpService, @@ -3118,7 +3118,7 @@ LPSTR lpBinaryPathName, LPSTR lpLoadOrderGroup, LPDWORD lpdwTagId, - LPSTR lpDependencies, + LPBYTE lpDependencies, DWORD dwDependSize, LPSTR lpServiceStartName, LPBYTE lpPassword, @@ -3134,7 +3134,6 @@ LPWSTR lpCanonicalImagePathW = NULL; LPWSTR lpLoadOrderGroupW = NULL; LPWSTR lpDependenciesW = NULL; - // LPWSTR lpPasswordW = NULL;
DPRINT("RChangeServiceConfigA() called\n"); DPRINT("dwServiceType = %lu\n", dwServiceType); @@ -3374,7 +3373,7 @@ { lpDependenciesW = HeapAlloc(GetProcessHeap(), 0, - (strlen(lpDependencies) + 1) * sizeof(WCHAR)); + (strlen((LPSTR)lpDependencies) + 1) * sizeof(WCHAR)); if (lpDependenciesW == NULL) { dwError = ERROR_NOT_ENOUGH_MEMORY; @@ -3383,10 +3382,10 @@
MultiByteToWideChar(CP_ACP, 0, - lpDependencies, + (LPSTR)lpDependencies, dwDependSize, lpDependenciesW, - (int)(strlen(lpDependencies) + 1)); + (int)(strlen((LPSTR)lpDependencies) + 1));
dwError = ScmWriteDependencies(hServiceKey, (LPWSTR)lpDependenciesW, @@ -3397,7 +3396,7 @@
if (lpPassword != NULL) { - /* FIXME: Write password */ + /* FIXME: Decrypt and write password */ }
done:
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 [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/service/scm.c [iso-8859-1] Thu Aug 23 20:24:00 2012 @@ -289,6 +289,8 @@ DWORD dwDependenciesLength = 0; DWORD dwLength; LPCSTR lpStr; + DWORD dwPasswordLength = 0; + LPBYTE lpEncryptedPassword = NULL;
TRACE("ChangeServiceConfigA() called\n");
@@ -306,6 +308,8 @@ }
/* FIXME: Encrypt the password */ + lpEncryptedPassword = (LPBYTE)lpPassword; + dwPasswordLength = (strlen(lpPassword) + 1) * sizeof(CHAR);
RpcTryExcept { @@ -317,11 +321,11 @@ (LPSTR)lpBinaryPathName, (LPSTR)lpLoadOrderGroup, lpdwTagId, - (LPSTR)lpDependencies, + (LPBYTE)lpDependencies, dwDependenciesLength, (LPSTR)lpServiceStartName, - NULL, /* FIXME: lpPassword */ - 0, /* FIXME: dwPasswordLength */ + lpEncryptedPassword, + dwPasswordLength, (LPSTR)lpDisplayName); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) @@ -363,6 +367,8 @@ DWORD dwDependenciesLength = 0; DWORD dwLength; LPCWSTR lpStr; + DWORD dwPasswordLength = 0; + LPBYTE lpEncryptedPassword = NULL;
TRACE("ChangeServiceConfigW() called\n");
@@ -380,6 +386,8 @@ }
/* FIXME: Encrypt the password */ + lpEncryptedPassword = (LPBYTE)lpPassword; + dwPasswordLength = (wcslen(lpPassword) + 1) * sizeof(WCHAR);
RpcTryExcept { @@ -394,8 +402,8 @@ (LPBYTE)lpDependencies, dwDependenciesLength, (LPWSTR)lpServiceStartName, - NULL, /* FIXME: lpPassword */ - 0, /* FIXME: dwPasswordLength */ + lpEncryptedPassword, + dwPasswordLength, (LPWSTR)lpDisplayName); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) @@ -541,6 +549,8 @@ DWORD dwError; DWORD dwLength; LPCSTR lpStr; + DWORD dwPasswordLength = 0; + LPBYTE lpEncryptedPassword = NULL;
TRACE("CreateServiceA() called\n"); TRACE("%p %s %s\n", hSCManager, @@ -566,6 +576,8 @@ }
/* FIXME: Encrypt the password */ + lpEncryptedPassword = (LPBYTE)lpPassword; + dwPasswordLength = (strlen(lpPassword) + 1) * sizeof(CHAR);
RpcTryExcept { @@ -583,8 +595,8 @@ (LPBYTE)lpDependencies, dwDependenciesLength, (LPSTR)lpServiceStartName, - NULL, /* FIXME: lpPassword */ - 0, /* FIXME: dwPasswordLength */ + lpEncryptedPassword, + dwPasswordLength, (SC_RPC_HANDLE *)&hService); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) @@ -629,6 +641,8 @@ DWORD dwError; DWORD dwLength; LPCWSTR lpStr; + DWORD dwPasswordLength = 0; + LPBYTE lpEncryptedPassword = NULL;
TRACE("CreateServiceW() called\n"); TRACE("%p %S %S\n", hSCManager, @@ -656,6 +670,8 @@ }
/* FIXME: Encrypt the password */ + lpEncryptedPassword = (LPBYTE)lpPassword; + dwPasswordLength = (wcslen(lpPassword) + 1) * sizeof(WCHAR);
RpcTryExcept { @@ -673,8 +689,8 @@ (LPBYTE)lpDependencies, dwDependenciesLength, lpServiceStartName, - NULL, /* FIXME: lpPassword */ - 0, /* FIXME: dwPasswordLength */ + lpEncryptedPassword, + dwPasswordLength, (SC_RPC_HANDLE *)&hService); } RpcExcept(EXCEPTION_EXECUTE_HANDLER)
Modified: trunk/reactos/include/reactos/idl/svcctl.idl URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/idl/svcctl.... ============================================================================== --- trunk/reactos/include/reactos/idl/svcctl.idl [iso-8859-1] (original) +++ trunk/reactos/include/reactos/idl/svcctl.idl [iso-8859-1] Thu Aug 23 20:24:00 2012 @@ -4,7 +4,7 @@
#include <ms-dtyp.idl>
-const unsigned int MAX_SERVICE_NAME_LENGTH = 255; +const unsigned int MAX_SERVICE_NAME_LENGTH = 256; const unsigned short SC_MAX_DEPEND_SIZE = 4 * 1024; const unsigned short SC_MAX_NAME_LENGTH = MAX_SERVICE_NAME_LENGTH + 1; const unsigned short SC_MAX_PATH_LENGTH = 32 * 1024; @@ -485,7 +485,7 @@ [in, string, unique] LPSTR lpBinaryPathName, [in, string, unique] LPSTR lpLoadOrderGroup, [in, out, unique] LPDWORD lpdwTagId, - [in, unique, size_is(dwDependSize)] LPSTR lpDependencies, + [in, unique, size_is(dwDependSize)] LPBYTE lpDependencies, [in, range(0, SC_MAX_DEPEND_SIZE)] DWORD dwDependSize, [in, string, unique] LPSTR lpServiceStartName, [in, unique, size_is(dwPwSize)] LPBYTE lpPassword,