ReactOS 0.4.17-dev-966-gf06eace
cache.c File Reference
#include <stdio.h>
#include <windows.h>
#include <winsxs.h>
#include "wine/test.h"
Include dependency graph for cache.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

static void test_QueryAssemblyInfo (void)
 
 START_TEST (cache)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file cache.c.

Function Documentation

◆ START_TEST()

START_TEST ( cache  )

Definition at line 154 of file cache.c.

155{
157}
static void test_QueryAssemblyInfo(void)
Definition: cache.c:28

◆ test_QueryAssemblyInfo()

static void test_QueryAssemblyInfo ( void  )
static

Definition at line 28 of file cache.c.

29{
30 static const WCHAR wineW[] =
31 L"wine,version=\"1.2.3.4\",type=\"win32\",processorArchitecture=\"x86\",publicKeyToken=\"1234567890abcdef\"";
32 HRESULT hr;
36 char comctl_path1[MAX_PATH], comctl_path2[MAX_PATH];
37 const WCHAR *comctlW;
38
40 ok( hr == S_OK, "got %08lx\n", hr );
41 ok( cache != NULL, "got %08lx\n", hr );
42
43 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, NULL, NULL );
44 ok( hr == E_INVALIDARG, "got %08lx\n", hr );
45
46 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"", NULL );
47 ok( hr == E_INVALIDARG, "got %08lx\n", hr );
48
49 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine", NULL );
51
52 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine,version=\"1.2.3.4\"", NULL );
54
55 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine,version=\"1.2.3.4\",type=\"win32\"", NULL );
57
58 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine,version=\"1.2.3.4\",type=\"win32\",processorArchitecture=\"x86\"",
59 NULL );
60 todo_wine ok( hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND ), "got %08lx\n", hr );
61
62 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, wineW, NULL );
63 todo_wine ok( hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND ), "got %08lx\n", hr );
64
65 GetWindowsDirectoryA( comctl_path1, MAX_PATH );
66 lstrcatA( comctl_path1, "\\winsxs\\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef" );
67 GetWindowsDirectoryA( comctl_path2, MAX_PATH );
68 lstrcatA( comctl_path2, "\\winsxs\\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.3636_none_a863d714867441db" );
69 if (GetFileAttributesA( comctl_path1 ) != INVALID_FILE_ATTRIBUTES)
70 comctlW = L"microsoft.windows.common-controls,version=\"6.0.2600.2982\",type=\"win32\",processorArchitecture=\"x86\","
71 "publicKeyToken=\"6595b64144ccf1df\"";
72 else if (GetFileAttributesA( comctl_path2 ) != INVALID_FILE_ATTRIBUTES)
73 comctlW = L"microsoft.windows.common-controls,version=\"6.0.19041.3636\",type=\"win32\",processorArchitecture=\"x86\","
74 "publicKeyToken=\"6595b64144ccf1df\"";
75 else
76 {
77 skip( "no assembly to test with\n" );
78 IAssemblyCache_Release( cache );
79 return;
80 }
81
82 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, comctlW, NULL );
83 ok( hr == S_OK, "got %08lx\n", hr );
84
85 memset( &info, 0, sizeof(info) );
86 info.cbAssemblyInfo = sizeof(info);
87 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, wineW, &info );
88 todo_wine ok( hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND ), "got %08lx\n", hr );
89
90 memset( &info, 0, sizeof(info) );
91 info.cbAssemblyInfo = sizeof(info);
92 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, comctlW, &info );
93 ok( hr == S_OK, "got %08lx\n", hr );
94 ok( info.dwAssemblyFlags == 1, "got %08lx\n", info.dwAssemblyFlags );
95 ok( !info.uliAssemblySizeInKB.u.LowPart, "got %lu\n", info.uliAssemblySizeInKB.u.LowPart );
96 ok( info.pszCurrentAssemblyPathBuf == NULL, "got %p\n", info.pszCurrentAssemblyPathBuf );
97 ok( !info.cchBuf, "got %lu\n", info.cchBuf );
98
99 memset( &info, 0, sizeof(info) );
100 info.cbAssemblyInfo = sizeof(info);
101 info.pszCurrentAssemblyPathBuf = path;
102 info.cchBuf = ARRAY_SIZE( path );
103 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, comctlW, &info );
104 ok( hr == S_OK, "got %08lx\n", hr );
105 ok( info.dwAssemblyFlags == 1, "got %08lx\n", info.dwAssemblyFlags );
106 ok( !info.uliAssemblySizeInKB.u.LowPart, "got %lu\n", info.uliAssemblySizeInKB.u.LowPart );
107 ok( info.cchBuf == ARRAY_SIZE( path ), "got %lu\n", info.cchBuf );
108 ok( path[0], "empty path\n" );
109 lstrcatW( path, L"comctl32.dll" );
110 ok( GetFileAttributesW( path ) != INVALID_FILE_ATTRIBUTES, "%s should exist\n", wine_dbgstr_w( path ));
111
112 memset( &info, 0, sizeof(info) );
113 info.cbAssemblyInfo = sizeof(info);
114 info.pszCurrentAssemblyPathBuf = path;
115 hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, comctlW, &info );
116 ok( hr == HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER ), "got %08lx\n", hr );
117 ok( info.dwAssemblyFlags == 1, "got %08lx\n", info.dwAssemblyFlags );
118 ok( !info.uliAssemblySizeInKB.u.LowPart, "got %lu\n", info.uliAssemblySizeInKB.u.LowPart );
119 ok( info.cchBuf, "got %lu\n", info.cchBuf );
120
121 memset( &info, 0, sizeof(info) );
122 info.cbAssemblyInfo = sizeof(info);
123 hr = IAssemblyCache_QueryAssemblyInfo( cache, 1, comctlW, &info );
124 ok( hr == E_INVALIDARG, "got %08lx\n", hr );
125 ok( !info.dwAssemblyFlags, "got %08lx\n", info.dwAssemblyFlags );
126 ok( !info.uliAssemblySizeInKB.u.LowPart, "got %lu\n", info.uliAssemblySizeInKB.u.LowPart );
127 ok( info.pszCurrentAssemblyPathBuf == NULL, "got %p\n", info.pszCurrentAssemblyPathBuf );
128 ok( !info.cchBuf, "got %lu\n", info.cchBuf );
129
130 memset( &info, 0, sizeof(info) );
131 info.cbAssemblyInfo = sizeof(info);
132 hr = IAssemblyCache_QueryAssemblyInfo( cache, 2, comctlW, &info );
133 ok( hr == E_INVALIDARG, "got %08lx\n", hr );
134 ok( !info.dwAssemblyFlags, "got %08lx\n", info.dwAssemblyFlags );
135 ok( !info.uliAssemblySizeInKB.u.LowPart, "got %lu\n", info.uliAssemblySizeInKB.u.LowPart );
136 ok( info.pszCurrentAssemblyPathBuf == NULL, "got %p\n", info.pszCurrentAssemblyPathBuf );
137 ok( !info.cchBuf, "got %lu\n", info.cchBuf );
138
139 memset( &info, 0, sizeof(info) );
140 info.cbAssemblyInfo = sizeof(info);
141 info.pszCurrentAssemblyPathBuf = path;
142 info.cchBuf = ARRAY_SIZE( path );
143 path[0] = 0;
144 hr = IAssemblyCache_QueryAssemblyInfo( cache, 2, comctlW, &info );
145 ok( hr == E_INVALIDARG, "got %08lx\n", hr );
146 ok( !info.dwAssemblyFlags, "got %08lx\n", info.dwAssemblyFlags );
147 ok( !info.uliAssemblySizeInKB.u.LowPart, "got %lu\n", info.uliAssemblySizeInKB.u.LowPart );
148 ok( info.cchBuf == ARRAY_SIZE( path ), "got %lu\n", info.cchBuf );
149 ok( !path[0], "got %s\n", wine_dbgstr_w(path) );
150
151 IAssemblyCache_Release( cache );
152}
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define ARRAY_SIZE(A)
Definition: main.h:20
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved)
Definition: asmcache.c:555
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:636
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:620
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2355
#define L(x)
Definition: resources.c:13
#define S_OK
Definition: intsafe.h:52
#define wine_dbgstr_w
Definition: kernel32.h:34
static WCHAR wineW[]
Definition: localmon.c:128
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define todo_wine
Definition: minitest.h:80
short WCHAR
Definition: pedump.c:58
#define memset(x, y, z)
Definition: compat.h:39
Definition: cache.c:41
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE
Definition: winerror.h:3173
#define ERROR_NOT_FOUND
Definition: winerror.h:1014

Referenced by START_TEST().