From fdfeb33f37db5e2dd035aaab5da6842bb890a856 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Thu, 19 Feb 2009 14:03:22 +0100 Subject: [PATCH] fusion: Assembly version must be taken from the metadata, not the file version. Office 2007 SP1 installer depends on this. I will supply a test as soon as I figure out how to create a variation of the test assembly in dlls/fusion/tests/asmcache.c. --- dlls/fusion/assembly.c | 50 ++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/dlls/fusion/assembly.c b/dlls/fusion/assembly.c index 7be541c4a4f..2373d0f21d6 100644 --- a/dlls/fusion/assembly.c +++ b/dlls/fusion/assembly.c @@ -793,45 +793,27 @@ HRESULT assembly_get_path(ASSEMBLY *assembly, LPSTR *path) HRESULT assembly_get_version(ASSEMBLY *assembly, LPSTR *version) { - LPSTR verdata; - VS_FIXEDFILEINFO *ffi; - HRESULT hr = S_OK; - DWORD size; + ASSEMBLYTABLE *asmtbl; + LONG offset; - size = GetFileVersionInfoSizeA(assembly->path, NULL); - if (!size) - return HRESULT_FROM_WIN32(GetLastError()); + *version = NULL; - verdata = HeapAlloc(GetProcessHeap(), 0, size); - if (!verdata) + offset = assembly->tables[TableFromToken(mdtAssembly)].offset; + if (offset == -1) + return E_FAIL; + + asmtbl = assembly_data_offset(assembly, offset); + if (!asmtbl) + return E_FAIL; + + *version = HeapAlloc(GetProcessHeap(), 0, sizeof("%u.%u.%u.%u") + 4 * strlen("65535")); + if (!*version) return E_OUTOFMEMORY; - if (!GetFileVersionInfoA(assembly->path, 0, size, verdata)) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto done; - } + sprintf(*version, "%u.%u.%u.%u", asmtbl->MajorVersion, asmtbl->MinorVersion, + asmtbl->BuildNumber, asmtbl->RevisionNumber); - if (!VerQueryValueA(verdata, "\\", (LPVOID *)&ffi, &size)) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto done; - } - - *version = HeapAlloc(GetProcessHeap(), 0, MAX_PATH); - if (!*version) - { - hr = E_OUTOFMEMORY; - goto done; - } - - sprintf(*version, "%d.%d.%d.%d", HIWORD(ffi->dwFileVersionMS), - LOWORD(ffi->dwFileVersionMS), HIWORD(ffi->dwFileVersionLS), - LOWORD(ffi->dwFileVersionLS)); - -done: - HeapFree(GetProcessHeap(), 0, verdata); - return hr; + return S_OK; } HRESULT assembly_get_architecture(ASSEMBLY *assembly, DWORD fixme)