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 static LPWSTR
msi_strdup(LPCWSTR str
)
217 DWORD len
= lstrlenW(str
)+1;
218 LPWSTR ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
)*len
);
223 /* str1 is the same as str2, ignoring case */
224 static BOOL
msi_strequal(LPCWSTR str1
, LPCSTR str2
)
229 len
= MultiByteToWideChar( CP_ACP
, 0, str2
, -1, NULL
, 0);
232 if( lstrlenW(str1
) != (len
-1) )
234 strW
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
)*len
);
235 MultiByteToWideChar( CP_ACP
, 0, str2
, -1, strW
, len
);
236 ret
= CompareStringW(GetThreadLocale(), NORM_IGNORECASE
, str1
, len
, strW
, len
);
237 HeapFree(GetProcessHeap(), 0, strW
);
238 return (ret
== CSTR_EQUAL
);
241 /* prefix is hyphen or dash, and str1 is the same as str2, ignoring case */
242 static BOOL
msi_option_equal(LPCWSTR str1
, LPCSTR str2
)
244 if (str1
[0] != '/' && str1
[0] != '-')
247 /* skip over the hyphen or slash */
248 return msi_strequal(str1
+ 1, str2
);
251 /* str2 is at the beginning of str1, ignoring case */
252 static BOOL
msi_strprefix(LPCWSTR str1
, LPCSTR str2
)
257 len
= MultiByteToWideChar( CP_ACP
, 0, str2
, -1, NULL
, 0);
260 if( lstrlenW(str1
) < (len
-1) )
262 strW
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
)*len
);
263 MultiByteToWideChar( CP_ACP
, 0, str2
, -1, strW
, len
);
264 ret
= CompareStringW(GetThreadLocale(), NORM_IGNORECASE
, str1
, len
-1, strW
, len
-1);
265 HeapFree(GetProcessHeap(), 0, strW
);
266 return (ret
== CSTR_EQUAL
);
269 /* prefix is hyphen or dash, and str2 is at the beginning of str1, ignoring case */
270 static BOOL
msi_option_prefix(LPCWSTR str1
, LPCSTR str2
)
272 if (str1
[0] != '/' && str1
[0] != '-')
275 /* skip over the hyphen or slash */
276 return msi_strprefix(str1
+ 1, str2
);
279 static VOID
*LoadProc(LPCWSTR DllName
, LPCSTR ProcName
, HMODULE
* DllHandle
)
283 *DllHandle
= LoadLibraryExW(DllName
, NULL
, LOAD_WITH_ALTERED_SEARCH_PATH
);
286 fprintf(stderr
, "Unable to load dll %s\n", wine_dbgstr_w(DllName
));
289 proc
= (VOID
*) GetProcAddress(*DllHandle
, ProcName
);
292 fprintf(stderr
, "Dll %s does not implement function %s\n",
293 wine_dbgstr_w(DllName
), ProcName
);
294 FreeLibrary(*DllHandle
);
301 static DWORD
DoDllRegisterServer(LPCWSTR DllName
)
304 DLLREGISTERSERVER pfDllRegisterServer
= NULL
;
305 HMODULE DllHandle
= NULL
;
307 pfDllRegisterServer
= LoadProc(DllName
, "DllRegisterServer", &DllHandle
);
309 hr
= pfDllRegisterServer();
312 fprintf(stderr
, "Failed to register dll %s\n", wine_dbgstr_w(DllName
));
315 printf("Successfully registered dll %s\n", wine_dbgstr_w(DllName
));
317 FreeLibrary(DllHandle
);
321 static DWORD
DoDllUnregisterServer(LPCWSTR DllName
)
324 DLLUNREGISTERSERVER pfDllUnregisterServer
= NULL
;
325 HMODULE DllHandle
= NULL
;
327 pfDllUnregisterServer
= LoadProc(DllName
, "DllUnregisterServer", &DllHandle
);
329 hr
= pfDllUnregisterServer();
332 fprintf(stderr
, "Failed to unregister dll %s\n", wine_dbgstr_w(DllName
));
335 printf("Successfully unregistered dll %s\n", wine_dbgstr_w(DllName
));
337 FreeLibrary(DllHandle
);
341 static DWORD
DoRegServer(void)
343 static const WCHAR msiserverW
[] = {'M','S','I','S','e','r','v','e','r',0};
344 static const WCHAR msiexecW
[] = {'\\','m','s','i','e','x','e','c',' ','/','V',0};
345 SC_HANDLE scm
, service
;
346 WCHAR path
[MAX_PATH
+12];
349 if (!(scm
= OpenSCManagerW(NULL
, SERVICES_ACTIVE_DATABASEW
, SC_MANAGER_CREATE_SERVICE
)))
351 fprintf(stderr
, "Failed to open the service control manager.\n");
354 len
= GetSystemDirectoryW(path
, MAX_PATH
);
355 lstrcpyW(path
+ len
, msiexecW
);
356 if ((service
= CreateServiceW(scm
, msiserverW
, msiserverW
, GENERIC_ALL
,
357 SERVICE_WIN32_SHARE_PROCESS
, SERVICE_DEMAND_START
,
358 SERVICE_ERROR_NORMAL
, path
, NULL
, NULL
, NULL
, NULL
, NULL
)))
360 CloseServiceHandle(service
);
362 else if (GetLastError() != ERROR_SERVICE_EXISTS
)
364 fprintf(stderr
, "Failed to create MSI service\n");
367 CloseServiceHandle(scm
);
371 static DWORD
DoUnregServer(void)
373 static const WCHAR msiserverW
[] = {'M','S','I','S','e','r','v','e','r',0};
374 SC_HANDLE scm
, service
;
377 if (!(scm
= OpenSCManagerW(NULL
, SERVICES_ACTIVE_DATABASEW
, SC_MANAGER_CONNECT
)))
379 fprintf(stderr
, "Failed to open service control manager\n");
382 if ((service
= OpenServiceW(scm
, msiserverW
, DELETE
)))
384 if (!DeleteService(service
))
386 fprintf(stderr
, "Failed to delete MSI service\n");
389 CloseServiceHandle(service
);
391 else if (GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST
)
393 fprintf(stderr
, "Failed to open MSI service\n");
396 CloseServiceHandle(scm
);
400 static INT
DoEmbedding( LPWSTR key
)
402 printf("Remote custom actions are not supported yet\n");
407 * state machine to break up the command line properly
417 static int chomp( WCHAR
*str
)
419 enum chomp_state state
= cs_token
;
424 for( p
= str
, out
= str
; *p
; p
++ )
452 state
= cs_whitespace
;
480 static void process_args( WCHAR
*cmdline
, int *pargc
, WCHAR
***pargv
)
482 WCHAR
**argv
, *p
= msi_strdup(cmdline
);
486 argv
= HeapAlloc(GetProcessHeap(), 0, sizeof (WCHAR
*)*(n
+1));
490 p
+= lstrlenW(p
) + 1;
498 static BOOL
process_args_from_reg( const WCHAR
*ident
, int *pargc
, WCHAR
***pargv
)
502 DWORD sz
= 0, type
= 0;
506 r
= RegOpenKeyW(HKEY_LOCAL_MACHINE
, InstallRunOnce
, &hkey
);
507 if(r
!= ERROR_SUCCESS
)
509 r
= RegQueryValueExW(hkey
, ident
, 0, &type
, 0, &sz
);
510 if(r
== ERROR_SUCCESS
&& type
== REG_SZ
)
512 int len
= lstrlenW( *pargv
[0] );
513 if (!(buf
= HeapAlloc( GetProcessHeap(), 0, sz
+ (len
+ 1) * sizeof(WCHAR
) )))
518 memcpy( buf
, *pargv
[0], len
* sizeof(WCHAR
) );
520 r
= RegQueryValueExW(hkey
, ident
, 0, &type
, (LPBYTE
)(buf
+ len
), &sz
);
521 if( r
== ERROR_SUCCESS
)
523 process_args(buf
, pargc
, pargv
);
526 HeapFree(GetProcessHeap(), 0, buf
);
532 int WINAPI
WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPSTR lpCmdLine
, int nCmdShow
)
535 BOOL FunctionInstall
= FALSE
;
536 BOOL FunctionInstallAdmin
= FALSE
;
537 BOOL FunctionRepair
= FALSE
;
538 BOOL FunctionAdvertise
= FALSE
;
539 BOOL FunctionPatch
= FALSE
;
540 BOOL FunctionDllRegisterServer
= FALSE
;
541 BOOL FunctionDllUnregisterServer
= FALSE
;
542 BOOL FunctionRegServer
= FALSE
;
543 BOOL FunctionUnregServer
= FALSE
;
544 BOOL FunctionServer
= FALSE
;
545 BOOL FunctionUnknown
= FALSE
;
547 LPWSTR PackageName
= NULL
;
548 LPWSTR Properties
= NULL
;
549 struct string_list
*property_list
= NULL
;
551 DWORD RepairMode
= 0;
553 DWORD_PTR AdvertiseMode
= 0;
554 struct string_list
*transform_list
= NULL
;
558 LPWSTR LogFileName
= NULL
;
559 DWORD LogAttributes
= 0;
561 LPWSTR PatchFileName
= NULL
;
562 INSTALLTYPE InstallType
= INSTALLTYPE_DEFAULT
;
564 INSTALLUILEVEL InstallUILevel
= INSTALLUILEVEL_FULL
;
566 LPWSTR DllName
= NULL
;
569 LPWSTR
*argvW
= NULL
;
571 /* parse the command line */
572 process_args( GetCommandLineW(), &argc
, &argvW
);
575 * If the args begin with /@ IDENT then we need to load the real
576 * command line out of the RunOnceEntries key in the registry.
577 * We do that before starting to process the real commandline,
578 * then overwrite the commandline again.
580 if(argc
>1 && msi_option_equal(argvW
[1], "@"))
582 if(!process_args_from_reg( argvW
[2], &argc
, &argvW
))
586 if (argc
== 3 && msi_option_equal(argvW
[1], "Embedding"))
587 return DoEmbedding( argvW
[2] );
589 for(i
= 1; i
< argc
; i
++)
591 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
593 if (msi_option_equal(argvW
[i
], "regserver"))
595 FunctionRegServer
= TRUE
;
597 else if (msi_option_equal(argvW
[i
], "unregserver") || msi_option_equal(argvW
[i
], "unregister")
598 || msi_option_equal(argvW
[i
], "unreg"))
600 FunctionUnregServer
= TRUE
;
602 else if(msi_option_prefix(argvW
[i
], "i") || msi_option_prefix(argvW
[i
], "package"))
604 LPWSTR argvWi
= argvW
[i
];
605 int argLen
= (msi_option_prefix(argvW
[i
], "i") ? 2 : 8);
606 FunctionInstall
= TRUE
;
607 if(lstrlenW(argvW
[i
]) > argLen
)
614 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
617 PackageName
= argvWi
;
619 else if(msi_option_equal(argvW
[i
], "a"))
621 FunctionInstall
= TRUE
;
622 FunctionInstallAdmin
= TRUE
;
623 InstallType
= INSTALLTYPE_NETWORK_IMAGE
;
627 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
628 PackageName
= argvW
[i
];
629 StringListAppend(&property_list
, ActionAdmin
);
630 WINE_FIXME("Administrative installs are not currently supported\n");
632 else if(msi_option_prefix(argvW
[i
], "f"))
635 int len
= lstrlenW(argvW
[i
]);
636 FunctionRepair
= TRUE
;
637 for(j
= 2; j
< len
; j
++)
643 RepairMode
|= REINSTALLMODE_FILEMISSING
;
647 RepairMode
|= REINSTALLMODE_FILEOLDERVERSION
;
651 RepairMode
|= REINSTALLMODE_FILEEQUALVERSION
;
655 RepairMode
|= REINSTALLMODE_FILEEXACT
;
659 RepairMode
|= REINSTALLMODE_FILEVERIFY
;
663 RepairMode
|= REINSTALLMODE_FILEREPLACE
;
667 RepairMode
|= REINSTALLMODE_USERDATA
;
671 RepairMode
|= REINSTALLMODE_MACHINEDATA
;
675 RepairMode
|= REINSTALLMODE_SHORTCUT
;
679 RepairMode
|= REINSTALLMODE_PACKAGE
;
682 fprintf(stderr
, "Unknown option \"%c\" in Repair mode\n", argvW
[i
][j
]);
688 RepairMode
= REINSTALLMODE_FILEMISSING
|
689 REINSTALLMODE_FILEEQUALVERSION
|
690 REINSTALLMODE_FILEVERIFY
|
691 REINSTALLMODE_MACHINEDATA
|
692 REINSTALLMODE_SHORTCUT
;
697 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
698 PackageName
= argvW
[i
];
700 else if(msi_option_prefix(argvW
[i
], "x") || msi_option_equal(argvW
[i
], "uninstall"))
702 FunctionInstall
= TRUE
;
703 if(msi_option_prefix(argvW
[i
], "x")) PackageName
= argvW
[i
]+2;
704 if(!PackageName
|| !PackageName
[0])
709 PackageName
= argvW
[i
];
711 WINE_TRACE("PackageName = %s\n", wine_dbgstr_w(PackageName
));
712 StringListAppend(&property_list
, RemoveAll
);
714 else if(msi_option_prefix(argvW
[i
], "j"))
717 int len
= lstrlenW(argvW
[i
]);
718 FunctionAdvertise
= TRUE
;
719 for(j
= 2; j
< len
; j
++)
725 AdvertiseMode
= ADVERTISEFLAGS_USERASSIGN
;
729 AdvertiseMode
= ADVERTISEFLAGS_MACHINEASSIGN
;
732 fprintf(stderr
, "Unknown option \"%c\" in Advertise mode\n", argvW
[i
][j
]);
739 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
740 PackageName
= argvW
[i
];
742 else if(msi_strequal(argvW
[i
], "u"))
744 FunctionAdvertise
= TRUE
;
745 AdvertiseMode
= ADVERTISEFLAGS_USERASSIGN
;
749 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
750 PackageName
= argvW
[i
];
752 else if(msi_strequal(argvW
[i
], "m"))
754 FunctionAdvertise
= TRUE
;
755 AdvertiseMode
= ADVERTISEFLAGS_MACHINEASSIGN
;
759 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
760 PackageName
= argvW
[i
];
762 else if(msi_option_equal(argvW
[i
], "t"))
767 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
768 StringListAppend(&transform_list
, argvW
[i
]);
770 else if(msi_option_equal(argvW
[i
], "g"))
775 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
776 Language
= msi_atou(argvW
[i
]);
778 else if(msi_option_prefix(argvW
[i
], "l"))
781 int len
= lstrlenW(argvW
[i
]);
782 for(j
= 2; j
< len
; j
++)
788 LogMode
|= INSTALLLOGMODE_INFO
;
792 LogMode
|= INSTALLLOGMODE_WARNING
;
796 LogMode
|= INSTALLLOGMODE_ERROR
;
800 LogMode
|= INSTALLLOGMODE_ACTIONSTART
;
804 LogMode
|= INSTALLLOGMODE_ACTIONDATA
;
808 LogMode
|= INSTALLLOGMODE_USER
;
812 LogMode
|= INSTALLLOGMODE_COMMONDATA
;
816 LogMode
|= INSTALLLOGMODE_FATALEXIT
;
820 LogMode
|= INSTALLLOGMODE_OUTOFDISKSPACE
;
824 LogMode
|= INSTALLLOGMODE_PROPERTYDUMP
;
828 LogMode
|= INSTALLLOGMODE_VERBOSE
;
831 LogMode
= INSTALLLOGMODE_FATALEXIT
|
832 INSTALLLOGMODE_ERROR
|
833 INSTALLLOGMODE_WARNING
|
834 INSTALLLOGMODE_USER
|
835 INSTALLLOGMODE_INFO
|
836 INSTALLLOGMODE_RESOLVESOURCE
|
837 INSTALLLOGMODE_OUTOFDISKSPACE
|
838 INSTALLLOGMODE_ACTIONSTART
|
839 INSTALLLOGMODE_ACTIONDATA
|
840 INSTALLLOGMODE_COMMONDATA
|
841 INSTALLLOGMODE_PROPERTYDUMP
|
842 INSTALLLOGMODE_PROGRESS
|
843 INSTALLLOGMODE_INITIALIZE
|
844 INSTALLLOGMODE_TERMINATE
|
845 INSTALLLOGMODE_SHOWDIALOG
;
848 LogAttributes
|= INSTALLLOGATTRIBUTES_APPEND
;
851 LogAttributes
|= INSTALLLOGATTRIBUTES_FLUSHEACHLINE
;
860 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
861 LogFileName
= argvW
[i
];
862 if(MsiEnableLogW(LogMode
, LogFileName
, LogAttributes
) != ERROR_SUCCESS
)
864 fprintf(stderr
, "Logging in %s (0x%08x, %u) failed\n",
865 wine_dbgstr_w(LogFileName
), LogMode
, LogAttributes
);
869 else if(msi_option_equal(argvW
[i
], "p"))
871 FunctionPatch
= TRUE
;
875 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
876 PatchFileName
= argvW
[i
];
878 else if(msi_option_prefix(argvW
[i
], "q"))
880 if(lstrlenW(argvW
[i
]) == 2 || msi_strequal(argvW
[i
]+2, "n") ||
881 msi_strequal(argvW
[i
] + 2, "uiet"))
883 InstallUILevel
= INSTALLUILEVEL_NONE
;
885 else if(msi_strequal(argvW
[i
]+2, "b"))
887 InstallUILevel
= INSTALLUILEVEL_BASIC
;
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_strequal(argvW
[i
]+2, "b+"))
903 InstallUILevel
= INSTALLUILEVEL_BASIC
|INSTALLUILEVEL_ENDDIALOG
;
905 else if(msi_strequal(argvW
[i
]+2, "b-"))
907 InstallUILevel
= INSTALLUILEVEL_BASIC
|INSTALLUILEVEL_PROGRESSONLY
;
909 else if(msi_strequal(argvW
[i
]+2, "b+!"))
911 WINE_FIXME("Unhandled modifier: !\n");
912 InstallUILevel
= INSTALLUILEVEL_BASIC
|INSTALLUILEVEL_ENDDIALOG
|INSTALLUILEVEL_HIDECANCEL
;
914 else if(msi_strequal(argvW
[i
]+2, "b-!"))
916 WINE_FIXME("Unhandled modifier: !\n");
917 InstallUILevel
= INSTALLUILEVEL_BASIC
|INSTALLUILEVEL_PROGRESSONLY
|INSTALLUILEVEL_HIDECANCEL
;
919 else if(msi_strequal(argvW
[i
]+2, "b!"))
921 WINE_FIXME("Unhandled modifier: !\n");
922 InstallUILevel
= INSTALLUILEVEL_BASIC
|INSTALLUILEVEL_HIDECANCEL
;
926 fprintf(stderr
, "Unknown option \"%s\" for UI level\n",
927 wine_dbgstr_w(argvW
[i
]+2));
930 else if(msi_option_equal(argvW
[i
], "y"))
932 FunctionDllRegisterServer
= TRUE
;
936 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
939 else if(msi_option_equal(argvW
[i
], "z"))
941 FunctionDllUnregisterServer
= TRUE
;
945 WINE_TRACE("argvW[%d] = %s\n", i
, wine_dbgstr_w(argvW
[i
]));
948 else if(msi_option_equal(argvW
[i
], "help") || msi_option_equal(argvW
[i
], "?"))
952 else if(msi_option_equal(argvW
[i
], "m"))
954 FunctionUnknown
= TRUE
;
955 WINE_FIXME("Unknown parameter /m\n");
957 else if(msi_option_equal(argvW
[i
], "D"))
959 FunctionUnknown
= TRUE
;
960 WINE_FIXME("Unknown parameter /D\n");
962 else if (msi_option_equal(argvW
[i
], "V"))
964 FunctionServer
= TRUE
;
967 StringListAppend(&property_list
, argvW
[i
]);
971 MsiSetInternalUI(InstallUILevel
, NULL
);
973 Properties
= build_properties( property_list
);
975 if(FunctionInstallAdmin
&& FunctionPatch
)
976 FunctionInstall
= FALSE
;
981 if(IsProductCode(PackageName
))
982 ReturnCode
= MsiConfigureProductExW(PackageName
, 0, INSTALLSTATE_DEFAULT
, Properties
);
984 ReturnCode
= MsiInstallProductW(PackageName
, Properties
);
986 else if(FunctionRepair
)
988 if(IsProductCode(PackageName
))
989 WINE_FIXME("Product code treatment not implemented yet\n");
991 ReturnCode
= MsiReinstallProductW(PackageName
, RepairMode
);
993 else if(FunctionAdvertise
)
995 LPWSTR Transforms
= build_transforms( property_list
);
996 ReturnCode
= MsiAdvertiseProductW(PackageName
, (LPWSTR
) AdvertiseMode
, Transforms
, Language
);
998 else if(FunctionPatch
)
1000 ReturnCode
= MsiApplyPatchW(PatchFileName
, PackageName
, InstallType
, Properties
);
1002 else if(FunctionDllRegisterServer
)
1004 ReturnCode
= DoDllRegisterServer(DllName
);
1006 else if(FunctionDllUnregisterServer
)
1008 ReturnCode
= DoDllUnregisterServer(DllName
);
1010 else if (FunctionRegServer
)
1012 ReturnCode
= DoRegServer();
1014 else if (FunctionUnregServer
)
1016 ReturnCode
= DoUnregServer();
1018 else if (FunctionServer
)
1020 ReturnCode
= DoService();
1022 else if (FunctionUnknown
)
1024 WINE_FIXME( "Unknown function, ignoring\n" );