comctl32: Simplify DATETIME_Char.
[wine/wine64.git] / dlls / fusion / fusion.c
blobac01cf415eeb02cb60e8a56f93f8e80bd921e449
1 /*
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
21 #include <stdarg.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
29 #include "fusion.h"
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)
40 FIXME("stub!\n");
41 return E_NOTIMPL;
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);
54 return E_NOTIMPL;
57 /******************************************************************
58 * CreateAssemblyEnum (FUSION.@)
60 HRESULT WINAPI CreateAssemblyEnum(IAssemblyEnum **pEnum, IUnknown *pUnkReserved,
61 IAssemblyName *pName, DWORD dwFlags, LPVOID pvReserved)
63 FIXME("(%p, %p, %p, %08x, %p) stub!\n", pEnum, pUnkReserved,
64 pName, dwFlags, pvReserved);
66 return E_NOTIMPL;
69 /******************************************************************
70 * CreateInstallReferenceEnum (FUSION.@)
72 HRESULT WINAPI CreateInstallReferenceEnum(IInstallReferenceEnum **ppRefEnum,
73 IAssemblyName *pName, DWORD dwFlags,
74 LPVOID pvReserved)
76 FIXME("(%p, %p, %08x, %p) stub!\n", ppRefEnum, pName, dwFlags, pvReserved);
77 return E_NOTIMPL;
80 /******************************************************************
81 * GetAssemblyIdentityFromFile (FUSION.@)
83 HRESULT WINAPI GetAssemblyIdentityFromFile(LPCWSTR pwzFilePath, REFIID riid,
84 IUnknown **ppIdentity)
86 FIXME("(%s, %s, %p) stub!\n", debugstr_w(pwzFilePath), debugstr_guid(riid),
87 ppIdentity);
89 return E_NOTIMPL;
92 static HRESULT (WINAPI *pGetCORVersion)(LPWSTR pbuffer, DWORD cchBuffer,
93 DWORD *dwLength);
95 static HRESULT get_corversion(LPWSTR version, DWORD size)
97 HMODULE hmscoree;
98 HRESULT hr;
99 DWORD len;
101 hmscoree = LoadLibraryA("mscoree.dll");
102 if (!hmscoree)
103 return E_FAIL;
105 pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion");
106 if (!pGetCORVersion)
107 return E_FAIL;
109 hr = pGetCORVersion(version, size, &len);
111 FreeLibrary(hmscoree);
112 return hr;
115 /******************************************************************
116 * GetCachePath (FUSION.@)
118 HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
119 PDWORD pcchPath)
121 WCHAR path[MAX_PATH];
122 WCHAR windir[MAX_PATH];
123 WCHAR version[MAX_PATH];
124 DWORD len;
125 HRESULT hr = S_OK;
127 static const WCHAR backslash[] = {'\\',0};
128 static const WCHAR assembly[] = {'a','s','s','e','m','b','l','y',0};
129 static const WCHAR gac[] = {'G','A','C',0};
130 static const WCHAR nativeimg[] = {
131 'N','a','t','i','v','e','I','m','a','g','e','s','_',0};
132 static const WCHAR zapfmt[] = {
133 '%','s','\\','%','s','\\','%','s','%','s','_','3','2',0};
135 TRACE("(%08x, %p, %p)\n", dwCacheFlags, pwzCachePath, pcchPath);
137 if (!pcchPath)
138 return E_INVALIDARG;
140 GetWindowsDirectoryW(windir, MAX_PATH);
141 lstrcpyW(path, windir);
142 lstrcatW(path, backslash);
143 lstrcatW(path, assembly);
145 switch (dwCacheFlags)
147 case ASM_CACHE_ZAP:
149 hr = get_corversion(version, MAX_PATH);
150 if (FAILED(hr))
151 return hr;
153 sprintfW(path, zapfmt, windir, assembly, nativeimg, version);
154 break;
157 case ASM_CACHE_GAC:
159 lstrcatW(path, backslash);
160 lstrcatW(path, gac);
161 break;
164 case ASM_CACHE_DOWNLOAD:
166 FIXME("Download cache not implemented\n");
167 return E_FAIL;
170 case ASM_CACHE_ROOT:
171 break; /* already set */
173 default:
174 return E_INVALIDARG;
177 len = lstrlenW(path) + 1;
178 if (*pcchPath <= len || !pwzCachePath)
179 hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
180 else if (pwzCachePath)
181 lstrcpyW(pwzCachePath, path);
183 *pcchPath = len;
185 return hr;