From: Alex Henrie alexhenrie24@gmail.com
--- dlls/fusion/asmcache.c | 32 ++++++----------- dlls/fusion/asmenum.c | 68 +++++++++++++---------------------- dlls/fusion/asmname.c | 81 +++++++++++++----------------------------- dlls/fusion/assembly.c | 6 ++-- dlls/fusion/fusion.c | 30 +++++++--------- 5 files changed, 73 insertions(+), 144 deletions(-)
diff --git a/dlls/fusion/asmcache.c b/dlls/fusion/asmcache.c index 88805bb354b..05c72388b90 100644 --- a/dlls/fusion/asmcache.c +++ b/dlls/fusion/asmcache.c @@ -53,9 +53,6 @@ typedef struct { LONG ref; } IAssemblyCacheItemImpl;
-static const WCHAR cache_mutex_nameW[] = - {'_','_','W','I','N','E','_','F','U','S','I','O','N','_','C','A','C','H','E','_','M','U','T','E','X','_','_',0}; - static BOOL create_full_path(LPCWSTR path) { LPWSTR new_path; @@ -106,11 +103,8 @@ static BOOL create_full_path(LPCWSTR path)
static BOOL get_assembly_directory(LPWSTR dir, DWORD size, const char *version, PEKIND architecture) { - static const WCHAR dotnet[] = {'\','M','i','c','r','o','s','o','f','t','.','N','E','T','\',0}; - static const WCHAR gac[] = {'\','a','s','s','e','m','b','l','y','\','G','A','C',0}; - static const WCHAR msil[] = {'_','M','S','I','L',0}; - static const WCHAR x86[] = {'_','3','2',0}; - static const WCHAR amd64[] = {'_','6','4',0}; + static const WCHAR dotnet[] = L"\Microsoft.NET\"; + static const WCHAR gac[] = L"\assembly\GAC"; DWORD len = GetWindowsDirectoryW(dir, size);
if (!strcmp(version, "v4.0.30319")) @@ -131,15 +125,15 @@ static BOOL get_assembly_directory(LPWSTR dir, DWORD size, const char *version, break;
case peMSIL: - lstrcpyW(dir + len, msil); + lstrcpyW(dir + len, L"_MSIL"); break;
case peI386: - lstrcpyW(dir + len, x86); + lstrcpyW(dir + len, L"_32"); break;
case peAMD64: - lstrcpyW(dir + len, amd64); + lstrcpyW(dir + len, L"_64"); break;
default: @@ -419,12 +413,6 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, LPCWSTR pszManifestFilePath, LPCFUSION_INSTALL_REFERENCE pRefData) { - static const WCHAR format[] = - {'%','s','\','%','s','\','%','s','_','_','%','s','\',0}; - static const WCHAR format_v40[] = - {'%','s','\','%','s','\','v','4','.','0','_','%','s','_','_','%','s','\',0}; - static const WCHAR ext_exe[] = {'.','e','x','e',0}; - static const WCHAR ext_dll[] = {'.','d','l','l',0}; IAssemblyCacheImpl *cache = impl_from_IAssemblyCache(iface); ASSEMBLY *assembly; const WCHAR *extension, *filename, *src_dir; @@ -432,7 +420,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, WCHAR asmdir[MAX_PATH], *p, **external_files = NULL, *dst_dir = NULL; PEKIND architecture; char *clr_version; - DWORD i, count = 0, src_len, dst_len = ARRAY_SIZE(format_v40); + DWORD i, count = 0, src_len, dst_len = sizeof("\\v4.0___\"); HRESULT hr;
TRACE("(%p, %ld, %s, %p)\n", iface, dwFlags, @@ -444,7 +432,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, if (!(extension = wcsrchr(pszManifestFilePath, '.'))) return HRESULT_FROM_WIN32(ERROR_INVALID_NAME);
- if (lstrcmpiW(extension, ext_exe) && lstrcmpiW(extension, ext_dll)) + if (lstrcmpiW(extension, L".exe") && lstrcmpiW(extension, L".dll")) return HRESULT_FROM_WIN32(ERROR_INVALID_NAME);
if (GetFileAttributesW(pszManifestFilePath) == INVALID_FILE_ATTRIBUTES) @@ -489,9 +477,9 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, goto done; } if (!strcmp(clr_version, "v4.0.30319")) - dst_len = swprintf(dst_dir, dst_len, format_v40, asmdir, name, version, token); + dst_len = swprintf(dst_dir, dst_len, L"%s\%s\v4.0_%s__%s\", asmdir, name, version, token); else - dst_len = swprintf(dst_dir, dst_len, format, asmdir, name, version, token); + dst_len = swprintf(dst_dir, dst_len, L"%s\%s\%s__%s\", asmdir, name, version, token);
create_full_path(dst_dir);
@@ -564,7 +552,7 @@ HRESULT WINAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved
cache->IAssemblyCache_iface.lpVtbl = &AssemblyCacheVtbl; cache->ref = 1; - cache->lock = CreateMutexW( NULL, FALSE, cache_mutex_nameW ); + cache->lock = CreateMutexW( NULL, FALSE, L"__WINE_FUSION_CACHE_MUTEX__" ); if (!cache->lock) { free( cache ); diff --git a/dlls/fusion/asmenum.c b/dlls/fusion/asmenum.c index bdde3bf1e3c..767c37beda9 100644 --- a/dlls/fusion/asmenum.c +++ b/dlls/fusion/asmenum.c @@ -165,13 +165,6 @@ static const IAssemblyEnumVtbl AssemblyEnumVtbl = { static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path, const WCHAR *prefix, WCHAR *buf) { - static const WCHAR star[] = {'*',0}; - static const WCHAR ss_fmt[] = {'%','s','\','%','s',0}; - static const WCHAR sss_fmt[] = {'%','s','\','%','s','_','_','%','s',0}; - static const WCHAR ssss_fmt[] = {'%','s','\','%','s','%','s','_','_','%','s',0}; - static const WCHAR ver_fmt[] = {'%','u','.','%','u','.','%','u','.','%','u',0}; - static const WCHAR star_fmt[] = {'%','s','\','*',0}; - static const WCHAR star_prefix_fmt[] = {'%','s','\','%','s','*',0}; WCHAR disp[MAX_PATH], version[24]; /* strlen("65535") * 4 + 3 + 1 */ LPCWSTR verptr, pubkeyptr; HRESULT hr; @@ -183,9 +176,9 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path, if (!name) { if (prefix && depth == 1) - swprintf(buf, MAX_PATH, star_prefix_fmt, path, prefix); + swprintf(buf, MAX_PATH, L"%s\%s*", path, prefix); else - swprintf(buf, MAX_PATH, star_fmt, path); + swprintf(buf, MAX_PATH, L"%s\*", path); return; } if (depth == 0) @@ -194,9 +187,9 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path, *disp = '\0'; hr = IAssemblyName_GetName(name, &size, disp); if (SUCCEEDED(hr)) - swprintf(buf, MAX_PATH, ss_fmt, path, disp); + swprintf(buf, MAX_PATH, L"%s\%s", path, disp); else - swprintf(buf, MAX_PATH, ss_fmt, path, star); + swprintf(buf, MAX_PATH, L"%s\*", path); } else if (depth == 1) { @@ -212,17 +205,17 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path, revision_size = sizeof(revision); IAssemblyName_GetProperty(name, ASM_NAME_REVISION_NUMBER, &revision, &revision_size);
- if (!major_size || !minor_size || !build_size || !revision_size) verptr = star; + if (!major_size || !minor_size || !build_size || !revision_size) verptr = L"*"; else { - swprintf(version, ARRAY_SIZE(version), ver_fmt, major, minor, build, revision); + swprintf(version, ARRAY_SIZE(version), L"%u.%u.%u.%u", major, minor, build, revision); verptr = version; }
size = sizeof(token); IAssemblyName_GetProperty(name, ASM_NAME_PUBLIC_KEY_TOKEN, token, &size);
- if (!size) pubkeyptr = star; + if (!size) pubkeyptr = L"*"; else { token_to_str(token, token_str); @@ -230,9 +223,9 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path, }
if (prefix) - swprintf(buf, MAX_PATH, ssss_fmt, path, prefix, verptr, pubkeyptr); + swprintf(buf, MAX_PATH, L"%s\%s%s__%s", path, prefix, verptr, pubkeyptr); else - swprintf(buf, MAX_PATH, sss_fmt, path, verptr, pubkeyptr); + swprintf(buf, MAX_PATH, L"%s\%s__%s", path, verptr, pubkeyptr); } }
@@ -299,14 +292,6 @@ static void insert_assembly(struct list *assemblies, ASMNAME *to_insert) static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, int depth, const WCHAR *prefix, LPWSTR path) { - static const WCHAR dot[] = {'.',0}; - static const WCHAR dotdot[] = {'.','.',0}; - static const WCHAR dblunder[] = {'_','_',0}; - static const WCHAR path_fmt[] = {'%','s','\','%','s','\','%','s','.','d','l','l',0}; - static const WCHAR name_fmt[] = {'%','s',',',' ','V','e','r','s','i','o','n','=','%','s',',',' ', - 'C','u','l','t','u','r','e','=','n','e','u','t','r','a','l',',',' ', - 'P','u','b','l','i','c','K','e','y','T','o','k','e','n','=','%','s',0}; - static const WCHAR ss_fmt[] = {'%','s','\','%','s',0}; WIN32_FIND_DATAW ffd; WCHAR buf[MAX_PATH], disp[MAX_PATH], asmpath[MAX_PATH], *ptr; static WCHAR parent[MAX_PATH]; @@ -321,7 +306,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
do { - if (!lstrcmpW(ffd.cFileName, dot) || !lstrcmpW(ffd.cFileName, dotdot)) + if (!lstrcmpW(ffd.cFileName, L".") || !lstrcmpW(ffd.cFileName, L"..")) continue;
if (depth == 0) @@ -337,8 +322,8 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, { const WCHAR *token, *version = ffd.cFileName;
- swprintf(asmpath, ARRAY_SIZE(asmpath), path_fmt, path, ffd.cFileName, parent); - ptr = wcsstr(ffd.cFileName, dblunder); + swprintf(asmpath, ARRAY_SIZE(asmpath), L"%s\%s\%s.dll", path, ffd.cFileName, parent); + ptr = wcsstr(ffd.cFileName, L"__"); *ptr = '\0'; token = ptr + 2;
@@ -349,7 +334,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, !wcsnicmp(ffd.cFileName, prefix, prefix_len)) version += prefix_len; } - swprintf(disp, ARRAY_SIZE(disp), name_fmt, parent, version, token); + swprintf(disp, ARRAY_SIZE(disp), L"%s, Version=%s, Culture=neutral, PublicKeyToken=%s", parent, version, token);
if (!(asmname = malloc(sizeof(*asmname)))) { @@ -377,7 +362,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, continue; }
- swprintf(buf, ARRAY_SIZE(buf), ss_fmt, path, ffd.cFileName); + swprintf(buf, ARRAY_SIZE(buf), L"%s\%s", path, ffd.cFileName); hr = enum_gac_assemblies(assemblies, name, depth + 1, prefix, buf); if (FAILED(hr)) break; @@ -389,11 +374,6 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
static HRESULT enumerate_gac(IAssemblyEnumImpl *asmenum, IAssemblyName *pName) { - static const WCHAR gac[] = {'\','G','A','C',0}; - static const WCHAR gac_32[] = {'\','G','A','C','_','3','2',0}; - static const WCHAR gac_64[] = {'\','G','A','C','_','6','4',0}; - static const WCHAR gac_msil[] = {'\','G','A','C','_','M','S','I','L',0}; - static const WCHAR v40[] = {'v','4','.','0','_',0}; WCHAR path[MAX_PATH], buf[MAX_PATH]; SYSTEM_INFO info; HRESULT hr; @@ -408,18 +388,18 @@ static HRESULT enumerate_gac(IAssemblyEnumImpl *asmenum, IAssemblyName *pName) GetNativeSystemInfo(&info); if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { - lstrcpyW(path + size - 1, gac_64); - hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path); + lstrcpyW(path + size - 1, L"\GAC_64"); + hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, L"v4.0_", path); if (FAILED(hr)) return hr; } - lstrcpyW(path + size - 1, gac_32); - hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path); + lstrcpyW(path + size - 1, L"\GAC_32"); + hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, L"v4.0_", path); if (FAILED(hr)) return hr;
- lstrcpyW(path + size - 1, gac_msil); - hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path); + lstrcpyW(path + size - 1, L"\GAC_MSIL"); + hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, L"v4.0_", path); if (FAILED(hr)) return hr;
@@ -431,22 +411,22 @@ static HRESULT enumerate_gac(IAssemblyEnumImpl *asmenum, IAssemblyName *pName) lstrcpyW(path, buf); if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { - lstrcpyW(path + size - 1, gac_64); + lstrcpyW(path + size - 1, L"\GAC_64"); hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path); if (FAILED(hr)) return hr; } - lstrcpyW(path + size - 1, gac_32); + lstrcpyW(path + size - 1, L"\GAC_32"); hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path); if (FAILED(hr)) return hr;
- lstrcpyW(path + size - 1, gac_msil); + lstrcpyW(path + size - 1, L"\GAC_MSIL"); hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path); if (FAILED(hr)) return hr;
- lstrcpyW(path + size - 1, gac); + lstrcpyW(path + size - 1, L"\GAC"); hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path); if (FAILED(hr)) return hr; diff --git a/dlls/fusion/asmname.c b/dlls/fusion/asmname.c index 1d4d588762d..4169330adf7 100644 --- a/dlls/fusion/asmname.c +++ b/dlls/fusion/asmname.c @@ -59,14 +59,6 @@ typedef struct { LONG ref; } IAssemblyNameImpl;
-static const WCHAR separator[] = {',',' ',0}; -static const WCHAR version[] = {'V','e','r','s','i','o','n',0}; -static const WCHAR culture[] = {'C','u','l','t','u','r','e',0}; -static const WCHAR pubkey[] = - {'P','u','b','l','i','c','K','e','y','T','o','k','e','n',0}; -static const WCHAR procarch[] = {'p','r','o','c','e','s','s','o','r', - 'A','r','c','h','i','t','e','c','t','u','r','e',0}; - #define CHARS_PER_PUBKEY 16
static inline IAssemblyNameImpl *impl_from_IAssemblyName(IAssemblyName *iface) @@ -263,7 +255,6 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName *iface, LPDWORD pccDisplayName, DWORD dwDisplayFlags) { - static const WCHAR equals[] = {'=',0}; IAssemblyNameImpl *name = impl_from_IAssemblyName(iface); WCHAR verstr[30], *cultureval = NULL; DWORD size; @@ -298,37 +289,33 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName *iface,
if ((dwDisplayFlags & ASM_DISPLAYF_VERSION) && (name->versize > 0)) { - static const WCHAR spec[] = {'%','d',0}; - static const WCHAR period[] = {'.',0}; DWORD i;
- wsprintfW(verstr, spec, name->version[0]); + wsprintfW(verstr, L"%d", name->version[0]);
for (i = 1; i < name->versize; i++) { WCHAR value[6]; - wsprintfW(value, spec, name->version[i]); + wsprintfW(value, L"%d", name->version[i]);
- lstrcatW(verstr, period); + lstrcatW(verstr, L"."); lstrcatW(verstr, value); }
- size += lstrlenW(separator) + lstrlenW(version) + lstrlenW(equals) + lstrlenW(verstr); + size += lstrlenW(L", Version=") + lstrlenW(verstr); }
if ((dwDisplayFlags & ASM_DISPLAYF_CULTURE) && (name->culture)) { - static const WCHAR neutral[] = {'n','e','u','t','r','a','l', 0}; - - cultureval = (lstrlenW(name->culture) == 2) ? name->culture : (LPWSTR) neutral; - size += lstrlenW(separator) + lstrlenW(culture) + lstrlenW(equals) + lstrlenW(cultureval); + cultureval = (lstrlenW(name->culture) == 2) ? name->culture : (WCHAR *)L"neutral"; + size += lstrlenW(L", Culture=") + lstrlenW(cultureval); }
if ((dwDisplayFlags & ASM_DISPLAYF_PUBLIC_KEY_TOKEN) && (name->haspubkey)) - size += lstrlenW(separator) + lstrlenW(pubkey) + lstrlenW(equals) + CHARS_PER_PUBKEY; + size += lstrlenW(L", PublicKeyToken=") + CHARS_PER_PUBKEY;
if ((dwDisplayFlags & ASM_DISPLAYF_PROCESSORARCHITECTURE) && (name->procarch)) - size += lstrlenW(separator) + lstrlenW(procarch) + lstrlenW(equals) + lstrlenW(name->procarch); + size += lstrlenW(L", processorArchitecture=") + lstrlenW(name->procarch);
if (size > *pccDisplayName) { @@ -341,46 +328,32 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName *iface,
if ((dwDisplayFlags & ASM_DISPLAYF_VERSION) && (name->versize > 0)) { - lstrcatW(szDisplayName, separator); - - lstrcatW(szDisplayName, version); - lstrcatW(szDisplayName, equals); + lstrcatW(szDisplayName, L", Version="); lstrcatW(szDisplayName, verstr); }
if ((dwDisplayFlags & ASM_DISPLAYF_CULTURE) && (name->culture)) { - lstrcatW(szDisplayName, separator); - - lstrcatW(szDisplayName, culture); - lstrcatW(szDisplayName, equals); + lstrcatW(szDisplayName, L", Culture="); lstrcatW(szDisplayName, cultureval); }
if ((dwDisplayFlags & ASM_DISPLAYF_PUBLIC_KEY_TOKEN) && (name->haspubkey)) { WCHAR pkt[CHARS_PER_PUBKEY + 1]; - static const WCHAR spec[] = {'%','0','2','x','%','0','2','x','%','0','2','x', - '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x',0};
- lstrcatW(szDisplayName, separator); + lstrcatW(szDisplayName, L", PublicKeyToken=");
- lstrcatW(szDisplayName, pubkey); - lstrcatW(szDisplayName, equals); - - wsprintfW(pkt, spec, name->pubkey[0], name->pubkey[1], name->pubkey[2], - name->pubkey[3], name->pubkey[4], name->pubkey[5], name->pubkey[6], - name->pubkey[7]); + wsprintfW(pkt, L"%02x%02x%02x%02x%02x%02x%02x%02x", + name->pubkey[0], name->pubkey[1], name->pubkey[2], name->pubkey[3], + name->pubkey[4], name->pubkey[5], name->pubkey[6], name->pubkey[7]);
lstrcatW(szDisplayName, pkt); }
if ((dwDisplayFlags & ASM_DISPLAYF_PROCESSORARCHITECTURE) && (name->procarch)) { - lstrcatW(szDisplayName, separator); - - lstrcatW(szDisplayName, procarch); - lstrcatW(szDisplayName, equals); + lstrcatW(szDisplayName, L", processorArchitecture="); lstrcatW(szDisplayName, name->procarch); }
@@ -606,9 +579,8 @@ static HRESULT parse_pubkey(IAssemblyNameImpl *name, LPCWSTR pubkey) { int i; BYTE val; - static const WCHAR nullstr[] = {'n','u','l','l',0};
- if(lstrcmpiW(pubkey, nullstr) == 0) + if(lstrcmpiW(pubkey, L"null") == 0) return FUSION_E_PRIVATE_ASM_DISALLOWED;
if (lstrlenW(pubkey) < CHARS_PER_PUBKEY) @@ -631,18 +603,13 @@ static HRESULT parse_pubkey(IAssemblyNameImpl *name, LPCWSTR pubkey)
static HRESULT parse_procarch(IAssemblyNameImpl *name, LPCWSTR procarch) { - static const WCHAR msilW[] = {'m','s','i','l',0}; - static const WCHAR x86W[] = {'x','8','6',0}; - static const WCHAR ia64W[] = {'i','a','6','4',0}; - static const WCHAR amd64W[] = {'a','m','d','6','4',0}; - - if (!lstrcmpiW(procarch, msilW)) + if (!lstrcmpiW(procarch, L"msil")) name->pekind = peMSIL; - else if (!lstrcmpiW(procarch, x86W)) + else if (!lstrcmpiW(procarch, L"x86")) name->pekind = peI386; - else if (!lstrcmpiW(procarch, ia64W)) + else if (!lstrcmpiW(procarch, L"ia64")) name->pekind = peIA64; - else if (!lstrcmpiW(procarch, amd64W)) + else if (!lstrcmpiW(procarch, L"amd64")) name->pekind = peAMD64; else { @@ -753,13 +720,13 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam } while (*str == ' ') str++;
- if (!lstrcmpiW(str, version)) + if (!lstrcmpiW(str, L"Version")) hr = parse_version( name, value ); - else if (!lstrcmpiW(str, culture)) + else if (!lstrcmpiW(str, L"Culture")) hr = parse_culture( name, value ); - else if (!lstrcmpiW(str, pubkey)) + else if (!lstrcmpiW(str, L"PublicKeyToken")) hr = parse_pubkey( name, value ); - else if (!lstrcmpiW(str, procarch)) + else if (!lstrcmpiW(str, L"processorArchitecture")) { name->procarch = value; value = NULL; diff --git a/dlls/fusion/assembly.c b/dlls/fusion/assembly.c index 433e30a5399..88d3f4372e2 100644 --- a/dlls/fusion/assembly.c +++ b/dlls/fusion/assembly.c @@ -761,8 +761,6 @@ HRESULT assembly_get_path(const ASSEMBLY *assembly, LPWSTR *path)
HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version) { - static const WCHAR format[] = {'%','u','.','%','u','.','%','u','.','%','u',0}; - ASSEMBLYTABLE *asmtbl; LONG offset;
@@ -779,8 +777,8 @@ HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version) if (!(*version = malloc(24 * sizeof(WCHAR)))) return E_OUTOFMEMORY;
- swprintf(*version, 24, format, asmtbl->MajorVersion, asmtbl->MinorVersion, - asmtbl->BuildNumber, asmtbl->RevisionNumber); + swprintf(*version, 24, L"%u.%u.%u.%u", asmtbl->MajorVersion, + asmtbl->MinorVersion, asmtbl->BuildNumber, asmtbl->RevisionNumber);
return S_OK; } diff --git a/dlls/fusion/fusion.c b/dlls/fusion/fusion.c index c7d3f3bca00..61b13dc7a3d 100644 --- a/dlls/fusion/fusion.c +++ b/dlls/fusion/fusion.c @@ -108,14 +108,10 @@ static HRESULT get_corversion(LPWSTR version, DWORD size) HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath, PDWORD pcchPath) { - static const WCHAR assembly[] = {'\','a','s','s','e','m','b','l','y',0}; - static const WCHAR gac[] = {'\','G','A','C',0}; - static const WCHAR nativeimg[] = {'N','a','t','i','v','e','I','m','a','g','e','s','_',0}; - static const WCHAR dotnet[] = {'\','M','i','c','r','o','s','o','f','t','.','N','E','T',0}; #ifdef _WIN64 - static const WCHAR zapfmt[] = {'%','s','\','%','s','\','%','s','%','s','_','6','4',0}; + static const WCHAR zapfmt[] = L"%s\assembly\NativeImages_%s_64"; #else - static const WCHAR zapfmt[] = {'%','s','\','%','s','\','%','s','%','s','_','3','2',0}; + static const WCHAR zapfmt[] = L"%s\assembly\NativeImages_%s_32"; #endif WCHAR path[MAX_PATH], windir[MAX_PATH], version[MAX_PATH]; DWORD len; @@ -137,15 +133,15 @@ HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath, if (FAILED(hr)) return hr;
- len = swprintf(path, ARRAY_SIZE(path), zapfmt, windir, assembly + 1, nativeimg, version); + len = swprintf(path, ARRAY_SIZE(path), zapfmt, windir, version); break; } case ASM_CACHE_GAC: { - lstrcpyW(path + len, assembly); - len += ARRAY_SIZE(assembly) - 1; - lstrcpyW(path + len, gac); - len += ARRAY_SIZE(gac) - 1; + lstrcpyW(path + len, L"\assembly"); + len += ARRAY_SIZE(L"\assembly") - 1; + lstrcpyW(path + len, L"\GAC"); + len += ARRAY_SIZE(L"\GAC") - 1; break; } case ASM_CACHE_DOWNLOAD: @@ -154,14 +150,14 @@ HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath, return E_FAIL; } case ASM_CACHE_ROOT: - lstrcpyW(path + len, assembly); - len += ARRAY_SIZE(assembly) - 1; + lstrcpyW(path + len, L"\assembly"); + len += ARRAY_SIZE(L"\assembly") - 1; break; case ASM_CACHE_ROOT_EX: - lstrcpyW(path + len, dotnet); - len += ARRAY_SIZE(dotnet) - 1; - lstrcpyW(path + len, assembly); - len += ARRAY_SIZE(assembly) - 1; + lstrcpyW(path + len, L"\Microsoft.NET"); + len += ARRAY_SIZE(L"\Microsoft.NET") - 1; + lstrcpyW(path + len, L"\assembly"); + len += ARRAY_SIZE(L"\assembly") - 1; break; default: return E_INVALIDARG;