oleaut32: Assign MEMBERIDs to vardescs without one.

This commit is contained in:
Andrew Eikum 2013-08-16 14:40:22 -05:00 committed by Alexandre Julliard
parent 341ff65b95
commit b6bfd6d32e
2 changed files with 31 additions and 0 deletions

View File

@ -4032,6 +4032,7 @@ static void test_SetVarHelpContext(void)
ok(hr == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hr);
memset(&desc, 0, sizeof(desc));
desc.memid = MEMBERID_NIL;
desc.elemdescVar.tdesc.vt = VT_INT;
desc.varkind = VAR_CONST;
@ -4067,6 +4068,7 @@ static void test_SetVarHelpContext(void)
hr = ITypeInfo_GetVarDesc(ti, 0, &pdesc);
ok(hr == S_OK, "got %08x\n", hr);
ok(pdesc->memid == 0x40000000, "got wrong memid: %x\n", pdesc->memid);
ok(pdesc->elemdescVar.tdesc.vt == VT_INT, "got wrong vardesc type: %u\n", pdesc->elemdescVar.tdesc.vt);
ok(pdesc->varkind == VAR_CONST, "got wrong varkind: %u\n", pdesc->varkind);
ok(V_VT(U(pdesc)->lpvarValue) == VT_INT, "got wrong value type: %u\n", V_VT(U(pdesc)->lpvarValue));
@ -4191,6 +4193,7 @@ static void test_SetVarDocString(void)
ok(hr == E_INVALIDARG, "got %08x\n", hr);
memset(&desc, 0, sizeof(desc));
desc.memid = MEMBERID_NIL;
desc.elemdescVar.tdesc.vt = VT_INT;
desc.varkind = VAR_CONST;
@ -4229,6 +4232,7 @@ static void test_SetVarDocString(void)
hr = ITypeInfo_GetVarDesc(ti, 0, &pdesc);
ok(hr == S_OK, "got %08x\n", hr);
ok(pdesc->memid == 0x40000000, "got wrong memid: %x\n", pdesc->memid);
ok(pdesc->elemdescVar.tdesc.vt == VT_INT, "got wrong vardesc type: %u\n", pdesc->elemdescVar.tdesc.vt);
ok(pdesc->varkind == VAR_CONST, "got wrong varkind: %u\n", pdesc->varkind);
ok(V_VT(U(pdesc)->lpvarValue) == VT_INT, "got wrong value type: %u\n", V_VT(U(pdesc)->lpvarValue));

View File

@ -10737,6 +10737,33 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(ICreateTypeInfo2 *iface)
if (user_vft > This->cbSizeVft)
This->cbSizeVft = user_vft + This->pTypeLib->ptr_size;
for(i = 0; i < This->cVars; ++i){
TLBVarDesc *var_desc = &This->vardescs[i];
if(var_desc->vardesc.memid == MEMBERID_NIL){
UINT j = 0;
BOOL reset = FALSE;
TLBVarDesc *iter;
var_desc->vardesc.memid = 0x40000000 + (depth << 16) + i;
iter = This->vardescs;
while (j < This->cVars) {
if (iter != var_desc && iter->vardesc.memid == var_desc->vardesc.memid) {
if (!reset) {
var_desc->vardesc.memid = 0x40000000 + (depth << 16) + This->cVars;
reset = TRUE;
} else
++var_desc->vardesc.memid;
iter = This->vardescs;
j = 0;
} else {
++iter;
++j;
}
}
}
}
ITypeInfo_Release(tinfo);
return hres;
}