/* INCLUDES ******************************************************************/
-#include "advapi32.h"
-#include "svcctl.h"
+#include <advapi32.h>
+#include "svcctl_c.h"
#define NDEBUG
#include <debug.h>
{
DWORD dwError;
- DPRINT1("CloseServiceHandle() called\n");
+ DPRINT("CloseServiceHandle() called\n");
HandleBind();
/* Call to services.exe using RPC */
dwError = ScmrCloseServiceHandle(BindingHandle,
(unsigned int)hSCObject);
- DPRINT1("dwError %lu\n", dwError);
-
if (dwError)
{
+ DPRINT1("ScmrCloseServiceHandle() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return FALSE;
}
+ DPRINT("CloseServiceHandle() done\n");
+
return TRUE;
}
DWORD dwControl,
LPSERVICE_STATUS lpServiceStatus)
{
-#if 0
DWORD dwError;
- DPRINT1("ControlService(%x, %x, %p)\n",
- hService, dwControl, lpServiceStatus);
+ DPRINT("ControlService(%x, %x, %p)\n",
+ hService, dwControl, lpServiceStatus);
HandleBind();
lpServiceStatus);
if (dwError != ERROR_SUCCESS)
{
+ DPRINT1("ScmrControlService() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return FALSE;
}
+ DPRINT("ControlService() done\n");
+
return TRUE;
-#endif
+}
- DPRINT1("ControlService is unimplemented\n");
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
+
+/**********************************************************************
+ * 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
*
*
* @unimplemented
*/
-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 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 hService = NULL;
+ DWORD dwError;
+
+ DPRINT1("CreateServiceW() called\n");
+
+ 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,
+ NULL, /* FIXME: lpDependencies */
+ 0, /* FIXME: 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;
- DPRINT1("DeleteService(%x)\n", hService);
+ DPRINT("DeleteService(%x)\n", hService);
HandleBind();
(unsigned int)hService);
if (dwError != ERROR_SUCCESS)
{
+ DPRINT1("ScmrDeleteService() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return FALSE;
}
(unsigned int *)&hLock);
if (dwError != ERROR_SUCCESS)
{
- DPRINT("ScmrLockServiceDatabase() failed (Error %lu)\n", dwError);
+ DPRINT1("ScmrLockServiceDatabase() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return NULL;
}
(LPSTR)lpDatabaseName,
dwDesiredAccess,
(unsigned int*)&hScm);
- if (dwError)
+ if (dwError != ERROR_SUCCESS)
{
- DPRINT("ScmrOpenSCManagerA() failed (Error %lu)\n", dwError);
+ DPRINT1("ScmrOpenSCManagerA() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return NULL;
}
/**********************************************************************
* QueryServiceStatus
*
- * @unimplemented
+ * @implemented
*/
-BOOL
-STDCALL
-QueryServiceStatus(
- SC_HANDLE hService,
- LPSERVICE_STATUS lpServiceStatus)
+BOOL STDCALL
+QueryServiceStatus(SC_HANDLE hService,
+ LPSERVICE_STATUS lpServiceStatus)
{
- DPRINT1("QueryServiceStatus is unimplemented\n");
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ DWORD dwError;
+
+ DPRINT("QueryServiceStatus(%p, %p)\n",
+ hService, lpServiceStatus);
+
+ HandleBind();
+
+ /* Call to services.exe using RPC */
+ dwError = ScmrQueryServiceStatus(BindingHandle,
+ (unsigned int)hService,
+ lpServiceStatus);
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("ScmrQueryServiceStatus() failed (Error %lu)\n", dwError);
+ SetLastError(dwError);
return FALSE;
+ }
+
+ return TRUE;
}
}
-
-
/**********************************************************************
* StartServiceW
*
{
DWORD dwError;
+#if 0
DPRINT("UnlockServiceDatabase(%x)\n", hSCManager);
+#endif
HandleBind();
(unsigned int)ScLock);
if (dwError != ERROR_SUCCESS)
{
- DPRINT("ScmrUnlockServiceDatabase() failed (Error %lu)\n", dwError);
+ DPRINT1("ScmrUnlockServiceDatabase() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return FALSE;
}
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 */