Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenfusion.c
Go to the documentation of this file.
00001 /* 00002 * Implementation of the Fusion API 00003 * 00004 * Copyright 2008 James Hawkins 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #include <stdarg.h> 00022 00023 #define COBJMACROS 00024 00025 #include "windef.h" 00026 #include "winbase.h" 00027 #include "winuser.h" 00028 #include "ole2.h" 00029 #include "fusion.h" 00030 #include "wine/debug.h" 00031 #include "wine/unicode.h" 00032 00033 WINE_DEFAULT_DEBUG_CHANNEL(fusion); 00034 00035 /****************************************************************** 00036 * ClearDownloadCache (FUSION.@) 00037 */ 00038 HRESULT WINAPI ClearDownloadCache(void) 00039 { 00040 FIXME("stub!\n"); 00041 return E_NOTIMPL; 00042 } 00043 00044 /****************************************************************** 00045 * CreateInstallReferenceEnum (FUSION.@) 00046 */ 00047 HRESULT WINAPI CreateInstallReferenceEnum(IInstallReferenceEnum **ppRefEnum, 00048 IAssemblyName *pName, DWORD dwFlags, 00049 LPVOID pvReserved) 00050 { 00051 FIXME("(%p, %p, %08x, %p) stub!\n", ppRefEnum, pName, dwFlags, pvReserved); 00052 return E_NOTIMPL; 00053 } 00054 00055 /****************************************************************** 00056 * CreateApplicationContext (FUSION.@) 00057 */ 00058 HRESULT WINAPI CreateApplicationContext(IAssemblyName *name, void *ctx) 00059 { 00060 FIXME("%p, %p\n", name, ctx); 00061 return E_NOTIMPL; 00062 } 00063 00064 static HRESULT (WINAPI *pGetCORVersion)(LPWSTR pbuffer, DWORD cchBuffer, 00065 DWORD *dwLength); 00066 00067 static HRESULT get_corversion(LPWSTR version, DWORD size) 00068 { 00069 HMODULE hmscoree; 00070 HRESULT hr; 00071 DWORD len; 00072 00073 hmscoree = LoadLibraryA("mscoree.dll"); 00074 if (!hmscoree) 00075 return E_FAIL; 00076 00077 pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion"); 00078 if (!pGetCORVersion) 00079 return E_FAIL; 00080 00081 hr = pGetCORVersion(version, size, &len); 00082 00083 FreeLibrary(hmscoree); 00084 return hr; 00085 } 00086 00087 /****************************************************************** 00088 * GetCachePath (FUSION.@) 00089 */ 00090 HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath, 00091 PDWORD pcchPath) 00092 { 00093 WCHAR path[MAX_PATH]; 00094 WCHAR windir[MAX_PATH]; 00095 WCHAR version[MAX_PATH]; 00096 DWORD len; 00097 HRESULT hr = S_OK; 00098 00099 static const WCHAR backslash[] = {'\\',0}; 00100 static const WCHAR assembly[] = {'a','s','s','e','m','b','l','y',0}; 00101 static const WCHAR gac[] = {'G','A','C',0}; 00102 static const WCHAR nativeimg[] = { 00103 'N','a','t','i','v','e','I','m','a','g','e','s','_',0}; 00104 #ifdef _WIN64 00105 static const WCHAR zapfmt[] = {'%','s','\\','%','s','\\','%','s','%','s','_','6','4',0}; 00106 #else 00107 static const WCHAR zapfmt[] = {'%','s','\\','%','s','\\','%','s','%','s','_','3','2',0}; 00108 #endif 00109 00110 TRACE("(%08x, %p, %p)\n", dwCacheFlags, pwzCachePath, pcchPath); 00111 00112 if (!pcchPath) 00113 return E_INVALIDARG; 00114 00115 GetWindowsDirectoryW(windir, MAX_PATH); 00116 lstrcpyW(path, windir); 00117 lstrcatW(path, backslash); 00118 lstrcatW(path, assembly); 00119 00120 switch (dwCacheFlags) 00121 { 00122 case ASM_CACHE_ZAP: 00123 { 00124 hr = get_corversion(version, MAX_PATH); 00125 if (FAILED(hr)) 00126 return hr; 00127 00128 sprintfW(path, zapfmt, windir, assembly, nativeimg, version); 00129 break; 00130 } 00131 00132 case ASM_CACHE_GAC: 00133 { 00134 lstrcatW(path, backslash); 00135 lstrcatW(path, gac); 00136 break; 00137 } 00138 00139 case ASM_CACHE_DOWNLOAD: 00140 { 00141 FIXME("Download cache not implemented\n"); 00142 return E_FAIL; 00143 } 00144 00145 case ASM_CACHE_ROOT: 00146 break; /* already set */ 00147 00148 default: 00149 return E_INVALIDARG; 00150 } 00151 00152 len = lstrlenW(path) + 1; 00153 if (*pcchPath <= len || !pwzCachePath) 00154 hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); 00155 else if (pwzCachePath) 00156 lstrcpyW(pwzCachePath, path); 00157 00158 *pcchPath = len; 00159 00160 return hr; 00161 } Generated on Sat May 26 2012 04:22:08 for ReactOS by
1.7.6.1
|