Example #1
0
PString FindPluginsPath( void )
{
	CRegString regStr( "CLSID\\{C802F39D-BF85-427A-A334-77E501DB62E9}\\InprocServer32\\", "", FALSE, HKEY_CLASSES_ROOT );

	string strRead			= regStr.read();
	PString strPluginPath	= strRead;
	PINDEX nPos				= strPluginPath.FindLast( "\\" );
	strPluginPath = strPluginPath.Mid( 0, nPos + 1 ) + "js2n\\";

	return strPluginPath;
}
Example #2
0
NPBool CPlugin::init(NPWindow* pNPWindow)
{
  if(pNPWindow == NULL)
    return FALSE;

#ifdef XP_WIN
  m_hWnd = (HWND)pNPWindow->window;
  if(m_hWnd == NULL)
    return FALSE;

  // subclass window so we can intercept window messages and
  // do our drawing to it
  lpOldProc = SubclassWindow(m_hWnd, (WNDPROC)PluginWinProc);

  // associate window with our CPlugin object so we can access 
  // it in the window procedure
  SetWindowLong(m_hWnd, GWL_USERDATA, (LONG)this);
#endif

  m_Window = pNPWindow;

  m_bInitialized	= TRUE;
  g_pNPInstance		= m_pNPInstance;
  g_pNPWindow		= pNPWindow;
  PString strPluginPath;
#ifdef XP_WIN // NPAPI plugin
	//Get Current Path of exe
	char szFullFileName[ MAX_PATH ];
	GetModuleFileName ( GetModuleHandle(NULL), szFullFileName, MAX_PATH ) ;
	strPluginPath = szFullFileName;
	PINDEX nPos = strPluginPath.FindLast( "\\" );
	strPluginPath = strPluginPath.Mid( 0, nPos + 1 ) + "plugins\\js2n\\";
#else // not Windows - assuming Linux
    BrInitError error;
    if (br_init_lib(&error) == 0 && error != BR_INIT_ERROR_DISABLED)
    {
        printf( "Error - can't init binreloc, code %d\n", error );
    }
	strPluginPath = br_find_exe_dir("/usr/lib/firefox/plugins/");
	strPluginPath += "js2n/";
#endif
  g_NativeLogic.Init( g_strPageURL, strPluginPath );
  return TRUE;
}