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

msi: Improve the BindImage action stub.

parent 02fb5304
MODULE = msi.dll MODULE = msi.dll
IMPORTLIB = msi IMPORTLIB = msi
IMPORTS = uuid urlmon wininet comctl32 shell32 shlwapi cabinet oleaut32 ole32 version user32 gdi32 advapi32 IMPORTS = uuid urlmon wininet comctl32 shell32 shlwapi cabinet oleaut32 ole32 version user32 gdi32 advapi32
DELAYIMPORTS = odbccp32 wintrust crypt32 DELAYIMPORTS = odbccp32 wintrust crypt32 imagehlp
C_SRCS = \ C_SRCS = \
action.c \ action.c \
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "objbase.h" #include "objbase.h"
#include "mscoree.h" #include "mscoree.h"
#include "shlwapi.h" #include "shlwapi.h"
#include "imagehlp.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "winver.h" #include "winver.h"
...@@ -7097,7 +7098,6 @@ static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package ) ...@@ -7097,7 +7098,6 @@ static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package )
{ {
UINT r; UINT r;
MSIQUERY *view; MSIQUERY *view;
static const WCHAR query[] = static const WCHAR query[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','U','p','g','r','a','d','e',0}; {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','U','p','g','r','a','d','e',0};
...@@ -7121,6 +7121,66 @@ static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package ) ...@@ -7121,6 +7121,66 @@ static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static void bind_image( const char *filename, const char *path )
{
if (!BindImageEx( 0, filename, path, NULL, NULL ))
{
WARN("failed to bind image %u\n", GetLastError());
}
}
static UINT ITERATE_BindImage( MSIRECORD *rec, LPVOID param )
{
UINT i;
MSIFILE *file;
MSIPACKAGE *package = param;
const WCHAR *key = MSI_RecordGetString( rec, 1 );
const WCHAR *paths = MSI_RecordGetString( rec, 2 );
char *filenameA, *pathA;
WCHAR *pathW, **path_list;
if (!(file = msi_get_loaded_file( package, key )))
{
WARN("file %s not found\n", debugstr_w(key));
return ERROR_SUCCESS;
}
if (!(filenameA = strdupWtoA( file->TargetPath ))) return ERROR_SUCCESS;
path_list = msi_split_string( paths, ';' );
if (!path_list) bind_image( filenameA, NULL );
else
{
for (i = 0; path_list[i] && path_list[i][0]; i++)
{
deformat_string( package, path_list[i], &pathW );
if ((pathA = strdupWtoA( pathW )))
{
bind_image( filenameA, pathA );
msi_free( pathA );
}
msi_free( pathW );
}
}
msi_free( path_list );
msi_free( filenameA );
return ERROR_SUCCESS;
}
static UINT ACTION_BindImage( MSIPACKAGE *package )
{
UINT r;
MSIQUERY *view;
static const WCHAR query[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','B','i','n','d','I','m','a','g','e',0};
r = MSI_DatabaseOpenViewW( package->db, query, &view );
if (r == ERROR_SUCCESS)
{
r = MSI_IterateRecords( view, NULL, ITERATE_BindImage, package );
msiobj_release( &view->hdr );
}
return ERROR_SUCCESS;
}
static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, static UINT msi_unimplemented_action_stub( MSIPACKAGE *package,
LPCSTR action, LPCWSTR table ) LPCSTR action, LPCWSTR table )
{ {
...@@ -7145,12 +7205,6 @@ static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, ...@@ -7145,12 +7205,6 @@ static UINT msi_unimplemented_action_stub( MSIPACKAGE *package,
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT ACTION_BindImage( MSIPACKAGE *package )
{
static const WCHAR table[] = { 'B','i','n','d','I','m','a','g','e',0 };
return msi_unimplemented_action_stub( package, "BindImage", table );
}
static UINT ACTION_IsolateComponents( MSIPACKAGE *package ) static UINT ACTION_IsolateComponents( MSIPACKAGE *package )
{ {
static const WCHAR table[] = { static const WCHAR table[] = {
......
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