diff options
author | Rüdiger Timm <rt@openoffice.org> | 2004-01-07 15:18:35 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2004-01-07 15:18:35 +0000 |
commit | 6ca5bf11b9f130e0c0219df5cbce6b0b467ea6af (patch) | |
tree | c1158ebf63a554c9fc900fc0f2c311de6365fccb /crashrep/source/win32 | |
parent | 4667051fe261e33e843bf879149502d94669e046 (diff) |
INTEGRATION: CWS geordi2q12 (1.8.2); FILE MERGED
2004/01/07 15:07:36 hr 1.8.2.1: #111934#: merge CWS crashrep7pp2 -> SRC680
Diffstat (limited to 'crashrep/source/win32')
-rwxr-xr-x | crashrep/source/win32/soreport.cpp | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/crashrep/source/win32/soreport.cpp b/crashrep/source/win32/soreport.cpp index e24efd470532..5f7c5fc6d783 100755 --- a/crashrep/source/win32/soreport.cpp +++ b/crashrep/source/win32/soreport.cpp @@ -2,14 +2,15 @@ * * $RCSfile: soreport.cpp,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: vg $ $Date: 2003-12-17 19:30:21 $ + * last change: $Author: rt $ $Date: 2004-01-07 16:18:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses * * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 * * Sun Microsystems Inc., October, 2000 * @@ -32,6 +33,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * * Copyright: 2000 by Sun Microsystems, Inc. @@ -42,6 +58,7 @@ * * ************************************************************************/ + #define UNICODE #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -104,7 +121,7 @@ using namespace ::std; -wstring g_strProductKey; +wstring g_wstrProductKey; string g_strDefaultLanguage; FILE *g_fpStackFile = NULL; FILE *g_fpChecksumFile = NULL; @@ -410,6 +427,19 @@ static int LoadAndFormatString( HINSTANCE hInstance, UINT uID, LPTSTR lpBuffer, //*************************************************************************** +static string wstring2utf8( const wstring &rString ) +{ + int nBufSize = WideCharToMultiByte( CP_UTF8, 0, rString.c_str(), -1, NULL, 0, NULL, FALSE ); + + LPSTR pBuffer = (LPSTR)alloca( nBufSize ); + + WideCharToMultiByte( CP_UTF8, 0, rString.c_str(), -1, pBuffer, nBufSize, NULL, FALSE ); + + return string( pBuffer ); +} + +//*************************************************************************** + static string xml_encode( const string &rString ) { string temp = rString; @@ -523,7 +553,6 @@ BOOL WriteReportFile( CrashReportParams *pParams ) CHAR szBuildId[1024] = ""; CHAR szEmail[1024] = ""; const char *pszUserType = getenv( "STAROFFICE_USERTYPE" ); - const char *pszProductName = getenv( "PRODUCTNAME" ); WideCharToMultiByte( CP_UTF8, 0, pParams->szTitle, -1, szTitle, sizeof(szTitle), NULL, NULL ); WideCharToMultiByte( CP_UTF8, 0, g_szBuildId, -1, szBuildId, sizeof(szBuildId), NULL, NULL ); @@ -551,10 +580,10 @@ BOOL WriteReportFile( CrashReportParams *pParams ) "<officeinfo:officeinfo xmlns:officeinfo=\"http://openoffice.org/2002/officeinfo\" build=\"%s\" platform=\"%s\" language=\"%s\" procpath=\"%s\" exceptiontype=\"0x%08X\" product=\"%s\"/>\n", szBuildId, _INPATH, - g_strDefaultLanguage.c_str(), - GetModuleDirectory( NULL ).c_str(), + xml_encode(g_strDefaultLanguage).c_str(), + xml_encode(GetModuleDirectory( NULL )).c_str(), g_dwExceptionCode, - pszProductName ? pszProductName : "" + xml_encode(wstring2utf8(g_wstrProductKey)).c_str() ); OSVERSIONINFO VersionInfo; @@ -1264,6 +1293,9 @@ BOOL CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ShowWindow( hwndPages[1], SW_HIDE ); ShowWindow( hwndPages[0], SW_SHOW ); + + // Let Crash Reporter window stay on top of all other windows + SetWindowPos( hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE ); } return FALSE; case WM_CTLCOLORSTATIC: @@ -1341,7 +1373,7 @@ static void repatch_soffice_exe( void *pBuffer, size_t nBufSize ) wchar_t DescriptionBuffer[MAGIC_DESCRIPTION_COUNT]; memset( DescriptionBuffer, 0, sizeof(DescriptionBuffer) ); - wcsncpy( DescriptionBuffer, g_strProductKey.c_str(), elementsof(DescriptionBuffer) - 1 ); + wcsncpy( DescriptionBuffer, g_wstrProductKey.c_str(), elementsof(DescriptionBuffer) - 1 ); bool bPatched = false; @@ -1549,10 +1581,10 @@ static bool WriteStackFile( FILE *fout, hash_map< string, string >& rLibraries, frameNum, frame.AddrPC.Offset, frame.AddrPC.Offset - moduleInfo.BaseOfImage, - pSymbol->Name, + xml_encode(pSymbol->Name).c_str(), frame.AddrPC.Offset - pSymbol->Address, - GetFileName( moduleInfo.LoadedImageName ).c_str(), - GetFileDirectory( moduleInfo.LoadedImageName ).c_str() + xml_encode(GetFileName( moduleInfo.LoadedImageName )).c_str(), + xml_encode( GetFileDirectory( moduleInfo.LoadedImageName )).c_str() ); else fprintf( fout, "<errormail:StackInfo " \ @@ -1560,8 +1592,8 @@ static bool WriteStackFile( FILE *fout, hash_map< string, string >& rLibraries, frameNum, frame.AddrPC.Offset, frame.AddrPC.Offset - moduleInfo.BaseOfImage, - GetFileName( moduleInfo.LoadedImageName ).c_str(), - GetFileDirectory( moduleInfo.LoadedImageName ).c_str() + xml_encode(GetFileName( moduleInfo.LoadedImageName )).c_str(), + xml_encode(GetFileDirectory( moduleInfo.LoadedImageName )).c_str() ); } else @@ -2017,7 +2049,7 @@ static bool ReadBootstrapParams() { TCHAR *pVersion = _tcschr( szBuffer, ' ' ); - g_strProductKey = szBuffer; + g_wstrProductKey = szBuffer; if ( pVersion ) { |