2 * Implementation of the Fusion API
4 * Copyright 2008 James Hawkins
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "wine/debug.h"
31 #include "wine/unicode.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(fusion);
35 /******************************************************************
36 * ClearDownloadCache (FUSION.@)
38 HRESULT WINAPI ClearDownloadCache(void)
44 /******************************************************************
45 * CompareAssemblyIdentity (FUSION.@)
47 HRESULT WINAPI CompareAssemblyIdentity(LPCWSTR pwzAssemblyIdentity1, BOOL fUnified1,
48 LPCWSTR pwzAssemblyIdentity2, BOOL fUnified2,
49 BOOL *pfEquivalent, AssemblyComparisonResult *pResult)
51 FIXME("(%s, %d, %s, %d, %p, %p) stub!\n", debugstr_w(pwzAssemblyIdentity1),
52 fUnified1, debugstr_w(pwzAssemblyIdentity2), fUnified2, pfEquivalent, pResult);
57 /******************************************************************
58 * CreateInstallReferenceEnum (FUSION.@)
60 HRESULT WINAPI CreateInstallReferenceEnum(IInstallReferenceEnum **ppRefEnum,
61 IAssemblyName *pName, DWORD dwFlags,
64 FIXME("(%p, %p, %08x, %p) stub!\n", ppRefEnum, pName, dwFlags, pvReserved);
68 /******************************************************************
69 * GetAssemblyIdentityFromFile (FUSION.@)
71 HRESULT WINAPI GetAssemblyIdentityFromFile(LPCWSTR pwzFilePath, REFIID riid,
72 IUnknown **ppIdentity)
74 FIXME("(%s, %s, %p) stub!\n", debugstr_w(pwzFilePath), debugstr_guid(riid),
80 static HRESULT (WINAPI *pGetCORVersion)(LPWSTR pbuffer, DWORD cchBuffer,
83 static HRESULT get_corversion(LPWSTR version, DWORD size)
89 hmscoree = LoadLibraryA("mscoree.dll");
93 pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion");
97 hr = pGetCORVersion(version, size, &len);
99 FreeLibrary(hmscoree);
103 /******************************************************************
104 * GetCachePath (FUSION.@)
106 HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
109 WCHAR path[MAX_PATH];
110 WCHAR windir[MAX_PATH];
111 WCHAR version[MAX_PATH];
115 static const WCHAR backslash[] = {'\\',0};
116 static const WCHAR assembly[] = {'a','s','s','e','m','b','l','y',0};
117 static const WCHAR gac[] = {'G','A','C',0};
118 static const WCHAR nativeimg[] = {
119 'N','a','t','i','v','e','I','m','a','g','e','s','_',0};
120 static const WCHAR zapfmt[] = {
121 '%','s','\\','%','s','\\','%','s','%','s','_','3','2',0};
123 TRACE("(%08x, %p, %p)\n", dwCacheFlags, pwzCachePath, pcchPath);
128 GetWindowsDirectoryW(windir, MAX_PATH);
129 lstrcpyW(path, windir);
130 lstrcatW(path, backslash);
131 lstrcatW(path, assembly);
133 switch (dwCacheFlags)
137 hr = get_corversion(version, MAX_PATH);
141 sprintfW(path, zapfmt, windir, assembly, nativeimg, version);
147 lstrcatW(path, backslash);
152 case ASM_CACHE_DOWNLOAD:
154 FIXME("Download cache not implemented\n");
159 break; /* already set */
165 len = lstrlenW(path) + 1;
166 if (*pcchPath <= len || !pwzCachePath)
167 hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
168 else if (pwzCachePath)
169 lstrcpyW(pwzCachePath, path);