diff options
author | Andras Timar <atimar@suse.com> | 2013-01-27 20:29:45 +0100 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2013-01-27 20:34:31 +0100 |
commit | 55fc2b96bb808381fff62b3d34f0e25c13de84a4 (patch) | |
tree | fe9eee790e09705ea3dd1ccf541eee1f16dd4118 /setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx | |
parent | 2d70b928a982a787aa975acd0770e3bf9ffb94b1 (diff) |
Revert "fix for fdo#39632 : Consolidate GetMsiProperty()"
This reverts commit 95ee7d9cd3a0b0f397def8e607759c81feb8c592.
Diffstat (limited to 'setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx')
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx index 476d2351e527..1b159fd22e79 100644 --- a/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx +++ b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx @@ -23,7 +23,7 @@ #endif #define WIN32_LEAN_AND_MEAN #include <windows.h> -#include <../tools/msiprop.hxx> +#include <msiquery.h> #ifdef _MSC_VER #pragma warning(pop) #endif @@ -41,6 +41,27 @@ using namespace std; +namespace +{ + std::_tstring GetMsiProperty( MSIHANDLE handle, const std::_tstring& sProperty ) + { + std::_tstring result; + TCHAR szDummy[1] = TEXT(""); + DWORD nChars = 0; + + if ( MsiGetProperty( handle, sProperty.c_str(), szDummy, &nChars ) == ERROR_MORE_DATA ) + { + DWORD nBytes = ++nChars * sizeof(TCHAR); + LPTSTR buffer = reinterpret_cast<LPTSTR>(_alloca(nBytes)); + ZeroMemory( buffer, nBytes ); + MsiGetProperty(handle, sProperty.c_str(), buffer, &nChars); + result = buffer; + } + + return result; + } +} // namespace + extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle ) { TCHAR szValue[8192]; @@ -48,10 +69,10 @@ extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle ) HKEY hKey; std::_tstring sInstDir; - std::_tstring sManufacturer = GetMsiPropValue( handle, TEXT("Manufacturer") ); - std::_tstring sDefinedName = GetMsiPropValue( handle, TEXT("DEFINEDPRODUCT") ); - std::_tstring sUpdateVersion = GetMsiPropValue( handle, TEXT("DEFINEDVERSION") ); - std::_tstring sUpgradeCode = GetMsiPropValue( handle, TEXT("UpgradeCode") ); + std::_tstring sManufacturer = GetMsiProperty( handle, TEXT("Manufacturer") ); + std::_tstring sDefinedName = GetMsiProperty( handle, TEXT("DEFINEDPRODUCT") ); + std::_tstring sUpdateVersion = GetMsiProperty( handle, TEXT("DEFINEDVERSION") ); + std::_tstring sUpgradeCode = GetMsiProperty( handle, TEXT("UpgradeCode") ); std::_tstring sProductKey = "Software\\" + sManufacturer + "\\" + sDefinedName + "\\" + sUpdateVersion + "\\" + sUpgradeCode; |