diff options
Diffstat (limited to 'setup_native/source/win32/customactions')
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/registerextensions.cxx | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx index 1e30c4611245..0fbe4e113b02 100644 --- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx +++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx @@ -211,44 +211,16 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle) extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle) { - std::_tstring mystr; - - // 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; } |