Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a80e952a
Commit
a80e952a
authored
Jul 18, 2007
by
Paul Vriens
Committed by
Alexandre Julliard
Jul 19, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/service: Cleanup (long lines and a typo).
parent
4fdf90d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
service.c
dlls/advapi32/tests/service.c
+27
-15
No files found.
dlls/advapi32/tests/service.c
View file @
a80e952a
...
@@ -203,7 +203,9 @@ static void test_create_delete_svc(void)
...
@@ -203,7 +203,9 @@ static void test_create_delete_svc(void)
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %d
\n
"
,
GetLastError
());
/* Open the Service Control Manager with minimal rights for creation (verified with 'SC_MANAGER_ALL_ACCESS &~ SC_MANAGER_CREATE_SERVICE') */
/* Open the Service Control Manager with minimal rights for creation
* (Verified with 'SC_MANAGER_ALL_ACCESS &~ SC_MANAGER_CREATE_SERVICE')
*/
CloseServiceHandle
(
scm_handle
);
CloseServiceHandle
(
scm_handle
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
scm_handle
=
OpenSCManagerA
(
NULL
,
NULL
,
SC_MANAGER_CREATE_SERVICE
);
scm_handle
=
OpenSCManagerA
(
NULL
,
NULL
,
SC_MANAGER_CREATE_SERVICE
);
...
@@ -231,15 +233,20 @@ static void test_create_delete_svc(void)
...
@@ -231,15 +233,20 @@ static void test_create_delete_svc(void)
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_NAME
,
"Expected ERROR_INVALID_NAME, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_NAME
,
"Expected ERROR_INVALID_NAME, got %d
\n
"
,
GetLastError
());
/* Valid call (as we will see later) except for the empty binary name (to proof it's indeed an ERROR_INVALID_PARAMETER */
/* Valid call (as we will see later) except for the empty binary name (to proof it's indeed
* an ERROR_INVALID_PARAMETER)
*/
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
NULL
,
0
,
SERVICE_WIN32_OWN_PROCESS
,
SERVICE_DISABLED
,
0
,
empty
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
NULL
,
0
,
SERVICE_WIN32_OWN_PROCESS
,
SERVICE_DISABLED
,
0
,
empty
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
/* Windows checks if the 'service type', 'access type' and the combination of them are valid, so let's test that */
/* Windows checks if the 'service type', 'access type' and the combination of them are valid, so let's test that */
/* Illegal (service-type, which is used as a mask can't have a mix. Except the one with SERVICE_INTERACTIVE_PROCESS which is tested below) */
/* Illegal (service-type, which is used as a mask can't have a mix. Except the one with
* SERVICE_INTERACTIVE_PROCESS which will be tested below in a valid call)
*/
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
NULL
,
GENERIC_ALL
,
SERVICE_WIN32_OWN_PROCESS
|
SERVICE_WIN32_SHARE_PROCESS
,
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
NULL
,
GENERIC_ALL
,
SERVICE_WIN32_OWN_PROCESS
|
SERVICE_WIN32_SHARE_PROCESS
,
SERVICE_DISABLED
,
0
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
SERVICE_DISABLED
,
0
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
...
@@ -263,17 +270,19 @@ static void test_create_delete_svc(void)
...
@@ -263,17 +270,19 @@ static void test_create_delete_svc(void)
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
/* Illegal (start-type is not a mask and should only be one of the possibilities)
/* Illegal (start-type is not a mask and should only be one of the possibilities)
* Remark : 'OR'-ing them could result in a valid possibility (but doesn't make sense as it's most likely not the wanted start-type)
* Remark : 'OR'-ing them could result in a valid possibility (but doesn't make sense as
* it's most likely not the wanted start-type)
*/
*/
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
NULL
,
GENERIC_ALL
,
SERVICE_WIN32_OWN_PROCESS
,
SERVICE_AUTO_START
|
SERVICE_DISABLED
,
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
NULL
,
GENERIC_ALL
,
SERVICE_WIN32_OWN_PROCESS
,
0
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
SERVICE_AUTO_START
|
SERVICE_DISABLED
,
0
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
/* Illegal (SERVICE_BOOT_START and SERVICE_SYSTEM_START
or
only allowed for driver services) */
/* Illegal (SERVICE_BOOT_START and SERVICE_SYSTEM_START
are
only allowed for driver services) */
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
NULL
,
0
,
SERVICE_WIN32_OWN_PROCESS
,
SERVICE_BOOT_START
,
0
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
NULL
,
0
,
SERVICE_WIN32_OWN_PROCESS
,
SERVICE_BOOT_START
,
0
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
...
@@ -284,15 +293,17 @@ static void test_create_delete_svc(void)
...
@@ -284,15 +293,17 @@ static void test_create_delete_svc(void)
spooler_exists
=
TRUE
;
spooler_exists
=
TRUE
;
CloseServiceHandle
(
svc_handle1
);
CloseServiceHandle
(
svc_handle1
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
svc_handle1
=
CreateServiceA
(
scm_handle
,
spooler
,
NULL
,
0
,
SERVICE_WIN32_OWN_PROCESS
,
SERVICE_DISABLED
,
0
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
svc_handle1
=
CreateServiceA
(
scm_handle
,
spooler
,
NULL
,
0
,
SERVICE_WIN32_OWN_PROCESS
,
SERVICE_DISABLED
,
0
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_SERVICE_EXISTS
,
"Expected ERROR_SERVICE_EXISTS, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SERVICE_EXISTS
,
"Expected ERROR_SERVICE_EXISTS, got %d
\n
"
,
GetLastError
());
}
}
else
else
skip
(
"Spooler service doesn't exist
\n
"
);
skip
(
"Spooler service doesn't exist
\n
"
);
/* To find an existing displayname we check the 'Spooler' service. Although the registry doesn't show DisplayName on NT4, this call
/* To find an existing displayname we check the 'Spooler' service. Although the registry
* will return a displayname which is equal to the servicename and can't be used as well for a new displayname.
* doesn't show DisplayName on NT4, this call will return a displayname which is equal
* to the servicename and can't be used as well for a new displayname.
*/
*/
if
(
spooler_exists
)
if
(
spooler_exists
)
{
{
...
@@ -302,12 +313,13 @@ static void test_create_delete_svc(void)
...
@@ -302,12 +313,13 @@ static void test_create_delete_svc(void)
skip
(
"Could not retrieve a displayname for the Spooler service
\n
"
);
skip
(
"Could not retrieve a displayname for the Spooler service
\n
"
);
else
else
{
{
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
display
,
0
,
SERVICE_WIN32_OWN_PROCESS
,
SERVICE_DISABLED
,
0
,
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
display
,
0
,
SERVICE_WIN32_OWN_PROCESS
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
SERVICE_DISABLED
,
0
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
todo_wine
todo_wine
{
{
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_DUPLICATE_SERVICE_NAME
,
"Expected ERROR_DUPLICATE_SERVICE_NAME, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_DUPLICATE_SERVICE_NAME
,
"Expected ERROR_DUPLICATE_SERVICE_NAME, got %d
\n
"
,
GetLastError
());
}
}
}
}
}
}
...
...
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