ReactOS 0.4.17-dev-934-g091855f
asmenum.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "guiddef.h"
#include "fusion.h"
#include "corerror.h"
#include "fusionpriv.h"
#include "wine/debug.h"
#include "wine/list.h"
Include dependency graph for asmenum.c:

Go to the source code of this file.

Classes

struct  _tagASMNAME
 
struct  IAssemblyEnumImpl
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct _tagASMNAME ASMNAME
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (fusion)
 
static IAssemblyEnumImpl * impl_from_IAssemblyEnum (IAssemblyEnum *iface)
 
static HRESULT WINAPI IAssemblyEnumImpl_QueryInterface (IAssemblyEnum *iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IAssemblyEnumImpl_AddRef (IAssemblyEnum *iface)
 
static ULONG WINAPI IAssemblyEnumImpl_Release (IAssemblyEnum *iface)
 
static HRESULT WINAPI IAssemblyEnumImpl_GetNextAssembly (IAssemblyEnum *iface, LPVOID pvReserved, IAssemblyName **ppName, DWORD dwFlags)
 
static HRESULT WINAPI IAssemblyEnumImpl_Reset (IAssemblyEnum *iface)
 
static HRESULT WINAPI IAssemblyEnumImpl_Clone (IAssemblyEnum *iface, IAssemblyEnum **ppEnum)
 
static void build_file_mask (IAssemblyName *name, int depth, const WCHAR *path, const WCHAR *prefix, WCHAR *buf)
 
static int compare_assembly_names (ASMNAME *asmname1, ASMNAME *asmname2)
 
static void insert_assembly (struct list *assemblies, ASMNAME *to_insert)
 
static HRESULT enum_gac_assemblies (struct list *assemblies, IAssemblyName *name, int depth, const WCHAR *prefix, LPWSTR path)
 
static HRESULT enumerate_gac (IAssemblyEnumImpl *asmenum, IAssemblyName *pName)
 
HRESULT WINAPI CreateAssemblyEnum (IAssemblyEnum **pEnum, IUnknown *pUnkReserved, IAssemblyName *pName, DWORD dwFlags, LPVOID pvReserved)
 

Variables

static const IAssemblyEnumVtbl AssemblyEnumVtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 28 of file asmenum.c.

Typedef Documentation

◆ ASMNAME

Function Documentation

◆ build_file_mask()

static void build_file_mask ( IAssemblyName *  name,
int  depth,
const WCHAR *  path,
const WCHAR *  prefix,
WCHAR *  buf 
)
static

Definition at line 171 of file asmenum.c.

173{
174 static const WCHAR star[] = {'*',0};
175 static const WCHAR ss_fmt[] = {'%','s','\\','%','s',0};
176 static const WCHAR sss_fmt[] = {'%','s','\\','%','s','_','_','%','s',0};
177 static const WCHAR ssss_fmt[] = {'%','s','\\','%','s','%','s','_','_','%','s',0};
178 static const WCHAR ver_fmt[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
179 static const WCHAR star_fmt[] = {'%','s','\\','*',0};
180 static const WCHAR star_prefix_fmt[] = {'%','s','\\','%','s','*',0};
181 WCHAR disp[MAX_PATH], version[24]; /* strlen("65535") * 4 + 3 + 1 */
182 LPCWSTR verptr, pubkeyptr;
183 HRESULT hr;
184 DWORD size, major_size, minor_size, build_size, revision_size;
186 WCHAR token_str[TOKEN_LENGTH + 1];
188
189 if (!name)
190 {
191 if (prefix && depth == 1)
192 swprintf(buf, MAX_PATH, star_prefix_fmt, path, prefix);
193 else
194 swprintf(buf, MAX_PATH, star_fmt, path);
195 return;
196 }
197 if (depth == 0)
198 {
199 size = MAX_PATH;
200 *disp = '\0';
201 hr = IAssemblyName_GetName(name, &size, disp);
202 if (SUCCEEDED(hr))
203 swprintf(buf, MAX_PATH, ss_fmt, path, disp);
204 else
205 swprintf(buf, MAX_PATH, ss_fmt, path, star);
206 }
207 else if (depth == 1)
208 {
209 major_size = sizeof(major);
210 IAssemblyName_GetProperty(name, ASM_NAME_MAJOR_VERSION, &major, &major_size);
211
212 minor_size = sizeof(minor);
213 IAssemblyName_GetProperty(name, ASM_NAME_MINOR_VERSION, &minor, &minor_size);
214
215 build_size = sizeof(build);
216 IAssemblyName_GetProperty(name, ASM_NAME_BUILD_NUMBER, &build, &build_size);
217
218 revision_size = sizeof(revision);
219 IAssemblyName_GetProperty(name, ASM_NAME_REVISION_NUMBER, &revision, &revision_size);
220
221 if (!major_size || !minor_size || !build_size || !revision_size) verptr = star;
222 else
223 {
225 verptr = version;
226 }
227
228 size = sizeof(token);
229 IAssemblyName_GetProperty(name, ASM_NAME_PUBLIC_KEY_TOKEN, token, &size);
230
231 if (!size) pubkeyptr = star;
232 else
233 {
234 token_to_str(token, token_str);
235 pubkeyptr = token_str;
236 }
237
238 if (prefix)
239 swprintf(buf, MAX_PATH, ssss_fmt, path, prefix, verptr, pubkeyptr);
240 else
241 swprintf(buf, MAX_PATH, sss_fmt, path, verptr, pubkeyptr);
242 }
243}
#define ARRAY_SIZE(A)
Definition: main.h:20
HRESULT hr
Definition: delayimp.cpp:582
#define MAX_PATH
Definition: compat.h:34
static const WCHAR version[]
Definition: asmname.c:66
WORD WORD WORD * revision
Definition: metahost.c:91
WORD WORD * build
Definition: metahost.c:91
#define swprintf
Definition: precomp.h:40
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TOKEN_LENGTH
Definition: fusionpriv.h:451
#define BYTES_PER_TOKEN
Definition: fusionpriv.h:449
static void token_to_str(BYTE *bytes, LPWSTR str)
Definition: fusionpriv.h:453
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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 SUCCEEDED(hr)
Definition: intsafe.h:50
short WCHAR
Definition: pedump.c:58
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928
Definition: name.c:39
Character const *const prefix
Definition: tempnam.cpp:195
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char BYTE
Definition: xxhash.c:193

Referenced by enum_gac_assemblies().

◆ compare_assembly_names()

static int compare_assembly_names ( ASMNAME *  asmname1,
ASMNAME *  asmname2 
)
static

Definition at line 245 of file asmenum.c.

246{
247 int ret;
248 WORD version1, version2;
250 WCHAR token_str1[TOKEN_LENGTH + 1], token_str2[TOKEN_LENGTH + 1];
251 BYTE token1[BYTES_PER_TOKEN], token2[BYTES_PER_TOKEN];
252 DWORD size, i;
253
254 size = sizeof(name1);
255 IAssemblyName_GetProperty(asmname1->name, ASM_NAME_NAME, name1, &size);
256 size = sizeof(name2);
257 IAssemblyName_GetProperty(asmname2->name, ASM_NAME_NAME, name2, &size);
258
259 if ((ret = wcsicmp(name1, name2))) return ret;
260
261 for (i = ASM_NAME_MAJOR_VERSION; i < ASM_NAME_CULTURE; i++)
262 {
263 size = sizeof(version1);
264 IAssemblyName_GetProperty(asmname1->name, i, &version1, &size);
265 size = sizeof(version2);
266 IAssemblyName_GetProperty(asmname2->name, i, &version2, &size);
267
268 if (version1 < version2) return -1;
269 if (version1 > version2) return 1;
270 }
271
272 /* FIXME: compare cultures */
273
274 size = sizeof(token1);
275 IAssemblyName_GetProperty(asmname1->name, ASM_NAME_PUBLIC_KEY_TOKEN, token1, &size);
276 size = sizeof(token2);
277 IAssemblyName_GetProperty(asmname2->name, ASM_NAME_PUBLIC_KEY_TOKEN, token2, &size);
278
279 token_to_str(token1, token_str1);
280 token_to_str(token2, token_str2);
281
282 if ((ret = wcsicmp(token_str1, token_str2))) return ret;
283
284 return 0;
285}
#define wcsicmp
Definition: compat.h:15
return ret
Definition: mutex.c:147
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
static WCHAR name1[]
Definition: record.c:34
static WCHAR name2[]
Definition: record.c:35
IAssemblyName * name
Definition: asmenum.c:47

Referenced by insert_assembly().

◆ CreateAssemblyEnum()

HRESULT WINAPI CreateAssemblyEnum ( IAssemblyEnum **  pEnum,
IUnknown *  pUnkReserved,
IAssemblyName *  pName,
DWORD  dwFlags,
LPVOID  pvReserved 
)

Definition at line 466 of file asmenum.c.

468{
469 IAssemblyEnumImpl *asmenum;
470 HRESULT hr;
471
472 TRACE("(%p, %p, %p, %08lx, %p)\n", pEnum, pUnkReserved,
474
475 if (!pEnum)
476 return E_INVALIDARG;
477
478 if (dwFlags == 0 || dwFlags == ASM_CACHE_ROOT)
479 return E_INVALIDARG;
480
481 if (!(asmenum = malloc(sizeof(*asmenum)))) return E_OUTOFMEMORY;
482
483 asmenum->IAssemblyEnum_iface.lpVtbl = &AssemblyEnumVtbl;
484 asmenum->ref = 1;
485 list_init(&asmenum->assemblies);
486
488 {
489 hr = enumerate_gac(asmenum, pName);
490 if (FAILED(hr))
491 {
492 free(asmenum);
493 return hr;
494 }
495 }
496
497 asmenum->iter = list_head(&asmenum->assemblies);
498 *pEnum = &asmenum->IAssemblyEnum_iface;
499
500 return S_OK;
501}
static void list_init(struct list_entry *head)
Definition: list.h:51
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
static const IAssemblyEnumVtbl AssemblyEnumVtbl
Definition: asmenum.c:162
static HRESULT enumerate_gac(IAssemblyEnumImpl *asmenum, IAssemblyName *pName)
Definition: asmenum.c:396
@ ASM_CACHE_ROOT
Definition: fusion.idl:31
@ ASM_CACHE_GAC
Definition: fusion.idl:29
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
static LPSTR pName
Definition: security.c:86
static LPCWSTR LPVOID pvReserved
Definition: asmcache.c:749
static IUnknown * pUnkReserved
Definition: asmenum.c:33
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define TRACE(s)
Definition: solgame.cpp:4
IAssemblyEnum IAssemblyEnum_iface
Definition: asmenum.c:52
struct list assemblies
Definition: asmenum.c:54
struct list * iter
Definition: asmenum.c:55
Definition: list.h:15

Referenced by IAssemblyCacheImpl_QueryAssemblyInfo(), and IAssemblyCacheImpl_UninstallAssembly().

◆ enum_gac_assemblies()

static HRESULT enum_gac_assemblies ( struct list *  assemblies,
IAssemblyName *  name,
int  depth,
const WCHAR *  prefix,
LPWSTR  path 
)
static

Definition at line 305 of file asmenum.c.

307{
308 static const WCHAR dot[] = {'.',0};
309 static const WCHAR dotdot[] = {'.','.',0};
310 static const WCHAR dblunder[] = {'_','_',0};
311 static const WCHAR path_fmt[] = {'%','s','\\','%','s','\\','%','s','.','d','l','l',0};
312 static const WCHAR name_fmt[] = {'%','s',',',' ','V','e','r','s','i','o','n','=','%','s',',',' ',
313 'C','u','l','t','u','r','e','=','n','e','u','t','r','a','l',',',' ',
314 'P','u','b','l','i','c','K','e','y','T','o','k','e','n','=','%','s',0};
315 static const WCHAR ss_fmt[] = {'%','s','\\','%','s',0};
317 WCHAR buf[MAX_PATH], disp[MAX_PATH], asmpath[MAX_PATH], *ptr;
318 static WCHAR parent[MAX_PATH];
319 ASMNAME *asmname;
320 HANDLE hfind;
321 HRESULT hr = S_OK;
322
324 hfind = FindFirstFileW(buf, &ffd);
325 if (hfind == INVALID_HANDLE_VALUE)
326 return S_OK;
327
328 do
329 {
330 if (!lstrcmpW(ffd.cFileName, dot) || !lstrcmpW(ffd.cFileName, dotdot))
331 continue;
332
333 if (depth == 0)
334 {
335 if (name)
336 ptr = wcsrchr(buf, '\\') + 1;
337 else
338 ptr = ffd.cFileName;
339
341 }
342 else if (depth == 1)
343 {
344 const WCHAR *token, *version = ffd.cFileName;
345
346 swprintf(asmpath, ARRAY_SIZE(asmpath), path_fmt, path, ffd.cFileName, parent);
347 ptr = wcsstr(ffd.cFileName, dblunder);
348 *ptr = '\0';
349 token = ptr + 2;
350
351 if (prefix)
352 {
353 unsigned int prefix_len = lstrlenW(prefix);
354 if (lstrlenW(ffd.cFileName) >= prefix_len &&
355 !wcsnicmp(ffd.cFileName, prefix, prefix_len))
356 version += prefix_len;
357 }
358 swprintf(disp, ARRAY_SIZE(disp), name_fmt, parent, version, token);
359
360 if (!(asmname = malloc(sizeof(*asmname))))
361 {
363 break;
364 }
365
366 hr = CreateAssemblyNameObject(&asmname->name, disp,
368 if (FAILED(hr))
369 {
370 free(asmname);
371 break;
372 }
373
374 hr = IAssemblyName_SetPath(asmname->name, asmpath);
375 if (FAILED(hr))
376 {
377 IAssemblyName_Release(asmname->name);
378 free(asmname);
379 break;
380 }
381
382 insert_assembly(assemblies, asmname);
383 continue;
384 }
385
386 swprintf(buf, ARRAY_SIZE(buf), ss_fmt, path, ffd.cFileName);
387 hr = enum_gac_assemblies(assemblies, name, depth + 1, prefix, buf);
388 if (FAILED(hr))
389 break;
390 } while (FindNextFileW(hfind, &ffd) != 0);
391
392 FindClose(hfind);
393 return hr;
394}
#define NULL
Definition: types.h:112
#define wcsnicmp
Definition: compat.h:14
#define wcsrchr
Definition: compat.h:16
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, int depth, const WCHAR *prefix, LPWSTR path)
Definition: asmenum.c:305
static void insert_assembly(struct list *assemblies, ASMNAME *to_insert)
Definition: asmenum.c:288
static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path, const WCHAR *prefix, WCHAR *buf)
Definition: asmenum.c:171
HRESULT IAssemblyName_SetPath(IAssemblyName *iface, LPCWSTR path)
Definition: asmname.c:523
HRESULT WINAPI CreateAssemblyNameObject(IAssemblyName **ppAssemblyNameObj, LPCWSTR szAssemblyName, DWORD dwFlags, LPVOID pvReserved)
Definition: asmname.c:795
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
_ACRTIMP wchar_t *__cdecl wcsstr(const wchar_t *, const wchar_t *)
Definition: wcs.c:2998
r parent
Definition: btrfs.c:3010
static PVOID ptr
Definition: dispmode.c:27
_Field_z_ WCHAR cFileName[MAX_PATH]
Definition: minwinbase.h:291
@ CANOF_PARSE_DISPLAY_NAME
Definition: winsxs.idl:193

Referenced by enum_gac_assemblies(), enumerate_gac(), and test_enumerate().

◆ enumerate_gac()

static HRESULT enumerate_gac ( IAssemblyEnumImpl *  asmenum,
IAssemblyName *  pName 
)
static

Definition at line 396 of file asmenum.c.

397{
398 static const WCHAR gac[] = {'\\','G','A','C',0};
399 static const WCHAR gac_32[] = {'\\','G','A','C','_','3','2',0};
400 static const WCHAR gac_64[] = {'\\','G','A','C','_','6','4',0};
401 static const WCHAR gac_msil[] = {'\\','G','A','C','_','M','S','I','L',0};
402 static const WCHAR v40[] = {'v','4','.','0','_',0};
405 HRESULT hr;
406 DWORD size;
407
408 size = MAX_PATH;
410 if (FAILED(hr))
411 return hr;
412
413 lstrcpyW(path, buf);
415 if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
416 {
417 lstrcpyW(path + size - 1, gac_64);
418 hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path);
419 if (FAILED(hr))
420 return hr;
421 }
422 lstrcpyW(path + size - 1, gac_32);
423 hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path);
424 if (FAILED(hr))
425 return hr;
426
427 lstrcpyW(path + size - 1, gac_msil);
428 hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path);
429 if (FAILED(hr))
430 return hr;
431
432 size = MAX_PATH;
434 if (FAILED(hr))
435 return hr;
436
437 lstrcpyW(path, buf);
438 if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
439 {
440 lstrcpyW(path + size - 1, gac_64);
441 hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path);
442 if (FAILED(hr))
443 return hr;
444 }
445 lstrcpyW(path + size - 1, gac_32);
446 hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path);
447 if (FAILED(hr))
448 return hr;
449
450 lstrcpyW(path + size - 1, gac_msil);
451 hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path);
452 if (FAILED(hr))
453 return hr;
454
455 lstrcpyW(path + size - 1, gac);
456 hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path);
457 if (FAILED(hr))
458 return hr;
459
460 return S_OK;
461}
HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath, PDWORD pcchPath)
Definition: fusion.c:111
VOID WINAPI GetNativeSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:207
@ ASM_CACHE_ROOT_EX
Definition: fusion.idl:32
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114

