wininet: Added support for INTERNET_COOKIE_HTTPONLY flag to InternetSetCookieEx.
[wine/multimedia.git] / dlls / fusion / fusion.c
blobe63820804398c3c4c90ab87278a37ca03980e7ee
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 * CreateInstallReferenceEnum (FUSION.@)
57 HRESULT WINAPI CreateInstallReferenceEnum(IInstallReferenceEnum **ppRefEnum,
58 IAssemblyName *pName, DWORD dwFlags,
59 LPVOID pvReserved)
61 FIXME("(%p, %p, %08x, %p) stub!\n", ppRefEnum, pName, dwFlags, pvReserved);
62 return E_NOTIMPL;
65 /******************************************************************
66 * CreateApplicationContext (FUSION.@)
68 HRESULT WINAPI CreateApplicationContext(IAssemblyName *name, void *ctx)
70 FIXME("%p, %p\n", name, ctx);
71 return E_NOTIMPL;
74 static HRESULT (WINAPI *pGetCORVersion)(LPWSTR pbuffer, DWORD cchBuffer,
75 DWORD *dwLength);
77 static HRESULT get_corversion(LPWSTR version, DWORD size)
79 HMODULE hmscoree;
80 HRESULT hr;
81 DWORD len;
83 hmscoree = LoadLibraryA("mscoree.dll");
84 if (!hmscoree)
85 return E_FAIL;
87 pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion");
88 if (!pGetCORVersion)
89 hr = E_FAIL;
90 else
91 hr = pGetCORVersion(version, size, &len);
93 FreeLibrary(hmscoree);
94 return hr;
97 /******************************************************************
98 * GetCachePath (FUSION.@)
100 HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
101 PDWORD pcchPath)
103 static const WCHAR assembly[] = {'\\','a','s','s','e','m','b','l','y',0};
104 static const WCHAR gac[] = {'\\','G','A','C',0};
105 static const WCHAR nativeimg[] = {'N','a','t','i','v','e','I','m','a','g','e','s','_',0};
106 static const WCHAR dotnet[] = {'\\','M','i','c','r','o','s','o','f','t','.','N','E','T',0};
107 #ifdef _WIN64
108 static const WCHAR zapfmt[] = {'%','s','\\','%','s','\\','%','s','%','s','_','6','4',0};
109 #else
110 static const WCHAR zapfmt[] = {'%','s','\\','%','s','\\','%','s','%','s','_','3','2',0};
111 #endif
112 WCHAR path[MAX_PATH], windir[MAX_PATH], version[MAX_PATH];
113 DWORD len;
114 HRESULT hr = S_OK;
116 TRACE("(%08x, %p, %p)\n", dwCacheFlags, pwzCachePath, pcchPath);
118 if (!pcchPath)
119 return E_INVALIDARG;
121 len = GetWindowsDirectoryW(windir, MAX_PATH);
122 strcpyW(path, windir);
124 switch (dwCacheFlags)
126 case ASM_CACHE_ZAP:
128 hr = get_corversion(version, MAX_PATH);
129 if (FAILED(hr))
130 return hr;
132 len = sprintfW(path, zapfmt, windir, assembly + 1, nativeimg, version);
133 break;
135 case ASM_CACHE_GAC:
137 strcpyW(path + len, assembly);
138 len += sizeof(assembly)/sizeof(WCHAR) - 1;
139 strcpyW(path + len, gac);
140 len += sizeof(gac)/sizeof(WCHAR) - 1;
141 break;
143 case ASM_CACHE_DOWNLOAD:
145 FIXME("Download cache not implemented\n");
146 return E_FAIL;
148 case ASM_CACHE_ROOT:
149 strcpyW(path + len, assembly);
150 len += sizeof(assembly)/sizeof(WCHAR) - 1;
151 break;
152 case ASM_CACHE_ROOT_EX:
153 strcpyW(path + len, dotnet);
154 len += sizeof(dotnet)/sizeof(WCHAR) - 1;
155 strcpyW(path + len, assembly);
156 len += sizeof(assembly)/sizeof(WCHAR) - 1;
157 break;
158 default:
159 return E_INVALIDARG;
162 len++;
163 if (*pcchPath <= len || !pwzCachePath)
164 hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
165 else if (pwzCachePath)
166 strcpyW(pwzCachePath, path);
168 *pcchPath = len;
169 return hr;