mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 03:15:43 +00:00
[ADVAPI32/SERVICES]
Little improvements to advapi32.dll / services.exe. Patch by Hermes Belusca. See issue #7239 for more details. svn path=/trunk/; revision=57146
This commit is contained in:
parent
6431b75749
commit
5fd0a21ec7
3 changed files with 34 additions and 19 deletions
|
@ -1955,7 +1955,7 @@ DWORD RChangeServiceConfigW(
|
||||||
|
|
||||||
if (lpPassword != NULL)
|
if (lpPassword != NULL)
|
||||||
{
|
{
|
||||||
/* FIXME: Write password */
|
/* FIXME: Decrypt and write password */
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -2293,7 +2293,7 @@ DWORD RCreateServiceW(
|
||||||
|
|
||||||
if (lpPassword != NULL)
|
if (lpPassword != NULL)
|
||||||
{
|
{
|
||||||
/* FIXME: Write password */
|
/* FIXME: Decrypt and write password */
|
||||||
}
|
}
|
||||||
|
|
||||||
dwError = ScmCreateServiceHandle(lpService,
|
dwError = ScmCreateServiceHandle(lpService,
|
||||||
|
@ -3118,7 +3118,7 @@ DWORD RChangeServiceConfigA(
|
||||||
LPSTR lpBinaryPathName,
|
LPSTR lpBinaryPathName,
|
||||||
LPSTR lpLoadOrderGroup,
|
LPSTR lpLoadOrderGroup,
|
||||||
LPDWORD lpdwTagId,
|
LPDWORD lpdwTagId,
|
||||||
LPSTR lpDependencies,
|
LPBYTE lpDependencies,
|
||||||
DWORD dwDependSize,
|
DWORD dwDependSize,
|
||||||
LPSTR lpServiceStartName,
|
LPSTR lpServiceStartName,
|
||||||
LPBYTE lpPassword,
|
LPBYTE lpPassword,
|
||||||
|
@ -3134,7 +3134,6 @@ DWORD RChangeServiceConfigA(
|
||||||
LPWSTR lpCanonicalImagePathW = NULL;
|
LPWSTR lpCanonicalImagePathW = NULL;
|
||||||
LPWSTR lpLoadOrderGroupW = NULL;
|
LPWSTR lpLoadOrderGroupW = NULL;
|
||||||
LPWSTR lpDependenciesW = NULL;
|
LPWSTR lpDependenciesW = NULL;
|
||||||
// LPWSTR lpPasswordW = NULL;
|
|
||||||
|
|
||||||
DPRINT("RChangeServiceConfigA() called\n");
|
DPRINT("RChangeServiceConfigA() called\n");
|
||||||
DPRINT("dwServiceType = %lu\n", dwServiceType);
|
DPRINT("dwServiceType = %lu\n", dwServiceType);
|
||||||
|
@ -3374,7 +3373,7 @@ DWORD RChangeServiceConfigA(
|
||||||
{
|
{
|
||||||
lpDependenciesW = HeapAlloc(GetProcessHeap(),
|
lpDependenciesW = HeapAlloc(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
(strlen(lpDependencies) + 1) * sizeof(WCHAR));
|
(strlen((LPSTR)lpDependencies) + 1) * sizeof(WCHAR));
|
||||||
if (lpDependenciesW == NULL)
|
if (lpDependenciesW == NULL)
|
||||||
{
|
{
|
||||||
dwError = ERROR_NOT_ENOUGH_MEMORY;
|
dwError = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
@ -3383,10 +3382,10 @@ DWORD RChangeServiceConfigA(
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP,
|
MultiByteToWideChar(CP_ACP,
|
||||||
0,
|
0,
|
||||||
lpDependencies,
|
(LPSTR)lpDependencies,
|
||||||
dwDependSize,
|
dwDependSize,
|
||||||
lpDependenciesW,
|
lpDependenciesW,
|
||||||
(int)(strlen(lpDependencies) + 1));
|
(int)(strlen((LPSTR)lpDependencies) + 1));
|
||||||
|
|
||||||
dwError = ScmWriteDependencies(hServiceKey,
|
dwError = ScmWriteDependencies(hServiceKey,
|
||||||
(LPWSTR)lpDependenciesW,
|
(LPWSTR)lpDependenciesW,
|
||||||
|
@ -3397,7 +3396,7 @@ DWORD RChangeServiceConfigA(
|
||||||
|
|
||||||
if (lpPassword != NULL)
|
if (lpPassword != NULL)
|
||||||
{
|
{
|
||||||
/* FIXME: Write password */
|
/* FIXME: Decrypt and write password */
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
|
@ -289,6 +289,8 @@ ChangeServiceConfigA(SC_HANDLE hService,
|
||||||
DWORD dwDependenciesLength = 0;
|
DWORD dwDependenciesLength = 0;
|
||||||
DWORD dwLength;
|
DWORD dwLength;
|
||||||
LPCSTR lpStr;
|
LPCSTR lpStr;
|
||||||
|
DWORD dwPasswordLength = 0;
|
||||||
|
LPBYTE lpEncryptedPassword = NULL;
|
||||||
|
|
||||||
TRACE("ChangeServiceConfigA() called\n");
|
TRACE("ChangeServiceConfigA() called\n");
|
||||||
|
|
||||||
|
@ -306,6 +308,8 @@ ChangeServiceConfigA(SC_HANDLE hService,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Encrypt the password */
|
/* FIXME: Encrypt the password */
|
||||||
|
lpEncryptedPassword = (LPBYTE)lpPassword;
|
||||||
|
dwPasswordLength = (strlen(lpPassword) + 1) * sizeof(CHAR);
|
||||||
|
|
||||||
RpcTryExcept
|
RpcTryExcept
|
||||||
{
|
{
|
||||||
|
@ -317,11 +321,11 @@ ChangeServiceConfigA(SC_HANDLE hService,
|
||||||
(LPSTR)lpBinaryPathName,
|
(LPSTR)lpBinaryPathName,
|
||||||
(LPSTR)lpLoadOrderGroup,
|
(LPSTR)lpLoadOrderGroup,
|
||||||
lpdwTagId,
|
lpdwTagId,
|
||||||
(LPSTR)lpDependencies,
|
(LPBYTE)lpDependencies,
|
||||||
dwDependenciesLength,
|
dwDependenciesLength,
|
||||||
(LPSTR)lpServiceStartName,
|
(LPSTR)lpServiceStartName,
|
||||||
NULL, /* FIXME: lpPassword */
|
lpEncryptedPassword,
|
||||||
0, /* FIXME: dwPasswordLength */
|
dwPasswordLength,
|
||||||
(LPSTR)lpDisplayName);
|
(LPSTR)lpDisplayName);
|
||||||
}
|
}
|
||||||
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
@ -363,6 +367,8 @@ ChangeServiceConfigW(SC_HANDLE hService,
|
||||||
DWORD dwDependenciesLength = 0;
|
DWORD dwDependenciesLength = 0;
|
||||||
DWORD dwLength;
|
DWORD dwLength;
|
||||||
LPCWSTR lpStr;
|
LPCWSTR lpStr;
|
||||||
|
DWORD dwPasswordLength = 0;
|
||||||
|
LPBYTE lpEncryptedPassword = NULL;
|
||||||
|
|
||||||
TRACE("ChangeServiceConfigW() called\n");
|
TRACE("ChangeServiceConfigW() called\n");
|
||||||
|
|
||||||
|
@ -380,6 +386,8 @@ ChangeServiceConfigW(SC_HANDLE hService,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Encrypt the password */
|
/* FIXME: Encrypt the password */
|
||||||
|
lpEncryptedPassword = (LPBYTE)lpPassword;
|
||||||
|
dwPasswordLength = (wcslen(lpPassword) + 1) * sizeof(WCHAR);
|
||||||
|
|
||||||
RpcTryExcept
|
RpcTryExcept
|
||||||
{
|
{
|
||||||
|
@ -394,8 +402,8 @@ ChangeServiceConfigW(SC_HANDLE hService,
|
||||||
(LPBYTE)lpDependencies,
|
(LPBYTE)lpDependencies,
|
||||||
dwDependenciesLength,
|
dwDependenciesLength,
|
||||||
(LPWSTR)lpServiceStartName,
|
(LPWSTR)lpServiceStartName,
|
||||||
NULL, /* FIXME: lpPassword */
|
lpEncryptedPassword,
|
||||||
0, /* FIXME: dwPasswordLength */
|
dwPasswordLength,
|
||||||
(LPWSTR)lpDisplayName);
|
(LPWSTR)lpDisplayName);
|
||||||
}
|
}
|
||||||
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
@ -541,6 +549,8 @@ CreateServiceA(SC_HANDLE hSCManager,
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
DWORD dwLength;
|
DWORD dwLength;
|
||||||
LPCSTR lpStr;
|
LPCSTR lpStr;
|
||||||
|
DWORD dwPasswordLength = 0;
|
||||||
|
LPBYTE lpEncryptedPassword = NULL;
|
||||||
|
|
||||||
TRACE("CreateServiceA() called\n");
|
TRACE("CreateServiceA() called\n");
|
||||||
TRACE("%p %s %s\n", hSCManager,
|
TRACE("%p %s %s\n", hSCManager,
|
||||||
|
@ -566,6 +576,8 @@ CreateServiceA(SC_HANDLE hSCManager,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Encrypt the password */
|
/* FIXME: Encrypt the password */
|
||||||
|
lpEncryptedPassword = (LPBYTE)lpPassword;
|
||||||
|
dwPasswordLength = (strlen(lpPassword) + 1) * sizeof(CHAR);
|
||||||
|
|
||||||
RpcTryExcept
|
RpcTryExcept
|
||||||
{
|
{
|
||||||
|
@ -583,8 +595,8 @@ CreateServiceA(SC_HANDLE hSCManager,
|
||||||
(LPBYTE)lpDependencies,
|
(LPBYTE)lpDependencies,
|
||||||
dwDependenciesLength,
|
dwDependenciesLength,
|
||||||
(LPSTR)lpServiceStartName,
|
(LPSTR)lpServiceStartName,
|
||||||
NULL, /* FIXME: lpPassword */
|
lpEncryptedPassword,
|
||||||
0, /* FIXME: dwPasswordLength */
|
dwPasswordLength,
|
||||||
(SC_RPC_HANDLE *)&hService);
|
(SC_RPC_HANDLE *)&hService);
|
||||||
}
|
}
|
||||||
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
@ -629,6 +641,8 @@ CreateServiceW(SC_HANDLE hSCManager,
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
DWORD dwLength;
|
DWORD dwLength;
|
||||||
LPCWSTR lpStr;
|
LPCWSTR lpStr;
|
||||||
|
DWORD dwPasswordLength = 0;
|
||||||
|
LPBYTE lpEncryptedPassword = NULL;
|
||||||
|
|
||||||
TRACE("CreateServiceW() called\n");
|
TRACE("CreateServiceW() called\n");
|
||||||
TRACE("%p %S %S\n", hSCManager,
|
TRACE("%p %S %S\n", hSCManager,
|
||||||
|
@ -656,6 +670,8 @@ CreateServiceW(SC_HANDLE hSCManager,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Encrypt the password */
|
/* FIXME: Encrypt the password */
|
||||||
|
lpEncryptedPassword = (LPBYTE)lpPassword;
|
||||||
|
dwPasswordLength = (wcslen(lpPassword) + 1) * sizeof(WCHAR);
|
||||||
|
|
||||||
RpcTryExcept
|
RpcTryExcept
|
||||||
{
|
{
|
||||||
|
@ -673,8 +689,8 @@ CreateServiceW(SC_HANDLE hSCManager,
|
||||||
(LPBYTE)lpDependencies,
|
(LPBYTE)lpDependencies,
|
||||||
dwDependenciesLength,
|
dwDependenciesLength,
|
||||||
lpServiceStartName,
|
lpServiceStartName,
|
||||||
NULL, /* FIXME: lpPassword */
|
lpEncryptedPassword,
|
||||||
0, /* FIXME: dwPasswordLength */
|
dwPasswordLength,
|
||||||
(SC_RPC_HANDLE *)&hService);
|
(SC_RPC_HANDLE *)&hService);
|
||||||
}
|
}
|
||||||
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include <ms-dtyp.idl>
|
#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_DEPEND_SIZE = 4 * 1024;
|
||||||
const unsigned short SC_MAX_NAME_LENGTH = MAX_SERVICE_NAME_LENGTH + 1;
|
const unsigned short SC_MAX_NAME_LENGTH = MAX_SERVICE_NAME_LENGTH + 1;
|
||||||
const unsigned short SC_MAX_PATH_LENGTH = 32 * 1024;
|
const unsigned short SC_MAX_PATH_LENGTH = 32 * 1024;
|
||||||
|
@ -485,7 +485,7 @@ interface svcctl
|
||||||
[in, string, unique] LPSTR lpBinaryPathName,
|
[in, string, unique] LPSTR lpBinaryPathName,
|
||||||
[in, string, unique] LPSTR lpLoadOrderGroup,
|
[in, string, unique] LPSTR lpLoadOrderGroup,
|
||||||
[in, out, unique] LPDWORD lpdwTagId,
|
[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, range(0, SC_MAX_DEPEND_SIZE)] DWORD dwDependSize,
|
||||||
[in, string, unique] LPSTR lpServiceStartName,
|
[in, string, unique] LPSTR lpServiceStartName,
|
||||||
[in, unique, size_is(dwPwSize)] LPBYTE lpPassword,
|
[in, unique, size_is(dwPwSize)] LPBYTE lpPassword,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue