Paul Vriens : advapi32/tests: Add tests for CloseServiceHandle.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jul 6 12:59:04 CDT 2007
Module: wine
Branch: master
Commit: db892decda732b2eb2272dda503ff81719de48f6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=db892decda732b2eb2272dda503ff81719de48f6
Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date: Thu Jul 5 21:22:06 2007 +0200
advapi32/tests: Add tests for CloseServiceHandle.
---
dlls/advapi32/tests/service.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c
index 3e66ff2..341423e 100644
--- a/dlls/advapi32/tests/service.c
+++ b/dlls/advapi32/tests/service.c
@@ -133,6 +133,33 @@ static void test_open_svc(void)
CloseServiceHandle(scm_handle);
}
+static void test_close(void)
+{
+ SC_HANDLE handle;
+ BOOL ret;
+
+ /* NULL handle */
+ SetLastError(0xdeadbeef);
+ ret = CloseServiceHandle(NULL);
+ todo_wine
+ {
+ ok(!ret, "Expected failure\n");
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+ }
+
+ /* TODO: Add some tests with invalid handles. These produce errors on Windows but crash on Wine */
+
+ /* Proper call */
+ handle = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT);
+ SetLastError(0xdeadbeef);
+ ret = CloseServiceHandle(handle);
+ ok(ret, "Expected success\n");
+ ok(GetLastError() == ERROR_IO_PENDING /* W2K */ ||
+ GetLastError() == ERROR_SUCCESS /* W2K3 */ ||
+ GetLastError() == 0xdeadbeef /* NT4, XP, Vista */,
+ "Expected ERROR_SUCCESS, ERROR_IO_PENDING or 0xdeadbeef, got %d\n", GetLastError());
+}
+
static void test_sequence(void)
{
SC_HANDLE scm_handle, svc_handle;
@@ -264,6 +291,7 @@ START_TEST(service)
/* First some parameter checking */
test_open_scm();
test_open_svc();
+ test_close();
/* Test the creation, querying and deletion of a service */
test_sequence();
}
More information about the wine-cvs
mailing list