ReactOS 0.4.15-dev-7953-g1f49173
asmcache.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winver.h"
#include "wincrypt.h"
#include "winreg.h"
#include "shlwapi.h"
#include "dbghelp.h"
#include "ole2.h"
#include "fusion.h"
#include "corerror.h"
#include "fusionpriv.h"
#include "wine/debug.h"
Include dependency graph for asmcache.c:

Go to the source code of this file.

Classes

struct  IAssemblyCacheImpl
 
struct  IAssemblyCacheItemImpl
 

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (fusion)
 
static BOOL create_full_path (LPCWSTR path)
 
static BOOL get_assembly_directory (LPWSTR dir, DWORD size, const char *version, PEKIND architecture)
 
static IAssemblyCacheImplimpl_from_IAssemblyCache (IAssemblyCache *iface)
 
static HRESULT WINAPI IAssemblyCacheImpl_QueryInterface (IAssemblyCache *iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IAssemblyCacheImpl_AddRef (IAssemblyCache *iface)
 
static ULONG WINAPI IAssemblyCacheImpl_Release (IAssemblyCache *iface)
 
static void cache_lock (IAssemblyCacheImpl *cache)
 
static void cache_unlock (IAssemblyCacheImpl *cache)
 
static HRESULT WINAPI IAssemblyCacheImpl_UninstallAssembly (IAssemblyCache *iface, DWORD dwFlags, LPCWSTR pszAssemblyName, LPCFUSION_INSTALL_REFERENCE pRefData, ULONG *pulDisposition)
 
static HRESULT WINAPI IAssemblyCacheImpl_QueryAssemblyInfo (IAssemblyCache *iface, DWORD dwFlags, LPCWSTR pszAssemblyName, ASSEMBLY_INFO *pAsmInfo)
 
static HRESULT WINAPI IAssemblyCacheImpl_CreateAssemblyCacheItem (IAssemblyCache *iface, DWORD dwFlags, PVOID pvReserved, IAssemblyCacheItem **ppAsmItem, LPCWSTR pszAssemblyName)
 
static HRESULT WINAPI IAssemblyCacheImpl_CreateAssemblyScavenger (IAssemblyCache *iface, IUnknown **ppUnkReserved)
 
static HRESULT copy_file (const WCHAR *src_dir, DWORD src_len, const WCHAR *dst_dir, DWORD dst_len, const WCHAR *filename)
 
static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly (IAssemblyCache *iface, DWORD dwFlags, LPCWSTR pszManifestFilePath, LPCFUSION_INSTALL_REFERENCE pRefData)
 
HRESULT WINAPI CreateAssemblyCache (IAssemblyCache **ppAsmCache, DWORD dwReserved)
 
static IAssemblyCacheItemImplimpl_from_IAssemblyCacheItem (IAssemblyCacheItem *iface)
 
static HRESULT WINAPI IAssemblyCacheItemImpl_QueryInterface (IAssemblyCacheItem *iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IAssemblyCacheItemImpl_AddRef (IAssemblyCacheItem *iface)
 
static ULONG WINAPI IAssemblyCacheItemImpl_Release (IAssemblyCacheItem *iface)
 
static HRESULT WINAPI IAssemblyCacheItemImpl_CreateStream (IAssemblyCacheItem *iface, DWORD dwFlags, LPCWSTR pszStreamName, DWORD dwFormat, DWORD dwFormatFlags, IStream **ppIStream, ULARGE_INTEGER *puliMaxSize)
 
static HRESULT WINAPI IAssemblyCacheItemImpl_Commit (IAssemblyCacheItem *iface, DWORD dwFlags, ULONG *pulDisposition)
 
static HRESULT WINAPI IAssemblyCacheItemImpl_AbortItem (IAssemblyCacheItem *iface)
 

Variables

static const WCHAR cache_mutex_nameW []
 
static const IAssemblyCacheItemVtbl AssemblyCacheItemVtbl
 
static const IAssemblyCacheVtbl AssemblyCacheVtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file asmcache.c.

Function Documentation

◆ cache_lock()

static void cache_lock ( IAssemblyCacheImpl cache)
static

Definition at line 208 of file asmcache.c.

209{
211}
#define INFINITE
Definition: serial.h:102
Definition: cache.c:49
HANDLE lock
Definition: cache.c:52
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82

Referenced by IAssemblyCacheImpl_InstallAssembly(), IAssemblyCacheImpl_QueryAssemblyInfo(), and IAssemblyCacheImpl_UninstallAssembly().

◆ cache_unlock()

static void cache_unlock ( IAssemblyCacheImpl cache)
static

Definition at line 213 of file asmcache.c.

214{
216}
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618

Referenced by IAssemblyCacheImpl_InstallAssembly(), IAssemblyCacheImpl_QueryAssemblyInfo(), and IAssemblyCacheImpl_UninstallAssembly().

◆ copy_file()

static HRESULT copy_file ( const WCHAR src_dir,
DWORD  src_len,
const WCHAR dst_dir,
DWORD  dst_len,
const WCHAR filename 
)
static

Definition at line 394 of file asmcache.c.

396{
397 WCHAR *src_file, *dst_file;
399 HRESULT hr = S_OK;
400
401 if (!(src_file = heap_alloc( (src_len + len + 1) * sizeof(WCHAR) )))
402 return E_OUTOFMEMORY;
403 memcpy( src_file, src_dir, src_len * sizeof(WCHAR) );
404 lstrcpyW( src_file + src_len, filename );
405
406 if (!(dst_file = heap_alloc( (dst_len + len + 1) * sizeof(WCHAR) )))
407 {
408 heap_free( src_file );
409 return E_OUTOFMEMORY;
410 }
411 memcpy( dst_file, dst_dir, dst_len * sizeof(WCHAR) );
412 lstrcpyW( dst_file + dst_len, filename );
413
414 if (!CopyFileW( src_file, dst_file, FALSE )) hr = HRESULT_FROM_WIN32( GetLastError() );
415 heap_free( src_file );
416 heap_free( dst_file );
417 return hr;
418}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:52
const char * filename
Definition: ioapi.h:137
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HRESULT hr
Definition: shlfolder.c:183
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by IAssemblyCacheImpl_InstallAssembly().

◆ create_full_path()

static BOOL create_full_path ( LPCWSTR  path)
static

Definition at line 62 of file asmcache.c.

63{
64 LPWSTR new_path;
65 BOOL ret = TRUE;
66 int len;
67
68 if (!(new_path = heap_alloc((lstrlenW(path) + 1) * sizeof(WCHAR)))) return FALSE;
69
70 lstrcpyW(new_path, path);
71
72 while ((len = lstrlenW(new_path)) && new_path[len - 1] == '\\')
73 new_path[len - 1] = 0;
74
75 while (!CreateDirectoryW(new_path, NULL))
76 {
77 LPWSTR slash;
79
81 break;
82
84 {
85 ret = FALSE;
86 break;
87 }
88
89 if(!(slash = wcsrchr(new_path, '\\')))
90 {
91 ret = FALSE;
92 break;
93 }
94
95 len = slash - new_path;
96 new_path[len] = 0;
97 if(!create_full_path(new_path))
98 {
99 ret = FALSE;
100 break;
101 }
102
103 new_path[len] = '\\';
104 }
105
106 heap_free(new_path);
107 return ret;
108}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define wcsrchr
Definition: compat.h:16
static BOOL create_full_path(LPCWSTR path)
Definition: asmcache.c:62
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
int ret
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by create_full_path(), and IAssemblyCacheImpl_InstallAssembly().

◆ CreateAssemblyCache()

HRESULT WINAPI CreateAssemblyCache ( IAssemblyCache **  ppAsmCache,
DWORD  dwReserved 
)

Definition at line 555 of file asmcache.c.

556{
558
559 TRACE("(%p, %d)\n", ppAsmCache, dwReserved);
560
561 if (!ppAsmCache)
562 return E_INVALIDARG;
563
564 *ppAsmCache = NULL;
565
566 if (!(cache = heap_alloc(sizeof(*cache)))) return E_OUTOFMEMORY;
567
569 cache->ref = 1;
571 if (!cache->lock)
572 {
573 heap_free( cache );
575 }
576 *ppAsmCache = &cache->IAssemblyCache_iface;
577 return S_OK;
578}
#define E_INVALIDARG
Definition: ddrawi.h:101
static const WCHAR cache_mutex_nameW[]
Definition: asmcache.c:59
static const IAssemblyCacheVtbl AssemblyCacheVtbl
Definition: asmcache.c:541
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
#define TRACE(s)
Definition: solgame.cpp:4
IAssemblyCache IAssemblyCache_iface
Definition: cache.c:50
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:576

Referenced by msi_init_assembly_caches().

◆ get_assembly_directory()

static BOOL get_assembly_directory ( LPWSTR  dir,
DWORD  size,
const char version,
PEKIND  architecture 
)
static

Definition at line 110 of file asmcache.c.

111{
112 static const WCHAR dotnet[] = {'\\','M','i','c','r','o','s','o','f','t','.','N','E','T','\\',0};
113 static const WCHAR gac[] = {'\\','a','s','s','e','m','b','l','y','\\','G','A','C',0};
114 static const WCHAR msil[] = {'_','M','S','I','L',0};
115 static const WCHAR x86[] = {'_','3','2',0};
116 static const WCHAR amd64[] = {'_','6','4',0};
118
119 if (!strcmp(version, "v4.0.30319"))
120 {
121 lstrcpyW(dir + len, dotnet);
122 len += ARRAY_SIZE(dotnet) - 1;
123 lstrcpyW(dir + len, gac + 1);
124 len += ARRAY_SIZE(gac) - 2;
125 }
126 else
127 {
128 lstrcpyW(dir + len, gac);
129 len += ARRAY_SIZE(gac) - 1;
130 }
131 switch (architecture)
132 {
133 case peNone:
134 break;
135
136 case peMSIL:
137 lstrcpyW(dir + len, msil);
138 break;
139
140 case peI386:
141 lstrcpyW(dir + len, x86);
142 break;
143
144 case peAMD64:
145 lstrcpyW(dir + len, amd64);
146 break;
147
148 default:
149 WARN("unhandled architecture %u\n", architecture);
150 return FALSE;
151 }
152 return TRUE;
153}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
unsigned int dir
Definition: maze.c:112
#define ARRAY_SIZE(A)
Definition: main.h:33
#define WARN(fmt,...)
Definition: debug.h:112
static const WCHAR version[]
Definition: asmname.c:66
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
@ peMSIL
Definition: fusion.idl:38
@ peI386
Definition: fusion.idl:39
@ peNone
Definition: fusion.idl:37
@ peAMD64
Definition: fusion.idl:41
GLsizeiptr size
Definition: glext.h:5919

Referenced by IAssemblyCacheImpl_InstallAssembly().

◆ IAssemblyCacheImpl_AddRef()

static ULONG WINAPI IAssemblyCacheImpl_AddRef ( IAssemblyCache iface)
static

Definition at line 183 of file asmcache.c.

184{
186 ULONG refCount = InterlockedIncrement(&This->ref);
187
188 TRACE("(%p)->(ref before = %u)\n", This, refCount - 1);
189
190 return refCount;
191}
#define InterlockedIncrement
Definition: armddk.h:53
static IAssemblyCacheImpl * impl_from_IAssemblyCache(IAssemblyCache *iface)
Definition: asmcache.c:157
uint32_t ULONG
Definition: typedefs.h:59

◆ IAssemblyCacheImpl_CreateAssemblyCacheItem()

static HRESULT WINAPI IAssemblyCacheImpl_CreateAssemblyCacheItem ( IAssemblyCache iface,
DWORD  dwFlags,
PVOID  pvReserved,
IAssemblyCacheItem **  ppAsmItem,
LPCWSTR  pszAssemblyName 
)
static

Definition at line 362 of file asmcache.c.

367{
369
370 FIXME("(%p, %d, %p, %p, %s) semi-stub!\n", iface, dwFlags, pvReserved,
371 ppAsmItem, debugstr_w(pszAssemblyName));
372
373 if (!ppAsmItem)
374 return E_INVALIDARG;
375
376 *ppAsmItem = NULL;
377
378 if (!(item = heap_alloc(sizeof(*item)))) return E_OUTOFMEMORY;
379
380 item->IAssemblyCacheItem_iface.lpVtbl = &AssemblyCacheItemVtbl;
381 item->ref = 1;
382
383 *ppAsmItem = &item->IAssemblyCacheItem_iface;
384 return S_OK;
385}
#define FIXME(fmt,...)
Definition: debug.h:111
static const IAssemblyCacheItemVtbl AssemblyCacheItemVtbl
Definition: asmcache.c:360
#define debugstr_w
Definition: kernel32.h:32
static LPCSTR DWORD void * pvReserved
Definition: str.c:196
static ATOM item
Definition: dde.c:856
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

◆ IAssemblyCacheImpl_CreateAssemblyScavenger()

static HRESULT WINAPI IAssemblyCacheImpl_CreateAssemblyScavenger ( IAssemblyCache iface,
IUnknown **  ppUnkReserved 
)
static

Definition at line 387 of file asmcache.c.

389{
390 FIXME("(%p, %p) stub!\n", iface, ppUnkReserved);
391 return E_NOTIMPL;
392}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IAssemblyCacheImpl_InstallAssembly()

static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly ( IAssemblyCache iface,
DWORD  dwFlags,
LPCWSTR  pszManifestFilePath,
LPCFUSION_INSTALL_REFERENCE  pRefData 
)
static

Definition at line 420 of file asmcache.c.

424{
425 static const WCHAR format[] =
426 {'%','s','\\','%','s','\\','%','s','_','_','%','s','\\',0};
427 static const WCHAR format_v40[] =
428 {'%','s','\\','%','s','\\','v','4','.','0','_','%','s','_','_','%','s','\\',0};
429 static const WCHAR ext_exe[] = {'.','e','x','e',0};
430 static const WCHAR ext_dll[] = {'.','d','l','l',0};
433 const WCHAR *extension, *filename, *src_dir;
434 WCHAR *name = NULL, *token = NULL, *version = NULL, *asmpath = NULL;
435 WCHAR asmdir[MAX_PATH], *p, **external_files = NULL, *dst_dir = NULL;
436 PEKIND architecture;
437 char *clr_version;
438 DWORD i, count = 0, src_len, dst_len = ARRAY_SIZE(format_v40);
439 HRESULT hr;
440
441 TRACE("(%p, %d, %s, %p)\n", iface, dwFlags,
442 debugstr_w(pszManifestFilePath), pRefData);
443
444 if (!pszManifestFilePath || !*pszManifestFilePath)
445 return E_INVALIDARG;
446
447 if (!(extension = wcsrchr(pszManifestFilePath, '.')))
449
450 if (lstrcmpiW(extension, ext_exe) && lstrcmpiW(extension, ext_dll))
452
453 if (GetFileAttributesW(pszManifestFilePath) == INVALID_FILE_ATTRIBUTES)
455
456 hr = assembly_create(&assembly, pszManifestFilePath);
457 if (FAILED(hr))
458 {
460 goto done;
461 }
462
464 if (FAILED(hr))
465 goto done;
466
468 if (FAILED(hr))
469 goto done;
470
472 if (FAILED(hr))
473 goto done;
474
476 if (FAILED(hr))
477 goto done;
478
479 hr = assembly_get_external_files(assembly, &external_files, &count);
480 if (FAILED(hr))
481 goto done;
482
483 cache_lock( cache );
484
485 architecture = assembly_get_architecture(assembly);
486 get_assembly_directory(asmdir, MAX_PATH, clr_version, architecture);
487
488 dst_len += lstrlenW(asmdir) + lstrlenW(name) + lstrlenW(version) + lstrlenW(token);
489 if (!(dst_dir = heap_alloc(dst_len * sizeof(WCHAR))))
490 {
492 goto done;
493 }
494 if (!strcmp(clr_version, "v4.0.30319"))
495 dst_len = swprintf(dst_dir, format_v40, asmdir, name, version, token);
496 else
497 dst_len = swprintf(dst_dir, format, asmdir, name, version, token);
498
499 create_full_path(dst_dir);
500
501 hr = assembly_get_path(assembly, &asmpath);
502 if (FAILED(hr))
503 goto done;
504
505 if ((p = wcsrchr(asmpath, '\\')))
506 {
507 filename = p + 1;
508 src_dir = asmpath;
509 src_len = filename - asmpath;
510 }
511 else
512 {
513 filename = asmpath;
514 src_dir = NULL;
515 src_len = 0;
516 }
517 hr = copy_file(src_dir, src_len, dst_dir, dst_len, filename);
518 if (FAILED(hr))
519 goto done;
520
521 for (i = 0; i < count; i++)
522 {
523 hr = copy_file(src_dir, src_len, dst_dir, dst_len, external_files[i]);
524 if (FAILED(hr))
525 break;
526 }
527
528done:
532 heap_free(asmpath);
533 heap_free(dst_dir);
534 for (i = 0; i < count; i++) heap_free(external_files[i]);
535 heap_free(external_files);
538 return hr;
539}
#define COR_E_ASSEMBLYEXPECTED
Definition: corerror.h:52
#define MAX_PATH
Definition: compat.h:34
#define ERROR_INVALID_NAME
Definition: compat.h:103
static void cache_lock(IAssemblyCacheImpl *cache)
Definition: asmcache.c:208
static void cache_unlock(IAssemblyCacheImpl *cache)
Definition: asmcache.c:213
static BOOL get_assembly_directory(LPWSTR dir, DWORD size, const char *version, PEKIND architecture)
Definition: asmcache.c:110
static HRESULT copy_file(const WCHAR *src_dir, DWORD src_len, const WCHAR *dst_dir, DWORD dst_len, const WCHAR *filename)
Definition: asmcache.c:394
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define swprintf
Definition: precomp.h:40
HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name)
Definition: assembly.c:723
HRESULT assembly_release(ASSEMBLY *assembly)
Definition: assembly.c:694
HRESULT assembly_get_path(const ASSEMBLY *assembly, LPWSTR *path)
Definition: assembly.c:750
HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token)
Definition: assembly.c:807
HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version)
Definition: assembly.c:762
HRESULT assembly_get_runtime_version(ASSEMBLY *assembly, LPSTR *version)
Definition: assembly.c:865
HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file)
Definition: assembly.c:641
HRESULT assembly_get_external_files(ASSEMBLY *assembly, LPWSTR **files, DWORD *count)
Definition: assembly.c:871
PEKIND assembly_get_architecture(ASSEMBLY *assembly)
Definition: assembly.c:788
PEKIND
Definition: fusion.idl:36
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLfloat GLfloat p
Definition: glext.h:8902
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
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 token
Definition: glfuncs.h:210
#define FAILED(hr)
Definition: intsafe.h:51
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
clr_version
Definition: msipriv.h:374
Definition: name.c:39
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

