]> git.sesse.net Git - vlc/commitdiff
- activex: fix plugin path search, now relative to DLL location & registry settings
authorDamien Fouilleul <damienf@videolan.org>
Tue, 26 Sep 2006 03:12:52 +0000 (03:12 +0000)
committerDamien Fouilleul <damienf@videolan.org>
Tue, 26 Sep 2006 03:12:52 +0000 (03:12 +0000)
activex/main.cpp
activex/plugin.cpp

index 53df72424a54d0fe62f93ede8f7fa4fa9f773374..803f6a613a3df4b5e7addc016ceeac85bbc45b22 100644 (file)
@@ -51,13 +51,19 @@ extern const CATID CATID_SafeForScripting;
 static LONG i_class_ref= 0;
 static HINSTANCE h_instance= 0;
 
+HMODULE DllGetModule()
+{
+    return h_instance;
+};
+
 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 {
     HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
 
     *ppv = NULL;
 
-    if( CLSID_VLCPlugin2 == rclsid )
+    if( (CLSID_VLCPlugin == rclsid )
+     || ( CLSID_VLCPlugin2 == rclsid) )
     {
         VLCPluginClass *plugin = new VLCPluginClass(&i_class_ref, h_instance, rclsid);
         hr = plugin->QueryInterface(riid, ppv);
index 566f4a2a054ec87635402eb145551ed638b268ba..12295b42fc5473bee1136463516b1935a705f351 100644 (file)
@@ -549,6 +549,8 @@ HRESULT VLCPlugin::getVLCObject(int* i_vlc)
 
 HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
 {
+    extern HMODULE DllGetModule();
+
     if( ! isRunning() )
     {
         /*
@@ -568,16 +570,21 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
              {
                  if( i_type == REG_SZ )
                  {
-                     strcat( p_data, "\\vlc" );
-                     ppsz_argv[0] = p_data;
+                     strcat( p_data, "\\plugins" );
+                    ppsz_argv[ppsz_argc++] = "--plugin-path";
+                     ppsz_argv[ppsz_argc++] = p_data;
                  }
              }
              RegCloseKey( h_key );
         }
 
-#if 0
-        ppsz_argv[0] = "C:\\cygwin\\home\\damienf\\vlc-trunk\\vlc";
-#endif
+       char p_path[MAX_PATH+1];
+       DWORD len = GetModuleFileNameA(DllGetModule(), p_path, sizeof(p_path));
+       if( len > 0 )
+       {
+           p_path[len] = '\0';
+           ppsz_argv[0] = p_path;
+       }
 
         // make sure plugin isn't affected with VLC single instance mode
         ppsz_argv[ppsz_argc++] = "--no-one-instance";