Re: fusion: Allow null to be the value of the public key
On Thu, 2013-01-31 at 19:35 +1100, Alistair Leslie-Hughes wrote:
diff --git a/dlls/fusion/asmname.c b/dlls/fusion/asmname.c index 162a76b..2c4b379 100644 --- a/dlls/fusion/asmname.c +++ b/dlls/fusion/asmname.c @@ -561,6 +561,10 @@ static HRESULT parse_pubkey(IAssemblyNameImpl *name, LPCWSTR pubkey) { int i; BYTE val; + static WCHAR nullstr[] = {'n','u','l','l',0};
This should be const.
+ if(lstrcmpiW(pubkey, nullstr) == 0) + return S_OK;
Please add a test to show that it's case insensitive.
if (lstrlenW(pubkey) < CHARS_PER_PUBKEY) return FUSION_E_INVALID_NAME; diff --git a/dlls/fusion/tests/asmcache.c b/dlls/fusion/tests/asmcache.c index e97cfbe..79f8709 100644 --- a/dlls/fusion/tests/asmcache.c +++ b/dlls/fusion/tests/asmcache.c @@ -1016,6 +1016,10 @@ static void test_QueryAssemblyInfo(void) 'p','u','b','l','i','c','K','e','y','T','o','k','e','n','=', '2','d','0','3','6','1','7','b','1','c','3','1','e','2','f','5',',', 'c','u','l','t','u','r','e','=','n','e','u','t','r','a','l',0}; + static const WCHAR nullpublickey[] = { + 'm','s','c','o','r','l','i','n',',','v','e','r','s','i','o','n','=','0', + 'p','u','b','l','i','c','K','e','y','T','o','k','e','n','=','n','u','l', + 'c','u','l','t','u','r','e','=','n','e','u','t','r','a','l',0};
size = MAX_PATH; hr = pGetCachePath(ASM_CACHE_GAC, asmpath, &size); @@ -1386,6 +1390,17 @@ static void test_QueryAssemblyInfo(void) "Assembly path was changed\n"); ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
+ /* display name is "mscorlib.dll,version=0.0.0.0,publicKeyToken=null,culture=neutral" */
This comment doesn't agree with the string initialized above.
+ INIT_ASM_INFO(); + lstrcpyW(name, nullpublickey); + hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, name, &info); + ok(info.cbAssemblyInfo == sizeof(ASSEMBLY_INFO), + "Expected sizeof(ASSEMBLY_INFO), got %d\n", info.cbAssemblyInfo);
You should check the return value of QueryAssemblyInfo but CreateAssemblyNameObject is actually a better way to test this.
participants (1)
-
Hans Leidekker