Piotr Caban : oleaut32: Simplify ICreateTypeInfo2_SetTypeFlags implementation.
Alexandre Julliard
julliard at winehq.org
Tue Mar 16 11:49:15 CDT 2010
Module: wine
Branch: master
Commit: 6b035d25a8e0dd10045f8fbc29f1b70f5ec5ae7c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6b035d25a8e0dd10045f8fbc29f1b70f5ec5ae7c
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon Mar 15 23:37:48 2010 +0100
oleaut32: Simplify ICreateTypeInfo2_SetTypeFlags implementation.
---
dlls/oleaut32/typelib2.c | 60 ++++++++++++++++++++--------------------------
1 files changed, 26 insertions(+), 34 deletions(-)
diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index 4544317..dd42ab4 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -1406,43 +1406,35 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeFlags(ICreateTypeInfo2 *iface, U
TRACE("(%p,0x%x)\n", iface, uTypeFlags);
- This->typeinfo->flags = uTypeFlags;
+ if (uTypeFlags & (TYPEFLAG_FDISPATCHABLE|TYPEFLAG_FDUAL)) {
+ static const WCHAR stdole2tlb[] = { 's','t','d','o','l','e','2','.','t','l','b',0 };
+ ITypeLib *stdole;
+ ITypeInfo *dispatch;
+ HREFTYPE hreftype;
+ HRESULT hres;
- if (uTypeFlags & TYPEFLAG_FDISPATCHABLE) {
- MSFT_GuidEntry foo;
- int guidoffset;
- int fileoffset;
- MSFT_ImpInfo impinfo;
- static const WCHAR stdole2tlb[] = { 's','t','d','o','l','e','2','.','t','l','b',0 };
-
- foo.guid = IID_StdOle;
- foo.hreftype = 2;
- foo.next_hash = -1;
- guidoffset = ctl2_alloc_guid(This->typelib, &foo);
- if (guidoffset == -1) return E_OUTOFMEMORY;
-
- fileoffset = ctl2_alloc_importfile(This->typelib, guidoffset,
- This->typelib->typelib_header.lcid2, 2, 0, stdole2tlb);
- if (fileoffset == -1) return E_OUTOFMEMORY;
-
- foo.guid = IID_IDispatch;
- foo.hreftype = 1;
- foo.next_hash = -1;
- guidoffset = ctl2_alloc_guid(This->typelib, &foo);
- if (guidoffset == -1) return E_OUTOFMEMORY;
-
- impinfo.flags = TKIND_INTERFACE << 24 | MSFT_IMPINFO_OFFSET_IS_GUID;
- impinfo.oImpFile = fileoffset;
- impinfo.oGuid = guidoffset;
- ctl2_alloc_importinfo(This->typelib, &impinfo);
-
- This->typelib->typelib_header.dispatchpos = 1;
-
- This->typeinfo->typekind |= 0x10;
- This->typeinfo->typekind &= ~0x0f;
- This->typeinfo->typekind |= TKIND_DISPATCH;
+ hres = LoadTypeLib(stdole2tlb, &stdole);
+ if(FAILED(hres))
+ return hres;
+
+ hres = ITypeLib_GetTypeInfoOfGuid(stdole, &IID_IDispatch, &dispatch);
+ ITypeLib_Release(stdole);
+ if(FAILED(hres))
+ return hres;
+
+ hres = ICreateTypeInfo2_AddRefTypeInfo(iface, dispatch, &hreftype);
+ ITypeInfo_Release(dispatch);
+ if(FAILED(hres))
+ return hres;
}
+ if(uTypeFlags & TYPEFLAG_FDUAL) {
+ This->typeinfo->typekind |= 0x10;
+ This->typeinfo->typekind &= ~0x0f;
+ This->typeinfo->typekind |= TKIND_DISPATCH;
+ }
+
+ This->typeinfo->flags = uTypeFlags;
return S_OK;
}
More information about the wine-cvs
mailing list