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
9c2d8c73
Commit
9c2d8c73
authored
Jul 29, 2007
by
Paul Vriens
Committed by
Alexandre Julliard
Jul 30, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/service: Fix GetServiceDisplayNameA for service with no displayname.
parent
641e6452
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
10 deletions
+26
-10
service.c
dlls/advapi32/service.c
+26
-1
service.c
dlls/advapi32/tests/service.c
+0
-9
No files found.
dlls/advapi32/service.c
View file @
9c2d8c73
...
@@ -2353,7 +2353,32 @@ BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
...
@@ -2353,7 +2353,32 @@ BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
*
lpcchBuffer
=
(
size
/
sizeof
(
WCHAR
))
-
1
;
*
lpcchBuffer
=
(
size
/
sizeof
(
WCHAR
))
-
1
;
}
}
else
if
(
ret
==
ERROR_FILE_NOT_FOUND
)
else
if
(
ret
==
ERROR_FILE_NOT_FOUND
)
SetLastError
(
ERROR_SERVICE_DOES_NOT_EXIST
);
{
HKEY
hkey
;
if
(
!
RegOpenKeyW
(
hscm
->
hkey
,
lpServiceName
,
&
hkey
))
{
INT
len
=
lstrlenW
(
lpServiceName
);
BOOL
r
=
FALSE
;
if
((
*
lpcchBuffer
<=
len
)
||
(
!
lpDisplayName
&&
*
lpcchBuffer
))
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
else
if
(
lpDisplayName
&&
*
lpcchBuffer
)
{
/* No displayname, but the service exists and the buffer
* is big enough. We should return the servicename.
*/
lstrcpyW
(
lpDisplayName
,
lpServiceName
);
r
=
TRUE
;
}
*
lpcchBuffer
=
len
;
RegCloseKey
(
hkey
);
return
r
;
}
else
SetLastError
(
ERROR_SERVICE_DOES_NOT_EXIST
);
}
else
else
SetLastError
(
ret
);
SetLastError
(
ret
);
return
FALSE
;
return
FALSE
;
...
...
dlls/advapi32/tests/service.c
View file @
9c2d8c73
...
@@ -561,13 +561,10 @@ static void test_get_displayname(void)
...
@@ -561,13 +561,10 @@ static void test_get_displayname(void)
displaysize
=
-
1
;
displaysize
=
-
1
;
ret
=
GetServiceDisplayNameA
(
scm_handle
,
servicename
,
NULL
,
&
displaysize
);
ret
=
GetServiceDisplayNameA
(
scm_handle
,
servicename
,
NULL
,
&
displaysize
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ok
(
!
ret
,
"Expected failure
\n
"
);
todo_wine
{
ok
(
displaysize
==
lstrlen
(
servicename
)
*
2
,
ok
(
displaysize
==
lstrlen
(
servicename
)
*
2
,
"Expected the displaysize to be twice the size of the servicename
\n
"
);
"Expected the displaysize to be twice the size of the servicename
\n
"
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected ERROR_INSUFFICIENT_BUFFER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INSUFFICIENT_BUFFER, got %d
\n
"
,
GetLastError
());
}
/* Buffer is too small */
/* Buffer is too small */
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
...
@@ -575,18 +572,13 @@ static void test_get_displayname(void)
...
@@ -575,18 +572,13 @@ static void test_get_displayname(void)
displaysize
=
(
tempsize
/
2
);
displaysize
=
(
tempsize
/
2
);
ret
=
GetServiceDisplayNameA
(
scm_handle
,
servicename
,
displayname
,
&
displaysize
);
ret
=
GetServiceDisplayNameA
(
scm_handle
,
servicename
,
displayname
,
&
displaysize
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ok
(
!
ret
,
"Expected failure
\n
"
);
todo_wine
{
ok
(
displaysize
==
tempsize
,
"Expected the needed buffersize
\n
"
);
ok
(
displaysize
==
tempsize
,
"Expected the needed buffersize
\n
"
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected ERROR_INSUFFICIENT_BUFFER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INSUFFICIENT_BUFFER, got %d
\n
"
,
GetLastError
());
}
/* Get the displayname */
/* Get the displayname */
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
GetServiceDisplayNameA
(
scm_handle
,
servicename
,
displayname
,
&
displaysize
);
ret
=
GetServiceDisplayNameA
(
scm_handle
,
servicename
,
displayname
,
&
displaysize
);
todo_wine
{
ok
(
ret
,
"Expected success
\n
"
);
ok
(
ret
,
"Expected success
\n
"
);
ok
(
!
lstrcmpi
(
displayname
,
servicename
),
ok
(
!
lstrcmpi
(
displayname
,
servicename
),
"Expected displayname to be %s, got %s
\n
"
,
servicename
,
displayname
);
"Expected displayname to be %s, got %s
\n
"
,
servicename
,
displayname
);
...
@@ -594,7 +586,6 @@ static void test_get_displayname(void)
...
@@ -594,7 +586,6 @@ static void test_get_displayname(void)
GetLastError
()
==
ERROR_IO_PENDING
/* W2K */
||
GetLastError
()
==
ERROR_IO_PENDING
/* W2K */
||
GetLastError
()
==
0xdeadbeef
/* NT4, XP, Vista */
,
GetLastError
()
==
0xdeadbeef
/* NT4, XP, Vista */
,
"Expected ERROR_SUCCESS, ERROR_IO_PENDING or 0xdeadbeef, got %d
\n
"
,
GetLastError
());
"Expected ERROR_SUCCESS, ERROR_IO_PENDING or 0xdeadbeef, got %d
\n
"
,
GetLastError
());
}
/* Delete the service */
/* Delete the service */
ret
=
DeleteService
(
svc_handle
);
ret
=
DeleteService
(
svc_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