hidclass.sys: Implement IOCTL_HID_SET_FEATURE.
[wine.git] / dlls / fusion / fusion.c
blobf9d57d19c73d781d6413d9f187d191d1f4af9ac8
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);
36 /******************************************************************
37 * InitializeFusion (FUSION.@)
39 HRESULT WINAPI InitializeFusion(void)
41 FIXME("\n");
42 return E_NOTIMPL;
45 /******************************************************************
46 * ClearDownloadCache (FUSION.@)
48 HRESULT WINAPI ClearDownloadCache(void)
50 FIXME("stub!\n");
51 return E_NOTIMPL;
54 /******************************************************************
55 * CopyPDBs (FUSION.@)
57 HRESULT WINAPI CopyPDBs(void *unknown)
59 FIXME("(%p) stub!\n", unknown);
60 return E_NOTIMPL;
63 /******************************************************************
64 * CreateInstallReferenceEnum (FUSION.@)
66 HRESULT WINAPI CreateInstallReferenceEnum(IInstallReferenceEnum **ppRefEnum,
67 IAssemblyName *pName, DWORD dwFlags,
68 LPVOID pvReserved)
70 FIXME("(%p, %p, %08x, %p) stub!\n", ppRefEnum, pName, dwFlags, pvReserved);
71 return E_NOTIMPL;
74 /******************************************************************
75 * CreateApplicationContext (FUSION.@)
77 HRESULT WINAPI CreateApplicationContext(IAssemblyName *name, void *ctx)
79 FIXME("%p, %p\n", name, ctx);
80 return E_NOTIMPL;
83 static HRESULT (WINAPI *pGetCORVersion)(LPWSTR pbuffer, DWORD cchBuffer,
84 DWORD *dwLength);
86 static HRESULT get_corversion(LPWSTR version, DWORD size)
88 HMODULE hmscoree;
89 HRESULT hr;
90 DWORD len;
92 hmscoree = LoadLibraryA("mscoree.dll");
93 if (!hmscoree)
94 return E_FAIL;
96 pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion");
97 if (!pGetCORVersion)
98 hr = E_FAIL;
99 else
100 hr = pGetCORVersion(version, size, &len);
102 FreeLibrary(hmscoree);
103 return hr;
106 /******************************************************************
107 * GetCachePath (FUSION.@)
109 HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
110 PDWORD pcchPath)
112 static const WCHAR assembly[] = {'\\','a','s','s','e','m','b','l','y',0};
113 static const WCHAR gac[] = {'\\','G','A','C',0};
114 static const WCHAR nativeimg[] = {'N','a','t','i','v','e','I','m','a','g','e','s','_',0};
115 static const WCHAR dotnet[] = {'\\','M','i','c','r','o','s','o','f','t','.','N','E','T',0};
116 #ifdef _WIN64
117 static const WCHAR zapfmt[] = {'%','s','\\','%','s','\\','%','s','%','s','_','6','4',0};
118 #else
119 static const WCHAR zapfmt[] = {'%','s','\\','%','s','\\','%','s','%','s','_','3','2',0};
120 #endif
121 WCHAR path[MAX_PATH], windir[MAX_PATH], version[MAX_PATH];
122 DWORD len;
123 HRESULT hr = S_OK;
125 TRACE("(%08x, %p, %p)\n", dwCacheFlags, pwzCachePath, pcchPath);
127 if (!pcchPath)
128 return E_INVALIDARG;
130 len = GetWindowsDirectoryW(windir, MAX_PATH);
131 strcpyW(path, windir);
133 switch (dwCacheFlags)
135 case ASM_CACHE_ZAP:
137 hr = get_corversion(version, MAX_PATH);
138 if (FAILED(hr))
139 return hr;
141 len = sprintfW(path, zapfmt, windir, assembly + 1, nativeimg, version);
142 break;
144 case ASM_CACHE_GAC:
146 strcpyW(path + len, assembly);
147 len += sizeof(assembly)/sizeof(WCHAR) - 1;
148 strcpyW(path + len, gac);
149 len += sizeof(gac)/sizeof(WCHAR) - 1;
150 break;
152 case ASM_CACHE_DOWNLOAD:
154 FIXME("Download cache not implemented\n");
155 return E_FAIL;
157 case ASM_CACHE_ROOT:
158 strcpyW(path + len, assembly);
159 len += sizeof(assembly)/sizeof(WCHAR) - 1;
160 break;
161 case ASM_CACHE_ROOT_EX:
162 strcpyW(path + len, dotnet);
163 len += sizeof(dotnet)/sizeof(WCHAR) - 1;
164 strcpyW(path + len, assembly);
165 len += sizeof(assembly)/sizeof(WCHAR) - 1;
166 break;
167 default:
168 return E_INVALIDARG;
171 len++;
172 if (*pcchPath <= len || !pwzCachePath)
173 hr = E_NOT_SUFFICIENT_BUFFER;
174 else if (pwzCachePath)
175 strcpyW(pwzCachePath, path);
177 *pcchPath = len;
178 return hr;