/* INCLUDES ******************************************************************/
-#include "advapi32.h"
+#include <advapi32.h>
#include "svcctl_c.h"
#define NDEBUG
/**********************************************************************
* ChangeServiceConfigW
*
- * @unimplemented
+ * @implemented
*/
-BOOL
-STDCALL
-ChangeServiceConfigW(
- SC_HANDLE hService,
- DWORD dwServiceType,
- DWORD dwStartType,
- DWORD dwErrorControl,
- LPCWSTR lpBinaryPathName,
- LPCWSTR lpLoadOrderGroup,
- LPDWORD lpdwTagId,
- LPCWSTR lpDependencies,
- LPCWSTR lpServiceStartName,
- LPCWSTR lpPassword,
- LPCWSTR lpDisplayName)
+BOOL STDCALL
+ChangeServiceConfigW(SC_HANDLE hService,
+ DWORD dwServiceType,
+ DWORD dwStartType,
+ DWORD dwErrorControl,
+ LPCWSTR lpBinaryPathName,
+ LPCWSTR lpLoadOrderGroup,
+ LPDWORD lpdwTagId,
+ LPCWSTR lpDependencies,
+ LPCWSTR lpServiceStartName,
+ LPCWSTR lpPassword,
+ LPCWSTR lpDisplayName)
{
- DPRINT1("ChangeServiceConfigW is unimplemented\n");
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
+ DWORD dwError;
+ DWORD dwDependenciesLength = 0;
+ DWORD dwLength;
+ LPWSTR lpStr;
+
+ DPRINT1("ChangeServiceConfigW() called\n");
+
+ /* Calculate the Dependencies length*/
+ if (lpDependencies != NULL)
+ {
+ lpStr = (LPWSTR)lpDependencies;
+ while (*lpStr)
+ {
+ dwLength = wcslen(lpStr) + 1;
+ dwDependenciesLength += dwLength;
+ lpStr = lpStr + dwLength;
+ }
+ dwDependenciesLength++;
+ }
+
+ /* FIXME: Encrypt the password */
+
+ HandleBind();
+
+ /* Call to services.exe using RPC */
+ dwError = ScmrChangeServiceConfigW(BindingHandle,
+ (unsigned int)hService,
+ dwServiceType,
+ dwStartType,
+ dwErrorControl,
+ (LPWSTR)lpBinaryPathName,
+ (LPWSTR)lpLoadOrderGroup,
+ lpdwTagId,
+ (LPWSTR)lpDependencies,
+ dwDependenciesLength,
+ (LPWSTR)lpServiceStartName,
+ NULL, /* FIXME: lpPassword */
+ 0, /* FIXME: dwPasswordLength */
+ (LPWSTR)lpDisplayName);
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("ScmrChangeServiceConfigW() failed (Error %lu)\n", dwError);
+ SetLastError(dwError);
+ return FALSE;
+ }
+
+ return TRUE;
}
}
+/**********************************************************************
+ * ControlServiceEx
+ *
+ * @unimplemented
+ */
+BOOL STDCALL
+ControlServiceEx(IN SC_HANDLE hService,
+ IN DWORD dwControl,
+ IN DWORD dwInfoLevel,
+ IN OUT PVOID pControlParams)
+{
+ DPRINT1("ControlServiceEx(0x%p, 0x%x, 0x%x, 0x%p) UNIMPLEMENTED!\n",
+ hService, dwControl, dwInfoLevel, pControlParams);
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return FALSE;
+}
+
+
+
/**********************************************************************
* CreateServiceA
*
/**********************************************************************
* CreateServiceW
*
- * @unimplemented
+ * @implemented
*/
-SC_HANDLE
-STDCALL
-CreateServiceW(
- SC_HANDLE hSCManager,
- LPCWSTR lpServiceName,
- LPCWSTR lpDisplayName,
- DWORD dwDesiredAccess,
- DWORD dwServiceType,
- DWORD dwStartType,
- DWORD dwErrorControl,
- LPCWSTR lpBinaryPathName,
- LPCWSTR lpLoadOrderGroup,
- LPDWORD lpdwTagId,
- LPCWSTR lpDependencies,
- LPCWSTR lpServiceStartName,
- LPCWSTR lpPassword)
+SC_HANDLE STDCALL
+CreateServiceW(SC_HANDLE hSCManager,
+ LPCWSTR lpServiceName,
+ LPCWSTR lpDisplayName,
+ DWORD dwDesiredAccess,
+ DWORD dwServiceType,
+ DWORD dwStartType,
+ DWORD dwErrorControl,
+ LPCWSTR lpBinaryPathName,
+ LPCWSTR lpLoadOrderGroup,
+ LPDWORD lpdwTagId,
+ LPCWSTR lpDependencies,
+ LPCWSTR lpServiceStartName,
+ LPCWSTR lpPassword)
{
- DPRINT1("CreateServiceW is unimplemented, but returning INVALID_HANDLE_VALUE instead of NULL\n");
- return INVALID_HANDLE_VALUE;
+ SC_HANDLE hService = NULL;
+ DWORD dwError;
+ DWORD dwDependenciesLength = 0;
+ DWORD dwLength;
+ LPWSTR lpStr;
+
+ DPRINT1("CreateServiceW() called\n");
+
+ /* Calculate the Dependencies length*/
+ if (lpDependencies != NULL)
+ {
+ lpStr = (LPWSTR)lpDependencies;
+ while (*lpStr)
+ {
+ dwLength = wcslen(lpStr) + 1;
+ dwDependenciesLength += dwLength;
+ lpStr = lpStr + dwLength;
+ }
+ dwDependenciesLength++;
+ }
+
+ /* FIXME: Encrypt the password */
+
+ HandleBind();
+
+ /* Call to services.exe using RPC */
+ dwError = ScmrCreateServiceW(BindingHandle,
+ (unsigned int)hSCManager,
+ (LPWSTR)lpServiceName,
+ (LPWSTR)lpDisplayName,
+ dwDesiredAccess,
+ dwServiceType,
+ dwStartType,
+ dwErrorControl,
+ (LPWSTR)lpBinaryPathName,
+ (LPWSTR)lpLoadOrderGroup,
+ lpdwTagId,
+ (LPWSTR)lpDependencies,
+ dwDependenciesLength,
+ (LPWSTR)lpServiceStartName,
+ NULL, /* FIXME: lpPassword */
+ 0, /* FIXME: dwPasswordLength */
+ (unsigned int *)&hService);
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("ScmrCreateServiceW() failed (Error %lu)\n", dwError);
+ SetLastError(dwError);
+ return INVALID_HANDLE_VALUE;
+ }
+
+ return hService;
}
{
DWORD dwError;
- DPRINT("UnlockServiceDatabase(%x)\n", hSCManager);
+ DPRINT("UnlockServiceDatabase(%x)\n", ScLock);
HandleBind();
}
+/**********************************************************************
+ * NotifyBootConfigStatus
+ *
+ * @implemented
+ */
+BOOL STDCALL
+NotifyBootConfigStatus(BOOL BootAcceptable)
+{
+ DWORD dwError;
+
+ DPRINT1("NotifyBootConfigStatus()\n");
+
+ HandleBind();
+
+ /* Call to services.exe using RPC */
+ dwError = ScmrNotifyBootConfigStatus(BindingHandle,
+ BootAcceptable);
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("NotifyBootConfigStatus() failed (Error %lu)\n", dwError);
+ SetLastError(dwError);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
{
- return GlobalAlloc(GPTR,len);
+ return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
}
+
void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
{
- GlobalFree(ptr);
+ HeapFree(GetProcessHeap(), 0, ptr);
}
/* EOF */