summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extensions/source/activex/main/so_activex.cpp5
-rwxr-xr-xsetup_native/source/win32/customactions/reg64/reg64.cxx310
2 files changed, 161 insertions, 154 deletions
diff --git a/extensions/source/activex/main/so_activex.cpp b/extensions/source/activex/main/so_activex.cpp
index 7db1c67e1585..9c10fadadb06 100644
--- a/extensions/source/activex/main/so_activex.cpp
+++ b/extensions/source/activex/main/so_activex.cpp
@@ -35,6 +35,9 @@ END_OBJECT_MAP()
#ifndef KEY_WOW64_64KEY
#define KEY_WOW64_64KEY (0x0100)
#endif
+#ifndef KEY_WOW64_32KEY
+ #define KEY_WOW64_32KEY (0x0200)
+#endif
const REGSAM n64KeyAccess = KEY_ALL_ACCESS | KEY_WOW64_64KEY;
const REGSAM n32KeyAccess = KEY_ALL_ACCESS;
@@ -46,7 +49,9 @@ const BOOL bX64 = FALSE;
#endif
// 10.11.2009 tkr: MinGW doesn't know anything about RegDeleteKeyExA if WINVER < 0x0502.
+extern "C" {
WINADVAPI LONG WINAPI RegDeleteKeyExA(HKEY,LPCSTR,REGSAM,DWORD);
+}
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
diff --git a/setup_native/source/win32/customactions/reg64/reg64.cxx b/setup_native/source/win32/customactions/reg64/reg64.cxx
index ebb2890e7e49..ffa225791ead 100755
--- a/setup_native/source/win32/customactions/reg64/reg64.cxx
+++ b/setup_native/source/win32/customactions/reg64/reg64.cxx
@@ -47,11 +47,13 @@
#include <malloc.h>
//#include <string>
-//#include <map>
+//#include <map>
#include <strsafe.h>
// 10.11.2009 tkr: MinGW doesn't know anything about RegDeleteKeyExW if WINVER < 0x0502.
+extern "C" {
WINADVAPI LONG WINAPI RegDeleteKeyExW(HKEY,LPCWSTR,REGSAM,DWORD);
+}
// 06.11.2009 tkr: to provide windows xp as build systems for mingw we need to define KEY_WOW64_64KEY
// in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems.
@@ -227,24 +229,24 @@ bool QueryReg64Table(MSIHANDLE& rhDatabase, MSIHANDLE& rhView)
OutputDebugStringFormat(L"QueryReg64Table - START\n" );
int const arraysize = 400;
wchar_t szSelect[arraysize];
- StringCbPrintfW(szSelect, arraysize * sizeof(wchar_t), L"SELECT * FROM %s",TABLE_NAME);
- OutputDebugStringFormat( szSelect );
-
- UINT ret = MsiDatabaseOpenView(rhDatabase,szSelect,&rhView);
- if (ret != ERROR_SUCCESS)
- {
- if ( ret == ERROR_BAD_QUERY_SYNTAX)
- OutputDebugStringFormat(L"QueryReg64Table - MsiDatabaseOpenView - FAILED - ERROR_BAD_QUERY_SYNTAX\n" );
- if ( ret == ERROR_INVALID_HANDLE)
- OutputDebugStringFormat(L"QueryReg64Table - MsiDatabaseOpenView - FAILED - ERROR_INVALID_HANDLE\n" );
- return false;
- }
- // execute query - not a parameter query so second parameter is NULL.
- if (MsiViewExecute(rhView,NULL) != ERROR_SUCCESS)
- {
- OutputDebugStringFormat(L"QueryReg64Table - MsiViewExecute - FAILED\n" );
- return false;
- }
+ StringCbPrintfW(szSelect, arraysize * sizeof(wchar_t), L"SELECT * FROM %s",TABLE_NAME);
+ OutputDebugStringFormat( szSelect );
+
+ UINT ret = MsiDatabaseOpenView(rhDatabase,szSelect,&rhView);
+ if (ret != ERROR_SUCCESS)
+ {
+ if ( ret == ERROR_BAD_QUERY_SYNTAX)
+ OutputDebugStringFormat(L"QueryReg64Table - MsiDatabaseOpenView - FAILED - ERROR_BAD_QUERY_SYNTAX\n" );
+ if ( ret == ERROR_INVALID_HANDLE)
+ OutputDebugStringFormat(L"QueryReg64Table - MsiDatabaseOpenView - FAILED - ERROR_INVALID_HANDLE\n" );
+ return false;
+ }
+ // execute query - not a parameter query so second parameter is NULL.
+ if (MsiViewExecute(rhView,NULL) != ERROR_SUCCESS)
+ {
+ OutputDebugStringFormat(L"QueryReg64Table - MsiViewExecute - FAILED\n" );
+ return false;
+ }
OutputDebugStringFormat(L"QueryReg64Table - ENDE\n" );
return true;
@@ -295,136 +297,136 @@ bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView)
MSIHANDLE hRecord;
- long lRoot;
- wchar_t szKey[255];
- wchar_t szName[255];
- wchar_t szValue[1024];
- wchar_t szComponent[255];
-
- /// read records until there are no more records
- while (MsiViewFetch(rhView,&hRecord) == ERROR_SUCCESS)
- {
- DWORD dwKey = 255;
- DWORD dwName = 255;
- DWORD dwValue = 1024;
- DWORD dwComponent = 255;
-
- szKey[0] = '\0';
- szName[0] = '\0';
- szValue[0] = '\0';
- szComponent[0] = '\0';
-
- lRoot = MsiRecordGetInteger(hRecord,2);
- MsiRecordGetString(hRecord,3,szKey,&dwKey);
-
- if (!MsiRecordIsNull(hRecord, 4))
- MsiRecordGetString(hRecord,4,szName,&dwName);
-
- if (!MsiRecordIsNull(hRecord, 5))
- {
- MsiRecordGetString(hRecord,5,szValue,&dwValue);
-
-
-
- wchar_t* nPos = wcsstr(szValue , BASISINSTALLLOCATION);
- if ( NULL != nPos)
- {
-
- DWORD nPrefixSize = nPos - szValue;
-
- DWORD nPropSize = wcslen(sBasisInstallLocation);
- DWORD nPostfixSize = dwValue - wcslen( BASISINSTALLLOCATION );
-
+ long lRoot;
+ wchar_t szKey[255];
+ wchar_t szName[255];
+ wchar_t szValue[1024];
+ wchar_t szComponent[255];
+
+ /// read records until there are no more records
+ while (MsiViewFetch(rhView,&hRecord) == ERROR_SUCCESS)
+ {
+ DWORD dwKey = 255;
+ DWORD dwName = 255;
+ DWORD dwValue = 1024;
+ DWORD dwComponent = 255;
+
+ szKey[0] = '\0';
+ szName[0] = '\0';
+ szValue[0] = '\0';
+ szComponent[0] = '\0';
+
+ lRoot = MsiRecordGetInteger(hRecord,2);
+ MsiRecordGetString(hRecord,3,szKey,&dwKey);
+
+ if (!MsiRecordIsNull(hRecord, 4))
+ MsiRecordGetString(hRecord,4,szName,&dwName);
+
+ if (!MsiRecordIsNull(hRecord, 5))
+ {
+ MsiRecordGetString(hRecord,5,szValue,&dwValue);
+
+
+
+ wchar_t* nPos = wcsstr(szValue , BASISINSTALLLOCATION);
+ if ( NULL != nPos)
+ {
+
+ DWORD nPrefixSize = nPos - szValue;
+
+ DWORD nPropSize = wcslen(sBasisInstallLocation);
+ DWORD nPostfixSize = dwValue - wcslen( BASISINSTALLLOCATION );
+
DWORD nNewValueBytes = (nPropSize + nPostfixSize + 1) * sizeof( wchar_t );
wchar_t* newValue = reinterpret_cast<wchar_t*>( malloc( nNewValueBytes ) );
- ZeroMemory( newValue, nNewValueBytes );
-
- // prefix
- wcsncpy(newValue, szValue, nPrefixSize);
-
- // basis location
- wcsncat(newValue, sBasisInstallLocation, nPropSize * sizeof( wchar_t ));
-
- // postfix
- wcsncat(newValue, nPos + ( wcslen( BASISINSTALLLOCATION ) ), nPropSize * sizeof( wchar_t ));
-
- wcsncpy(szValue, newValue, nNewValueBytes <=1024? nNewValueBytes: 1024);
-
- free(newValue);
- }
-
- }
-
-
- MsiRecordGetString(hRecord,6,szComponent,&dwComponent);
-
- OutputDebugStringFormat(L"****** DoRegEntries *******" );
- OutputDebugStringFormat(L"Root:" );
- HKEY key = HKEY_CURRENT_USER;
- switch (lRoot)
- {
- case(-1):
- if (isInstall4AllUsers)
- {
- key = HKEY_CURRENT_USER;
- OutputDebugStringFormat(L"HKEY_CURRENT_USER" );
- }
- else
- {
- key = HKEY_LOCAL_MACHINE;
- OutputDebugStringFormat(L"HKEY_LOCAL_MACHINE" );
- }
- break;
- case(0):
- key = HKEY_CLASSES_ROOT;
- OutputDebugStringFormat(L"HKEY_CLASSES_ROOT" );
- break;
- case(1):
- key = HKEY_CURRENT_USER;
- OutputDebugStringFormat(L"HKEY_CURRENT_USER" );
- break;
- case(2):
- key = HKEY_LOCAL_MACHINE;
- OutputDebugStringFormat(L"HKEY_LOCAL_MACHINE" );
- break;
- case(3):
- key = HKEY_USERS;
- OutputDebugStringFormat(L"HKEY_USERS" );
- break;
-
- }
-
- OutputDebugStringFormat(L"Key:");
- OutputDebugStringFormat( szKey );
- OutputDebugStringFormat(L"Name:");
- OutputDebugStringFormat( szName );
- OutputDebugStringFormat(L"Value:");
- OutputDebugStringFormat( szValue);
- OutputDebugStringFormat(L"Component:");
- OutputDebugStringFormat( szComponent );
- OutputDebugStringFormat(L"*******************" );
- switch (op)
- {
- case SET:
-
- if (WriteRegistry(rhMSI, SET, szComponent))
- {
- OutputDebugStringFormat(L"DoRegEntries - Write\n" );
- SetRegistryKey(key, szKey, szName, szValue);
- }
- break;
- case REMOVE:
- OutputDebugStringFormat(L"DoRegEntries - PreRemove\n" );
- if (WriteRegistry(rhMSI, REMOVE, szComponent))
- {
- OutputDebugStringFormat(L"DoRegEntries - Remove\n" );
- DeleteRegistryKey(key, szKey);
- }
- break;
- }
- }
-
- MsiCloseHandle(rhView);
+ ZeroMemory( newValue, nNewValueBytes );
+
+ // prefix
+ wcsncpy(newValue, szValue, nPrefixSize);
+
+ // basis location
+ wcsncat(newValue, sBasisInstallLocation, nPropSize * sizeof( wchar_t ));
+
+ // postfix
+ wcsncat(newValue, nPos + ( wcslen( BASISINSTALLLOCATION ) ), nPropSize * sizeof( wchar_t ));
+
+ wcsncpy(szValue, newValue, nNewValueBytes <=1024? nNewValueBytes: 1024);
+
+ free(newValue);
+ }
+
+ }
+
+
+ MsiRecordGetString(hRecord,6,szComponent,&dwComponent);
+
+ OutputDebugStringFormat(L"****** DoRegEntries *******" );
+ OutputDebugStringFormat(L"Root:" );
+ HKEY key = HKEY_CURRENT_USER;
+ switch (lRoot)
+ {
+ case(-1):
+ if (isInstall4AllUsers)
+ {
+ key = HKEY_CURRENT_USER;
+ OutputDebugStringFormat(L"HKEY_CURRENT_USER" );
+ }
+ else
+ {
+ key = HKEY_LOCAL_MACHINE;
+ OutputDebugStringFormat(L"HKEY_LOCAL_MACHINE" );
+ }
+ break;
+ case(0):
+ key = HKEY_CLASSES_ROOT;
+ OutputDebugStringFormat(L"HKEY_CLASSES_ROOT" );
+ break;
+ case(1):
+ key = HKEY_CURRENT_USER;
+ OutputDebugStringFormat(L"HKEY_CURRENT_USER" );
+ break;
+ case(2):
+ key = HKEY_LOCAL_MACHINE;
+ OutputDebugStringFormat(L"HKEY_LOCAL_MACHINE" );
+ break;
+ case(3):
+ key = HKEY_USERS;
+ OutputDebugStringFormat(L"HKEY_USERS" );
+ break;
+
+ }
+
+ OutputDebugStringFormat(L"Key:");
+ OutputDebugStringFormat( szKey );
+ OutputDebugStringFormat(L"Name:");
+ OutputDebugStringFormat( szName );
+ OutputDebugStringFormat(L"Value:");
+ OutputDebugStringFormat( szValue);
+ OutputDebugStringFormat(L"Component:");
+ OutputDebugStringFormat( szComponent );
+ OutputDebugStringFormat(L"*******************" );
+ switch (op)
+ {
+ case SET:
+
+ if (WriteRegistry(rhMSI, SET, szComponent))
+ {
+ OutputDebugStringFormat(L"DoRegEntries - Write\n" );
+ SetRegistryKey(key, szKey, szName, szValue);
+ }
+ break;
+ case REMOVE:
+ OutputDebugStringFormat(L"DoRegEntries - PreRemove\n" );
+ if (WriteRegistry(rhMSI, REMOVE, szComponent))
+ {
+ OutputDebugStringFormat(L"DoRegEntries - Remove\n" );
+ DeleteRegistryKey(key, szKey);
+ }
+ break;
+ }
+ }
+
+ MsiCloseHandle(rhView);
OutputDebugStringFormat(L"DoRegEntries - ENDE\n" );
@@ -436,13 +438,13 @@ bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView)
bool Reg64(MSIHANDLE& rhMSI, OPERATION op)
{
isInstall4AllUsers = IsInstallForAllUsers(rhMSI);
- sBasisInstallLocation = GetBasisInstallLocation(rhMSI);
-
- if (NULL == sBasisInstallLocation)
- {
- OutputDebugStringFormat(L"BASISINSTALLLOCATION is NULL\n" );
- return false;
- }
+ sBasisInstallLocation = GetBasisInstallLocation(rhMSI);
+
+ if (NULL == sBasisInstallLocation)
+ {
+ OutputDebugStringFormat(L"BASISINSTALLLOCATION is NULL\n" );
+ return false;
+ }
MSIHANDLE hView;
MSIHANDLE hDatabase = MsiGetActiveDatabase(rhMSI);