in main/extensions/source/activex/main/so_activex.cpp [211:355]
STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess, const char* pProgramPath, const char* pLibName )
{
BOOL aResult = FALSE;
HKEY hkey = NULL;
HKEY hkey1 = NULL;
HKEY hkey2 = NULL;
HKEY hkey3 = NULL;
HKEY hkey4 = NULL;
char aSubKey[513];
int ind;
const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix;
char pActiveXPath[1124];
char pActiveXPath101[1124];
// In case SO7 is installed for this user he can have local registry entries that will prevent him from
// using SO8 ActiveX control. The fix is just to clean up the local entries related to ActiveX control.
// Unfortunately it can be done only for the user who installs the office.
if ( bForAllUsers )
DllUnregisterServerNative( nMode, sal_False, sal_False );
#ifdef MY_DEBUG
MessageBoxA(NULL, pProgramPath, "Library Path, ( from library )", MB_OK | MB_ICONINFORMATION);
#endif
if ( pProgramPath && strlen( pProgramPath ) < 1024 )
{
sprintf( pActiveXPath, "%s\\%s", pProgramPath, pLibName );
sprintf( pActiveXPath101, "%s\\%s, 101", pProgramPath, pLibName );
{
wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID );
aResult =
( ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey , NULL )
&& ERROR_SUCCESS == RegSetValueExA( hkey, "", 0, REG_SZ, (const BYTE*)"SOActiveX Class", 17 )
&& createKey( hkey, "Control", nKeyAccess )
&& createKey( hkey, "EnableFullPage", nKeyAccess )
&& createKey( hkey, "InprocServer32", nKeyAccess, pActiveXPath, "ThreadingModel", "Apartment" )
&& createKey( hkey, "MiscStatus", nKeyAccess, "0" )
&& createKey( hkey, "MiscStatus\\1", nKeyAccess, "131473" )
&& createKey( hkey, "ProgID", nKeyAccess, "so_activex.SOActiveX.1" )
&& createKey( hkey, "Programmable", nKeyAccess )
&& createKey( hkey, "ToolboxBitmap32", nKeyAccess, pActiveXPath101 )
&& createKey( hkey, "TypeLib", nKeyAccess, aTypeLib )
&& createKey( hkey, "Version", nKeyAccess, "1.0" )
&& createKey( hkey, "VersionIndependentProgID", nKeyAccess, "so_activex.SOActiveX" )
&& ERROR_SUCCESS == RegCloseKey( hkey )
&& ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aPrefix, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey , NULL )
&& createKey( hkey, "so_activex.SOActiveX", nKeyAccess, "SOActiveX Class" )
&& ERROR_SUCCESS == RegCreateKeyExA( hkey, "so_activex.SOActiveX", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL )
&& createKey( hkey1, "CLSID", nKeyAccess, aClassID )
&& createKey( hkey1, "CurVer", nKeyAccess, "so_activex.SOActiveX.1" )
&& ERROR_SUCCESS == RegCloseKey( hkey1 )
&& createKey( hkey, "so_activex.SOActiveX.1", nKeyAccess, "SOActiveX Class" )
&& ERROR_SUCCESS == RegCreateKeyExA( hkey, "so_activex.SOActiveX.1", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL )
&& createKey( hkey1, "CLSID", nKeyAccess, aClassID )
&& ERROR_SUCCESS == RegCloseKey( hkey1 )
&& ERROR_SUCCESS == RegCreateKeyExA( hkey, "TypeLib", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL )
&& ERROR_SUCCESS == RegCreateKeyExA( hkey1, aTypeLib, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL )
&& createKey( hkey2, "1.0", nKeyAccess, "wrap_activex 1.0 Type Library" )
&& ERROR_SUCCESS == RegCreateKeyExA( hkey2, "1.0", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey3 , NULL )
&& ERROR_SUCCESS == RegCreateKeyExA( hkey3, "0", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey4 , NULL )
&& createKey( hkey4, "win32", nKeyAccess, pActiveXPath )
&& ERROR_SUCCESS == RegCloseKey( hkey4 )
&& createKey( hkey3, "FLAGS", nKeyAccess, "0" )
&& createKey( hkey3, "HELPDIR", nKeyAccess, pProgramPath )
&& ERROR_SUCCESS == RegCloseKey( hkey3 )
&& ERROR_SUCCESS == RegCloseKey( hkey2 )
&& ERROR_SUCCESS == RegCloseKey( hkey1 )
&& ERROR_SUCCESS == RegCreateKeyExA( hkey, "Interface", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL )
&& createKey( hkey1, aInterIDWinPeer, nKeyAccess, "ISOComWindowPeer" )
&& ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDWinPeer, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL )
&& createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubWinPeer )
&& createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubWinPeer )
&& createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" )
&& ERROR_SUCCESS == RegCloseKey( hkey2 )
&& createKey( hkey1, aInterIDActApprove, nKeyAccess, "ISOActionsApproval" )
&& ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDActApprove, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL )
&& createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubActApprove )
&& createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubActApprove )
&& createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" )
&& ERROR_SUCCESS == RegCloseKey( hkey2 )
&& createKey( hkey1, aInterIDDispInt, nKeyAccess, "ISODispatchInterceptor" )
&& ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDDispInt, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL )
&& createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubDispInt )
&& createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubDispInt )
&& createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" )
&& ERROR_SUCCESS == RegCloseKey( hkey2 )
&& ERROR_SUCCESS == RegCloseKey( hkey1 )
&& ERROR_SUCCESS == RegCloseKey( hkey ) );
hkey = hkey1 = hkey2 = hkey3 = hkey4 = NULL;
}
}
for( ind = 0; ind < SUPPORTED_EXT_NUM && aResult; ind++ )
{
if( nForModes[ind] & nMode )
{
wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind] );
if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL )
// || ERROR_SUCCESS != RegSetValueExA(hkey, "Extension", 0, REG_SZ,
// (const BYTE *)aFileExt[ind], strlen( aFileExt[ind] ) )
|| ERROR_SUCCESS != RegSetValueExA(hkey, "CLSID", 0, REG_SZ,
(const BYTE *)aClassID, strlen(aClassID)) )
aResult = FALSE;
if( hkey )
RegCloseKey(hkey),hkey= NULL;
/*
wsprintfA( aSubKey, "%s%s", aPrefix, aFileExt[ind] );
if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL )
|| ERROR_SUCCESS != RegSetValueExA(hkey, "Content Type", 0, REG_SZ,
(const BYTE *)aMimeType[ind], strlen( aMimeType[ind] ) ) )
aResult = FALSE;
if( hkey )
RegCloseKey(hkey),hkey= NULL;
*/
}
}
wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID );
if ( aResult && ERROR_SUCCESS == RegOpenKeyExA(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nKeyAccess, &hkey) )
{
for( ind = 0; ind < SUPPORTED_EXT_NUM; ind++ )
{
wsprintfA( aSubKey, "EnableFullPage\\%s", aFileExt[ind] );
if ( ERROR_SUCCESS != RegCreateKeyExA( hkey, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) )
aResult = FALSE;
if ( hkey1 )
RegCloseKey(hkey1),hkey1= NULL;
}
}
else
aResult = FALSE;
if ( hkey )
RegCloseKey(hkey),hkey= NULL;
return aResult;
}