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 "fusionpriv.h"
23 /******************************************************************
24 * InitializeFusion (FUSION.@)
26 HRESULT WINAPI
InitializeFusion(void)
32 /******************************************************************
33 * ClearDownloadCache (FUSION.@)
35 HRESULT WINAPI
ClearDownloadCache(void)
41 /******************************************************************
42 * CreateInstallReferenceEnum (FUSION.@)
44 HRESULT WINAPI
CreateInstallReferenceEnum(IInstallReferenceEnum
**ppRefEnum
,
45 IAssemblyName
*pName
, DWORD dwFlags
,
48 FIXME("(%p, %p, %08x, %p) stub!\n", ppRefEnum
, pName
, dwFlags
, pvReserved
);
52 /******************************************************************
53 * CreateApplicationContext (FUSION.@)
55 HRESULT WINAPI
CreateApplicationContext(IAssemblyName
*name
, void *ctx
)
57 FIXME("%p, %p\n", name
, ctx
);
61 static HRESULT (WINAPI
*pGetCORVersion
)(LPWSTR pbuffer
, DWORD cchBuffer
,
64 static HRESULT
get_corversion(LPWSTR version
, DWORD size
)
70 hmscoree
= LoadLibraryA("mscoree.dll");
74 pGetCORVersion
= (void *)GetProcAddress(hmscoree
, "GetCORVersion");
78 hr
= pGetCORVersion(version
, size
, &len
);
80 FreeLibrary(hmscoree
);
84 /******************************************************************
85 * GetCachePath (FUSION.@)
87 HRESULT WINAPI
GetCachePath(ASM_CACHE_FLAGS dwCacheFlags
, LPWSTR pwzCachePath
,
90 static const WCHAR assembly
[] = {'\\','a','s','s','e','m','b','l','y',0};
91 static const WCHAR gac
[] = {'\\','G','A','C',0};
92 static const WCHAR nativeimg
[] = {'N','a','t','i','v','e','I','m','a','g','e','s','_',0};
93 static const WCHAR dotnet
[] = {'\\','M','i','c','r','o','s','o','f','t','.','N','E','T',0};
95 static const WCHAR zapfmt
[] = {'%','s','\\','%','s','\\','%','s','%','s','_','6','4',0};
97 static const WCHAR zapfmt
[] = {'%','s','\\','%','s','\\','%','s','%','s','_','3','2',0};
99 WCHAR path
[MAX_PATH
], windir
[MAX_PATH
], version
[MAX_PATH
];
103 TRACE("(%08x, %p, %p)\n", dwCacheFlags
, pwzCachePath
, pcchPath
);
108 len
= GetWindowsDirectoryW(windir
, MAX_PATH
);
109 strcpyW(path
, windir
);
111 switch (dwCacheFlags
)
115 hr
= get_corversion(version
, MAX_PATH
);
119 len
= sprintfW(path
, zapfmt
, windir
, assembly
+ 1, nativeimg
, version
);
124 strcpyW(path
+ len
, assembly
);
125 len
+= sizeof(assembly
)/sizeof(WCHAR
) - 1;
126 strcpyW(path
+ len
, gac
);
127 len
+= sizeof(gac
)/sizeof(WCHAR
) - 1;
130 case ASM_CACHE_DOWNLOAD
:
132 FIXME("Download cache not implemented\n");
136 strcpyW(path
+ len
, assembly
);
137 len
+= sizeof(assembly
)/sizeof(WCHAR
) - 1;
139 case ASM_CACHE_ROOT_EX
:
140 strcpyW(path
+ len
, dotnet
);
141 len
+= sizeof(dotnet
)/sizeof(WCHAR
) - 1;
142 strcpyW(path
+ len
, assembly
);
143 len
+= sizeof(assembly
)/sizeof(WCHAR
) - 1;
150 if (*pcchPath
<= len
|| !pwzCachePath
)
151 hr
= HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER
);
152 else if (pwzCachePath
)
153 strcpyW(pwzCachePath
, path
);