Commit fdfeb33f authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

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.
parent 9ae0e899
...@@ -793,45 +793,27 @@ HRESULT assembly_get_path(ASSEMBLY *assembly, LPSTR *path) ...@@ -793,45 +793,27 @@ HRESULT assembly_get_path(ASSEMBLY *assembly, LPSTR *path)
HRESULT assembly_get_version(ASSEMBLY *assembly, LPSTR *version) HRESULT assembly_get_version(ASSEMBLY *assembly, LPSTR *version)
{ {
LPSTR verdata; ASSEMBLYTABLE *asmtbl;
VS_FIXEDFILEINFO *ffi; LONG offset;
HRESULT hr = S_OK;
DWORD size;
size = GetFileVersionInfoSizeA(assembly->path, NULL); *version = NULL;
if (!size)
return HRESULT_FROM_WIN32(GetLastError());
verdata = HeapAlloc(GetProcessHeap(), 0, size); offset = assembly->tables[TableFromToken(mdtAssembly)].offset;
if (!verdata) if (offset == -1)
return E_OUTOFMEMORY; return E_FAIL;
if (!GetFileVersionInfoA(assembly->path, 0, size, verdata))
{
hr = HRESULT_FROM_WIN32(GetLastError());
goto done;
}
if (!VerQueryValueA(verdata, "\\", (LPVOID *)&ffi, &size)) asmtbl = assembly_data_offset(assembly, offset);
{ if (!asmtbl)
hr = HRESULT_FROM_WIN32(GetLastError()); return E_FAIL;
goto done;
}
*version = HeapAlloc(GetProcessHeap(), 0, MAX_PATH); *version = HeapAlloc(GetProcessHeap(), 0, sizeof("%u.%u.%u.%u") + 4 * strlen("65535"));
if (!*version) if (!*version)
{ return E_OUTOFMEMORY;
hr = E_OUTOFMEMORY;
goto done;
}
sprintf(*version, "%d.%d.%d.%d", HIWORD(ffi->dwFileVersionMS), sprintf(*version, "%u.%u.%u.%u", asmtbl->MajorVersion, asmtbl->MinorVersion,
LOWORD(ffi->dwFileVersionMS), HIWORD(ffi->dwFileVersionLS), asmtbl->BuildNumber, asmtbl->RevisionNumber);
LOWORD(ffi->dwFileVersionLS));
done: return S_OK;
HeapFree(GetProcessHeap(), 0, verdata);
return hr;
} }
HRESULT assembly_get_architecture(ASSEMBLY *assembly, DWORD fixme) HRESULT assembly_get_architecture(ASSEMBLY *assembly, DWORD fixme)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment