]> git.sesse.net Git - vlc/blobdiff - src/vlc.c
Move __wgetmainargs into VLC's main.
[vlc] / src / vlc.c
index 2cf02bb30f0a47a7fcd38b0653fd158aad02249f..8b90f737948e525435164c8630bb83c5d2fabe66 100644 (file)
--- a/src/vlc.c
+++ b/src/vlc.c
 
 #include <vlc/vlc.h>
 
+#ifdef WIN32
+extern void __wgetmainargs(int *argc, wchar_t ***wargv, wchar_t ***wenviron,
+                           int expand_wildcards, int *startupinfo);
+#endif
+
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
@@ -98,6 +103,20 @@ int main( int i_argc, char *ppsz_argv[] )
     signal( SIGPIPE, SIG_IGN );
 #endif
 
+#ifdef WIN32
+    /* Replace argv[1..n] with unicode for Windows NT and above */
+    if( GetVersion() < 0x80000000 )
+    {
+        wchar_t **wargv, **wenvp;
+        int i,i_wargc;
+        int si = { 0 };
+        __wgetmainargs(&i_wargc, &wargv, &wenvp, 0, &si);
+
+        for( i = 1; i < i_wargc; i++ )
+            ppsz_argv[i] = FromWide( wargv[i] );
+    }
+#endif
+
     /* Initialize libvlc */
     i_ret = VLC_Init( 0, i_argc, ppsz_argv );
     if( i_ret < 0 )