Implement MsiBreak Feature - Bug 8243

EA Durbin ead1234 at hotmail.com
Wed May 2 22:45:10 CDT 2007


patch created by Anastasius Focht for Bug 8243.

_________________________________________________________________
Download Messenger. Join the i’m Initiative. Help make a difference today. 
http://im.live.com/messenger/im/home/?source=TAGHM_APR07
-------------- next part --------------
>From 8ec1b4a37c2cb2daaf3648afa4805279577661df Mon Sep 17 00:00:00 2001
From: EA Durbin <ead1234 at hotmail.com>
Date: Wed, 2 May 2007 22:40:20 -0500
Subject: Implement MsiBreak feature, by Anastasius Focht

---
dlls/msi/custom.c |   38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index c8d889e..80d8cde 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -20,6 +20,8 @@

#define COBJMACROS

+#include <sys/types.h> /* for getpid() */
+#include <unistd.h>    /* for getpid() */
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
@@ -511,6 +513,38 @@ static msi_custom_action_info *find_action_by_guid( 
const GUID *guid )
     return info;
}

+static BOOL IsMsiBreak( LPCWSTR CustomActionName)
+{
+    static const WCHAR dbgMsgFormatW[] = {
+        'u','p','i','d','=','%','d',' ','(','0','x','%','X',')','\n',
+        'w','p','i','d','=','%','d',' ','(','0','x','%','X',')','\n','\n',
+        'T','o',' ','d','e','b','u','g',':',' ','a','t','t','a','c','h',' 
',
+        'd','e','b','u','g','g','e','r',' ','t','o',' ','p','i','d',' ',
+        'a','n','d',' ','p','r','e','s','s',' ','\'','O','K','\'','\n',
+        'T','o',' ','s','k','i','p',':',' ','p','r','e','s','s',' ',
+        '\'','c','a','n','c','e','l','\'', 0
+    };
+    WCHAR dbgMsgW[sizeof(dbgMsgFormatW)/sizeof(WCHAR)+40];
+    static const WCHAR envMsiBreakW[] = { 'M','s','i','B','r','e','a','k', 
0 };
+    WCHAR envMsiBreakValueW[MAX_PATH];
+
+    /* check "MsiBreak" environment variable */
+    if( GetEnvironmentVariableW( envMsiBreakW, envMsiBreakValueW, 
MAX_PATH))
+    {
+        if( !lstrcmpiW( envMsiBreakValueW, CustomActionName))
+        {
+           wsprintfW( dbgMsgW, dbgMsgFormatW, (int) getpid(), (int) 
getpid(),
+                             GetCurrentProcessId(), GetCurrentProcessId());
+           if( MessageBoxW( NULL, dbgMsgW, CustomActionName, MB_OKCANCEL) 
== IDOK)
+           {
+              return TRUE;
+           }
+        }
+    }
+
+    return FALSE;
+}
+
static DWORD WINAPI ACTION_CallDllFunction( const GUID *guid )
{
     msi_custom_action_info *info;
@@ -545,6 +579,10 @@ static DWORD WINAPI ACTION_CallDllFunction( const GUID 
*guid )
         if (hPackage)
         {
             TRACE("calling %s\n", debugstr_w( info->target ) );
+
+            if( IsMsiBreak( info->target))
+                 DebugBreak();
+
             r = fn( hPackage );
             MsiCloseHandle( hPackage );
         }
--
1.4.4.2




More information about the wine-patches mailing list