diff options
author | Tobias Krause <tkr@openoffice.org> | 2009-11-01 08:04:50 +0000 |
---|---|---|
committer | Tobias Krause <tkr@openoffice.org> | 2009-11-01 08:04:50 +0000 |
commit | 836563fec748e7b9cdafa4b52a0daec053305c01 (patch) | |
tree | 7fd51dc3dae2331249892a7f7461e601b1648fec /setup_native | |
parent | 24000843a30a1843a1f79c64c84e63e76ad29fb7 (diff) |
#105892# add new registry entries for x64
Diffstat (limited to 'setup_native')
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/shellextensions.cxx | 79 |
1 files changed, 72 insertions, 7 deletions
diff --git a/setup_native/source/win32/customactions/shellextensions/shellextensions.cxx b/setup_native/source/win32/customactions/shellextensions/shellextensions.cxx index 2a5d775eba5e..8c58986328b4 100644 --- a/setup_native/source/win32/customactions/shellextensions/shellextensions.cxx +++ b/setup_native/source/win32/customactions/shellextensions/shellextensions.cxx @@ -102,22 +102,87 @@ RegistryEntry InfotipHandler = { TEXT("{087B3AE3-E237-4467-B8DB-5A38AB959AC9}"), RegistryEntry PropHandler = { TEXT("{63542C48-9552-494A-84F7-73AA6A7C99C1}"), TEXT("OpenOffice.org Property Sheet Handler") }; RegistryEntry ThumbViewer = { TEXT("{3B092F0C-7696-40E3-A80F-68D74DA84210}"), TEXT("OpenOffice.org Thumbnail Viewer") }; +BOOL GetMsiProp( MSIHANDLE hMSI, const char* pPropName, char** ppValue ) +{ + DWORD sz = 0; + if ( MsiGetProperty( hMSI, pPropName, 0, &sz ) == ERROR_MORE_DATA ) + { + sz++; + DWORD nbytes = sz * sizeof( char ); + char* buff = reinterpret_cast<char*>( malloc( nbytes ) ); + ZeroMemory( buff, nbytes ); + MsiGetProperty( hMSI, pPropName, buff, &sz ); + *ppValue = buff; + + return TRUE; + } + + return FALSE; +} + +bool IsVersionNT64( MSIHANDLE hMSI ) +{ + char* pVal = NULL; + + if ( GetMsiProp( hMSI, "VersionNT64", &pVal ) && pVal ) + { + free( pVal ); + return true; + } + + return false; +} + + + + /* Called during installation when the module "Windows Explorer Extensions" is selected. */ -extern "C" UINT __stdcall InstallExecSequenceEntry(MSIHANDLE) +extern "C" UINT __stdcall InstallExecSequenceEntry(MSIHANDLE hMSI) { //MessageBox(NULL, TEXT("InstallExecSequenceEntry"), TEXT("Pythonmsi"), MB_OK | MB_ICONINFORMATION); HKEY hKey; - if (RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"), &hKey) == ERROR_SUCCESS) + + + if (IsVersionNT64(hMSI)) { - RegSetValueEx(hKey, ColumnHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ColumnHandler.Value), _tcslen(ColumnHandler.Value) + 1); - RegSetValueEx(hKey, InfotipHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(InfotipHandler.Value), _tcslen(InfotipHandler.Value) + 1); - RegSetValueEx(hKey, PropHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(PropHandler.Value), _tcslen(PropHandler.Value) + 1); - RegSetValueEx(hKey, ThumbViewer.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ThumbViewer.Value), _tcslen(ThumbViewer.Value) + 1); + // Open Windows 64 Bit Registry + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"),0, KEY_WRITE | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS) + { + RegSetValueEx(hKey, ColumnHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ColumnHandler.Value), _tcslen(ColumnHandler.Value) + 1); + RegSetValueEx(hKey, InfotipHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(InfotipHandler.Value), _tcslen(InfotipHandler.Value) + 1); + RegSetValueEx(hKey, PropHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(PropHandler.Value), _tcslen(PropHandler.Value) + 1); + RegSetValueEx(hKey, ThumbViewer.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ThumbViewer.Value), _tcslen(ThumbViewer.Value) + 1); - RegCloseKey(hKey); + RegCloseKey(hKey); + } + + // Open Windows 32 Bit Registry on Win64 maschine + + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"),0, KEY_WRITE | KEY_WOW64_32KEY, &hKey) == ERROR_SUCCESS) + { + RegSetValueEx(hKey, ColumnHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ColumnHandler.Value), _tcslen(ColumnHandler.Value) + 1); + RegSetValueEx(hKey, InfotipHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(InfotipHandler.Value), _tcslen(InfotipHandler.Value) + 1); + RegSetValueEx(hKey, PropHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(PropHandler.Value), _tcslen(PropHandler.Value) + 1); + RegSetValueEx(hKey, ThumbViewer.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ThumbViewer.Value), _tcslen(ThumbViewer.Value) + 1); + + RegCloseKey(hKey); + } + + + } else + { + if (RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"), &hKey) == ERROR_SUCCESS) + { + RegSetValueEx(hKey, ColumnHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ColumnHandler.Value), _tcslen(ColumnHandler.Value) + 1); + RegSetValueEx(hKey, InfotipHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(InfotipHandler.Value), _tcslen(InfotipHandler.Value) + 1); + RegSetValueEx(hKey, PropHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(PropHandler.Value), _tcslen(PropHandler.Value) + 1); + RegSetValueEx(hKey, ThumbViewer.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ThumbViewer.Value), _tcslen(ThumbViewer.Value) + 1); + + RegCloseKey(hKey); + } } return ERROR_SUCCESS; } |