From e81b63fc9c0a25c020efd03db3f494cfe0c18251 Mon Sep 17 00:00:00 2001 From: Francois Jacques Date: Sat, 8 Jul 2000 18:30:41 +0000 Subject: [PATCH] Implemented SafeArrayGetVarType. Added a VT_RECORD variant type definition. --- dlls/oleaut32/oleaut32.spec | 1 + dlls/oleaut32/safearray.c | 42 +++++++++++++++++++++++++++++++++++++ include/wine/obj_oleaut.h | 1 + 3 files changed, 44 insertions(+) diff --git a/dlls/oleaut32/oleaut32.spec b/dlls/oleaut32/oleaut32.spec index 5f708c70df2..6d5500321ec 100644 --- a/dlls/oleaut32/oleaut32.spec +++ b/dlls/oleaut32/oleaut32.spec @@ -73,6 +73,7 @@ import ole32.dll 74 stdcall VarR4FromStr(wstr long long ptr) VarR4FromStr 75 stub VarR4FromDisp 76 stdcall VarR4FromBool(long ptr) VarR4FromBool +77 stdcall SafeArrayGetVarType(ptr ptr) SafeArrayGetVarType 78 stdcall VarR8FromUI1(long ptr) VarR8FromUI1 79 stdcall VarR8FromI2(long ptr) VarR8FromI2 80 stdcall VarR8FromI4(long ptr) VarR8FromI4 diff --git a/dlls/oleaut32/safearray.c b/dlls/oleaut32/safearray.c index 0f2b62dc0d0..25ac1b6a2de 100644 --- a/dlls/oleaut32/safearray.c +++ b/dlls/oleaut32/safearray.c @@ -1036,3 +1036,45 @@ static HRESULT duplicateData( return S_OK; } + +/************************************************************************ + * SafeArrayGetVarType + * Returns the VARTYPE stored in the given safearray + */ +HRESULT WINAPI SafeArrayGetVarType( + SAFEARRAY* psa, + VARTYPE* pvt) +{ + HRESULT hr = E_INVALIDARG; + VARTYPE vt = VT_EMPTY; + + /* const short VARTYPE_OFFSET = -4; */ + + if (psa->fFeatures & FADF_HAVEVARTYPE) + { + /* VT tag @ negative offset 4 in the array descriptor */ + FIXME("Returning VT_BSTR instead of VT_..."); + vt = VT_BSTR; + } + else if (psa->fFeatures & FADF_RECORD) + { + vt = VT_RECORD; + } + else if (psa->fFeatures & FADF_DISPATCH) + { + vt = VT_DISPATCH; + } + else if (psa->fFeatures & FADF_UNKNOWN) + { + vt = VT_UNKNOWN; + } + + if (vt != VT_EMPTY) + { + *pvt = vt; + hr = S_OK; + } + + TRACE("HRESULT = %08lx", hr); + return hr; +} diff --git a/include/wine/obj_oleaut.h b/include/wine/obj_oleaut.h index 3c2ae39cbd0..5ebca28c656 100644 --- a/include/wine/obj_oleaut.h +++ b/include/wine/obj_oleaut.h @@ -467,6 +467,7 @@ enum VARENUM { VT_USERDEFINED = 29, VT_LPSTR = 30, VT_LPWSTR = 31, + VT_RECORD = 36, VT_FILETIME = 64, VT_BLOB = 65, VT_STREAM = 66,