22#define WIN32_LEAN_AND_MEAN
34DEFINE_GUID(
GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
67 WCHAR msiexec_version[40];
85 WINE_ERR(
"MsiGetFileVersion failed with %ld\n",
res);
92 msiexec_help =
malloc((
len + 1) *
sizeof(
WCHAR) +
sizeof(msiexec_version));
93 if (msi_res && msiexec_help) {
216 while(*
str >=
'0' && *
str <=
'9')
246 if (str1[0] !=
'/' && str1[0] !=
'-')
274 if (str1[0] !=
'/' && str1[0] !=
'-')
309 pfDllRegisterServer =
LoadProc(DllName,
"DllRegisterServer", &DllHandle);
311 hr = pfDllRegisterServer();
329 pfDllUnregisterServer =
LoadProc(DllName,
"DllUnregisterServer", &DllHandle);
331 hr = pfDllUnregisterServer();
345 SC_HANDLE scm, service;
351 report_error(
"Failed to open the service control manager.\n");
373 SC_HANDLE scm, service;
378 report_error(
"Failed to open service control manager\n");
431 ERR(
"Failed to create custom action server pipe: %lu\n",
GetLastError());
456 ERR(
"Failed to write to custom action server pipe: %lu\n",
GetLastError());
461 ERR(
"Failed to read from custom action server pipe: %lu\n",
GetLastError());
484 for (
p =
in; *
p;
p++)
516 if (
p >
in &&
p[-1] ==
'"')
536 if (!ignore &&
out) *
out++ = *
p;
580 L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\RunOnceEntries", &hkey);
640 BOOL FunctionDllUnregisterServer =
FALSE;
650 DWORD RepairMode = 0;
658 DWORD LogAttributes = 0;
697 FunctionRegServer =
TRUE;
702 FunctionUnregServer =
TRUE;
708 FunctionInstall =
TRUE;
719 PackageName = argvWi;
723 FunctionInstall =
TRUE;
724 FunctionInstallAdmin =
TRUE;
730 PackageName = argvW[
i];
732 WINE_FIXME(
"Administrative installs are not currently supported\n");
738 FunctionRepair =
TRUE;
784 report_error(
"Unknown option \"%c\" in Repair mode\n", argvW[
i][
j]);
800 PackageName = argvW[
i];
804 FunctionInstall =
TRUE;
806 if(!PackageName || !PackageName[0])
811 PackageName = argvW[
i];
820 FunctionAdvertise =
TRUE;
834 report_error(
"Unknown option \"%c\" in Advertise mode\n", argvW[
i][
j]);
842 PackageName = argvW[
i];
846 FunctionAdvertise =
TRUE;
852 PackageName = argvW[
i];
856 FunctionAdvertise =
TRUE;
862 PackageName = argvW[
i];
973 FunctionPatch =
TRUE;
978 PatchFileName = argvW[
i];
1033 FunctionDllRegisterServer =
TRUE;
1042 FunctionDllUnregisterServer =
TRUE;
1055 FunctionUnknown =
TRUE;
1060 FunctionUnknown =
TRUE;
1065 FunctionServer =
TRUE;
1076 if(FunctionInstallAdmin && FunctionPatch)
1077 FunctionInstall =
FALSE;
1094 else if(FunctionRepair)
1097 WINE_FIXME(
"Product code treatment not implemented yet\n");
1108 else if(FunctionAdvertise)
1113 else if(FunctionPatch)
1115 ReturnCode =
MsiApplyPatchW(PatchFileName, PackageName, InstallType, Properties);
1117 else if(FunctionDllRegisterServer)
1121 else if(FunctionDllUnregisterServer)
1125 else if (FunctionRegServer)
1129 else if (FunctionUnregServer)
1133 else if (FunctionServer)
1137 else if (FunctionUnknown)
1139 WINE_FIXME(
"Unknown function, ignoring\n" );
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define RegCloseKey(hKey)
VOID WINAPI InitCommonControls(void)
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
#define ReadFile(a, b, c, d, e)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define MultiByteToWideChar
static const WCHAR *const ext[]
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
VOID WINAPI ExitProcess(IN UINT uExitCode)
LPWSTR WINAPI GetCommandLineW(VOID)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
LCID WINAPI GetThreadLocale(void)
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
LANGID WINAPI GetUserDefaultLangID(void)
UINT WINAPI MsiGetFileVersionW(const WCHAR *path, WCHAR *verbuf, DWORD *verlen, WCHAR *langbuf, DWORD *langlen)
UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState, LPCWSTR szCommandLine)
UINT WINAPI MsiMessageBoxW(HWND hWnd, const WCHAR *lpText, const WCHAR *lpCaption, UINT uType, WORD wLanguageId, DWORD f)
UINT WINAPI MsiEnableLogW(DWORD dwLogMode, const WCHAR *szLogFile, DWORD attributes)
UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine)
UINT WINAPI MsiMessageBoxA(HWND hWnd, const char *lpText, const char *lpCaption, UINT uType, WORD wLanguageId, DWORD f)
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
UINT WINAPI MsiAdvertiseProductW(LPCWSTR szPackagePath, LPCWSTR szScriptfilePath, LPCWSTR szTransforms, LANGID lgidLanguage)
UINT WINAPI MsiApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szInstallPackage, INSTALLTYPE eInstallType, LPCWSTR szCommandLine)
UINT WINAPI MsiReinstallProductW(const WCHAR *szProduct, DWORD dwReinstallMode)
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLdouble GLdouble GLdouble r
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
#define memcpy(s1, s2, n)
#define ERROR_FILE_NOT_FOUND
enum tagINSTALLTYPE INSTALLTYPE
@ INSTALLLOGATTRIBUTES_FLUSHEACHLINE
@ INSTALLLOGATTRIBUTES_APPEND
@ ADVERTISEFLAGS_USERASSIGN
@ ADVERTISEFLAGS_MACHINEASSIGN
@ INSTALLLOGMODE_ACTIONDATA
@ INSTALLLOGMODE_ACTIONSTART
@ INSTALLLOGMODE_FATALEXIT
@ INSTALLLOGMODE_PROPERTYDUMP
@ INSTALLLOGMODE_RESOLVESOURCE
@ INSTALLLOGMODE_COMMONDATA
@ INSTALLLOGMODE_INITIALIZE
@ INSTALLLOGMODE_TERMINATE
@ INSTALLLOGMODE_OUTOFDISKSPACE
@ INSTALLLOGMODE_PROGRESS
@ INSTALLLOGMODE_SHOWDIALOG
@ INSTALLTYPE_NETWORK_IMAGE
@ REINSTALLMODE_MACHINEDATA
@ REINSTALLMODE_FILEREPLACE
@ REINSTALLMODE_FILEOLDERVERSION
@ REINSTALLMODE_FILEEXACT
@ REINSTALLMODE_FILEEQUALVERSION
@ REINSTALLMODE_FILEVERIFY
@ REINSTALLMODE_FILEMISSING
enum tagINSTALLUILEVEL INSTALLUILEVEL
@ INSTALLUILEVEL_ENDDIALOG
@ INSTALLUILEVEL_HIDECANCEL
@ INSTALLUILEVEL_PROGRESSONLY
static BOOL IsProductCode(LPWSTR str)
HRESULT(WINAPI * DLLUNREGISTERSERVER)(void)
static BOOL msi_strprefix(LPCWSTR str1, LPCSTR str2)
static DWORD DoUnregServer(void)
static DWORD DoDllRegisterServer(LPCWSTR DllName)
void report_error(const char *msg,...)
static void ShowUsage(int ExitCode)
static VOID * LoadProc(LPCWSTR DllName, LPCSTR ProcName, HMODULE *DllHandle)
static int chomp(const WCHAR *in, WCHAR *out)
static LPWSTR build_transforms(struct string_list *transform_list)
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
static int custom_action_server(const WCHAR *arg)
UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid)
static BOOL msi_strequal(LPCWSTR str1, LPCSTR str2)
static LPWSTR build_properties(struct string_list *property_list)
static WCHAR * get_path_with_extension(const WCHAR *package_name)
static BOOL msi_option_prefix(LPCWSTR str1, LPCSTR str2)
static VOID StringListAppend(struct string_list **list, LPCWSTR str)
static BOOL msi_option_equal(LPCWSTR str1, LPCSTR str2)
static DWORD DoDllUnregisterServer(LPCWSTR DllName)
static void process_args(WCHAR *cmdline, int *pargc, WCHAR ***pargv)
static DWORD DoRegServer(void)
static DWORD CALLBACK custom_action_thread(void *arg)
HRESULT(WINAPI * DLLREGISTERSERVER)(void)
static BOOL process_args_from_reg(const WCHAR *ident, int *pargc, WCHAR ***pargv)
static DWORD msi_atou(LPCWSTR str)
_Must_inspect_result_ _In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_opt_ PUNICODE_STRING LogFileName
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#define IsEqualGUID(rguid1, rguid2)
BOOL WINAPI DeleteService(SC_HANDLE hService)
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
SC_HANDLE WINAPI CreateServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, LPCWSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword)
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
struct string_list * next
#define FIELD_OFFSET(t, f)
DWORD WINAPI GetLastError(void)
#define LOAD_WITH_ALTERED_SEARCH_PATH
_In_ ULONG _In_ ULONG_PTR ident
#define ERROR_SERVICE_DOES_NOT_EXIST
#define ERROR_SERVICE_EXISTS
#define HKEY_LOCAL_MACHINE
#define SC_MANAGER_CREATE_SERVICE
#define SC_MANAGER_CONNECT
#define SERVICES_ACTIVE_DATABASEW
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SERVICE_DEMAND_START
#define SERVICE_WIN32_SHARE_PROCESS
#define SERVICE_ERROR_NORMAL