summaryrefslogtreecommitdiff
path: root/setup_native
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2012-06-20 21:07:29 +0200
committerAndras Timar <atimar@suse.com>2012-06-21 09:17:54 +0200
commitacdbe9d60e17a128c7c1c5d8994cb04b954cc57e (patch)
tree9d7507c8b5dd5a321a6c671d5ac80703b2ce05b5 /setup_native
parent6bc7cc692977431d1873dea0dd4c2636a6735eaa (diff)
fdo#51270 fix RemoveExtensions custom action
FINDPRODUCT property was not available to this deferred custom action. Not to mention that registry keys are also deleted at his stage of uninstallation. The proper solution is to set the installation directory with a type 51 custom action, and pass it to RemoveExtensions custom action via CustomActionData property. Change-Id: I0ac18b3a0b19ff1a87bcf580fad9c7fdadb26f76
Diffstat (limited to 'setup_native')
-rw-r--r--setup_native/source/win32/customactions/shellextensions/registerextensions.cxx42
1 files changed, 8 insertions, 34 deletions
diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
index bd5efb7f76c8..b1c1810e43e5 100644
--- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
@@ -210,42 +210,16 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle)
{
- // Finding the product with the help of the propery FINDPRODUCT,
- // that contains a Windows Registry key, that points to the install location.
-
- TCHAR szValue[8192];
- DWORD nValueSize = sizeof(szValue);
- HKEY hKey;
- std::_tstring sInstDir;
-
- std::_tstring sProductKey = GetMsiProperty( handle, TEXT("FINDPRODUCT") );
-
- if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) )
- {
- if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) )
- {
- sInstDir = szValue;
- }
- RegCloseKey( hKey );
- }
- else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) )
- {
- if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) )
- {
- sInstDir = szValue;
- }
- RegCloseKey( hKey );
- }
- else
- {
- return ERROR_SUCCESS;
- }
-
- // Removing complete directory "Basis\prereg\bundled"
+ std::_tstring sInstDir = GetMsiProperty( handle, TEXT("CustomActionData") );
- std::_tstring sCacheDir = sInstDir + TEXT("share\\prereg\\bundled");
+ // Removing complete directory "share\prereg\bundled"
+ RemoveCompleteDirectory( sInstDir + TEXT("share\\prereg\\bundled") );
- RemoveCompleteDirectory( sCacheDir );
+ // At this point we need to take care about removing upper directories,
+ // because we are after InstallFinalize. We remove only empty directories.
+ RemoveDirectory( (sInstDir + TEXT("share\\prereg")).c_str() );
+ RemoveDirectory( (sInstDir + TEXT("share")).c_str() );
+ RemoveDirectory( sInstDir.c_str() );
return ERROR_SUCCESS;
}