[1/2] services/tests: Add test for database locking.
Sebastian Lackner
sebastian at fds-team.de
Fri Mar 10 07:40:29 CST 2017
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---
Since Windows Vista, those functions are no-ops.
programs/services/tests/service.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/programs/services/tests/service.c b/programs/services/tests/service.c
index 98419497a5a..8ca25ad890b 100644
--- a/programs/services/tests/service.c
+++ b/programs/services/tests/service.c
@@ -396,16 +396,29 @@ static void test_service(void)
SC_HANDLE service_handle = register_service("simple_service");
SERVICE_STATUS_PROCESS status2;
SERVICE_STATUS status;
+ BOOL res, res2;
+ SC_LOCK lock;
DWORD bytes;
- BOOL res;
if(!service_handle)
return;
- trace("starting...\n");
+ lock = LockServiceDatabase(scm_handle);
+ ok(lock != NULL, "LockServiceDatabase failed: %u\n", GetLastError());
res = StartServiceA(service_handle, 2, argv);
- ok(res, "StartService failed: %u\n", GetLastError());
- if(!res) {
+todo_wine
+ ok(res || broken(!res && GetLastError() == ERROR_SERVICE_DATABASE_LOCKED) /* < Vista */,
+ "StartService failed: %u\n", GetLastError());
+ res2 = UnlockServiceDatabase(lock);
+ ok(res2, "UnlockServiceDatabase failed: %u\n", GetLastError());
+
+ if (!res)
+ {
+ res = StartServiceA(service_handle, 2, argv);
+ ok(res, "StartService failed: %u\n", GetLastError());
+ }
+ if (!res)
+ {
DeleteService(service_handle);
CloseServiceHandle(service_handle);
return;
@@ -454,7 +467,6 @@ static inline void test_no_stop(void)
if(!service_handle)
return;
- trace("starting...\n");
res = StartServiceA(service_handle, 0, NULL);
ok(res, "StartService failed: %u\n", GetLastError());
if(!res) {
--
2.11.0
More information about the wine-patches
mailing list