ReactOS 0.4.15-dev-8119-g4fb2fdb
asmcache.c File Reference
#include <stdio.h>
#include <windows.h>
#include <mscoree.h>
#include <fusion.h>
#include <corerror.h>
#include "wine/test.h"
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for asmcache.c:

Go to the source code of this file.

Classes

struct  METADATAHDR
 
struct  METADATASTREAMHDR
 
struct  METADATATABLESHDR
 
struct  MODULETABLE
 
struct  TYPEDEFTABLE
 
struct  ASSEMBLYTABLE
 
struct  MANIFESTRESTABLE
 
struct  IMPORTTABLE
 
struct  IMPORTLOOKUPTABLE
 
struct  HINTNAMETABLE
 
struct  RELOCATION
 
struct  VS_VERSIONINFO
 
struct  VARFILEINFO
 
struct  VAR
 
struct  STRINGFILEINFO
 
struct  STRINGTABLE
 
struct  STRINGHDR
 
struct  RESOURCE
 
struct  _tagASSEMBLY
 

Macros

#define COBJMACROS
 
#define INITGUID
 
#define create_file(name, size)   create_file_data(name, name, size)
 
#define INIT_ASM_INFO()
 

Typedefs

typedef struct _tagASSEMBLY ASSEMBLY
 

Functions

static HRESULT (WINAPI *pCreateAssemblyCache)(IAssemblyCache **ppAsmCache
 
static BOOL init_functionpointers (void)
 
static void create_file_data (LPCSTR name, LPCSTR data, DWORD size)
 
static void create_assembly (LPCSTR file)
 
static BOOL check_dotnet20 (void)
 
static void test_CreateAssemblyCache (void)
 
static void test_CreateAssemblyCacheItem (void)
 
static void test_InstallAssembly (void)
 
static void test_QueryAssemblyInfo (void)
 
 START_TEST (asmcache)
 

Variables

static struct _tagASSEMBLY assembly
 
static DWORD dwReserved
 
static LPWSTR pwzCachePath
 
static LPWSTR PDWORD pcchPath
 
static LPCWSTR szVersion
 
static LPCWSTR LPVOID pvReserved
 
static LPCWSTR LPVOID HMODULEphModDll
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file asmcache.c.

◆ create_file

#define create_file (   name,
  size 
)    create_file_data(name, name, size)

Definition at line 813 of file asmcache.c.

◆ INIT_ASM_INFO

#define INIT_ASM_INFO ( )
Value:
info.cbAssemblyInfo = sizeof(ASSEMBLY_INFO); \
info.pszCurrentAssemblyPathBuf = path; \
info.cchBuf = MAX_PATH; \
path[0] = '\0';
#define MAX_PATH
Definition: compat.h:34
#define ZeroMemory
Definition: winbase.h:1712
struct _ASSEMBLY_INFO ASSEMBLY_INFO

Definition at line 1008 of file asmcache.c.

◆ INITGUID

#define INITGUID

Definition at line 20 of file asmcache.c.

Typedef Documentation

◆ ASSEMBLY

Definition at line 31 of file asmcache.c.

Function Documentation

◆ check_dotnet20()

static BOOL check_dotnet20 ( void  )
static

Definition at line 838 of file asmcache.c.

839{
841 HRESULT hr;
842 BOOL ret = FALSE;
843 ULONG disp;
844
845 static const WCHAR winedll[] = {'w','i','n','e','.','d','l','l',0};
846
847 create_assembly("wine.dll");
848
849 hr = pCreateAssemblyCache(&cache, 0);
850 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
851
852 hr = IAssemblyCache_InstallAssembly(cache, 0, winedll, NULL);
853 if (hr == S_OK)
854 ret = TRUE;
855 else if (hr == CLDB_E_FILE_OLDVER)
856 win_skip("Tests can't be run on older .NET version (.NET 1.1)\n");
857 else if (hr == E_ACCESSDENIED)
858 skip("Not enough rights to install an assembly\n");
859 else
860 ok(0, "Expected S_OK, got %08x\n", hr);
861
862 DeleteFileA("wine.dll");
863 IAssemblyCache_UninstallAssembly(cache, 0, winedll, NULL, &disp);
864 IAssemblyCache_Release(cache);
865 return ret;
866}
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define CLDB_E_FILE_OLDVER
Definition: corerror.h:125
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
unsigned int BOOL
Definition: ntddk_ex.h:94
#define S_OK
Definition: intsafe.h:52
static void create_assembly(LPCSTR file)
Definition: asmcache.c:815
#define win_skip
Definition: test.h:163
HRESULT hr
Definition: shlfolder.c:183
Definition: cache.c:49
uint32_t ULONG
Definition: typedefs.h:59
int ret
#define E_ACCESSDENIED
Definition: winerror.h:2849
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ create_assembly()

static void create_assembly ( LPCSTR  file)
static

Definition at line 815 of file asmcache.c.

816{
817 HANDLE hfile;
818 DWORD written;
819
820 /* nameless unions initialized here */
821 assembly.tableshdr.MaskValid.u.HighPart = 0x101;
822 assembly.tableshdr.MaskValid.u.LowPart = 0x00000005;
823 assembly.tableshdr.MaskSorted.u.HighPart = 0x1600;
824 assembly.tableshdr.MaskSorted.u.LowPart = 0x3301FA00;
825 U(assembly.labelres).Name = 0x10;
826 U2(assembly.labelres).OffsetToData = 0x80000018;
827 U(assembly.label11res).Name = 0x1;
828 U2(assembly.label11res).OffsetToData = 0x80000030;
829 U(assembly.label10res).Name = 0x0;
830 U2(assembly.label10res).OffsetToData = 0x48;
831
832 hfile = CreateFileA(file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
833
834 WriteFile(hfile, &assembly, sizeof(ASSEMBLY), &written, NULL);
835 CloseHandle(hfile);
836}
#define U(x)
Definition: wordpad.c:45
#define U2(x)
Definition: wordpad.c:46
#define CloseHandle
Definition: compat.h:739
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: fci.c:127

Referenced by check_dotnet20(), test_InstallAssembly(), and test_QueryAssemblyInfo().

◆ create_file_data()

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

Definition at line 795 of file asmcache.c.

796{
797 HANDLE file;
798 DWORD written;
799
801 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
802 WriteFile(file, data, strlen(data), &written, NULL);
803
804 if (size)
805 {
808 }
809
811}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define FILE_BEGIN
Definition: compat.h:761
#define SetFilePointer
Definition: compat.h:743
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:1004
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
Definition: name.c:39

Referenced by test_MsiConfigureProductEx(), test_MsiGetFileHash(), test_MsiGetFileSignatureInformation(), test_MsiProvideQualifiedComponentEx(), and test_publish_assemblies().

◆ HRESULT()

static HRESULT ( WINAPI pCreateAssemblyCache)
static

◆ init_functionpointers()

static BOOL init_functionpointers ( void  )
static

Definition at line 751 of file asmcache.c.

752{
753 HRESULT hr;
754 HMODULE hfusion;
756
757 static const WCHAR szFusion[] = {'f','u','s','i','o','n','.','d','l','l',0};
758
759 hmscoree = LoadLibraryA("mscoree.dll");
760 if (!hmscoree)
761 {
762 win_skip("mscoree.dll not available\n");
763 return FALSE;
764 }
765
766 pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim");
767 if (!pLoadLibraryShim)
768 {
769 win_skip("LoadLibraryShim not available\n");
771 return FALSE;
772 }
773
774 hr = pLoadLibraryShim(szFusion, NULL, NULL, &hfusion);
775 if (FAILED(hr))
776 {
777 win_skip("fusion.dll not available\n");
779 return FALSE;
780 }
781
782 pCreateAssemblyCache = (void *)GetProcAddress(hfusion, "CreateAssemblyCache");
783 pGetCachePath = (void *)GetProcAddress(hfusion, "GetCachePath");
784
785 if (!pCreateAssemblyCache || !pGetCachePath)
786 {
787 win_skip("fusion.dll not implemented\n");
788 return FALSE;
789 }
790
792 return TRUE;
793}
#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 FAILED(hr)
Definition: intsafe.h:51
static HMODULE hmscoree
Definition: fusion.c:24

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( asmcache  )

Definition at line 1581 of file asmcache.c.

1582{
1583 if (!init_functionpointers())
1584 return;
1585
1586 if (!check_dotnet20())
1587 return;
1588
1593}
static BOOL init_functionpointers(void)
Definition: asmcache.c:751
static void test_QueryAssemblyInfo(void)
Definition: asmcache.c:1015
static void test_CreateAssemblyCache(void)
Definition: asmcache.c:868
static void test_CreateAssemblyCacheItem(void)
Definition: asmcache.c:884
static BOOL check_dotnet20(void)
Definition: asmcache.c:838
static void test_InstallAssembly(void)
Definition: asmcache.c:921

◆ test_CreateAssemblyCache()

static void test_CreateAssemblyCache ( void  )
static

Definition at line 868 of file asmcache.c.

869{
871 HRESULT hr;
872
873 /* NULL ppAsmCache */
874 hr = pCreateAssemblyCache(NULL, 0);
875 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
876
877 /* dwReserved is non-zero */
878 hr = pCreateAssemblyCache(&cache, 42);
879 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
880
881 IAssemblyCache_Release(cache);
882}
#define E_INVALIDARG
Definition: ddrawi.h:101

Referenced by START_TEST().

◆ test_CreateAssemblyCacheItem()

static void test_CreateAssemblyCacheItem ( void  )
static

Definition at line 884 of file asmcache.c.

885{
888 HRESULT hr;
889
890 static const WCHAR wine[] = {'w','i','n','e',0};
891
892 hr = pCreateAssemblyCache(&cache, 0);
893 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
894
895 hr = IAssemblyCache_CreateAssemblyCacheItem(cache, 0, NULL, NULL, NULL);
896 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
897
898 hr = IAssemblyCache_CreateAssemblyCacheItem(cache, 0, NULL, &item, NULL);
899 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
900 IAssemblyCacheItem_Release(item);
901
902 hr = IAssemblyCache_CreateAssemblyCacheItem(cache, 0, NULL, &item, wine);
903 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
904 IAssemblyCacheItem_Release(item);
905
906 hr = IAssemblyCache_CreateAssemblyCacheItem(cache, 1, (void *)0xdeadbeef, &item, NULL);
907 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
908 IAssemblyCacheItem_Release(item);
909
910 hr = IAssemblyCache_CreateAssemblyCacheItem(cache, 1, NULL, &item, NULL);
911 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
912 IAssemblyCacheItem_Release(item);
913
914 hr = IAssemblyCache_CreateAssemblyCacheItem(cache, 0, (void *)0xdeadbeef, &item, NULL);
915 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
916 IAssemblyCacheItem_Release(item);
917
918 IAssemblyCache_Release(cache);
919}
static const BYTE wine[]
Definition: encode.c:696
static ATOM item
Definition: dde.c:856

Referenced by START_TEST().

◆ test_InstallAssembly()

static void test_InstallAssembly ( void  )
static

Definition at line 921 of file asmcache.c.

922{
924 HRESULT hr;
925 ULONG disp;
926 DWORD attr;
927 char dllpath[MAX_PATH];
928
929 static const WCHAR empty[] = {0};
930 static const WCHAR noext[] = {'f','i','l','e',0};
931 static const WCHAR badext[] = {'f','i','l','e','.','b','a','d',0};
932 static const WCHAR dllext[] = {'f','i','l','e','.','d','l','l',0};
933 static const WCHAR exeext[] = {'f','i','l','e','.','e','x','e',0};
934 static const WCHAR testdll[] = {'t','e','s','t','.','d','l','l',0};
935 static const WCHAR winedll[] = {'w','i','n','e','.','d','l','l',0};
936 static const WCHAR wine[] = {'w','i','n','e',0};
937
938 create_file("test.dll", 100);
939 create_assembly("wine.dll");
940
941 hr = pCreateAssemblyCache(&cache, 0);
942 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
943
944 /* NULL pszManifestFilePath */
945 hr = IAssemblyCache_InstallAssembly(cache, 0, NULL, NULL);
946 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
947
948 /* empty pszManifestFilePath */
949 hr = IAssemblyCache_InstallAssembly(cache, 0, empty, NULL);
950 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
951
952 /* pszManifestFilePath has no extension */
953 hr = IAssemblyCache_InstallAssembly(cache, 0, noext, NULL);
955 "Expected HRESULT_FROM_WIN32(ERROR_INVALID_NAME), got %08x\n", hr);
956
957 /* pszManifestFilePath has bad extension */
958 hr = IAssemblyCache_InstallAssembly(cache, 0, badext, NULL);
960 "Expected HRESULT_FROM_WIN32(ERROR_INVALID_NAME), got %08x\n", hr);
961
962 /* pszManifestFilePath has dll extension */
963 hr = IAssemblyCache_InstallAssembly(cache, 0, dllext, NULL);
965 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
966
967 /* pszManifestFilePath has exe extension */
968 hr = IAssemblyCache_InstallAssembly(cache, 0, exeext, NULL);
970 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
971
972 /* empty file */
973 hr = IAssemblyCache_InstallAssembly(cache, 0, testdll, NULL);
975 "Expected COR_E_ASSEMBLYEXPECTED, got %08x\n", hr);
976
977 /* wine assembly */
978 hr = IAssemblyCache_InstallAssembly(cache, 0, winedll, NULL);
979 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
980
982 strcat(dllpath, "\\assembly\\GAC_MSIL\\wine\\\\1.0.0.0__2d03617b1c31e2f5\\wine.dll");
983
985 ok(attr != INVALID_FILE_ATTRIBUTES, "Expected assembly to exist\n");
986
987 /* uninstall the assembly from the GAC */
988 disp = 0xf00dbad;
989 hr = IAssemblyCache_UninstallAssembly(cache, 0, wine, NULL, &disp);
990 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
991 ok(disp == IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED,
992 "Expected IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED, got %d\n", disp);
993
995 ok(attr == INVALID_FILE_ATTRIBUTES, "Expected assembly not to exist\n");
996
997 disp = 0xf00dbad;
998 hr = IAssemblyCache_UninstallAssembly(cache, 0, wine, NULL, &disp);
999 ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
1000 ok(disp == IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED,
1001 "Expected IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED, got %d\n", disp);
1002
1003 DeleteFileA("test.dll");
1004 DeleteFileA("wine.dll");
1005 IAssemblyCache_Release(cache);
1006}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define COR_E_ASSEMBLYEXPECTED
Definition: corerror.h:52
static const WCHAR empty[]
Definition: main.c:47
#define ERROR_INVALID_NAME
Definition: compat.h:103
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
WCHAR dllpath[MAX_PATH]
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define create_file(name, size)
Definition: asmcache.c:813
Definition: cookie.c:202
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define S_FALSE
Definition: winerror.h:2357
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by START_TEST().

