Commit b74b6343 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Use custom action name for MsiBreak handling.

parent 06ce7001
...@@ -449,21 +449,15 @@ static msi_custom_action_info *find_action_by_guid( const GUID *guid ) ...@@ -449,21 +449,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();
} }
...@@ -497,7 +491,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) ...@@ -497,7 +491,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;
...@@ -525,7 +519,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) ...@@ -525,7 +519,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;
...@@ -533,6 +527,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) ...@@ -533,6 +527,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;
...@@ -542,6 +537,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) ...@@ -542,6 +537,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 );
...@@ -552,7 +548,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) ...@@ -552,7 +548,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
{ {
...@@ -569,11 +565,11 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) ...@@ -569,11 +565,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;
} }
...@@ -1612,7 +1608,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) ...@@ -1612,7 +1608,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;
...@@ -1620,6 +1616,7 @@ UINT __cdecl s_remote_GetActionInfo(const GUID *guid, int *type, LPWSTR *dll, LP ...@@ -1620,6 +1616,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);
......
...@@ -105,7 +105,7 @@ interface IWineMsiRemote ...@@ -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 );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment