Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
programs/uninstaller/main.c | 44 +++++++++++++------------------------
1 file changed, 15 insertions(+), 29 deletions(-)
diff --git a/programs/uninstaller/main.c b/programs/uninstaller/main.c
index 7686c803b36..7236f1689e5 100644
--- a/programs/uninstaller/main.c
+++ b/programs/uninstaller/main.c
@@ -46,17 +46,7 @@ static WCHAR *sFilter;
static int FetchUninstallInformation(void);
static void UninstallProgram(void);
-
-static const WCHAR DisplayNameW[] = {'D','i','s','p','l','a','y','N','a','m','e',0};
-static const WCHAR PathUninstallW[] = {
- 'S','o','f','t','w','a','r','e','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
- 'U','n','i','n','s','t','a','l','l',0 };
-static const WCHAR UninstallCommandlineW[] = {'U','n','i','n','s','t','a','l','l','S','t','r','i','n','g',0};
-static const WCHAR WindowsInstallerW[] = {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
-static const WCHAR SystemComponentW[] = {'S','y','s','t','e','m','C','o','m','p','o','n','e','n','t',0};
+static const WCHAR PathUninstallW[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
static void output_writeconsole(const WCHAR *str, DWORD len)
{
@@ -125,12 +115,11 @@ static void WINAPIV output_array(const WCHAR *fmt, ...)
static void ListUninstallPrograms(void)
{
unsigned int i;
- static WCHAR fmtW[] = {'%','1','|','|','|','%','2','\n',0};
FetchUninstallInformation();
for (i=0; i < numentries; i++)
- output_array(fmtW, entries[i].key, entries[i].descr);
+ output_array(L"%1|||%2\n", entries[i].key, entries[i].descr);
}
@@ -159,9 +148,6 @@ static void RemoveSpecificProgram(WCHAR *nameW)
int __cdecl wmain(int argc, WCHAR *argv[])
{
LPCWSTR token = NULL;
- static const WCHAR helpW[] = { '-','-','h','e','l','p',0 };
- static const WCHAR listW[] = { '-','-','l','i','s','t',0 };
- static const WCHAR removeW[] = { '-','-','r','e','m','o','v','e',0 };
int i = 1;
BOOL is_wow64;
@@ -192,19 +178,19 @@ int __cdecl wmain(int argc, WCHAR *argv[])
while( i<argc )
{
token = argv[i++];
-
- if( !lstrcmpW( token, helpW ) )
+
+ if( !lstrcmpW( token, L"--help" ) )
{
output_message(STRING_HEADER);
output_message(STRING_USAGE);
return 0;
}
- else if( !lstrcmpW( token, listW ) )
+ else if( !lstrcmpW( token, L"--list" ) )
{
ListUninstallPrograms();
return 0;
}
- else if( !lstrcmpW( token, removeW ) )
+ else if( !lstrcmpW( token, L"--remove" ) )
{
if( i >= argc )
{
@@ -252,29 +238,29 @@ static int FetchFromRootKey(HKEY root)
{
RegOpenKeyExW(root, subKeyName, 0, KEY_READ, &hkeyApp);
size = sizeof(value);
- if (!RegQueryValueExW(hkeyApp, SystemComponentW, NULL, &type, (LPBYTE)&value, &size) &&
+ if (!RegQueryValueExW(hkeyApp, L"SystemComponent", NULL, &type, (BYTE *)&value, &size) &&
type == REG_DWORD && value == 1)
{
RegCloseKey(hkeyApp);
sizeOfSubKeyName = 255;
continue;
}
- if (!RegQueryValueExW(hkeyApp, DisplayNameW, NULL, NULL, NULL, &displen))
+ if (!RegQueryValueExW(hkeyApp, L"DisplayName", NULL, NULL, NULL, &displen))
{
WCHAR *command;
size = sizeof(value);
- if (!RegQueryValueExW(hkeyApp, WindowsInstallerW, NULL, &type, (LPBYTE)&value, &size) &&
+ if (!RegQueryValueExW(hkeyApp, L"WindowsInstaller", NULL, &type, (BYTE *)&value, &size) &&
type == REG_DWORD && value == 1)
{
- static const WCHAR fmtW[] = {'m','s','i','e','x','e','c',' ','/','x','%','s',0};
- command = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(fmtW) + lstrlenW(subKeyName)) * sizeof(WCHAR));
- wsprintfW(command, fmtW, subKeyName);
+ command = HeapAlloc(GetProcessHeap(), 0,
+ (lstrlenW(L"msiexec /x%s") + lstrlenW(subKeyName)) * sizeof(WCHAR));
+ wsprintfW(command, L"msiexec /x%s", subKeyName);
}
- else if (!RegQueryValueExW(hkeyApp, UninstallCommandlineW, NULL, NULL, NULL, &uninstlen))
+ else if (!RegQueryValueExW(hkeyApp, L"UninstallString", NULL, NULL, NULL, &uninstlen))
{
command = HeapAlloc(GetProcessHeap(), 0, uninstlen);
- RegQueryValueExW(hkeyApp, UninstallCommandlineW, 0, 0, (LPBYTE)command, &uninstlen);
+ RegQueryValueExW(hkeyApp, L"UninstallString", 0, 0, (BYTE *)command, &uninstlen);
}
else
{
@@ -288,7 +274,7 @@ static int FetchFromRootKey(HKEY root)
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);
- RegQueryValueExW(hkeyApp, DisplayNameW, 0, 0, (LPBYTE)entries[numentries-1].descr, &displen);
+ RegQueryValueExW(hkeyApp, L"DisplayName", 0, 0, (BYTE *)entries[numentries-1].descr, &displen);
entries[numentries-1].command = command;
entries[numentries-1].active = 0;
WINE_TRACE("allocated entry #%d: %s (%s), %s\n",
--
2.26.3