2 * Copyright 2012 Hans Leidekker for CodeWeavers
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.
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.
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
26 #include "wine/test.h"
28 static void test_QueryAssemblyInfo( void )
30 static const WCHAR emptyW
[] = {0};
31 static const WCHAR wine1W
[] = {'w','i','n','e',0};
32 static const WCHAR wine2W
[] =
34 'v','e','r','s','i','o','n','=','\"','1','.','2','.','3','.','4','\"',0};
35 static const WCHAR wine3W
[] =
37 'v','e','r','s','i','o','n','=','\"','1','.','2','.','3','.','4','\"',',',
38 't','y','p','e','=','\"','w','i','n','3','2','\"',0};
39 static const WCHAR wine4W
[] =
41 'v','e','r','s','i','o','n','=','\"','1','.','2','.','3','.','4','\"',',',
42 't','y','p','e','=','\"','w','i','n','3','2','\"',',',
43 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=',
44 '\"','x','8','6','\"',0};
45 static const WCHAR wine5W
[] =
47 'v','e','r','s','i','o','n','=','\"','1','.','2','.','3','.','4','\"',',',
48 't','y','p','e','=','\"','w','i','n','3','2','\"',',',
49 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=',
50 '\"','x','8','6','\"',',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=',
51 '\"','1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f','\"',0};
52 static const WCHAR comctl1W
[] =
53 {'m','i','c','r','o','s','o','f','t','.','w','i','n','d','o','w','s','.',
54 'c','o','m','m','o','n','-','c','o','n','t','r','o','l','s',',',
55 'v','e','r','s','i','o','n','=','\"','6','.','0','.','2','6','0','0','.','2','9','8','2','\"',',',
56 't','y','p','e','=','\"','w','i','n','3','2','\"',',',
57 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=',
58 '\"','x','8','6','\"',',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=',
59 '\"','6','5','9','5','b','6','4','1','4','4','c','c','f','1','d','f','\"',0};
60 static const WCHAR comctl2W
[] =
61 {'m','i','c','r','o','s','o','f','t','.','w','i','n','d','o','w','s','.',
62 'c','o','m','m','o','n','-','c','o','n','t','r','o','l','s',',',
63 'v','e','r','s','i','o','n','=','\"','6','.','0','.','3','7','9','0','.','4','7','7','0','\"',',',
64 't','y','p','e','=','\"','w','i','n','3','2','\"',',',
65 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=',
66 '\"','x','8','6','\"',',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=',
67 '\"','6','5','9','5','b','6','4','1','4','4','c','c','f','1','d','f','\"',0};
68 static const WCHAR comctl3W
[] =
69 {'m','i','c','r','o','s','o','f','t','.','w','i','n','d','o','w','s','.',
70 'c','o','m','m','o','n','-','c','o','n','t','r','o','l','s',',',
71 'v','e','r','s','i','o','n','=','\"','6','.','0','.','8','2','5','0','.','0','\"',',',
72 't','y','p','e','=','\"','w','i','n','3','2','\"',',',
73 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=',
74 '\"','x','8','6','\"',',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=',
75 '\"','6','5','9','5','b','6','4','1','4','4','c','c','f','1','d','f','\"',0};
76 static const WCHAR comctl4W
[] =
77 {'m','i','c','r','o','s','o','f','t','.','w','i','n','d','o','w','s','.',
78 'c','o','m','m','o','n','-','c','o','n','t','r','o','l','s',',',
79 'v','e','r','s','i','o','n','=','\"','6','.','0','.','7','6','0','1','.','1','7','5','1','4','\"',',',
80 't','y','p','e','=','\"','w','i','n','3','2','\"',',',
81 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=',
82 '\"','x','8','6','\"',',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=',
83 '\"','6','5','9','5','b','6','4','1','4','4','c','c','f','1','d','f','\"',0};
86 IAssemblyCache
*cache
= NULL
;
88 char comctl_path1
[MAX_PATH
], comctl_path2
[MAX_PATH
], comctl_path3
[MAX_PATH
], comctl_path4
[MAX_PATH
];
91 hr
= CreateAssemblyCache( &cache
, 0 );
92 ok( hr
== S_OK
, "got %08x\n", hr
);
93 ok( cache
!= NULL
, "got %08x\n", hr
);
95 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, NULL
, NULL
);
96 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
98 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, emptyW
, NULL
);
99 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
101 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, wine1W
, NULL
);
102 ok( hr
== HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE
) ||
103 broken(hr
== E_INVALIDARG
) /* winxp */, "got %08x\n", hr
);
105 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, wine2W
, NULL
);
106 ok( hr
== HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE
) ||
107 broken(hr
== HRESULT_FROM_WIN32( ERROR_NOT_FOUND
)) /* winxp */, "got %08x\n", hr
);
109 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, wine3W
, NULL
);
110 ok( hr
== HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE
) ||
111 broken(hr
== HRESULT_FROM_WIN32( ERROR_NOT_FOUND
)) /* winxp */, "got %08x\n", hr
);
113 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, wine4W
, NULL
);
114 todo_wine
ok( hr
== HRESULT_FROM_WIN32( ERROR_NOT_FOUND
), "got %08x\n", hr
);
116 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, wine5W
, NULL
);
117 todo_wine
ok( hr
== HRESULT_FROM_WIN32( ERROR_NOT_FOUND
), "got %08x\n", hr
);
119 GetWindowsDirectoryA( comctl_path1
, MAX_PATH
);
120 lstrcatA( comctl_path1
, "\\winsxs\\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef" );
121 GetWindowsDirectoryA( comctl_path2
, MAX_PATH
);
122 lstrcatA( comctl_path2
, "\\winsxs\\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.3790.4770_x-ww_05fdf087" );
123 GetWindowsDirectoryA( comctl_path3
, MAX_PATH
);
124 lstrcatA( comctl_path3
, "\\winsxs\\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.8250.0_none_c119e7cca62b92bd" );
125 GetWindowsDirectoryA( comctl_path4
, MAX_PATH
);
126 lstrcatA( comctl_path4
, "\\winsxs\\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2" );
127 if (GetFileAttributesA( comctl_path1
) != INVALID_FILE_ATTRIBUTES
) comctlW
= comctl1W
;
128 else if (GetFileAttributesA( comctl_path2
) != INVALID_FILE_ATTRIBUTES
) comctlW
= comctl2W
;
129 else if (GetFileAttributesA( comctl_path3
) != INVALID_FILE_ATTRIBUTES
) comctlW
= comctl3W
;
130 else if (GetFileAttributesA( comctl_path4
) != INVALID_FILE_ATTRIBUTES
) comctlW
= comctl4W
;
133 skip( "no assembly to test with\n" );
134 IAssemblyCache_Release( cache
);
138 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, comctlW
, NULL
);
139 ok( hr
== S_OK
, "got %08x\n", hr
);
141 memset( &info
, 0, sizeof(info
) );
142 info
.cbAssemblyInfo
= sizeof(info
);
143 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, wine5W
, &info
);
144 todo_wine
ok( hr
== HRESULT_FROM_WIN32( ERROR_NOT_FOUND
), "got %08x\n", hr
);
146 memset( &info
, 0, sizeof(info
) );
147 info
.cbAssemblyInfo
= sizeof(info
);
148 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, comctlW
, &info
);
149 ok( hr
== S_OK
, "got %08x\n", hr
);
150 ok( info
.dwAssemblyFlags
== 1, "got %08x\n", info
.dwAssemblyFlags
);
151 ok( !info
.uliAssemblySizeInKB
.u
.LowPart
, "got %u\n", info
.uliAssemblySizeInKB
.u
.LowPart
);
152 ok( info
.pszCurrentAssemblyPathBuf
== NULL
, "got %p\n", info
.pszCurrentAssemblyPathBuf
);
153 ok( !info
.cchBuf
, "got %u\n", info
.cchBuf
);
155 memset( &info
, 0, sizeof(info
) );
156 info
.cbAssemblyInfo
= sizeof(info
);
157 info
.pszCurrentAssemblyPathBuf
= path
;
158 info
.cchBuf
= ARRAY_SIZE( path
);
159 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, comctlW
, &info
);
160 ok( hr
== S_OK
, "got %08x\n", hr
);
161 ok( info
.dwAssemblyFlags
== 1, "got %08x\n", info
.dwAssemblyFlags
);
162 ok( !info
.uliAssemblySizeInKB
.u
.LowPart
, "got %u\n", info
.uliAssemblySizeInKB
.u
.LowPart
);
163 ok( info
.cchBuf
== ARRAY_SIZE( path
), "got %u\n", info
.cchBuf
);
164 ok( path
[0], "empty path\n" );
166 memset( &info
, 0, sizeof(info
) );
167 info
.cbAssemblyInfo
= sizeof(info
);
168 info
.pszCurrentAssemblyPathBuf
= path
;
169 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 0, comctlW
, &info
);
170 ok( hr
== HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER
), "got %08x\n", hr
);
171 ok( info
.dwAssemblyFlags
== 1, "got %08x\n", info
.dwAssemblyFlags
);
172 ok( !info
.uliAssemblySizeInKB
.u
.LowPart
, "got %u\n", info
.uliAssemblySizeInKB
.u
.LowPart
);
173 ok( info
.cchBuf
, "got %u\n", info
.cchBuf
);
175 memset( &info
, 0, sizeof(info
) );
176 info
.cbAssemblyInfo
= sizeof(info
);
177 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 1, comctlW
, &info
);
178 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
179 ok( !info
.dwAssemblyFlags
, "got %08x\n", info
.dwAssemblyFlags
);
180 ok( !info
.uliAssemblySizeInKB
.u
.LowPart
, "got %u\n", info
.uliAssemblySizeInKB
.u
.LowPart
);
181 ok( info
.pszCurrentAssemblyPathBuf
== NULL
, "got %p\n", info
.pszCurrentAssemblyPathBuf
);
182 ok( !info
.cchBuf
, "got %u\n", info
.cchBuf
);
184 memset( &info
, 0, sizeof(info
) );
185 info
.cbAssemblyInfo
= sizeof(info
);
186 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 2, comctlW
, &info
);
187 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
188 ok( !info
.dwAssemblyFlags
, "got %08x\n", info
.dwAssemblyFlags
);
189 ok( !info
.uliAssemblySizeInKB
.u
.LowPart
, "got %u\n", info
.uliAssemblySizeInKB
.u
.LowPart
);
190 ok( info
.pszCurrentAssemblyPathBuf
== NULL
, "got %p\n", info
.pszCurrentAssemblyPathBuf
);
191 ok( !info
.cchBuf
, "got %u\n", info
.cchBuf
);
193 memset( &info
, 0, sizeof(info
) );
194 info
.cbAssemblyInfo
= sizeof(info
);
195 info
.pszCurrentAssemblyPathBuf
= path
;
196 info
.cchBuf
= ARRAY_SIZE( path
);
198 hr
= IAssemblyCache_QueryAssemblyInfo( cache
, 2, comctlW
, &info
);
199 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
200 ok( !info
.dwAssemblyFlags
, "got %08x\n", info
.dwAssemblyFlags
);
201 ok( !info
.uliAssemblySizeInKB
.u
.LowPart
, "got %u\n", info
.uliAssemblySizeInKB
.u
.LowPart
);
202 ok( info
.cchBuf
== ARRAY_SIZE( path
), "got %u\n", info
.cchBuf
);
203 ok( !path
[0], "got %s\n", wine_dbgstr_w(path
) );
205 IAssemblyCache_Release( cache
);
210 test_QueryAssemblyInfo();