◆ test_QueryAssemblyInfo()

static void test_QueryAssemblyInfo ( void  )
static

Definition at line 1015 of file asmcache.c.

1016{
1020 WCHAR asmpath[MAX_PATH];
1022 HRESULT hr;
1023 DWORD size;
1024 ULONG disp;
1025
1026 static const WCHAR empty[] = {0};
1027 static const WCHAR commasep[] = {',',' ',0};
1028 static const WCHAR winedll[] = {'w','i','n','e','.','d','l','l',0};
1029 static const WCHAR wine[] = {'w','i','n','e',0};
1030 static const WCHAR ver[] = {
1031 'V','e','r','s','i','o','n','=','1','.','0','.','0','.','0',0};
1032 static const WCHAR otherver[] = {
1033 'V','e','r','s','i','o','n','=','1','.','0','.','0','.','0','0','0','0','0',0};
1034 static const WCHAR badver[] = {
1035 'V','e','r','s','i','o','n','=','1','.','0','.','0','.','1',0};
1036 static const WCHAR culture[] = {
1037 'C','u','l','t','u','r','e','=','n','e','u','t','r','a','l',0};
1038 static const WCHAR badculture[] = {
1039 'C','u','l','t','u','r','e','=','e','n',0};
1040 static const WCHAR pubkey[] = {
1041 'P','u','b','l','i','c','K','e','y','T','o','k','e','n','=',
1042 '2','d','0','3','6','1','7','b','1','c','3','1','e','2','f','5',0};
1043 static const WCHAR badpubkey[] = {
1044 'P','u','b','l','i','c','K','e','y','T','o','k','e','n','=',
1045 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a',0};
1046 static const WCHAR badprop[] = {'B','a','d','P','r','o','p','=','b','u','h',0};
1047 static const WCHAR msil[] = {
1048 '_','M','S','I','L','\\','w','i','n','e','\\',
1049 '1','.','0','.','0','.','0','_','_','2','d','0','3','6','1','7','b',
1050 '1','c','3','1','e','2','f','5','\\',0};
1051 static const WCHAR wine2[] = {
1052 'w','i','n','e',',','v','e','r','s','i','o','n','=','1','.','0','.','0','.','1',',',
1053 'p','u','b','l','i','c','K','e','y','T','o','k','e','n','=',
1054 '2','d','0','3','6','1','7','b','1','c','3','1','e','2','f','5',',',
1055 'c','u','l','t','u','r','e','=','n','e','u','t','r','a','l',0};
1056 static const WCHAR nullpublickey[] = {
1057 'm','s','c','o','r','l','i','b','.','d','l','l',',','v','e','r','s','i','o','n','=','0','.','0','.',
1058 '0','.','0',',','c','u','l','t','u','r','e','=','n','e','u','t','r','a','l',',',
1059 'p','u','b','l','i','c','K','e','y','T','o','k','e','n','=','n','u','l','l',0};
1060 static const WCHAR nullpublickey1[] = {
1061 'm','s','c','o','r','l','i','b','.','d','l','l',',',
1062 'p','u','b','l','i','c','K','e','y','T','o','k','e','n','=','n','u','L','l',0};
1063
1064 size = MAX_PATH;
1065 hr = pGetCachePath(ASM_CACHE_GAC, asmpath, &size);
1066 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1067
1068 lstrcatW(asmpath, msil);
1069 lstrcatW(asmpath, winedll);
1070
1071 create_assembly("wine.dll");
1072
1073 hr = pCreateAssemblyCache(&cache, 0);
1074 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1075
1076 /* assembly not installed yet */
1077 INIT_ASM_INFO();
1078 hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, wine, &info);
1080 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
1081 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1082 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1083 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1084 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1085 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1086 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1087 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1088 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1089 "Assembly path was changed\n");
1090 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1091
1092 hr = IAssemblyCache_InstallAssembly(cache, 0, winedll, NULL);
1093 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1094
1095 /* NULL pszAssemblyName */
1096 INIT_ASM_INFO();
1097 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_VALIDATE,
1098 NULL, &info);
1099 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
1100 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1101 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1102 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1103 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1104 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1105 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1106 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1107 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1108 "Assembly path was changed\n");
1109 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1110
1111 /* empty pszAssemblyName */
1112 INIT_ASM_INFO();
1113 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_VALIDATE,
1114 empty, &info);
1115 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
1116 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1117 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1118 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1119 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1120 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1121 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1122 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1123 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1124 "Assembly path was changed\n");
1125 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1126
1127 /* no dwFlags */
1128 INIT_ASM_INFO();
1129 hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, wine, &info);
1130 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1131 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1132 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1133 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1134 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1135 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1136 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1137 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1138 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1139 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1140 "Wrong assembly path returned\n");
1141 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1142 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1143
1144 /* pwzCachePath is full filename */
1145 INIT_ASM_INFO();
1146 hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, winedll, &info);
1148 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
1149 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1150 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1151 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1152 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1153 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1154 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1155 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1156 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1157 "Assembly path was changed\n");
1158 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1159
1160 /* NULL pAsmInfo, QUERYASMINFO_FLAG_VALIDATE */
1161 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_VALIDATE,
1162 wine, NULL);
1163 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1164
1165 /* NULL pAsmInfo, QUERYASMINFO_FLAG_GETSIZE */
1166 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1167 wine, NULL);
1168 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1169
1170 /* info.cbAssemblyInfo is 0 */
1171 INIT_ASM_INFO();
1172 info.cbAssemblyInfo = 0;
1173 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_VALIDATE,
1174 wine, &info);
1175 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1176 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1177 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1178 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1179 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1180 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1181 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1182 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1183 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1184 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1185 "Wrong assembly path returned\n");
1186 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1187 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1188
1189 /* info.cbAssemblyInfo is 1 */
1190 INIT_ASM_INFO();
1191 info.cbAssemblyInfo = 1;
1192 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_VALIDATE,
1193 wine, &info);
1194 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
1195 ok(info.cbAssemblyInfo == 1, "Expected 1, got %d\n", info.cbAssemblyInfo);
1196 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1197 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1198 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1199 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1200 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1201 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1202 "Assembly path was changed\n");
1203 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1204
1205 /* info.cbAssemblyInfo is > sizeof(ASSEMBLY_INFO) */
1206 INIT_ASM_INFO();
1207 info.cbAssemblyInfo = sizeof(ASSEMBLY_INFO) * 2;
1208 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1209 wine, &info);
1210 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
1211 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO) * 2,
1212 "Expected sizeof(ASSEMBLY_INFO) * 2, got %d\n", info.cbAssemblyInfo);
1213 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1214 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1215 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1216 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1217 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1218 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1219 "Assembly path was changed\n");
1220 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1221
1222 /* QUERYASMINFO_FLAG_GETSIZE */
1223 INIT_ASM_INFO();
1224 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1225 wine, &info);
1226 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1227 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1228 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1229 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1230 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1231 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1232 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1233 todo_wine
1234 {
1235 ok((info.uliAssemblySizeInKB.u.LowPart == 4),
1236 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1237 }
1238 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1239 "Wrong assembly path returned\n");
1240 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1241 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1242
1243 /* QUERYASMINFO_FLAG_GETSIZE and QUERYASMINFO_FLAG_VALIDATE */
1244 INIT_ASM_INFO();
1245 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE |
1246 QUERYASMINFO_FLAG_VALIDATE,wine, &info);
1247 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1248 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1249 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1250 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1251 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1252 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1253 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1254 todo_wine
1255 {
1256 ok((info.uliAssemblySizeInKB.u.LowPart == 4),
1257 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1258 }
1259 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1260 "Wrong assembly path returned\n");
1261 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1262 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1263
1264 /* info.pszCurrentAssemblyPathBuf is NULL */
1265 INIT_ASM_INFO();
1266 info.pszCurrentAssemblyPathBuf = NULL;
1267 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1268 wine, &info);
1269 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1270 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1271 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1272 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1273 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1274 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1275 ok(hr == E_NOT_SUFFICIENT_BUFFER, "Expected E_NOT_SUFFICIENT_BUFFER, got %08x\n", hr);
1276 todo_wine
1277 {
1278 ok((info.uliAssemblySizeInKB.u.LowPart == 4),
1279 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1280 }
1281 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1282 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1283
1284 /* info.cchBuf is exactly size of asmpath */
1285 INIT_ASM_INFO();
1286 info.cchBuf = lstrlenW(asmpath);
1287 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1288 wine, &info);
1289 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1290 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1291 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1292 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1293 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1294 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1295 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1296 "Assembly path was changed\n");
1297 ok(hr == E_NOT_SUFFICIENT_BUFFER, "Expected E_NOT_SUFFICIENT_BUFFER, got %08x\n", hr);
1298 todo_wine
1299 {
1300 ok((info.uliAssemblySizeInKB.u.LowPart == 4),
1301 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1302 }
1303 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1304 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1305
1306 /* info.cchBuf has room for NULL-terminator */
1307 INIT_ASM_INFO();
1308 info.cchBuf = lstrlenW(asmpath) + 1;
1309 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1310 wine, &info);
1311 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1312 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1313 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1314 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1315 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1316 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1317 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1318 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1319 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1320 todo_wine
1321 {
1322 ok((info.uliAssemblySizeInKB.u.LowPart == 4),
1323 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1324 }
1325 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1326 "Wrong assembly path returned\n");
1327
1328 /* display name is "wine, Version=1.0.0.0" */
1329 INIT_ASM_INFO();
1330 lstrcpyW(name, wine);
1331 lstrcatW(name, commasep);
1332 lstrcatW(name, ver);
1333 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1334 name, &info);
1335 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1336 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1337 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1338 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1339 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1340 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1341 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1342 todo_wine
1343 {
1344 ok((info.uliAssemblySizeInKB.u.LowPart == 4),
1345 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1346 }
1347 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1348 "Wrong assembly path returned\n");
1349 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1350 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1351
1352 /* short buffer, QUERYASMINFO_FLAG_VALIDATE */
1353 memset(&info, 0, sizeof(info));
1354 lstrcpyW(name, wine);
1355 lstrcatW(name, commasep);
1356 lstrcatW(name, otherver);
1357 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_VALIDATE,
1358 name, &info);
1359 ok(hr == E_NOT_SUFFICIENT_BUFFER, "got %08x\n", hr);
1360 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED, "got %08x\n", info.dwAssemblyFlags);
1361
1362 /* short buffer, QUERYASMINFO_FLAG_GETSIZE */
1363 memset(&info, 0, sizeof(info));
1364 lstrcpyW(name, wine);
1365 lstrcatW(name, commasep);
1366 lstrcatW(name, otherver);
1367 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1368 name, &info);
1369 ok(hr == E_NOT_SUFFICIENT_BUFFER, "got %08x\n", hr);
1370 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED, "got %08x\n", info.dwAssemblyFlags);
1371
1372 /* display name is "wine, Version=1.0.0.00000" */
1373 INIT_ASM_INFO();
1374 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1375 name, &info);
1376 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1377 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1378 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1379 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1380 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1381 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1382 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1383 todo_wine
1384 {
1385 ok((info.uliAssemblySizeInKB.u.LowPart == 4),
1386 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1387 }
1388 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1389 "Wrong assembly path returned\n");
1390 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1391 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1392
1393 /* display name is "wine, Version=1.0.0.1", versions don't match */
1394 INIT_ASM_INFO();
1395 lstrcpyW(name, wine);
1396 lstrcatW(name, commasep);
1397 lstrcatW(name, badver);
1398 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1399 name, &info);
1401 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
1402 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1403 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1404 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1405 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1406 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1407 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1408 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1409 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1410 "Assembly path was changed\n");
1411 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1412
1413 /* display name is "wine,version=1.0.0.1,publicKeyToken=2d03617b1c31e2f5,culture=neutral" */
1414 INIT_ASM_INFO();
1415 lstrcpyW(name, wine2);
1416 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1417 name, &info);
1419 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
1420 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1421 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1422 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1423 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1424 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1425 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1426 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1427 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1428 "Assembly path was changed\n");
1429 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1430
1431 /* display name is "mscorlib.dll,version=0.0.0.0,culture=neutral,publicKeyToken=null" */
1432 INIT_ASM_INFO();
1433 lstrcpyW(name, nullpublickey);
1434 hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, name, &info);
1435 ok(hr == FUSION_E_PRIVATE_ASM_DISALLOWED, "got %08x\n", hr);
1436
1437 /* display name is "mscorlib.dll,publicKeyToken=nuLl" */
1438 INIT_ASM_INFO();
1439 lstrcpyW(name, nullpublickey1);
1440 hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, name, &info);
1441 ok(hr == FUSION_E_PRIVATE_ASM_DISALLOWED, "got %08x\n", hr);
1442
1443 /* display name is "wine, Culture=neutral" */
1444 INIT_ASM_INFO();
1445 lstrcpyW(name, wine);
1446 lstrcatW(name, commasep);
1448 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1449 name, &info);
1450 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1451 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1452 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1453 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1454 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1455 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1456 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1457 todo_wine
1458 {
1459 ok((info.uliAssemblySizeInKB.u.LowPart == 4),
1460 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1461 }
1462 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1463 "Wrong assembly path returned\n");
1464 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1465 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1466
1467 /* display name is "wine, Culture=en", cultures don't match */
1468 INIT_ASM_INFO();
1469 lstrcpyW(name, wine);
1470 lstrcatW(name, commasep);
1471 lstrcatW(name, badculture);
1472 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1473 name, &info);
1475 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
1476 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1477 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1478 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1479 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1480 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1481 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1482 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1483 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1484 "Assembly path was changed\n");
1485 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1486
1487 /* display name is "wine, PublicKeyTokens=2d03617b1c31e2f5" */
1488 INIT_ASM_INFO();
1489 lstrcpyW(name, wine);
1490 lstrcatW(name, commasep);
1492 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1493 name, &info);
1494 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1495 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1496 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1497 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1498 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1499 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1500 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1501 todo_wine
1502 {
1503 ok((info.uliAssemblySizeInKB.u.LowPart == 4),
1504 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1505 }
1506 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1507 "Wrong assembly path returned\n");
1508 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1509 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1510
1511 /* display name is "wine, PublicKeyToken=aaaaaaaaaaaaaaaa", pubkeys don't match */
1512 INIT_ASM_INFO();
1513 lstrcpyW(name, wine);
1514 lstrcatW(name, commasep);
1515 lstrcatW(name, badpubkey);
1516 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1517 name, &info);
1519 "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %08x\n", hr);
1520 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1521 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1522 ok(info.dwAssemblyFlags == 0, "Expected 0, got %08x\n", info.dwAssemblyFlags);
1523 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1524 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1525 ok(info.uliAssemblySizeInKB.u.LowPart == 0,
1526 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1527 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
1528 "Assembly path was changed\n");
1529 ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
1530
1531 /* display name is "wine, BadProp=buh", bad property */
1532 INIT_ASM_INFO();
1533 lstrcpyW(name, wine);
1534 lstrcatW(name, commasep);
1535 lstrcatW(name, badprop);
1536 hr = IAssemblyCache_QueryAssemblyInfo(cache, QUERYASMINFO_FLAG_GETSIZE,
1537 name, &info);
1538 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1539 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1540 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1541 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1542 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1543 ok(info.uliAssemblySizeInKB.u.HighPart == 0,
1544 "Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
1545 todo_wine
1546 {
1547 ok((info.uliAssemblySizeInKB.u.LowPart == 4),
1548 "Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
1549 }
1550 ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
1551 "Wrong assembly path returned\n");
1552 ok(info.cchBuf == lstrlenW(asmpath) + 1,
1553 "Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
1554
1555 /* no flags, display name is "wine, Version=1.0.0.0" */
1556 INIT_ASM_INFO();
1557 info.pszCurrentAssemblyPathBuf = NULL;
1558 info.cchBuf = 0;
1559 lstrcpyW(name, wine);
1560 lstrcatW(name, commasep);
1561 lstrcatW(name, ver);
1562 hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, name, &info);
1563 ok(hr == E_NOT_SUFFICIENT_BUFFER, "Expected E_NOT_SUFFICIENT_BUFFER, got %08x\n", hr);
1564 ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO),
1565 "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
1566 ok(info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED,
1567 "Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
1568
1569 /* uninstall the assembly from the GAC */
1570 disp = 0xf00dbad;
1571 hr = IAssemblyCache_UninstallAssembly(cache, 0, wine, NULL, &disp);
1572 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
1573 ok(disp == IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED,
1574 "Expected IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED, got %d\n", disp);
1575
1576 DeleteFileA("test.dll");
1577 DeleteFileA("wine.dll");
1578 IAssemblyCache_Release(cache);
1579}
#define FUSION_E_PRIVATE_ASM_DISALLOWED
Definition: corerror.h:122
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
static const WCHAR pubkey[]
Definition: asmname.c:68
static const WCHAR culture[]
Definition: asmname.c:67
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
#define ASSEMBLYINFO_FLAG_INSTALLED
Definition: fusion.idl:103
@ ASM_CACHE_GAC
Definition: fusion.idl:29
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define INIT_ASM_INFO()
Definition: asmcache.c:1008
#define todo_wine
Definition: custom.c:79
#define memset(x, y, z)
Definition: compat.h:39
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345

Referenced by START_TEST().

Variable Documentation

◆ assembly

◆ dwReserved

Definition at line 745 of file asmcache.c.

◆ pcchPath

◆ phModDll

LPCWSTR LPVOID HMODULE* phModDll

Definition at line 749 of file asmcache.c.

Referenced by LoadLibraryShim().

◆ pvReserved

LPCWSTR LPVOID pvReserved

Definition at line 749 of file asmcache.c.

◆ pwzCachePath

LPWSTR pwzCachePath

Definition at line 747 of file asmcache.c.

Referenced by GetCachePath().

◆ szVersion