summaryrefslogtreecommitdiff
path: root/crashrep/source/win32
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2005-05-20 14:41:02 +0000
committerRüdiger Timm <rt@openoffice.org>2005-05-20 14:41:02 +0000
commit24a462c067645e4d36451b3cd5a82f5a1b89b551 (patch)
tree1cff8918458a1855c300b5bb81b0d4228a843312 /crashrep/source/win32
parent360a26374ac594df6cc7c55366661774ecbfefe6 (diff)
INTEGRATION: CWS nativefixer9 (1.15.2); FILE MERGED
2005/05/19 08:26:43 hro 1.15.2.1: #i49458# Patch Description in soffice.bin
Diffstat (limited to 'crashrep/source/win32')
-rwxr-xr-xcrashrep/source/win32/soreport.cpp96
1 files changed, 94 insertions, 2 deletions
diff --git a/crashrep/source/win32/soreport.cpp b/crashrep/source/win32/soreport.cpp
index 65883e5aa52e..b8d3364b8c02 100755
--- a/crashrep/source/win32/soreport.cpp
+++ b/crashrep/source/win32/soreport.cpp
@@ -2,9 +2,9 @@
*
* $RCSfile: soreport.cpp,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: rt $ $Date: 2005-05-13 09:30:04 $
+ * last change: $Author: rt $ $Date: 2005-05-20 15:41:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1518,6 +1518,53 @@ BOOL CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
//* Generate MD5 checksum
//*****************************************************************************
+#define MAGIC_DESCRIPTION_FILLER 'x'
+#define MAGIC_DESCRIPTION_COUNT 80
+
+static void repatch_soffice_exe( void *pBuffer, size_t nBufSize )
+{
+ wchar_t DescriptionBuffer[MAGIC_DESCRIPTION_COUNT];
+
+ memset( DescriptionBuffer, 0, sizeof(DescriptionBuffer) );
+ wcsncpy( DescriptionBuffer, g_wstrProductKey.c_str(), elementsof(DescriptionBuffer) - 1 );
+
+ bool bPatched = false;
+
+ do
+ {
+ void *pFound = memchr( pBuffer, ((char *)DescriptionBuffer)[0], nBufSize );
+
+ if ( pFound )
+ {
+ size_t distance = (char *)pFound - (char *)pBuffer;
+
+ if ( nBufSize >= distance )
+ {
+ nBufSize -= distance;
+
+ if ( nBufSize >= sizeof(DescriptionBuffer) &&
+ 0 == memcmp( pFound, DescriptionBuffer, sizeof(DescriptionBuffer) ) )
+ {
+ for ( int i = 0; i < 80; i++ )
+ {
+ ((wchar_t *)pFound)[i] = MAGIC_DESCRIPTION_FILLER;
+ }
+ bPatched = true;
+ }
+ else
+ {
+ pBuffer = (void *)(((char *)pFound) + 1);
+ nBufSize--;
+ }
+ }
+ else
+ nBufSize = 0;
+ }
+ else
+ nBufSize = 0;
+ } while ( !bPatched && nBufSize );
+}
+
static sal_uInt32 calc_md5_checksum( const char *filename, sal_uInt8 *pChecksum, sal_uInt32 nChecksumLen )
{
sal_uInt32 nBytesProcessed = 0;
@@ -1537,6 +1584,9 @@ static sal_uInt32 calc_md5_checksum( const char *filename, sal_uInt8 *pChecksum
if ( nBytesRead == nFileSize )
{
+ if ( 0 == stricmp( GetFileName(filename).c_str(), "soffice.bin" ) )
+ repatch_soffice_exe( pBuffer, nBytesRead );
+
rtlDigestError error = rtl_digest_MD5 (
pBuffer, nBytesRead,
pChecksum, nChecksumLen );
@@ -1555,6 +1605,48 @@ static sal_uInt32 calc_md5_checksum( const char *filename, sal_uInt8 *pChecksum
return nBytesProcessed;
}
+#if 0
+static sal_uInt32 calc_md5_checksum( const char *filename, sal_uInt8 *pChecksum, sal_uInt32 nChecksumLen )
+{
+ sal_uInt32 nBytesProcessed = 0;
+
+ FILE *fp = fopen( filename, "rb" );
+
+ if ( fp )
+ {
+ rtlDigest digest = rtl_digest_createMD5();
+
+ if ( digest )
+ {
+ size_t nBytesRead;
+ sal_uInt8 buffer[4096];
+ rtlDigestError error = rtl_Digest_E_None;
+
+ while ( rtl_Digest_E_None == error &&
+ 0 != (nBytesRead = fread( buffer, 1, sizeof(buffer), fp )) )
+ {
+ error = rtl_digest_updateMD5( digest, buffer, nBytesRead );
+ nBytesProcessed += nBytesRead;
+ }
+
+ if ( rtl_Digest_E_None == error )
+ {
+ error = rtl_digest_getMD5( digest, pChecksum, nChecksumLen );
+ }
+
+ if ( rtl_Digest_E_None != error )
+ nBytesProcessed = 0;
+
+ rtl_digest_destroyMD5( digest );
+ }
+
+ fclose( fp );
+ }
+
+ return nBytesProcessed;
+}
+
+#endif
//***************************************************************************
static bool WriteStackFile( FILE *fout, hash_map< string, string >& rLibraries, DWORD dwProcessId, PEXCEPTION_POINTERS pExceptionPointers )