From 0c93b1f0a79b0ad0ee99bca91f7d7e08f305aefe Mon Sep 17 00:00:00 2001 From: Jon Griffiths Date: Fri, 23 Apr 2004 21:31:16 +0000 Subject: [PATCH] Implement ClearCustData. --- dlls/oleaut32/oleaut32.spec | 2 +- dlls/oleaut32/typelib2.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/dlls/oleaut32/oleaut32.spec b/dlls/oleaut32/oleaut32.spec index 136de5dbea..65f477bcef 100644 --- a/dlls/oleaut32/oleaut32.spec +++ b/dlls/oleaut32/oleaut32.spec @@ -166,7 +166,7 @@ 168 stdcall VarAbs(ptr ptr) 169 stdcall VarFix(ptr ptr) 170 stdcall OaBuildVersion() -171 stub ClearCustData +171 stdcall ClearCustData(ptr) 172 stdcall VarInt(ptr ptr) 173 stdcall VarNeg(ptr ptr) 174 stdcall VarNot(ptr ptr) diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index 0bccdaabc4..d7564760e0 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -3879,3 +3879,33 @@ HRESULT WINAPI CreateTypeLib2( *ppctlib = ICreateTypeLib2_Constructor(syskind, szFile); return (*ppctlib)? S_OK: E_OUTOFMEMORY; } + +/****************************************************************************** + * ClearCustData (OLEAUT32.171) + * + * Clear a custom data types' data. + * + * PARAMS + * lpCust [I] The custom data type instance + * + * RETURNS + * Nothing. + */ +void WINAPI ClearCustData(LPCUSTDATA lpCust) +{ + if (lpCust && lpCust->cCustData) + { + if (lpCust->prgCustData) + { + DWORD i; + + for (i = 0; i < lpCust->cCustData; i++) + VariantClear(&lpCust->prgCustData[i].varValue); + + /* FIXME - Should be using a per-thread IMalloc */ + HeapFree(GetProcessHeap(), 0, lpCust->prgCustData); + lpCust->prgCustData = NULL; + } + lpCust->cCustData = 0; + } +}