From 4b7f50f673d4883616afb338c279d5268365dae4 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 13 Feb 2006 23:02:06 +0000 Subject: [PATCH] ditch explicit close command; just close the handle --- stepmania/src/archutils/Win32/Crash.cpp | 29 ++++++++----------- .../src/archutils/Win32/CrashHandlerChild.cpp | 3 +- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/stepmania/src/archutils/Win32/Crash.cpp b/stepmania/src/archutils/Win32/Crash.cpp index 147608dd66..00cce8a894 100644 --- a/stepmania/src/archutils/Win32/Crash.cpp +++ b/stepmania/src/archutils/Win32/Crash.cpp @@ -247,27 +247,22 @@ void RunChild() WriteToChild( hToStdin, p, iSize ); /* The parent process needs to access this process briefly. When it's done, it'll - * write a byte to stdout. Wait until we see that before exiting. */ + * close the handle. Wait until we see that before exiting. */ while(1) { - int iCmd; - DWORD iActual; - if( !ReadFile(hFromStdout, &iCmd, sizeof(iCmd), &iActual, NULL) ) - break; - /* Ugly: the new process can't execute GetModuleFileName on this process, * since GetModuleFileNameEx might not be available. Run the requests here. */ - if( iCmd == 1 ) - { - HMODULE hMod; - ReadFile( hFromStdout, &hMod, sizeof(hMod), &iActual, NULL ); - char szName[MAX_PATH]; - if( !CrashGetModuleBaseName(hMod, szName) ) - strcpy( szName, "???" ); - iSize = strlen( szName ); - WriteToChild( hToStdin, &iSize, sizeof(iSize) ); - WriteToChild( hToStdin, szName, iSize ); - } + HMODULE hMod; + DWORD iActual; + if( !ReadFile( hFromStdout, &hMod, sizeof(hMod), &iActual, NULL) ) + break; + + char szName[MAX_PATH]; + if( !CrashGetModuleBaseName(hMod, szName) ) + strcpy( szName, "???" ); + iSize = strlen( szName ); + WriteToChild( hToStdin, &iSize, sizeof(iSize) ); + WriteToChild( hToStdin, szName, iSize ); } } diff --git a/stepmania/src/archutils/Win32/CrashHandlerChild.cpp b/stepmania/src/archutils/Win32/CrashHandlerChild.cpp index 942bc41ddc..8b79380f1e 100644 --- a/stepmania/src/archutils/Win32/CrashHandlerChild.cpp +++ b/stepmania/src/archutils/Win32/CrashHandlerChild.cpp @@ -784,8 +784,7 @@ void ChildProcess() DoSave( sCrashReport ); /* Tell the crashing process that it can exit. Be sure to write crashinfo.txt first. */ - int iCmd = 0; - write( _fileno(stdout), &iCmd, sizeof(iCmd) ); + fclose( stdout ); /* Now that we've done that, the process is gone. Don't use g_hParent. */ CloseHandle( SymbolLookup::g_hParent );