Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6dde7648
Commit
6dde7648
authored
Jul 02, 2007
by
Paul Vriens
Committed by
Alexandre Julliard
Jul 02, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Add tests for OpenSCManagerA.
parent
973496d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
6 deletions
+74
-6
service.c
dlls/advapi32/tests/service.c
+74
-6
No files found.
dlls/advapi32/tests/service.c
View file @
6dde7648
...
...
@@ -27,6 +27,64 @@
#include "wine/test.h"
static
void
test_open_scm
(
void
)
{
SC_HANDLE
scm_handle
;
/* No access rights */
SetLastError
(
0xdeadbeef
);
scm_handle
=
OpenSCManagerA
(
NULL
,
NULL
,
0
);
ok
(
scm_handle
!=
NULL
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
/* W2K3, Vista */
||
GetLastError
()
==
0xdeadbeef
/* NT4, XP */
||
GetLastError
()
==
ERROR_IO_PENDING
/* W2K */
,
"Expected ERROR_SUCCESS, ERROR_IO_PENDING or 0xdeadbeef, got %d
\n
"
,
GetLastError
());
CloseServiceHandle
(
scm_handle
);
/* Unknown database name */
SetLastError
(
0xdeadbeef
);
scm_handle
=
OpenSCManagerA
(
NULL
,
"DoesNotExist"
,
SC_MANAGER_CONNECT
);
ok
(
!
scm_handle
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_NAME
,
"Expected ERROR_INVALID_NAME, got %d
\n
"
,
GetLastError
());
CloseServiceHandle
(
scm_handle
);
/* Just in case */
/* MSDN says only ServiceActive is allowed, or NULL */
SetLastError
(
0xdeadbeef
);
scm_handle
=
OpenSCManagerA
(
NULL
,
SERVICES_FAILED_DATABASEA
,
SC_MANAGER_CONNECT
);
ok
(
!
scm_handle
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_DATABASE_DOES_NOT_EXIST
,
"Expected ERROR_DATABASE_DOES_NOT_EXIST, got %d
\n
"
,
GetLastError
());
CloseServiceHandle
(
scm_handle
);
/* Just in case */
/* Remote unknown host */
SetLastError
(
0xdeadbeef
);
scm_handle
=
OpenSCManagerA
(
"DOESNOTEXIST"
,
SERVICES_ACTIVE_DATABASEA
,
SC_MANAGER_CONNECT
);
ok
(
!
scm_handle
,
"Expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
RPC_S_SERVER_UNAVAILABLE
,
"Expected RPC_S_SERVER_UNAVAILABLE, got %d
\n
"
,
GetLastError
());
CloseServiceHandle
(
scm_handle
);
/* Just in case */
/* Proper call with an empty hostname */
SetLastError
(
0xdeadbeef
);
scm_handle
=
OpenSCManagerA
(
""
,
SERVICES_ACTIVE_DATABASEA
,
SC_MANAGER_CONNECT
);
ok
(
scm_handle
!=
NULL
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
/* W2K3, Vista */
||
GetLastError
()
==
ERROR_ENVVAR_NOT_FOUND
/* NT4 */
||
GetLastError
()
==
0xdeadbeef
/* XP */
||
GetLastError
()
==
ERROR_IO_PENDING
/* W2K */
,
"Expected ERROR_SUCCESS, ERROR_IO_PENDING, ERROR_ENVVAR_NOT_FOUND or 0xdeadbeef, got %d
\n
"
,
GetLastError
());
CloseServiceHandle
(
scm_handle
);
/* Again a correct one */
SetLastError
(
0xdeadbeef
);
scm_handle
=
OpenSCManagerA
(
NULL
,
NULL
,
SC_MANAGER_CONNECT
);
ok
(
scm_handle
!=
NULL
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
/* W2K3, Vista */
||
GetLastError
()
==
0xdeadbeef
/* NT4, XP */
||
GetLastError
()
==
ERROR_IO_PENDING
/* W2K */
,
"Expected ERROR_SUCCESS, ERROR_IO_PENDING or 0xdeadbeef, got %d
\n
"
,
GetLastError
());
CloseServiceHandle
(
scm_handle
);
}
static
void
test_sequence
(
void
)
{
SC_HANDLE
scm_handle
,
svc_handle
;
...
...
@@ -44,12 +102,7 @@ static void test_sequence(void)
SetLastError
(
0xdeadbeef
);
scm_handle
=
OpenSCManagerA
(
NULL
,
NULL
,
GENERIC_ALL
);
if
(
!
scm_handle
&&
(
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
))
{
skip
(
"OpenSCManagerA is not implemented
\n
"
);
return
;
}
else
if
(
!
scm_handle
&&
(
GetLastError
()
==
ERROR_ACCESS_DENIED
))
if
(
!
scm_handle
&&
(
GetLastError
()
==
ERROR_ACCESS_DENIED
))
{
skip
(
"Not enough rights to get a handle to the manager
\n
"
);
return
;
...
...
@@ -147,6 +200,21 @@ static void test_sequence(void)
START_TEST
(
service
)
{
SC_HANDLE
scm_handle
;
/* Bail out if we are on win98 */
SetLastError
(
0xdeadbeef
);
scm_handle
=
OpenSCManagerA
(
NULL
,
NULL
,
GENERIC_ALL
);
if
(
!
scm_handle
&&
(
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
))
{
skip
(
"OpenSCManagerA is not implemented, we are most likely on win9x
\n
"
);
return
;
}
CloseServiceHandle
(
scm_handle
);
/* First some parameter checking */
test_open_scm
();
/* Test the creation, querying and deletion of a service */
test_sequence
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment