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
880ef2bb
Commit
880ef2bb
authored
Jun 07, 2011
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Factor out common code to execute custom action commands.
parent
219a8302
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
151 deletions
+50
-151
custom.c
dlls/msi/custom.c
+50
-151
No files found.
dlls/msi/custom.c
View file @
880ef2bb
...
...
@@ -972,55 +972,39 @@ static UINT HANDLE_CustomType1(MSIPACKAGE *package, LPCWSTR source,
return
r
;
}
static
UINT
HANDLE_CustomType2
(
MSIPACKAGE
*
package
,
LPCWSTR
source
,
LPCWSTR
target
,
const
INT
type
,
LPCWSTR
action
)
static
HANDLE
execute_command
(
const
WCHAR
*
exe
,
WCHAR
*
arg
,
const
WCHAR
*
dir
)
{
STARTUPINFOW
si
;
PROCESS_INFORMATION
info
;
BOOL
rc
;
INT
len
;
WCHAR
*
deformated
=
NULL
;
WCHAR
*
cmd
;
static
const
WCHAR
spc
[]
=
{
' '
,
0
};
MSIBINARY
*
binary
;
UINT
r
;
memset
(
&
si
,
0
,
sizeof
(
STARTUPINFOW
));
if
(
!
(
binary
=
get_temp_binary
(
package
,
source
,
FALSE
)))
return
ERROR_FUNCTION_FAILED
;
deformat_string
(
package
,
target
,
&
deformated
);
len
=
strlenW
(
binary
->
tmpfile
)
+
2
;
if
(
deformated
)
len
+=
strlenW
(
deformated
);
BOOL
ret
;
cmd
=
msi_alloc
(
sizeof
(
WCHAR
)
*
len
);
strcpyW
(
cmd
,
binary
->
tmpfile
);
if
(
deformated
)
memset
(
&
si
,
0
,
sizeof
(
STARTUPINFOW
)
);
ret
=
CreateProcessW
(
exe
,
arg
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
dir
,
&
si
,
&
info
);
if
(
!
ret
)
{
strcatW
(
cmd
,
spc
);
strcatW
(
cmd
,
deformated
);
msi_free
(
deformated
);
WARN
(
"unable to execute command %u
\n
"
,
GetLastError
());
return
INVALID_HANDLE_VALUE
;
}
CloseHandle
(
info
.
hThread
);
return
info
.
hProcess
;
}
TRACE
(
"executing exe %s
\n
"
,
debugstr_w
(
cmd
));
rc
=
CreateProcessW
(
NULL
,
cmd
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
szCRoot
,
&
si
,
&
info
);
msi_free
(
cmd
);
static
UINT
HANDLE_CustomType2
(
MSIPACKAGE
*
package
,
LPCWSTR
source
,
LPCWSTR
target
,
const
INT
type
,
LPCWSTR
action
)
{
MSIBINARY
*
binary
;
HANDLE
handle
;
WCHAR
*
arg
;
if
(
!
rc
)
{
ERR
(
"Unable to execute command %s
\n
"
,
debugstr_w
(
cmd
));
return
ERROR_SUCCESS
;
}
CloseHandle
(
info
.
hThread
);
if
(
!
(
binary
=
get_temp_binary
(
package
,
source
,
FALSE
)))
return
ERROR_FUNCTION_FAILED
;
r
=
wait_process_handle
(
package
,
type
,
info
.
hProcess
,
action
);
deformat_string
(
package
,
target
,
&
arg
);
TRACE
(
"exe %s arg %s
\n
"
,
debugstr_w
(
binary
->
tmpfile
),
debugstr_w
(
arg
));
return
r
;
handle
=
execute_command
(
binary
->
tmpfile
,
arg
,
szCRoot
);
msi_free
(
arg
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
return
ERROR_SUCCESS
;
return
wait_process_handle
(
package
,
type
,
handle
,
action
);
}
static
UINT
HANDLE_CustomType17
(
MSIPACKAGE
*
package
,
LPCWSTR
source
,
...
...
@@ -1049,53 +1033,19 @@ static UINT HANDLE_CustomType17(MSIPACKAGE *package, LPCWSTR source,
static
UINT
HANDLE_CustomType18
(
MSIPACKAGE
*
package
,
LPCWSTR
source
,
LPCWSTR
target
,
const
INT
type
,
LPCWSTR
action
)
{
STARTUPINFOW
si
;
PROCESS_INFORMATION
info
;
BOOL
rc
;
WCHAR
*
deformated
;
WCHAR
*
cmd
;
INT
len
;
static
const
WCHAR
spc
[]
=
{
' '
,
0
};
MSIFILE
*
file
;
HANDLE
handle
;
WCHAR
*
arg
;
memset
(
&
si
,
0
,
sizeof
(
STARTUPINFOW
));
file
=
msi_get_loaded_file
(
package
,
source
);
if
(
!
file
)
return
ERROR_FUNCTION_FAILED
;
len
=
lstrlenW
(
file
->
TargetPath
);
deformat_string
(
package
,
target
,
&
deformated
);
if
(
deformated
)
len
+=
strlenW
(
deformated
);
len
+=
2
;
cmd
=
msi_alloc
(
len
*
sizeof
(
WCHAR
));
lstrcpyW
(
cmd
,
file
->
TargetPath
);
if
(
deformated
)
{
strcatW
(
cmd
,
spc
);
strcatW
(
cmd
,
deformated
);
msi_free
(
deformated
);
}
TRACE
(
"executing exe %s
\n
"
,
debugstr_w
(
cmd
));
rc
=
CreateProcessW
(
NULL
,
cmd
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
szCRoot
,
&
si
,
&
info
);
if
(
!
(
file
=
msi_get_loaded_file
(
package
,
source
)))
return
ERROR_FUNCTION_FAILED
;
if
(
!
rc
)
{
ERR
(
"Unable to execute command %s
\n
"
,
debugstr_w
(
cmd
));
msi_free
(
cmd
);
return
ERROR_SUCCESS
;
}
msi_free
(
cmd
);
CloseHandle
(
info
.
hThread
);
deformat_string
(
package
,
target
,
&
arg
);
TRACE
(
"exe %s arg %s
\n
"
,
debugstr_w
(
file
->
TargetPath
),
debugstr_w
(
arg
));
return
wait_process_handle
(
package
,
type
,
info
.
hProcess
,
action
);
handle
=
execute_command
(
file
->
TargetPath
,
arg
,
szCRoot
);
msi_free
(
arg
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
return
ERROR_SUCCESS
;
return
wait_process_handle
(
package
,
type
,
handle
,
action
);
}
static
UINT
HANDLE_CustomType19
(
MSIPACKAGE
*
package
,
LPCWSTR
source
,
...
...
@@ -1132,90 +1082,39 @@ static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
static
UINT
HANDLE_CustomType50
(
MSIPACKAGE
*
package
,
LPCWSTR
source
,
LPCWSTR
target
,
const
INT
type
,
LPCWSTR
action
)
{
STARTUPINFOW
si
;
PROCESS_INFORMATION
info
;
WCHAR
*
prop
;
BOOL
rc
;
WCHAR
*
deformated
;
WCHAR
*
cmd
;
INT
len
;
static
const
WCHAR
spc
[]
=
{
' '
,
0
};
memset
(
&
si
,
0
,
sizeof
(
STARTUPINFOW
));
memset
(
&
info
,
0
,
sizeof
(
PROCESS_INFORMATION
));
prop
=
msi_dup_property
(
package
->
db
,
source
);
if
(
!
prop
)
return
ERROR_SUCCESS
;
deformat_string
(
package
,
target
,
&
deformated
);
len
=
strlenW
(
prop
)
+
2
;
if
(
deformated
)
len
+=
strlenW
(
deformated
);
cmd
=
msi_alloc
(
sizeof
(
WCHAR
)
*
len
);
strcpyW
(
cmd
,
prop
);
if
(
deformated
)
{
strcatW
(
cmd
,
spc
);
strcatW
(
cmd
,
deformated
);
msi_free
(
deformated
);
}
msi_free
(
prop
);
WCHAR
*
exe
,
*
arg
;
HANDLE
handle
;
TRACE
(
"executing exe %s
\n
"
,
debugstr_w
(
cmd
))
;
if
(
!
(
exe
=
msi_dup_property
(
package
->
db
,
source
)))
return
ERROR_SUCCESS
;
rc
=
CreateProcessW
(
NULL
,
cmd
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
szCRoot
,
&
si
,
&
info
);
deformat_string
(
package
,
target
,
&
arg
);
TRACE
(
"exe %s arg %s
\n
"
,
debugstr_w
(
exe
),
debugstr_w
(
arg
));
if
(
!
rc
)
{
ERR
(
"Unable to execute command %s
\n
"
,
debugstr_w
(
cmd
));
msi_free
(
cmd
);
return
ERROR_SUCCESS
;
}
msi_free
(
cmd
);
CloseHandle
(
info
.
hThread
);
return
wait_process_handle
(
package
,
type
,
info
.
hProcess
,
action
);
handle
=
execute_command
(
exe
,
arg
,
szCRoot
);
msi_free
(
arg
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
return
ERROR_SUCCESS
;
return
wait_process_handle
(
package
,
type
,
handle
,
action
);
}
static
UINT
HANDLE_CustomType34
(
MSIPACKAGE
*
package
,
LPCWSTR
source
,
LPCWSTR
target
,
const
INT
type
,
LPCWSTR
action
)
{
LPWSTR
filename
;
const
WCHAR
*
workingdir
;
STARTUPINFOW
si
;
PROCESS_INFORMATION
info
;
BOOL
rc
;
memset
(
&
si
,
0
,
sizeof
(
STARTUPINFOW
));
HANDLE
handle
;
WCHAR
*
cmd
;
workingdir
=
msi_get_target_folder
(
package
,
source
);
if
(
!
workingdir
)
return
ERROR_FUNCTION_FAILED
;
deformat_string
(
package
,
target
,
&
filename
);
if
(
!
filename
)
return
ERROR_FUNCTION_FAILED
;
TRACE
(
"executing exe %s with working directory %s
\n
"
,
debugstr_w
(
filename
),
debugstr_w
(
workingdir
));
deformat_string
(
package
,
target
,
&
cmd
);
if
(
!
cmd
)
return
ERROR_FUNCTION_FAILED
;
rc
=
CreateProcessW
(
NULL
,
filename
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
workingdir
,
&
si
,
&
info
);
if
(
!
rc
)
{
ERR
(
"Unable to execute command %s with working directory %s
\n
"
,
debugstr_w
(
filename
),
debugstr_w
(
workingdir
));
msi_free
(
filename
);
return
ERROR_SUCCESS
;
}
msi_free
(
filename
);
CloseHandle
(
info
.
hThread
);
TRACE
(
"cmd %s dir %s
\n
"
,
debugstr_w
(
cmd
),
debugstr_w
(
workingdir
));
return
wait_process_handle
(
package
,
type
,
info
.
hProcess
,
action
);
handle
=
execute_command
(
NULL
,
cmd
,
workingdir
);
msi_free
(
cmd
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
return
ERROR_SUCCESS
;
return
wait_process_handle
(
package
,
type
,
handle
,
action
);
}
static
DWORD
ACTION_CallScript
(
const
GUID
*
guid
)
...
...
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