ReactOS  0.4.14-dev-614-gbfd8a84
assembly.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "msipriv.h"
Include dependency graph for assembly.c:

Go to the source code of this file.

Classes

struct  assembly_name
 

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msi)
 
static HRESULT (WINAPI *pCreateAssemblyCacheNet10)(IAssemblyCache **
 
static BOOL init_function_pointers (void)
 
BOOL msi_init_assembly_caches (MSIPACKAGE *package)
 
void msi_destroy_assembly_caches (MSIPACKAGE *package)
 
static MSIRECORDget_assembly_record (MSIPACKAGE *package, const WCHAR *comp)
 
static UINT get_assembly_name_attribute (MSIRECORD *rec, LPVOID param)
 
static WCHARget_assembly_display_name (MSIDATABASE *db, const WCHAR *comp, MSIASSEMBLY *assembly)
 
static BOOL is_assembly_installed (IAssemblyCache *cache, const WCHAR *display_name)
 
WCHARmsi_get_assembly_path (MSIPACKAGE *package, const WCHAR *displayname)
 
IAssemblyEnummsi_create_assembly_enum (MSIPACKAGE *package, const WCHAR *displayname)
 
static const WCHARget_clr_version_str (enum clr_version version)
 
MSIASSEMBLYmsi_load_assembly (MSIPACKAGE *package, MSICOMPONENT *comp)
 
static enum clr_version get_clr_version (const WCHAR *filename)
 
UINT msi_install_assembly (MSIPACKAGE *package, MSICOMPONENT *comp)
 
UINT msi_uninstall_assembly (MSIPACKAGE *package, MSICOMPONENT *comp)
 
static WCHARbuild_local_assembly_path (const WCHAR *filename)
 
static LONG open_assemblies_key (UINT context, BOOL win32, HKEY *hkey)
 
static LONG open_local_assembly_key (UINT context, BOOL win32, const WCHAR *filename, HKEY *hkey)
 
static LONG delete_local_assembly_key (UINT context, BOOL win32, const WCHAR *filename)
 
static LONG open_global_assembly_key (UINT context, BOOL win32, HKEY *hkey)
 
UINT ACTION_MsiPublishAssemblies (MSIPACKAGE *package)
 
UINT ACTION_MsiUnpublishAssemblies (MSIPACKAGE *package)
 

Variables

static DWORD
 
static LPCWSTR
 
static LPVOID
 
static HMODULE *static LPWSTR
 
static HMODULE hfusion10
 
static HMODULE hfusion11
 
static HMODULE hfusion20
 
static HMODULE hfusion40
 
static HMODULE hmscoree
 
static HMODULE hsxs
 
static const WCHAR clr_version_v10 [] = {'v','1','.','0','.','3','7','0','5',0}
 
static const WCHAR clr_version_v11 [] = {'v','1','.','1','.','4','3','2','2',0}
 
static const WCHAR clr_version_v20 [] = {'v','2','.','0','.','5','0','7','2','7',0}
 
static const WCHAR clr_version_v40 [] = {'v','4','.','0','.','3','0','3','1','9',0}
 
static const WCHAR clr_version_unknown [] = {'u','n','k','n','o','w','n',0}
 
static const WCHARclr_version []
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file assembly.c.

Function Documentation

◆ ACTION_MsiPublishAssemblies()

UINT ACTION_MsiPublishAssemblies ( MSIPACKAGE package)

Definition at line 651 of file assembly.c.

652 {
653  MSICOMPONENT *comp;
654 
656  {
657  LONG res;
658  HKEY hkey;
659  GUID guid;
660  DWORD size;
661  WCHAR buffer[43];
662  MSIRECORD *uirow;
663  MSIASSEMBLY *assembly = comp->assembly;
664  BOOL win32;
665 
666  if (!assembly || !comp->ComponentId) continue;
667 
668  comp->Action = msi_get_component_action( package, comp );
669  if (comp->Action != INSTALLSTATE_LOCAL)
670  {
671  TRACE("component not scheduled for installation %s\n", debugstr_w(comp->Component));
672  continue;
673  }
674  TRACE("publishing %s\n", debugstr_w(comp->Component));
675 
676  CLSIDFromString( package->ProductCode, &guid );
678  buffer[20] = '>';
679  CLSIDFromString( comp->ComponentId, &guid );
680  encode_base85_guid( &guid, buffer + 21 );
681  buffer[42] = 0;
682 
683  win32 = assembly->attributes & msidbAssemblyAttributesWin32;
684  if (assembly->application)
685  {
686  MSIFILE *file = msi_get_loaded_file( package, assembly->application );
687  if ((res = open_local_assembly_key( package->Context, win32, file->TargetPath, &hkey )))
688  {
689  WARN("failed to open local assembly key %d\n", res);
690  return ERROR_FUNCTION_FAILED;
691  }
692  }
693  else
694  {
695  if ((res = open_global_assembly_key( package->Context, win32, &hkey )))
696  {
697  WARN("failed to open global assembly key %d\n", res);
698  return ERROR_FUNCTION_FAILED;
699  }
700  }
701  size = sizeof(buffer);
702  if ((res = RegSetValueExW( hkey, assembly->display_name, 0, REG_MULTI_SZ, (const BYTE *)buffer, size )))
703  {
704  WARN("failed to set assembly value %d\n", res);
705  }
706  RegCloseKey( hkey );
707 
708  uirow = MSI_CreateRecord( 2 );
709  MSI_RecordSetStringW( uirow, 2, assembly->display_name );
711  msiobj_release( &uirow->hdr );
712  }
713  return ERROR_SUCCESS;
714 }
LPWSTR ProductCode
Definition: msipriv.h:426
UINT MSI_RecordSetStringW(MSIRECORD *, UINT, LPCWSTR) DECLSPEC_HIDDEN
Definition: record.c:649
#define ERROR_SUCCESS
Definition: deptool.c:10
MSIASSEMBLY * assembly
Definition: msipriv.h:517
MSIOBJECTHDR hdr
Definition: msipriv.h:141
#define WARN(fmt,...)
Definition: debug.h:111
GLuint buffer
Definition: glext.h:5915
INSTALLSTATE Action
Definition: msipriv.h:510
INSTALLSTATE msi_get_component_action(MSIPACKAGE *package, MSICOMPONENT *comp)
Definition: action.c:755
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
const GUID * guid
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
static LONG open_local_assembly_key(UINT context, BOOL win32, const WCHAR *filename, HKEY *hkey)
Definition: assembly.c:578
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define debugstr_w
Definition: kernel32.h:32
INT MSI_ProcessMessage(MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD *) DECLSPEC_HIDDEN
Definition: package.c:1946
MSIFILE * msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *key)
Definition: action.c:674
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
LPWSTR Component
Definition: msipriv.h:502
struct list components
Definition: msipriv.h:392
MSIRECORD * MSI_CreateRecord(UINT) DECLSPEC_HIDDEN
Definition: record.c:79
uint32_t entry
Definition: isohybrid.c:63
unsigned char BYTE
Definition: mem.h:68
LPWSTR ComponentId
Definition: msipriv.h:503
static LONG open_global_assembly_key(UINT context, BOOL win32, HKEY *hkey)
Definition: assembly.c:618
UINT Context
Definition: msipriv.h:437
GLuint res
Definition: glext.h:9613
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
BOOL encode_base85_guid(GUID *, LPWSTR) DECLSPEC_HIDDEN
Definition: registry.c:316
Definition: fci.c:126

