2 * msiexec.exe implementation
4 * Copyright 2004 Vincent BĂ©ron
5 * Copyright 2005 Mike McCormack
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define WIN32_LEAN_AND_MEAN
30 #include "wine/debug.h"
31 #include "wine/unicode.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(msiexec
);
35 typedef HRESULT (WINAPI
*DLLREGISTERSERVER
)(void);
36 typedef HRESULT (WINAPI
*DLLUNREGISTERSERVER
)(void);
38 DWORD
DoService(void);
42 struct string_list
*next
;
46 static const WCHAR ActionAdmin
[] = {
47 'A','C','T','I','O','N','=','A','D','M','I','N',0 };
48 static const WCHAR RemoveAll
[] = {
49 'R','E','M','O','V','E','=','A','L','L',0 };
51 static const WCHAR InstallRunOnce
[] = {
52 'S','o','f','t','w','a','r','e','\\',
53 'M','i','c','r','o','s','o','f','t','\\',
54 'W','i','n','d','o','w','s','\\',
55 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
56 'I','n','s','t','a','l','l','e','r','\\',
57 'R','u','n','O','n','c','e','E','n','t','r','i','e','s',0};
59 static void ShowUsage(int ExitCode
)
61 WCHAR msiexec_version
[40];
62 WCHAR filename
[MAX_PATH
];
65 HMODULE hmsi
= GetModuleHandleA("msi.dll");
69 /* MsiGetFileVersion need the full path */
71 res
= GetModuleFileNameW(hmsi
, filename
, sizeof(filename
) / sizeof(filename
[0]));
73 WINE_ERR("GetModuleFileName failed: %d\n", GetLastError());
75 len
= sizeof(msiexec_version
) / sizeof(msiexec_version
[0]);
77 res
= MsiGetFileVersionW(filename
, msiexec_version
, &len
, NULL
, NULL
);
79 WINE_ERR("MsiGetFileVersion failed with %d\n", res
);
81 /* Return the length of the resource.
82 No typo: The LPWSTR parameter must be a LPWSTR * for this mode */
83 len
= LoadStringW(hmsi
, 10, (LPWSTR
) &msi_res
, 0);
85 msi_res
= HeapAlloc(GetProcessHeap(), 0, (len
+ 1) * sizeof(WCHAR
));
86 msiexec_help
= HeapAlloc(GetProcessHeap(), 0, (len
+ 1) * sizeof(WCHAR
) + sizeof(msiexec_version
));
87 if (msi_res
&& msiexec_help
) {
89 LoadStringW(hmsi
, 10, msi_res
, len
+ 1);
91 sprintfW(msiexec_help
, msi_res
, msiexec_version
);
92 MsiMessageBoxW(0, msiexec_help
, NULL
, 0, GetUserDefaultLangID(), 0);
94 HeapFree(GetProcessHeap(), 0, msi_res
);
95 HeapFree(GetProcessHeap(), 0, msiexec_help
);
96 ExitProcess(ExitCode
);
99 static BOOL
IsProductCode(LPWSTR str
)
103 if(lstrlenW(str
) != 38)
105 return ( (CLSIDFromString(str
, &ProductCode
) == NOERROR
) );
109 static VOID
StringListAppend(struct string_list
**list
, LPCWSTR str
)
111 struct string_list
*entry
;
113 entry
= HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(struct string_list
, str
[lstrlenW(str
) + 1]));
116 WINE_ERR("Out of memory!\n");
119 lstrcpyW(entry
->str
, str
);
123 * Ignoring o(n^2) time complexity to add n strings for simplicity,
124 * add the string to the end of the list to preserve the order.
127 list
= &(*list
)->next
;
131 static LPWSTR
build_properties(struct string_list
*property_list
)
133 struct string_list
*list
;
134 LPWSTR ret
, p
, value
;
141 /* count the space we need */
143 for(list
= property_list
; list
; list
= list
->next
)
144 len
+= lstrlenW(list
->str
) + 3;
146 ret
= HeapAlloc( GetProcessHeap(), 0, len
*sizeof(WCHAR
) );
148 /* add a space before each string, and quote the value */
150 for(list
= property_list
; list
; list
= list
->next
)
152 value
= strchrW(list
->str
,'=');
155 len
= value
- list
->str
;
157 memcpy(p
, list
->str
, len
* sizeof(WCHAR
));
161 /* check if the value contains spaces and maybe quote it */
163 needs_quote
= strchrW(value
,' ') ? 1 : 0;
166 len
= lstrlenW(value
);
167 memcpy(p
, value
, len
* sizeof(WCHAR
));
174 WINE_TRACE("properties -> %s\n", wine_dbgstr_w(ret
) );
179 static LPWSTR
build_transforms(struct string_list
*transform_list
)
181 struct string_list
*list
;
185 /* count the space we need */
187 for(list
= transform_list
; list
; list
= list
->next
)
188 len
+= lstrlenW(list
->str
) + 1;
190 ret
= HeapAlloc( GetProcessHeap(), 0, len
*sizeof(WCHAR
) );
192 /* add all the transforms with a semicolon between each one */
194 for(list
= transform_list
; list
; list
= list
->next
)
196 len
= lstrlenW(list
->str
);
197 lstrcpynW(p
, list
->str
, len
);
207 static DWORD
msi_atou(LPCWSTR str
)
210 while(*str
>= '0' && *str
<= '9')
219 static LPWSTR
msi_strdup(LPCWSTR str
)
221 DWORD len
= lstrlenW(str
)+1;
222 LPWSTR ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
)*len
);
227 /* str1 is the same as str2, ignoring case */
228 static BOOL
msi_strequal(LPCWSTR str1
, LPCSTR str2
)
233 len
= MultiByteToWideChar( CP_ACP
, 0, str2
, -1, NULL
, 0);
236 if( lstrlenW(str1
) != (len
-1) )
238 strW
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
)*len
);
239 MultiByteToWideChar( CP_ACP
, 0, str2
, -1, strW
, len
);
240 ret
= CompareStringW(GetThreadLocale(), NORM_IGNORECASE
, str1
, len
, strW
, len
);
241 HeapFree(GetProcessHeap(), 0, strW
);
242 return (ret
== CSTR_EQUAL
);
245 /* prefix is hyphen or dash, and str1 is the same as str2, ignoring case */
246 static BOOL
msi_option_equal(LPCWSTR str1
, LPCSTR str2
)
248 if (str1
[0] != '/' && str1
[0] != '-')
251 /* skip over the hyphen or slash */
252 return msi_strequal(str1
+ 1, str2
);
255 /* str2 is at the beginning of str1, ignoring case */
256 static BOOL
msi_strprefix(LPCWSTR str1
, LPCSTR str2
)
261 len
= MultiByteToWideChar( CP_ACP
, 0, str2
, -1, NULL
, 0);
264 if( lstrlenW(str1
) < (len
-1) )
266 strW
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
)*len
);
267 MultiByteToWideChar( CP_ACP
, 0, str2
, -1, strW
, len
);
268 ret
= CompareStringW(GetThreadLocale(), NORM_IGNORECASE
, str1
, len
-1, strW
, len
-1);
269 HeapFree(GetProcessHeap(), 0, strW
);
270 return (ret
== CSTR_EQUAL
);
273 /* prefix is hyphen or dash, and str2 is at the beginning of str1, ignoring case */
274 static BOOL
msi_option_prefix(LPCWSTR str1
, LPCSTR str2
)
276 if (str1
[0] != '/' && str1
[0] != '-')
279 /* skip over the hyphen or slash */
280 return msi_strprefix(str1
+ 1, str2
);
283 static VOID
*LoadProc(LPCWSTR DllName
, LPCSTR ProcName
, HMODULE
* DllHandle
)
287 *DllHandle
= LoadLibraryExW(DllName
, NULL
, LOAD_WITH_ALTERED_SEARCH_PATH
);
290 fprintf(stderr
, "Unable to load dll %s\n", wine_dbgstr_w(DllName
));
293 proc
= (VOID
*) GetProcAddress(*DllHandle
, ProcName
);
296 fprintf(stderr
, "Dll %s does not implement function %s\n",
297 wine_dbgstr_w(DllName
), ProcName
);
298 FreeLibrary(*DllHandle
);
305 static DWORD
DoDllRegisterServer(LPCWSTR DllName
)
308 DLLREGISTERSERVER pfDllRegisterServer
= NULL
;
309 HMODULE DllHandle
= NULL
;
311 pfDllRegisterServer
= LoadProc(DllName
, "DllRegisterServer", &DllHandle
);
313 hr
= pfDllRegisterServer();
316 fprintf(stderr
, "Failed to register dll %s\n", wine_dbgstr_w(DllName
));
319 printf("Successfully registered dll %s\n", wine_dbgstr_w(DllName
));
321 FreeLibrary(DllHandle
);
325 static DWORD
DoDllUnregisterServer(LPCWSTR DllName
)
328 DLLUNREGISTERSERVER pfDllUnregisterServer
= NULL
;
329 HMODULE DllHandle
= NULL
;
331 pfDllUnregisterServer
= LoadProc(DllName
, "DllUnregisterServer", &DllHandle
);
333 hr
= pfDllUnregisterServer();
336 fprintf(stderr
, "Failed to unregister dll %s\n", wine_dbgstr_w(DllName
));
339 printf("Successfully unregistered dll %s\n", wine_dbgstr_w(DllName
));
341 FreeLibrary(DllHandle
);
345 static DWORD
DoRegServer(void)
347 static const WCHAR msiserverW
[] = {'M','S','I','S','e','r','v','e','r',0};
348 static const WCHAR msiexecW
[] = {'\\','m','s','i','e','x','e','c',' ','/','V',0};
349 SC_HANDLE scm
, service
;
350 WCHAR path
[MAX_PATH
+12];
353 if (!(scm
= OpenSCManagerW(NULL
, SERVICES_ACTIVE_DATABASEW
, SC_MANAGER_CREATE_SERVICE
)))
355 fprintf(stderr
, "Failed to open the service control manager.\n");
358 len
= GetSystemDirectoryW(path
, MAX_PATH
);
359 lstrcpyW(path
+ len
, msiexecW
);
360 if ((service
= CreateServiceW(scm
, msiserverW
, msiserverW
, GENERIC_ALL
,
361 SERVICE_WIN32_SHARE_PROCESS
, SERVICE_DEMAND_START
,
362 SERVICE_ERROR_NORMAL
, path
, NULL
, NULL
, NULL
, NULL
, NULL
)))
364 CloseServiceHandle(service
);
366 else if (GetLastError() != ERROR_SERVICE_EXISTS
)
368 fprintf(stderr
, "Failed to create MSI service\n");
371 CloseServiceHandle(scm
);
375 static DWORD
DoUnregServer(void)
377 static const WCHAR msiserverW
[] = {'M','S','I','S','e','r','v','e','r',0};
378 SC_HANDLE scm
, service
;
381 if (!(scm
= OpenSCManagerW(NULL
, SERVICES_ACTIVE_DATABASEW
, SC_MANAGER_CONNECT
)))
383 fprintf(stderr
, "Failed to open service control manager\n");
386 if ((service
= OpenServiceW(scm
, msiserverW
, DELETE
)))
388 if (!DeleteService(service
))
390 fprintf(stderr
, "Failed to delete MSI service\n");
393 CloseServiceHandle(service
);
395 else if (GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST
)
397 fprintf(stderr
, "Failed to open MSI service\n");
400 CloseServiceHandle(scm
);
404 static INT
DoEmbedding( LPWSTR key
)
406 printf("Remote custom actions are not supported yet\n");
411 * state machine to break up the command line properly
421 static int chomp( WCHAR
*str
)
423 enum chomp_state state
= cs_token
;
425 int count
= 1, ignore
;
427 for( p
= str
, out
= str
; *p
; p
++ )
455 state
= cs_whitespace
;
483 static void process_args( WCHAR
*cmdline
, int *pargc
, WCHAR
***pargv
)
485 WCHAR
**argv
, *p
= msi_strdup(cmdline
);
489 argv
= HeapAlloc(GetProcessHeap(), 0, sizeof (WCHAR
*)*(n
+1));
493 p
+= lstrlenW(p
) + 1;
501 static BOOL
process_args_from_reg( const WCHAR
*ident
, int *pargc
, WCHAR
***pargv
)
505 DWORD sz
= 0, type
= 0;
509 r
= RegOpenKeyW(HKEY_LOCAL_MACHINE
, InstallRunOnce
, &hkey
);
510 if(r
!= ERROR_SUCCESS
)
512 r
= RegQueryValueExW(hkey
, ident
, 0, &type
, 0, &sz
);
513 if(r
== ERROR_SUCCESS
&& type
== REG_SZ
)
515 int len
= lstrlenW( *pargv
[0] );
516 if (!(buf
= HeapAlloc( GetProcessHeap(), 0, sz
+ (len
+ 1) * sizeof(WCHAR
) )))
521 memcpy( buf
, *pargv
[0], len
* sizeof(WCHAR
) );
523 r
= RegQueryValueExW(hkey
, ident
, 0, &type
, (LPBYTE
)(buf
+ len
), &sz
);
524 if( r
== ERROR_SUCCESS
)
526 process_args(buf
, pargc
, pargv
);
529 HeapFree(GetProcessHeap(), 0, buf
);
535 int WINAPI
WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPSTR lpCmdLine
, int nCmdShow
)
538 BOOL FunctionInstall
= FALSE
;
539 BOOL FunctionInstallAdmin
= FALSE
;
540 BOOL FunctionRepair
= FALSE
;
541 BOOL FunctionAdvertise
= FALSE
;
542 BOOL FunctionPatch
= FALSE
;
543 BOOL FunctionDllRegisterServer
= FALSE
;
544 BOOL FunctionDllUnregisterServer
= FALSE
;
545 BOOL FunctionRegServer
= FALSE
;
546 BOOL FunctionUnregServer
= FALSE
;
547 BOOL FunctionServer
= FALSE
;
548 BOOL FunctionUnknown
= FALSE
;
550 LPWSTR PackageName
= NULL
;
551 LPWSTR Properties
= NULL
;
552 struct string_list
*property_list
= NULL
;
554 DWORD RepairMode
= 0;
556 DWORD_PTR AdvertiseMode
= 0;
557 struct string_list
*transform_list
= NULL
;
561 LPWSTR LogFileName
= NULL
;
562 DWORD LogAttributes
= 0;
564 LPWSTR PatchFileName
= NULL
;
565 INSTALLTYPE InstallType
= INSTALLTYPE_DEFAULT
;
567 INSTALLUILEVEL InstallUILevel
= INSTALLUILEVEL_FULL
;
569 LPWSTR DllName
= NULL
;
572 LPWSTR
*argvW
= NULL
;
574 /* parse the command line */
575 process_args( GetCommandLineW(), &argc
, &argvW
);
578 * If the args begin with /@ IDENT then we need to load the real
579 * command line out of the RunOnceEntries key in the registry.
580 * We do that before starting to process the real commandline,
581 * then overwrite the commandline again.
583 if(argc
>1 && msi_option_equal(argvW
[1], "@"))
585 if(!process_args_from_reg( argvW
[2], &argc
, &argvW
))
589 if (argc
== 3 && msi_option_equal(argvW
[1], "Embedding"))
590 return DoEmbedding( argvW
[2] );
592 for(i
= 1; i
< argc
; i
++)
594 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
596 if (msi_option_equal(argvW
[i
], "regserver"))
598 FunctionRegServer
= TRUE
;
600 else if (msi_option_equal(argvW
[i
], "unregserver") || msi_option_equal(argvW
[i
], "unregister")
601 || msi_option_equal(argvW
[i
], "unreg"))
603 FunctionUnregServer
= TRUE
;
605 else if(msi_option_prefix(argvW
[i
], "i") || msi_option_prefix(argvW
[i
], "package"))
607 LPWSTR argvWi
= argvW
[i
];
608 int argLen
= (msi_option_prefix(argvW
[i
], "i") ? 2 : 8);
609 FunctionInstall
= TRUE
;
610 if(lstrlenW(argvW
[i
]) > argLen
)
617 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
620 PackageName
= argvWi
;
622 else if(msi_option_equal(argvW
[i
], "a"))
624 FunctionInstall
= TRUE
;
625 FunctionInstallAdmin
= TRUE
;
626 InstallType
= INSTALLTYPE_NETWORK_IMAGE
;
630 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
631 PackageName
= argvW
[i
];
632 StringListAppend(&property_list
, ActionAdmin
);
633 WINE_FIXME("Administrative installs are not currently supported\n");
635 else if(msi_option_prefix(argvW
[i
], "f"))
638 int len
= lstrlenW(argvW
[i
]);
639 FunctionRepair
= TRUE
;
640 for(j
= 2; j
< len
; j
++)
646 RepairMode
|= REINSTALLMODE_FILEMISSING
;
650 RepairMode
|= REINSTALLMODE_FILEOLDERVERSION
;
654 RepairMode
|= REINSTALLMODE_FILEEQUALVERSION
;
658 RepairMode
|= REINSTALLMODE_FILEEXACT
;
662 RepairMode
|= REINSTALLMODE_FILEVERIFY
;
666 RepairMode
|= REINSTALLMODE_FILEREPLACE
;
670 RepairMode
|= REINSTALLMODE_USERDATA
;
674 RepairMode
|= REINSTALLMODE_MACHINEDATA
;
678 RepairMode
|= REINSTALLMODE_SHORTCUT
;
682 RepairMode
|= REINSTALLMODE_PACKAGE
;
685 fprintf(stderr
, "Unknown option \"%c\" in Repair mode\n", argvW
[i
][j
]);
691 RepairMode
= REINSTALLMODE_FILEMISSING
|
692 REINSTALLMODE_FILEEQUALVERSION
|
693 REINSTALLMODE_FILEVERIFY
|
694 REINSTALLMODE_MACHINEDATA
|
695 REINSTALLMODE_SHORTCUT
;
700 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
701 PackageName
= argvW
[i
];
703 else if(msi_option_prefix(argvW
[i
], "x") || msi_option_equal(argvW
[i
], "uninstall"))
705 FunctionInstall
= TRUE
;
706 if(msi_option_prefix(argvW
[i
], "x")) PackageName
= argvW
[i
]+2;
707 if(!PackageName
|| !PackageName
[0])
712 PackageName
= argvW
[i
];
714 WINE_TRACE("PackageName = %s\n", wine_dbgstr_w(PackageName
));
715 StringListAppend(&property_list
, RemoveAll
);
717 else if(msi_option_prefix(argvW
[i
], "j"))
720 int len
= lstrlenW(argvW
[i
]);
721 FunctionAdvertise
= TRUE
;
722 for(j
= 2; j
< len
; j
++)
728 AdvertiseMode
= ADVERTISEFLAGS_USERASSIGN
;
732 AdvertiseMode
= ADVERTISEFLAGS_MACHINEASSIGN
;
735 fprintf(stderr
, "Unknown option \"%c\" in Advertise mode\n", argvW
[i
][j
]);
742 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
743 PackageName
= argvW
[i
];
745 else if(msi_strequal(argvW
[i
], "u"))
747 FunctionAdvertise
= TRUE
;
748 AdvertiseMode
= ADVERTISEFLAGS_USERASSIGN
;
752 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
753 PackageName
= argvW
[i
];
755 else if(msi_strequal(argvW
[i
], "m"))
757 FunctionAdvertise
= TRUE
;
758 AdvertiseMode
= ADVERTISEFLAGS_MACHINEASSIGN
;
762 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
763 PackageName
= argvW
[i
];
765 else if(msi_option_equal(argvW
[i
], "t"))
770 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
771 StringListAppend(&transform_list
, argvW
[i
]);
773 else if(msi_option_equal(argvW
[i
], "g"))
778 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
779 Language
= msi_atou(argvW
[i
]);
781 else if(msi_option_prefix(argvW
[i
], "l"))
784 int len
= lstrlenW(argvW
[i
]);
785 for(j
= 2; j
< len
; j
++)
791 LogMode
|= INSTALLLOGMODE_INFO
;
795 LogMode
|= INSTALLLOGMODE_WARNING
;
799 LogMode
|= INSTALLLOGMODE_ERROR
;
803 LogMode
|= INSTALLLOGMODE_ACTIONSTART
;
807 LogMode
|= INSTALLLOGMODE_ACTIONDATA
;
811 LogMode
|= INSTALLLOGMODE_USER
;
815 LogMode
|= INSTALLLOGMODE_COMMONDATA
;
819 LogMode
|= INSTALLLOGMODE_FATALEXIT
;
823 LogMode
|= INSTALLLOGMODE_OUTOFDISKSPACE
;
827 LogMode
|= INSTALLLOGMODE_PROPERTYDUMP
;
831 LogMode
|= INSTALLLOGMODE_VERBOSE
;
834 LogMode
= INSTALLLOGMODE_FATALEXIT
|
835 INSTALLLOGMODE_ERROR
|
836 INSTALLLOGMODE_WARNING
|
837 INSTALLLOGMODE_USER
|
838 INSTALLLOGMODE_INFO
|
839 INSTALLLOGMODE_RESOLVESOURCE
|
840 INSTALLLOGMODE_OUTOFDISKSPACE
|
841 INSTALLLOGMODE_ACTIONSTART
|
842 INSTALLLOGMODE_ACTIONDATA
|
843 INSTALLLOGMODE_COMMONDATA
|
844 INSTALLLOGMODE_PROPERTYDUMP
|
845 INSTALLLOGMODE_PROGRESS
|
846 INSTALLLOGMODE_INITIALIZE
|
847 INSTALLLOGMODE_TERMINATE
|
848 INSTALLLOGMODE_SHOWDIALOG
;
851 LogAttributes
|= INSTALLLOGATTRIBUTES_APPEND
;
854 LogAttributes
|= INSTALLLOGATTRIBUTES_FLUSHEACHLINE
;
863 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
864 LogFileName
= argvW
[i
];
865 if(MsiEnableLogW(LogMode
, LogFileName
, LogAttributes
) != ERROR_SUCCESS
)
867 fprintf(stderr
, "Logging in %s (0x%08x, %u) failed\n",
868 wine_dbgstr_w(LogFileName
), LogMode
, LogAttributes
);
872 else if(msi_option_equal(argvW
[i
], "p"))
874 FunctionPatch
= TRUE
;
878 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
879 PatchFileName
= argvW
[i
];
881 else if(msi_option_prefix(argvW
[i
], "q"))
883 if(lstrlenW(argvW
[i
]) == 2 || msi_strequal(argvW
[i
]+2, "n") ||
884 msi_strequal(argvW
[i
] + 2, "uiet"))
886 InstallUILevel
= INSTALLUILEVEL_NONE
;
888 else if(msi_strequal(argvW
[i
]+2, "b"))
890 InstallUILevel
= INSTALLUILEVEL_BASIC
;
892 else if(msi_strequal(argvW
[i
]+2, "r"))
894 InstallUILevel
= INSTALLUILEVEL_REDUCED
;
896 else if(msi_strequal(argvW
[i
]+2, "f"))
898 InstallUILevel
= INSTALLUILEVEL_FULL
|INSTALLUILEVEL_ENDDIALOG
;
900 else if(msi_strequal(argvW
[i
]+2, "n+"))
902 InstallUILevel
= INSTALLUILEVEL_NONE
|INSTALLUILEVEL_ENDDIALOG
;
904 else if(msi_strequal(argvW
[i
]+2, "b+"))
906 InstallUILevel
= INSTALLUILEVEL_BASIC
|INSTALLUILEVEL_ENDDIALOG
;
908 else if(msi_strequal(argvW
[i
]+2, "b-"))
910 InstallUILevel
= INSTALLUILEVEL_BASIC
|INSTALLUILEVEL_PROGRESSONLY
;
912 else if(msi_strequal(argvW
[i
]+2, "b+!"))
914 InstallUILevel
= INSTALLUILEVEL_BASIC
|INSTALLUILEVEL_ENDDIALOG
;
915 WINE_FIXME("Unknown modifier: !\n");
917 else if(msi_strequal(argvW
[i
]+2, "b!"))
919 InstallUILevel
= INSTALLUILEVEL_BASIC
;
920 WINE_FIXME("Unknown modifier: !\n");
924 fprintf(stderr
, "Unknown option \"%s\" for UI level\n",
925 wine_dbgstr_w(argvW
[i
]+2));
928 else if(msi_option_equal(argvW
[i
], "y"))
930 FunctionDllRegisterServer
= TRUE
;
934 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
937 else if(msi_option_equal(argvW
[i
], "z"))
939 FunctionDllUnregisterServer
= TRUE
;
943 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
946 else if(msi_option_equal(argvW
[i
], "help") || msi_option_equal(argvW
[i
], "?"))
950 else if(msi_option_equal(argvW
[i
], "m"))
952 FunctionUnknown
= TRUE
;
953 WINE_FIXME("Unknown parameter /m\n");
955 else if(msi_option_equal(argvW
[i
], "D"))
957 FunctionUnknown
= TRUE
;
958 WINE_FIXME("Unknown parameter /D\n");
960 else if (msi_option_equal(argvW
[i
], "V"))
962 FunctionServer
= TRUE
;
965 StringListAppend(&property_list
, argvW
[i
]);
969 MsiSetInternalUI(InstallUILevel
, NULL
);
971 Properties
= build_properties( property_list
);
973 if(FunctionInstallAdmin
&& FunctionPatch
)
974 FunctionInstall
= FALSE
;
979 if(IsProductCode(PackageName
))
980 ReturnCode
= MsiConfigureProductExW(PackageName
, 0, INSTALLSTATE_DEFAULT
, Properties
);
982 ReturnCode
= MsiInstallProductW(PackageName
, Properties
);
984 else if(FunctionRepair
)
986 if(IsProductCode(PackageName
))
987 WINE_FIXME("Product code treatment not implemented yet\n");
989 ReturnCode
= MsiReinstallProductW(PackageName
, RepairMode
);
991 else if(FunctionAdvertise
)
993 LPWSTR Transforms
= build_transforms( property_list
);
994 ReturnCode
= MsiAdvertiseProductW(PackageName
, (LPWSTR
) AdvertiseMode
, Transforms
, Language
);
996 else if(FunctionPatch
)
998 ReturnCode
= MsiApplyPatchW(PatchFileName
, PackageName
, InstallType
, Properties
);
1000 else if(FunctionDllRegisterServer
)
1002 ReturnCode
= DoDllRegisterServer(DllName
);
1004 else if(FunctionDllUnregisterServer
)
1006 ReturnCode
= DoDllUnregisterServer(DllName
);
1008 else if (FunctionRegServer
)
1010 ReturnCode
= DoRegServer();
1012 else if (FunctionUnregServer
)
1014 ReturnCode
= DoUnregServer();
1016 else if (FunctionServer
)
1018 ReturnCode
= DoService();
1020 else if (FunctionUnknown
)
1022 WINE_FIXME( "Unknown function, ignoring\n" );