I have code that we've been using for years with PDFs, HTML docs, and XBRL docs. The code is called from either a BHO in IE, or an Adobe plugin in Reader. It registers a moniker in the ROT, and creates a signalling event.
We've been trying to upgrade from Adobe 9 to Adobe 11, and the debugging the code, it simply fails to register the moniker in the ROT. It works if called from an Adobe 9 plugin, and if called from the BHO. But simply upgrading to Adobe 11 is enough to make it start silently failing.
The code in question is below:
void CLocatorRegistration::Register( ISourceLocator* pLocator, long nKeyFile )
{
HRESULT hr;
CComPtr<IRunningObjectTable> pROT;
CComPtr<IMoniker> pmk;
CComBSTR bstrName;
// access the ROT
pROT = GetROT();
// create the moniker
pmk = CreateMoniker( nKeyFile );
// put this object in the ROT.
_ASSERTE( !m_bRegistered );
->>hr = pROT->Register( ROTFLAGS_REGISTRATIONKEEPSALIVE, pLocator, pmk, &m_dwROTCookie );
if FAILED(hr)
throw hr;
m_bRegistered = true;
// create the event and signal it, to support notification to any callers that this object
// is now available to connect to
CreateEventName( nKeyFile, bstrName );
m_hEvent.Attach( ::CreateEvent( NULL, TRUE, FALSE, bstrName ));
::SetEvent( m_hEvent );
}
The highlighted line is the ROT registration, and the return is S_OK. Does anyone have any idea why the method would succeed, but the entry not be placed into the ROT?
The problem that I found in researching this was the fact that Adobe 11 includes a new sandboxed protected mode setting. When developing a plugin, it no longer by default has access to the OS.
For our purposes it was quite simple just to disable this setting, as this is for an internal application. There are a lot of other ways to accomplish this, but we didn't look into them because of time constraints.