From 2a51df3b7aa3070bbc4cad00eff36efa0fd20c37 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 16 Jul 2008 10:57:44 -0500 Subject: [PATCH] fusion: Handle DWORD-sized string indices when loading the assembly name. --- dlls/fusion/assembly.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/dlls/fusion/assembly.c b/dlls/fusion/assembly.c index b8b771922db..9fcde8f223e 100644 --- a/dlls/fusion/assembly.c +++ b/dlls/fusion/assembly.c @@ -735,7 +735,7 @@ HRESULT assembly_release(ASSEMBLY *assembly) return S_OK; } -static LPSTR assembly_dup_str(ASSEMBLY *assembly, WORD index) +static LPSTR assembly_dup_str(ASSEMBLY *assembly, DWORD index) { LPSTR str = (LPSTR)&assembly->strings[index]; LPSTR cpy = HeapAlloc(GetProcessHeap(), 0, strlen(str)+1); @@ -746,18 +746,25 @@ static LPSTR assembly_dup_str(ASSEMBLY *assembly, WORD index) HRESULT assembly_get_name(ASSEMBLY *assembly, LPSTR *name) { - ASSEMBLYTABLE *asmtbl; + BYTE *ptr; ULONG offset; + DWORD stridx; offset = assembly->tables[TableFromToken(mdtAssembly)].offset; if (offset == -1) return E_FAIL; - asmtbl = (ASSEMBLYTABLE *)assembly_data_offset(assembly, offset); - if (!asmtbl) + ptr = assembly_data_offset(assembly, offset); + if (!ptr) return E_FAIL; - *name = assembly_dup_str(assembly, asmtbl->Name); + ptr += FIELD_OFFSET(ASSEMBLYTABLE, PublicKey) + assembly->blobsz; + if (assembly->stringsz == sizeof(DWORD)) + stridx = *((DWORD *)ptr); + else + stridx = *((WORD *)ptr); + + *name = assembly_dup_str(assembly, stridx); if (!*name) return E_OUTOFMEMORY;