ReactOS 0.4.17-dev-966-gf06eace
asmenum.c File Reference
#include <stdio.h>
#include <windows.h>
#include <shlwapi.h>
#include <mscoree.h>
#include <fusion.h>
#include <corerror.h>
#include "wine/test.h"
#include "wine/list.h"
Include dependency graph for asmenum.c:

Go to the source code of this file.

Classes

struct  _tagASMNAME
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct _tagASMNAME ASMNAME
 

Functions

static HRESULT (WINAPI *pCreateAssemblyEnum)(IAssemblyEnum **pEnum
 
static BOOL init_functionpointers (void)
 
static void to_widechar (LPWSTR dest, LPCSTR src)
 
static void to_multibyte (LPSTR dest, LPWSTR src)
 
static BOOL create_full_path (LPCSTR path)
 
static BOOL create_file_data (LPCSTR name, LPCSTR data, DWORD size)
 
static void test_CreateAssemblyEnum (void)
 
static void enum_gac_assembly_dirs (struct list *assemblies, const char *parent, char path[MAX_PATH])
 
static void enum_gac_assemblies (struct list *assemblies, char path[MAX_PATH])
 
static void test_enumerate (void)
 
static void test_enumerate_name (void)
 
 START_TEST (asmenum)
 

Variables

static IUnknown * pUnkReserved
 
static IUnknown IAssemblyName * pName
 
static IUnknown IAssemblyName DWORD dwFlags
 
static IUnknown IAssemblyName DWORD LPVOID pvReserved
 
static LPCWSTR szAssemblyName
 
static LPWSTR pwzCachePath
 
static LPWSTR PDWORD pcchPath
 
static LPCWSTR szVersion
 
static LPCWSTR LPVOID HMODULE * phModDll
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file asmenum.c.

Typedef Documentation

◆ ASMNAME

Function Documentation

◆ create_file_data()

static BOOL create_file_data ( LPCSTR  name,
LPCSTR  data,
DWORD  size 
)
static

Definition at line 148 of file asmenum.c.

149{
150 HANDLE file;
151 DWORD written;
152
155 return FALSE;
156
157 WriteFile(file, data, strlen(data), &written, NULL);
158
159 if (size)
160 {
163 }
164
166 return TRUE;
167}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define FILE_BEGIN
Definition: compat.h:761
#define SetFilePointer
Definition: compat.h:743
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:989
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: fci.c:123
Definition: name.c:39

Referenced by test_enumerate_name().

◆ create_full_path()

static BOOL create_full_path ( LPCSTR  path)
static

Definition at line 98 of file asmenum.c.

99{
100 LPSTR new_path;
101 BOOL ret = TRUE;
102 int len;
103
104 new_path = HeapAlloc(GetProcessHeap(), 0, lstrlenA(path) + 1);
105 if (!new_path)
106 return FALSE;
107
108 lstrcpyA(new_path, path);
109
110 while ((len = lstrlenA(new_path)) && new_path[len - 1] == '\\')
111 new_path[len - 1] = 0;
112
113 while (!CreateDirectoryA(new_path, NULL))
114 {
115 LPSTR slash;
117
119 break;
120
122 {
123 ret = FALSE;
124 break;
125 }
126
127 if(!(slash = strrchr(new_path, '\\')))
128 {
129 ret = FALSE;
130 break;
131 }
132
133 len = slash - new_path;
134 new_path[len] = 0;
135 if(!create_full_path(new_path))
136 {
137 ret = FALSE;
138 break;
139 }
140
141 new_path[len] = '\\';
142 }
143
144 HeapFree(GetProcessHeap(), 0, new_path);
145 return ret;
146}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
_ACRTIMP char *__cdecl strrchr(const char *, int)
Definition: string.c:3303
return ret
Definition: mutex.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLsizei len
Definition: glext.h:6722
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
static BOOL create_full_path(LPCSTR path)
Definition: asmenum.c:98
char * LPSTR
Definition: typedefs.h:51
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:228

Referenced by create_full_path(), and test_enumerate_name().

◆ enum_gac_assemblies()

static void enum_gac_assemblies ( struct list *  assemblies,
char  path[MAX_PATH] 
)
static

Definition at line 273 of file asmenum.c.

274{
276 HANDLE hfind;
277 char *end = path + strlen( path );
278
279 lstrcpynA( end, "\\*", path + MAX_PATH - end );
280 hfind = FindFirstFileA(path, &ffd);
281 if (hfind == INVALID_HANDLE_VALUE) return;
282 end++;
283
284 do
285 {
286 if (!strcmp(ffd.cFileName, ".") || !strcmp(ffd.cFileName, "..")) continue;
287 lstrcpynA( end, ffd.cFileName, path + MAX_PATH - end );
288 enum_gac_assembly_dirs( assemblies, ffd.cFileName, path );
289 } while (FindNextFileA(hfind, &ffd) != 0);
290
291 FindClose(hfind);
292}
#define lstrcpynA
Definition: compat.h:751
#define MAX_PATH
Definition: compat.h:34
HANDLE WINAPI FindFirstFileA(IN LPCSTR lpFileName, OUT LPWIN32_FIND_DATAA lpFindFileData)
Definition: find.c:263
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileA(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAA lpFindFileData)
Definition: find.c:336
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
GLuint GLuint end
Definition: gl.h:1545
static void enum_gac_assembly_dirs(struct list *assemblies, const char *parent, char path[MAX_PATH])
Definition: asmenum.c:221

◆ enum_gac_assembly_dirs()

static void enum_gac_assembly_dirs ( struct list *  assemblies,
const char *  parent,
char  path[MAX_PATH] 
)
static

Definition at line 221 of file asmenum.c.

222{
223 static const char format[] = "%s, Version=%s, Culture=%s, PublicKeyToken=%s";
225 ASMNAME *name;
226 HANDLE hfind;
227 int len;
228 char *ptr, *end = path + strlen( path );
229
230 lstrcpynA( end, "\\*", path + MAX_PATH - end );
231 hfind = FindFirstFileA(path, &ffd);
232 if (hfind == INVALID_HANDLE_VALUE) return;
233 end++;
234
235 do
236 {
237 char culture[MAX_PATH];
238
239 if (!strcmp(ffd.cFileName, ".") || !strcmp(ffd.cFileName, "..")) continue;
240
241 *end = 0;
242 /* Directories with no dll or exe will not be enumerated */
243 sprintf(end, "%s\\%s.dll", ffd.cFileName, parent);
245 {
246 sprintf(end, "%s\\%s.exe", ffd.cFileName, parent);
248 }
249
250 if (!(ptr = strchr(ffd.cFileName, '_'))) continue;
251 *ptr++ = 0;
252
253 if (*ptr != '_')
254 {
256 *strchr(culture, '_') = 0;
257 }
258 else
259 lstrcpyA(culture, "neutral");
260
261 ptr = strchr(ptr, '_');
262 ptr++;
263 len = sizeof(format) + strlen(parent) + strlen(ffd.cFileName) + strlen(culture) + strlen(ptr);
264
266 sprintf( name->data, format, parent, ffd.cFileName, culture, ptr);
267 list_add_tail(assemblies, &name->entry);
268 } while (FindNextFileA(hfind, &ffd) != 0);
269
270 FindClose(hfind);
271}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static const WCHAR culture[]
Definition: asmname.c:67
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:620
_ACRTIMP char *__cdecl strchr(const char *, int)
Definition: string.c:3291
r parent
Definition: btrfs.c:3010
static PVOID ptr
Definition: dispmode.c:27
#define sprintf
Definition: sprintf.c:45
#define offsetof(TYPE, MEMBER)
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

Referenced by enum_gac_assemblies().

◆ HRESULT()

static HRESULT ( WINAPI *  pCreateAssemblyEnum)
static

◆ init_functionpointers()

static BOOL init_functionpointers ( void  )
static

Definition at line 44 of file asmenum.c.

45{
46 HRESULT hr;
47 HMODULE hfusion;
49
50 hmscoree = LoadLibraryA("mscoree.dll");
51 if (!hmscoree)
52 {
53 win_skip("mscoree.dll not available\n");
54 return FALSE;
55 }
56
57 pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim");
58 if (!pLoadLibraryShim)
59 {
60 win_skip("LoadLibraryShim not available\n");
62 return FALSE;
63 }
64
65 hr = pLoadLibraryShim(L"fusion.dll", NULL, NULL, &hfusion);
66 if (FAILED(hr))
67 {
68 win_skip("fusion.dll not available\n");
70 return FALSE;
71 }
72
73 pCreateAssemblyEnum = (void *)GetProcAddress(hfusion, "CreateAssemblyEnum");
74 pCreateAssemblyNameObject = (void *)GetProcAddress(hfusion, "CreateAssemblyNameObject");
75 pGetCachePath = (void *)GetProcAddress(hfusion, "GetCachePath");
76
77 if (!pCreateAssemblyEnum ||
78 !pCreateAssemblyNameObject || !pGetCachePath)
79 {
80 win_skip("fusion.dll not implemented\n");
81 return FALSE;
82 }
83
85 return TRUE;
86}
HRESULT hr
Definition: delayimp.cpp:582
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define L(x)
Definition: resources.c:13
#define FAILED(hr)
Definition: intsafe.h:51
#define win_skip
Definition: minitest.h:67
static HMODULE hmscoree
Definition: fusion.c:24

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( asmenum  )

Definition at line 680 of file asmenum.c.

681{
683 return;
684
688}
static BOOL init_functionpointers(void)
Definition: asmenum.c:44
static void test_enumerate(void)
Definition: asmenum.c:294
static void test_CreateAssemblyEnum(void)
Definition: asmenum.c:169
static void test_enumerate_name(void)
Definition: asmenum.c:376

◆ test_CreateAssemblyEnum()

static void test_CreateAssemblyEnum ( void  )
static

Definition at line 169 of file asmenum.c.

170{
171 HRESULT hr;
172 WCHAR namestr[MAX_PATH];
173 IAssemblyEnum *asmenum;
174 IAssemblyName *asmname;
175
176 to_widechar(namestr, "wine");
177 asmname = NULL;
178 hr = pCreateAssemblyNameObject(&asmname, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
179 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
180 ok(asmname != NULL, "Expected non-NULL asmname\n");
181
182 /* pEnum is NULL */
183 if (0)
184 {
185 /* Crashes on .NET 1.x */
186 hr = pCreateAssemblyEnum(NULL, NULL, asmname, ASM_CACHE_GAC, NULL);
187 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
188 }
189
190 /* pName is NULL */
191 asmenum = NULL;
192 hr = pCreateAssemblyEnum(&asmenum, NULL, NULL, ASM_CACHE_GAC, NULL);
193 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
194 ok(asmenum != NULL, "Expected non-NULL asmenum\n");
195
196 IAssemblyEnum_Release(asmenum);
197
198 /* dwFlags is ASM_CACHE_ROOT */
199 asmenum = (IAssemblyEnum *)0xdeadbeef;
200 hr = pCreateAssemblyEnum(&asmenum, NULL, NULL, ASM_CACHE_ROOT, NULL);
201 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
202 ok(asmenum == (IAssemblyEnum *)0xdeadbeef,
203 "Expected asmenum to be unchanged, got %p\n", asmenum);
204
205 /* invalid dwFlags */
206 asmenum = (IAssemblyEnum *)0xdeadbeef;
207 hr = pCreateAssemblyEnum(&asmenum, NULL, NULL, 0, NULL);
208 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
209 ok(asmenum == (IAssemblyEnum *)0xdeadbeef,
210 "Expected asmenum to be unchanged, got %p\n", asmenum);
211
212 IAssemblyName_Release(asmname);
213}
#define ok(value,...)
Definition: atltest.h:57
#define E_INVALIDARG
Definition: ddrawi.h:101
@ ASM_CACHE_ROOT
Definition: fusion.idl:31
@ ASM_CACHE_GAC
Definition: fusion.idl:29
#define S_OK
Definition: intsafe.h:52
static void to_widechar(LPWSTR dest, LPCSTR src)
Definition: asmenum.c:88
short WCHAR
Definition: pedump.c:58
@ CANOF_PARSE_DISPLAY_NAME
Definition: winsxs.idl:193

Referenced by START_TEST().

◆ test_enumerate()

static void test_enumerate ( void  )
static

Definition at line 294 of file asmenum.c.

295{
296 struct list assemblies = LIST_INIT(assemblies);
297 struct list *item, *cursor;
298 IAssemblyEnum *asmenum;
302 CHAR disp[MAX_PATH];
303 HRESULT hr;
304 BOOL found;
305 DWORD size;
306
307 size = MAX_PATH;
308 hr = pGetCachePath(ASM_CACHE_GAC, buf, &size);
309 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
310
312 lstrcatA(path, "_32");
313 enum_gac_assemblies(&assemblies, path);
314
316 lstrcatA(path, "_64");
317 enum_gac_assemblies(&assemblies, path);
318
320 lstrcatA(path, "_MSIL");
321 enum_gac_assemblies(&assemblies, path);
322
324 enum_gac_assemblies(&assemblies, path);
325
326 asmenum = NULL;
327 hr = pCreateAssemblyEnum(&asmenum, NULL, NULL, ASM_CACHE_GAC, NULL);
328 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
329 ok(asmenum != NULL, "Expected non-NULL asmenum\n");
330
331 while (IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0) == S_OK)
332 {
333 size = MAX_PATH;
334 IAssemblyName_GetDisplayName(next, buf, &size, 0);
335 to_multibyte(disp, buf);
336
337 found = FALSE;
338 LIST_FOR_EACH_SAFE(item, cursor, &assemblies)
339 {
340 ASMNAME *asmname = LIST_ENTRY(item, ASMNAME, entry);
341
342 if (!lstrcmpA(asmname->data, disp))
343 {
344 found = TRUE;
345
346 list_remove(&asmname->entry);
347 HeapFree(GetProcessHeap(), 0, asmname);
348 break;
349 }
350 }
351
352 ok(found, "Extra assembly enumerated: %s\n", disp);
353 IAssemblyName_Release(next);
354 }
355
356 /* enumeration is exhausted */
357 next = (IAssemblyName *)0xdeadbeef;
358 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
359 ok(hr == S_FALSE, "Expected S_FALSE, got %08lx\n", hr);
360 ok(next == (IAssemblyName *)0xdeadbeef,
361 "Expected next to be unchanged, got %p\n", next);
362
363 LIST_FOR_EACH_SAFE(item, cursor, &assemblies)
364 {
365 ASMNAME *asmname = LIST_ENTRY(item, ASMNAME, entry);
366
367 ok(FALSE, "Assembly not enumerated: %s\n", asmname->data);
368
369 list_remove(&asmname->entry);
370 HeapFree(GetProcessHeap(), 0, asmname);
371 }
372
373 IAssemblyEnum_Release(asmenum);
374}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
Definition: list.h:39
static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, int depth, const WCHAR *prefix, LPWSTR path)
Definition: asmenum.c:305
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4104
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
const char cursor[]
Definition: icontest.c:13
uint32_t entry
Definition: isohybrid.c:63
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
static void to_multibyte(LPSTR dest, LPWSTR src)
Definition: asmenum.c:93
char CHAR
Definition: pedump.c:57
static unsigned __int64 next
Definition: rand_nt.c:6
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:230
struct list entry
Definition: asmenum.c:46
char data[1]
Definition: asmenum.c:218
#define LIST_INIT(head)
Definition: queue.h:197
#define LIST_ENTRY(type)
Definition: queue.h:175
#define S_FALSE
Definition: winerror.h:3451

