From 3496689a89c645c9bd9d3172d5297e40e4d7c6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20B=C3=A9ron?= Date: Mon, 19 Jul 2004 19:44:07 +0000 Subject: [PATCH] First draft for a msiexec.exe replacement. --- configure | 3 +- configure.ac | 1 + programs/Makefile.in | 7 + programs/msiexec/.cvsignore | 2 + programs/msiexec/Makefile.in | 14 ++ programs/msiexec/msiexec.c | 325 +++++++++++++++++++++++++++++++++++ programs/msiexec/msiexec.h | 43 +++++ 7 files changed, 394 insertions(+), 1 deletion(-) create mode 100644 programs/msiexec/.cvsignore create mode 100644 programs/msiexec/Makefile.in create mode 100644 programs/msiexec/msiexec.c create mode 100644 programs/msiexec/msiexec.h diff --git a/configure b/configure index c4c731e289c..4846875c218 100755 --- a/configure +++ b/configure @@ -20183,7 +20183,7 @@ MAKE_LIB_RULES=libs/Makelib.rules MAKE_PROG_RULES=programs/Makeprog.rules - ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile" + ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile" cat >confcache <<\_ACEOF @@ -20915,6 +20915,7 @@ do "programs/cmdlgtst/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/cmdlgtst/Makefile" ;; "programs/control/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/control/Makefile" ;; "programs/expand/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/expand/Makefile" ;; + "programs/msiexec/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/msiexec/Makefile" ;; "programs/notepad/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/notepad/Makefile" ;; "programs/progman/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/progman/Makefile" ;; "programs/regedit/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/regedit/Makefile" ;; diff --git a/configure.ac b/configure.ac index 5f3c8f685f5..9dff3a5dea0 100644 --- a/configure.ac +++ b/configure.ac @@ -1699,6 +1699,7 @@ programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile +programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile diff --git a/programs/Makefile.in b/programs/Makefile.in index ea88b5f6c25..622c0c7a47c 100644 --- a/programs/Makefile.in +++ b/programs/Makefile.in @@ -11,6 +11,7 @@ SUBDIRS = \ cmdlgtst \ control \ expand \ + msiexec \ notepad \ progman \ regedit \ @@ -42,6 +43,7 @@ INSTALLSUBDIRS = \ clock \ control \ expand \ + msiexec \ notepad \ progman \ regedit \ @@ -93,6 +95,7 @@ SYMLINKS = \ control.exe \ expand.exe \ icinfo.exe \ + msiexec.exe \ notepad.exe \ progman.exe \ regedit.exe \ @@ -182,6 +185,9 @@ expand.exe$(DLLEXT): expand/expand.exe$(DLLEXT) icinfo.exe$(DLLEXT): avitools/icinfo.exe$(DLLEXT) $(RM) $@ && $(LN_S) avitools/icinfo.exe$(DLLEXT) $@ +msiexec.exe$(DLLEXT): msiexec/msiexec.exe$(DLLEXT) + $(RM) $@ && $(LN_S) msiexec/msiexec.exe$(DLLEXT) $@ + notepad.exe$(DLLEXT): notepad/notepad.exe$(DLLEXT) $(RM) $@ && $(LN_S) notepad/notepad.exe$(DLLEXT) $@ @@ -261,6 +267,7 @@ cmdlgtst/cmdlgtst.exe$(DLLEXT): cmdlgtst control/control.exe$(DLLEXT): control expand/expand.exe$(DLLEXT): expand avitools/icinfo.exe$(DLLEXT): avitools +msiexec/msiexec.exe$(DLLEXT): msiexec notepad/notepad.exe$(DLLEXT): notepad progman/progman.exe$(DLLEXT): progman regedit/regedit.exe$(DLLEXT): regedit diff --git a/programs/msiexec/.cvsignore b/programs/msiexec/.cvsignore new file mode 100644 index 00000000000..b108954393a --- /dev/null +++ b/programs/msiexec/.cvsignore @@ -0,0 +1,2 @@ +Makefile +msiexec.exe.dbg.c diff --git a/programs/msiexec/Makefile.in b/programs/msiexec/Makefile.in new file mode 100644 index 00000000000..2562abee8e2 --- /dev/null +++ b/programs/msiexec/Makefile.in @@ -0,0 +1,14 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = msiexec.exe +APPMODE = -mconsole +IMPORTS = msi ole32 user32 kernel32 + +C_SRCS = \ + msiexec.c + +@MAKE_PROG_RULES@ + +### Dependencies: diff --git a/programs/msiexec/msiexec.c b/programs/msiexec/msiexec.c new file mode 100644 index 00000000000..a01cbb56741 --- /dev/null +++ b/programs/msiexec/msiexec.c @@ -0,0 +1,325 @@ +/* + * msiexec.exe implementation + * + * Copyright 2004 Vincent Béron + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#include "msiexec.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msiexec); + +static const char UsageStr[] = +"Usage: msiexec ...\n\n" +"Copyright 2004 Vincent Béron\n"; + +static const char ActionAdmin[] = "ACTION=ADMIN "; +static const char RemoveAll[] = "REMOVE=ALL "; + +static void ShowUsage(int ExitCode) +{ + printf(UsageStr); + ExitProcess(ExitCode); +} + +static BOOL GetProductCode(LPCSTR str, LPGUID guid) +{ + BOOL ret = FALSE; + int len = 0; + LPWSTR wstr = NULL; + + if(strlen(str) == 38) + { + len = MultiByteToWideChar(CP_ACP, 0, str, -1, wstr, 0); + wstr = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); + ret = (CLSIDFromString(wstr, guid) == NOERROR); + HeapFree(GetProcessHeap(), 0, wstr); + wstr = NULL; + } + + return ret; +} + +static VOID *LoadProc(LPCSTR DllName, LPCSTR ProcName, HMODULE* DllHandle) +{ + VOID* (*proc)(void); + + *DllHandle = LoadLibraryExA(DllName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + if(!*DllHandle) + { + fprintf(stderr, "Unable to load dll %s\n", DllName); + ExitProcess(1); + } + proc = (VOID *) GetProcAddress(*DllHandle, ProcName); + if(!proc) + { + fprintf(stderr, "Dll %s does not implement function %s\n", DllName, ProcName); + FreeLibrary(*DllHandle); + ExitProcess(1); + } + + return proc; +} + +static void DllRegisterServer(LPCSTR DllName) +{ + HRESULT hr; + DLLREGISTERSERVER pfDllRegisterServer = NULL; + HMODULE DllHandle = NULL; + + pfDllRegisterServer = LoadProc(DllName, "DllRegisterServer", &DllHandle); + + hr = pfDllRegisterServer(); + if(FAILED(hr)) + { + fprintf(stderr, "Failed to register dll %s\n", DllName); + ExitProcess(1); + } + printf("Successfully registered dll %s\n", DllName); + if(DllHandle) + FreeLibrary(DllHandle); +} + +static void DllUnregisterServer(LPCSTR DllName) +{ + HRESULT hr; + DLLUNREGISTERSERVER pfDllUnregisterServer = NULL; + HMODULE DllHandle = NULL; + + pfDllUnregisterServer = LoadProc(DllName, "DllUnregisterServer", &DllHandle); + + hr = pfDllUnregisterServer(); + if(FAILED(hr)) + { + fprintf(stderr, "Failed to unregister dll %s\n", DllName); + ExitProcess(1); + } + printf("Successfully unregistered dll %s\n", DllName); + if(DllHandle) + FreeLibrary(DllHandle); +} + +int main(int argc, char *argv[]) +{ + int i; + BOOL FunctionInstall = FALSE; + BOOL FunctionDllRegisterServer = FALSE; + BOOL FunctionDllUnregisterServer = FALSE; + + BOOL GotProductCode = FALSE; + LPSTR PackageName = NULL; + LPGUID ProductCode = HeapAlloc(GetProcessHeap(), 0, sizeof(GUID)); + LPSTR Properties = HeapAlloc(GetProcessHeap(), 0, 1); + LPSTR TempStr = NULL; + + LPSTR DllName = NULL; + + Properties[0] = 0; + + for(i = 1; i < argc; i++) + { + WINE_TRACE("argv[%d] = %s\n", i, argv[i]); + + if(!strcasecmp(argv[i], "/i")) + { + FunctionInstall = TRUE; + i++; + if(i >= argc) + ShowUsage(1); + GotProductCode = GetProductCode(argv[i], ProductCode); + if(!GotProductCode) + { + HeapFree(GetProcessHeap(), 0, ProductCode); + ProductCode = NULL; + PackageName = argv[i]; + } + } + else if(!strcasecmp(argv[i], "/a")) + { + FunctionInstall = TRUE; + i++; + if(i >= argc) + ShowUsage(1); + PackageName = argv[i]; + TempStr = HeapReAlloc(GetProcessHeap(), 0, Properties, HeapSize(GetProcessHeap(), 0, Properties)+strlen(ActionAdmin)); + if(!TempStr) + { + WINE_ERR("Out of memory!\n"); + ExitProcess(1); + } + Properties = TempStr; + strcat(Properties, ActionAdmin); + } + else if(!strncasecmp(argv[i], "/f", 2)) + { + i++; + if(i >= argc) + ShowUsage(1); + WINE_FIXME("Repair not implemented yet\n"); + ExitProcess(1); + } + else if(!strcasecmp(argv[i], "/x")) + { + FunctionInstall = TRUE; + i++; + if(i >= argc) + ShowUsage(1); + GotProductCode = GetProductCode(argv[i], ProductCode); + if(!GotProductCode) + { + HeapFree(GetProcessHeap(), 0, ProductCode); + ProductCode = NULL; + PackageName = argv[i]; + } + TempStr = HeapReAlloc(GetProcessHeap(), 0, Properties, HeapSize(GetProcessHeap(), 0, Properties)+strlen(RemoveAll)); + if(!TempStr) + { + WINE_ERR("Out of memory!\n"); + ExitProcess(1); + } + Properties = TempStr; + strcat(Properties, RemoveAll); + } + else if(!strncasecmp(argv[i], "/j", 2)) + { + i++; + if(i >= argc) + ShowUsage(1); + WINE_FIXME("Advertising not yet implemented\n"); + ExitProcess(1); + } + else if(!strcasecmp(argv[i], "u") || !strcasecmp(argv[i], "m")) + { + i++; + if(i >= argc) + ShowUsage(1); + WINE_FIXME("Advertising not yet implemented\n"); + ExitProcess(1); + } + else if(!strcasecmp(argv[i], "/t")) + { + i++; + if(i >= argc) + ShowUsage(1); + WINE_FIXME("Transforms not yet implemented\n"); + ExitProcess(1); + } + else if(!strncasecmp(argv[i], "TRANSFORMS", 10)) + { + WINE_FIXME("Transforms not yet implemented\n"); + ExitProcess(1); + } + else if(!strcasecmp(argv[i], "/g")) + { + i++; + if(i >= argc) + ShowUsage(1); + WINE_FIXME("Language ID not yet implemented\n"); + ExitProcess(1); + } + else if(!strncasecmp(argv[i], "/l", 2)) + { + i++; + if(i >= argc) + ShowUsage(1); + WINE_FIXME("Logging not yet implemented\n"); + ExitProcess(1); + } + else if(!strcasecmp(argv[i], "/p")) + { + i++; + if(i >= argc) + ShowUsage(1); + WINE_FIXME("Patching not yet implemented\n"); + ExitProcess(1); + } + else if(!strncasecmp(argv[i], "/q", 2)) + { + i++; + if(i >= argc) + ShowUsage(1); + WINE_FIXME("User interface not yet implemented\n"); + ExitProcess(1); + } + else if(!strcasecmp(argv[i], "/y")) + { + FunctionDllRegisterServer = TRUE; + i++; + if(i >= argc) + ShowUsage(1); + DllName = argv[i]; + } + else if(!strcasecmp(argv[i], "/z")) + { + FunctionDllUnregisterServer = TRUE; + i++; + if(i >= argc) + ShowUsage(1); + DllName = argv[i]; + } + else if(!strcasecmp(argv[i], "/h") || !strcasecmp(argv[i], "/?")) + { + ShowUsage(0); + } + } + + if(FunctionInstall) + { + if(Properties[strlen(Properties)-1] == ' ') + { + Properties[strlen(Properties)-1] = 0; + TempStr = HeapReAlloc(GetProcessHeap(), 0, Properties, HeapSize(GetProcessHeap(), 0, Properties)-1); + if(!TempStr) + { + fprintf(stderr, "Out of memory!\n"); + ExitProcess(1); + } + Properties = TempStr; + } + if(GotProductCode) + { + WINE_FIXME("Product code treatment not implemented yet\n"); + ExitProcess(1); + } + else + { + if(MsiInstallProductA(PackageName, Properties) != ERROR_SUCCESS) + { + fprintf(stderr, "Installation of %s (%s) failed.\n", PackageName, Properties); + ExitProcess(1); + } + } + } + else if(FunctionDllRegisterServer) + { + DllRegisterServer(DllName); + } + else if(FunctionDllUnregisterServer) + { + DllUnregisterServer(DllName); + } + else + ShowUsage(1); + + return 0; +} diff --git a/programs/msiexec/msiexec.h b/programs/msiexec/msiexec.h new file mode 100644 index 00000000000..2b46abb772a --- /dev/null +++ b/programs/msiexec/msiexec.h @@ -0,0 +1,43 @@ +/* + * Msiexec (msiexec.h) + * + * Copyright 2004 Vincent Béron + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +typedef HRESULT (*DLLREGISTERSERVER)(void); +typedef HRESULT (*DLLUNREGISTERSERVER)(void); + +/* Advertising flags */ + +#define ADVERTISE_CURRENT_USER 0x00000001 +#define ADVERTISE_ALL_USERS 0x00000002 + +/* Logging flags */ + +#define LOG_STATUS_MESSAGES 0x00000001 +#define LOG_NONFATAL_WARNINGS 0x00000002 +#define LOG_ALL_ERROR_MESSAGES 0x00000004 +#define LOG_STARTUP_OF_ACTIONS 0x00000008 +#define LOG_ACTION_SPECIFIC_RECORDS 0x00000010 +#define LOG_USER_REQUESTS 0x00000020 +#define LOG_INITIAL_USER_INTERFACE_PARAMETERS 0x00000040 +#define LOG_OUT_OF_MEMORY 0x00000080 +#define LOG_TERMINAL_PROPERTIES 0x00000100 +#define LOG_VERBOSE_OUTPUT 0x00000200 +#define LOG_APPEND_TO_EXISTING_FILE 0x00000400 +#define LOG_FLUSH_EACH_LINE 0x00000800 +#define LOG_WILDCARD 0x000001ff