oleaut32: Overwrite previous CustData segment.

This eliminates the diff between Wine's and Windows XP's generated TLB
files.
This commit is contained in:
Andrew Eikum 2010-08-18 12:21:22 -05:00 committed by Alexandre Julliard
parent a0c0d2693d
commit a8dbeb1e60
1 changed files with 32 additions and 4 deletions

View File

@ -921,6 +921,26 @@ static HRESULT ctl2_encode_variant(
} }
} }
static int ctl2_find_custdata(
ICreateTypeLib2Impl *This,
REFGUID guid,
int offset)
{
while (offset != -1) {
MSFT_CDGuid *cdentry =
(MSFT_CDGuid *)&This->typelib_segment_data[MSFT_SEG_CUSTDATAGUID][offset];
MSFT_GuidEntry *guidentry =
(MSFT_GuidEntry *)&This->typelib_segment_data[MSFT_SEG_GUID][cdentry->GuidOffset];
if (IsEqualGUID(guidentry, guid))
return offset;
offset = cdentry->next;
}
return -1;
}
/**************************************************************************** /****************************************************************************
* ctl2_set_custdata * ctl2_set_custdata
* *
@ -943,6 +963,7 @@ static HRESULT ctl2_set_custdata(
int guidoffset; int guidoffset;
int custoffset; int custoffset;
int *custdata; int *custdata;
BOOL new_segment = FALSE;
switch(V_VT(pVarVal)) switch(V_VT(pVarVal))
{ {
@ -971,14 +992,21 @@ static HRESULT ctl2_set_custdata(
if (status) if (status)
return status; return status;
custoffset = ctl2_find_custdata(This, guid, *offset);
if (custoffset == -1) {
custoffset = ctl2_alloc_segment(This, MSFT_SEG_CUSTDATAGUID, 12, 0); custoffset = ctl2_alloc_segment(This, MSFT_SEG_CUSTDATAGUID, 12, 0);
if (custoffset == -1) return E_OUTOFMEMORY; if (custoffset == -1)
return E_OUTOFMEMORY;
new_segment = TRUE;
}
custdata = (int *)&This->typelib_segment_data[MSFT_SEG_CUSTDATAGUID][custoffset]; custdata = (int *)&This->typelib_segment_data[MSFT_SEG_CUSTDATAGUID][custoffset];
custdata[0] = guidoffset; custdata[0] = guidoffset;
custdata[1] = dataoffset; custdata[1] = dataoffset;
if (new_segment) {
custdata[2] = *offset; custdata[2] = *offset;
*offset = custoffset; *offset = custoffset;
}
return S_OK; return S_OK;
} }