Referenced by START_TEST().

◆ test_enumerate_name()

static void test_enumerate_name ( void  )
static

Definition at line 376 of file asmenum.c.

377{
378 IAssemblyEnum *asmenum;
379 IAssemblyName *asmname, *next;
381 CHAR gac[MAX_PATH];
382 CHAR path[MAX_PATH + 40];
383 CHAR disp[MAX_PATH];
384 WCHAR namestr[MAX_PATH];
385 CHAR exp[6][MAX_PATH];
386 HRESULT hr;
387 DWORD size;
388
389 lstrcpyA(exp[0], "wine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=16a3fcd171e93a8d");
390 lstrcpyA(exp[1], "wine, Version=1.0.1.2, Culture=neutral, PublicKeyToken=123456789abcdef0");
391 lstrcpyA(exp[2], "wine, Version=1.0.1.2, Culture=neutral, PublicKeyToken=16a3fcd171e93a8d");
392 lstrcpyA(exp[3], "Wine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=16a3fcd171e93a8d");
393 lstrcpyA(exp[4], "Wine, Version=1.0.1.2, Culture=neutral, PublicKeyToken=123456789abcdef0");
394 lstrcpyA(exp[5], "Wine, Version=1.0.1.2, Culture=neutral, PublicKeyToken=16a3fcd171e93a8d");
395
396 size = MAX_PATH;
397 hr = pGetCachePath(ASM_CACHE_GAC, buf, &size);
398 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
399
400 to_multibyte(gac, buf);
401 create_full_path(gac);
402
403 sprintf(path, "%s\\Wine", gac);
405
406 sprintf(path, "%s\\Wine\\1.0.0.0__16a3fcd171e93a8d", gac);
408
409 lstrcatA(path, "\\Wine.dll");
410 if (!create_file_data(path, path, 100))
411 {
412 win_skip("Failed to open file %s, skipping name enumeration tests\n", path);
413 goto done;
414 }
415
416 sprintf(path, "%s\\Wine\\1.0.1.2__16a3fcd171e93a8d", gac);
418
419 lstrcatA(path, "\\Wine.dll");
420 if (!create_file_data(path, path, 100))
421 {
422 win_skip("Failed to open file %s, skipping name enumeration tests\n", path);
423 goto done;
424 }
425
426 sprintf(path, "%s\\Wine\\1.0.1.2__123456789abcdef0", gac);
428
429 lstrcatA(path, "\\Wine.dll");
430 if (!create_file_data(path, path, 100))
431 {
432 win_skip("Failed to open file %s, skipping name enumeration tests\n", path);
433 goto done;
434 }
435
436 /* test case sensitivity */
437 to_widechar(namestr, "wine");
438 asmname = NULL;
439 hr = pCreateAssemblyNameObject(&asmname, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
440 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
441 ok(asmname != NULL, "Expected non-NULL asmname\n");
442
443 asmenum = NULL;
444 hr = pCreateAssemblyEnum(&asmenum, NULL, asmname, ASM_CACHE_GAC, NULL);
445 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
446 ok(asmenum != NULL, "Expected non-NULL asmenum\n");
447
448 next = NULL;
449 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
450 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
451 ok(next != NULL, "Expected non-NULL next\n");
452
453 size = MAX_PATH;
454 hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
455 to_multibyte(disp, buf);
456 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
457 ok(!lstrcmpA(disp, exp[0]),
458 "Expected \"%s\" or \"%s\", got \"%s\"\n", exp[0], exp[1], disp);
459
460 IAssemblyName_Release(next);
461
462 next = NULL;
463 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
464 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
465 ok(next != NULL, "Expected non-NULL next\n");
466
467 size = MAX_PATH;
468 hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
469 to_multibyte(disp, buf);
470 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
471 ok(!lstrcmpA(disp, exp[1]) ||
472 !lstrcmpA(disp, exp[2]), /* Win98 */
473 "Expected \"%s\" or \"%s\", got \"%s\"\n", exp[1], exp[2], disp);
474
475 IAssemblyName_Release(next);
476
477 next = NULL;
478 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
479 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
480 ok(next != NULL, "Expected non-NULL next\n");
481
482 size = MAX_PATH;
483 hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
484 to_multibyte(disp, buf);
485 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
486 ok(!lstrcmpA(disp, exp[2]) ||
487 !lstrcmpA(disp, exp[1]), /* Win98 */
488 "Expected \"%s\" or \"%s\", got \"%s\"\n", exp[2], exp[1], disp);
489
490 IAssemblyName_Release(next);
491
492 next = (IAssemblyName *)0xdeadbeef;
493 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
494 ok(hr == S_FALSE, "Expected S_FALSE, got %08lx\n", hr);
495 ok(next == (IAssemblyName *)0xdeadbeef,
496 "Expected next to be unchanged, got %p\n", next);
497
498 IAssemblyEnum_Release(asmenum);
499 IAssemblyName_Release(asmname);
500
501 /* only Version */
502 to_widechar(namestr, "Wine, Version=1.0.1.2");
503 asmname = NULL;
504 hr = pCreateAssemblyNameObject(&asmname, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
505 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
506 ok(asmname != NULL, "Expected non-NULL asmname\n");
507
508 asmenum = NULL;
509 hr = pCreateAssemblyEnum(&asmenum, NULL, asmname, ASM_CACHE_GAC, NULL);
510 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
511 ok(asmenum != NULL, "Expected non-NULL asmenum\n");
512
513 next = NULL;
514 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
515 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
516 ok(next != NULL, "Expected non-NULL next\n");
517
518 size = MAX_PATH;
519 hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
520 to_multibyte(disp, buf);
521 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
522 ok(!lstrcmpA(disp, exp[4]) ||
523 !lstrcmpA(disp, exp[5]), /* Win98 */
524 "Expected \"%s\" or \"%s\", got \"%s\"\n", exp[4], exp[5], disp);
525
526 IAssemblyName_Release(next);
527
528 next = NULL;
529 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
530 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
531 ok(next != NULL, "Expected non-NULL next\n");
532
533 size = MAX_PATH;
534 hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
535 to_multibyte(disp, buf);
536 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
537 ok(!lstrcmpA(disp, exp[5]) ||
538 !lstrcmpA(disp, exp[4]), /* Win98 */
539 "Expected \"%s\" or \"%s\", got \"%s\"\n", exp[5], exp[4], disp);
540
541 IAssemblyName_Release(next);
542
543 next = (IAssemblyName *)0xdeadbeef;
544 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
545 ok(hr == S_FALSE, "Expected S_FALSE, got %08lx\n", hr);
546 ok(next == (IAssemblyName *)0xdeadbeef,
547 "Expected next to be unchanged, got %p\n", next);
548
549 IAssemblyEnum_Release(asmenum);
550 IAssemblyName_Release(asmname);
551
552 /* only PublicKeyToken */
553 to_widechar(namestr, "Wine, PublicKeyToken=16a3fcd171e93a8d");
554 asmname = NULL;
555 hr = pCreateAssemblyNameObject(&asmname, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
556 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
557 ok(asmname != NULL, "Expected non-NULL asmname\n");
558
559 asmenum = NULL;
560 hr = pCreateAssemblyEnum(&asmenum, NULL, asmname, ASM_CACHE_GAC, NULL);
561 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
562 ok(asmenum != NULL, "Expected non-NULL asmenum\n");
563
564 next = NULL;
565 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
566 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
567 ok(next != NULL, "Expected non-NULL next\n");
568
569 size = MAX_PATH;
570 hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
571 to_multibyte(disp, buf);
572 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
573 ok(!lstrcmpA(disp, exp[3]), "Expected \"%s\", got \"%s\"\n", exp[3], disp);
574
575 IAssemblyName_Release(next);
576
577 next = NULL;
578 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
579 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
580 ok(next != NULL, "Expected non-NULL next\n");
581
582 size = MAX_PATH;
583 hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
584 to_multibyte(disp, buf);
585 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
586 ok(!lstrcmpA(disp, exp[5]), "Expected \"%s\", got \"%s\"\n", exp[5], disp);
587
588 IAssemblyName_Release(next);
589
590 next = (IAssemblyName *)0xdeadbeef;
591 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
592 ok(hr == S_FALSE, "Expected S_FALSE, got %08lx\n", hr);
593 ok(next == (IAssemblyName *)0xdeadbeef,
594 "Expected next to be unchanged, got %p\n", next);
595
596 IAssemblyEnum_Release(asmenum);
597 IAssemblyName_Release(asmname);
598
599 /* only Culture */
600 to_widechar(namestr, "wine, Culture=neutral");
601 asmname = NULL;
602 hr = pCreateAssemblyNameObject(&asmname, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
603 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
604 ok(asmname != NULL, "Expected non-NULL asmname\n");
605
606 asmenum = NULL;
607 hr = pCreateAssemblyEnum(&asmenum, NULL, asmname, ASM_CACHE_GAC, NULL);
608 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
609 ok(asmenum != NULL, "Expected non-NULL asmenum\n");
610
611 next = NULL;
612 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
613 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
614 ok(next != NULL, "Expected non-NULL next\n");
615
616 size = MAX_PATH;
617 hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
618 to_multibyte(disp, buf);
619 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
620 ok(!lstrcmpA(disp, exp[0]), "Expected \"%s\", got \"%s\"\n", exp[0], disp);
621
622 IAssemblyName_Release(next);
623
624 next = NULL;
625 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
626 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
627 ok(next != NULL, "Expected non-NULL next\n");
628
629 size = MAX_PATH;
630 hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
631 to_multibyte(disp, buf);
632 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
633 ok(!lstrcmpA(disp, exp[1]) ||
634 !lstrcmpA(disp, exp[2]), /* Win98 */
635 "Expected \"%s\" or \"%s\", got \"%s\"\n", exp[1], exp[2], disp);
636
637 IAssemblyName_Release(next);
638
639 next = NULL;
640 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
641 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
642 ok(next != NULL, "Expected non-NULL next\n");
643
644 size = MAX_PATH;
645 hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
646 to_multibyte(disp, buf);
647 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
648 ok(!lstrcmpA(disp, exp[2]) ||
649 !lstrcmpA(disp, exp[1]), /* Win98 */
650 "Expected \"%s\" or \"%s\", got \"%s\"\n", exp[2], exp[1], disp);
651
652 IAssemblyName_Release(next);
653
654 next = (IAssemblyName *)0xdeadbeef;
655 hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
656 ok(hr == S_FALSE, "Expected S_FALSE, got %08lx\n", hr);
657 ok(next == (IAssemblyName *)0xdeadbeef,
658 "Expected next to be unchanged, got %p\n", next);
659
660 IAssemblyEnum_Release(asmenum);
661 IAssemblyName_Release(asmname);
662
663done:
664 sprintf(path, "%s\\Wine\\1.0.0.0__16a3fcd171e93a8d\\Wine.dll", gac);
666 sprintf(path, "%s\\Wine\\1.0.1.2__16a3fcd171e93a8d\\Wine.dll", gac);
668 sprintf(path, "%s\\Wine\\1.0.1.2__123456789abcdef0\\Wine.dll", gac);
670 sprintf(path, "%s\\Wine\\1.0.0.0__16a3fcd171e93a8d", gac);
672 sprintf(path, "%s\\Wine\\1.0.1.2__16a3fcd171e93a8d", gac);
674 sprintf(path, "%s\\Wine\\1.0.1.2__123456789abcdef0", gac);
676 sprintf(path, "%s\\Wine", gac);
678}
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:682
static BOOL create_file_data(LPCSTR name, LPCSTR data, DWORD size)
Definition: asmenum.c:148
DWORD exp
Definition: msg.c:18625

Referenced by START_TEST().

◆ to_multibyte()

static void to_multibyte ( LPSTR  dest,
LPWSTR  src 
)
inlinestatic

Definition at line 93 of file asmenum.c.

94{
96}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
GLenum src
Definition: glext.h:6340
static char * dest
Definition: rtl.c:149

Referenced by test_enumerate(), and test_enumerate_name().

◆ to_widechar()

static void to_widechar ( LPWSTR  dest,
LPCSTR  src 
)
inlinestatic

Definition at line 88 of file asmenum.c.

89{
91}
#define MultiByteToWideChar
Definition: compat.h:110

Referenced by test_CreateAssemblyEnum(), and test_enumerate_name().

Variable Documentation

◆ dwFlags

Definition at line 35 of file asmenum.c.

◆ pcchPath

LPWSTR PDWORD pcchPath

Definition at line 40 of file asmenum.c.

◆ phModDll

LPCWSTR LPVOID HMODULE* phModDll

Definition at line 42 of file asmenum.c.

◆ pName

Definition at line 34 of file asmenum.c.

◆ pUnkReserved

◆ pvReserved

LPCWSTR LPVOID pvReserved

Definition at line 35 of file asmenum.c.

◆ pwzCachePath

LPWSTR pwzCachePath

Definition at line 40 of file asmenum.c.

◆ szAssemblyName

◆ szVersion

LPCWSTR szVersion

Definition at line 41 of file asmenum.c.