[PATCH] msi: call Custom function via wrapper

Marcus Meissner meissner at suse.de
Wed Feb 3 09:57:00 CST 2010


Hi,

Bug 20725 has the issue that Photoshop CS2 is not installing on openSUSE
11.2 regular Wine.

The difference to other packages is that 11.2 Wine builts with
-fomit-frame-pointer.

Some hours investigating later why I found that the PS2 installer has
Custom Functions that sometimes do "lret 4" (stdcall) and sometimes just
do "lret" (cdecl).

That %ebp framepointer was used before is saving the code from the bad
returns, but it really needs to be fixed with a assembler wrapper to
avoid this bad returns.

(Sample code used from the WINPROC wrapper.)

Ciao, Marcus
---
 dlls/msi/custom.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index 508bf6b..b0b0ed7 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -647,6 +647,33 @@ static UINT get_action_info( const GUID *guid, INT *type, MSIHANDLE *handle,
     return ERROR_SUCCESS;
 }
 
+#ifdef __i386__
+extern UINT CUSTOMPROC_wrapper(
+		MsiCustomActionEntryPoint proc,
+		MSIHANDLE handle
+);
+__ASM_GLOBAL_FUNC( CUSTOMPROC_wrapper,
+	"pushl %ebp\n\t"
+	__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+	__ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
+	"movl %esp,%ebp\n\t"
+	__ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
+	"pushl 12(%ebp)\n\t"
+	"movl 8(%ebp),%eax\n\t"
+	"call *%eax\n\t"
+	"leave\n\t"
+	__ASM_CFI(".cfi_def_cfa %esp,4\n\t")
+	__ASM_CFI(".cfi_same_value %ebp\n\t")
+	"ret" )
+#else
+static inline UINT CUSTOMPROC_wrapper(
+	MsiCustomActionEntryPoint proc,
+	MSIHANDLE handle
+) {
+	return proc(handle);
+}
+#endif
+
 static DWORD ACTION_CallDllFunction( const GUID *guid )
 {
     MsiCustomActionEntryPoint fn;
@@ -685,7 +712,7 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
 
             __TRY
             {
-                r = fn( hPackage );
+                r = CUSTOMPROC_wrapper( fn, hPackage );
             }
             __EXCEPT_PAGE_FAULT
             {
-- 
1.6.4.2



More information about the wine-patches mailing list