ReactOS 0.4.16-dev-87-g3dfbe52
fusion.c File Reference
#include <windows.h>
#include <fusion.h>
#include "wine/test.h"
Include dependency graph for fusion.c:

Go to the source code of this file.

Functions

static HRESULT (WINAPI *pGetCachePath)(ASM_CACHE_FLAGS dwCacheFlags
 
static BOOL init_functionpointers (void)
 
static void test_GetCachePath (void)
 
 START_TEST (fusion)
 

Variables

static HMODULE hmscoree
 
static LPWSTR pwzCachePath
 
static LPWSTR PDWORD pcchPath
 
static LPCWSTR szVersion
 
static LPCWSTR LPVOID pvReserved
 
static LPCWSTR LPVOID HMODULEphModDll
 
static DWORD cchBuffer
 
static DWORD DWORDdwLength
 

Function Documentation

◆ HRESULT()

static HRESULT ( WINAPI pGetCachePath)
static

◆ init_functionpointers()

static BOOL init_functionpointers ( void  )
static

Definition at line 33 of file fusion.c.

34{
35 HRESULT hr;
36 HMODULE hfusion;
37
38 static const WCHAR szFusion[] = {'f','u','s','i','o','n','.','d','l','l',0};
39
40 hmscoree = LoadLibraryA("mscoree.dll");
41 if (!hmscoree)
42 {
43 win_skip("mscoree.dll not available\n");
44 return FALSE;
45 }
46
47 pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim");
48 if (!pLoadLibraryShim)
49 {
50 win_skip("LoadLibraryShim not available\n");
52 return FALSE;
53 }
54
55 pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion");
56
57 hr = pLoadLibraryShim(szFusion, NULL, NULL, &hfusion);
58 if (FAILED(hr))
59 {
60 win_skip("fusion.dll not available\n");
62 return FALSE;
63 }
64
65 pGetCachePath = (void *)GetProcAddress(hfusion, "GetCachePath");
66 return TRUE;
67}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#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
#define win_skip
Definition: test.h:163
HRESULT hr
Definition: shlfolder.c:183
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( fusion  )

Definition at line 194 of file fusion.c.

195{
197 return;
198
200
202}
static BOOL init_functionpointers(void)
Definition: fusion.c:33
static void test_GetCachePath(void)
Definition: fusion.c:69

◆ test_GetCachePath()

static void test_GetCachePath ( void  )
static

Definition at line 69 of file fusion.c.

70{
71 CHAR windirA[MAX_PATH];
72 WCHAR windir[MAX_PATH];
73 WCHAR cachepath[MAX_PATH];
76 DWORD size;
77 HRESULT hr;
78
79 static const WCHAR backslash[] = {'\\',0};
80 static const WCHAR nochange[] = {'n','o','c','h','a','n','g','e',0};
81 static const WCHAR assembly[] = {'a','s','s','e','m','b','l','y',0};
82 static const WCHAR gac[] = {'G','A','C',0};
83
84 if (!pGetCachePath)
85 {
86 win_skip("GetCachePath not implemented\n");
87 return;
88 }
89
91 MultiByteToWideChar(CP_ACP, 0, windirA, -1, windir, MAX_PATH);
92 lstrcpyW(cachepath, windir);
93 lstrcatW(cachepath, backslash);
94 lstrcatW(cachepath, assembly);
95 lstrcatW(cachepath, backslash);
96 lstrcatW(cachepath, gac);
97
98 /* NULL pwzCachePath, pcchPath is 0 */
99 size = 0;
100 hr = pGetCachePath(ASM_CACHE_GAC, NULL, &size);
101 ok(hr == E_NOT_SUFFICIENT_BUFFER, "Expected E_NOT_SUFFICIENT_BUFFER, got %08x\n", hr);
102 ok(size == lstrlenW(cachepath) + 1,
103 "Expected %d, got %d\n", lstrlenW(cachepath) + 1, size);
104
105 /* NULL pwszCachePath, pcchPath is MAX_PATH */
106 size = MAX_PATH;
107 hr = pGetCachePath(ASM_CACHE_GAC, NULL, &size);
108 ok(hr == E_NOT_SUFFICIENT_BUFFER, "Expected E_NOT_SUFFICIENT_BUFFER, got %08x\n", hr);
109 ok(size == lstrlenW(cachepath) + 1,
110 "Expected %d, got %d\n", lstrlenW(cachepath) + 1, size);
111
112 /* both pwszCachePath and pcchPath NULL */
113 hr = pGetCachePath(ASM_CACHE_GAC, NULL, NULL);
114 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
115
116 /* NULL pcchPath */
117 lstrcpyW(path, nochange);
118 hr = pGetCachePath(ASM_CACHE_GAC, path, NULL);
119 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
120 ok( !lstrcmpW( nochange, path ), "Expected %s, got %s\n", wine_dbgstr_w(nochange), wine_dbgstr_w(path));
121
122 /* get the cache path */
123 lstrcpyW(path, nochange);
124 size = MAX_PATH;
125 hr = pGetCachePath(ASM_CACHE_GAC, path, &size);
126 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
127 ok( !lstrcmpW( cachepath, path ), "Expected %s, got %s\n", wine_dbgstr_w(cachepath), wine_dbgstr_w(path));
128
129 /* pcchPath has no room for NULL terminator */
130 lstrcpyW(path, nochange);
131 size = lstrlenW(cachepath);
132 hr = pGetCachePath(ASM_CACHE_GAC, path, &size);
133 ok(hr == E_NOT_SUFFICIENT_BUFFER, "Expected E_NOT_SUFFICIENT_BUFFER, got %08x\n", hr);
134 ok( !lstrcmpW( nochange, path ), "Expected %s, got %s\n", wine_dbgstr_w(nochange), wine_dbgstr_w(path));
135
136 lstrcpyW(cachepath, windir);
137 lstrcatW(cachepath, backslash);
138 lstrcatW(cachepath, assembly);
139
140 /* ASM_CACHE_ROOT */
141 lstrcpyW(path, nochange);
142 size = MAX_PATH;
143 hr = pGetCachePath(ASM_CACHE_ROOT, path, &size);
144 ok(hr == S_OK ||
145 broken(hr == E_INVALIDARG), /* .NET 1.1 */
146 "Expected S_OK, got %08x\n", hr);
147 if (hr == S_OK)
148 ok( !lstrcmpW( cachepath, path ), "Expected %s, got %s\n", wine_dbgstr_w(cachepath), wine_dbgstr_w(path));
149
150 if (pGetCORVersion)
151 {
152 CHAR versionA[MAX_PATH];
153 CHAR cachepathA[MAX_PATH];
154 CHAR nativeimgA[MAX_PATH];
155 CHAR zapfmtA[MAX_PATH];
156
157 if (hr == S_OK)
158 {
159 lstrcpyA(nativeimgA, "NativeImages_");
160#ifdef _WIN64
161 lstrcpyA(zapfmtA, "%s\\%s\\%s%s_64");
162#else
163 lstrcpyA(zapfmtA, "%s\\%s\\%s%s_32");
164#endif
165 }
166 else
167 {
168 lstrcpyA(nativeimgA, "NativeImages1_");
169 lstrcpyA(zapfmtA, "%s\\%s\\%s%s");
170 }
171
172 pGetCORVersion(version, MAX_PATH, &size);
173 WideCharToMultiByte(CP_ACP, 0, version, -1, versionA, MAX_PATH, 0, 0);
174
175 wsprintfA(cachepathA, zapfmtA, windirA, "assembly", nativeimgA, versionA);
176 MultiByteToWideChar(CP_ACP, 0, cachepathA, -1, cachepath, MAX_PATH);
177
178 /* ASM_CACHE_ZAP */
179 lstrcpyW(path, nochange);
180 size = MAX_PATH;
181 hr = pGetCachePath(ASM_CACHE_ZAP, path, &size);
182 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
183 ok( !lstrcmpW( cachepath, path ), "Expected %s, got %s\n", wine_dbgstr_w(cachepath), wine_dbgstr_w(path));
184 }
185
186 /* two flags at once */
187 lstrcpyW(path, nochange);
188 size = MAX_PATH;
189 hr = pGetCachePath(ASM_CACHE_GAC | ASM_CACHE_ROOT, path, &size);
190 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
191 ok( !lstrcmpW( nochange, path ), "Expected %s, got %s\n", wine_dbgstr_w(nochange), wine_dbgstr_w(path));
192}
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define E_INVALIDARG
Definition: ddrawi.h:101
#define CP_ACP
Definition: compat.h:109
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
static const WCHAR version[]
Definition: asmname.c:66
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
unsigned long DWORD
Definition: ntddk_ex.h:95
@ ASM_CACHE_ROOT
Definition: fusion.idl:31
@ ASM_CACHE_GAC
Definition: fusion.idl:29
@ ASM_CACHE_ZAP
Definition: fusion.idl:28
GLsizeiptr size
Definition: glext.h:5919
#define S_OK
Definition: intsafe.h:52
#define wine_dbgstr_w
Definition: kernel32.h:34
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

Variable Documentation

◆ cchBuffer

DWORD cchBuffer

Definition at line 30 of file fusion.c.

◆ dwLength

DWORD DWORD* dwLength

Definition at line 31 of file fusion.c.

◆ hmscoree

HMODULE hmscoree
static

Definition at line 24 of file fusion.c.

Referenced by exit(), get_corversion(), init_functionpointers(), and START_TEST().

◆ pcchPath

LPWSTR PDWORD pcchPath

Definition at line 27 of file fusion.c.

◆ phModDll

LPCWSTR LPVOID HMODULE* phModDll

Definition at line 29 of file fusion.c.

◆ pvReserved

LPCWSTR LPVOID pvReserved

Definition at line 29 of file fusion.c.

◆ pwzCachePath

LPWSTR pwzCachePath

Definition at line 27 of file fusion.c.

◆ szVersion

LPCWSTR szVersion

Definition at line 28 of file fusion.c.