From f1394861f4d8ca3702b31f6f4cd4adfabb2379ee Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Tue, 29 Aug 2006 12:32:27 +0000 Subject: INTEGRATION: CWS hro08 (1.19.8); FILE MERGED 2006/08/28 09:11:49 hro 1.19.8.1: #i64352# _wfopen does not work on Win9x with dynamically linked CRT --- crashrep/source/win32/soreport.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'crashrep/source') diff --git a/crashrep/source/win32/soreport.cpp b/crashrep/source/win32/soreport.cpp index b78d7d34eb0c..22c67729e361 100755 --- a/crashrep/source/win32/soreport.cpp +++ b/crashrep/source/win32/soreport.cpp @@ -4,9 +4,9 @@ * * $RCSfile: soreport.cpp,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: hr $ $Date: 2006-06-19 14:31:42 $ + * last change: $Author: ihi $ $Date: 2006-08-29 13:32:27 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -132,6 +132,26 @@ bool g_bLoadReport = false; // tmpfile from msvcrt creates the temporary file in the root of the current // volume and can fail. +static FILE *_xfopen( const _TCHAR *file, const _TCHAR *mode ) +{ +#ifdef UNICODE + if ( (LONG)GetVersion() < 0 ) + { + char afile[MAX_PATH]; + char amode[16]; + + WideCharToMultiByte( CP_ACP, 0, file, -1, afile, MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CP_ACP, 0, mode, -1, amode, 16, NULL, NULL ); + + + return fopen( afile, amode ); + } + else +#endif + return _tfopen( file, mode ); +} + + static FILE *_tmpfile(void) { FILE *fp = NULL; @@ -203,7 +223,7 @@ static FILE *_open_reportfile( LPCTSTR lpExt, LPCTSTR lpMode ) _tcscat( szAppDataPath, _T("\\crashdat") ); _tcscat( szAppDataPath, lpExt ); - fp = _tfopen( szAppDataPath, lpMode ); + fp = _xfopen( szAppDataPath, lpMode ); } return fp; @@ -420,7 +440,7 @@ void CrashReportParams::ReadFromEnvironment() if ( dwResult && dwResult < elementsof(szBuffer) ) { - FILE *fp = _tfopen( szBuffer, _T("rb") ); + FILE *fp = _xfopen( szBuffer, _T("rb") ); if ( fp ) { -- cgit