Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Mayr
wine
Commits
6dde7648
Commit
6dde7648
authored
17 years ago
by
Paul Vriens
Committed by
Alexandre Julliard
17 years ago
Browse files
Options
Downloads
Patches
Plain Diff
advapi32/tests: Add tests for OpenSCManagerA.
parent
973496d5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/advapi32/tests/service.c
+74
-6
74 additions, 6 deletions
dlls/advapi32/tests/service.c
with
74 additions
and
6 deletions
dlls/advapi32/tests/service.c
+
74
−
6
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
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment