[WINESYNC] msi: Use custom action name for MsiBreak handling.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50433
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id b74b634335c8d843e6dc2ef21e5d9248ca05bae9 by Hans Leidekker <hans@codeweavers.com>
This commit is contained in:
winesync 2022-03-14 20:05:24 +01:00 committed by Mark Jansen
parent 218a1ae241
commit 5deb0e6042
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
2 changed files with 16 additions and 19 deletions

View file

@ -456,21 +456,15 @@ static msi_custom_action_info *find_action_by_guid( const GUID *guid )
return info; return info;
} }
static void handle_msi_break(LPCSTR target) static void handle_msi_break( const WCHAR *action )
{ {
char format[] = "To debug your custom action, attach your debugger to " const WCHAR fmt[] = L"To debug your custom action, attach your debugger to process %u (0x%x) and press OK";
"process %i (0x%X) and press OK"; WCHAR val[MAX_PATH], msg[100];
char val[MAX_PATH];
char msg[100];
if (!GetEnvironmentVariableA("MsiBreak", val, MAX_PATH)) if (!GetEnvironmentVariableW( L"MsiBreak", val, MAX_PATH ) || wcscmp( val, action )) return;
return;
if (strcmp(val, target)) swprintf( msg, ARRAY_SIZE(msg), fmt, GetCurrentProcessId(), GetCurrentProcessId() );
return; MessageBoxW( NULL, msg, L"Windows Installer", MB_OK );
sprintf(msg, format, GetCurrentProcessId(), GetCurrentProcessId());
MessageBoxA(NULL, msg, "Windows Installer", MB_OK);
DebugBreak(); DebugBreak();
} }
@ -518,7 +512,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid)
RPC_WSTR binding_str; RPC_WSTR binding_str;
MSIHANDLE hPackage; MSIHANDLE hPackage;
RPC_STATUS status; RPC_STATUS status;
LPWSTR dll = NULL; WCHAR *dll = NULL, *action = NULL;
LPSTR proc = NULL; LPSTR proc = NULL;
HANDLE hModule; HANDLE hModule;
INT type; INT type;
@ -546,7 +540,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid)
RpcStringFreeW(&binding_str); RpcStringFreeW(&binding_str);
} }
r = remote_GetActionInfo(guid, &type, &dll, &proc, &remote_package); r = remote_GetActionInfo(guid, &action, &type, &dll, &proc, &remote_package);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
return r; return r;
@ -554,6 +548,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid)
if (!hPackage) if (!hPackage)
{ {
ERR( "failed to create handle for %x\n", remote_package ); ERR( "failed to create handle for %x\n", remote_package );
midl_user_free( action );
midl_user_free( dll ); midl_user_free( dll );
midl_user_free( proc ); midl_user_free( proc );
return ERROR_INSTALL_FAILURE; return ERROR_INSTALL_FAILURE;
@ -563,6 +558,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid)
if (!hModule) if (!hModule)
{ {
ERR( "failed to load dll %s (%u)\n", debugstr_w( dll ), GetLastError() ); ERR( "failed to load dll %s (%u)\n", debugstr_w( dll ), GetLastError() );
midl_user_free( action );
midl_user_free( dll ); midl_user_free( dll );
midl_user_free( proc ); midl_user_free( proc );
MsiCloseHandle( hPackage ); MsiCloseHandle( hPackage );
@ -573,7 +569,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid)
if (!fn) WARN( "GetProcAddress(%s) failed\n", debugstr_a(proc) ); if (!fn) WARN( "GetProcAddress(%s) failed\n", debugstr_a(proc) );
else else
{ {
handle_msi_break(proc); handle_msi_break(action);
__TRY __TRY
{ {
@ -590,11 +586,11 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid)
FreeLibrary(hModule); FreeLibrary(hModule);
midl_user_free(action);
midl_user_free(dll); midl_user_free(dll);
midl_user_free(proc); midl_user_free(proc);
MsiCloseAllHandles(); MsiCloseAllHandles();
return r; return r;
} }
@ -1633,7 +1629,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
LeaveCriticalSection( &msi_custom_action_cs ); LeaveCriticalSection( &msi_custom_action_cs );
} }
UINT __cdecl s_remote_GetActionInfo(const GUID *guid, int *type, LPWSTR *dll, LPSTR *func, MSIHANDLE *hinst) UINT __cdecl s_remote_GetActionInfo(const GUID *guid, WCHAR **name, int *type, WCHAR **dll, char **func, MSIHANDLE *hinst)
{ {
msi_custom_action_info *info; msi_custom_action_info *info;
@ -1641,6 +1637,7 @@ UINT __cdecl s_remote_GetActionInfo(const GUID *guid, int *type, LPWSTR *dll, LP
if (!info) if (!info)
return ERROR_INVALID_DATA; return ERROR_INVALID_DATA;
*name = strdupW(info->action);
*type = info->type; *type = info->type;
*hinst = alloc_msihandle(&info->package->hdr); *hinst = alloc_msihandle(&info->package->hdr);
*dll = strdupW(info->source); *dll = strdupW(info->source);

View file

@ -105,7 +105,7 @@ interface IWineMsiRemote
UINT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in, string, unique] LPCWSTR component, [in] DWORD index, [in] INSTALLSTATE state, UINT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in, string, unique] LPCWSTR component, [in] DWORD index, [in] INSTALLSTATE state,
[out, string, size_is(3)] LPWSTR drive, [out] INT *cost, [out] INT *temp ); [out, string, size_is(3)] LPWSTR drive, [out] INT *cost, [out] INT *temp );
UINT remote_GetActionInfo( [in] const GUID *guid, [out] int *type, [out, string] LPWSTR *dllname, UINT remote_GetActionInfo( [in] const GUID *guid, [out, string] WCHAR **action, [out] int *type, [out, string] WCHAR **dllname,
[out, string] LPSTR *function, [out] MSIHANDLE *hinst ); [out, string] char **function, [out] MSIHANDLE *hinst );
UINT remote_CloseHandle( [in] MSIHANDLE handle ); UINT remote_CloseHandle( [in] MSIHANDLE handle );
} }