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
1510cce8
Commit
1510cce8
authored
Feb 10, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
Feb 10, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert to Unicode.
parent
0e0544aa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
184 additions
and
142 deletions
+184
-142
msiexec.c
programs/msiexec/msiexec.c
+184
-142
No files found.
programs/msiexec/msiexec.c
View file @
1510cce8
...
...
@@ -27,13 +27,14 @@
#include "msiexec.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
msiexec
);
struct
string_list
{
struct
string_list
*
next
;
CHAR
str
[
1
];
W
CHAR
str
[
1
];
};
static
const
char
UsageStr
[]
=
...
...
@@ -65,8 +66,10 @@ static const char UsageStr[] =
"
\n
"
"Copyright 2004 Vincent Bron
\n
"
;
static
const
char
ActionAdmin
[]
=
"ACTION=ADMIN "
;
static
const
char
RemoveAll
[]
=
"REMOVE=ALL "
;
static
const
WCHAR
ActionAdmin
[]
=
{
'A'
,
'C'
,
'T'
,
'I'
,
'O'
,
'N'
,
'='
,
'A'
,
'D'
,
'M'
,
'I'
,
'N'
,
' '
,
0
};
static
const
WCHAR
RemoveAll
[]
=
{
'R'
,
'E'
,
'M'
,
'O'
,
'V'
,
'E'
,
'='
,
'A'
,
'L'
,
'L'
,
' '
,
0
};
static
void
ShowUsage
(
int
ExitCode
)
{
...
...
@@ -74,20 +77,12 @@ static void ShowUsage(int ExitCode)
ExitProcess
(
ExitCode
);
}
static
BOOL
GetProductCode
(
LP
CSTR
str
,
LPC
STR
*
PackageName
,
LPGUID
ProductCode
)
static
BOOL
GetProductCode
(
LP
WSTR
str
,
LPCW
STR
*
PackageName
,
LPGUID
ProductCode
)
{
BOOL
ret
=
FALSE
;
int
len
=
0
;
LPWSTR
wstr
=
NULL
;
if
(
strlen
(
str
)
==
38
)
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
wstr
,
0
);
wstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
ret
=
(
CLSIDFromString
(
wstr
,
ProductCode
)
==
NOERROR
);
HeapFree
(
GetProcessHeap
(),
0
,
wstr
);
wstr
=
NULL
;
}
if
(
lstrlenW
(
str
)
==
38
)
ret
=
(
CLSIDFromString
(
str
,
ProductCode
)
==
NOERROR
);
if
(
!
ret
)
*
PackageName
=
str
;
...
...
@@ -95,19 +90,19 @@ static BOOL GetProductCode(LPCSTR str, LPCSTR *PackageName, LPGUID ProductCode)
return
ret
;
}
static
VOID
StringListAppend
(
struct
string_list
**
list
,
LPCSTR
str
)
static
VOID
StringListAppend
(
struct
string_list
**
list
,
LPC
W
STR
str
)
{
struct
string_list
*
entry
;
DWORD
size
;
size
=
sizeof
*
entry
+
strlen
(
str
)
*
sizeof
(
CHAR
);
size
=
sizeof
*
entry
+
lstrlenW
(
str
)
*
sizeof
(
W
CHAR
);
entry
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
entry
)
{
WINE_ERR
(
"Out of memory!
\n
"
);
ExitProcess
(
1
);
}
strcpy
(
entry
->
str
,
str
);
lstrcpyW
(
entry
->
str
,
str
);
entry
->
next
=
NULL
;
/*
...
...
@@ -119,10 +114,10 @@ static VOID StringListAppend(struct string_list **list, LPCSTR str)
*
list
=
entry
;
}
static
LPSTR
build_properties
(
struct
string_list
*
property_list
)
static
LP
W
STR
build_properties
(
struct
string_list
*
property_list
)
{
struct
string_list
*
list
;
LPSTR
ret
,
p
,
value
;
LP
W
STR
ret
,
p
,
value
;
DWORD
len
;
BOOL
needs_quote
;
...
...
@@ -132,58 +127,60 @@ static LPSTR build_properties(struct string_list *property_list)
/* count the space we need */
len
=
1
;
for
(
list
=
property_list
;
list
;
list
=
list
->
next
)
len
+=
strlen
(
list
->
str
)
+
3
;
len
+=
lstrlenW
(
list
->
str
)
+
3
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
CHAR
)
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
W
CHAR
)
);
/* add a space before each string, and quote the value */
p
=
ret
;
for
(
list
=
property_list
;
list
;
list
=
list
->
next
)
{
value
=
strchr
(
list
->
str
,
'='
);
value
=
strchr
W
(
list
->
str
,
'='
);
if
(
!
value
)
continue
;
len
=
value
-
list
->
str
;
*
p
++
=
' '
;
strncpy
(
p
,
list
->
str
,
len
);
strncpy
W
(
p
,
list
->
str
,
len
);
p
+=
len
;
*
p
++
=
'='
;
/* check if the value contains spaces and maybe quote it */
value
++
;
needs_quote
=
strchr
(
value
,
' '
)
?
1
:
0
;
needs_quote
=
strchr
W
(
value
,
' '
)
?
1
:
0
;
if
(
needs_quote
)
*
p
++
=
'"'
;
len
=
strlen
(
value
);
strncpy
(
p
,
value
,
len
);
len
=
lstrlenW
(
value
);
strncpy
W
(
p
,
value
,
len
);
p
+=
len
;
if
(
needs_quote
)
*
p
++
=
'"'
;
}
*
p
=
0
;
WINE_TRACE
(
"properties -> %s
\n
"
,
wine_dbgstr_w
(
ret
)
);
return
ret
;
}
static
LPSTR
build_transforms
(
struct
string_list
*
transform_list
)
static
LP
W
STR
build_transforms
(
struct
string_list
*
transform_list
)
{
struct
string_list
*
list
;
LPSTR
ret
,
p
;
LP
W
STR
ret
,
p
;
DWORD
len
;
/* count the space we need */
len
=
1
;
for
(
list
=
transform_list
;
list
;
list
=
list
->
next
)
len
+=
strlen
(
list
->
str
)
+
1
;
len
+=
lstrlenW
(
list
->
str
)
+
1
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
CHAR
)
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
W
CHAR
)
);
/* add all the transforms with a semicolon between each one */
p
=
ret
;
for
(
list
=
transform_list
;
list
;
list
=
list
->
next
)
{
len
=
strlen
(
list
->
str
);
strncpy
(
p
,
list
->
str
,
len
);
len
=
lstrlenW
(
list
->
str
);
lstrcpynW
(
p
,
list
->
str
,
len
);
p
+=
len
;
if
(
list
->
next
)
*
p
++
=
';'
;
...
...
@@ -193,34 +190,77 @@ static LPSTR build_transforms(struct string_list *transform_list)
return
ret
;
}
static
INT
MSIEXEC_lstrncmpiA
(
LPCSTR
str1
,
LPCSTR
str2
,
INT
size
)
static
DWORD
msi_atou
(
LPCWSTR
str
)
{
INT
ret
;
DWORD
ret
=
0
;
while
(
*
str
>=
'0'
&&
*
str
<=
'9'
)
{
ret
*=
10
;
ret
+=
(
*
str
-
'0'
);
str
++
;
}
return
0
;
}
if
((
str1
==
NULL
)
&&
(
str2
==
NULL
))
return
0
;
if
(
str1
==
NULL
)
return
-
1
;
if
(
str2
==
NULL
)
return
1
;
static
LPWSTR
msi_strdup
(
LPCWSTR
str
)
{
DWORD
len
=
lstrlenW
(
str
)
+
1
;
LPWSTR
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
len
);
lstrcpyW
(
ret
,
str
);
return
ret
;
}
ret
=
CompareStringA
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
size
,
str2
,
-
1
);
if
(
ret
)
ret
-=
2
;
/* str1 is the same as str2, ignoring case */
static
BOOL
msi_strequal
(
LPCWSTR
str1
,
LPCSTR
str2
)
{
DWORD
len
,
ret
;
LPWSTR
strW
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str2
,
-
1
,
NULL
,
0
);
if
(
!
len
)
return
TRUE
;
if
(
lstrlenW
(
str1
)
!=
(
len
-
1
)
)
return
TRUE
;
strW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
str2
,
-
1
,
strW
,
len
);
ret
=
CompareStringW
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
len
,
strW
,
len
);
HeapFree
(
GetProcessHeap
(),
0
,
strW
);
return
(
ret
!=
CSTR_EQUAL
);
}
return
ret
;
/* str2 is at the beginning of str1, ignoring case */
static
BOOL
msi_strprefix
(
LPCWSTR
str1
,
LPCSTR
str2
)
{
DWORD
len
,
ret
;
LPWSTR
strW
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str2
,
-
1
,
NULL
,
0
);
if
(
!
len
)
return
TRUE
;
if
(
lstrlenW
(
str1
)
<
(
len
-
1
)
)
return
TRUE
;
strW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
str2
,
-
1
,
strW
,
len
);
ret
=
CompareStringW
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
len
-
1
,
strW
,
len
-
1
);
HeapFree
(
GetProcessHeap
(),
0
,
strW
);
return
(
ret
!=
CSTR_EQUAL
);
}
static
VOID
*
LoadProc
(
LPCSTR
DllName
,
LPCSTR
ProcName
,
HMODULE
*
DllHandle
)
static
VOID
*
LoadProc
(
LPC
W
STR
DllName
,
LPCSTR
ProcName
,
HMODULE
*
DllHandle
)
{
VOID
*
(
*
proc
)(
void
);
*
DllHandle
=
LoadLibraryEx
A
(
DllName
,
NULL
,
LOAD_WITH_ALTERED_SEARCH_PATH
);
*
DllHandle
=
LoadLibraryEx
W
(
DllName
,
NULL
,
LOAD_WITH_ALTERED_SEARCH_PATH
);
if
(
!*
DllHandle
)
{
fprintf
(
stderr
,
"Unable to load dll %s
\n
"
,
DllName
);
fprintf
(
stderr
,
"Unable to load dll %s
\n
"
,
wine_dbgstr_w
(
DllName
)
);
ExitProcess
(
1
);
}
proc
=
(
VOID
*
)
GetProcAddress
(
*
DllHandle
,
ProcName
);
if
(
!
proc
)
{
fprintf
(
stderr
,
"Dll %s does not implement function %s
\n
"
,
DllName
,
ProcName
);
fprintf
(
stderr
,
"Dll %s does not implement function %s
\n
"
,
wine_dbgstr_w
(
DllName
),
ProcName
);
FreeLibrary
(
*
DllHandle
);
ExitProcess
(
1
);
}
...
...
@@ -228,7 +268,7 @@ static VOID *LoadProc(LPCSTR DllName, LPCSTR ProcName, HMODULE* DllHandle)
return
proc
;
}
static
DWORD
DllRegisterServer
(
LPCSTR
DllName
)
static
DWORD
DllRegisterServer
(
LPC
W
STR
DllName
)
{
HRESULT
hr
;
DLLREGISTERSERVER
pfDllRegisterServer
=
NULL
;
...
...
@@ -239,16 +279,16 @@ static DWORD DllRegisterServer(LPCSTR DllName)
hr
=
pfDllRegisterServer
();
if
(
FAILED
(
hr
))
{
fprintf
(
stderr
,
"Failed to register dll %s
\n
"
,
DllName
);
fprintf
(
stderr
,
"Failed to register dll %s
\n
"
,
wine_dbgstr_w
(
DllName
)
);
return
1
;
}
printf
(
"Successfully registered dll %s
\n
"
,
DllName
);
printf
(
"Successfully registered dll %s
\n
"
,
wine_dbgstr_w
(
DllName
)
);
if
(
DllHandle
)
FreeLibrary
(
DllHandle
);
return
0
;
}
static
DWORD
DllUnregisterServer
(
LPCSTR
DllName
)
static
DWORD
DllUnregisterServer
(
LPC
W
STR
DllName
)
{
HRESULT
hr
;
DLLUNREGISTERSERVER
pfDllUnregisterServer
=
NULL
;
...
...
@@ -259,10 +299,10 @@ static DWORD DllUnregisterServer(LPCSTR DllName)
hr
=
pfDllUnregisterServer
();
if
(
FAILED
(
hr
))
{
fprintf
(
stderr
,
"Failed to unregister dll %s
\n
"
,
DllName
);
fprintf
(
stderr
,
"Failed to unregister dll %s
\n
"
,
wine_dbgstr_w
(
DllName
)
);
return
1
;
}
printf
(
"Successfully unregistered dll %s
\n
"
,
DllName
);
printf
(
"Successfully unregistered dll %s
\n
"
,
wine_dbgstr_w
(
DllName
)
);
if
(
DllHandle
)
FreeLibrary
(
DllHandle
);
return
0
;
...
...
@@ -279,10 +319,10 @@ enum chomp_state
cs_quote
};
static
int
chomp
(
char
*
str
)
static
int
chomp
(
WCHAR
*
str
)
{
enum
chomp_state
state
=
cs_whitespace
;
char
*
p
,
*
out
;
WCHAR
*
p
,
*
out
;
int
count
=
0
,
ignore
;
for
(
p
=
str
,
out
=
str
;
*
p
;
p
++
)
...
...
@@ -341,17 +381,17 @@ static int chomp( char *str )
return
count
;
}
void
process_args
(
char
*
cmdline
,
int
*
pargc
,
char
***
pargv
)
void
process_args
(
WCHAR
*
cmdline
,
int
*
pargc
,
WCHAR
***
pargv
)
{
char
**
argv
,
*
p
=
strdup
(
cmdline
);
WCHAR
**
argv
,
*
p
=
msi_
strdup
(
cmdline
);
int
i
,
n
;
n
=
chomp
(
p
);
argv
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
char
*
)
*
(
n
+
1
));
argv
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
*
)
*
(
n
+
1
));
for
(
i
=
0
;
i
<
n
;
i
++
)
{
argv
[
i
]
=
p
;
p
+=
strlen
(
p
)
+
1
;
p
+=
lstrlenW
(
p
)
+
1
;
}
argv
[
i
]
=
NULL
;
...
...
@@ -374,61 +414,62 @@ int main(int argc, char **argv)
BOOL
FunctionUnknown
=
FALSE
;
BOOL
GotProductCode
=
FALSE
;
LPCSTR
PackageName
=
NULL
;
LPC
W
STR
PackageName
=
NULL
;
GUID
ProductCode
;
LPSTR
Properties
=
NULL
;
LP
W
STR
Properties
=
NULL
;
struct
string_list
*
property_list
=
NULL
;
DWORD
RepairMode
=
0
;
DWORD
AdvertiseMode
=
0
;
LPSTR
Transforms
=
NULL
;
LP
W
STR
Transforms
=
NULL
;
struct
string_list
*
transform_list
=
NULL
;
LANGID
Language
=
0
;
DWORD
LogMode
=
0
;
LPSTR
LogFileName
=
NULL
;
LP
W
STR
LogFileName
=
NULL
;
DWORD
LogAttributes
=
0
;
LPSTR
PatchFileName
=
NULL
;
LP
W
STR
PatchFileName
=
NULL
;
INSTALLTYPE
InstallType
=
INSTALLTYPE_DEFAULT
;
INSTALLUILEVEL
InstallUILevel
=
0
,
retInstallUILevel
;
LPSTR
DllName
=
NULL
;
LP
W
STR
DllName
=
NULL
;
DWORD
ReturnCode
;
LPWSTR
*
argvW
=
NULL
;
process_args
(
GetCommandLine
A
(),
&
argc
,
&
argv
);
process_args
(
GetCommandLine
W
(),
&
argc
,
&
argvW
);
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
if
(
!
lstrcmpiA
(
argv
[
i
],
"/regserver"
))
if
(
!
msi_strequal
(
argvW
[
i
],
"/regserver"
))
{
FunctionRegServer
=
TRUE
;
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"/unregserver"
)
||
!
lstrcmpiA
(
argv
[
i
],
"/unregister"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"/unregserver"
)
||
!
msi_strequal
(
argvW
[
i
],
"/unregister"
))
{
FunctionUnregServer
=
TRUE
;
}
else
if
(
!
MSIEXEC_lstrncmpiA
(
argv
[
i
],
"/i"
,
2
))
else
if
(
!
msi_strprefix
(
argvW
[
i
],
"/i"
))
{
char
*
argvi
=
argv
[
i
];
LPWSTR
argvWi
=
argvW
[
i
];
FunctionInstall
=
TRUE
;
if
(
strlen
(
argv
i
)
>
2
)
argvi
+=
2
;
if
(
lstrlenW
(
argvW
i
)
>
2
)
argv
W
i
+=
2
;
else
{
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
argv
i
=
argv
[
i
];
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
argv
Wi
=
argvW
[
i
];
}
GotProductCode
=
GetProductCode
(
argvi
,
&
PackageName
,
&
ProductCode
);
GotProductCode
=
GetProductCode
(
argv
W
i
,
&
PackageName
,
&
ProductCode
);
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"/a"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"/a"
))
{
FunctionInstall
=
TRUE
;
FunctionInstallAdmin
=
TRUE
;
...
...
@@ -436,18 +477,18 @@ int main(int argc, char **argv)
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
PackageName
=
argv
[
i
];
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
PackageName
=
argv
W
[
i
];
StringListAppend
(
&
property_list
,
ActionAdmin
);
}
else
if
(
!
MSIEXEC_lstrncmpiA
(
argv
[
i
],
"/f"
,
2
))
else
if
(
!
msi_strprefix
(
argvW
[
i
],
"/f"
))
{
int
j
;
int
len
=
strlen
(
argv
[
i
]);
int
len
=
lstrlenW
(
argvW
[
i
]);
FunctionRepair
=
TRUE
;
for
(
j
=
2
;
j
<
len
;
j
++
)
{
switch
(
argv
[
i
][
j
])
switch
(
argv
W
[
i
][
j
])
{
case
'P'
:
case
'p'
:
...
...
@@ -490,7 +531,7 @@ int main(int argc, char **argv)
RepairMode
|=
REINSTALLMODE_PACKAGE
;
break
;
default:
fprintf
(
stderr
,
"Unknown option
\"
%c
\"
in Repair mode
\n
"
,
argv
[
i
][
j
]);
fprintf
(
stderr
,
"Unknown option
\"
%c
\"
in Repair mode
\n
"
,
argv
W
[
i
][
j
]);
break
;
}
}
...
...
@@ -505,27 +546,27 @@ int main(int argc, char **argv)
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
GotProductCode
=
GetProductCode
(
argv
[
i
],
&
PackageName
,
&
ProductCode
);
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
GotProductCode
=
GetProductCode
(
argv
W
[
i
],
&
PackageName
,
&
ProductCode
);
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"/x"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"/x"
))
{
FunctionInstall
=
TRUE
;
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
GotProductCode
=
GetProductCode
(
argv
[
i
],
&
PackageName
,
&
ProductCode
);
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
GotProductCode
=
GetProductCode
(
argv
W
[
i
],
&
PackageName
,
&
ProductCode
);
StringListAppend
(
&
property_list
,
RemoveAll
);
}
else
if
(
!
MSIEXEC_lstrncmpiA
(
argv
[
i
],
"/j"
,
2
))
else
if
(
!
msi_strprefix
(
argvW
[
i
],
"/j"
))
{
int
j
;
int
len
=
strlen
(
argv
[
i
]);
int
len
=
lstrlenW
(
argvW
[
i
]);
FunctionAdvertise
=
TRUE
;
for
(
j
=
2
;
j
<
len
;
j
++
)
{
switch
(
argv
[
i
][
j
])
switch
(
argv
W
[
i
][
j
])
{
case
'U'
:
case
'u'
:
...
...
@@ -536,63 +577,63 @@ int main(int argc, char **argv)
AdvertiseMode
=
ADVERTISEFLAGS_MACHINEASSIGN
;
break
;
default:
fprintf
(
stderr
,
"Unknown option
\"
%c
\"
in Advertise mode
\n
"
,
argv
[
i
][
j
]);
fprintf
(
stderr
,
"Unknown option
\"
%c
\"
in Advertise mode
\n
"
,
argv
W
[
i
][
j
]);
break
;
}
}
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
PackageName
=
argv
[
i
];
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
PackageName
=
argv
W
[
i
];
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"u"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"u"
))
{
FunctionAdvertise
=
TRUE
;
AdvertiseMode
=
ADVERTISEFLAGS_USERASSIGN
;
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
PackageName
=
argv
[
i
];
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
PackageName
=
argv
W
[
i
];
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"m"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"m"
))
{
FunctionAdvertise
=
TRUE
;
AdvertiseMode
=
ADVERTISEFLAGS_MACHINEASSIGN
;
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
PackageName
=
argv
[
i
];
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
PackageName
=
argv
W
[
i
];
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"/t"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"/t"
))
{
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
StringListAppend
(
&
transform_list
,
argv
[
i
]);
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
StringListAppend
(
&
transform_list
,
argv
W
[
i
]);
}
else
if
(
!
MSIEXEC_lstrncmpiA
(
argv
[
i
],
"TRANSFORMS="
,
11
))
else
if
(
!
msi_strprefix
(
argvW
[
i
],
"TRANSFORMS="
))
{
StringListAppend
(
&
transform_list
,
argv
[
i
]
+
11
);
StringListAppend
(
&
transform_list
,
argv
W
[
i
]
+
11
);
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"/g"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"/g"
))
{
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
Language
=
strtol
(
argv
[
i
],
NULL
,
0
);
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
Language
=
msi_atou
(
argvW
[
i
]
);
}
else
if
(
!
MSIEXEC_lstrncmpiA
(
argv
[
i
],
"/l"
,
2
))
else
if
(
!
msi_strprefix
(
argvW
[
i
],
"/l"
))
{
int
j
;
int
len
=
strlen
(
argv
[
i
]);
int
len
=
lstrlenW
(
argvW
[
i
]);
for
(
j
=
2
;
j
<
len
;
j
++
)
{
switch
(
argv
[
i
][
j
])
switch
(
argv
W
[
i
][
j
])
{
case
'I'
:
case
'i'
:
...
...
@@ -668,61 +709,63 @@ int main(int argc, char **argv)
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
LogFileName
=
argv
[
i
];
if
(
MsiEnableLog
A
(
LogMode
,
LogFileName
,
LogAttributes
)
!=
ERROR_SUCCESS
)
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
LogFileName
=
argv
W
[
i
];
if
(
MsiEnableLog
W
(
LogMode
,
LogFileName
,
LogAttributes
)
!=
ERROR_SUCCESS
)
{
fprintf
(
stderr
,
"Logging in %s (0x%08lx, %lu) failed
\n
"
,
LogFileName
,
LogMode
,
LogAttributes
);
fprintf
(
stderr
,
"Logging in %s (0x%08lx, %lu) failed
\n
"
,
wine_dbgstr_w
(
LogFileName
),
LogMode
,
LogAttributes
);
ExitProcess
(
1
);
}
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"/p"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"/p"
))
{
FunctionPatch
=
TRUE
;
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
PatchFileName
=
argv
[
i
];
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
PatchFileName
=
argv
W
[
i
];
}
else
if
(
!
MSIEXEC_lstrncmpiA
(
argv
[
i
],
"/q"
,
2
))
else
if
(
!
msi_strprefix
(
argvW
[
i
],
"/q"
))
{
if
(
strlen
(
argv
[
i
])
==
2
||
!
lstrcmpiA
(
argv
[
i
]
+
2
,
"n"
))
if
(
lstrlenW
(
argvW
[
i
])
==
2
||
!
msi_strequal
(
argvW
[
i
]
+
2
,
"n"
))
{
InstallUILevel
=
INSTALLUILEVEL_NONE
;
}
else
if
(
!
lstrcmpiA
(
argv
[
i
]
+
2
,
"b"
))
else
if
(
!
msi_strequal
(
argvW
[
i
]
+
2
,
"b"
))
{
InstallUILevel
=
INSTALLUILEVEL_BASIC
;
}
else
if
(
!
lstrcmpiA
(
argv
[
i
]
+
2
,
"r"
))
else
if
(
!
msi_strequal
(
argvW
[
i
]
+
2
,
"r"
))
{
InstallUILevel
=
INSTALLUILEVEL_REDUCED
;
}
else
if
(
!
lstrcmpiA
(
argv
[
i
]
+
2
,
"f"
))
else
if
(
!
msi_strequal
(
argvW
[
i
]
+
2
,
"f"
))
{
InstallUILevel
=
INSTALLUILEVEL_FULL
|
INSTALLUILEVEL_ENDDIALOG
;
}
else
if
(
!
lstrcmpiA
(
argv
[
i
]
+
2
,
"n+"
))
else
if
(
!
msi_strequal
(
argvW
[
i
]
+
2
,
"n+"
))
{
InstallUILevel
=
INSTALLUILEVEL_NONE
|
INSTALLUILEVEL_ENDDIALOG
;
}
else
if
(
!
lstrcmpiA
(
argv
[
i
]
+
2
,
"b+"
))
else
if
(
!
msi_strequal
(
argvW
[
i
]
+
2
,
"b+"
))
{
InstallUILevel
=
INSTALLUILEVEL_BASIC
|
INSTALLUILEVEL_ENDDIALOG
;
}
else
if
(
!
lstrcmpiA
(
argv
[
i
]
+
2
,
"b-"
))
else
if
(
!
msi_strequal
(
argvW
[
i
]
+
2
,
"b-"
))
{
InstallUILevel
=
INSTALLUILEVEL_BASIC
|
INSTALLUILEVEL_PROGRESSONLY
;
}
else
if
(
!
lstrcmpiA
(
argv
[
i
]
+
2
,
"b+!"
))
else
if
(
!
msi_strequal
(
argvW
[
i
]
+
2
,
"b+!"
))
{
InstallUILevel
=
INSTALLUILEVEL_BASIC
|
INSTALLUILEVEL_ENDDIALOG
;
WINE_FIXME
(
"Unknown modifier: !
\n
"
);
}
else
{
fprintf
(
stderr
,
"Unknown option
\"
%s
\"
for UI level
\n
"
,
argv
[
i
]
+
2
);
fprintf
(
stderr
,
"Unknown option
\"
%s
\"
for UI level
\n
"
,
wine_dbgstr_w
(
argvW
[
i
]
+
2
));
}
retInstallUILevel
=
MsiSetInternalUI
(
InstallUILevel
,
NULL
);
if
(
retInstallUILevel
==
INSTALLUILEVEL_NOCHANGE
)
...
...
@@ -731,47 +774,46 @@ int main(int argc, char **argv)
ExitProcess
(
1
);
}
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"/y"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"/y"
))
{
FunctionDllRegisterServer
=
TRUE
;
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
DllName
=
argv
[
i
];
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
DllName
=
argv
W
[
i
];
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"/z"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"/z"
))
{
FunctionDllUnregisterServer
=
TRUE
;
i
++
;
if
(
i
>=
argc
)
ShowUsage
(
1
);
WINE_TRACE
(
"argv
[%d] = %s
\n
"
,
i
,
argv
[
i
]
);
DllName
=
argv
[
i
];
WINE_TRACE
(
"argv
W[%d] = %s
\n
"
,
i
,
wine_dbgstr_w
(
argvW
[
i
])
);
DllName
=
argv
W
[
i
];
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"/h"
)
||
!
lstrcmpiA
(
argv
[
i
],
"/?"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"/h"
)
||
!
msi_strequal
(
argvW
[
i
],
"/?"
))
{
ShowUsage
(
0
);
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"/m"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"/m"
))
{
FunctionUnknown
=
TRUE
;
WINE_FIXME
(
"Unknown parameter /m
\n
"
);
}
else
if
(
!
lstrcmpiA
(
argv
[
i
],
"/D"
))
else
if
(
!
msi_strequal
(
argvW
[
i
],
"/D"
))
{
FunctionUnknown
=
TRUE
;
WINE_FIXME
(
"Unknown parameter /D
\n
"
);
}
else
if
(
strchr
(
argv
[
i
],
'='
))
else
if
(
strchr
W
(
argvW
[
i
],
'='
))
{
StringListAppend
(
&
property_list
,
argv
[
i
]);
StringListAppend
(
&
property_list
,
" "
);
StringListAppend
(
&
property_list
,
argvW
[
i
]);
}
else
{
FunctionInstall
=
TRUE
;
GotProductCode
=
GetProductCode
(
argv
[
i
],
&
PackageName
,
&
ProductCode
);
GotProductCode
=
GetProductCode
(
argv
W
[
i
],
&
PackageName
,
&
ProductCode
);
}
}
...
...
@@ -787,22 +829,22 @@ int main(int argc, char **argv)
if
(
GotProductCode
)
WINE_FIXME
(
"Product code treatment not implemented yet
\n
"
);
else
ReturnCode
=
MsiInstallProduct
A
(
PackageName
,
Properties
);
ReturnCode
=
MsiInstallProduct
W
(
PackageName
,
Properties
);
}
else
if
(
FunctionRepair
)
{
if
(
GotProductCode
)
WINE_FIXME
(
"Product code treatment not implemented yet
\n
"
);
else
ReturnCode
=
MsiReinstallProduct
A
(
PackageName
,
RepairMode
);
ReturnCode
=
MsiReinstallProduct
W
(
PackageName
,
RepairMode
);
}
else
if
(
FunctionAdvertise
)
{
ReturnCode
=
MsiAdvertiseProduct
A
(
PackageName
,
(
LP
STR
)
AdvertiseMode
,
Transforms
,
Language
);
ReturnCode
=
MsiAdvertiseProduct
W
(
PackageName
,
(
LPW
STR
)
AdvertiseMode
,
Transforms
,
Language
);
}
else
if
(
FunctionPatch
)
{
ReturnCode
=
MsiApplyPatch
A
(
PatchFileName
,
PackageName
,
InstallType
,
Properties
);
ReturnCode
=
MsiApplyPatch
W
(
PatchFileName
,
PackageName
,
InstallType
,
Properties
);
}
else
if
(
FunctionDllRegisterServer
)
{
...
...
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