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
de7220e2
Commit
de7220e2
authored
Oct 11, 2017
by
Bernhard Übelacker
Committed by
Alexandre Julliard
Oct 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Fix ChangeServiceConfig2 when given a null description.
Signed-off-by:
Bernhard Übelacker
<
bernhardu@mailbox.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
825f3932
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
0 deletions
+69
-0
service.c
dlls/advapi32/tests/service.c
+66
-0
rpc.c
programs/services/rpc.c
+3
-0
No files found.
dlls/advapi32/tests/service.c
View file @
de7220e2
...
@@ -36,6 +36,7 @@ static const CHAR spooler[] = "Spooler"; /* Should be available on all platforms
...
@@ -36,6 +36,7 @@ static const CHAR spooler[] = "Spooler"; /* Should be available on all platforms
static
CHAR
selfname
[
MAX_PATH
];
static
CHAR
selfname
[
MAX_PATH
];
static
BOOL
(
WINAPI
*
pChangeServiceConfig2A
)(
SC_HANDLE
,
DWORD
,
LPVOID
);
static
BOOL
(
WINAPI
*
pChangeServiceConfig2A
)(
SC_HANDLE
,
DWORD
,
LPVOID
);
static
BOOL
(
WINAPI
*
pChangeServiceConfig2W
)(
SC_HANDLE
,
DWORD
,
LPVOID
);
static
BOOL
(
WINAPI
*
pEnumServicesStatusExA
)(
SC_HANDLE
,
SC_ENUM_TYPE
,
DWORD
,
static
BOOL
(
WINAPI
*
pEnumServicesStatusExA
)(
SC_HANDLE
,
SC_ENUM_TYPE
,
DWORD
,
DWORD
,
LPBYTE
,
DWORD
,
LPDWORD
,
DWORD
,
LPBYTE
,
DWORD
,
LPDWORD
,
LPDWORD
,
LPDWORD
,
LPCSTR
);
LPDWORD
,
LPDWORD
,
LPCSTR
);
...
@@ -57,6 +58,7 @@ static void init_function_pointers(void)
...
@@ -57,6 +58,7 @@ static void init_function_pointers(void)
HMODULE
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
HMODULE
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
pChangeServiceConfig2A
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"ChangeServiceConfig2A"
);
pChangeServiceConfig2A
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"ChangeServiceConfig2A"
);
pChangeServiceConfig2W
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"ChangeServiceConfig2W"
);
pEnumServicesStatusExA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"EnumServicesStatusExA"
);
pEnumServicesStatusExA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"EnumServicesStatusExA"
);
pEnumServicesStatusExW
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"EnumServicesStatusExW"
);
pEnumServicesStatusExW
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"EnumServicesStatusExW"
);
pGetSecurityInfo
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"GetSecurityInfo"
);
pGetSecurityInfo
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"GetSecurityInfo"
);
...
@@ -1954,6 +1956,7 @@ static void test_queryconfig2(void)
...
@@ -1954,6 +1956,7 @@ static void test_queryconfig2(void)
DWORD
expected
,
needed
;
DWORD
expected
,
needed
;
BYTE
buffer
[
MAX_PATH
];
BYTE
buffer
[
MAX_PATH
];
LPSERVICE_DESCRIPTIONA
pConfig
=
(
LPSERVICE_DESCRIPTIONA
)
buffer
;
LPSERVICE_DESCRIPTIONA
pConfig
=
(
LPSERVICE_DESCRIPTIONA
)
buffer
;
LPSERVICE_DESCRIPTIONW
pConfigW
=
(
LPSERVICE_DESCRIPTIONW
)
buffer
;
SERVICE_PRESHUTDOWN_INFO
preshutdown_info
;
SERVICE_PRESHUTDOWN_INFO
preshutdown_info
;
static
const
CHAR
servicename
[]
=
"Winetest"
;
static
const
CHAR
servicename
[]
=
"Winetest"
;
static
const
CHAR
displayname
[]
=
"Winetest dummy service"
;
static
const
CHAR
displayname
[]
=
"Winetest dummy service"
;
...
@@ -1961,6 +1964,9 @@ static void test_queryconfig2(void)
...
@@ -1961,6 +1964,9 @@ static void test_queryconfig2(void)
static
const
CHAR
dependencies
[]
=
"Master1
\0
Master2
\0
+MasterGroup1
\0
"
;
static
const
CHAR
dependencies
[]
=
"Master1
\0
Master2
\0
+MasterGroup1
\0
"
;
static
const
CHAR
password
[]
=
""
;
static
const
CHAR
password
[]
=
""
;
static
const
CHAR
description
[]
=
"Description"
;
static
const
CHAR
description
[]
=
"Description"
;
static
const
CHAR
description_empty
[]
=
""
;
static
const
WCHAR
descriptionW
[]
=
{
'D'
,
'e'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
'W'
,
0
};
static
const
WCHAR
descriptionW_empty
[]
=
{
0
};
if
(
!
pQueryServiceConfig2A
)
if
(
!
pQueryServiceConfig2A
)
{
{
...
@@ -2121,6 +2127,66 @@ static void test_queryconfig2(void)
...
@@ -2121,6 +2127,66 @@ static void test_queryconfig2(void)
ret
=
pQueryServiceConfig2W
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
buffer
,
needed
,
&
needed
);
ret
=
pQueryServiceConfig2W
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
buffer
,
needed
,
&
needed
);
ok
(
ret
,
"expected QueryServiceConfig2W to succeed
\n
"
);
ok
(
ret
,
"expected QueryServiceConfig2W to succeed
\n
"
);
pConfig
->
lpDescription
=
(
LPSTR
)
description
;
ret
=
pChangeServiceConfig2A
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
&
buffer
);
ok
(
ret
,
"expected ChangeServiceConfig2A to succeed
\n
"
);
pConfig
->
lpDescription
=
NULL
;
ret
=
pQueryServiceConfig2A
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
buffer
,
sizeof
(
buffer
),
&
needed
);
ok
(
ret
,
"expected QueryServiceConfig2A to succeed
\n
"
);
ok
(
pConfig
->
lpDescription
&&
!
strcmp
(
description
,
pConfig
->
lpDescription
),
"expected lpDescription to be %s, got %s
\n
"
,
description
,
pConfig
->
lpDescription
);
pConfig
->
lpDescription
=
NULL
;
ret
=
pChangeServiceConfig2A
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
&
buffer
);
ok
(
ret
,
"expected ChangeServiceConfig2A to succeed
\n
"
);
pConfig
->
lpDescription
=
NULL
;
ret
=
pQueryServiceConfig2A
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
buffer
,
sizeof
(
buffer
),
&
needed
);
ok
(
ret
,
"expected QueryServiceConfig2A to succeed
\n
"
);
ok
(
pConfig
->
lpDescription
&&
!
strcmp
(
description
,
pConfig
->
lpDescription
),
"expected lpDescription to be %s, got %s
\n
"
,
description
,
pConfig
->
lpDescription
);
pConfig
->
lpDescription
=
(
LPSTR
)
description_empty
;
ret
=
pChangeServiceConfig2A
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
&
buffer
);
ok
(
ret
,
"expected ChangeServiceConfig2A to succeed
\n
"
);
pConfig
->
lpDescription
=
(
void
*
)
0xdeadbeef
;
ret
=
pQueryServiceConfig2A
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
buffer
,
sizeof
(
buffer
),
&
needed
);
ok
(
ret
,
"expected QueryServiceConfig2A to succeed
\n
"
);
ok
(
!
pConfig
->
lpDescription
,
"expected lpDescription to be null, got %s
\n
"
,
pConfig
->
lpDescription
);
pConfigW
->
lpDescription
=
(
LPWSTR
)
descriptionW
;
ret
=
pChangeServiceConfig2W
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
&
buffer
);
ok
(
ret
,
"expected ChangeServiceConfig2W to succeed
\n
"
);
pConfigW
->
lpDescription
=
NULL
;
ret
=
pQueryServiceConfig2W
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
buffer
,
sizeof
(
buffer
),
&
needed
);
ok
(
ret
,
"expected QueryServiceConfig2A to succeed
\n
"
);
ok
(
pConfigW
->
lpDescription
&&
!
lstrcmpW
(
descriptionW
,
pConfigW
->
lpDescription
),
"expected lpDescription to be %s, got %s
\n
"
,
wine_dbgstr_w
(
descriptionW
),
wine_dbgstr_w
(
pConfigW
->
lpDescription
));
pConfigW
->
lpDescription
=
NULL
;
ret
=
pChangeServiceConfig2W
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
&
buffer
);
ok
(
ret
,
"expected ChangeServiceConfig2W to succeed
\n
"
);
pConfigW
->
lpDescription
=
NULL
;
ret
=
pQueryServiceConfig2W
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
buffer
,
sizeof
(
buffer
),
&
needed
);
ok
(
ret
,
"expected QueryServiceConfig2A to succeed
\n
"
);
ok
(
pConfigW
->
lpDescription
&&
!
lstrcmpW
(
descriptionW
,
pConfigW
->
lpDescription
),
"expected lpDescription to be %s, got %s
\n
"
,
wine_dbgstr_w
(
descriptionW
),
wine_dbgstr_w
(
pConfigW
->
lpDescription
));
pConfigW
->
lpDescription
=
(
LPWSTR
)
descriptionW_empty
;
ret
=
pChangeServiceConfig2W
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
&
buffer
);
ok
(
ret
,
"expected ChangeServiceConfig2W to succeed
\n
"
);
pConfigW
->
lpDescription
=
(
void
*
)
0xdeadbeef
;
ret
=
pQueryServiceConfig2W
(
svc_handle
,
SERVICE_CONFIG_DESCRIPTION
,
buffer
,
sizeof
(
buffer
),
&
needed
);
ok
(
ret
,
"expected QueryServiceConfig2A to succeed
\n
"
);
ok
(
!
pConfigW
->
lpDescription
,
"expected lpDescription to be null, got %s
\n
"
,
wine_dbgstr_w
(
pConfigW
->
lpDescription
));
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
pQueryServiceConfig2W
(
svc_handle
,
SERVICE_CONFIG_PRESHUTDOWN_INFO
,
ret
=
pQueryServiceConfig2W
(
svc_handle
,
SERVICE_CONFIG_PRESHUTDOWN_INFO
,
(
LPBYTE
)
&
preshutdown_info
,
sizeof
(
preshutdown_info
),
&
needed
);
(
LPBYTE
)
&
preshutdown_info
,
sizeof
(
preshutdown_info
),
&
needed
);
...
...
programs/services/rpc.c
View file @
de7220e2
...
@@ -826,6 +826,9 @@ DWORD __cdecl svcctl_ChangeServiceConfig2W( SC_RPC_HANDLE hService, SC_RPC_CONFI
...
@@ -826,6 +826,9 @@ DWORD __cdecl svcctl_ChangeServiceConfig2W( SC_RPC_HANDLE hService, SC_RPC_CONFI
{
{
WCHAR
*
descr
=
NULL
;
WCHAR
*
descr
=
NULL
;
if
(
!
config
.
u
.
descr
->
lpDescription
)
break
;
if
(
config
.
u
.
descr
->
lpDescription
[
0
])
if
(
config
.
u
.
descr
->
lpDescription
[
0
])
{
{
if
(
!
(
descr
=
strdupW
(
config
.
u
.
descr
->
lpDescription
)))
if
(
!
(
descr
=
strdupW
(
config
.
u
.
descr
->
lpDescription
)))
...
...
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