msi: Add handling for MsiBreak

James Hawkins truiken at gmail.com
Wed May 30 13:19:56 CDT 2007


Hi,

I did some testing, and native msi does check the MsiBreak environment
variable for each custom action, so the value can be changed.

Changelog:
* Add handling for MsiBreak.

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

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index eaf5ce9..6169260 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -514,6 +514,39 @@ static msi_custom_action_info *find_acti
     return info;
 }
 
+static void handle_msi_break( LPCWSTR target )
+{
+    LPWSTR msg;
+    WCHAR val[MAX_PATH];
+
+    static const WCHAR MsiBreak[] = { 'M','s','i','B','r','e','a','k',0 };
+    static const WCHAR WindowsInstaller[] = {
+        'W','i','n','d','o','w','s',' ','I','n','s','t','a','l','l','e','r',0
+    };
+
+    static const WCHAR format[] = {
+        'T','o',' ','d','e','b','u','g',' ','y','o','u','r',' ',
+        'c','u','s','t','o','m',' ','a','c','t','i','o','n',',',' ',
+        'a','t','t','a','c','h',' ','y','o','u','r',' ','d','e','b','u','g','g','e','r',' ',
+        't','o',' ','p','r','o','c','e','s','s',' ','%','i',' ','(','0','x','%','X',')',' ',
+        'a','n','d',' ','p','r','e','s','s',' ','O','K',0
+    };
+
+    if( !GetEnvironmentVariableW( MsiBreak, val, MAX_PATH ))
+        return;
+
+    if( lstrcmpiW( val, target ))
+        return;
+
+    msg = msi_alloc( (lstrlenW(format) + 10) * sizeof(WCHAR) );
+    if (!msg)
+        return;
+
+    wsprintfW( msg, format, GetCurrentProcessId(), GetCurrentProcessId());
+    MessageBoxW( NULL, msg, WindowsInstaller, MB_OK);
+    DebugBreak();
+}
+
 static DWORD WINAPI ACTION_CallDllFunction( const GUID *guid )
 {
     msi_custom_action_info *info;
@@ -548,6 +581,7 @@ static DWORD WINAPI ACTION_CallDllFuncti
         if (hPackage)
         {
             TRACE("calling %s\n", debugstr_w( info->target ) );
+            handle_msi_break( info->target );
             r = fn( hPackage );
             MsiCloseHandle( hPackage );
         }
-- 
1.4.1


More information about the wine-patches mailing list