msi: Don't fail if no .NET runtime is available.
This commit is contained in:
parent
f6f1bfd6fb
commit
458f6b7ccd
|
@ -49,13 +49,21 @@ static BOOL init_function_pointers( void )
|
||||||
static const WCHAR szVersion20[] = {'v','2','.','0','.','5','0','7','2','7',0};
|
static const WCHAR szVersion20[] = {'v','2','.','0','.','5','0','7','2','7',0};
|
||||||
static const WCHAR szVersion40[] = {'v','4','.','0','.','3','0','3','1','9',0};
|
static const WCHAR szVersion40[] = {'v','4','.','0','.','3','0','3','1','9',0};
|
||||||
|
|
||||||
if (pCreateAssemblyCacheNet10 || pCreateAssemblyCacheNet11 || pCreateAssemblyCacheNet20 ||
|
if (!hsxs && !(hsxs = LoadLibraryA( "sxs.dll" ))) return FALSE;
|
||||||
pCreateAssemblyCacheNet40 ) return TRUE;
|
if (!(pCreateAssemblyCacheSxs = (void *)GetProcAddress( hsxs, "CreateAssemblyCache" )))
|
||||||
|
{
|
||||||
if (!(hmscoree = LoadLibraryA( "mscoree.dll" ))) return FALSE;
|
FreeLibrary( hsxs );
|
||||||
|
hsxs = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (hmscoree || !(hmscoree = LoadLibraryA( "mscoree.dll" ))) return TRUE;
|
||||||
pGetFileVersion = (void *)GetProcAddress( hmscoree, "GetFileVersion" ); /* missing from v1.0.3705 */
|
pGetFileVersion = (void *)GetProcAddress( hmscoree, "GetFileVersion" ); /* missing from v1.0.3705 */
|
||||||
if (!(pLoadLibraryShim = (void *)GetProcAddress( hmscoree, "LoadLibraryShim" ))) goto error;
|
if (!(pLoadLibraryShim = (void *)GetProcAddress( hmscoree, "LoadLibraryShim" )))
|
||||||
|
{
|
||||||
|
FreeLibrary( hmscoree );
|
||||||
|
hmscoree = NULL;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
if (!pLoadLibraryShim( szFusion, szVersion10, NULL, &hfusion10 ))
|
if (!pLoadLibraryShim( szFusion, szVersion10, NULL, &hfusion10 ))
|
||||||
pCreateAssemblyCacheNet10 = (void *)GetProcAddress( hfusion10, "CreateAssemblyCache" );
|
pCreateAssemblyCacheNet10 = (void *)GetProcAddress( hfusion10, "CreateAssemblyCache" );
|
||||||
|
|
||||||
|
@ -68,76 +76,27 @@ static BOOL init_function_pointers( void )
|
||||||
if (!pLoadLibraryShim( szFusion, szVersion40, NULL, &hfusion40 ))
|
if (!pLoadLibraryShim( szFusion, szVersion40, NULL, &hfusion40 ))
|
||||||
pCreateAssemblyCacheNet40 = (void *)GetProcAddress( hfusion40, "CreateAssemblyCache" );
|
pCreateAssemblyCacheNet40 = (void *)GetProcAddress( hfusion40, "CreateAssemblyCache" );
|
||||||
|
|
||||||
if (!pCreateAssemblyCacheNet10 && !pCreateAssemblyCacheNet11 && !pCreateAssemblyCacheNet20
|
|
||||||
&& !pCreateAssemblyCacheNet40) goto error;
|
|
||||||
|
|
||||||
if (!(hsxs = LoadLibraryA( "sxs.dll" ))) goto error;
|
|
||||||
if (!(pCreateAssemblyCacheSxs = (void *)GetProcAddress( hsxs, "CreateAssemblyCache" ))) goto error;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
error:
|
|
||||||
pCreateAssemblyCacheNet10 = NULL;
|
|
||||||
pCreateAssemblyCacheNet11 = NULL;
|
|
||||||
pCreateAssemblyCacheNet20 = NULL;
|
|
||||||
pCreateAssemblyCacheNet40 = NULL;
|
|
||||||
FreeLibrary( hfusion10 );
|
|
||||||
FreeLibrary( hfusion11 );
|
|
||||||
FreeLibrary( hfusion20 );
|
|
||||||
FreeLibrary( hfusion40 );
|
|
||||||
FreeLibrary( hmscoree );
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL msi_init_assembly_caches( MSIPACKAGE *package )
|
BOOL msi_init_assembly_caches( MSIPACKAGE *package )
|
||||||
{
|
{
|
||||||
if (!init_function_pointers()) return FALSE;
|
if (!init_function_pointers()) return FALSE;
|
||||||
if (package->cache_net[CLR_VERSION_V10] ||
|
|
||||||
package->cache_net[CLR_VERSION_V11] ||
|
|
||||||
package->cache_net[CLR_VERSION_V20] ||
|
|
||||||
package->cache_net[CLR_VERSION_V40]) return TRUE;
|
|
||||||
if (pCreateAssemblyCacheSxs( &package->cache_sxs, 0 ) != S_OK) return FALSE;
|
if (pCreateAssemblyCacheSxs( &package->cache_sxs, 0 ) != S_OK) return FALSE;
|
||||||
|
|
||||||
if (pCreateAssemblyCacheNet10) pCreateAssemblyCacheNet10( &package->cache_net[CLR_VERSION_V10], 0 );
|
if (pCreateAssemblyCacheNet10) pCreateAssemblyCacheNet10( &package->cache_net[CLR_VERSION_V10], 0 );
|
||||||
if (pCreateAssemblyCacheNet11) pCreateAssemblyCacheNet11( &package->cache_net[CLR_VERSION_V11], 0 );
|
if (pCreateAssemblyCacheNet11) pCreateAssemblyCacheNet11( &package->cache_net[CLR_VERSION_V11], 0 );
|
||||||
if (pCreateAssemblyCacheNet20) pCreateAssemblyCacheNet20( &package->cache_net[CLR_VERSION_V20], 0 );
|
if (pCreateAssemblyCacheNet20) pCreateAssemblyCacheNet20( &package->cache_net[CLR_VERSION_V20], 0 );
|
||||||
if (pCreateAssemblyCacheNet40) pCreateAssemblyCacheNet40( &package->cache_net[CLR_VERSION_V40], 0 );
|
if (pCreateAssemblyCacheNet40) pCreateAssemblyCacheNet40( &package->cache_net[CLR_VERSION_V40], 0 );
|
||||||
|
return TRUE;
|
||||||
if (package->cache_net[CLR_VERSION_V10] ||
|
|
||||||
package->cache_net[CLR_VERSION_V11] ||
|
|
||||||
package->cache_net[CLR_VERSION_V20] ||
|
|
||||||
package->cache_net[CLR_VERSION_V40])
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
if (package->cache_net[CLR_VERSION_V10])
|
|
||||||
{
|
|
||||||
IAssemblyCache_Release( package->cache_net[CLR_VERSION_V10] );
|
|
||||||
package->cache_net[CLR_VERSION_V10] = NULL;
|
|
||||||
}
|
|
||||||
if (package->cache_net[CLR_VERSION_V11])
|
|
||||||
{
|
|
||||||
IAssemblyCache_Release( package->cache_net[CLR_VERSION_V11] );
|
|
||||||
package->cache_net[CLR_VERSION_V11] = NULL;
|
|
||||||
}
|
|
||||||
if (package->cache_net[CLR_VERSION_V20])
|
|
||||||
{
|
|
||||||
IAssemblyCache_Release( package->cache_net[CLR_VERSION_V20] );
|
|
||||||
package->cache_net[CLR_VERSION_V20] = NULL;
|
|
||||||
}
|
|
||||||
if (package->cache_net[CLR_VERSION_V40])
|
|
||||||
{
|
|
||||||
IAssemblyCache_Release( package->cache_net[CLR_VERSION_V40] );
|
|
||||||
package->cache_net[CLR_VERSION_V40] = NULL;
|
|
||||||
}
|
|
||||||
IAssemblyCache_Release( package->cache_sxs );
|
|
||||||
package->cache_sxs = NULL;
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void msi_destroy_assembly_caches( MSIPACKAGE *package )
|
void msi_destroy_assembly_caches( MSIPACKAGE *package )
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
|
IAssemblyCache_Release( package->cache_sxs );
|
||||||
|
package->cache_sxs = NULL;
|
||||||
|
|
||||||
for (i = 0; i < CLR_VERSION_MAX; i++)
|
for (i = 0; i < CLR_VERSION_MAX; i++)
|
||||||
{
|
{
|
||||||
if (package->cache_net[i])
|
if (package->cache_net[i])
|
||||||
|
@ -146,11 +105,6 @@ void msi_destroy_assembly_caches( MSIPACKAGE *package )
|
||||||
package->cache_net[i] = NULL;
|
package->cache_net[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (package->cache_sxs)
|
|
||||||
{
|
|
||||||
IAssemblyCache_Release( package->cache_sxs );
|
|
||||||
package->cache_sxs = NULL;
|
|
||||||
}
|
|
||||||
pCreateAssemblyCacheNet10 = NULL;
|
pCreateAssemblyCacheNet10 = NULL;
|
||||||
pCreateAssemblyCacheNet11 = NULL;
|
pCreateAssemblyCacheNet11 = NULL;
|
||||||
pCreateAssemblyCacheNet20 = NULL;
|
pCreateAssemblyCacheNet20 = NULL;
|
||||||
|
@ -161,6 +115,12 @@ void msi_destroy_assembly_caches( MSIPACKAGE *package )
|
||||||
FreeLibrary( hfusion40 );
|
FreeLibrary( hfusion40 );
|
||||||
FreeLibrary( hmscoree );
|
FreeLibrary( hmscoree );
|
||||||
FreeLibrary( hsxs );
|
FreeLibrary( hsxs );
|
||||||
|
hfusion10 = NULL;
|
||||||
|
hfusion11 = NULL;
|
||||||
|
hfusion20 = NULL;
|
||||||
|
hfusion40 = NULL;
|
||||||
|
hmscoree = NULL;
|
||||||
|
hsxs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MSIRECORD *get_assembly_record( MSIPACKAGE *package, const WCHAR *comp )
|
static MSIRECORD *get_assembly_record( MSIPACKAGE *package, const WCHAR *comp )
|
||||||
|
@ -279,6 +239,8 @@ static BOOL is_assembly_installed( IAssemblyCache *cache, const WCHAR *display_n
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
ASSEMBLY_INFO info;
|
ASSEMBLY_INFO info;
|
||||||
|
|
||||||
|
if (!cache) return FALSE;
|
||||||
|
|
||||||
memset( &info, 0, sizeof(info) );
|
memset( &info, 0, sizeof(info) );
|
||||||
info.cbAssemblyInfo = sizeof(info);
|
info.cbAssemblyInfo = sizeof(info);
|
||||||
hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, display_name, &info );
|
hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, display_name, &info );
|
||||||
|
@ -433,6 +395,7 @@ UINT msi_install_assembly( MSIPACKAGE *package, MSICOMPONENT *comp )
|
||||||
{
|
{
|
||||||
manifest = msi_get_loaded_file( package, comp->KeyPath )->TargetPath;
|
manifest = msi_get_loaded_file( package, comp->KeyPath )->TargetPath;
|
||||||
cache = package->cache_net[get_clr_version( manifest )];
|
cache = package->cache_net[get_clr_version( manifest )];
|
||||||
|
if (!cache) return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
TRACE("installing assembly %s\n", debugstr_w(manifest));
|
TRACE("installing assembly %s\n", debugstr_w(manifest));
|
||||||
|
|
||||||
|
@ -477,8 +440,11 @@ UINT msi_uninstall_assembly( MSIPACKAGE *package, MSICOMPONENT *comp )
|
||||||
{
|
{
|
||||||
if (!assembly->clr_version[i]) continue;
|
if (!assembly->clr_version[i]) continue;
|
||||||
cache = package->cache_net[i];
|
cache = package->cache_net[i];
|
||||||
hr = IAssemblyCache_UninstallAssembly( cache, 0, assembly->display_name, NULL, NULL );
|
if (cache)
|
||||||
if (FAILED( hr )) WARN("failed to uninstall assembly 0x%08x\n", hr);
|
{
|
||||||
|
hr = IAssemblyCache_UninstallAssembly( cache, 0, assembly->display_name, NULL, NULL );
|
||||||
|
if (FAILED( hr )) WARN("failed to uninstall assembly 0x%08x\n", hr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (feature) feature->Action = INSTALLSTATE_ABSENT;
|
if (feature) feature->Action = INSTALLSTATE_ABSENT;
|
||||||
|
|
Loading…
Reference in New Issue