Referenced by CreateAssemblyEnum().

◆ IAssemblyEnumImpl_AddRef()

static ULONG WINAPI IAssemblyEnumImpl_AddRef ( IAssemblyEnum *  iface)
static

Definition at line 85 of file asmenum.c.

86{
88 ULONG refCount = InterlockedIncrement(&This->ref);
89
90 TRACE("(%p)->(ref before = %lu)\n", This, refCount - 1);
91
92 return refCount;
93}
#define InterlockedIncrement
Definition: armddk.h:53
static IAssemblyEnumImpl * impl_from_IAssemblyEnum(IAssemblyEnum *iface)
Definition: asmenum.c:59
uint32_t ULONG
Definition: typedefs.h:59

◆ IAssemblyEnumImpl_Clone()

static HRESULT WINAPI IAssemblyEnumImpl_Clone ( IAssemblyEnum *  iface,
IAssemblyEnum **  ppEnum 
)
static

Definition at line 155 of file asmenum.c.

157{
158 FIXME("(%p, %p) stub!\n", iface, ppEnum);
159 return E_NOTIMPL;
160}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IAssemblyEnumImpl_GetNextAssembly()

static HRESULT WINAPI IAssemblyEnumImpl_GetNextAssembly ( IAssemblyEnum *  iface,
LPVOID  pvReserved,
IAssemblyName **  ppName,
DWORD  dwFlags 
)
static

