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
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(fusion
);
38 /******************************************************************
39 * InitializeFusion (FUSION.@)
41 HRESULT WINAPI
InitializeFusion(void)
47 /******************************************************************
48 * ClearDownloadCache (FUSION.@)
50 HRESULT WINAPI
ClearDownloadCache(void)
56 /******************************************************************
59 HRESULT WINAPI
CopyPDBs(void *unknown
)
61 FIXME("(%p) stub!\n", unknown
);
65 /******************************************************************
66 * CreateInstallReferenceEnum (FUSION.@)
68 HRESULT WINAPI
CreateInstallReferenceEnum(IInstallReferenceEnum
**ppRefEnum
,
69 IAssemblyName
*pName
, DWORD dwFlags
,
72 FIXME("(%p, %p, %08x, %p) stub!\n", ppRefEnum
, pName
, dwFlags
, pvReserved
);
76 /******************************************************************
77 * CreateApplicationContext (FUSION.@)
79 HRESULT WINAPI
CreateApplicationContext(IAssemblyName
*name
, void *ctx
)
81 FIXME("%p, %p\n", name
, ctx
);
85 static HRESULT (WINAPI
*pGetCORVersion
)(LPWSTR pbuffer
, DWORD cchBuffer
,
88 static HRESULT
get_corversion(LPWSTR version
, DWORD size
)
94 hmscoree
= LoadLibraryA("mscoree.dll");
98 pGetCORVersion
= (void *)GetProcAddress(hmscoree
, "GetCORVersion");
102 hr
= pGetCORVersion(version
, size
, &len
);
104 FreeLibrary(hmscoree
);
108 /******************************************************************
109 * GetCachePath (FUSION.@)
111 HRESULT WINAPI
GetCachePath(ASM_CACHE_FLAGS dwCacheFlags
, LPWSTR pwzCachePath
,
114 static const WCHAR assembly
[] = {'\\','a','s','s','e','m','b','l','y',0};
115 static const WCHAR gac
[] = {'\\','G','A','C',0};
116 static const WCHAR nativeimg
[] = {'N','a','t','i','v','e','I','m','a','g','e','s','_',0};
117 static const WCHAR dotnet
[] = {'\\','M','i','c','r','o','s','o','f','t','.','N','E','T',0};
119 static const WCHAR zapfmt
[] = {'%','s','\\','%','s','\\','%','s','%','s','_','6','4',0};
121 static const WCHAR zapfmt
[] = {'%','s','\\','%','s','\\','%','s','%','s','_','3','2',0};
123 WCHAR path
[MAX_PATH
], windir
[MAX_PATH
], version
[MAX_PATH
];
127 TRACE("(%08x, %p, %p)\n", dwCacheFlags
, pwzCachePath
, pcchPath
);
132 len
= GetWindowsDirectoryW(windir
, MAX_PATH
);
133 lstrcpyW(path
, windir
);
135 switch (dwCacheFlags
)
139 hr
= get_corversion(version
, MAX_PATH
);
143 len
= swprintf(path
, zapfmt
, windir
, assembly
+ 1, nativeimg
, version
);
148 lstrcpyW(path
+ len
, assembly
);
149 len
+= ARRAY_SIZE(assembly
) - 1;
150 lstrcpyW(path
+ len
, gac
);
151 len
+= ARRAY_SIZE(gac
) - 1;
154 case ASM_CACHE_DOWNLOAD
:
156 FIXME("Download cache not implemented\n");
160 lstrcpyW(path
+ len
, assembly
);
161 len
+= ARRAY_SIZE(assembly
) - 1;
163 case ASM_CACHE_ROOT_EX
:
164 lstrcpyW(path
+ len
, dotnet
);
165 len
+= ARRAY_SIZE(dotnet
) - 1;
166 lstrcpyW(path
+ len
, assembly
);
167 len
+= ARRAY_SIZE(assembly
) - 1;
174 if (*pcchPath
<= len
|| !pwzCachePath
)
175 hr
= E_NOT_SUFFICIENT_BUFFER
;
176 else if (pwzCachePath
)
177 lstrcpyW(pwzCachePath
, path
);