msi: Generalize the msi_custom_action_info struct so other custom actions can use it.

This commit is contained in:
James Hawkins 2007-04-15 03:10:00 -05:00 committed by Alexandre Julliard
parent 4cc48b7710
commit 06df9f790d
1 changed files with 13 additions and 13 deletions

View File

@ -412,8 +412,8 @@ static UINT wait_process_handle(MSIPACKAGE* package, UINT type,
typedef struct _msi_custom_action_info { typedef struct _msi_custom_action_info {
struct list entry; struct list entry;
MSIPACKAGE *package; MSIPACKAGE *package;
LPWSTR dllname; LPWSTR source;
LPWSTR function; LPWSTR target;
HANDLE handle; HANDLE handle;
LPWSTR action; LPWSTR action;
INT type; INT type;
@ -428,8 +428,8 @@ static void free_custom_action_data( msi_custom_action_info *info )
if (info->handle) if (info->handle)
CloseHandle( info->handle ); CloseHandle( info->handle );
msi_free( info->action ); msi_free( info->action );
msi_free( info->dllname ); msi_free( info->source );
msi_free( info->function ); msi_free( info->target );
msiobj_release( &info->package->hdr ); msiobj_release( &info->package->hdr );
msi_free( info ); msi_free( info );
} }
@ -497,16 +497,16 @@ static DWORD WINAPI ACTION_CallDllFunction( const GUID *guid )
return r; return r;
} }
TRACE("%s %s\n", debugstr_w( info->dllname ), debugstr_w( info->function ) ); TRACE("%s %s\n", debugstr_w( info->source ), debugstr_w( info->target ) );
hModule = LoadLibraryW( info->dllname ); hModule = LoadLibraryW( info->source );
if (!hModule) if (!hModule)
{ {
ERR("failed to load dll %s\n", debugstr_w( info->dllname ) ); ERR("failed to load dll %s\n", debugstr_w( info->source ) );
return r; return r;
} }
proc = strdupWtoA( info->function ); proc = strdupWtoA( info->target );
fn = (MsiCustomActionEntryPoint) GetProcAddress( hModule, proc ); fn = (MsiCustomActionEntryPoint) GetProcAddress( hModule, proc );
msi_free( proc ); msi_free( proc );
if (fn) if (fn)
@ -514,7 +514,7 @@ static DWORD WINAPI ACTION_CallDllFunction( const GUID *guid )
hPackage = alloc_msihandle( &info->package->hdr ); hPackage = alloc_msihandle( &info->package->hdr );
if (hPackage) if (hPackage)
{ {
TRACE("calling %s\n", debugstr_w( info->function ) ); TRACE("calling %s\n", debugstr_w( info->target ) );
r = fn( hPackage ); r = fn( hPackage );
MsiCloseHandle( hPackage ); MsiCloseHandle( hPackage );
} }
@ -522,7 +522,7 @@ static DWORD WINAPI ACTION_CallDllFunction( const GUID *guid )
ERR("failed to create handle for %p\n", info->package ); ERR("failed to create handle for %p\n", info->package );
} }
else else
ERR("GetProcAddress(%s) failed\n", debugstr_w( info->function ) ); ERR("GetProcAddress(%s) failed\n", debugstr_w( info->target ) );
FreeLibrary(hModule); FreeLibrary(hModule);
@ -549,7 +549,7 @@ static DWORD WINAPI DllThread( LPVOID arg )
} }
static msi_custom_action_info *do_msidbCustomActionTypeDll( static msi_custom_action_info *do_msidbCustomActionTypeDll(
MSIPACKAGE *package, INT type, LPCWSTR dllname, LPCWSTR function, LPCWSTR action ) MSIPACKAGE *package, INT type, LPCWSTR source, LPCWSTR target, LPCWSTR action )
{ {
msi_custom_action_info *info; msi_custom_action_info *info;
@ -560,8 +560,8 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll(
msiobj_addref( &package->hdr ); msiobj_addref( &package->hdr );
info->package = package; info->package = package;
info->type = type; info->type = type;
info->function = strdupW( function ); info->target = strdupW( target );
info->dllname = strdupW( dllname ); info->source = strdupW( source );
info->action = strdupW( action ); info->action = strdupW( action );
CoCreateGuid( &info->guid ); CoCreateGuid( &info->guid );