Definition at line 120 of file asmenum.c.

124{
126 ASMNAME *asmname;
127
128 TRACE("(%p, %p, %p, %ld)\n", iface, pvReserved, ppName, dwFlags);
129
130 if (!ppName)
131 return E_INVALIDARG;
132
133 asmname = LIST_ENTRY(asmenum->iter, ASMNAME, entry);
134 if (!asmname)
135 return S_FALSE;
136
137 *ppName = asmname->name;
138 IAssemblyName_AddRef(*ppName);
139
140 asmenum->iter = list_next(&asmenum->assemblies, asmenum->iter);
141
142 return S_OK;
143}
uint32_t entry
Definition: isohybrid.c:63
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
Definition: list.h:117
#define LIST_ENTRY(type)
Definition: queue.h:175
#define S_FALSE
Definition: winerror.h:3451

◆ IAssemblyEnumImpl_QueryInterface()

static HRESULT WINAPI IAssemblyEnumImpl_QueryInterface ( IAssemblyEnum *  iface,
REFIID  riid,
LPVOID *  ppobj 
)
static

Definition at line 64 of file asmenum.c.

66{
68
69 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
70
71 *ppobj = NULL;
72
74 IsEqualIID(riid, &IID_IAssemblyEnum))
75 {
76 IAssemblyEnum_AddRef(iface);
77 *ppobj = &This->IAssemblyEnum_iface;
78 return S_OK;
79 }
80
81 WARN("(%p, %s, %p): not found\n", This, debugstr_guid(riid), ppobj);
82 return E_NOINTERFACE;
83}
#define WARN(fmt,...)
Definition: precomp.h:61
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:3479