◆ ACTION_MsiUnpublishAssemblies()

UINT ACTION_MsiUnpublishAssemblies ( MSIPACKAGE package)

Definition at line 716 of file assembly.c.

717 {
718  MSICOMPONENT *comp;
719 
721  {
722  LONG res;
723  MSIRECORD *uirow;
724  MSIASSEMBLY *assembly = comp->assembly;
725  BOOL win32;
726 
727  if (!assembly || !comp->ComponentId) continue;
728 
729  comp->Action = msi_get_component_action( package, comp );
730  if (comp->Action != INSTALLSTATE_ABSENT)
731  {
732  TRACE("component not scheduled for removal %s\n", debugstr_w(comp->Component));
733  continue;
734  }
735  TRACE("unpublishing %s\n", debugstr_w(comp->Component));
736 
737  win32 = assembly->attributes & msidbAssemblyAttributesWin32;
738  if (assembly->application)
739  {
740  MSIFILE *file = msi_get_loaded_file( package, assembly->application );
741  if ((res = delete_local_assembly_key( package->Context, win32, file->TargetPath )))
742  WARN("failed to delete local assembly key %d\n", res);
743  }
744  else
745  {
746  HKEY hkey;
747  if ((res = open_global_assembly_key( package->Context, win32, &hkey )))
748  WARN("failed to delete global assembly key %d\n", res);
749  else
750  {
751  if ((res = RegDeleteValueW( hkey, assembly->display_name )))
752  WARN("failed to delete global assembly value %d\n", res);
753  RegCloseKey( hkey );
754  }
755  }
756 
757  uirow = MSI_CreateRecord( 2 );
758  MSI_RecordSetStringW( uirow, 2, assembly->display_name );
760  msiobj_release( &uirow->hdr );
761  }
762  return ERROR_SUCCESS;
763 }
UINT MSI_RecordSetStringW(MSIRECORD *, UINT, LPCWSTR) DECLSPEC_HIDDEN
Definition: record.c:649
#define ERROR_SUCCESS
Definition: deptool.c:10
MSIASSEMBLY * assembly
Definition: msipriv.h:517
MSIOBJECTHDR hdr
Definition: msipriv.h:141
#define WARN(fmt,...)
Definition: debug.h:111
INSTALLSTATE Action
Definition: msipriv.h:510
INSTALLSTATE msi_get_component_action(MSIPACKAGE *package, MSICOMPONENT *comp)
Definition: action.c:755
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
INT MSI_ProcessMessage(MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD *) DECLSPEC_HIDDEN
Definition: package.c:1946
MSIFILE * msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *key)
Definition: action.c:674
#define TRACE(s)
Definition: solgame.cpp:4
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
LPWSTR Component
Definition: msipriv.h:502
struct list components
Definition: msipriv.h:392
MSIRECORD * MSI_CreateRecord(UINT) DECLSPEC_HIDDEN
Definition: record.c:79
uint32_t entry
Definition: isohybrid.c:63
static LONG delete_local_assembly_key(UINT context, BOOL win32, const WCHAR *filename)
Definition: assembly.c:598
LPWSTR ComponentId
Definition: msipriv.h:503
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
static LONG open_global_assembly_key(UINT context, BOOL win32, HKEY *hkey)
Definition: assembly.c:618
UINT Context
Definition: msipriv.h:437
GLuint res
Definition: glext.h:9613
Definition: fci.c:126

◆ build_local_assembly_path()

static WCHAR* build_local_assembly_path ( const WCHAR filename)
static

Definition at line 531 of file assembly.c.