◆ IAssemblyCacheImpl_QueryAssemblyInfo()

static HRESULT WINAPI IAssemblyCacheImpl_QueryAssemblyInfo ( IAssemblyCache iface,
DWORD  dwFlags,
LPCWSTR  pszAssemblyName,
ASSEMBLY_INFO pAsmInfo 
)
static

Definition at line 301 of file asmcache.c.

305{
307 IAssemblyName *asmname, *next = NULL;
308 IAssemblyEnum *asmenum = NULL;
309 HRESULT hr;
310
311 TRACE("(%p, %d, %s, %p)\n", iface, dwFlags,
312 debugstr_w(pszAssemblyName), pAsmInfo);
313
314 if (pAsmInfo)
315 {
316 if (pAsmInfo->cbAssemblyInfo == 0)
317 pAsmInfo->cbAssemblyInfo = sizeof(ASSEMBLY_INFO);
318 else if (pAsmInfo->cbAssemblyInfo != sizeof(ASSEMBLY_INFO))
319 return E_INVALIDARG;
320 }
321
322 hr = CreateAssemblyNameObject(&asmname, pszAssemblyName,
324 if (FAILED(hr))
325 return hr;
326
327 cache_lock( cache );
328
329 hr = CreateAssemblyEnum(&asmenum, NULL, asmname, ASM_CACHE_GAC, NULL);
330 if (FAILED(hr))
331 goto done;
332
333 for (;;)
334 {
335 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
336 if (hr != S_OK)
337 {
339 goto done;
340 }
341 hr = IAssemblyName_IsEqual(asmname, next, ASM_CMPF_IL_ALL);
342 if (hr == S_OK) break;
343 }
344
345 if (!pAsmInfo)
346 goto done;
347
349
351
352done:
353 IAssemblyName_Release(asmname);
354 if (next) IAssemblyName_Release(next);
355 if (asmenum) IAssemblyEnum_Release(asmenum);
357 return hr;
358}
HRESULT WINAPI CreateAssemblyEnum(IAssemblyEnum **pEnum, IUnknown *pUnkReserved, IAssemblyName *pName, DWORD dwFlags, LPVOID pvReserved)
Definition: asmenum.c:468
HRESULT WINAPI CreateAssemblyNameObject(IAssemblyName **ppAssemblyNameObj, LPCWSTR szAssemblyName, DWORD dwFlags, LPVOID pvReserved)
Definition: asmname.c:797
HRESULT IAssemblyName_GetPath(IAssemblyName *iface, LPWSTR buf, ULONG *len)
Definition: asmname.c:534
#define ASSEMBLYINFO_FLAG_INSTALLED
Definition: fusion.idl:103
@ ASM_CACHE_GAC
Definition: fusion.idl:29
static unsigned __int64 next
Definition: rand_nt.c:6
ULONG cbAssemblyInfo
Definition: winsxs.idl:37
ULONG cchBuf
Definition: winsxs.idl:41
LPWSTR pszCurrentAssemblyPathBuf
Definition: winsxs.idl:40
DWORD dwAssemblyFlags
Definition: winsxs.idl:38
@ CANOF_PARSE_DISPLAY_NAME
Definition: winsxs.idl:193
struct _ASSEMBLY_INFO ASSEMBLY_INFO

◆ IAssemblyCacheImpl_QueryInterface()

static HRESULT WINAPI IAssemblyCacheImpl_QueryInterface ( IAssemblyCache iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 162 of file asmcache.c.

164{
166
167 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
168
169 *ppobj = NULL;
170
172 IsEqualIID(riid, &IID_IAssemblyCache))
173 {
174 IAssemblyCache_AddRef(iface);
175 *ppobj = &This->IAssemblyCache_iface;
176 return S_OK;
177 }
178
179 WARN("(%p, %s, %p): not found\n", This, debugstr_guid(riid), ppobj);
180 return E_NOINTERFACE;
181}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ IAssemblyCacheImpl_Release()

static ULONG WINAPI IAssemblyCacheImpl_Release ( IAssemblyCache iface)
static

Definition at line 193 of file asmcache.c.

194{
196 ULONG refCount = InterlockedDecrement( &cache->ref );
197
198 TRACE("(%p)->(ref before = %u)\n", cache, refCount + 1);
199
200 if (!refCount)
201 {
203 heap_free( cache );
204 }
205 return refCount;
206}
#define InterlockedDecrement
Definition: armddk.h:52
#define CloseHandle
Definition: compat.h:739

◆ IAssemblyCacheImpl_UninstallAssembly()

static HRESULT WINAPI IAssemblyCacheImpl_UninstallAssembly ( IAssemblyCache iface,
DWORD  dwFlags,
LPCWSTR  pszAssemblyName,
LPCFUSION_INSTALL_REFERENCE  pRefData,
ULONG pulDisposition 
)
static

Definition at line 218 of file asmcache.c.

223{
224 HRESULT hr;
226 IAssemblyName *asmname, *next = NULL;
227 IAssemblyEnum *asmenum = NULL;
228 WCHAR *p, *path = NULL;
229 ULONG disp;
230 DWORD len;
231
232 TRACE("(%p, 0%08x, %s, %p, %p)\n", iface, dwFlags,
233 debugstr_w(pszAssemblyName), pRefData, pulDisposition);
234
235 if (pRefData)
236 {
237 FIXME("application reference not supported\n");
238 return E_NOTIMPL;
239 }
240 hr = CreateAssemblyNameObject( &asmname, pszAssemblyName, CANOF_PARSE_DISPLAY_NAME, NULL );
241 if (FAILED( hr ))
242 return hr;
243
244 cache_lock( cache );
245
246 hr = CreateAssemblyEnum( &asmenum, NULL, asmname, ASM_CACHE_GAC, NULL );
247 if (FAILED( hr ))
248 goto done;
249
250 hr = IAssemblyEnum_GetNextAssembly( asmenum, NULL, &next, 0 );
251 if (hr == S_FALSE)
252 {
253 if (pulDisposition)
254 *pulDisposition = IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED;
255 goto done;
256 }
259 goto done;
260
261 if (!(path = heap_alloc( len * sizeof(WCHAR) )))
262 {
264 goto done;
265 }
267 if (FAILED( hr ))
268 goto done;
269
270 if (DeleteFileW( path ))
271 {
272 if ((p = wcsrchr( path, '\\' )))
273 {
274 *p = 0;
276 if ((p = wcsrchr( path, '\\' )))
277 {
278 *p = 0;
280 }
281 }
282 disp = IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED;
283 hr = S_OK;
284 }
285 else
286 {
287 disp = IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED;
288 hr = S_FALSE;
289 }
290 if (pulDisposition) *pulDisposition = disp;
291
292done:
293 IAssemblyName_Release( asmname );
294 if (next) IAssemblyName_Release( next );
295 if (asmenum) IAssemblyEnum_Release( asmenum );
296 heap_free( path );
298 return hr;
299}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
#define S_FALSE
Definition: winerror.h:2357

◆ IAssemblyCacheItemImpl_AbortItem()

static HRESULT WINAPI IAssemblyCacheItemImpl_AbortItem ( IAssemblyCacheItem iface)
static

Definition at line 653 of file asmcache.c.

654{
655 FIXME("(%p) stub!\n", iface);
656 return E_NOTIMPL;
657}

◆ IAssemblyCacheItemImpl_AddRef()

static ULONG WINAPI IAssemblyCacheItemImpl_AddRef ( IAssemblyCacheItem iface)
static

Definition at line 608 of file asmcache.c.

609{
611 ULONG refCount = InterlockedIncrement(&This->ref);
612
613 TRACE("(%p)->(ref before = %u)\n", This, refCount - 1);
614
615 return refCount;
616}
static IAssemblyCacheItemImpl * impl_from_IAssemblyCacheItem(IAssemblyCacheItem *iface)
Definition: asmcache.c:582

◆ IAssemblyCacheItemImpl_Commit()

static HRESULT WINAPI IAssemblyCacheItemImpl_Commit ( IAssemblyCacheItem iface,
DWORD  dwFlags,
ULONG pulDisposition 
)
static

Definition at line 645 of file asmcache.c.

648{
649 FIXME("(%p, %d, %p) stub!\n", iface, dwFlags, pulDisposition);
650 return E_NOTIMPL;
651}

◆ IAssemblyCacheItemImpl_CreateStream()

static HRESULT WINAPI IAssemblyCacheItemImpl_CreateStream ( IAssemblyCacheItem iface,
DWORD  dwFlags,
LPCWSTR  pszStreamName,
DWORD  dwFormat,
DWORD  dwFormatFlags,
IStream **  ppIStream,
ULARGE_INTEGER puliMaxSize 
)
static

Definition at line 631 of file asmcache.c.

638{
639 FIXME("(%p, %d, %s, %d, %d, %p, %p) stub!\n", iface, dwFlags,
640 debugstr_w(pszStreamName), dwFormat, dwFormatFlags, ppIStream, puliMaxSize);
641
642 return E_NOTIMPL;
643}
DWORD dwFormatFlags
Definition: trayclock.cpp:31

◆ IAssemblyCacheItemImpl_QueryInterface()

static HRESULT WINAPI IAssemblyCacheItemImpl_QueryInterface ( IAssemblyCacheItem iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 587 of file asmcache.c.

589{
591
592 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
593
594 *ppobj = NULL;
595
597 IsEqualIID(riid, &IID_IAssemblyCacheItem))
598 {
599 IAssemblyCacheItem_AddRef(iface);
600 *ppobj = &This->IAssemblyCacheItem_iface;
601 return S_OK;
602 }
603
604 WARN("(%p, %s, %p): not found\n", This, debugstr_guid(riid), ppobj);
605 return E_NOINTERFACE;
606}

◆ IAssemblyCacheItemImpl_Release()

static ULONG WINAPI IAssemblyCacheItemImpl_Release ( IAssemblyCacheItem iface)
static

Definition at line 618 of file asmcache.c.

619{
621 ULONG refCount = InterlockedDecrement(&This->ref);
622
623 TRACE("(%p)->(ref before = %u)\n", This, refCount + 1);
624
625 if (!refCount)
627
628 return refCount;
629}

◆ impl_from_IAssemblyCache()

static IAssemblyCacheImpl * impl_from_IAssemblyCache ( IAssemblyCache iface)
inlinestatic

◆ impl_from_IAssemblyCacheItem()

static IAssemblyCacheItemImpl * impl_from_IAssemblyCacheItem ( IAssemblyCacheItem iface)
inlinestatic

Definition at line 582 of file asmcache.c.

583{
584 return CONTAINING_RECORD(iface, IAssemblyCacheItemImpl, IAssemblyCacheItem_iface);
585}

Referenced by IAssemblyCacheItemImpl_AddRef(), IAssemblyCacheItemImpl_QueryInterface(), and IAssemblyCacheItemImpl_Release().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( fusion  )

Variable Documentation

◆ AssemblyCacheItemVtbl

static const IAssemblyCacheItemVtbl AssemblyCacheItemVtbl
static
Initial value:
= {
}
static ULONG WINAPI IAssemblyCacheItemImpl_Release(IAssemblyCacheItem *iface)
Definition: asmcache.c:618
static HRESULT WINAPI IAssemblyCacheItemImpl_QueryInterface(IAssemblyCacheItem *iface, REFIID riid, LPVOID *ppobj)
Definition: asmcache.c:587
static ULONG WINAPI IAssemblyCacheItemImpl_AddRef(IAssemblyCacheItem *iface)
Definition: asmcache.c:608
static HRESULT WINAPI IAssemblyCacheItemImpl_CreateStream(IAssemblyCacheItem *iface, DWORD dwFlags, LPCWSTR pszStreamName, DWORD dwFormat, DWORD dwFormatFlags, IStream **ppIStream, ULARGE_INTEGER *puliMaxSize)
Definition: asmcache.c:631
static HRESULT WINAPI IAssemblyCacheItemImpl_AbortItem(IAssemblyCacheItem *iface)
Definition: asmcache.c:653
static HRESULT WINAPI IAssemblyCacheItemImpl_Commit(IAssemblyCacheItem *iface, DWORD dwFlags, ULONG *pulDisposition)
Definition: asmcache.c:645

Definition at line 360 of file asmcache.c.

Referenced by IAssemblyCacheImpl_CreateAssemblyCacheItem().

◆ AssemblyCacheVtbl

const IAssemblyCacheVtbl AssemblyCacheVtbl
static
Initial value:
= {
}
static HRESULT WINAPI IAssemblyCacheImpl_QueryInterface(IAssemblyCache *iface, REFIID riid, LPVOID *ppobj)
Definition: asmcache.c:162
static HRESULT WINAPI IAssemblyCacheImpl_QueryAssemblyInfo(IAssemblyCache *iface, DWORD dwFlags, LPCWSTR pszAssemblyName, ASSEMBLY_INFO *pAsmInfo)
Definition: asmcache.c:301
static ULONG WINAPI IAssemblyCacheImpl_AddRef(IAssemblyCache *iface)
Definition: asmcache.c:183
static HRESULT WINAPI IAssemblyCacheImpl_CreateAssemblyCacheItem(IAssemblyCache *iface, DWORD dwFlags, PVOID pvReserved, IAssemblyCacheItem **ppAsmItem, LPCWSTR pszAssemblyName)
Definition: asmcache.c:362
static HRESULT WINAPI IAssemblyCacheImpl_CreateAssemblyScavenger(IAssemblyCache *iface, IUnknown **ppUnkReserved)
Definition: asmcache.c:387
static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, DWORD dwFlags, LPCWSTR pszManifestFilePath, LPCFUSION_INSTALL_REFERENCE pRefData)
Definition: asmcache.c:420
static ULONG WINAPI IAssemblyCacheImpl_Release(IAssemblyCache *iface)
Definition: asmcache.c:193
static HRESULT WINAPI IAssemblyCacheImpl_UninstallAssembly(IAssemblyCache *iface, DWORD dwFlags, LPCWSTR pszAssemblyName, LPCFUSION_INSTALL_REFERENCE pRefData, ULONG *pulDisposition)
Definition: asmcache.c:218

Definition at line 541 of file asmcache.c.

Referenced by CreateAssemblyCache().

◆ cache_mutex_nameW

const WCHAR cache_mutex_nameW[]
static
Initial value:
=
{'_','_','W','I','N','E','_','F','U','S','I','O','N','_','C','A','C','H','E','_','M','U','T','E','X','_','_',0}

Definition at line 59 of file asmcache.c.

Referenced by CreateAssemblyCache().