fusion: Return correct error for null public token.

This commit is contained in:
Alistair Leslie-Hughes 2013-01-31 16:08:38 +11:00 committed by Alexandre Julliard
parent 50a9fb579c
commit 575571c9fc
3 changed files with 24 additions and 0 deletions

View File

@ -561,6 +561,10 @@ static HRESULT parse_pubkey(IAssemblyNameImpl *name, LPCWSTR pubkey)
{
int i;
BYTE val;
static const WCHAR nullstr[] = {'n','u','l','l',0};
if(lstrcmpiW(pubkey, nullstr) == 0)
return FUSION_E_PRIVATE_ASM_DISALLOWED;
if (lstrlenW(pubkey) < CHARS_PER_PUBKEY)
return FUSION_E_INVALID_NAME;

View File

@ -1016,6 +1016,13 @@ 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','b','.','d','l','l',',','v','e','r','s','i','o','n','=','0','.','0','.',
'0','.','0',',','c','u','l','t','u','r','e','=','n','e','u','t','r','a','l',',',
'p','u','b','l','i','c','K','e','y','T','o','k','e','n','=','n','u','l','l',0};
static const WCHAR nullpublickey1[] = {
'm','s','c','o','r','l','i','b','.','d','l','l',',',
'p','u','b','l','i','c','K','e','y','T','o','k','e','n','=','n','u','L','l',0};
size = MAX_PATH;
hr = pGetCachePath(ASM_CACHE_GAC, asmpath, &size);
@ -1386,6 +1393,18 @@ 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,culture=neutral,publicKeyToken=null" */
INIT_ASM_INFO();
lstrcpyW(name, nullpublickey);
hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, name, &info);
ok(hr == FUSION_E_PRIVATE_ASM_DISALLOWED, "got %08x\n", hr);
/* display name is "mscorlib.dll,publicKeyToken=nuLl" */
INIT_ASM_INFO();
lstrcpyW(name, nullpublickey1);
hr = IAssemblyCache_QueryAssemblyInfo(cache, 0, name, &info);
ok(hr == FUSION_E_PRIVATE_ASM_DISALLOWED, "got %08x\n", hr);
/* display name is "wine, Culture=neutral" */
INIT_ASM_INFO();
lstrcpyW(name, wine);

View File

@ -119,6 +119,7 @@
#define COR_E_HOSTPROTECTION EMAKEHR(0x1640)
#define COR_E_ILLEGAL_REENTRANCY EMAKEHR(0x1641)
#define FUSION_E_PRIVATE_ASM_DISALLOWED EMAKEHR(0x1044)
#define FUSION_E_INVALID_NAME EMAKEHR(0x1047)
#define CLDB_E_FILE_OLDVER EMAKEHR(0x1107)