◆ IAssemblyEnumImpl_Release()

static ULONG WINAPI IAssemblyEnumImpl_Release ( IAssemblyEnum *  iface)
static

Definition at line 95 of file asmenum.c.

96{
98 ULONG refCount = InterlockedDecrement(&This->ref);
99 struct list *item, *cursor;
100
101 TRACE("(%p)->(ref before = %lu)\n", This, refCount + 1);
102
103 if (!refCount)
104 {
105 LIST_FOR_EACH_SAFE(item, cursor, &This->assemblies)
106 {
107 ASMNAME *asmname = LIST_ENTRY(item, ASMNAME, entry);
108
109 list_remove(&asmname->entry);
110 IAssemblyName_Release(asmname->name);
111 free(asmname);
112 }
113
114 free(This);
115 }
116
117 return refCount;
118}
#define InterlockedDecrement
Definition: armddk.h:52
static void list_remove(struct list_entry *entry)
Definition: list.h:90
Definition: list.h:39
const char cursor[]
Definition: icontest.c:13
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:230
struct list entry
Definition: asmenum.c:46

◆ IAssemblyEnumImpl_Reset()

static HRESULT WINAPI IAssemblyEnumImpl_Reset ( IAssemblyEnum *  iface)
static

Definition at line 145 of file asmenum.c.

