diff options
Diffstat (limited to 'setup_native/source/win32/customactions/reg64/reg64.cxx')
-rwxr-xr-x | setup_native/source/win32/customactions/reg64/reg64.cxx | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/setup_native/source/win32/customactions/reg64/reg64.cxx b/setup_native/source/win32/customactions/reg64/reg64.cxx index 53eb16a99583..72dc208a8c1b 100755 --- a/setup_native/source/win32/customactions/reg64/reg64.cxx +++ b/setup_native/source/win32/customactions/reg64/reg64.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,21 +44,21 @@ #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); +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. +// in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems. // Also defined in setup_native\source\win32\customactions\reg64\reg64.cxx,source\win32\customactions\shellextensions\shellextensions.cxx and // extensions\source\activex\main\so_activex.cpp #ifndef KEY_WOW64_64KEY - #define KEY_WOW64_64KEY (0x0100) + #define KEY_WOW64_64KEY (0x0100) #endif @@ -93,7 +93,7 @@ static inline void OutputDebugStringFormat( const wchar_t*, ... ) bool WriteRegistry( MSIHANDLE & hMSI, OPERATION op, const wchar_t* componentName) { INSTALLSTATE current_state; - INSTALLSTATE comp_state; + INSTALLSTATE comp_state; UINT ret = MsiGetComponentState( hMSI, componentName, ¤t_state, &comp_state ); if ( ERROR_SUCCESS == ret ) { @@ -159,7 +159,7 @@ BOOL UnicodeEquals( wchar_t* pStr1, wchar_t* pStr2 ) pStr1++, pStr2++; return ( *pStr1 == 0 && *pStr2 == 0 ); -} +} BOOL GetMsiProp( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue ) { @@ -180,11 +180,11 @@ BOOL GetMsiProp( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue ) return TRUE; } else if (ret == ERROR_INVALID_HANDLE) - { + { OutputDebugStringFormat(L"GetMsiProp - ERROR_INVALID_HANDLE" ); } else if (ret == ERROR_INVALID_PARAMETER) { - OutputDebugStringFormat(L"GetMsiProp - ERROR_INVALID_PARAMETER" ); + OutputDebugStringFormat(L"GetMsiProp - ERROR_INVALID_PARAMETER" ); } else if (ret == ERROR_SUCCESS) { OutputDebugStringFormat(L"GetMsiProp - ERROR_SUCCESS" ); @@ -193,7 +193,7 @@ BOOL GetMsiProp( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue ) OutputDebugStringFormat(L"GetMsiProp - ENDE\n" ); return FALSE; -} +} bool IsInstallForAllUsers( MSIHANDLE hMSI ) { @@ -221,9 +221,9 @@ wchar_t* GetBasisInstallLocation( MSIHANDLE hMSI ) return pVal; } + - -bool QueryReg64Table(MSIHANDLE& rhDatabase, MSIHANDLE& rhView) +bool QueryReg64Table(MSIHANDLE& rhDatabase, MSIHANDLE& rhView) { OutputDebugStringFormat(L"QueryReg64Table - START\n" ); int const arraysize = 400; @@ -293,9 +293,9 @@ bool SetRegistryKey(HKEY RootKey, const wchar_t* KeyName, const wchar_t* ValueNa bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView) { OutputDebugStringFormat(L"DoRegEntries - START\n" ); - + MSIHANDLE hRecord; - + long lRoot; wchar_t szKey[255]; wchar_t szName[255]; @@ -305,28 +305,28 @@ bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView) /// 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; - + 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)) + + if (!MsiRecordIsNull(hRecord, 4)) MsiRecordGetString(hRecord,4,szName,&dwName); - + if (!MsiRecordIsNull(hRecord, 5)) { - MsiRecordGetString(hRecord,5,szValue,&dwValue); - - - + MsiRecordGetString(hRecord,5,szValue,&dwValue); + + + wchar_t* nPos = wcsstr(szValue , INSTALLLOCATION); if ( NULL != nPos) { @@ -342,21 +342,21 @@ bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView) // prefix wcsncpy(newValue, szValue, nPrefixSize); - + // basis location wcsncat(newValue, sBasisInstallLocation, nPropSize * sizeof( wchar_t )); // postfix wcsncat(newValue, nPos + ( wcslen( INSTALLLOCATION ) ), nPropSize * sizeof( wchar_t )); - + wcsncpy(szValue, newValue, nNewValueBytes <=1024? nNewValueBytes: 1024); free(newValue); } - + } - - + + MsiRecordGetString(hRecord,6,szComponent,&dwComponent); OutputDebugStringFormat(L"****** DoRegEntries *******" ); @@ -396,7 +396,7 @@ bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView) OutputDebugStringFormat(L"Unknown Root!" ); break; } - + OutputDebugStringFormat(L"Key:"); OutputDebugStringFormat( szKey ); OutputDebugStringFormat(L"Name:"); @@ -409,14 +409,14 @@ bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView) switch (op) { case SET: - + if (WriteRegistry(rhMSI, SET, szComponent)) { OutputDebugStringFormat(L"DoRegEntries - Write\n" ); SetRegistryKey(key, szKey, szName, szValue); } break; - case REMOVE: + case REMOVE: OutputDebugStringFormat(L"DoRegEntries - PreRemove\n" ); if (WriteRegistry(rhMSI, REMOVE, szComponent)) { @@ -428,10 +428,10 @@ bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView) } MsiCloseHandle(rhView); - - + + OutputDebugStringFormat(L"DoRegEntries - ENDE\n" ); - + return true; } @@ -446,7 +446,7 @@ bool Reg64(MSIHANDLE& rhMSI, OPERATION op) OutputDebugStringFormat(L"BASISINSTALLLOCATION is NULL\n" ); return false; } - + MSIHANDLE hView; MSIHANDLE hDatabase = MsiGetActiveDatabase(rhMSI); @@ -466,7 +466,7 @@ extern "C" UINT __stdcall InstallReg64(MSIHANDLE hMSI) { OutputDebugStringFormat(L"InstallReg64\n" ); Reg64(hMSI, SET); - return ERROR_SUCCESS; + return ERROR_SUCCESS; } extern "C" UINT __stdcall DeinstallReg64(MSIHANDLE hMSI) |