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.
This commit is contained in:
parent
9ae0e89999
commit
fdfeb33f37
|
@ -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_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;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
if (!GetFileVersionInfoA(assembly->path, 0, size, verdata))
|
sprintf(*version, "%u.%u.%u.%u", asmtbl->MajorVersion, asmtbl->MinorVersion,
|
||||||
{
|
asmtbl->BuildNumber, asmtbl->RevisionNumber);
|
||||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!VerQueryValueA(verdata, "\\", (LPVOID *)&ffi, &size))
|
return S_OK;
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT assembly_get_architecture(ASSEMBLY *assembly, DWORD fixme)
|
HRESULT assembly_get_architecture(ASSEMBLY *assembly, DWORD fixme)
|
||||||
|
|
Loading…
Reference in New Issue