146{
148
149 TRACE("(%p)\n", iface);
150
151 asmenum->iter = list_head(&asmenum->assemblies);
152 return S_OK;
153}

◆ impl_from_IAssemblyEnum()

static IAssemblyEnumImpl * impl_from_IAssemblyEnum ( IAssemblyEnum *  iface)
inlinestatic

Definition at line 59 of file asmenum.c.

60{
61 return CONTAINING_RECORD(iface, IAssemblyEnumImpl, IAssemblyEnum_iface);
62}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by IAssemblyEnumImpl_AddRef(), IAssemblyEnumImpl_GetNextAssembly(), IAssemblyEnumImpl_QueryInterface(), IAssemblyEnumImpl_Release(), and IAssemblyEnumImpl_Reset().

◆ insert_assembly()

static void insert_assembly ( struct list *  assemblies,
ASMNAME *  to_insert 
)
static

Definition at line 288 of file asmenum.c.

289{
290 struct list *item;
291
292 LIST_FOR_EACH(item, assemblies)
293 {
295
296 if (compare_assembly_names(name, to_insert) > 0)
297 {
298 list_add_before(&name->entry, &to_insert->entry);
299 return;
300 }
301 }
302 list_add_tail(assemblies, &to_insert->entry);
303}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static int compare_assembly_names(ASMNAME *asmname1, ASMNAME *asmname2)
Definition: asmenum.c:245
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:226
__WINE_SERVER_LIST_INLINE void list_add_before(struct list *elem, struct list *to_add)
Definition: list.h:89

