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
2a8043aa
Commit
2a8043aa
authored
Dec 02, 2014
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 02, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Properly handle service control events in Start/StopService.
parent
f103247d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
24 deletions
+45
-24
action.c
dlls/msi/action.c
+15
-18
action.c
dlls/msi/tests/action.c
+30
-6
No files found.
dlls/msi/action.c
View file @
2a8043aa
...
@@ -5952,24 +5952,21 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param)
...
@@ -5952,24 +5952,21 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param)
if
(
!
comp
)
if
(
!
comp
)
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
event
=
MSI_RecordGetInteger
(
rec
,
3
);
deformat_string
(
package
,
MSI_RecordGetString
(
rec
,
2
),
&
name
);
comp
->
Action
=
msi_get_component_action
(
package
,
comp
);
comp
->
Action
=
msi_get_component_action
(
package
,
comp
);
if
(
comp
->
Action
!=
INSTALLSTATE_LOCAL
)
if
(
!
(
comp
->
Action
==
INSTALLSTATE_LOCAL
&&
(
event
&
msidbServiceControlEventStart
))
&&
!
(
comp
->
Action
==
INSTALLSTATE_ABSENT
&&
(
event
&
msidbServiceControlEventUninstallStart
)))
{
{
TRACE
(
"component not scheduled for installation %s
\n
"
,
debugstr_w
(
component
));
TRACE
(
"not starting %s
\n
"
,
debugstr_w
(
name
));
msi_free
(
name
);
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
}
}
deformat_string
(
package
,
MSI_RecordGetString
(
rec
,
2
),
&
name
);
deformat_string
(
package
,
MSI_RecordGetString
(
rec
,
4
),
&
args
);
deformat_string
(
package
,
MSI_RecordGetString
(
rec
,
4
),
&
args
);
event
=
MSI_RecordGetInteger
(
rec
,
3
);
wait
=
MSI_RecordGetInteger
(
rec
,
5
);
wait
=
MSI_RecordGetInteger
(
rec
,
5
);
if
(
!
(
event
&
msidbServiceControlEventStart
))
{
r
=
ERROR_SUCCESS
;
goto
done
;
}
scm
=
OpenSCManagerW
(
NULL
,
NULL
,
SC_MANAGER_CONNECT
);
scm
=
OpenSCManagerW
(
NULL
,
NULL
,
SC_MANAGER_CONNECT
);
if
(
!
scm
)
if
(
!
scm
)
{
{
...
@@ -6159,23 +6156,24 @@ static UINT ITERATE_StopService( MSIRECORD *rec, LPVOID param )
...
@@ -6159,23 +6156,24 @@ static UINT ITERATE_StopService( MSIRECORD *rec, LPVOID param )
MSICOMPONENT
*
comp
;
MSICOMPONENT
*
comp
;
MSIRECORD
*
uirow
;
MSIRECORD
*
uirow
;
LPCWSTR
component
;
LPCWSTR
component
;
LPWSTR
name
=
NULL
,
display_name
=
NULL
;
WCHAR
*
name
,
*
display_name
=
NULL
;
DWORD
event
,
len
;
DWORD
event
,
len
;
SC_HANDLE
scm
;
SC_HANDLE
scm
;
event
=
MSI_RecordGetInteger
(
rec
,
3
);
if
(
!
(
event
&
msidbServiceControlEventStop
))
return
ERROR_SUCCESS
;
component
=
MSI_RecordGetString
(
rec
,
6
);
component
=
MSI_RecordGetString
(
rec
,
6
);
comp
=
msi_get_loaded_component
(
package
,
component
);
comp
=
msi_get_loaded_component
(
package
,
component
);
if
(
!
comp
)
if
(
!
comp
)
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
event
=
MSI_RecordGetInteger
(
rec
,
3
);
deformat_string
(
package
,
MSI_RecordGetString
(
rec
,
2
),
&
name
);
comp
->
Action
=
msi_get_component_action
(
package
,
comp
);
comp
->
Action
=
msi_get_component_action
(
package
,
comp
);
if
(
comp
->
Action
!=
INSTALLSTATE_ABSENT
)
if
(
!
(
comp
->
Action
==
INSTALLSTATE_LOCAL
&&
(
event
&
msidbServiceControlEventStop
))
&&
!
(
comp
->
Action
==
INSTALLSTATE_ABSENT
&&
(
event
&
msidbServiceControlEventUninstallStop
)))
{
{
TRACE
(
"component not scheduled for removal %s
\n
"
,
debugstr_w
(
component
));
TRACE
(
"not stopping %s
\n
"
,
debugstr_w
(
name
));
msi_free
(
name
);
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
}
}
...
@@ -6195,7 +6193,6 @@ static UINT ITERATE_StopService( MSIRECORD *rec, LPVOID param )
...
@@ -6195,7 +6193,6 @@ static UINT ITERATE_StopService( MSIRECORD *rec, LPVOID param )
}
}
CloseServiceHandle
(
scm
);
CloseServiceHandle
(
scm
);
deformat_string
(
package
,
MSI_RecordGetString
(
rec
,
2
),
&
name
);
stop_service
(
name
);
stop_service
(
name
);
done:
done:
...
...
dlls/msi/tests/action.c
View file @
2a8043aa
...
@@ -247,7 +247,10 @@ static const char sss_service_control_dat[] =
...
@@ -247,7 +247,10 @@ static const char sss_service_control_dat[] =
"ServiceControl
\t
Name
\t
Event
\t
Arguments
\t
Wait
\t
Component_
\n
"
"ServiceControl
\t
Name
\t
Event
\t
Arguments
\t
Wait
\t
Component_
\n
"
"s72
\t
l255
\t
i2
\t
L255
\t
I2
\t
s72
\n
"
"s72
\t
l255
\t
i2
\t
L255
\t
I2
\t
s72
\n
"
"ServiceControl
\t
ServiceControl
\n
"
"ServiceControl
\t
ServiceControl
\n
"
"ServiceControl
\t
Spooler
\t
1
\t\t
0
\t
service_comp"
;
"ServiceControl
\t
Spooler
\t
1
\t\t
1
\t
service_comp
\n
"
"ServiceControl2
\t
Spooler
\t
2
\t\t
1
\t
service_comp
\n
"
"ServiceControl3
\t
Spooler
\t
16
\t\t
1
\t
service_comp
\n
"
"ServiceControl4
\t
Spooler
\t
32
\t\t
1
\t
service_comp
\n
"
;
static
const
char
sss_install_exec_seq_dat
[]
=
static
const
char
sss_install_exec_seq_dat
[]
=
"Action
\t
Condition
\t
Sequence
\n
"
"Action
\t
Condition
\t
Sequence
\n
"
...
@@ -260,11 +263,15 @@ static const char sss_install_exec_seq_dat[] =
...
@@ -260,11 +263,15 @@ static const char sss_install_exec_seq_dat[] =
"CostFinalize
\t\t
1000
\n
"
"CostFinalize
\t\t
1000
\n
"
"InstallValidate
\t\t
1400
\n
"
"InstallValidate
\t\t
1400
\n
"
"InstallInitialize
\t\t
1500
\n
"
"InstallInitialize
\t\t
1500
\n
"
"StopServices
\t\t
4000
\n
"
"DeleteServices
\t\t
5000
\n
"
"DeleteServices
\t\t
5000
\n
"
"MoveFiles
\t\t
5100
\n
"
"MoveFiles
\t\t
5100
\n
"
"InstallFiles
\t\t
5200
\n
"
"InstallFiles
\t\t
5200
\n
"
"DuplicateFiles
\t\t
5300
\n
"
"DuplicateFiles
\t\t
5300
\n
"
"StartServices
\t\t
5400
\n
"
"StartServices
\t\t
5400
\n
"
"RegisterProduct
\t\t
5500
\n
"
"PublishFeatures
\t\t
5600
\n
"
"PublishProduct
\t\t
5700
\n
"
"InstallFinalize
\t\t
6000
\n
"
;
"InstallFinalize
\t\t
6000
\n
"
;
static
const
char
sds_install_exec_seq_dat
[]
=
static
const
char
sds_install_exec_seq_dat
[]
=
...
@@ -5310,7 +5317,7 @@ error:
...
@@ -5310,7 +5317,7 @@ error:
DeleteFileA
(
msifile
);
DeleteFileA
(
msifile
);
}
}
static
void
test_start_services
(
void
)
static
void
test_start_s
top_s
ervices
(
void
)
{
{
UINT
r
;
UINT
r
;
SC_HANDLE
scm
,
service
;
SC_HANDLE
scm
,
service
;
...
@@ -5359,6 +5366,23 @@ static void test_start_services(void)
...
@@ -5359,6 +5366,23 @@ static void test_start_services(void)
r
=
MsiInstallProductA
(
msifile
,
NULL
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
if
(
error
==
ERROR_SUCCESS
)
{
SERVICE_STATUS
status
;
scm
=
OpenSCManagerA
(
NULL
,
NULL
,
SC_MANAGER_ALL_ACCESS
);
service
=
OpenServiceA
(
scm
,
"Spooler"
,
SC_MANAGER_ALL_ACCESS
);
ret
=
ControlService
(
service
,
SERVICE_CONTROL_STOP
,
&
status
);
ok
(
ret
,
"ControlService failed %u
\n
"
,
GetLastError
());
CloseServiceHandle
(
service
);
CloseServiceHandle
(
scm
);
}
r
=
MsiInstallProductA
(
msifile
,
"REMOVE=ALL"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
delete_pf
(
"msitest
\\
cabout
\\
new
\\
five.txt"
,
TRUE
),
"File not installed
\n
"
);
ok
(
delete_pf
(
"msitest
\\
cabout
\\
new
\\
five.txt"
,
TRUE
),
"File not installed
\n
"
);
ok
(
delete_pf
(
"msitest
\\
cabout
\\
new"
,
FALSE
),
"Directory not created
\n
"
);
ok
(
delete_pf
(
"msitest
\\
cabout
\\
new"
,
FALSE
),
"Directory not created
\n
"
);
ok
(
delete_pf
(
"msitest
\\
cabout
\\
four.txt"
,
TRUE
),
"File not installed
\n
"
);
ok
(
delete_pf
(
"msitest
\\
cabout
\\
four.txt"
,
TRUE
),
"File not installed
\n
"
);
...
@@ -5373,9 +5397,6 @@ static void test_start_services(void)
...
@@ -5373,9 +5397,6 @@ static void test_start_services(void)
ok
(
delete_pf
(
"msitest
\\
service2.exe"
,
TRUE
),
"File not installed
\n
"
);
ok
(
delete_pf
(
"msitest
\\
service2.exe"
,
TRUE
),
"File not installed
\n
"
);
ok
(
delete_pf
(
"msitest"
,
FALSE
),
"Directory not created
\n
"
);
ok
(
delete_pf
(
"msitest"
,
FALSE
),
"Directory not created
\n
"
);
delete_test_files
();
DeleteFileA
(
msifile
);
if
(
error
==
ERROR_SUCCESS
)
if
(
error
==
ERROR_SUCCESS
)
{
{
SERVICE_STATUS
status
;
SERVICE_STATUS
status
;
...
@@ -5389,6 +5410,9 @@ static void test_start_services(void)
...
@@ -5389,6 +5410,9 @@ static void test_start_services(void)
CloseServiceHandle
(
service
);
CloseServiceHandle
(
service
);
CloseServiceHandle
(
scm
);
CloseServiceHandle
(
scm
);
}
}
delete_test_files
();
DeleteFileA
(
msifile
);
}
}
static
void
test_delete_services
(
void
)
static
void
test_delete_services
(
void
)
...
@@ -6869,7 +6893,7 @@ START_TEST(action)
...
@@ -6869,7 +6893,7 @@ START_TEST(action)
test_write_registry_values
();
test_write_registry_values
();
test_envvar
();
test_envvar
();
test_create_remove_folder
();
test_create_remove_folder
();
test_start_services
();
test_start_s
top_s
ervices
();
test_delete_services
();
test_delete_services
();
test_install_services
();
test_install_services
();
test_self_registration
();
test_self_registration
();
...
...
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