Merge from amd64-branch:
[reactos.git] / rostests / winetests / fusion / asmcache.c
1 /*
2 * Copyright 2008 James Hawkins
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 #define COBJMACROS
20 #define INITGUID
21
22 #include <stdio.h>
23
24 #include <windows.h>
25 #include <mscoree.h>
26 #include <fusion.h>
27 #include <corerror.h>
28
29 #include "wine/test.h"
30
31 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
32 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
33 #define CLDB_E_FILE_OLDVER EMAKEHR(0x1107)
34
35 typedef struct _tagASSEMBLY ASSEMBLY;
36
37 typedef struct
38 {
39 ULONG Signature;
40 USHORT MajorVersion;
41 USHORT MinorVersion;
42 ULONG Reserved;
43 ULONG VersionLength;
44 BYTE Version[12];
45 BYTE Flags;
46 WORD Streams;
47 } METADATAHDR;
48
49 #include <pshpack1.h>
50
51 typedef struct
52 {
53 DWORD Offset;
54 DWORD Size;
55 } METADATASTREAMHDR;
56
57 typedef struct
58 {
59 DWORD Reserved1;
60 BYTE MajorVersion;
61 BYTE MinorVersion;
62 BYTE HeapOffsetSizes;
63 BYTE Reserved2;
64 LARGE_INTEGER MaskValid;
65 LARGE_INTEGER MaskSorted;
66 } METADATATABLESHDR;
67
68 typedef struct
69 {
70 WORD Generation;
71 WORD Name;
72 WORD Mvid;
73 WORD EncId;
74 WORD EncBaseId;
75 } MODULETABLE;
76
77 typedef struct
78 {
79 DWORD Flags;
80 WORD Name;
81 WORD Namespace;
82 WORD Extends;
83 WORD FieldList;
84 WORD MethodList;
85 } TYPEDEFTABLE;
86
87 typedef struct
88 {
89 DWORD HashAlgId;
90 WORD MajorVersion;
91 WORD MinorVersion;
92 WORD BuildNumber;
93 WORD RevisionNumber;
94 DWORD Flags;
95 WORD PublicKey;
96 WORD Name;
97 WORD Culture;
98 } ASSEMBLYTABLE;
99
100 typedef struct
101 {
102 DWORD Offset;
103 DWORD Flags;
104 WORD Name;
105 WORD Implementation;
106 } MANIFESTRESTABLE;
107
108 typedef struct
109 {
110 DWORD ImportLookupTable;
111 DWORD DateTimeStamp;
112 DWORD ForwarderChain;
113 DWORD Name;
114 DWORD ImportAddressTable;
115 BYTE pad[20];
116 } IMPORTTABLE;
117
118 typedef struct
119 {
120 DWORD HintNameTableRVA;
121 BYTE pad[8];
122 } IMPORTLOOKUPTABLE;
123
124 typedef struct
125 {
126 WORD Hint;
127 BYTE Name[12];
128 BYTE Module[12];
129 DWORD Reserved;
130 WORD EntryPoint;
131 DWORD RVA;
132 } HINTNAMETABLE;
133
134 typedef struct
135 {
136 DWORD PageRVA;
137 DWORD Size;
138 DWORD Relocation;
139 } RELOCATION;
140
141 typedef struct
142 {
143 WORD wLength;
144 WORD wValueLength;
145 WORD wType;
146 WCHAR szKey[17];
147 VS_FIXEDFILEINFO Value;
148 } VS_VERSIONINFO;
149
150 typedef struct
151 {
152 WORD wLength;
153 WORD wValueLength;
154 WORD wType;
155 WCHAR szKey[13];
156 } VARFILEINFO;
157
158 typedef struct
159 {
160 WORD wLength;
161 WORD wValueLength;
162 WORD wType;
163 WCHAR szKey[13];
164 DWORD Value;
165 } VAR;
166
167 typedef struct
168 {
169 WORD wLength;
170 WORD wValueLength;
171 WORD wType;
172 WCHAR szKey[15];
173 } STRINGFILEINFO;
174
175 typedef struct
176 {
177 WORD wLength;
178 WORD wValueLength;
179 WORD wType;
180 WCHAR szKey[9];
181 } STRINGTABLE;
182
183 typedef struct
184 {
185 WORD wLength;
186 WORD wValueLength;
187 WORD wType;
188 } STRINGHDR;
189
190 typedef struct
191 {
192 DWORD Size;
193 DWORD Signature;
194 DWORD HeaderVersion;
195 DWORD SkipBytes;
196 BYTE Data[168];
197 } RESOURCE;
198
199 #include <poppack.h>
200
201 static struct _tagASSEMBLY
202 {
203 IMAGE_DOS_HEADER doshdr;
204 WORD unknown[32];
205 IMAGE_NT_HEADERS32 nthdrs;
206 IMAGE_SECTION_HEADER text;
207 IMAGE_SECTION_HEADER rsrc;
208 IMAGE_SECTION_HEADER reloc;
209 BYTE pad[16];
210 IMAGE_IMPORT_BY_NAME iat;
211 BYTE pad2[3];
212 IMAGE_COR20_HEADER clrhdr;
213 WORD strongname[64];
214 RESOURCE resource;
215 METADATAHDR metadatahdr;
216 METADATASTREAMHDR roothdr;
217 BYTE rootname[4];
218 METADATASTREAMHDR stringshdr;
219 BYTE stringsname[12];
220 METADATASTREAMHDR ushdr;
221 BYTE usname[4];
222 METADATASTREAMHDR guidhdr;
223 BYTE guidname[8];
224 METADATASTREAMHDR blobhdr;
225 BYTE blobname[8];
226 METADATATABLESHDR tableshdr;
227 DWORD numrows[4];
228 MODULETABLE modtable;
229 TYPEDEFTABLE tdtable;
230 ASSEMBLYTABLE asmtable;
231 MANIFESTRESTABLE manifestrestable;
232 WORD pad3;
233 BYTE stringheap[40];
234 WORD usheap[4];
235 WORD guidheap[8];
236 WORD blobheap[82];
237 IMAGE_IMPORT_DESCRIPTOR importdesc;
238 BYTE pad4[20];
239 IMPORTLOOKUPTABLE importlookup;
240 HINTNAMETABLE hintnametable;
241 BYTE pad5[108];
242 IMAGE_RESOURCE_DIRECTORY topresdir;
243 IMAGE_RESOURCE_DIRECTORY_ENTRY labelres;
244 IMAGE_RESOURCE_DIRECTORY res11dir;
245 IMAGE_RESOURCE_DIRECTORY_ENTRY label11res;
246 IMAGE_RESOURCE_DIRECTORY res10dir;
247 IMAGE_RESOURCE_DIRECTORY_ENTRY label10res;
248 IMAGE_RESOURCE_DATA_ENTRY resdata;
249 VS_VERSIONINFO verinfo;
250 VARFILEINFO varfileinfo;
251 VAR translation;
252 STRINGFILEINFO strfileinfo;
253 STRINGTABLE strtable;
254 STRINGHDR filedeschdr;
255 WCHAR filedesckey[17];
256 WCHAR filedescval[2];
257 STRINGHDR fileverhdr;
258 WCHAR fileverkey[13];
259 WCHAR fileverval[8];
260 STRINGHDR intnamehdr;
261 WCHAR intnamekey[13];
262 WCHAR intnameval[10];
263 STRINGHDR copyrighthdr;
264 WCHAR copyrightkey[15];
265 WCHAR copyrightval[2];
266 STRINGHDR orignamehdr;
267 WCHAR orignamekey[17];
268 WCHAR orignameval[10];
269 STRINGHDR prodverhdr;
270 WCHAR prodverkey[15];
271 WCHAR prodverval[8];
272 STRINGHDR asmverhdr;
273 WCHAR asmverkey[17];
274 WCHAR asmverval[8];
275 WORD pad6[182];
276 RELOCATION relocation;
277 WORD pad7[250];
278 } assembly =
279 {
280 /* IMAGE_DOS_HEADER */
281 {
282 IMAGE_DOS_SIGNATURE, 144, 3, 0, 4, 0, 0xFFFF, 0, 0xB8, 0, 0, 0, 0x40,
283 0, { 0 }, 0, 0, { 0 }, 0x80
284 },
285 /* binary to print "This program cannot be run in DOS mode." */
286 {
287 0x1F0E, 0x0EBA, 0xB400, 0xCD09, 0xB821, 0x4C01, 0x21CD, 0x6854, 0x7369,
288 0x7020, 0x6F72, 0x7267, 0x6D61, 0x6320, 0x6E61, 0x6F6E, 0x2074, 0x6562,
289 0x7220, 0x6E75, 0x6920, 0x206E, 0x4F44, 0x2053, 0x6F6D, 0x6564, 0x0D2E,
290 0x0A0D, 0x0024, 0x0000, 0x0000, 0x0000
291 },
292 /* IMAGE_NT_HEADERS32 */
293 {
294 IMAGE_NT_SIGNATURE, /* Signature */
295 /* IMAGE_FILE_HEADER */
296 {
297 IMAGE_FILE_MACHINE_I386, /* Machine */
298 3, /* NumberOfSections */
299 0x47EFDF09, /* TimeDateStamp */
300 0, /* PointerToSymbolTable */
301 0, /* NumberOfSymbols */
302 0xE0, /* SizeOfOptionalHeader */
303 IMAGE_FILE_32BIT_MACHINE | IMAGE_FILE_LOCAL_SYMS_STRIPPED |
304 IMAGE_FILE_LINE_NUMS_STRIPPED | IMAGE_FILE_EXECUTABLE_IMAGE |
305 IMAGE_FILE_DLL, /* Characteristics */
306 },
307 /* IMAGE_OPTIONAL_HEADER32 */
308 {
309 IMAGE_NT_OPTIONAL_HDR32_MAGIC, /* Magic */
310 8, /* MajorLinkerVersion */
311 0, /* MinorLinkerVersion */
312 0x400, /* SizeOfCode */
313 0x600, /* SizeOfInitializedData */
314 0, /* SizeOfUninitializedData */
315 0x238E, /* AddressOfEntryPoint */
316 0x2000, /* BaseOfCode */
317 0x4000, /* BaseOfData */
318 0x400000, /* ImageBase */
319 0x2000, /* SectionAlignment */
320 0x200, /* FileAlignment */
321 4, /* MajorOperatingSystemVersion */
322 0, /* MinorOperatingSystemVersion */
323 0, /* MajorImageVersion */
324 0, /* MinorImageVersion */
325 4, /* MajorSubsystemVersion */
326 0, /* MinorSubsystemVersion */
327 0, /* Win32VersionValue */
328 0x8000, /* SizeOfImage */
329 0x200, /* SizeOfHeaders */
330 0xB576, /* CheckSum */
331 IMAGE_SUBSYSTEM_WINDOWS_CUI, /* Subsystem */
332 IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE |
333 IMAGE_DLLCHARACTERISTICS_NO_SEH |
334 IMAGE_DLLCHARACTERISTICS_NX_COMPAT, /* DllCharacteristics */
335 0x100000, /* SizeOfStackReserve */
336 0x1000, /* SizeOfStackCommit */
337 0x100000, /* SizeOfHeapReserve */
338 0x1000, /* SizeOfHeapCommit */
339 0, /* LoaderFlags */
340 0x10, /* NumberOfRvaAndSizes */
341 /* IMAGE_DATA_DIRECTORY */
342 {
343 { 0 }, /* Export Table */
344 { 0x233C, 0x4F }, /* Import Table */
345 { 0x4000, 0x298 }, /* Resource Table */
346 { 0 }, /* Exception Table */
347 { 0 }, /* Certificate Table */
348 { 0x6000, 0xC }, /* Base Relocation Table */
349 { 0 }, /* Debug */
350 { 0 }, /* Copyright */
351 { 0 }, /* Global Ptr */
352 { 0 }, /* TLS Table */
353 { 0 }, /* Load Config Table */
354 { 0 }, /* Bound Import */
355 { 0x2000, 8 }, /* IAT */
356 { 0 }, /* Delay Import Descriptor */
357 { 0x2008, 0x48 }, /* CLI Header */
358 { 0 } /* Reserved */
359 }
360 }
361 },
362 /* IMAGE_SECTION_HEADER */
363 {
364 ".text", /* Name */
365 { 0x394 }, /* Misc.VirtualSize */
366 0x2000, /* VirtualAddress */
367 0x400, /* SizeOfRawData */
368 0x200, /* PointerToRawData */
369 0, /* PointerToRelocations */
370 0, /* PointerToLinenumbers */
371 0, /* NumberOfRelocations */
372 0, /* NumberOfLinenumbers */
373 IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_EXECUTE |
374 IMAGE_SCN_CNT_CODE, /* Characteristics */
375 },
376 /* IMAGE_SECTION_HEADER */
377 {
378 ".rsrc", /* Name */
379 { 0x298 }, /* Misc.VirtualSize */
380 0x4000, /* VirtualAddress */
381 0x400, /* SizeOfRawData */
382 0x600, /* PointerToRawData */
383 0, /* PointerToRelocations */
384 0, /* PointerToLinenumbers */
385 0, /* NumberOfRelocations */
386 0, /* NumberOfLinenumbers */
387 IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ, /* Characteristics */
388 },
389 /* IMAGE_SECTION_HEADER */
390 {
391 ".reloc", /* Name */
392 { 0xC }, /* Misc.VirtualSize */
393 0x6000, /* VirtualAddress */
394 0x200, /* SizeOfRawData */
395 0xA00, /* PointerToRawData */
396 0, /* PointerToRelocations */
397 0, /* PointerToLinenumbers */
398 0, /* NumberOfRelocations */
399 0, /* NumberOfLinenumbers */
400 IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ |
401 IMAGE_SCN_MEM_DISCARDABLE, /* Characteristics */
402 },
403 /* fill */
404 { 0 },
405 /* IMAGE_IMPORT_BY_NAME */
406 {
407 0x2370, /* Hint */
408 { 0 } /* Name */
409 },
410 /* fill */
411 { 0 },
412 /* IMAGE_COR20_HEADER */
413 {
414 0x48, /* Cb */
415 2, /* MajorRuntimeVersion */
416 5, /* MinorRuntimeVersion */
417 { 0x2188, 0x1B4 }, /* MetaData */
418 COMIMAGE_FLAGS_ILONLY | COMIMAGE_FLAGS_STRONGNAMESIGNED, /* Flags */
419 0, /* EntryPointToken */
420 { 0x20D0, 0xB8 }, /* Resources */
421 { 0x2050, 0x80 }, /* StrongNameSignature */
422 { 0 }, /* CodeManagerTable */
423 { 0 }, /* VTableFixups */
424 { 0 }, /* ExportAddressTableJumps */
425 { 0 } /* ManagedNativeHeader */
426 },
427 { 0xE496, 0x9A6E, 0xD95E, 0xA2A1, 0x5D72, 0x9CEF, 0x41E3, 0xD483,
428 0xCB5C, 0x329A, 0x887C, 0xE18E, 0xE664, 0x2E1C, 0x0E61, 0xB361,
429 0x8B88, 0xC8D0, 0x47A5, 0x9260, 0x6CC5, 0xE60F, 0x1F61, 0x1E3E,
430 0xAFEE, 0x925A, 0xA084, 0x6B44, 0x2DC6, 0x8126, 0xEBC9, 0xD812,
431 0xF3E9, 0xA3F3, 0xD0D5, 0x2C7F, 0x4592, 0xA0AF, 0x8B15, 0xD91E,
432 0x693E, 0x7A4F, 0x5567, 0xC466, 0xC410, 0x3D29, 0xB25F, 0xCD6C,
433 0x53EF, 0x0D29, 0x085A, 0xEC39, 0xE3BD, 0x58E0, 0x78F5, 0x0587,
434 0xF8D8, 0x14E4, 0x77CE, 0xCCC9, 0x4DCF, 0x8A18, 0x90E8, 0x1A52
435 },
436 /* RESOURCE */
437 {
438 0xB4, /* Size */
439 0xBEEFCACE, /* Signature */
440 1, /* HeaderVersion */
441 0x91, /* SkipBytes */
442 { 'l','S','y','s','t','e','m','.','R','e','s','o','u','r','c','e','s','.',
443 'R','e','s','o','u','r','c','e','R','e','a','d','e','r',',',' ',
444 'm','s','c','o','r','l','i','b',',',' ','V','e','r','s','i','o','n','=',
445 '2','.','0','.','0','.','0',',',' ','C','u','l','t','u','r','e','=',
446 'n','e','u','t','r','a','l',',',' ','P','u','b','l','i','c','K','e','y','T','o','k','e','n','=',
447 'b','7','7','a','5','c','5','6','1','9','3','4','e','0','8','9',
448 '#','S','y','s','t','e','m','.','R','e','s','o','u','r','c','e','s','.',
449 'R','u','n','t','i','m','e','R','e','s','o','u','r','c','e','S','e','t',
450 2,0,0,0,0,0,0,0,0,0,0,0,'P','A','D','P','A','D','P',180,0,0,0
451 }
452 },
453 /* METADATAHDR */
454 {
455 0x424A5342, /* Signature */
456 1, /* MajorVersion */
457 1, /* MinorVersion */
458 0, /* Reserved */
459 0xC, /* VersionLength */
460 "v2.0.50727", /* Version */
461 0, /* Flags */
462 5 /* Streams */
463 },
464 /* METADATASTREAMHDR */
465 {
466 0x6C, /* Offset */
467 0x64, /* Size */
468 },
469 "#~\0\0",
470 /* METADATASTREAMHDR */
471 {
472 0xD0, /* Offset */
473 0x28, /* Size */
474 },
475 "#Strings\0\0\0\0",
476 /* METADATASTREAMHDR */
477 {
478 0xF8, /* Offset */
479 0x8, /* Size */
480 },
481 "#US\0",
482 /* METADATASTREAMHDR */
483 {
484 0x100, /* Offset */
485 0x10, /* Size */
486 },
487 "#GUID\0\0\0",
488 /* METADATASTREAMHDR */
489 {
490 0x110, /* Offset */
491 0xA4, /* Size */
492 },
493 "#Blob\0\0\0",
494 /* METADATATABLESHDR */
495 {
496 0, /* Reserved1 */
497 2, /* MajorVersion */
498 0, /* MinorVersion */
499 0, /* HeapOffsetSizes */
500 1, /* Reserved2 */
501 { { 0 } }, /* MaskValid */
502 { { 0 } } /* MaskSorted */
503 },
504 /* numrows */
505 { 1, 1, 1, 1 },
506 /* MODULETABLE */
507 {
508 0, /* Generation */
509 0xA, /* Name */
510 1, /* Mvid */
511 0, /* EncId */
512 0 /* EncBaseId */
513 },
514 /* TYPEDEFTABLE */
515 {
516 0, /* Flags */
517 0x1, /* Name */
518 0, /* Namespace */
519 0, /* Extends */
520 1, /* FieldList */
521 1 /* MethodList */
522 },
523 /* ASSEMBLYTABLE */
524 {
525 0x8004, /* HashAlgId */
526 1, /* MajorVersion */
527 0, /* MinorVersion */
528 0, /* BuildNumber */
529 0, /* RevisionNumber */
530 1, /* Flags */
531 1, /* PublicKey */
532 0x13, /* Name */
533 0 /* Culture */
534 },
535 /* MANIFESTRESTABLE */
536 {
537 0, /* Offset */
538 0x2, /* Flags */
539 0x18, /* Name */
540 0 /* Implementation */
541 },
542 /* pad */
543 0,
544 /* String heap */
545 "\0<Module>\0wine.dll\0wine\0wine.resources\0\0",
546 /* US heap */
547 { 0x0300, 0x0020 },
548 /* GUID heap */
549 { 0x86EF, 0x5B5A, 0x2C5E, 0x4F6D, 0xC2AB, 0x0A94, 0xD658, 0x31DA },
550 /* BLOB heap */
551 { 0x8000, 0x00A0, 0x0024, 0x0400, 0x0080, 0x9400, 0x0000, 0x0600,
552 0x0002, 0x0000, 0x0024, 0x5200, 0x4153, 0x0031, 0x0004, 0x0100,
553 0x0100, 0x2F00, 0x60E0, 0x4D76, 0x5E5C, 0x430A, 0x6FF3, 0x77D6,
554 0x04CA, 0xF6AD, 0xF54D, 0x0AD2, 0x9FB6, 0x39C2, 0x2E66, 0xD30F,
555 0x916F, 0x1826, 0xFB52, 0x78A0, 0x8262, 0x6902, 0xBD47, 0xAF30,
556 0xBAB1, 0x29DA, 0xAA6D, 0xF189, 0x296A, 0x0F13, 0x4982, 0x531D,
557 0x8283, 0x1343, 0x5A33, 0x5D36, 0xEB3F, 0x0863, 0xA771, 0x0679,
558 0x4DFF, 0xD30A, 0xBEAD, 0x2A9F, 0x12A8, 0x4319, 0x5706, 0x333D,
559 0x0CAC, 0xE80A, 0xFD99, 0xC82D, 0x3D3B, 0xBFFE, 0xF256, 0x25E3,
560 0x1A12, 0xC116, 0x8936, 0xF237, 0x5F26, 0xC68A, 0x1E42, 0xCE41,
561 0xC17C, 0x00C4
562 },
563 /* IMAGE_IMPORT_DESCRIPTOR */
564 {
565 { 0x2364 }, /* OriginalFirstThunk */
566 0, /* TimeDateStamp */
567 0, /* ForwarderChain */
568 0x237E, /* Name */
569 0x2000, /* FirstThunk */
570 },
571 /* pad */
572 { 0 },
573 /* IMPORTLOOKUPTABLE */
574 {
575 0x2370, /* HintNameTableRVA */
576 { 0 }, /* pad */
577 },
578 /* HINTNAMETABLE */
579 {
580 0, /* Hint */
581 "_CorDllMain", /* Name */
582 "mscoree.dll", /* Module */
583 0, /* Reserved */
584 0x25FF, /* EntryPoint */
585 0x402000 /* RVA */
586 },
587 /* pad to 0x600 */
588 { 0 },
589 /* IMAGE_RESOURCE_DIRECTORY */
590 {
591 0, /* Characteristics */
592 0, /* TimeDateStamp */
593 0, /* MajorVersion */
594 0, /* MinorVersion */
595 0, /* NumberOfNamedEntries */
596 1, /* NumberOfIdEntries */
597 },
598 /* IMAGE_RESOURCE_DIRECTORY_ENTRY */
599 { { { 0 } }, { 0 } }, /* nameless unions initialized later */
600 /* IMAGE_RESOURCE_DIRECTORY */
601 {
602 0, /* Characteristics */
603 0, /* TimeDateStamp */
604 0, /* MajorVersion */
605 0, /* MinorVersion */
606 0, /* NumberOfNamedEntries */
607 1, /* NumberOfIdEntries */
608 },
609 /* IMAGE_RESOURCE_DIRECTORY_ENTRY */
610 { { { 0 } }, { 0 } }, /* nameless unions initialized later */
611 /* IMAGE_RESOURCE_DIRECTORY */
612 {
613 0, /* Characteristics */
614 0, /* TimeDateStamp */
615 0, /* MajorVersion */
616 0, /* MinorVersion */
617 0, /* NumberOfNamedEntries */
618 1, /* NumberOfIdEntries */
619 },
620 /* IMAGE_RESOURCE_DIRECTORY_ENTRY */
621 { { { 0 } }, { 0 } }, /* nameless unions initialized later */
622 /* IMAGE_RESOURCE_DATA_ENTRY */
623 {
624 0x4058, /* OffsetToData */
625 0x23C, /* Size */
626 0, /* CodePage */
627 0, /* Reserved */
628 },
629 /* VS_VERSIONINFO */
630 {
631 0x23C, /* wLength */
632 0x34, /* wValueLength */
633 0, /* wType */
634 { 'V','S','_','V','E','R','S','I','O','N','_','I','N','F','O',0,0 }, /* szKey */
635 /* VS_FIXEDFILEINFO */
636 {
637 VS_FFI_SIGNATURE, /* dwSignature */
638 VS_FFI_STRUCVERSION, /* dwStrucVersion */
639 0x10000, /* dwFileVersionMS */
640 0x00000, /* dwFileVersionLS */
641 0x10000, /* dwProductVersionMS */
642 0x00000, /* dwProductVersionLS */
643 VS_FFI_FILEFLAGSMASK, /* dwFileFlagsMask */
644 0x0, /* dwFileFlags */
645 VOS__WINDOWS32, /* dwFileOS */
646 VFT_DLL, /* dwFileType */
647 VFT2_UNKNOWN, /* dwFileSubtype */
648 0, /* dwFileDateMS */
649 0, /* dwFileDateLS */
650 },
651 },
652 /* VARFILEINFO */
653 {
654 0x44, /* wLength */
655 0, /* wValueLength */
656 1, /* wType */
657 { 'V','a','r','F','i','l','e','I','n','f','o',0,0 } /* szKey */
658 },
659 /* VAR */
660 {
661 0x24, /* wLength */
662 0x4, /* wValueLength */
663 0, /* wType */
664 { 'T','r','a','n','s','l','a','t','i','o','n',0,0 }, /* szKey */
665 0x4B00000, /* Value */
666 },
667 /* STRINGFILEINFO */
668 {
669 0x19C, /* wLength */
670 0, /* wValueLength */
671 1, /* wType */
672 { 'S','t','r','i','n','g','F','i','l','e','I','n','f','o',0 }, /* szKey */
673 },
674 /* STRINGTABLE */
675 {
676 0x178, /* wLength */
677 0, /* wValueLength */
678 1, /* wType */
679 { '0','0','0','0','0','4','b','0',0 }, /* szKey */
680 },
681 /* STRINGHDR */
682 {
683 0x2C, /* wLength */
684 2, /* wValueLength */
685 1, /* wType */
686 },
687 { 'F','i','l','e','D','e','s','c','r','i','p','t','i','o','n',0,0 }, /* szKey */
688 { ' ',0 }, /* szValue */
689 /* STRINGHDR */
690 {
691 0x30, /* wLength */
692 8, /* wValueLength */
693 1, /* wType */
694 },
695 { 'F','i','l','e','V','e','r','s','i','o','n',0,0 }, /* szKey */
696 { '1','.','0','.','0','.','0',0 }, /* szValue */
697 /* STRINGHDR */
698 {
699 0x34, /* wLength */
700 9, /* wValueLength */
701 1, /* wType */
702 },
703 { 'I','n','t','e','r','n','a','l','N','a','m','e',0 }, /* szKey */
704 { 'w','i','n','e','.','d','l','l',0 }, /* szValue */
705 /* STRINGHDR */
706 {
707 0x28, /* wLength */
708 2, /* wValueLength */
709 1, /* wType */
710 },
711 { 'L','e','g','a','l','C','o','p','y','r','i','g','h','t',0 }, /* szKey */
712 { ' ',0 }, /* szValue */
713 /* STRINGHDR */
714 {
715 0x3C, /* wLength */
716 9, /* wValueLength */
717 1, /* wType */
718 },
719 { 'O','r','i','g','i','n','a','l','F','i','l','e','n','a','m','e',0 }, /* szKey */
720 { 'w','i','n','e','.','d','l','l',0,0 }, /* szValue */
721 /* STRINGHDR */
722 {
723 0x34, /* wLength */
724 8, /* wValueLength */
725 1, /* wType */
726 },
727 { 'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0 }, /* szKey */
728 { '1','.','0','.','0','.','0',0 }, /* szValue */
729 /* STRINGHDR */
730 {
731 0x38, /* wLength */
732 8, /* wValueLength */
733 1, /* wType */
734 },
735 { 'A','s','s','e','m','b','l','y',' ','V','e','r','s','i','o','n',0 }, /* szKey */
736 { '1','.','0','.','0','.','0',0 }, /* szValue */
737 { 0 }, /* pad */
738 /* RELOCATION */
739 {
740 0x2000, /* PageRVA */
741 0xC, /* Size */
742 0x3390, /* Relocation */
743 },
744 { 0 }
745 };
746
747
748 static HRESULT (WINAPI *pCreateAssemblyCache)(IAssemblyCache **ppAsmCache,
749 DWORD dwReserved);
750 static HRESULT (WINAPI *pGetCachePath)(ASM_CACHE_FLAGS dwCacheFlags,
751 LPWSTR pwzCachePath, PDWORD pcchPath);
752 static HRESULT (WINAPI *pLoadLibraryShim)(LPCWSTR szDllName, LPCWSTR szVersion,
753 LPVOID pvReserved, HMODULE *phModDll);
754
755 static BOOL init_functionpointers(void)
756 {
757 HRESULT hr;
758 HMODULE hfusion;
759 HMODULE hmscoree;
760
761 static const WCHAR szFusion[] = {'f','u','s','i','o','n','.','d','l','l',0};
762
763 hmscoree = LoadLibraryA("mscoree.dll");
764 if (!hmscoree)
765 {
766 win_skip("mscoree.dll not available\n");
767 return FALSE;
768 }
769
770 pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim");
771 if (!pLoadLibraryShim)
772 {
773 win_skip("LoadLibraryShim not available\n");
774 FreeLibrary(hmscoree);
775 return FALSE;
776 }
777
778 hr = pLoadLibraryShim(szFusion, NULL, NULL, &hfusion);
779 if (FAILED(hr))
780 {
781 win_skip("fusion.dll not available\n");
782 FreeLibrary(hmscoree);
783 return FALSE;
784 }
785
786 pCreateAssemblyCache = (void *)GetProcAddress(hfusion, "CreateAssemblyCache");
787 pGetCachePath = (void *)GetProcAddress(hfusion, "GetCachePath");
788
789 if (!pCreateAssemblyCache || !pGetCachePath)
790 {
791 win_skip("fusion.dll not implemented\n");
792 return FALSE;
793 }
794
795 FreeLibrary(hmscoree);
796 return TRUE;
797 }
798
799 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
800 {
801 HANDLE file;
802 DWORD written;
803
804 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
805 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
806 WriteFile(file, data, strlen(data), &written, NULL);
807
808 if (size)
809 {
810 SetFilePointer(file, size, NULL, FILE_BEGIN);
811 SetEndOfFile(file);
812 }
813
814 CloseHandle(file);
815 }
816
817 #define create_file(name, size) create_file_data(name, name, size)
818
819 static void create_assembly(LPCSTR file)
820 {
821 HANDLE hfile;
822 DWORD written;
823
824 /* nameless unions initialized here */
825 assembly.tableshdr.MaskValid.u.HighPart = 0x101;
826 assembly.tableshdr.MaskValid.u.LowPart = 0x00000005;
827 assembly.tableshdr.MaskSorted.u.HighPart = 0x1600;
828 assembly.tableshdr.MaskSorted.u.LowPart = 0x3301FA00;
829 U1(assembly.labelres).Name = 0x10;
830 U2(assembly.labelres).OffsetToData = 0x80000018;
831 U1(assembly.label11res).Name = 0x1;
832 U2(assembly.label11res).OffsetToData = 0x80000030;
833 U1(assembly.label10res).Name = 0x0;
834 U2(assembly.label10res).OffsetToData = 0x48;
835
836 hfile = CreateFileA(file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
837
838 WriteFile(hfile, &assembly, sizeof(ASSEMBLY), &written, NULL);
839 CloseHandle(hfile);
840 }
841
842 static BOOL check_dotnet20(void)
843 {
844 IAssemblyCache *cache;
845 HRESULT hr;
846 BOOL ret = FALSE;
847 ULONG disp;
848
849 static const WCHAR winedll[] = {'w','i','n','e','.','d','l','l',0};
850
851 create_assembly("wine.dll");
852
853 hr = pCreateAssemblyCache(&cache, 0);
854 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
855
856 hr = IAssemblyCache_InstallAssembly(cache, 0, winedll, NULL);
857 if (hr == S_OK)
858 ret = TRUE;
859 else if (hr == CLDB_E_FILE_OLDVER)
860 win_skip("Tests can't be run on older .NET version (.NET 1.1)\n");
861 else if (hr == E_ACCESSDENIED)
862 skip("Not enough rights to install an assembly\n");
863 else
864 ok(0, "Expected S_OK, got %08x\n", hr);
865
866 DeleteFileA("wine.dll");
867 IAssemblyCache_UninstallAssembly(cache, 0, winedll, NULL, &disp);
868 IAssemblyCache_Release(cache);
869 return ret;
870 }
871
872 static void test_CreateAssemblyCache(void)
873 {
874 IAssemblyCache *cache;
875 HRESULT hr;
876
877 /* NULL ppAsmCache */
878 hr = pCreateAssemblyCache(NULL, 0);
879 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
880
881 /* dwReserved is non-zero */
882 hr = pCreateAssemblyCache(&cache, 42);
883 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
884
885 IAssemblyCache_Release(cache);
886 }
887
888 static void test_InstallAssembly(void)
889 {
890 IAssemblyCache *cache;
891 HRESULT hr;
892 ULONG disp;
893 DWORD attr;
894 char dllpath[MAX_PATH];
895 UINT size;
896
897 static const WCHAR empty[] = {0};
898 static const WCHAR noext[] = {'f','i','l','e',0};
899 static const WCHAR badext[] = {'f','i','l','e','.','b','a','d',0};
900 static const WCHAR dllext[] = {'f','i','l','e','.','d','l','l',0};
901 static const WCHAR exeext[] = {'f','i','l','e','.','e','x','e',0};
902 static const WCHAR testdll[] = {'t','e','s','t','.','d','l','l',0};
903 static const WCHAR winedll[] = {'w','i','n','e','.','d','l','l',0};
904 static const WCHAR wine[] = {'w','i','n','e',0};
905
906 create_file("test.dll", 100);
907 create_assembly("wine.dll");
908
909 hr = pCreateAssemblyCache(&cache, 0);
910 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
911
912 /* NULL pszManifestFilePath */
913 hr = IAssemblyCache_InstallAssembly(cache, 0, NULL, NULL);
914 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
915
916 /* empty pszManifestFilePath */
917 hr = IAssemblyCache_InstallAssembly(cache, 0, empty, NULL);
918 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
919
920 /* pszManifestFilePath has no extension */
921 hr = IAssemblyCache_InstallAssembly(cache, 0, noext, NULL);
922 ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_NAME),
923 "Expected HRESULT_FROM_WIN32(ERROR_INVALID_NAME), got %08x\n", hr);
924
925 /* pszManifestFilePath has bad extension */
926 hr = IAssemblyCache_InstallAssembly(cache, 0, badext, NULL);
927 ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_NAME),
928 "Expected HRESULT_FROM_WIN32(ERROR_INVALID_NAME), got %08x\n", hr);
929
930 /* pszManifestFilePath has dll extension */
931 hr = IAssemblyCache_InstallAssembly(cache, 0, dllext, NULL);
932 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
933 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
934
935 /* pszManifestFilePath has exe extension */
936 hr = IAssemblyCache_InstallAssembly(cache, 0, exeext, NULL);
937 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
938 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
939
940 /* empty file */
941 hr = IAssemblyCache_InstallAssembly(cache, 0, testdll, NULL);
942 ok(hr == COR_E_ASSEMBLYEXPECTED,
943 "Expected COR_E_ASSEMBLYEXPECTED, got %08x\n", hr);
944
945 /* wine assembly */
946 hr = IAssemblyCache_InstallAssembly(cache, 0, winedll, NULL);
947 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
948
949 size = GetWindowsDirectoryA(dllpath, MAX_PATH);
950 strcat(dllpath, "\\assembly\\GAC_MSIL\\wine\\\\1.0.0.0__2d03617b1c31e2f5\\wine.dll");
951
952 attr = GetFileAttributes(dllpath);
953 ok(attr != INVALID_FILE_ATTRIBUTES, "Expected assembly to exist\n");
954
955 /* uninstall the assembly from the GAC */
956 disp = 0xf00dbad;
957 hr = IAssemblyCache_UninstallAssembly(cache, 0, wine, NULL, &disp);
958 todo_wine
959 {
960 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
961 ok(disp == IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED,
962 "Expected IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED, got %d\n", disp);
963 }
964
965 /* FIXME: remove once UninstallAssembly is implemented */
966 DeleteFileA(dllpath);
967 dllpath[size + sizeof("\\assembly\\GAC_MSIL\\wine\\1.0.0.0__2d03617b1c31e2f5")] = '\0';
968 RemoveDirectoryA(dllpath);
969 dllpath[size + sizeof("\\assembly\\GAC_MSIL\\wine")] = '\0';
970 RemoveDirectoryA(dllpath);
971
972 DeleteFileA("test.dll");
973 DeleteFileA("wine.dll");
974 IAssemblyCache_Release(cache);
975 }
976
977 #define INIT_ASM_INFO() \
978 ZeroMemory(&info, sizeof(ASSEMBLY_INFO)); \
979 info.cbAssemblyInfo = sizeof(ASSEMBLY_INFO); \
980 info.pszCurrentAssemblyPathBuf = path; \
981 info.cchBuf = MAX_PATH; \
982 path[0] = '\0';
983
984 static void test_QueryAssemblyInfo(void)
985 {
986 IAssemblyCache *cache;
987 ASSEMBLY_INFO info;
988 WCHAR path[MAX_PATH];
989 WCHAR asmpath[MAX_PATH];
990 WCHAR name[MAX_PATH];
991 HRESULT hr;
992 DWORD size;
993 ULONG disp;
994 char dllpath[MAX_PATH];
995 UINT len;
996
997 static const WCHAR empty[] = {0};
998 static const WCHAR commasep[] = {',',' ',0};
999 static const WCHAR winedll[] = {'w','i','n','e','.','d','l','l',0};
1000 static const WCHAR wine[] = {'w','i','n','e',0};
1001 static const WCHAR ver[] = {
1002 'V','e','r','s','i','o','n','=','1','.','0','.','0','.','0',0};
1003 static const WCHAR otherver[] = {
1004 'V','e','r','s','i','o','n','=','1','.','0','.','0','.','0','0','0','0','0',0};
1005 static const WCHAR badver[] = {
1006 'V','e','r','s','i','o','n','=','1','.','0','.','0','.','1',0};
1007 static const WCHAR culture[] = {
1008 'C','u','l','t','u','r','e','=','n','e','u','t','r','a','l',0};
1009 static const WCHAR badculture[] = {
1010 'C','u','l','t','u','r','e','=','e','n',0};
1011 static const WCHAR pubkey[] = {
1012 'P','u','b','l','i','c','K','e','y','T','o','k','e','n','=',
1013 '2','d','0','3','6','1','7','b','1','c','3','1','e','2','f','5',0};
1014 static const WCHAR badpubkey[] = {
1015 'P','u','b','l','i','c','K','e','y','T','o','k','e','n','=',
1016 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a',0};
1017 static const WCHAR badprop[] = {'B','a','d','P','r','o','p','=','b','u','h',0};
1018 static const WCHAR msil[] = {
1019 '_','M','S','I','L','\\','w','i','n','e','\\',
1020 '1','.','0','.','0','.','0','_','_','2','d','0','3','6','1','7','b',
1021 '1','c','3','1','e','2','f','5','\\',0};
1022
1023 size = MAX_PATH;
1024 hr = pGetCachePath(ASM_CACHE_GAC, asmpath, &size);
1025 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1026
1027 lstrcatW(asmpath, msil);
1028 lstrcatW(asmpath, winedll);
1029
1030 create_assembly("wine.dll");
1031
1032 hr = pCreateAssemblyCache(&cache, 0);
1033 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1034
1035 /* assembly not installed yet */
1036 INIT_ASM_INFO();
1037 hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, wine, &info);
1038 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
1039 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
1040 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1041 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1042 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1043 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1044 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1045 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1046 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1047 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1048 "Assembly path was changed\n");
1049 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1050
1051 hr = IAssemblyCache_InstallAssembly(cache, 0, winedll, NULL);
1052 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1053
1054 /* NULL pszAssemblyName */
1055 INIT_ASM_INFO();
1056 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_VALIDATE,
1057 NULL, &info);
1058 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
1059 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1060 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1061 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1062 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1063 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1064 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1065 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1066 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1067 "Assembly path was changed\n");
1068 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1069
1070 /* empty pszAssemblyName */
1071 INIT_ASM_INFO();
1072 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_VALIDATE,
1073 empty, &info);
1074 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
1075 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1076 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1077 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1078 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1079 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1080 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1081 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1082 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1083 "Assembly path was changed\n");
1084 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1085
1086 /* no dwFlags */
1087 INIT_ASM_INFO();
1088 hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, wine, &info);
1089 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1090 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1091 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1092 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1093 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1094 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1095 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1096 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1097 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1098 todo_wine
1099 {
1100 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1101 "Wrong assembly path returned\n");
1102 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1103 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1104 }
1105
1106 /* pwzCachePath is full filename */
1107 INIT_ASM_INFO();
1108 hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, winedll, &info);
1109 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
1110 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
1111 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1112 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1113 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1114 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1115 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1116 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1117 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1118 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1119 "Assembly path was changed\n");
1120 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1121
1122 /* NULL pAsmInfo, QUERYASMINFO_FLAG_VALIDATE */
1123 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_VALIDATE,
1124 wine, NULL);
1125 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1126
1127 /* NULL pAsmInfo, QUERYASMINFO_FLAG_GETSIZE */
1128 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1129 wine, NULL);
1130 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1131
1132 /* info.cbAssemblyInfo is 0 */
1133 INIT_ASM_INFO();
1134 info.cbAssemblyInfo = 0;
1135 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_VALIDATE,
1136 wine, &info);
1137 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1138 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1139 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1140 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1141 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1142 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1143 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1144 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1145 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1146 todo_wine
1147 {
1148 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1149 "Wrong assembly path returned\n");
1150 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1151 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1152 }
1153
1154 /* info.cbAssemblyInfo is 1 */
1155 INIT_ASM_INFO();
1156 info.cbAssemblyInfo = 1;
1157 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_VALIDATE,
1158 wine, &info);
1159 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
1160 ok(info.cbAssemblyInfo == 1, "Expected 1, got %d\n", info.cbAssemblyInfo);
1161 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1162 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1163 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1164 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1165 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1166 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1167 "Assembly path was changed\n");
1168 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1169
1170 /* info.cbAssemblyInfo is > sizeof(ASSEMBLY_INFO) */
1171 INIT_ASM_INFO();
1172 info.cbAssemblyInfo = sizeof(ASSEMBLY_INFO) * 2;
1173 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1174 wine, &info);
1175 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
1176 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO) * 2,
1177 "Expected sizeof(ASSEMBLY_INFO) * 2, got %d\n", info.cbAssemblyInfo);
1178 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1179 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1180 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1181 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1182 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1183 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1184 "Assembly path was changed\n");
1185 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1186
1187 /* QUERYASMINFO_FLAG_GETSIZE */
1188 INIT_ASM_INFO();
1189 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1190 wine, &info);
1191 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1192 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1193 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1194 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1195 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1196 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1197 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1198 todo_wine
1199 {
1200 /* win9x: 32 */
1201 ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
1202 broken(info.uliAssemblySizeInKB.u.LowPart == 32),
1203 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1204 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1205 "Wrong assembly path returned\n");
1206 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1207 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1208 }
1209
1210 /* QUERYASMINFO_FLAG_GETSIZE and QUERYASMINFO_FLAG_VALIDATE */
1211 INIT_ASM_INFO();
1212 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE |
1213 QUERYASMINFO_FLAG_VALIDATE,wine, &info);
1214 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1215 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1216 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1217 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1218 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1219 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1220 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1221 todo_wine
1222 {
1223 /* win9x: 32 */
1224 ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
1225 broken(info.uliAssemblySizeInKB.u.LowPart == 32),
1226 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1227 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1228 "Wrong assembly path returned\n");
1229 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1230 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1231 }
1232
1233 /* info.pszCurrentAssemblyPathBuf is NULL */
1234 INIT_ASM_INFO();
1235 info.pszCurrentAssemblyPathBuf = NULL;
1236 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1237 wine, &info);
1238 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1239 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1240 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1241 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1242 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1243 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1244 todo_wine
1245 {
1246 ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),
1247 "Expected HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), got %08x\n", hr);
1248 /* win9x: 32 */
1249 ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
1250 broken(info.uliAssemblySizeInKB.u.LowPart == 32),
1251 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1252 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1253 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1254 }
1255
1256 /* info.cchBuf is exactly size of asmpath */
1257 INIT_ASM_INFO();
1258 info.cchBuf = lstrlenW(asmpath);
1259 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1260 wine, &info);
1261 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1262 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1263 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1264 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1265 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1266 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1267 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1268 "Assembly path was changed\n");
1269 todo_wine
1270 {
1271 ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),
1272 "Expected HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), got %08x\n", hr);
1273 /* win9x: 32 */
1274 ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
1275 broken(info.uliAssemblySizeInKB.u.LowPart == 32),
1276 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1277 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1278 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1279 }
1280
1281 /* info.cchBuf has room for NULL-terminator */
1282 INIT_ASM_INFO();
1283 info.cchBuf = lstrlenW(asmpath) + 1;
1284 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1285 wine, &info);
1286 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1287 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1288 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1289 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1290 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1291 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1292 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1293 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1294 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1295 todo_wine
1296 {
1297 /* win9x: 32 */
1298 ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
1299 broken(info.uliAssemblySizeInKB.u.LowPart == 32),
1300 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1301 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1302 "Wrong assembly path returned\n");
1303 }
1304
1305 /* display name is "wine, Version=1.0.0.0" */
1306 INIT_ASM_INFO();
1307 lstrcpyW(name, wine);
1308 lstrcatW(name, commasep);
1309 lstrcatW(name, ver);
1310 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1311 name, &info);
1312 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1313 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1314 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1315 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1316 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1317 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1318 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1319 todo_wine
1320 {
1321 /* win9x: 32 */
1322 ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
1323 broken(info.uliAssemblySizeInKB.u.LowPart == 32),
1324 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1325 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1326 "Wrong assembly path returned\n");
1327 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1328 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1329 }
1330
1331 /* display name is "wine, Version=1.0.0.00000" */
1332 INIT_ASM_INFO();
1333 lstrcpyW(name, wine);
1334 lstrcatW(name, commasep);
1335 lstrcatW(name, otherver);
1336 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1337 name, &info);
1338 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1339 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1340 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1341 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1342 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1343 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1344 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1345 todo_wine
1346 {
1347 /* win9x: 32 */
1348 ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
1349 broken(info.uliAssemblySizeInKB.u.LowPart == 32),
1350 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1351 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1352 "Wrong assembly path returned\n");
1353 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1354 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1355 }
1356
1357 /* display name is "wine, Version=1.0.0.1", versions don't match */
1358 INIT_ASM_INFO();
1359 lstrcpyW(name, wine);
1360 lstrcatW(name, commasep);
1361 lstrcatW(name, badver);
1362 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1363 name, &info);
1364 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
1365 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
1366 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1367 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1368 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1369 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1370 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1371 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1372 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1373 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1374 "Assembly path was changed\n");
1375 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1376
1377 /* display name is "wine, Culture=neutral" */
1378 INIT_ASM_INFO();
1379 lstrcpyW(name, wine);
1380 lstrcatW(name, commasep);
1381 lstrcatW(name, culture);
1382 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1383 name, &info);
1384 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1385 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1386 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1387 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1388 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1389 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1390 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1391 todo_wine
1392 {
1393 /* win9x: 32 */
1394 ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
1395 broken(info.uliAssemblySizeInKB.u.LowPart == 32),
1396 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1397 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1398 "Wrong assembly path returned\n");
1399 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1400 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1401 }
1402
1403 /* display name is "wine, Culture=en", cultures don't match */
1404 INIT_ASM_INFO();
1405 lstrcpyW(name, wine);
1406 lstrcatW(name, commasep);
1407 lstrcatW(name, badculture);
1408 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1409 name, &info);
1410 todo_wine
1411 {
1412 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
1413 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
1414 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1415 }
1416 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1417 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1418 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1419 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1420 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1421 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1422 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1423 "Assembly path was changed\n");
1424 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1425
1426 /* display name is "wine, PublicKeyTokens=2d03617b1c31e2f5" */
1427 INIT_ASM_INFO();
1428 lstrcpyW(name, wine);
1429 lstrcatW(name, commasep);
1430 lstrcatW(name, pubkey);
1431 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1432 name, &info);
1433 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1434 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1435 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1436 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1437 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1438 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1439 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1440 todo_wine
1441 {
1442 /* win9x: 32 */
1443 ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
1444 broken(info.uliAssemblySizeInKB.u.LowPart == 32),
1445 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1446 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1447 "Wrong assembly path returned\n");
1448 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1449 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1450 }
1451
1452 /* display name is "wine, PublicKeyToken=aaaaaaaaaaaaaaaa", pubkeys don't match */
1453 INIT_ASM_INFO();
1454 lstrcpyW(name, wine);
1455 lstrcatW(name, commasep);
1456 lstrcatW(name, badpubkey);
1457 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1458 name, &info);
1459 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
1460 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
1461 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1462 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1463 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1464 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1465 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1466 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1467 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1468 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1469 "Assembly path was changed\n");
1470 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1471
1472 /* display name is "wine, BadProp=buh", bad property */
1473 INIT_ASM_INFO();
1474 lstrcpyW(name, wine);
1475 lstrcatW(name, commasep);
1476 lstrcatW(name, badprop);
1477 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1478 name, &info);
1479 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1480 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1481 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1482 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1483 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1484 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1485 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1486 todo_wine
1487 {
1488 /* win9x: 32 */
1489 ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
1490 broken(info.uliAssemblySizeInKB.u.LowPart == 32),
1491 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1492 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1493 "Wrong assembly path returned\n");
1494 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1495 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1496 }
1497
1498 /* uninstall the assembly from the GAC */
1499 disp = 0xf00dbad;
1500 hr = IAssemblyCache_UninstallAssembly(cache, 0, wine, NULL, &disp);
1501 todo_wine
1502 {
1503 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1504 ok(disp == IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED,
1505 "Expected IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED, got %d\n", disp);
1506 }
1507
1508 /* FIXME: remove once UninstallAssembly is implemented */
1509 len = GetWindowsDirectoryA(dllpath, MAX_PATH);
1510 strcat(dllpath, "\\assembly\\GAC_MSIL\\wine\\\\1.0.0.0__2d03617b1c31e2f5\\wine.dll");
1511 DeleteFileA(dllpath);
1512 dllpath[len + sizeof("\\assembly\\GAC_MSIL\\wine\\1.0.0.0__2d03617b1c31e2f5")] = '\0';
1513 RemoveDirectoryA(dllpath);
1514 dllpath[len + sizeof("\\assembly\\GAC_MSIL\\wine")] = '\0';
1515 RemoveDirectoryA(dllpath);
1516
1517 DeleteFileA("test.dll");
1518 DeleteFileA("wine.dll");
1519 IAssemblyCache_Release(cache);
1520 }
1521
1522 START_TEST(asmcache)
1523 {
1524 if (!init_functionpointers())
1525 return;
1526
1527 if (!check_dotnet20())
1528 return;
1529
1530 test_CreateAssemblyCache();
1531 test_InstallAssembly();
1532 test_QueryAssemblyInfo();
1533 }