Referenced by enum_gac_assemblies().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( fusion  )

Variable Documentation

◆ AssemblyEnumVtbl

const IAssemblyEnumVtbl AssemblyEnumVtbl
static
Initial value:
= {
}
static HRESULT WINAPI IAssemblyEnumImpl_Reset(IAssemblyEnum *iface)
Definition: asmenum.c:145
static ULONG WINAPI IAssemblyEnumImpl_AddRef(IAssemblyEnum *iface)
Definition: asmenum.c:85
static ULONG WINAPI IAssemblyEnumImpl_Release(IAssemblyEnum *iface)
Definition: asmenum.c:95
static HRESULT WINAPI IAssemblyEnumImpl_QueryInterface(IAssemblyEnum *iface, REFIID riid, LPVOID *ppobj)
Definition: asmenum.c:64
static HRESULT WINAPI IAssemblyEnumImpl_Clone(IAssemblyEnum *iface, IAssemblyEnum **ppEnum)
Definition: asmenum.c:155
static HRESULT WINAPI IAssemblyEnumImpl_GetNextAssembly(IAssemblyEnum *iface, LPVOID pvReserved, IAssemblyName **ppName, DWORD dwFlags)
Definition: asmenum.c:120

Definition at line 162 of file asmenum.c.

Referenced by CreateAssemblyEnum().