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
29 #include <wine/unicode.h>
31 typedef HRESULT (WINAPI
*DLLREGISTERSERVER
)(void);
32 typedef HRESULT (WINAPI
*DLLUNREGISTERSERVER
)(void);
34 DWORD
DoService(void);
38 struct string_list
*next
;
42 static const WCHAR ActionAdmin
[] = {
43 'A','C','T','I','O','N','=','A','D','M','I','N',0 };
44 static const WCHAR RemoveAll
[] = {
45 'R','E','M','O','V','E','=','A','L','L',0 };
47 static const WCHAR InstallRunOnce
[] = {
48 'S','o','f','t','w','a','r','e','\\',
49 'M','i','c','r','o','s','o','f','t','\\',
50 'W','i','n','d','o','w','s','\\',
51 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
52 'I','n','s','t','a','l','l','e','r','\\',
53 'R','u','n','O','n','c','e','E','n','t','r','i','e','s',0};
55 static void ShowUsage(int ExitCode
)
57 WCHAR msiexec_version
[40];
58 WCHAR filename
[MAX_PATH
];
61 HMODULE hmsi
= GetModuleHandleA("msi.dll");
65 /* MsiGetFileVersion need the full path */
67 res
= GetModuleFileNameW(hmsi
, filename
, sizeof(filename
) / sizeof(filename
[0]));
69 WINE_ERR("GetModuleFileName failed: %d\n", GetLastError());
71 len
= sizeof(msiexec_version
) / sizeof(msiexec_version
[0]);
73 res
= MsiGetFileVersionW(filename
, msiexec_version
, &len
, NULL
, NULL
);
75 WINE_ERR("MsiGetFileVersion failed with %d\n", res
);
77 /* Return the length of the resource.
78 No typo: The LPWSTR parameter must be a LPWSTR * for this mode */
79 len
= LoadStringW(hmsi
, 10, (LPWSTR
) &msi_res
, 0);
81 msi_res
= HeapAlloc(GetProcessHeap(), 0, (len
+ 1) * sizeof(WCHAR
));
82 msiexec_help
= HeapAlloc(GetProcessHeap(), 0, (len
+ 1) * sizeof(WCHAR
) + sizeof(msiexec_version
));
83 if (msi_res
&& msiexec_help
) {
85 LoadStringW(hmsi
, 10, msi_res
, len
+ 1);
87 sprintfW(msiexec_help
, msi_res
, msiexec_version
);
88 MsiMessageBoxW(0, msiexec_help
, NULL
, 0, GetUserDefaultLangID(), 0);
90 HeapFree(GetProcessHeap(), 0, msi_res
);
91 HeapFree(GetProcessHeap(), 0, msiexec_help
);
92 ExitProcess(ExitCode
);
95 static BOOL
IsProductCode(LPWSTR str
)
99 if(lstrlenW(str
) != 38)
101 return ( (CLSIDFromString(str
, &ProductCode
) == NOERROR
) );
105 static VOID
StringListAppend(struct string_list
**list
, LPCWSTR str
)
107 struct string_list
*entry
;
109 entry
= HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(struct string_list
, str
[lstrlenW(str
) + 1]));
112 WINE_ERR("Out of memory!\n");
115 lstrcpyW(entry
->str
, str
);
119 * Ignoring o(n^2) time complexity to add n strings for simplicity,
120 * add the string to the end of the list to preserve the order.
123 list
= &(*list
)->next
;
127 static LPWSTR
build_properties(struct string_list
*property_list
)
129 struct string_list
*list
;
130 LPWSTR ret
, p
, value
;
137 /* count the space we need */
139 for(list
= property_list
; list
; list
= list
->next
)
140 len
+= lstrlenW(list
->str
) + 3;
142 ret
= HeapAlloc( GetProcessHeap(), 0, len
*sizeof(WCHAR
) );
144 /* add a space before each string, and quote the value */
146 for(list
= property_list
; list
; list
= list
->next
)
148 value
= strchrW(list
->str
,'=');
151 len
= value
- list
->str
;
153 memcpy(p
, list
->str
, len
* sizeof(WCHAR
));
157 /* check if the value contains spaces and maybe quote it */
159 needs_quote
= strchrW(value
,' ') ? 1 : 0;
162 len
= lstrlenW(value
);
163 memcpy(p
, value
, len
* sizeof(WCHAR
));
170 WINE_TRACE("properties -> %s\n", wine_dbgstr_w(ret
) );
175 static LPWSTR
build_transforms(struct string_list
*transform_list
)
177 struct string_list
*list
;
181 /* count the space we need */
183 for(list
= transform_list
; list
; list
= list
->next
)
184 len
+= lstrlenW(list
->str
) + 1;
186 ret
= HeapAlloc( GetProcessHeap(), 0, len
*sizeof(WCHAR
) );
188 /* add all the transforms with a semicolon between each one */
190 for(list
= transform_list
; list
; list
= list
->next
)
192 len
= lstrlenW(list
->str
);
193 lstrcpynW(p
, list
->str
, len
);
203 static DWORD
msi_atou(LPCWSTR str
)
206 while(*str
>= '0' && *str
<= '9')
215 /* str1 is the same as str2, ignoring case */
216 static BOOL
msi_strequal(LPCWSTR str1
, LPCSTR str2
)
221 len
= MultiByteToWideChar( CP_ACP
, 0, str2
, -1, NULL
, 0);
224 if( lstrlenW(str1
) != (len
-1) )
226 strW
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
)*len
);
227 MultiByteToWideChar( CP_ACP
, 0, str2
, -1, strW
, len
);
228 ret
= CompareStringW(GetThreadLocale(), NORM_IGNORECASE
, str1
, len
, strW
, len
);
229 HeapFree(GetProcessHeap(), 0, strW
);
230 return (ret
== CSTR_EQUAL
);
233 /* prefix is hyphen or dash, and str1 is the same as str2, ignoring case */
234 static BOOL
msi_option_equal(LPCWSTR str1
, LPCSTR str2
)
236 if (str1
[0] != '/' && str1
[0] != '-')
239 /* skip over the hyphen or slash */
240 return msi_strequal(str1
+ 1, str2
);
243 /* str2 is at the beginning of str1, ignoring case */
244 static BOOL
msi_strprefix(LPCWSTR str1
, LPCSTR str2
)
249 len
= MultiByteToWideChar( CP_ACP
, 0, str2
, -1, NULL
, 0);
252 if( lstrlenW(str1
) < (len
-1) )
254 strW
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
)*len
);
255 MultiByteToWideChar( CP_ACP
, 0, str2
, -1, strW
, len
);
256 ret
= CompareStringW(GetThreadLocale(), NORM_IGNORECASE
, str1
, len
-1, strW
, len
-1);
257 HeapFree(GetProcessHeap(), 0, strW
);
258 return (ret
== CSTR_EQUAL
);
261 /* prefix is hyphen or dash, and str2 is at the beginning of str1, ignoring case */
262 static BOOL
msi_option_prefix(LPCWSTR str1
, LPCSTR str2
)
264 if (str1
[0] != '/' && str1
[0] != '-')
267 /* skip over the hyphen or slash */
268 return msi_strprefix(str1
+ 1, str2
);
271 static VOID
*LoadProc(LPCWSTR DllName
, LPCSTR ProcName
, HMODULE
* DllHandle
)
275 *DllHandle
= LoadLibraryExW(DllName
, NULL
, LOAD_WITH_ALTERED_SEARCH_PATH
);
278 fprintf(stderr
, "Unable to load dll %s\n", wine_dbgstr_w(DllName
));
281 proc
= (VOID
*) GetProcAddress(*DllHandle
, ProcName
);
284 fprintf(stderr
, "Dll %s does not implement function %s\n",
285 wine_dbgstr_w(DllName
), ProcName
);
286 FreeLibrary(*DllHandle
);
293 static DWORD
DoDllRegisterServer(LPCWSTR DllName
)
296 DLLREGISTERSERVER pfDllRegisterServer
= NULL
;
297 HMODULE DllHandle
= NULL
;
299 pfDllRegisterServer
= LoadProc(DllName
, "DllRegisterServer", &DllHandle
);
301 hr
= pfDllRegisterServer();
304 fprintf(stderr
, "Failed to register dll %s\n", wine_dbgstr_w(DllName
));
307 printf("Successfully registered dll %s\n", wine_dbgstr_w(DllName
));
309 FreeLibrary(DllHandle
);
313 static DWORD
DoDllUnregisterServer(LPCWSTR DllName
)
316 DLLUNREGISTERSERVER pfDllUnregisterServer
= NULL
;
317 HMODULE DllHandle
= NULL
;
319 pfDllUnregisterServer
= LoadProc(DllName
, "DllUnregisterServer", &DllHandle
);
321 hr
= pfDllUnregisterServer();
324 fprintf(stderr
, "Failed to unregister dll %s\n", wine_dbgstr_w(DllName
));
327 printf("Successfully unregistered dll %s\n", wine_dbgstr_w(DllName
));
329 FreeLibrary(DllHandle
);
333 static DWORD
DoRegServer(void)
335 static const WCHAR msiserverW
[] = {'M','S','I','S','e','r','v','e','r',0};
336 static const WCHAR msiexecW
[] = {'\\','m','s','i','e','x','e','c',' ','/','V',0};
337 SC_HANDLE scm
, service
;
338 WCHAR path
[MAX_PATH
+12];
341 if (!(scm
= OpenSCManagerW(NULL
, SERVICES_ACTIVE_DATABASEW
, SC_MANAGER_CREATE_SERVICE
)))
343 fprintf(stderr
, "Failed to open the service control manager.\n");
346 len
= GetSystemDirectoryW(path
, MAX_PATH
);
347 lstrcpyW(path
+ len
, msiexecW
);
348 if ((service
= CreateServiceW(scm
, msiserverW
, msiserverW
, GENERIC_ALL
,
349 SERVICE_WIN32_SHARE_PROCESS
, SERVICE_DEMAND_START
,
350 SERVICE_ERROR_NORMAL
, path
, NULL
, NULL
, NULL
, NULL
, NULL
)))
352 CloseServiceHandle(service
);
354 else if (GetLastError() != ERROR_SERVICE_EXISTS
)
356 fprintf(stderr
, "Failed to create MSI service\n");
359 CloseServiceHandle(scm
);
363 static DWORD
DoUnregServer(void)
365 static const WCHAR msiserverW
[] = {'M','S','I','S','e','r','v','e','r',0};
366 SC_HANDLE scm
, service
;
369 if (!(scm
= OpenSCManagerW(NULL
, SERVICES_ACTIVE_DATABASEW
, SC_MANAGER_CONNECT
)))
371 fprintf(stderr
, "Failed to open service control manager\n");
374 if ((service
= OpenServiceW(scm
, msiserverW
, DELETE
)))
376 if (!DeleteService(service
))
378 fprintf(stderr
, "Failed to delete MSI service\n");
381 CloseServiceHandle(service
);
383 else if (GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST
)
385 fprintf(stderr
, "Failed to open MSI service\n");
388 CloseServiceHandle(scm
);
392 static INT
DoEmbedding( LPWSTR key
)
394 printf("Remote custom actions are not supported yet\n");
399 * state machine to break up the command line properly
409 static int chomp( const WCHAR
*in
, WCHAR
*out
)
411 enum chomp_state state
= CS_TOKEN
;
416 for (p
= in
; *p
; p
++)
444 state
= CS_WHITESPACE
;
448 if (p
> in
&& p
[-1] == '"')
468 if (!ignore
&& out
) *out
++ = *p
;
474 static void process_args( WCHAR
*cmdline
, int *pargc
, WCHAR
***pargv
)
482 count
= chomp( cmdline
, NULL
);
483 if (!(p
= HeapAlloc( GetProcessHeap(), 0, (lstrlenW(cmdline
) + count
+ 1) * sizeof(WCHAR
) )))
486 count
= chomp( cmdline
, p
);
487 if (!(argv
= HeapAlloc( GetProcessHeap(), 0, (count
+ 1) * sizeof(WCHAR
*) )))
489 HeapFree( GetProcessHeap(), 0, p
);
492 for (i
= 0; i
< count
; i
++)
495 p
+= lstrlenW( p
) + 1;
503 static BOOL
process_args_from_reg( const WCHAR
*ident
, int *pargc
, WCHAR
***pargv
)
507 DWORD sz
= 0, type
= 0;
511 r
= RegOpenKeyW(HKEY_LOCAL_MACHINE
, InstallRunOnce
, &hkey
);
512 if(r
!= ERROR_SUCCESS
)
514 r
= RegQueryValueExW(hkey
, ident
, 0, &type
, 0, &sz
);
515 if(r
== ERROR_SUCCESS
&& type
== REG_SZ
)
517 int len
= lstrlenW( *pargv
[0] );
518 if (!(buf
= HeapAlloc( GetProcessHeap(), 0, sz
+ (len
+ 1) * sizeof(WCHAR
) )))
523 memcpy( buf
, *pargv
[0], len
* sizeof(WCHAR
) );
525 r
= RegQueryValueExW(hkey
, ident
, 0, &type
, (LPBYTE
)(buf
+ len
), &sz
);
526 if( r
== ERROR_SUCCESS
)
528 process_args(buf
, pargc
, pargv
);
531 HeapFree(GetProcessHeap(), 0, buf
);
537 int WINAPI
WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPSTR lpCmdLine
, int nCmdShow
)
540 BOOL FunctionInstall
= FALSE
;
541 BOOL FunctionInstallAdmin
= FALSE
;
542 BOOL FunctionRepair
= FALSE
;
543 BOOL FunctionAdvertise
= FALSE
;
544 BOOL FunctionPatch
= FALSE
;
545 BOOL FunctionDllRegisterServer
= FALSE
;
546 BOOL FunctionDllUnregisterServer
= FALSE
;
547 BOOL FunctionRegServer
= FALSE
;
548 BOOL FunctionUnregServer
= FALSE
;
549 BOOL FunctionServer
= FALSE
;
550 BOOL FunctionUnknown
= FALSE
;
552 LPWSTR PackageName
= NULL
;
553 LPWSTR Properties
= NULL
;
554 struct string_list
*property_list
= NULL
;
556 DWORD RepairMode
= 0;
558 DWORD_PTR AdvertiseMode
= 0;
559 struct string_list
*transform_list
= NULL
;
563 LPWSTR LogFileName
= NULL
;
564 DWORD LogAttributes
= 0;
566 LPWSTR PatchFileName
= NULL
;
567 INSTALLTYPE InstallType
= INSTALLTYPE_DEFAULT
;
569 INSTALLUILEVEL InstallUILevel
= INSTALLUILEVEL_FULL
;
571 LPWSTR DllName
= NULL
;
574 LPWSTR
*argvW
= NULL
;
576 /* parse the command line */
577 process_args( GetCommandLineW(), &argc
, &argvW
);
580 * If the args begin with /@ IDENT then we need to load the real
581 * command line out of the RunOnceEntries key in the registry.
582 * We do that before starting to process the real commandline,
583 * then overwrite the commandline again.
585 if(argc
>1 && msi_option_equal(argvW
[1], "@"))
587 if(!process_args_from_reg( argvW
[2], &argc
, &argvW
))
591 if (argc
== 3 && msi_option_equal(argvW
[1], "Embedding"))
592 return DoEmbedding( argvW
[2] );
594 for(i
= 1; i
< argc
; i
++)
596 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
598 if (msi_option_equal(argvW
[i
], "regserver"))
600 FunctionRegServer
= TRUE
;
602 else if (msi_option_equal(argvW
[i
], "unregserver") || msi_option_equal(argvW
[i
], "unregister")
603 || msi_option_equal(argvW
[i
], "unreg"))
605 FunctionUnregServer
= TRUE
;
607 else if(msi_option_prefix(argvW
[i
], "i") || msi_option_prefix(argvW
[i
], "package"))
609 LPWSTR argvWi
= argvW
[i
];
610 int argLen
= (msi_option_prefix(argvW
[i
], "i") ? 2 : 8);
611 FunctionInstall
= TRUE
;
612 if(lstrlenW(argvW
[i
]) > argLen
)
619 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
622 PackageName
= argvWi
;
624 else if(msi_option_equal(argvW
[i
], "a"))
626 FunctionInstall
= TRUE
;
627 FunctionInstallAdmin
= TRUE
;
628 InstallType
= INSTALLTYPE_NETWORK_IMAGE
;
632 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
633 PackageName
= argvW
[i
];
634 StringListAppend(&property_list
, ActionAdmin
);
635 WINE_FIXME("Administrative installs are not currently supported\n");
637 else if(msi_option_prefix(argvW
[i
], "f"))
640 int len
= lstrlenW(argvW
[i
]);
641 FunctionRepair
= TRUE
;
642 for(j
= 2; j
< len
; j
++)
648 RepairMode
|= REINSTALLMODE_FILEMISSING
;
652 RepairMode
|= REINSTALLMODE_FILEOLDERVERSION
;
656 RepairMode
|= REINSTALLMODE_FILEEQUALVERSION
;
660 RepairMode
|= REINSTALLMODE_FILEEXACT
;
664 RepairMode
|= REINSTALLMODE_FILEVERIFY
;
668 RepairMode
|= REINSTALLMODE_FILEREPLACE
;
672 RepairMode
|= REINSTALLMODE_USERDATA
;
676 RepairMode
|= REINSTALLMODE_MACHINEDATA
;
680 RepairMode
|= REINSTALLMODE_SHORTCUT
;
684 RepairMode
|= REINSTALLMODE_PACKAGE
;
687 fprintf(stderr
, "Unknown option \"%c\" in Repair mode\n", argvW
[i
][j
]);
693 RepairMode
= REINSTALLMODE_FILEMISSING
|
694 REINSTALLMODE_FILEEQUALVERSION
|
695 REINSTALLMODE_FILEVERIFY
|
696 REINSTALLMODE_MACHINEDATA
|
697 REINSTALLMODE_SHORTCUT
;
702 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
703 PackageName
= argvW
[i
];
705 else if(msi_option_prefix(argvW
[i
], "x") || msi_option_equal(argvW
[i
], "uninstall"))
707 FunctionInstall
= TRUE
;
708 if(msi_option_prefix(argvW
[i
], "x")) PackageName
= argvW
[i
]+2;
709 if(!PackageName
|| !PackageName
[0])
714 PackageName
= argvW
[i
];
716 WINE_TRACE("PackageName = %s\n", wine_dbgstr_w(PackageName
));
717 StringListAppend(&property_list
, RemoveAll
);
719 else if(msi_option_prefix(argvW
[i
], "j"))
722 int len
= lstrlenW(argvW
[i
]);
723 FunctionAdvertise
= TRUE
;
724 for(j
= 2; j
< len
; j
++)
730 AdvertiseMode
= ADVERTISEFLAGS_USERASSIGN
;
734 AdvertiseMode
= ADVERTISEFLAGS_MACHINEASSIGN
;
737 fprintf(stderr
, "Unknown option \"%c\" in Advertise mode\n", argvW
[i
][j
]);
744 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
745 PackageName
= argvW
[i
];
747 else if(msi_strequal(argvW
[i
], "u"))
749 FunctionAdvertise
= TRUE
;
750 AdvertiseMode
= ADVERTISEFLAGS_USERASSIGN
;
754 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
755 PackageName
= argvW
[i
];
757 else if(msi_strequal(argvW
[i
], "m"))
759 FunctionAdvertise
= TRUE
;
760 AdvertiseMode
= ADVERTISEFLAGS_MACHINEASSIGN
;
764 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
765 PackageName
= argvW
[i
];
767 else if(msi_option_equal(argvW
[i
], "t"))
772 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
773 StringListAppend(&transform_list
, argvW
[i
]);
775 else if(msi_option_equal(argvW
[i
], "g"))
780 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
781 Language
= msi_atou(argvW
[i
]);
783 else if(msi_option_prefix(argvW
[i
], "l"))
786 int len
= lstrlenW(argvW
[i
]);
787 for(j
= 2; j
< len
; j
++)
793 LogMode
|= INSTALLLOGMODE_INFO
;
797 LogMode
|= INSTALLLOGMODE_WARNING
;
801 LogMode
|= INSTALLLOGMODE_ERROR
;
805 LogMode
|= INSTALLLOGMODE_ACTIONSTART
;
809 LogMode
|= INSTALLLOGMODE_ACTIONDATA
;
813 LogMode
|= INSTALLLOGMODE_USER
;
817 LogMode
|= INSTALLLOGMODE_COMMONDATA
;
821 LogMode
|= INSTALLLOGMODE_FATALEXIT
;
825 LogMode
|= INSTALLLOGMODE_OUTOFDISKSPACE
;
829 LogMode
|= INSTALLLOGMODE_PROPERTYDUMP
;
833 LogMode
|= INSTALLLOGMODE_VERBOSE
;
836 LogMode
= INSTALLLOGMODE_FATALEXIT
|
837 INSTALLLOGMODE_ERROR
|
838 INSTALLLOGMODE_WARNING
|
839 INSTALLLOGMODE_USER
|
840 INSTALLLOGMODE_INFO
|
841 INSTALLLOGMODE_RESOLVESOURCE
|
842 INSTALLLOGMODE_OUTOFDISKSPACE
|
843 INSTALLLOGMODE_ACTIONSTART
|
844 INSTALLLOGMODE_ACTIONDATA
|
845 INSTALLLOGMODE_COMMONDATA
|
846 INSTALLLOGMODE_PROPERTYDUMP
|
847 INSTALLLOGMODE_PROGRESS
|
848 INSTALLLOGMODE_INITIALIZE
|
849 INSTALLLOGMODE_TERMINATE
|
850 INSTALLLOGMODE_SHOWDIALOG
;
853 LogAttributes
|= INSTALLLOGATTRIBUTES_APPEND
;
856 LogAttributes
|= INSTALLLOGATTRIBUTES_FLUSHEACHLINE
;
865 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
866 LogFileName
= argvW
[i
];
867 if(MsiEnableLogW(LogMode
, LogFileName
, LogAttributes
) != ERROR_SUCCESS
)
869 fprintf(stderr
, "Logging in %s (0x%08x, %u) failed\n",
870 wine_dbgstr_w(LogFileName
), LogMode
, LogAttributes
);
874 else if(msi_option_equal(argvW
[i
], "p") || msi_option_equal(argvW
[i
], "update"))
876 FunctionPatch
= TRUE
;
880 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
881 PatchFileName
= argvW
[i
];
883 else if(msi_option_prefix(argvW
[i
], "q"))
885 if(lstrlenW(argvW
[i
]) == 2 || msi_strequal(argvW
[i
]+2, "n") ||
886 msi_strequal(argvW
[i
] + 2, "uiet"))
888 InstallUILevel
= INSTALLUILEVEL_NONE
;
890 else if(msi_strequal(argvW
[i
]+2, "r"))
892 InstallUILevel
= INSTALLUILEVEL_REDUCED
;
894 else if(msi_strequal(argvW
[i
]+2, "f"))
896 InstallUILevel
= INSTALLUILEVEL_FULL
|INSTALLUILEVEL_ENDDIALOG
;
898 else if(msi_strequal(argvW
[i
]+2, "n+"))
900 InstallUILevel
= INSTALLUILEVEL_NONE
|INSTALLUILEVEL_ENDDIALOG
;
902 else if(msi_strprefix(argvW
[i
]+2, "b"))
904 const WCHAR
*ptr
= argvW
[i
] + 3;
906 InstallUILevel
= INSTALLUILEVEL_BASIC
;
910 if (msi_strprefix(ptr
, "+"))
911 InstallUILevel
|= INSTALLUILEVEL_ENDDIALOG
;
912 if (msi_strprefix(ptr
, "-"))
913 InstallUILevel
|= INSTALLUILEVEL_PROGRESSONLY
;
914 if (msi_strprefix(ptr
, "!"))
916 WINE_FIXME("Unhandled modifier: !\n");
917 InstallUILevel
|= INSTALLUILEVEL_HIDECANCEL
;
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
], "passive"))
930 static const WCHAR rebootpromptW
[] =
931 {'R','E','B','O','O','T','P','R','O','M','P','T','=','"','S','"',0};
933 InstallUILevel
= INSTALLUILEVEL_BASIC
|INSTALLUILEVEL_PROGRESSONLY
|INSTALLUILEVEL_HIDECANCEL
;
934 StringListAppend(&property_list
, rebootpromptW
);
936 else if(msi_option_equal(argvW
[i
], "y"))
938 FunctionDllRegisterServer
= TRUE
;
942 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
945 else if(msi_option_equal(argvW
[i
], "z"))
947 FunctionDllUnregisterServer
= TRUE
;
951 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
954 else if(msi_option_equal(argvW
[i
], "help") || msi_option_equal(argvW
[i
], "?"))
958 else if(msi_option_equal(argvW
[i
], "m"))
960 FunctionUnknown
= TRUE
;
961 WINE_FIXME("Unknown parameter /m\n");
963 else if(msi_option_equal(argvW
[i
], "D"))
965 FunctionUnknown
= TRUE
;
966 WINE_FIXME("Unknown parameter /D\n");
968 else if (msi_option_equal(argvW
[i
], "V"))
970 FunctionServer
= TRUE
;
973 StringListAppend(&property_list
, argvW
[i
]);
977 MsiSetInternalUI(InstallUILevel
, NULL
);
979 Properties
= build_properties( property_list
);
981 if(FunctionInstallAdmin
&& FunctionPatch
)
982 FunctionInstall
= FALSE
;
987 if(IsProductCode(PackageName
))
988 ReturnCode
= MsiConfigureProductExW(PackageName
, 0, INSTALLSTATE_DEFAULT
, Properties
);
990 ReturnCode
= MsiInstallProductW(PackageName
, Properties
);
992 else if(FunctionRepair
)
994 if(IsProductCode(PackageName
))
995 WINE_FIXME("Product code treatment not implemented yet\n");
997 ReturnCode
= MsiReinstallProductW(PackageName
, RepairMode
);
999 else if(FunctionAdvertise
)
1001 LPWSTR Transforms
= build_transforms( property_list
);
1002 ReturnCode
= MsiAdvertiseProductW(PackageName
, (LPWSTR
) AdvertiseMode
, Transforms
, Language
);
1004 else if(FunctionPatch
)
1006 ReturnCode
= MsiApplyPatchW(PatchFileName
, PackageName
, InstallType
, Properties
);
1008 else if(FunctionDllRegisterServer
)
1010 ReturnCode
= DoDllRegisterServer(DllName
);
1012 else if(FunctionDllUnregisterServer
)
1014 ReturnCode
= DoDllUnregisterServer(DllName
);
1016 else if (FunctionRegServer
)
1018 ReturnCode
= DoRegServer();
1020 else if (FunctionUnregServer
)
1022 ReturnCode
= DoUnregServer();
1024 else if (FunctionServer
)
1026 ReturnCode
= DoService();
1028 else if (FunctionUnknown
)
1030 WINE_FIXME( "Unknown function, ignoring\n" );