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
;
428 for( p
= str
, out
= str
; *p
; p
++ )
456 state
= cs_whitespace
;
484 static void process_args( WCHAR
*cmdline
, int *pargc
, WCHAR
***pargv
)
486 WCHAR
**argv
, *p
= msi_strdup(cmdline
);
490 argv
= HeapAlloc(GetProcessHeap(), 0, sizeof (WCHAR
*)*(n
+1));
494 p
+= lstrlenW(p
) + 1;
502 static BOOL
process_args_from_reg( const WCHAR
*ident
, int *pargc
, WCHAR
***pargv
)
506 DWORD sz
= 0, type
= 0;
510 r
= RegOpenKeyW(HKEY_LOCAL_MACHINE
, InstallRunOnce
, &hkey
);
511 if(r
!= ERROR_SUCCESS
)
513 r
= RegQueryValueExW(hkey
, ident
, 0, &type
, 0, &sz
);
514 if(r
== ERROR_SUCCESS
&& type
== REG_SZ
)
516 int len
= lstrlenW( *pargv
[0] );
517 if (!(buf
= HeapAlloc( GetProcessHeap(), 0, sz
+ (len
+ 1) * sizeof(WCHAR
) )))
522 memcpy( buf
, *pargv
[0], len
* sizeof(WCHAR
) );
524 r
= RegQueryValueExW(hkey
, ident
, 0, &type
, (LPBYTE
)(buf
+ len
), &sz
);
525 if( r
== ERROR_SUCCESS
)
527 process_args(buf
, pargc
, pargv
);
530 HeapFree(GetProcessHeap(), 0, buf
);
536 int WINAPI
WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPSTR lpCmdLine
, int nCmdShow
)
539 BOOL FunctionInstall
= FALSE
;
540 BOOL FunctionInstallAdmin
= FALSE
;
541 BOOL FunctionRepair
= FALSE
;
542 BOOL FunctionAdvertise
= FALSE
;
543 BOOL FunctionPatch
= FALSE
;
544 BOOL FunctionDllRegisterServer
= FALSE
;
545 BOOL FunctionDllUnregisterServer
= FALSE
;
546 BOOL FunctionRegServer
= FALSE
;
547 BOOL FunctionUnregServer
= FALSE
;
548 BOOL FunctionServer
= FALSE
;
549 BOOL FunctionUnknown
= FALSE
;
551 LPWSTR PackageName
= NULL
;
552 LPWSTR Properties
= NULL
;
553 struct string_list
*property_list
= NULL
;
555 DWORD RepairMode
= 0;
557 DWORD_PTR AdvertiseMode
= 0;
558 struct string_list
*transform_list
= NULL
;
562 LPWSTR LogFileName
= NULL
;
563 DWORD LogAttributes
= 0;
565 LPWSTR PatchFileName
= NULL
;
566 INSTALLTYPE InstallType
= INSTALLTYPE_DEFAULT
;
568 INSTALLUILEVEL InstallUILevel
= INSTALLUILEVEL_FULL
;
570 LPWSTR DllName
= NULL
;
573 LPWSTR
*argvW
= NULL
;
575 /* parse the command line */
576 process_args( GetCommandLineW(), &argc
, &argvW
);
579 * If the args begin with /@ IDENT then we need to load the real
580 * command line out of the RunOnceEntries key in the registry.
581 * We do that before starting to process the real commandline,
582 * then overwrite the commandline again.
584 if(argc
>1 && msi_option_equal(argvW
[1], "@"))
586 if(!process_args_from_reg( argvW
[2], &argc
, &argvW
))
590 if (argc
== 3 && msi_option_equal(argvW
[1], "Embedding"))
591 return DoEmbedding( argvW
[2] );
593 for(i
= 1; i
< argc
; i
++)
595 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
597 if (msi_option_equal(argvW
[i
], "regserver"))
599 FunctionRegServer
= TRUE
;
601 else if (msi_option_equal(argvW
[i
], "unregserver") || msi_option_equal(argvW
[i
], "unregister")
602 || msi_option_equal(argvW
[i
], "unreg"))
604 FunctionUnregServer
= TRUE
;
606 else if(msi_option_prefix(argvW
[i
], "i") || msi_option_prefix(argvW
[i
], "package"))
608 LPWSTR argvWi
= argvW
[i
];
609 int argLen
= (msi_option_prefix(argvW
[i
], "i") ? 2 : 8);
610 FunctionInstall
= TRUE
;
611 if(lstrlenW(argvW
[i
]) > argLen
)
618 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
621 PackageName
= argvWi
;
623 else if(msi_option_equal(argvW
[i
], "a"))
625 FunctionInstall
= TRUE
;
626 FunctionInstallAdmin
= TRUE
;
627 InstallType
= INSTALLTYPE_NETWORK_IMAGE
;
631 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
632 PackageName
= argvW
[i
];
633 StringListAppend(&property_list
, ActionAdmin
);
634 WINE_FIXME("Administrative installs are not currently supported\n");
636 else if(msi_option_prefix(argvW
[i
], "f"))
639 int len
= lstrlenW(argvW
[i
]);
640 FunctionRepair
= TRUE
;
641 for(j
= 2; j
< len
; j
++)
647 RepairMode
|= REINSTALLMODE_FILEMISSING
;
651 RepairMode
|= REINSTALLMODE_FILEOLDERVERSION
;
655 RepairMode
|= REINSTALLMODE_FILEEQUALVERSION
;
659 RepairMode
|= REINSTALLMODE_FILEEXACT
;
663 RepairMode
|= REINSTALLMODE_FILEVERIFY
;
667 RepairMode
|= REINSTALLMODE_FILEREPLACE
;
671 RepairMode
|= REINSTALLMODE_USERDATA
;
675 RepairMode
|= REINSTALLMODE_MACHINEDATA
;
679 RepairMode
|= REINSTALLMODE_SHORTCUT
;
683 RepairMode
|= REINSTALLMODE_PACKAGE
;
686 fprintf(stderr
, "Unknown option \"%c\" in Repair mode\n", argvW
[i
][j
]);
692 RepairMode
= REINSTALLMODE_FILEMISSING
|
693 REINSTALLMODE_FILEEQUALVERSION
|
694 REINSTALLMODE_FILEVERIFY
|
695 REINSTALLMODE_MACHINEDATA
|
696 REINSTALLMODE_SHORTCUT
;
701 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
702 PackageName
= argvW
[i
];
704 else if(msi_option_prefix(argvW
[i
], "x") || msi_option_equal(argvW
[i
], "uninstall"))
706 FunctionInstall
= TRUE
;
707 if(msi_option_prefix(argvW
[i
], "x")) PackageName
= argvW
[i
]+2;
708 if(!PackageName
|| !PackageName
[0])
713 PackageName
= argvW
[i
];
715 WINE_TRACE("PackageName = %s\n", wine_dbgstr_w(PackageName
));
716 StringListAppend(&property_list
, RemoveAll
);
718 else if(msi_option_prefix(argvW
[i
], "j"))
721 int len
= lstrlenW(argvW
[i
]);
722 FunctionAdvertise
= TRUE
;
723 for(j
= 2; j
< len
; j
++)
729 AdvertiseMode
= ADVERTISEFLAGS_USERASSIGN
;
733 AdvertiseMode
= ADVERTISEFLAGS_MACHINEASSIGN
;
736 fprintf(stderr
, "Unknown option \"%c\" in Advertise mode\n", argvW
[i
][j
]);
743 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
744 PackageName
= argvW
[i
];
746 else if(msi_strequal(argvW
[i
], "u"))
748 FunctionAdvertise
= TRUE
;
749 AdvertiseMode
= ADVERTISEFLAGS_USERASSIGN
;
753 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
754 PackageName
= argvW
[i
];
756 else if(msi_strequal(argvW
[i
], "m"))
758 FunctionAdvertise
= TRUE
;
759 AdvertiseMode
= ADVERTISEFLAGS_MACHINEASSIGN
;
763 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
764 PackageName
= argvW
[i
];
766 else if(msi_option_equal(argvW
[i
], "t"))
771 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
772 StringListAppend(&transform_list
, argvW
[i
]);
774 else if(msi_option_equal(argvW
[i
], "g"))
779 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
780 Language
= msi_atou(argvW
[i
]);
782 else if(msi_option_prefix(argvW
[i
], "l"))
785 int len
= lstrlenW(argvW
[i
]);
786 for(j
= 2; j
< len
; j
++)
792 LogMode
|= INSTALLLOGMODE_INFO
;
796 LogMode
|= INSTALLLOGMODE_WARNING
;
800 LogMode
|= INSTALLLOGMODE_ERROR
;
804 LogMode
|= INSTALLLOGMODE_ACTIONSTART
;
808 LogMode
|= INSTALLLOGMODE_ACTIONDATA
;
812 LogMode
|= INSTALLLOGMODE_USER
;
816 LogMode
|= INSTALLLOGMODE_COMMONDATA
;
820 LogMode
|= INSTALLLOGMODE_FATALEXIT
;
824 LogMode
|= INSTALLLOGMODE_OUTOFDISKSPACE
;
828 LogMode
|= INSTALLLOGMODE_PROPERTYDUMP
;
832 LogMode
|= INSTALLLOGMODE_VERBOSE
;
835 LogMode
= INSTALLLOGMODE_FATALEXIT
|
836 INSTALLLOGMODE_ERROR
|
837 INSTALLLOGMODE_WARNING
|
838 INSTALLLOGMODE_USER
|
839 INSTALLLOGMODE_INFO
|
840 INSTALLLOGMODE_RESOLVESOURCE
|
841 INSTALLLOGMODE_OUTOFDISKSPACE
|
842 INSTALLLOGMODE_ACTIONSTART
|
843 INSTALLLOGMODE_ACTIONDATA
|
844 INSTALLLOGMODE_COMMONDATA
|
845 INSTALLLOGMODE_PROPERTYDUMP
|
846 INSTALLLOGMODE_PROGRESS
|
847 INSTALLLOGMODE_INITIALIZE
|
848 INSTALLLOGMODE_TERMINATE
|
849 INSTALLLOGMODE_SHOWDIALOG
;
852 LogAttributes
|= INSTALLLOGATTRIBUTES_APPEND
;
855 LogAttributes
|= INSTALLLOGATTRIBUTES_FLUSHEACHLINE
;
864 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
865 LogFileName
= argvW
[i
];
866 if(MsiEnableLogW(LogMode
, LogFileName
, LogAttributes
) != ERROR_SUCCESS
)
868 fprintf(stderr
, "Logging in %s (0x%08x, %u) failed\n",
869 wine_dbgstr_w(LogFileName
), LogMode
, LogAttributes
);
873 else if(msi_option_equal(argvW
[i
], "p") || msi_option_equal(argvW
[i
], "update"))
875 FunctionPatch
= TRUE
;
879 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
880 PatchFileName
= argvW
[i
];
882 else if(msi_option_prefix(argvW
[i
], "q"))
884 if(lstrlenW(argvW
[i
]) == 2 || msi_strequal(argvW
[i
]+2, "n") ||
885 msi_strequal(argvW
[i
] + 2, "uiet"))
887 InstallUILevel
= INSTALLUILEVEL_NONE
;
889 else if(msi_strequal(argvW
[i
]+2, "r"))
891 InstallUILevel
= INSTALLUILEVEL_REDUCED
;
893 else if(msi_strequal(argvW
[i
]+2, "f"))
895 InstallUILevel
= INSTALLUILEVEL_FULL
|INSTALLUILEVEL_ENDDIALOG
;
897 else if(msi_strequal(argvW
[i
]+2, "n+"))
899 InstallUILevel
= INSTALLUILEVEL_NONE
|INSTALLUILEVEL_ENDDIALOG
;
901 else if(msi_strprefix(argvW
[i
]+2, "b"))
903 const WCHAR
*ptr
= argvW
[i
] + 3;
905 InstallUILevel
= INSTALLUILEVEL_BASIC
;
909 if (msi_strprefix(ptr
, "+"))
910 InstallUILevel
|= INSTALLUILEVEL_ENDDIALOG
;
911 if (msi_strprefix(ptr
, "-"))
912 InstallUILevel
|= INSTALLUILEVEL_PROGRESSONLY
;
913 if (msi_strprefix(ptr
, "!"))
915 WINE_FIXME("Unhandled modifier: !\n");
916 InstallUILevel
|= INSTALLUILEVEL_HIDECANCEL
;
923 fprintf(stderr
, "Unknown option \"%s\" for UI level\n",
924 wine_dbgstr_w(argvW
[i
]+2));
927 else if(msi_option_equal(argvW
[i
], "passive"))
929 static const WCHAR rebootpromptW
[] =
930 {'R','E','B','O','O','T','P','R','O','M','P','T','=','"','S','"',0};
932 InstallUILevel
= INSTALLUILEVEL_BASIC
|INSTALLUILEVEL_PROGRESSONLY
|INSTALLUILEVEL_HIDECANCEL
;
933 StringListAppend(&property_list
, rebootpromptW
);
935 else if(msi_option_equal(argvW
[i
], "y"))
937 FunctionDllRegisterServer
= TRUE
;
941 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
944 else if(msi_option_equal(argvW
[i
], "z"))
946 FunctionDllUnregisterServer
= TRUE
;
950 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
953 else if(msi_option_equal(argvW
[i
], "help") || msi_option_equal(argvW
[i
], "?"))
957 else if(msi_option_equal(argvW
[i
], "m"))
959 FunctionUnknown
= TRUE
;
960 WINE_FIXME("Unknown parameter /m\n");
962 else if(msi_option_equal(argvW
[i
], "D"))
964 FunctionUnknown
= TRUE
;
965 WINE_FIXME("Unknown parameter /D\n");
967 else if (msi_option_equal(argvW
[i
], "V"))
969 FunctionServer
= TRUE
;
972 StringListAppend(&property_list
, argvW
[i
]);
976 MsiSetInternalUI(InstallUILevel
, NULL
);
978 Properties
= build_properties( property_list
);
980 if(FunctionInstallAdmin
&& FunctionPatch
)
981 FunctionInstall
= FALSE
;
986 if(IsProductCode(PackageName
))
987 ReturnCode
= MsiConfigureProductExW(PackageName
, 0, INSTALLSTATE_DEFAULT
, Properties
);
989 ReturnCode
= MsiInstallProductW(PackageName
, Properties
);
991 else if(FunctionRepair
)
993 if(IsProductCode(PackageName
))
994 WINE_FIXME("Product code treatment not implemented yet\n");
996 ReturnCode
= MsiReinstallProductW(PackageName
, RepairMode
);
998 else if(FunctionAdvertise
)
1000 LPWSTR Transforms
= build_transforms( property_list
);
1001 ReturnCode
= MsiAdvertiseProductW(PackageName
, (LPWSTR
) AdvertiseMode
, Transforms
, Language
);
1003 else if(FunctionPatch
)
1005 ReturnCode
= MsiApplyPatchW(PatchFileName
, PackageName
, InstallType
, Properties
);
1007 else if(FunctionDllRegisterServer
)
1009 ReturnCode
= DoDllRegisterServer(DllName
);
1011 else if(FunctionDllUnregisterServer
)
1013 ReturnCode
= DoDllUnregisterServer(DllName
);
1015 else if (FunctionRegServer
)
1017 ReturnCode
= DoRegServer();
1019 else if (FunctionUnregServer
)
1021 ReturnCode
= DoUnregServer();
1023 else if (FunctionServer
)
1025 ReturnCode
= DoService();
1027 else if (FunctionUnknown
)
1029 WINE_FIXME( "Unknown function, ignoring\n" );