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
c011369a
Commit
c011369a
authored
Jul 11, 2007
by
Paul Vriens
Committed by
Alexandre Julliard
Jul 12, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi/service: Check if we have enough access rights to create a service.
parent
5dab8935
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
service.c
dlls/advapi32/service.c
+6
-0
service.c
dlls/advapi32/tests/service.c
+12
-5
No files found.
dlls/advapi32/service.c
View file @
c011369a
...
...
@@ -1315,6 +1315,12 @@ CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
return
NULL
;
}
if
(
!
(
hscm
->
dwAccess
&
SC_MANAGER_CREATE_SERVICE
))
{
SetLastError
(
ERROR_ACCESS_DENIED
);
return
NULL
;
}
r
=
RegCreateKeyExW
(
hscm
->
hkey
,
lpServiceName
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_ALL_ACCESS
,
NULL
,
&
hKey
,
&
dp
);
if
(
r
!=
ERROR_SUCCESS
)
...
...
dlls/advapi32/tests/service.c
View file @
c011369a
...
...
@@ -137,6 +137,7 @@ static void test_create_delete_svc(void)
SC_HANDLE
scm_handle
,
svc_handle1
;
static
const
CHAR
servicename
[]
=
"Winetest"
;
static
const
CHAR
pathname
[]
=
"we_dont_care.exe"
;
static
const
CHAR
empty
[]
=
""
;
/* All NULL */
SetLastError
(
0xdeadbeef
);
...
...
@@ -173,13 +174,19 @@ static void test_create_delete_svc(void)
/* Both servicename and binary name (We only have connect rights) */
SetLastError
(
0xdeadbeef
);
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
NULL
,
0
,
0
,
0
,
0
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
todo_wine
{
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %d
\n
"
,
GetLastError
());
DeleteService
(
svc_handle1
);
/* Wine doesn't care (yet) about access rights, line can be removed when fixed */
CloseServiceHandle
(
svc_handle1
);
/* Wine doesn't care (yet) about access rights, line can be removed when fixed */
}
/* They can even be empty at this stage of parameter checking */
SetLastError
(
0xdeadbeef
);
svc_handle1
=
CreateServiceA
(
scm_handle
,
empty
,
NULL
,
0
,
0
,
0
,
0
,
pathname
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
svc_handle1
=
CreateServiceA
(
scm_handle
,
servicename
,
NULL
,
0
,
0
,
0
,
0
,
empty
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
!
svc_handle1
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %d
\n
"
,
GetLastError
());
CloseServiceHandle
(
scm_handle
);
}
...
...
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