]> git.sesse.net Git - vlc/blobdiff - bin/winvlc.c
sftp: change item b_net
[vlc] / bin / winvlc.c
index 02bc5b684df5e1f07b812eca513abed182805bbe..33784e294d41c12914bc7ede89871ecfbd6bc62b 100644 (file)
@@ -90,13 +90,13 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
         BOOL (WINAPI * mySetDllDirectoryA)(const char* lpPathName);
 # define PROCESS_DEP_ENABLE 1
 
-        mySetProcessDEPPolicy = (BOOL WINAPI (*)(DWORD))
+        mySetProcessDEPPolicy = (BOOL (WINAPI *)(DWORD))
                             GetProcAddress(h_Kernel32, "SetProcessDEPPolicy");
         if(mySetProcessDEPPolicy)
             mySetProcessDEPPolicy(PROCESS_DEP_ENABLE);
 
         /* Do NOT load any library from cwd. */
-        mySetDllDirectoryA = (BOOL WINAPI (*)(const char*))
+        mySetDllDirectoryA = (BOOL (WINAPI *)(const char*))
                             GetProcAddress(h_Kernel32, "SetDllDirectoryA");
         if(mySetDllDirectoryA)
             mySetDllDirectoryA("");
@@ -109,13 +109,12 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
     if (wargv == NULL)
         return 1;
 
-    char *argv[argc + 4];
+    char *argv[argc + 3];
     BOOL crash_handling = TRUE;
     int j = 0;
     char *lang = NULL;
 
     argv[j++] = FromWide( L"--media-library" );
-    argv[j++] = FromWide( L"--stats" );
     argv[j++] = FromWide( L"--no-ignore-config" );
     for (int i = 1; i < argc; i++)
     {
@@ -151,7 +150,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
         SetUnhandledExceptionFilter(vlc_exception_filter);
     }
 
-    _setmode( STDIN_FILENO, _O_BINARY ); /* Needed for pipes */
+    _setmode( _fileno( stdin ), _O_BINARY ); /* Needed for pipes */
 
     /* */
     if (!lang)
@@ -207,7 +206,14 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
 /* Crashdumps handling */
 static void check_crashdump(void)
 {
-    FILE * fd = _wfopen ( crashdump_path, L"r, ccs=UTF-8" );
+    wchar_t mv_crashdump_path[MAX_PATH];
+    wcscpy (mv_crashdump_path, crashdump_path);
+    wcscat (mv_crashdump_path, L".mv");
+
+    if (_wrename (crashdump_path, mv_crashdump_path))
+        return;
+
+    FILE * fd = _wfopen ( mv_crashdump_path, L"r, ccs=UTF-8" );
     if( !fd )
         return;
     fclose( fd );
@@ -235,7 +241,7 @@ static void check_crashdump(void)
                         now.wYear, now.wMonth, now.wDay, now.wHour,
                         now.wMinute, now.wSecond );
 
-                if( FtpPutFile( ftp, crashdump_path, remote_file,
+                if( FtpPutFile( ftp, mv_crashdump_path, remote_file,
                             FTP_TRANSFER_TYPE_BINARY, 0) )
                     MessageBox( NULL, L"Report sent correctly. Thanks a lot " \
                                 "for the help.", L"Report sent", MB_OK);
@@ -265,7 +271,7 @@ static void check_crashdump(void)
         }
     }
 
-    _wremove(crashdump_path);
+    _wremove(mv_crashdump_path);
 }
 
 /*****************************************************************************
@@ -349,6 +355,9 @@ LONG WINAPI vlc_exception_filter(struct _EXCEPTION_POINTERS *lpExceptionInfo)
             GetModuleFileName( mbi.AllocationBase, module, 256 );
             fwprintf( fd, L"%p|%ls\n", caller, module );
 
+            if( IsBadReadPtr( pBase, 2 * sizeof( void* ) ) )
+                break;
+
             /*The last BP points to NULL!*/
             caller = *(pBase + 1);
             if( !caller )