532 {
533  UINT i;
534  WCHAR *ret;
535 
536  if (!(ret = msi_alloc( (strlenW( filename ) + 1) * sizeof(WCHAR) )))
537  return NULL;
538 
539  for (i = 0; filename[i]; i++)
540  {
541  if (filename[i] == '\\' || filename[i] == '/') ret[i] = '|';
542  else ret[i] = filename[i];
543  }
544  ret[i] = 0;
545  return ret;
546 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
const char * filename
Definition: ioapi.h:135
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
unsigned int UINT
Definition: ndis.h:50
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204

Referenced by delete_local_assembly_key(), and open_local_assembly_key().

◆ delete_local_assembly_key()

static LONG delete_local_assembly_key ( UINT  context,
BOOL  win32,
const WCHAR filename 
)
static

Definition at line 598 of file assembly.c.

599 {
600  LONG res;
601  HKEY root;
602  WCHAR *path;
603 
605  return ERROR_OUTOFMEMORY;
606 
607  if ((res = open_assemblies_key( context, win32, &root )))
608  {
609  msi_free( path );
610  return res;
611  }
612  res = RegDeleteKeyW( root, path );
613  RegCloseKey( root );
614  msi_free( path );
615  return res;
616 }
Definition: http.c:7098
GLsizei const GLchar ** path
Definition: glext.h:7234
struct _root root
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
const char * filename
Definition: ioapi.h:135
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
__wchar_t WCHAR
Definition: xmlstorage.h:180
static LONG open_assemblies_key(UINT context, BOOL win32, HKEY *hkey)
Definition: assembly.c:548
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static WCHAR * build_local_assembly_path(const WCHAR *filename)
Definition: assembly.c:531
GLuint res
Definition: glext.h:9613
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by ACTION_MsiUnpublishAssemblies().

◆ get_assembly_display_name()

static WCHAR* get_assembly_display_name ( MSIDATABASE db,
const WCHAR comp,
MSIASSEMBLY assembly 
)
static

Definition at line 196 of file assembly.c.

197 {
198  static const WCHAR commaW[] = {',',0};
199  static const WCHAR queryW[] = {
200  'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
201  '`','M','s','i','A','s','s','e','m','b','l','y','N','a','m','e','`',' ',
202  'W','H','E','R','E',' ','`','C','o','m','p','o','n','e','n','t','_','`',
203  ' ','=',' ','\'','%','s','\'',0};
204  struct assembly_name name;
205  WCHAR *display_name = NULL;
206  MSIQUERY *view;
207  UINT i, r;
208  int len;
209 
210  r = MSI_OpenQuery( db, &view, queryW, comp );
211  if (r != ERROR_SUCCESS)
212  return NULL;
213 
214  name.count = 0;
215  name.index = 0;
216  name.attrs = NULL;
217  MSI_IterateRecords( view, &name.count, NULL, NULL );
218  if (!name.count) goto done;
219 
220  name.attrs = msi_alloc( name.count * sizeof(WCHAR *) );
221  if (!name.attrs) goto done;
222 
224 
225  len = 0;
226  for (i = 0; i < name.count; i++) len += strlenW( name.attrs[i] ) + 1;
227 
228  display_name = msi_alloc( (len + 1) * sizeof(WCHAR) );
229  if (display_name)
230  {
231  display_name[0] = 0;
232  for (i = 0; i < name.count; i++)
233  {
234  strcatW( display_name, name.attrs[i] );
235  if (i < name.count - 1) strcatW( display_name, commaW );
236  }
237  }
238 
239 done:
240  msiobj_release( &view->hdr );
241  if (name.attrs)
242  {
243  for (i = 0; i < name.count; i++) msi_free( name.attrs[i] );
244  msi_free( name.attrs );
245  }
246  return display_name;
247 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT MSI_OpenQuery(MSIDATABASE *, MSIQUERY **, LPCWSTR,...) DECLSPEC_HIDDEN
Definition: msiquery.c:143
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
static UINT get_assembly_name_attribute(MSIRECORD *rec, LPVOID param)
Definition: assembly.c:179
GLenum GLsizei len
Definition: glext.h:6722
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
Definition: name.c:38
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
static IOleDocumentView * view
Definition: activex.c:1749
UINT MSI_IterateRecords(MSIQUERY *, LPDWORD, record_func, LPVOID) DECLSPEC_HIDDEN
Definition: msiquery.c:168

Referenced by msi_load_assembly().

◆ get_assembly_name_attribute()

static UINT get_assembly_name_attribute ( MSIRECORD rec,
LPVOID  param 
)
static

Definition at line 179 of file assembly.c.

180 {
181  static const WCHAR fmtW[] = {'%','s','=','"','%','s','"',0};
182  static const WCHAR nameW[] = {'n','a','m','e',0};
183  struct assembly_name *name = param;
184  const WCHAR *attr = MSI_RecordGetString( rec, 2 );
185  const WCHAR *value = MSI_RecordGetString( rec, 3 );
186  int len = strlenW( fmtW ) + strlenW( attr ) + strlenW( value );
187 
188  if (!(name->attrs[name->index] = msi_alloc( len * sizeof(WCHAR) )))
189  return ERROR_OUTOFMEMORY;
190 
191  if (!strcmpiW( attr, nameW )) strcpyW( name->attrs[name->index++], value );
192  else sprintfW( name->attrs[name->index++], fmtW, attr, value );
193  return ERROR_SUCCESS;
194 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * MSI_RecordGetString(const MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:482
static const WCHAR nameW[]
Definition: main.c:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLfloat param
Definition: glext.h:5796
Definition: cookie.c:201
GLenum GLsizei len
Definition: glext.h:6722
#define strcmpiW(s1, s2)
Definition: unicode.h:39
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define sprintfW
Definition: unicode.h:58
Definition: name.c:38
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by get_assembly_display_name().

◆ get_assembly_record()

static MSIRECORD* get_assembly_record ( MSIPACKAGE package,
const WCHAR comp 
)
static

Definition at line 138 of file assembly.c.

139 {
140  static const WCHAR query[] = {
141  'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
142  '`','M','s','i','A','s','s','e','m','b','l','y','`',' ',
143  'W','H','E','R','E',' ','`','C','o','m','p','o','n','e','n','t','_','`',
144  ' ','=',' ','\'','%','s','\'',0};
145  MSIQUERY *view;
146  MSIRECORD *rec;
147  UINT r;
148 
149  r = MSI_OpenQuery( package->db, &view, query, comp );
150  if (r != ERROR_SUCCESS)
151  return NULL;
152 
153  r = MSI_ViewExecute( view, NULL );
154  if (r != ERROR_SUCCESS)
155  {
156  msiobj_release( &view->hdr );
157  return NULL;
158  }
159  r = MSI_ViewFetch( view, &rec );
160  if (r != ERROR_SUCCESS)
161  {
162  msiobj_release( &view->hdr );
163  return NULL;
164  }
165  if (!MSI_RecordGetString( rec, 4 ))
166  TRACE("component is a global assembly\n");
167 
168  msiobj_release( &view->hdr );
169  return rec;
170 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT MSI_ViewExecute(MSIQUERY *, MSIRECORD *) DECLSPEC_HIDDEN
Definition: msiquery.c:443
UINT MSI_OpenQuery(MSIDATABASE *, MSIQUERY **, LPCWSTR,...) DECLSPEC_HIDDEN
Definition: msiquery.c:143
UINT MSI_ViewFetch(MSIQUERY *, MSIRECORD **) DECLSPEC_HIDDEN
Definition: msiquery.c:364
smooth NULL
Definition: ftsmooth.c:416
const WCHAR * MSI_RecordGetString(const MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:482
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIDATABASE * db
Definition: msipriv.h:386
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
unsigned int UINT
Definition: ndis.h:50
static IOleDocumentView * view
Definition: activex.c:1749

Referenced by msi_load_assembly().

◆ get_clr_version()

static enum clr_version get_clr_version ( const WCHAR filename)
static

Definition at line 419 of file assembly.c.

420 {
421  DWORD len;
422  HRESULT hr;
424  WCHAR *strW;
425 
426  if (!pGetFileVersion) return CLR_VERSION_V10;
427 
428  hr = pGetFileVersion( filename, NULL, 0, &len );
430  if ((strW = msi_alloc( len * sizeof(WCHAR) )))
431  {
432  hr = pGetFileVersion( filename, strW, len, &len );
433  if (hr == S_OK)
434  {
435  UINT i;
436  for (i = 0; i < CLR_VERSION_MAX; i++)
437  if (!strcmpW( strW, clr_version[i] )) version = i;
438  }
439  msi_free( strW );
440  }
441  return version;
442 }
clr_version
Definition: msipriv.h:365
HRESULT hr
Definition: shlfolder.c:183
const char * filename
Definition: ioapi.h:135
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
WCHAR strW[12]
Definition: clipboard.c:2029
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:66
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204

Referenced by msi_install_assembly().

◆ get_clr_version_str()

static const WCHAR* get_clr_version_str ( enum clr_version  version)
static

Definition at line 345 of file assembly.c.

346 {
347  if (version >= sizeof(clr_version)/sizeof(clr_version[0])) return clr_version_unknown;
348  return clr_version[version];
349 }
clr_version
Definition: msipriv.h:365
static const WCHAR version[]
Definition: asmname.c:66
static const WCHAR clr_version_unknown[]
Definition: assembly.c:335

Referenced by msi_load_assembly().

◆ HRESULT()

static HRESULT ( WINAPI pCreateAssemblyCacheNet10)
static

◆ init_function_pointers()

static BOOL init_function_pointers ( void  )
static

Definition at line 46 of file assembly.c.

47 {
48  static const WCHAR szFusion[] = {'f','u','s','i','o','n','.','d','l','l',0};
49  static const WCHAR szMscoree[] = {'\\','m','s','c','o','r','e','e','.','d','l','l',0};
50  static const WCHAR szSxs[] = {'s','x','s','.','d','l','l',0};
51  static const WCHAR szVersion10[] = {'v','1','.','0','.','3','7','0','5',0};
52  static const WCHAR szVersion11[] = {'v','1','.','1','.','4','3','2','2',0};
53  static const WCHAR szVersion20[] = {'v','2','.','0','.','5','0','7','2','7',0};
54  static const WCHAR szVersion40[] = {'v','4','.','0','.','3','0','3','1','9',0};
57 
58  if (!hsxs && !(hsxs = LoadLibraryW( szSxs ))) return FALSE;
59  if (!(pCreateAssemblyCacheSxs = (void *)GetProcAddress( hsxs, "CreateAssemblyCache" )))
60  {
61  FreeLibrary( hsxs );
62  hsxs = NULL;
63  return FALSE;
64  }
65  strcpyW( path + len, szMscoree );
66  if (hmscoree || !(hmscoree = LoadLibraryW( path ))) return TRUE;
67  pGetFileVersion = (void *)GetProcAddress( hmscoree, "GetFileVersion" ); /* missing from v1.0.3705 */
68  if (!(pLoadLibraryShim = (void *)GetProcAddress( hmscoree, "LoadLibraryShim" )))
69  {
71  hmscoree = NULL;
72  return TRUE;
73  }
74  if (!pLoadLibraryShim( szFusion, szVersion10, NULL, &hfusion10 ))
75  pCreateAssemblyCacheNet10 = (void *)GetProcAddress( hfusion10, "CreateAssemblyCache" );
76 
77  if (!pLoadLibraryShim( szFusion, szVersion11, NULL, &hfusion11 ))
78  pCreateAssemblyCacheNet11 = (void *)GetProcAddress( hfusion11, "CreateAssemblyCache" );
79 
80  if (!pLoadLibraryShim( szFusion, szVersion20, NULL, &hfusion20 ))
81  pCreateAssemblyCacheNet20 = (void *)GetProcAddress( hfusion20, "CreateAssemblyCache" );
82 
83  if (!pLoadLibraryShim( szFusion, szVersion40, NULL, &hfusion40 ))
84  {
85  pCreateAssemblyCacheNet40 = (void *)GetProcAddress( hfusion40, "CreateAssemblyCache" );
86  pCreateAssemblyNameObject = (void *)GetProcAddress( hfusion40, "CreateAssemblyNameObject" );
87  pCreateAssemblyEnum = (void *)GetProcAddress( hfusion40, "CreateAssemblyEnum" );
88  }
89  return TRUE;
90 }
#define TRUE
Definition: types.h:120
static HMODULE hfusion11
Definition: assembly.c:44
static HMODULE hmscoree
Definition: assembly.c:44
static HMODULE hfusion20
Definition: assembly.c:44
#define LoadLibraryW(x)
Definition: compat.h:412
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:413
static HMODULE hfusion10
Definition: assembly.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static HMODULE hfusion40
Definition: assembly.c:44
GLenum GLsizei len
Definition: glext.h:6722
static HMODULE hsxs
Definition: assembly.c:44
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2312
#define GetProcAddress(x, y)
Definition: compat.h:418

Referenced by msi_init_assembly_caches().

◆ is_assembly_installed()

static BOOL is_assembly_installed ( IAssemblyCache cache,
const WCHAR display_name 
)
static

Definition at line 249 of file assembly.c.

250 {
251  HRESULT hr;
253 
254  if (!cache) return FALSE;
255 
256  memset( &info, 0, sizeof(info) );
257  info.cbAssemblyInfo = sizeof(info);
258  hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, display_name, &info );
259  if (hr == S_OK /* sxs version */ || hr == E_NOT_SUFFICIENT_BUFFER)
260  {
261  return (info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED);
262  }
263  TRACE("QueryAssemblyInfo returned 0x%08x\n", hr);
264  return FALSE;
265 }
Definition: cache.c:48
#define ASSEMBLYINFO_FLAG_INSTALLED
Definition: cache.c:197
HRESULT hr
Definition: shlfolder.c:183
struct _test_info info[]
Definition: SetCursorPos.c:19
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345
#define S_OK
Definition: intsafe.h:59
#define memset(x, y, z)
Definition: compat.h:39

Referenced by msi_load_assembly().

◆ msi_create_assembly_enum()

IAssemblyEnum* msi_create_assembly_enum ( MSIPACKAGE package,
const WCHAR displayname 
)

Definition at line 292 of file assembly.c.

293 {
294  HRESULT hr;
297  WCHAR *str;
298  UINT len = 0;
299 
300  if (!pCreateAssemblyNameObject || !pCreateAssemblyEnum) return NULL;
301 
302  hr = pCreateAssemblyNameObject( &name, displayname, CANOF_PARSE_DISPLAY_NAME, NULL );
303  if (FAILED( hr )) return NULL;
304 
305  hr = IAssemblyName_GetName( name, &len, NULL );
306  if (hr != E_NOT_SUFFICIENT_BUFFER || !(str = msi_alloc( len * sizeof(WCHAR) )))
307  {
308  IAssemblyName_Release( name );
309  return NULL;
310  }
311 
312  hr = IAssemblyName_GetName( name, &len, str );
313  IAssemblyName_Release( name );
314  if (FAILED( hr ))
315  {
316  msi_free( str );
317  return NULL;
318  }
319 
320  hr = pCreateAssemblyNameObject( &name, str, 0, NULL );
321  msi_free( str );
322  if (FAILED( hr )) return NULL;
323 
324  hr = pCreateAssemblyEnum( &ret, NULL, name, ASM_CACHE_GAC, NULL );
325  IAssemblyName_Release( name );
326  if (FAILED( hr )) return NULL;
327 
328  return ret;
329 }
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
Definition: name.c:38
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by patch_assembly().

◆ msi_destroy_assembly_caches()

void msi_destroy_assembly_caches ( MSIPACKAGE package)

Definition at line 103 of file assembly.c.

104 {
105  UINT i;
106 
107  if (package->cache_sxs)
108  {
109  IAssemblyCache_Release( package->cache_sxs );
110  package->cache_sxs = NULL;
111  }
112  for (i = 0; i < CLR_VERSION_MAX; i++)
113  {
114  if (package->cache_net[i])
115  {
116  IAssemblyCache_Release( package->cache_net[i] );
117  package->cache_net[i] = NULL;
118  }
119  }
120  pCreateAssemblyCacheNet10 = NULL;
121  pCreateAssemblyCacheNet11 = NULL;
122  pCreateAssemblyCacheNet20 = NULL;
123  pCreateAssemblyCacheNet40 = NULL;
129  FreeLibrary( hsxs );
130  hfusion10 = NULL;
131  hfusion11 = NULL;
132  hfusion20 = NULL;
133  hfusion40 = NULL;
134  hmscoree = NULL;
135  hsxs = NULL;
136 }
IAssemblyCache * cache_net[CLR_VERSION_MAX]
Definition: msipriv.h:406
static HMODULE hfusion11
Definition: assembly.c:44
static HMODULE hmscoree
Definition: assembly.c:44
static HMODULE hfusion20
Definition: assembly.c:44
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:413
static HMODULE hfusion10
Definition: assembly.c:44
IAssemblyCache * cache_sxs
Definition: msipriv.h:407
static HMODULE hfusion40
Definition: assembly.c:44
static HMODULE hsxs
Definition: assembly.c:44
unsigned int UINT
Definition: ndis.h:50

Referenced by MSI_FreePackage().

◆ msi_get_assembly_path()

WCHAR* msi_get_assembly_path ( MSIPACKAGE package,
const WCHAR displayname 
)

Definition at line 267 of file assembly.c.

268 {
269  HRESULT hr;
272 
273  if (!cache) return NULL;
274 
275  memset( &info, 0, sizeof(info) );
276  info.cbAssemblyInfo = sizeof(info);
277  hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, displayname, &info );
278  if (hr != E_NOT_SUFFICIENT_BUFFER) return NULL;
279 
280  if (!(info.pszCurrentAssemblyPathBuf = msi_alloc( info.cchBuf * sizeof(WCHAR) ))) return NULL;
281 
282  hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, displayname, &info );
283  if (FAILED( hr ))
284  {
285  msi_free( info.pszCurrentAssemblyPathBuf );
286  return NULL;
287  }
288  TRACE("returning %s\n", debugstr_w(info.pszCurrentAssemblyPathBuf));
289  return info.pszCurrentAssemblyPathBuf;
290 }
Definition: cache.c:48
IAssemblyCache * cache_net[CLR_VERSION_MAX]
Definition: msipriv.h:406
HRESULT hr
Definition: shlfolder.c:183
struct _test_info info[]
Definition: SetCursorPos.c:19
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
#define memset(x, y, z)
Definition: compat.h:39

Referenced by patch_assembly().

◆ msi_init_assembly_caches()

BOOL msi_init_assembly_caches ( MSIPACKAGE package)

Definition at line 92 of file assembly.c.

93 {
94  if (!init_function_pointers()) return FALSE;
95  if (pCreateAssemblyCacheSxs( &package->cache_sxs, 0 ) != S_OK) return FALSE;
96  if (pCreateAssemblyCacheNet10) pCreateAssemblyCacheNet10( &package->cache_net[CLR_VERSION_V10], 0 );
97  if (pCreateAssemblyCacheNet11) pCreateAssemblyCacheNet11( &package->cache_net[CLR_VERSION_V11], 0 );
98  if (pCreateAssemblyCacheNet20) pCreateAssemblyCacheNet20( &package->cache_net[CLR_VERSION_V20], 0 );
99  if (pCreateAssemblyCacheNet40) pCreateAssemblyCacheNet40( &package->cache_net[CLR_VERSION_V40], 0 );
100  return TRUE;
101 }
#define TRUE
Definition: types.h:120
IAssemblyCache * cache_net[CLR_VERSION_MAX]
Definition: msipriv.h:406
static BOOL init_function_pointers(void)
Definition: assembly.c:46
IAssemblyCache * cache_sxs
Definition: msipriv.h:407
#define S_OK
Definition: intsafe.h:59

Referenced by msi_load_all_components().

◆ msi_install_assembly()

UINT msi_install_assembly ( MSIPACKAGE package,
MSICOMPONENT comp 
)

Definition at line 444 of file assembly.c.

445 {
446  HRESULT hr;
447  const WCHAR *manifest;
449  MSIASSEMBLY *assembly = comp->assembly;
451 
452  if (comp->assembly->feature)
453  feature = msi_get_loaded_feature( package, comp->assembly->feature );
454 
455  if (assembly->application)
456  {
457  if (feature) feature->Action = INSTALLSTATE_LOCAL;
458  return ERROR_SUCCESS;
459  }
460  if (assembly->attributes == msidbAssemblyAttributesWin32)
461  {
462  if (!assembly->manifest)
463  {
464  WARN("no manifest\n");
465  return ERROR_FUNCTION_FAILED;
466  }
468  cache = package->cache_sxs;
469  }
470  else
471  {
472  manifest = msi_get_loaded_file( package, comp->KeyPath )->TargetPath;
473  cache = package->cache_net[get_clr_version( manifest )];
474  if (!cache) return ERROR_SUCCESS;
475  }
476  TRACE("installing assembly %s\n", debugstr_w(manifest));
477 
478  hr = IAssemblyCache_InstallAssembly( cache, 0, manifest, NULL );
479  if (hr != S_OK)
480  {
481  ERR("Failed to install assembly %s (0x%08x)\n", debugstr_w(manifest), hr);
482  return ERROR_FUNCTION_FAILED;
483  }
484  if (feature) feature->Action = INSTALLSTATE_LOCAL;
485  assembly->installed = TRUE;
486  return ERROR_SUCCESS;
487 }
Definition: cache.c:48
INTERNETFEATURELIST feature
Definition: misc.c:1719
#define TRUE
Definition: types.h:120
IAssemblyCache * cache_net[CLR_VERSION_MAX]
Definition: msipriv.h:406
MSIFEATURE * msi_get_loaded_feature(MSIPACKAGE *package, const WCHAR *Feature)
Definition: action.c:663
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
MSIASSEMBLY * assembly
Definition: msipriv.h:517
struct file_info manifest
Definition: actctx.c:447
#define WARN(fmt,...)
Definition: debug.h:111
LPWSTR KeyPath
Definition: msipriv.h:507
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LPWSTR feature
Definition: msipriv.h:489
MSIFILE * msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *key)
Definition: action.c:674
static enum clr_version get_clr_version(const WCHAR *filename)
Definition: assembly.c:419
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
IAssemblyCache * cache_sxs
Definition: msipriv.h:407
static IOleCache * cache
Definition: ole2.c:75
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static const CHAR manifest[]
Definition: v6util.h:39
LPWSTR TargetPath
Definition: msipriv.h:594

Referenced by ACTION_InstallFiles(), and ACTION_PatchFiles().

◆ msi_load_assembly()

MSIASSEMBLY* msi_load_assembly ( MSIPACKAGE package,
MSICOMPONENT comp 
)

Definition at line 352 of file assembly.c.

353 {
354  MSIRECORD *rec;
355  MSIASSEMBLY *a;
356 
357  if (!(rec = get_assembly_record( package, comp->Component ))) return NULL;
358  if (!(a = msi_alloc_zero( sizeof(MSIASSEMBLY) )))
359  {
360  msiobj_release( &rec->hdr );
361  return NULL;
362  }
363  a->feature = strdupW( MSI_RecordGetString( rec, 2 ) );
364  TRACE("feature %s\n", debugstr_w(a->feature));
365 
366  a->manifest = strdupW( MSI_RecordGetString( rec, 3 ) );
367  TRACE("manifest %s\n", debugstr_w(a->manifest));
368 
369  a->application = strdupW( MSI_RecordGetString( rec, 4 ) );
370  TRACE("application %s\n", debugstr_w(a->application));
371 
372  a->attributes = MSI_RecordGetInteger( rec, 5 );
373  TRACE("attributes %u\n", a->attributes);
374 
375  if (!(a->display_name = get_assembly_display_name( package->db, comp->Component, a )))
376  {
377  WARN("can't get display name\n");
378  msiobj_release( &rec->hdr );
379  msi_free( a->feature );
380  msi_free( a->manifest );
381  msi_free( a->application );
382  msi_free( a );
383  return NULL;
384  }
385  TRACE("display name %s\n", debugstr_w(a->display_name));
386 
387  if (a->application)
388  {
389  /* We can't check the manifest here because the target path may still change.
390  So we assume that the assembly is not installed and lean on the InstallFiles
391  action to determine which files need to be installed.
392  */
393  a->installed = FALSE;
394  }
395  else
396  {
397  if (a->attributes == msidbAssemblyAttributesWin32)
398  a->installed = is_assembly_installed( package->cache_sxs, a->display_name );
399  else
400  {
401  UINT i;
402  for (i = 0; i < CLR_VERSION_MAX; i++)
403  {
404  a->clr_version[i] = is_assembly_installed( package->cache_net[i], a->display_name );
405  if (a->clr_version[i])
406  {
407  TRACE("runtime version %s\n", debugstr_w(get_clr_version_str( i )));
408  a->installed = TRUE;
409  break;
410  }
411  }
412  }
413  }
414  TRACE("assembly is %s\n", a->installed ? "installed" : "not installed");
415  msiobj_release( &rec->hdr );
416  return a;
417 }
#define TRUE
Definition: types.h:120
IAssemblyCache * cache_net[CLR_VERSION_MAX]
Definition: msipriv.h:406
static const WCHAR * get_clr_version_str(enum clr_version version)
Definition: assembly.c:345
static WCHAR * get_assembly_display_name(MSIDATABASE *db, const WCHAR *comp, MSIASSEMBLY *assembly)
Definition: assembly.c:196
MSIOBJECTHDR hdr
Definition: msipriv.h:141
#define WARN(fmt,...)
Definition: debug.h:111
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1210
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define a
Definition: ke_i.h:78
static MSIRECORD * get_assembly_record(MSIPACKAGE *package, const WCHAR *comp)
Definition: assembly.c:138
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
static BOOL is_assembly_installed(IAssemblyCache *cache, const WCHAR *display_name)
Definition: assembly.c:249
const WCHAR * MSI_RecordGetString(const MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:482
#define TRACE(s)
Definition: solgame.cpp:4
IAssemblyCache * cache_sxs
Definition: msipriv.h:407
MSIDATABASE * db
Definition: msipriv.h:386
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
LPWSTR Component
Definition: msipriv.h:502
int MSI_RecordGetInteger(MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:245
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static LPWSTR strdupW(LPCWSTR src)
Definition: assembly.c:67

Referenced by load_component().

◆ msi_uninstall_assembly()

UINT msi_uninstall_assembly ( MSIPACKAGE package,
MSICOMPONENT comp 
)

Definition at line 489 of file assembly.c.

490 {
491  HRESULT hr;
493  MSIASSEMBLY *assembly = comp->assembly;
495 
496  if (comp->assembly->feature)
497  feature = msi_get_loaded_feature( package, comp->assembly->feature );
498 
499  if (assembly->application)
500  {
501  if (feature) feature->Action = INSTALLSTATE_ABSENT;
502  return ERROR_SUCCESS;
503  }
504  TRACE("removing %s\n", debugstr_w(assembly->display_name));
505 
506  if (assembly->attributes == msidbAssemblyAttributesWin32)
507  {
508  cache = package->cache_sxs;
509  hr = IAssemblyCache_UninstallAssembly( cache, 0, assembly->display_name, NULL, NULL );
510  if (FAILED( hr )) WARN("failed to uninstall assembly 0x%08x\n", hr);
511  }
512  else
513  {
514  unsigned int i;
515  for (i = 0; i < CLR_VERSION_MAX; i++)
516  {
517  if (!assembly->clr_version[i]) continue;
518  cache = package->cache_net[i];
519  if (cache)
520  {
521  hr = IAssemblyCache_UninstallAssembly( cache, 0, assembly->display_name, NULL, NULL );
522  if (FAILED( hr )) WARN("failed to uninstall assembly 0x%08x\n", hr);
523  }
524  }
525  }
526  if (feature) feature->Action = INSTALLSTATE_ABSENT;
527  assembly->installed = FALSE;
528  return ERROR_SUCCESS;
529 }
Definition: cache.c:48
INTERNETFEATURELIST feature
Definition: misc.c:1719
IAssemblyCache * cache_net[CLR_VERSION_MAX]
Definition: msipriv.h:406
MSIFEATURE * msi_get_loaded_feature(MSIPACKAGE *package, const WCHAR *Feature)
Definition: action.c:663
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
MSIASSEMBLY * assembly
Definition: msipriv.h:517
#define WARN(fmt,...)
Definition: debug.h:111
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LPWSTR feature
Definition: msipriv.h:489
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
IAssemblyCache * cache_sxs
Definition: msipriv.h:407
static IOleCache * cache
Definition: ole2.c:75

Referenced by ACTION_RemoveFiles().

◆ open_assemblies_key()

static LONG open_assemblies_key ( UINT  context,
BOOL  win32,
HKEY hkey 
)
static

Definition at line 548 of file assembly.c.

549 {
550  static const WCHAR path_win32[] =
551  {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
552  'I','n','s','t','a','l','l','e','r','\\','W','i','n','3','2','A','s','s','e','m','b','l','i','e','s','\\',0};
553  static const WCHAR path_dotnet[] =
554  {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
555  'I','n','s','t','a','l','l','e','r','\\','A','s','s','e','m','b','l','i','e','s','\\',0};
556  static const WCHAR classes_path_win32[] =
557  {'I','n','s','t','a','l','l','e','r','\\','W','i','n','3','2','A','s','s','e','m','b','l','i','e','s','\\',0};
558  static const WCHAR classes_path_dotnet[] =
559  {'I','n','s','t','a','l','l','e','r','\\','A','s','s','e','m','b','l','i','e','s','\\',0};
560  HKEY root;
561  const WCHAR *path;
562 
564  {
566  if (win32) path = classes_path_win32;
567  else path = classes_path_dotnet;
568  }
569  else
570  {
572  if (win32) path = path_win32;
573  else path = path_dotnet;
574  }
575  return RegCreateKeyW( root, path, hkey );
576 }
Definition: http.c:7098
GLsizei const GLchar ** path
Definition: glext.h:7234
#define HKEY_CURRENT_USER
Definition: winreg.h:11
struct _root root
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by delete_local_assembly_key(), and open_local_assembly_key().

◆ open_global_assembly_key()

static LONG open_global_assembly_key ( UINT  context,
BOOL  win32,
HKEY hkey 
)
static

Definition at line 618 of file assembly.c.

619 {
620  static const WCHAR path_win32[] =
621  {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
622  'I','n','s','t','a','l','l','e','r','\\','W','i','n','3','2','A','s','s','e','m','b','l','i','e','s','\\',
623  'G','l','o','b','a','l',0};
624  static const WCHAR path_dotnet[] =
625  {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
626  'I','n','s','t','a','l','l','e','r','\\','A','s','s','e','m','b','l','i','e','s','\\',
627  'G','l','o','b','a','l',0};
628  static const WCHAR classes_path_win32[] =
629  {'I','n','s','t','a','l','l','e','r','\\','W','i','n','3','2','A','s','s','e','m','b','l','i','e','s','\\',
630  'G','l','o','b','a','l',0};
631  static const WCHAR classes_path_dotnet[] =
632  {'I','n','s','t','a','l','l','e','r','\\','A','s','s','e','m','b','l','i','e','s','\\','G','l','o','b','a','l',0};
633  HKEY root;
634  const WCHAR *path;
635 
637  {
639  if (win32) path = classes_path_win32;
640  else path = classes_path_dotnet;
641  }
642  else
643  {
645  if (win32) path = path_win32;
646  else path = path_dotnet;
647  }
648  return RegCreateKeyW( root, path, hkey );
649 }
Definition: http.c:7098
GLsizei const GLchar ** path
Definition: glext.h:7234
#define HKEY_CURRENT_USER
Definition: winreg.h:11
struct _root root
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by ACTION_MsiPublishAssemblies(), and ACTION_MsiUnpublishAssemblies().

◆ open_local_assembly_key()

static LONG open_local_assembly_key ( UINT  context,
BOOL  win32,
const WCHAR filename,
HKEY hkey 
)
static

Definition at line 578 of file assembly.c.

579 {
580  LONG res;
581  HKEY root;
582  WCHAR *path;
583 
585  return ERROR_OUTOFMEMORY;
586 
587  if ((res = open_assemblies_key( context, win32, &root )))
588  {
589  msi_free( path );
590  return res;
591  }
592  res = RegCreateKeyW( root, path, hkey );
593  RegCloseKey( root );
594  msi_free( path );
595  return res;
596 }
Definition: http.c:7098
GLsizei const GLchar ** path
Definition: glext.h:7234
struct _root root
const char * filename
Definition: ioapi.h:135
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
__wchar_t WCHAR
Definition: xmlstorage.h:180
static LONG open_assemblies_key(UINT context, BOOL win32, HKEY *hkey)
Definition: assembly.c:548
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static WCHAR * build_local_assembly_path(const WCHAR *filename)
Definition: assembly.c:531
GLuint res
Definition: glext.h:9613
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by ACTION_MsiPublishAssemblies().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msi  )

Variable Documentation

◆ clr_version

const WCHAR* clr_version[]
static
Initial value:
=
{
}
static const WCHAR clr_version_v40[]
Definition: assembly.c:334
static const WCHAR clr_version_v10[]
Definition: assembly.c:331
static const WCHAR clr_version_v20[]
Definition: assembly.c:333
static const WCHAR clr_version_v11[]
Definition: assembly.c:332

Definition at line 337 of file assembly.c.

◆ clr_version_unknown

const WCHAR clr_version_unknown[] = {'u','n','k','n','o','w','n',0}
static

Definition at line 335 of file assembly.c.

Referenced by get_clr_version_str().

◆ clr_version_v10

const WCHAR clr_version_v10[] = {'v','1','.','0','.','3','7','0','5',0}
static

Definition at line 331 of file assembly.c.

◆ clr_version_v11

const WCHAR clr_version_v11[] = {'v','1','.','1','.','4','3','2','2',0}
static

Definition at line 332 of file assembly.c.

◆ clr_version_v20

const WCHAR clr_version_v20[] = {'v','2','.','0','.','5','0','7','2','7',0}
static

Definition at line 333 of file assembly.c.

◆ clr_version_v40

const WCHAR clr_version_v40[] = {'v','4','.','0','.','3','0','3','1','9',0}
static

Definition at line 334 of file assembly.c.

◆ DWORD

◆ hfusion10

HMODULE hfusion10
static

Definition at line 44 of file assembly.c.

Referenced by init_function_pointers(), and msi_destroy_assembly_caches().

◆ hfusion11

HMODULE hfusion11
static

Definition at line 44 of file assembly.c.

Referenced by init_function_pointers(), and msi_destroy_assembly_caches().

◆ hfusion20

HMODULE hfusion20
static

Definition at line 44 of file assembly.c.

Referenced by init_function_pointers(), and msi_destroy_assembly_caches().

◆ hfusion40

HMODULE hfusion40
static

Definition at line 44 of file assembly.c.

Referenced by init_function_pointers(), and msi_destroy_assembly_caches().

◆ hmscoree

HMODULE hmscoree
static

◆ hsxs

HMODULE hsxs
static

Definition at line 44 of file assembly.c.

Referenced by init_function_pointers(), and msi_destroy_assembly_caches().

◆ LPCWSTR

HMODULE* static DWORD* static LPCWSTR

Definition at line 39 of file assembly.c.

◆ LPVOID

Definition at line 39 of file assembly.c.

◆ LPWSTR

HMODULE* static LPWSTR

Definition at line 40 of file assembly.c.