uninstaller: Don't list system components.

This commit is contained in:
Hans Leidekker 2011-05-30 09:28:45 +02:00 committed by Alexandre Julliard
parent 9432d65b7a
commit 3de8370a4e

View file

@ -60,7 +60,7 @@ static const WCHAR PathUninstallW[] = {
'U','n','i','n','s','t','a','l','l',0 }; '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 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 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};
/** /**
* Used to output program list when used with --list * Used to output program list when used with --list
@ -176,19 +176,27 @@ static int FetchFromRootKey(HKEY root)
{ {
HKEY hkeyApp; HKEY hkeyApp;
int i; int i;
DWORD sizeOfSubKeyName, displen, uninstlen; DWORD sizeOfSubKeyName, displen, uninstlen, value, type, size;
WCHAR subKeyName[256]; WCHAR subKeyName[256];
sizeOfSubKeyName = 255; sizeOfSubKeyName = 255;
for (i=0; RegEnumKeyExW( root, i, subKeyName, &sizeOfSubKeyName, NULL, NULL, NULL, NULL ) != ERROR_NO_MORE_ITEMS; ++i) for (i=0; RegEnumKeyExW( root, i, subKeyName, &sizeOfSubKeyName, NULL, NULL, NULL, NULL ) != ERROR_NO_MORE_ITEMS; ++i)
{ {
RegOpenKeyExW(root, subKeyName, 0, KEY_READ, &hkeyApp); RegOpenKeyExW(root, subKeyName, 0, KEY_READ, &hkeyApp);
if (!RegQueryValueExW(hkeyApp, SystemComponentW, NULL, &type, (LPBYTE)&value, &size) &&
type == REG_DWORD && value == 1)
{
RegCloseKey(hkeyApp);
sizeOfSubKeyName = 255;
continue;
}
if (!RegQueryValueExW(hkeyApp, DisplayNameW, NULL, NULL, NULL, &displen)) if (!RegQueryValueExW(hkeyApp, DisplayNameW, NULL, NULL, NULL, &displen))
{ {
DWORD value, type;
WCHAR *command; WCHAR *command;
if (!RegQueryValueExW(hkeyApp, WindowsInstallerW, NULL, &type, NULL, &value) && type == REG_DWORD && value == 1) size = sizeof(value);
if (!RegQueryValueExW(hkeyApp, WindowsInstallerW, NULL, &type, (LPBYTE)&value, &size) &&
type == REG_DWORD && value == 1)
{ {
static const WCHAR fmtW[] = {'m','s','i','e','x','e','c',' ','/','x','%','s',0}; static const WCHAR fmtW[] = {'m','s','i','e','x','e','c',' ','/','x','%','s',0};
command = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(fmtW) + lstrlenW(subKeyName)) * sizeof(WCHAR)); command = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(fmtW) + lstrlenW(subKeyName)) * sizeof(WCHAR));