2000-08-01 02:27:35 +02:00
|
|
|
/*
|
2005-03-10 16:46:33 +01:00
|
|
|
* Uninstaller
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
2005-03-10 16:46:33 +01:00
|
|
|
* Copyright 2000 Andreas Mohr
|
|
|
|
* Copyright 2004 Hannu Valtonen
|
|
|
|
* Copyright 2005 Jonathan Ernst
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-19 03:03:58 +01:00
|
|
|
*
|
2000-08-01 02:27:35 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <windows.h>
|
2021-06-16 04:33:21 +02:00
|
|
|
#include <commctrl.h>
|
2005-03-11 11:26:41 +01:00
|
|
|
#include <shlwapi.h>
|
2005-03-10 16:46:33 +01:00
|
|
|
#include "resource.h"
|
2000-08-01 02:27:35 +02:00
|
|
|
#include "regstr.h"
|
2002-07-05 23:23:54 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(uninstaller);
|
2000-08-01 02:27:35 +02:00
|
|
|
|
2008-08-19 22:12:21 +02:00
|
|
|
extern void WINAPI Control_RunDLL(HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow);
|
|
|
|
|
2000-08-01 02:27:35 +02:00
|
|
|
typedef struct {
|
2007-12-03 04:07:31 +01:00
|
|
|
HKEY root;
|
2005-03-10 16:46:33 +01:00
|
|
|
WCHAR *key;
|
2004-02-24 02:01:10 +01:00
|
|
|
WCHAR *descr;
|
2005-03-10 16:46:33 +01:00
|
|
|
WCHAR *command;
|
2000-08-01 02:27:35 +02:00
|
|
|
int active;
|
|
|
|
} uninst_entry;
|
2005-03-10 16:46:33 +01:00
|
|
|
static uninst_entry *entries = NULL;
|
|
|
|
static unsigned int numentries = 0;
|
|
|
|
static int oldsel = -1;
|
2005-03-11 11:26:41 +01:00
|
|
|
static WCHAR *sFilter;
|
2005-03-10 16:46:33 +01:00
|
|
|
|
|
|
|
static int FetchUninstallInformation(void);
|
|
|
|
static void UninstallProgram(void);
|
2021-03-17 22:30:51 +01:00
|
|
|
static const WCHAR PathUninstallW[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
|
2005-03-11 11:26:41 +01:00
|
|
|
|
2015-08-19 07:00:56 +02:00
|
|
|
static void output_writeconsole(const WCHAR *str, DWORD len)
|
|
|
|
{
|
|
|
|
DWORD written, ret, lenA;
|
|
|
|
char *strA;
|
|
|
|
|
|
|
|
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, len, &written, NULL);
|
|
|
|
if (ret) return;
|
|
|
|
|
|
|
|
/* WriteConsole fails if its output is redirected to a file.
|
|
|
|
* If this occurs, we should use an OEM codepage and call WriteFile.
|
|
|
|
*/
|
|
|
|
lenA = WideCharToMultiByte(GetConsoleOutputCP(), 0, str, len, NULL, 0, NULL, NULL);
|
|
|
|
strA = HeapAlloc(GetProcessHeap(), 0, lenA);
|
|
|
|
if (strA)
|
|
|
|
{
|
|
|
|
WideCharToMultiByte(GetConsoleOutputCP(), 0, str, len, strA, lenA, NULL, NULL);
|
|
|
|
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), strA, lenA, &written, FALSE);
|
|
|
|
HeapFree(GetProcessHeap(), 0, strA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 11:02:12 +02:00
|
|
|
static void output_formatstring(const WCHAR *fmt, va_list va_args)
|
2015-08-17 10:39:40 +02:00
|
|
|
{
|
|
|
|
WCHAR *str;
|
2015-08-19 07:00:56 +02:00
|
|
|
DWORD len;
|
2015-08-17 10:39:40 +02:00
|
|
|
|
|
|
|
len = FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER,
|
|
|
|
fmt, 0, 0, (LPWSTR)&str, 0, &va_args);
|
2020-05-13 22:07:11 +02:00
|
|
|
if (len == 0 && GetLastError() != ERROR_NO_WORK_DONE)
|
2015-08-17 10:39:40 +02:00
|
|
|
{
|
|
|
|
WINE_FIXME("Could not format string: le=%u, fmt=%s\n", GetLastError(), wine_dbgstr_w(fmt));
|
|
|
|
return;
|
|
|
|
}
|
2015-08-19 07:00:56 +02:00
|
|
|
output_writeconsole(str, len);
|
2015-08-17 10:39:40 +02:00
|
|
|
LocalFree(str);
|
|
|
|
}
|
|
|
|
|
2017-11-02 10:22:17 +01:00
|
|
|
static void WINAPIV output_message(unsigned int id, ...)
|
2015-08-17 10:39:40 +02:00
|
|
|
{
|
|
|
|
WCHAR fmt[1024];
|
2021-10-25 11:02:12 +02:00
|
|
|
va_list va_args;
|
2015-08-17 10:39:40 +02:00
|
|
|
|
2018-07-24 22:13:43 +02:00
|
|
|
if (!LoadStringW(GetModuleHandleW(NULL), id, fmt, ARRAY_SIZE(fmt)))
|
2015-08-17 10:39:40 +02:00
|
|
|
{
|
|
|
|
WINE_FIXME("LoadString failed with %d\n", GetLastError());
|
|
|
|
return;
|
|
|
|
}
|
2021-10-25 11:02:12 +02:00
|
|
|
va_start(va_args, id);
|
2015-08-17 10:39:40 +02:00
|
|
|
output_formatstring(fmt, va_args);
|
2021-10-25 11:02:12 +02:00
|
|
|
va_end(va_args);
|
2015-08-17 10:39:40 +02:00
|
|
|
}
|
|
|
|
|
2021-03-17 22:30:50 +01:00
|
|
|
static void WINAPIV output_array(const WCHAR *fmt, ...)
|
2015-08-17 10:39:41 +02:00
|
|
|
{
|
2021-10-25 11:02:12 +02:00
|
|
|
va_list va_args;
|
2015-08-17 10:39:41 +02:00
|
|
|
|
2021-10-25 11:02:12 +02:00
|
|
|
va_start(va_args, fmt);
|
2015-08-17 10:39:41 +02:00
|
|
|
output_formatstring(fmt, va_args);
|
2021-10-25 11:02:12 +02:00
|
|
|
va_end(va_args);
|
2015-08-17 10:39:41 +02:00
|
|
|
}
|
|
|
|
|
2005-03-10 16:46:33 +01:00
|
|
|
/**
|
|
|
|
* Used to output program list when used with --list
|
|
|
|
*/
|
|
|
|
static void ListUninstallPrograms(void)
|
2001-07-08 22:28:23 +02:00
|
|
|
{
|
2004-09-22 04:46:38 +02:00
|
|
|
unsigned int i;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-07-25 17:50:27 +02:00
|
|
|
FetchUninstallInformation();
|
2001-07-08 22:28:23 +02:00
|
|
|
|
|
|
|
for (i=0; i < numentries; i++)
|
2021-03-17 22:30:51 +01:00
|
|
|
output_array(L"%1|||%2\n", entries[i].key, entries[i].descr);
|
2001-07-08 22:28:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-10 16:46:33 +01:00
|
|
|
static void RemoveSpecificProgram(WCHAR *nameW)
|
2001-07-08 22:28:23 +02:00
|
|
|
{
|
2004-09-22 04:46:38 +02:00
|
|
|
unsigned int i;
|
2001-07-08 22:28:23 +02:00
|
|
|
|
2006-07-25 17:50:27 +02:00
|
|
|
FetchUninstallInformation();
|
2001-07-08 22:28:23 +02:00
|
|
|
|
|
|
|
for (i=0; i < numentries; i++)
|
|
|
|
{
|
2009-09-10 17:58:18 +02:00
|
|
|
if (CompareStringW(GetThreadLocale(), NORM_IGNORECASE, entries[i].key, -1, nameW, -1) == CSTR_EQUAL)
|
2001-07-08 22:28:23 +02:00
|
|
|
{
|
|
|
|
entries[i].active++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i < numentries)
|
|
|
|
UninstallProgram();
|
|
|
|
else
|
2015-08-17 10:39:40 +02:00
|
|
|
output_message(STRING_NO_APP_MATCH, nameW);
|
2001-07-08 22:28:23 +02:00
|
|
|
}
|
|
|
|
|
2005-03-10 16:46:33 +01:00
|
|
|
|
2019-10-17 17:05:47 +02:00
|
|
|
int __cdecl wmain(int argc, WCHAR *argv[])
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2005-03-10 16:46:33 +01:00
|
|
|
LPCWSTR token = NULL;
|
2003-10-09 21:45:54 +02:00
|
|
|
int i = 1;
|
2019-03-30 21:55:43 +01:00
|
|
|
BOOL is_wow64;
|
|
|
|
|
|
|
|
if (IsWow64Process( GetCurrentProcess(), &is_wow64 ) && is_wow64)
|
|
|
|
{
|
|
|
|
STARTUPINFOW si;
|
|
|
|
PROCESS_INFORMATION pi;
|
|
|
|
WCHAR filename[MAX_PATH];
|
|
|
|
void *redir;
|
|
|
|
DWORD exit_code;
|
|
|
|
|
|
|
|
memset( &si, 0, sizeof(si) );
|
|
|
|
si.cb = sizeof(si);
|
2021-04-16 11:11:06 +02:00
|
|
|
GetSystemDirectoryW( filename, MAX_PATH );
|
|
|
|
wcscat( filename, L"\\uninstaller.exe" );
|
2019-03-30 21:55:43 +01:00
|
|
|
|
|
|
|
Wow64DisableWow64FsRedirection( &redir );
|
|
|
|
if (CreateProcessW( filename, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ))
|
|
|
|
{
|
|
|
|
WINE_TRACE( "restarting %s\n", wine_dbgstr_w(filename) );
|
|
|
|
WaitForSingleObject( pi.hProcess, INFINITE );
|
|
|
|
GetExitCodeProcess( pi.hProcess, &exit_code );
|
|
|
|
ExitProcess( exit_code );
|
|
|
|
}
|
|
|
|
else WINE_ERR( "failed to restart 64-bit %s, err %d\n", wine_dbgstr_w(filename), GetLastError() );
|
|
|
|
Wow64RevertWow64FsRedirection( redir );
|
|
|
|
}
|
2000-08-01 02:27:35 +02:00
|
|
|
|
2021-06-16 04:33:21 +02:00
|
|
|
InitCommonControls();
|
|
|
|
|
2003-10-09 21:45:54 +02:00
|
|
|
while( i<argc )
|
2001-07-08 22:28:23 +02:00
|
|
|
{
|
2003-10-09 21:45:54 +02:00
|
|
|
token = argv[i++];
|
2021-03-17 22:30:51 +01:00
|
|
|
|
|
|
|
if( !lstrcmpW( token, L"--help" ) )
|
2015-08-21 08:00:23 +02:00
|
|
|
{
|
|
|
|
output_message(STRING_HEADER);
|
|
|
|
output_message(STRING_USAGE);
|
|
|
|
return 0;
|
|
|
|
}
|
2021-03-17 22:30:51 +01:00
|
|
|
else if( !lstrcmpW( token, L"--list" ) )
|
2003-10-09 21:45:54 +02:00
|
|
|
{
|
|
|
|
ListUninstallPrograms();
|
|
|
|
return 0;
|
|
|
|
}
|
2021-03-17 22:30:51 +01:00
|
|
|
else if( !lstrcmpW( token, L"--remove" ) )
|
2003-10-09 21:45:54 +02:00
|
|
|
{
|
|
|
|
if( i >= argc )
|
|
|
|
{
|
2015-08-17 10:39:40 +02:00
|
|
|
output_message(STRING_PARAMETER_REQUIRED);
|
2003-10-09 21:45:54 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoveSpecificProgram( argv[i++] );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-17 10:39:40 +02:00
|
|
|
output_message(STRING_INVALID_OPTION, token);
|
2003-10-09 21:45:54 +02:00
|
|
|
return 1;
|
|
|
|
}
|
2001-07-08 22:28:23 +02:00
|
|
|
}
|
|
|
|
|
2008-08-19 22:12:21 +02:00
|
|
|
/* Start the GUI control panel */
|
|
|
|
Control_RunDLL(GetDesktopWindow(), 0, "appwiz.cpl", SW_SHOW);
|
|
|
|
return 1;
|
2000-08-01 02:27:35 +02:00
|
|
|
}
|
|
|
|
|
2005-03-10 16:46:33 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to sort entries by name.
|
|
|
|
*/
|
2019-05-06 10:40:58 +02:00
|
|
|
static int __cdecl cmp_by_name(const void *a, const void *b)
|
2002-03-19 03:03:58 +01:00
|
|
|
{
|
2004-11-30 22:38:57 +01:00
|
|
|
return lstrcmpiW(((const uninst_entry *)a)->descr, ((const uninst_entry *)b)->descr);
|
2002-03-19 03:03:58 +01:00
|
|
|
}
|
|
|
|
|
2005-03-10 16:46:33 +01:00
|
|
|
|
|
|
|
/**
|
2007-02-14 16:22:07 +01:00
|
|
|
* Fetch information from the uninstall key.
|
2005-03-10 16:46:33 +01:00
|
|
|
*/
|
2007-12-03 04:07:31 +01:00
|
|
|
static int FetchFromRootKey(HKEY root)
|
2000-08-01 02:27:35 +02:00
|
|
|
{
|
2011-02-22 13:23:30 +01:00
|
|
|
HKEY hkeyApp;
|
2000-08-01 02:27:35 +02:00
|
|
|
int i;
|
2011-05-30 09:28:45 +02:00
|
|
|
DWORD sizeOfSubKeyName, displen, uninstlen, value, type, size;
|
2005-03-10 16:46:33 +01:00
|
|
|
WCHAR subKeyName[256];
|
2004-02-24 02:01:10 +01:00
|
|
|
|
|
|
|
sizeOfSubKeyName = 255;
|
2011-02-22 13:23:30 +01:00
|
|
|
for (i=0; RegEnumKeyExW( root, i, subKeyName, &sizeOfSubKeyName, NULL, NULL, NULL, NULL ) != ERROR_NO_MORE_ITEMS; ++i)
|
2000-08-01 02:27:35 +02:00
|
|
|
{
|
2011-02-22 13:23:30 +01:00
|
|
|
RegOpenKeyExW(root, subKeyName, 0, KEY_READ, &hkeyApp);
|
2017-05-15 10:02:31 +02:00
|
|
|
size = sizeof(value);
|
2021-03-17 22:30:51 +01:00
|
|
|
if (!RegQueryValueExW(hkeyApp, L"SystemComponent", NULL, &type, (BYTE *)&value, &size) &&
|
2011-05-30 09:28:45 +02:00
|
|
|
type == REG_DWORD && value == 1)
|
|
|
|
{
|
|
|
|
RegCloseKey(hkeyApp);
|
|
|
|
sizeOfSubKeyName = 255;
|
|
|
|
continue;
|
|
|
|
}
|
2021-03-17 22:30:51 +01:00
|
|
|
if (!RegQueryValueExW(hkeyApp, L"DisplayName", NULL, NULL, NULL, &displen))
|
2005-03-10 16:46:33 +01:00
|
|
|
{
|
2010-12-23 17:09:31 +01:00
|
|
|
WCHAR *command;
|
|
|
|
|
2011-05-30 09:28:45 +02:00
|
|
|
size = sizeof(value);
|
2021-03-17 22:30:51 +01:00
|
|
|
if (!RegQueryValueExW(hkeyApp, L"WindowsInstaller", NULL, &type, (BYTE *)&value, &size) &&
|
2011-05-30 09:28:45 +02:00
|
|
|
type == REG_DWORD && value == 1)
|
2010-12-23 17:09:31 +01:00
|
|
|
{
|
2021-03-17 22:30:51 +01:00
|
|
|
command = HeapAlloc(GetProcessHeap(), 0,
|
|
|
|
(lstrlenW(L"msiexec /x%s") + lstrlenW(subKeyName)) * sizeof(WCHAR));
|
|
|
|
wsprintfW(command, L"msiexec /x%s", subKeyName);
|
2010-12-23 17:09:31 +01:00
|
|
|
}
|
2021-03-17 22:30:51 +01:00
|
|
|
else if (!RegQueryValueExW(hkeyApp, L"UninstallString", NULL, NULL, NULL, &uninstlen))
|
2010-12-23 17:09:31 +01:00
|
|
|
{
|
|
|
|
command = HeapAlloc(GetProcessHeap(), 0, uninstlen);
|
2021-03-17 22:30:51 +01:00
|
|
|
RegQueryValueExW(hkeyApp, L"UninstallString", 0, 0, (BYTE *)command, &uninstlen);
|
2010-12-23 17:09:31 +01:00
|
|
|
}
|
2010-12-24 09:37:51 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
RegCloseKey(hkeyApp);
|
|
|
|
sizeOfSubKeyName = 255;
|
|
|
|
continue;
|
|
|
|
}
|
2005-03-10 16:46:33 +01:00
|
|
|
numentries++;
|
|
|
|
entries = HeapReAlloc(GetProcessHeap(), 0, entries, numentries*sizeof(uninst_entry));
|
2007-12-03 04:07:31 +01:00
|
|
|
entries[numentries-1].root = root;
|
2005-03-10 16:46:33 +01:00
|
|
|
entries[numentries-1].key = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(subKeyName)+1)*sizeof(WCHAR));
|
|
|
|
lstrcpyW(entries[numentries-1].key, subKeyName);
|
|
|
|
entries[numentries-1].descr = HeapAlloc(GetProcessHeap(), 0, displen);
|
2021-03-17 22:30:51 +01:00
|
|
|
RegQueryValueExW(hkeyApp, L"DisplayName", 0, 0, (BYTE *)entries[numentries-1].descr, &displen);
|
2010-12-23 17:09:31 +01:00
|
|
|
entries[numentries-1].command = command;
|
2005-03-10 16:46:33 +01:00
|
|
|
entries[numentries-1].active = 0;
|
|
|
|
WINE_TRACE("allocated entry #%d: %s (%s), %s\n",
|
|
|
|
numentries, wine_dbgstr_w(entries[numentries-1].key), wine_dbgstr_w(entries[numentries-1].descr), wine_dbgstr_w(entries[numentries-1].command));
|
2005-03-11 11:26:41 +01:00
|
|
|
if(sFilter != NULL && StrStrIW(entries[numentries-1].descr,sFilter)==NULL)
|
|
|
|
numentries--;
|
2005-03-10 16:46:33 +01:00
|
|
|
}
|
|
|
|
RegCloseKey(hkeyApp);
|
|
|
|
sizeOfSubKeyName = 255;
|
2000-08-01 02:27:35 +02:00
|
|
|
}
|
|
|
|
return 1;
|
2007-12-03 04:07:31 +01:00
|
|
|
|
2000-08-01 02:27:35 +02:00
|
|
|
}
|
|
|
|
|
2007-12-03 04:07:31 +01:00
|
|
|
static int FetchUninstallInformation(void)
|
|
|
|
{
|
2011-02-22 13:23:30 +01:00
|
|
|
static const BOOL is_64bit = sizeof(void *) > sizeof(int);
|
|
|
|
int rc = 0;
|
|
|
|
HKEY root;
|
2007-12-03 04:07:31 +01:00
|
|
|
|
|
|
|
numentries = 0;
|
|
|
|
oldsel = -1;
|
|
|
|
if (!entries)
|
|
|
|
entries = HeapAlloc(GetProcessHeap(), 0, sizeof(uninst_entry));
|
|
|
|
|
2011-02-22 13:23:30 +01:00
|
|
|
if (!RegOpenKeyExW(HKEY_LOCAL_MACHINE, PathUninstallW, 0, KEY_READ, &root))
|
|
|
|
{
|
|
|
|
rc |= FetchFromRootKey(root);
|
|
|
|
RegCloseKey(root);
|
|
|
|
}
|
|
|
|
if (is_64bit &&
|
|
|
|
!RegOpenKeyExW(HKEY_LOCAL_MACHINE, PathUninstallW, 0, KEY_READ|KEY_WOW64_32KEY, &root))
|
|
|
|
{
|
|
|
|
rc |= FetchFromRootKey(root);
|
|
|
|
RegCloseKey(root);
|
|
|
|
}
|
|
|
|
if (!RegOpenKeyExW(HKEY_CURRENT_USER, PathUninstallW, 0, KEY_READ, &root))
|
|
|
|
{
|
|
|
|
rc |= FetchFromRootKey(root);
|
|
|
|
RegCloseKey(root);
|
|
|
|
}
|
2007-12-03 04:07:31 +01:00
|
|
|
|
|
|
|
qsort(entries, numentries, sizeof(uninst_entry), cmp_by_name);
|
|
|
|
return rc;
|
|
|
|
}
|
2005-03-10 16:46:33 +01:00
|
|
|
|
|
|
|
static void UninstallProgram(void)
|
2000-08-01 02:27:35 +02:00
|
|
|
{
|
2004-09-22 04:46:38 +02:00
|
|
|
unsigned int i;
|
2005-03-10 16:46:33 +01:00
|
|
|
WCHAR errormsg[1024];
|
2000-08-01 02:27:35 +02:00
|
|
|
BOOL res;
|
2005-03-10 16:46:33 +01:00
|
|
|
STARTUPINFOW si;
|
2000-08-01 02:27:35 +02:00
|
|
|
PROCESS_INFORMATION info;
|
|
|
|
DWORD exit_code;
|
|
|
|
HKEY hkey;
|
|
|
|
for (i=0; i < numentries; i++)
|
|
|
|
{
|
2005-03-10 16:46:33 +01:00
|
|
|
if (!(entries[i].active)) /* don't uninstall this one */
|
|
|
|
continue;
|
|
|
|
WINE_TRACE("uninstalling %s\n", wine_dbgstr_w(entries[i].descr));
|
|
|
|
memset(&si, 0, sizeof(STARTUPINFOW));
|
|
|
|
si.cb = sizeof(STARTUPINFOW);
|
|
|
|
si.wShowWindow = SW_NORMAL;
|
|
|
|
res = CreateProcessW(NULL, entries[i].command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &info);
|
|
|
|
if (res)
|
|
|
|
{ /* wait for the process to exit */
|
|
|
|
WaitForSingleObject(info.hProcess, INFINITE);
|
|
|
|
res = GetExitCodeProcess(info.hProcess, &exit_code);
|
2006-09-29 01:19:00 +02:00
|
|
|
WINE_TRACE("%d: %08x\n", res, exit_code);
|
2005-03-10 16:46:33 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-03 12:35:35 +01:00
|
|
|
WCHAR sAppName[MAX_STRING_LEN];
|
|
|
|
WCHAR sUninstallFailed[MAX_STRING_LEN];
|
|
|
|
HINSTANCE hInst = GetModuleHandleW(0);
|
|
|
|
|
2018-07-24 22:13:43 +02:00
|
|
|
LoadStringW(hInst, IDS_APPNAME, sAppName, ARRAY_SIZE(sAppName));
|
|
|
|
LoadStringW(hInst, IDS_UNINSTALLFAILED, sUninstallFailed, ARRAY_SIZE(sUninstallFailed));
|
2005-03-10 16:46:33 +01:00
|
|
|
wsprintfW(errormsg, sUninstallFailed, entries[i].command);
|
|
|
|
if(MessageBoxW(0, errormsg, sAppName, MB_YESNO | MB_ICONQUESTION)==IDYES)
|
|
|
|
{
|
|
|
|
/* delete the application's uninstall entry */
|
2007-12-03 04:07:31 +01:00
|
|
|
RegOpenKeyExW(entries[i].root, PathUninstallW, 0, KEY_READ, &hkey);
|
2005-03-10 16:46:33 +01:00
|
|
|
RegDeleteKeyW(hkey, entries[i].key);
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
}
|
|
|
|
}
|
2000-08-01 02:27:35 +02:00
|
|
|
}
|
2002-07-05 23:23:54 +02:00
|
|
|
WINE_TRACE("finished uninstall phase.\n");
|
2000-08-01 02:27:35 +02:00
|
|
|
}
|