]> git.sesse.net Git - vlc/blobdiff - src/win32/specific.c
libvlc os-specific path discovery
[vlc] / src / win32 / specific.c
index ea8a504fe8bcec7bbab97ac93daf9c4ada1fd324..bf131fbbbccab5e847282273ce508051f29a9197 100644 (file)
@@ -48,18 +48,23 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
 {
     VLC_UNUSED( p_this ); VLC_UNUSED( pi_argc ); VLC_UNUSED( ppsz_argv );
     WSADATA Data;
+    MEMORY_BASIC_INFORMATION mbi;
 
     /* Get our full path */
     char psz_path[MAX_PATH];
     char *psz_vlc;
 
     wchar_t psz_wpath[MAX_PATH];
-    if( GetModuleFileName( NULL, psz_wpath, MAX_PATH ) )
+    if( VirtualQuery(system_Init, &mbi, sizeof(mbi) ) )
     {
-        WideCharToMultiByte( CP_UTF8, 0, psz_wpath, -1,
-                             psz_path, MAX_PATH, NULL, NULL );
+        HMODULE hMod = (HMODULE) mbi.AllocationBase;
+        if( GetModuleFileName( hMod, psz_wpath, MAX_PATH ) )
+        {
+            WideCharToMultiByte( CP_UTF8, 0, psz_wpath, -1,
+                                psz_path, MAX_PATH, NULL, NULL );
+        }
+        else psz_path[0] = '\0';
     }
-    else psz_path[0] = '\0';
 
     if( (psz_vlc = strrchr( psz_path, '\\' )) ) *psz_vlc = '\0';
 
@@ -140,7 +145,7 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv
 #ifndef ABOVE_NORMAL_PRIORITY_CLASS
 #   define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
 #endif
-    if( config_GetInt( p_this, "high-priority" ) )
+    if( var_InheritBool( p_this, "high-priority" ) )
     {
         if( SetPriorityClass( GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS )
              || SetPriorityClass( GetCurrentProcess(), HIGH_PRIORITY_CLASS ) )
@@ -153,9 +158,9 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv
         }
     }
 
-    if( config_GetInt( p_this, "one-instance" )
-        || ( config_GetInt( p_this, "one-instance-when-started-from-file" )
-             && config_GetInt( p_this, "started-from-file" ) ) )
+    if( var_InheritBool( p_this, "one-instance" )
+     || ( var_InheritBool( p_this, "one-instance-when-started-from-file" )
+       && var_InheritBool( p_this, "started-from-file" ) ) )
     {
         HANDLE hmutex;
 
@@ -235,7 +240,7 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv
 
                 p_data = malloc( i_data );
                 p_data->argc = *pi_argc - optind;
-                p_data->enqueue = config_GetInt( p_this, "playlist-enqueue" );
+                p_data->enqueue = var_InheritBool( p_this, "playlist-enqueue" );
                 i_data = 0;
                 for( i_opt = optind; i_opt < *pi_argc; i_opt++ )
                 {