- Timestamp:
- Nov 9, 1999, 12:04:33 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/oleaut32/typelib.cpp
r914 r1656 1 /* $Id: typelib.cpp,v 1. 4 1999-09-12 21:51:03 davidrExp $ */1 /* $Id: typelib.cpp,v 1.5 1999-11-09 11:04:33 bird Exp $ */ 2 2 /* 3 3 * TYPELIB … … 28 28 * -. some methods just return pointers to internal data structures, this is 29 29 * partly laziness, partly I want to check how windows does it. 30 * 30 * 31 31 */ 32 32 … … 46 46 #include "winversion.h" 47 47 /* FIXME: get rid of these */ 48 typedef struct ITypeInfoVtbl ITypeLib_VTable, *LPTYPEINFO_VTABLE ; 49 typedef struct ITypeLibVtbl *LPTYPELIB_VTABLE ; 48 typedef struct ITypeInfoVtbl ITypeLib_VTable, *LPTYPEINFO_VTABLE ; 49 typedef struct ITypeLibVtbl *LPTYPELIB_VTABLE ; 50 50 #include "typelib.h" 51 51 … … 53 53 DECLARE_DEBUG_CHANNEL(typelib) 54 54 55 55 56 56 /**************************************************************************** 57 57 * QueryPathOfRegTypeLib [OLEAUT32.164] … … 60 60 */ 61 61 HRESULT WINAPI 62 QueryPathOfRegTypeLib( 62 QueryPathOfRegTypeLib( 63 63 REFGUID guid, /* [in] referenced guid */ 64 64 WORD wMaj, /* [in] major version */ … … 135 135 HRESULT res; 136 136 TRACE_(typelib)("('%s',%p)\n",debugstr_w(szFile),pptLib); 137 137 138 138 p=HEAP_strdupWtoA(GetProcessHeap(),0,szFile); 139 139 res= TLB_ReadTypeLib(p, pptLib); … … 148 148 * LoadRegTypeLib [OLEAUT32.162] 149 149 */ 150 HRESULT WINAPI LoadRegTypeLib( 150 HRESULT WINAPI LoadRegTypeLib( 151 151 REFGUID rguid, /* [in] referenced guid */ 152 152 WORD wVerMajor, /* [in] major version */ … … 169 169 } 170 170 return res; 171 } 171 } 172 172 173 173 174 174 /****************************************************************************** 175 175 * RegisterTypeLib [OLEAUT32.163] 176 * Adds information about a type library to the System Registry 176 * Adds information about a type library to the System Registry 177 177 * NOTES 178 178 * Docs: ITypeLib FAR * ptlib … … 196 196 /****************************************************************************** 197 197 * UnRegisterTypeLib [OLEAUT32.186] 198 * Removes information about a type library from the System Registry 198 * Removes information about a type library from the System Registry 199 199 * NOTES 200 200 * … … 209 209 LCID lcid, /* [in] locale id */ 210 210 SYSKIND syskind) 211 { 211 { 212 212 char xriid[50]; 213 213 WINE_StringFromCLSID((LPCLSID)libid,xriid); … … 223 223 /* ITypeLib methods */ 224 224 static HRESULT WINAPI ITypeLib_fnQueryInterface( LPTYPELIB This, REFIID riid, 225 VOID **ppvObject); 226 static ULONG WINAPI ITypeLib_fnAddRef( LPTYPELIB This); 227 static ULONG WINAPI ITypeLib_fnRelease( LPTYPELIB This); 228 static UINT WINAPI ITypeLib_fnGetTypeInfoCount( LPTYPELIB This); 229 static HRESULT WINAPI ITypeLib_fnGetTypeInfo( LPTYPELIB This, UINT index, 230 ITypeInfo **ppTInfo); 225 VOID **ppvObject); 226 static ULONG WINAPI ITypeLib_fnAddRef( LPTYPELIB This); 227 static ULONG WINAPI ITypeLib_fnRelease( LPTYPELIB This); 228 static UINT WINAPI ITypeLib_fnGetTypeInfoCount( LPTYPELIB This); 229 static HRESULT WINAPI ITypeLib_fnGetTypeInfo( LPTYPELIB This, UINT index, 230 ITypeInfo **ppTInfo); 231 231 232 232 static HRESULT WINAPI ITypeLib_fnGetTypeInfoType( LPTYPELIB This, UINT index, 233 TYPEKIND *pTKind); 233 TYPEKIND *pTKind); 234 234 235 235 static HRESULT WINAPI ITypeLib_fnGetTypeInfoOfGuid( LPTYPELIB This, REFGUID guid, 236 236 ITypeInfo **ppTinfo); 237 237 238 static HRESULT WINAPI ITypeLib_fnGetLibAttr( LPTYPELIB This, 239 LPTLIBATTR *ppTLibAttr); 238 static HRESULT WINAPI ITypeLib_fnGetLibAttr( LPTYPELIB This, 239 LPTLIBATTR *ppTLibAttr); 240 240 241 241 static HRESULT WINAPI ITypeLib_fnGetTypeComp( LPTYPELIB This, 242 ITypeComp **ppTComp); 242 ITypeComp **ppTComp); 243 243 244 244 static HRESULT WINAPI ITypeLib_fnGetDocumentation( LPTYPELIB This, INT index, 245 BSTR *pBstrName, BSTR *pBstrDocString, DWORD *pdwHelpContext, 245 BSTR *pBstrName, BSTR *pBstrDocString, DWORD *pdwHelpContext, 246 246 BSTR *pBstrHelpFile); 247 247 … … 255 255 TLIBATTR *pTLibAttr); 256 256 257 static HRESULT WINAPI ITypeLib2_fnGetCustData( ITypeLib * This, REFGUID guid, 258 VARIANT *pVarVal); 259 260 static HRESULT WINAPI ITypeLib2_fnGetLibStatistics( ITypeLib * This, 261 UINT *pcUniqueNames, UINT *pcchUniqueNames); 262 263 static HRESULT WINAPI ITypeLib2_fnGetDocumentation2( ITypeLib * This, 257 static HRESULT WINAPI ITypeLib2_fnGetCustData( ITypeLib * This, REFGUID guid, 258 VARIANT *pVarVal); 259 260 static HRESULT WINAPI ITypeLib2_fnGetLibStatistics( ITypeLib * This, 261 UINT *pcUniqueNames, UINT *pcchUniqueNames); 262 263 static HRESULT WINAPI ITypeLib2_fnGetDocumentation2( ITypeLib * This, 264 264 INT index, LCID lcid, BSTR *pbstrHelpString, 265 INT *pdwHelpStringContext, BSTR *pbstrHelpStringDll); 265 INT *pdwHelpStringContext, BSTR *pbstrHelpStringDll); 266 266 267 267 static HRESULT WINAPI ITypeLib2_fnGetAllCustData( ITypeLib * This, … … 289 289 290 290 static HRESULT WINAPI ITypeInfo_fnQueryInterface( LPTYPEINFO This, REFIID riid, 291 VOID **ppvObject); 292 static ULONG WINAPI ITypeInfo_fnAddRef( LPTYPEINFO This); 293 static ULONG WINAPI ITypeInfo_fnRelease( LPTYPEINFO This); 291 VOID **ppvObject); 292 static ULONG WINAPI ITypeInfo_fnAddRef( LPTYPEINFO This); 293 static ULONG WINAPI ITypeInfo_fnRelease( LPTYPEINFO This); 294 294 static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( LPTYPEINFO This, 295 LPTYPEATTR *ppTypeAttr); 295 LPTYPEATTR *ppTypeAttr); 296 296 297 297 static HRESULT WINAPI ITypeInfo_fnGetTypeComp( LPTYPEINFO This, 298 ITypeComp * *ppTComp); 298 ITypeComp * *ppTComp); 299 299 300 300 static HRESULT WINAPI ITypeInfo_fnGetFuncDesc( LPTYPEINFO This, UINT index, 301 LPFUNCDESC *ppFuncDesc); 301 LPFUNCDESC *ppFuncDesc); 302 302 303 303 static HRESULT WINAPI ITypeInfo_fnGetVarDesc( LPTYPEINFO This, UINT index, 304 LPVARDESC *ppVarDesc); 304 LPVARDESC *ppVarDesc); 305 305 306 306 static HRESULT WINAPI ITypeInfo_fnGetNames( LPTYPEINFO This, MEMBERID memid, … … 309 309 310 310 static HRESULT WINAPI ITypeInfo_fnGetRefTypeOfImplType( LPTYPEINFO This, 311 UINT index, HREFTYPE *pRefType); 311 UINT index, HREFTYPE *pRefType); 312 312 313 313 static HRESULT WINAPI ITypeInfo_fnGetImplTypeFlags( LPTYPEINFO This, 314 UINT index, INT *pImplTypeFlags); 314 UINT index, INT *pImplTypeFlags); 315 315 316 316 static HRESULT WINAPI ITypeInfo_fnGetIDsOfNames( LPTYPEINFO This, 317 LPOLESTR *rgszNames, UINT cNames, MEMBERID *pMemId); 317 LPOLESTR *rgszNames, UINT cNames, MEMBERID *pMemId); 318 318 319 319 static HRESULT WINAPI ITypeInfo_fnInvoke( LPTYPEINFO This, VOID *pIUnk, 320 MEMBERID memid, UINT16 dwFlags, DISPPARAMS *pDispParams, 320 MEMBERID memid, UINT16 dwFlags, DISPPARAMS *pDispParams, 321 321 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *pArgErr); 322 322 323 323 static HRESULT WINAPI ITypeInfo_fnGetDocumentation( LPTYPEINFO This, 324 MEMBERID memid, BSTR *pBstrName, BSTR *pBstrDocString, 325 DWORD *pdwHelpContext, BSTR *pBstrHelpFile); 324 MEMBERID memid, BSTR *pBstrName, BSTR *pBstrDocString, 325 DWORD *pdwHelpContext, BSTR *pBstrHelpFile); 326 326 327 327 static HRESULT WINAPI ITypeInfo_fnGetDllEntry( LPTYPEINFO This, 328 328 MEMBERID memid, INVOKEKIND invKind, BSTR *pBstrDllName, 329 BSTR *pBstrName, WORD *pwOrdinal); 329 BSTR *pBstrName, WORD *pwOrdinal); 330 330 331 331 static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( LPTYPEINFO This, 332 HREFTYPE hRefType, ITypeInfo * *ppTInfo); 332 HREFTYPE hRefType, ITypeInfo * *ppTInfo); 333 333 334 334 static HRESULT WINAPI ITypeInfo_fnAddressOfMember( LPTYPEINFO This, 335 MEMBERID memid, INVOKEKIND invKind, PVOID *ppv); 336 337 static HRESULT WINAPI ITypeInfo_fnCreateInstance( LPTYPEINFO This, 338 IUnknown *pUnk, REFIID riid, VOID * *ppvObj); 339 340 static HRESULT WINAPI ITypeInfo_fnGetMops( LPTYPEINFO This, MEMBERID memid, 335 MEMBERID memid, INVOKEKIND invKind, PVOID *ppv); 336 337 static HRESULT WINAPI ITypeInfo_fnCreateInstance( LPTYPEINFO This, 338 IUnknown *pUnk, REFIID riid, VOID * *ppvObj); 339 340 static HRESULT WINAPI ITypeInfo_fnGetMops( LPTYPEINFO This, MEMBERID memid, 341 341 BSTR *pBstrMops); 342 342 343 343 344 344 static HRESULT WINAPI ITypeInfo_fnGetContainingTypeLib( LPTYPEINFO This, 345 ITypeLib * *ppTLib, UINT *pIndex); 345 ITypeLib * *ppTLib, UINT *pIndex); 346 346 347 347 static HRESULT WINAPI ITypeInfo_fnReleaseTypeAttr( LPTYPEINFO This, 348 TYPEATTR *pTypeAttr); 348 TYPEATTR *pTypeAttr); 349 349 350 350 static HRESULT WINAPI ITypeInfo_fnReleaseFuncDesc( LPTYPEINFO This, 351 FUNCDESC *pFuncDesc); 351 FUNCDESC *pFuncDesc); 352 352 353 353 static HRESULT WINAPI ITypeInfo_fnReleaseVarDesc( LPTYPEINFO This, 354 VARDESC *pVarDesc); 354 VARDESC *pVarDesc); 355 355 /* itypeinfo2 methods */ 356 356 static HRESULT WINAPI ITypeInfo2_fnGetTypeKind( ITypeInfo * This, … … 477 477 { 478 478 DWORD bytesread=0; 479 479 480 480 if (( where != DO_NOT_SEEK && 481 481 (0xffffffff == SetFilePointer( pcx->hFile, where, 0,FILE_BEGIN)) … … 526 526 } 527 527 /* 528 * read a value and fill a VARIANT structure 528 * read a value and fill a VARIANT structure 529 529 */ 530 530 static void TLB_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx ) … … 536 536 return; 537 537 } 538 TLB_Read(&(pVar->vt), sizeof(VARTYPE), pcx, 538 TLB_Read(&(pVar->vt), sizeof(VARTYPE), pcx, 539 539 pcx->pTblDir->pCustData.offset + offset ); 540 540 switch(pVar->vt){ … … 544 544 case VT_I4 : 545 545 case VT_R4 : 546 case VT_ERROR : 547 case VT_BOOL : 548 case VT_I1 : 549 case VT_UI1 : 550 case VT_UI2 : 551 case VT_UI4 : 552 case VT_INT : 553 case VT_UINT : 546 case VT_ERROR : 547 case VT_BOOL : 548 case VT_I1 : 549 case VT_UI1 : 550 case VT_UI2 : 551 case VT_UI4 : 552 case VT_INT : 553 case VT_UINT : 554 554 case VT_VOID : /* FIXME: is this right? */ 555 case VT_HRESULT : 555 case VT_HRESULT : 556 556 size=4; break; 557 557 case VT_R8 : 558 558 case VT_CY : 559 case VT_DATE : 560 case VT_I8 : 561 case VT_UI8 : 559 case VT_DATE : 560 case VT_I8 : 561 case VT_UI8 : 562 562 case VT_DECIMAL : /* FIXME: is this right? */ 563 563 case VT_FILETIME : … … 578 578 /* FIXME: this will not work AT ALL when the variant contains a pointer */ 579 579 case VT_DISPATCH : 580 case VT_VARIANT : 581 case VT_UNKNOWN : 582 case VT_PTR : 580 case VT_VARIANT : 581 case VT_UNKNOWN : 582 case VT_PTR : 583 583 case VT_SAFEARRAY : 584 case VT_CARRAY : 585 case VT_USERDEFINED : 586 case VT_LPSTR : 587 case VT_LPWSTR : 588 case VT_BLOB : 589 case VT_STREAM : 590 case VT_STORAGE : 591 case VT_STREAMED_OBJECT : 592 case VT_STORED_OBJECT : 593 case VT_BLOB_OBJECT : 594 case VT_CF : 595 case VT_CLSID : 596 default: 597 size=0; 584 case VT_CARRAY : 585 case VT_USERDEFINED : 586 case VT_LPSTR : 587 case VT_LPWSTR : 588 case VT_BLOB : 589 case VT_STREAM : 590 case VT_STORAGE : 591 case VT_STREAMED_OBJECT : 592 case VT_STORED_OBJECT : 593 case VT_BLOB_OBJECT : 594 case VT_CF : 595 case VT_CLSID : 596 default: 597 size=0; 598 598 FIXME_(ole)("VARTYPE %d is not supported, setting pointer to NULL\n", 599 599 pVar->vt); … … 615 615 count++; 616 616 pNew=(TLBCustData* )TLB_Alloc(sizeof(TLBCustData)); 617 TLB_Read(&entry, sizeof(entry), pcx, 617 TLB_Read(&entry, sizeof(entry), pcx, 618 618 pcx->pTblDir->pCDGuids.offset+offset); 619 619 TLB_ReadGuid(&(pNew->guid), entry.GuidOffset , pcx); … … 637 637 int offset, TLBFuncDesc ** pptfd) 638 638 { 639 /* 639 /* 640 640 * member information is stored in a data structure at offset 641 641 * indicated by the memoffset field of the typeinfo structure 642 642 * There are several distinctive parts. 643 * the first part starts with a field that holds the total length 643 * the first part starts with a field that holds the total length 644 644 * of this (first) part excluding this field. Then follow the records, 645 645 * for each member there is one record. 646 646 * 647 647 * First entry is always the length of the record (excluding this 648 * length word). 649 * Rest of the record depends on the type of the member. If there is 648 * length word). 649 * Rest of the record depends on the type of the member. If there is 650 650 * a field indicating the member type (function variable intereface etc) 651 651 * I have not found it yet. At this time we depend on the information … … 654 654 * Second follows an array sized nrMEM*sizeof(INT) with a memeber id 655 655 * for each member; 656 * 657 * Third is a equal sized array with file offsets to the name entry 656 * 657 * Third is a equal sized array with file offsets to the name entry 658 658 * of each member. 659 * 659 * 660 660 * Forth and last (?) part is an array with offsets to the records in the 661 661 * first part of this file segment. … … 671 671 *pptfd=(TLBFuncDesc*)TLB_Alloc(sizeof(TLBFuncDesc)); 672 672 /* name, eventually add to a hash table */ 673 TLB_Read(&nameoffset, sizeof(INT), pcx, 673 TLB_Read(&nameoffset, sizeof(INT), pcx, 674 674 offset + infolen + (cFuncs + cVars + i + 1) * sizeof(INT)); 675 675 (*pptfd)->Name=TLB_ReadName(pcx, nameoffset); … … 677 677 TLB_Read(&reclength, sizeof(INT), pcx, recoffset); 678 678 reclength &=0x1ff; 679 TLB_Read(pFuncRec, reclength - sizeof(INT), pcx, DO_NOT_SEEK) ; 679 TLB_Read(pFuncRec, reclength - sizeof(INT), pcx, DO_NOT_SEEK) ; 680 680 /* do the attributes */ 681 681 nrattributes=(reclength-pFuncRec->nrargs*3*sizeof(int)-0x18) … … 702 702 } 703 703 /* fill the FuncDesc Structure */ 704 TLB_Read(&(*pptfd)->funcdesc.memid, sizeof(INT), pcx, 704 TLB_Read(&(*pptfd)->funcdesc.memid, sizeof(INT), pcx, 705 705 offset + infolen + ( i + 1) * sizeof(INT)); 706 706 (*pptfd)->funcdesc.funckind = (tagFUNCKIND)((pFuncRec->FKCCIC) & 0x7); … … 711 711 (*pptfd)->funcdesc.oVft = pFuncRec->VtableOffset ; 712 712 (*pptfd)->funcdesc.wFuncFlags = LOWORD(pFuncRec->Flags) ; 713 TLB_GetTdesc(pcx, pFuncRec->DataType, 713 TLB_GetTdesc(pcx, pFuncRec->DataType, 714 714 &(*pptfd)->funcdesc.elemdescFunc.tdesc) ; 715 715 716 716 /* do the parameters/arguments */ 717 717 if(pFuncRec->nrargs){ … … 725 725 pFuncRec->nrargs * sizeof(TLBParameterInfo)); 726 726 for(j=0;j<pFuncRec->nrargs;j++){ 727 TLB_GetTdesc(pcx, paraminfo.DataType, 727 TLB_GetTdesc(pcx, paraminfo.DataType, 728 728 &(*pptfd)->funcdesc.lprgelemdescParam[j].tdesc) ; 729 729 V_UNION(&((*pptfd)->funcdesc.lprgelemdescParam[j]), … … 748 748 pParamDesc->pparamdescex = (tagPARAMDESCEX*)TLB_Alloc(sizeof(PARAMDESCEX)); 749 749 pParamDesc->pparamdescex->cBytes= sizeof(PARAMDESCEX); 750 TLB_ReadValue(&(pParamDesc->pparamdescex->varDefaultValue), 750 TLB_ReadValue(&(pParamDesc->pparamdescex->varDefaultValue), 751 751 pInt[j], pcx); 752 752 } … … 773 773 int recoffset; 774 774 TLB_Read(&infolen,sizeof(INT), pcx, offset); 775 TLB_Read(&recoffset,sizeof(INT), pcx, offset + infolen + 775 TLB_Read(&recoffset,sizeof(INT), pcx, offset + infolen + 776 776 ((cFuncs+cVars)*2+cFuncs + 1)*sizeof(INT)); 777 777 recoffset += offset+sizeof(INT); … … 779 779 *pptvd=(TLBVarDesc*)TLB_Alloc(sizeof(TLBVarDesc)); 780 780 /* name, eventually add to a hash table */ 781 TLB_Read(&nameoffset, sizeof(INT), pcx, 781 TLB_Read(&nameoffset, sizeof(INT), pcx, 782 782 offset + infolen + (cFuncs + cVars + i + 1) * sizeof(INT)); 783 783 (*pptvd)->Name=TLB_ReadName(pcx, nameoffset); … … 785 785 TLB_Read(&reclength, sizeof(INT), pcx, recoffset); 786 786 reclength &=0xff; 787 TLB_Read(pVarRec, reclength - sizeof(INT), pcx, DO_NOT_SEEK) ; 787 TLB_Read(pVarRec, reclength - sizeof(INT), pcx, DO_NOT_SEEK) ; 788 788 /* Optional data */ 789 789 if(reclength >(6*sizeof(INT)) ) … … 795 795 (*pptvd)->HelpStringContext=pVarRec->HelpStringContext; 796 796 /* fill the VarDesc Structure */ 797 TLB_Read(&(*pptvd)->vardesc.memid, sizeof(INT), pcx, 797 TLB_Read(&(*pptvd)->vardesc.memid, sizeof(INT), pcx, 798 798 offset + infolen + ( i + 1) * sizeof(INT)); 799 799 (*pptvd)->vardesc.varkind = (tagVARKIND)pVarRec->VarKind; 800 800 (*pptvd)->vardesc.wVarFlags = pVarRec->Flags; 801 TLB_GetTdesc(pcx, pVarRec->DataType, 801 TLB_GetTdesc(pcx, pVarRec->DataType, 802 802 &(*pptvd)->vardesc.elemdescVar.tdesc) ; 803 803 /* (*pptvd)->vardesc.lpstrSchema; is reserved (SDK) fixme?? */ 804 804 if(pVarRec->VarKind == VAR_CONST ){ 805 805 V_UNION(&((*pptvd)->vardesc),lpvarValue)=(VARIANT*)TLB_Alloc(sizeof(VARIANT)); 806 TLB_ReadValue(V_UNION(&((*pptvd)->vardesc),lpvarValue), 806 TLB_ReadValue(V_UNION(&((*pptvd)->vardesc),lpvarValue), 807 807 pVarRec->OffsValue, pcx); 808 808 }else … … 816 816 * If comes fom import, its an offset+1 in the ImpInfo table 817 817 * */ 818 static void TLB_DoRefType(TLBContext *pcx, 818 static void TLB_DoRefType(TLBContext *pcx, 819 819 int offset, TLBRefType ** pprtd) 820 820 { … … 824 824 TLBImpInfo impinfo; 825 825 TLBImpLib *pImpLib=(pcx->pLibInfo->pImpLibs); 826 TLB_Read(&impinfo, sizeof(impinfo), pcx, 826 TLB_Read(&impinfo, sizeof(impinfo), pcx, 827 827 pcx->pTblDir->pImpInfo.offset + (offset & 0xfffffffc)); 828 828 for(j=0;pImpLib;j++){ /* search the known offsets of all import libraries */ … … 896 896 ptiRet->TypeAttr.cbSizeVft=tiBase.cbSizeVft; /* FIXME: this is only the non inherited part */ 897 897 if(ptiRet->TypeAttr.typekind == TKIND_ALIAS) 898 TLB_GetTdesc(pcx, tiBase.datatype1, 898 TLB_GetTdesc(pcx, tiBase.datatype1, 899 899 &ptiRet->TypeAttr.tdescAlias) ; 900 900 /* FIXME: */ … … 913 913 /* functions */ 914 914 if(ptiRet->TypeAttr.cFuncs >0 ) 915 TLB_DoFuncs(pcx, ptiRet->TypeAttr.cFuncs ,ptiRet->TypeAttr.cVars, 915 TLB_DoFuncs(pcx, ptiRet->TypeAttr.cFuncs ,ptiRet->TypeAttr.cVars, 916 916 tiBase.memoffset, & ptiRet->funclist); 917 917 /* variables */ 918 918 if(ptiRet->TypeAttr.cVars >0 ) 919 TLB_DoVars(pcx, ptiRet->TypeAttr.cFuncs ,ptiRet->TypeAttr.cVars, 919 TLB_DoVars(pcx, ptiRet->TypeAttr.cFuncs ,ptiRet->TypeAttr.cVars, 920 920 tiBase.memoffset, & ptiRet->varlist); 921 921 if(ptiRet->TypeAttr.cImplTypes >0 ){ 922 922 if(ptiRet->TypeAttr.typekind == TKIND_COCLASS) 923 TLB_DoImplTypes(pcx, ptiRet->TypeAttr.cImplTypes , 923 TLB_DoImplTypes(pcx, ptiRet->TypeAttr.cImplTypes , 924 924 tiBase.datatype1, & ptiRet->impltypelist); 925 925 else if(ptiRet->TypeAttr.typekind != TKIND_DISPATCH){ … … 1074 1074 (tlbHeader.varflags & HELPDLLFLAG? 4 :0); 1075 1075 /* now read the segment directory */ 1076 TLB_Read((void*)&tlbSegDir, sizeof(tlbSegDir), &cx, oStart + lPSegDir); 1076 TLB_Read((void*)&tlbSegDir, sizeof(tlbSegDir), &cx, oStart + lPSegDir); 1077 1077 cx.pTblDir=&tlbSegDir; 1078 1078 /* just check two entries */ … … 1148 1148 V_UNION(&(pLibInfo->pTypeDesc[i]),lpadesc)->cDims=td[2]; 1149 1149 for(j=0;j<td[2];j++){ 1150 TLB_Read(& V_UNION(&(pLibInfo->pTypeDesc[i]),lpadesc)->rgbounds[j].cElements, 1150 TLB_Read(& V_UNION(&(pLibInfo->pTypeDesc[i]),lpadesc)->rgbounds[j].cElements, 1151 1151 sizeof(INT), &cx, DO_NOT_SEEK); 1152 1152 TLB_Read(& V_UNION(&(pLibInfo->pTypeDesc[i]),lpadesc) 1153 ->rgbounds[j].lLbound, 1153 ->rgbounds[j].lLbound, 1154 1154 sizeof(INT), &cx, DO_NOT_SEEK); 1155 1155 } … … 1211 1211 } 1212 1212 *ppvObject=NULL; 1213 if(IsEqualIID(riid, &IID_IUnknown) || 1213 if(IsEqualIID(riid, &IID_IUnknown) || 1214 1214 IsEqualIID(riid,&IID_ITypeLib)|| 1215 1215 IsEqualIID(riid,&IID_ITypeLib2)) 1216 1216 *ppvObject = This; 1217 1217 if(*ppvObject){ 1218 ( *(LPTYPELIB*)ppvObject)->lpvtbl->fnAddRef(This);1218 (ICOM_VTBL(*(LPTYPELIB*)ppvObject))->fnAddRef(This); 1219 1219 TRACE_(typelib)("-- Interface: (%p)->(%p)\n",ppvObject,*ppvObject); 1220 1220 return S_OK; … … 1244 1244 1245 1245 /* ITypeLib::GetTypeInfoCount 1246 * 1246 * 1247 1247 * Returns the number of type descriptions in the type library 1248 1248 */ … … 1258 1258 *etrieves the specified type description in the library. 1259 1259 */ 1260 static HRESULT WINAPI ITypeLib_fnGetTypeInfo( LPTYPELIB iface, UINT index, 1260 static HRESULT WINAPI ITypeLib_fnGetTypeInfo( LPTYPELIB iface, UINT index, 1261 1261 ITypeInfo **ppTInfo) 1262 1262 { … … 1314 1314 TRACE_(typelib)("(%p) guid %sx)\n",This,xriid); 1315 1315 } 1316 for(i=0,*ppTLBTInfo=This->pTypeInfo;*ppTLBTInfo && 1316 for(i=0,*ppTLBTInfo=This->pTypeInfo;*ppTLBTInfo && 1317 1317 !IsEqualIID(guid,&(*ppTLBTInfo)->TypeAttr.guid);i++) 1318 1318 *ppTLBTInfo=(*ppTLBTInfo)->next; … … 1331 1331 * 1332 1332 */ 1333 static HRESULT WINAPI ITypeLib_fnGetLibAttr( LPTYPELIB iface, 1333 static HRESULT WINAPI ITypeLib_fnGetLibAttr( LPTYPELIB iface, 1334 1334 LPTLIBATTR *ppTLibAttr) 1335 1335 { … … 1363 1363 */ 1364 1364 static HRESULT WINAPI ITypeLib_fnGetDocumentation( LPTYPELIB iface, INT index, 1365 BSTR *pBstrName, BSTR *pBstrDocString, DWORD *pdwHelpContext, 1365 BSTR *pBstrName, BSTR *pBstrDocString, DWORD *pdwHelpContext, 1366 1366 BSTR *pBstrHelpFile) 1367 1367 { … … 1421 1421 for(pVInfo=pTInfo->varlist;pVInfo;pVInfo=pVInfo->next) ; 1422 1422 if(!strcmp(astr,pVInfo->Name)) goto ITypeLib_fnIsName_exit; 1423 1423 1424 1424 } 1425 1425 *pfName=FALSE; … … 1428 1428 TRACE_(typelib)("(%p)slow! search for %s: %s found!\n", This, 1429 1429 debugstr_a(astr), *pfName?"NOT":""); 1430 1430 1431 1431 HeapFree( GetProcessHeap(), 0, astr ); 1432 1432 return S_OK; … … 1468 1468 1469 1469 *pcFound=j; 1470 1470 1471 1471 HeapFree( GetProcessHeap(), 0, astr ); 1472 1472 return S_OK; … … 1489 1489 * gets the custom data 1490 1490 */ 1491 static HRESULT WINAPI ITypeLib2_fnGetCustData( ITypeLib * iface, REFGUID guid, 1491 static HRESULT WINAPI ITypeLib2_fnGetCustData( ITypeLib * iface, REFGUID guid, 1492 1492 VARIANT *pVarVal) 1493 1493 { … … 1516 1516 * 1517 1517 */ 1518 static HRESULT WINAPI ITypeLib2_fnGetLibStatistics( ITypeLib * iface, 1518 static HRESULT WINAPI ITypeLib2_fnGetLibStatistics( ITypeLib * iface, 1519 1519 UINT *pcUniqueNames, UINT *pcchUniqueNames) 1520 1520 { … … 1533 1533 * 1534 1534 */ 1535 static HRESULT WINAPI ITypeLib2_fnGetDocumentation2( ITypeLib * iface, 1535 static HRESULT WINAPI ITypeLib2_fnGetDocumentation2( ITypeLib * iface, 1536 1536 INT index, LCID lcid, BSTR *pbstrHelpString, 1537 1537 INT *pdwHelpStringContext, BSTR *pbstrHelpStringDll) … … 1568 1568 /* ITypeLib2::GetAllCustData 1569 1569 * 1570 * Gets all custom data items for the library. 1570 * Gets all custom data items for the library. 1571 1571 * 1572 1572 */ … … 1577 1577 TLBCustData *pCData; 1578 1578 int i; 1579 TRACE_(typelib)("(%p) returning %d items\n", This, This->ctCustData); 1579 TRACE_(typelib)("(%p) returning %d items\n", This, This->ctCustData); 1580 1580 pCustData->prgCustData = (tagCUSTDATAITEM*)TLB_Alloc(This->ctCustData * sizeof(CUSTDATAITEM)); 1581 1581 if(pCustData->prgCustData ){ … … 1607 1607 } 1608 1608 *ppvObject=NULL; 1609 if(IsEqualIID(riid, &IID_IUnknown) || 1609 if(IsEqualIID(riid, &IID_IUnknown) || 1610 1610 IsEqualIID(riid,&IID_ITypeInfo)|| 1611 1611 IsEqualIID(riid,&IID_ITypeInfo2)) 1612 1612 *ppvObject = This; 1613 1613 if(*ppvObject){ 1614 ( *(LPTYPEINFO*)ppvObject)->lpvtbl->fnAddRef(iface);1614 (ICOM_VTBL(*(LPTYPEINFO*)ppvObject))->fnAddRef(iface); 1615 1615 TRACE_(typelib)("-- Interface: (%p)->(%p)\n",ppvObject,*ppvObject); 1616 1616 return S_OK; … … 1682 1682 ICOM_THIS( TLBTypeInfo, iface); 1683 1683 int i; 1684 TLBFuncDesc * pFDesc; 1684 TLBFuncDesc * pFDesc; 1685 1685 TRACE_(typelib)("(%p) index %d\n", This, index); 1686 1686 for(i=0, pFDesc=This->funclist; i!=index && pFDesc; i++, pFDesc=pFDesc->next) … … 1696 1696 /* ITypeInfo::GetVarDesc 1697 1697 * 1698 * Retrieves a VARDESC structure that describes the specified variable. 1698 * Retrieves a VARDESC structure that describes the specified variable. 1699 1699 * 1700 1700 */ … … 1704 1704 ICOM_THIS( TLBTypeInfo, iface); 1705 1705 int i; 1706 TLBVarDesc * pVDesc; 1706 TLBVarDesc * pVDesc; 1707 1707 TRACE_(typelib)("(%p) index %d\n", This, index); 1708 1708 for(i=0, pVDesc=This->varlist; i!=index && pVDesc; i++, pVDesc=pVDesc->next) … … 1726 1726 { 1727 1727 ICOM_THIS( TLBTypeInfo, iface); 1728 TLBFuncDesc * pFDesc; 1729 TLBVarDesc * pVDesc; 1728 TLBFuncDesc * pFDesc; 1729 TLBVarDesc * pVDesc; 1730 1730 int i; 1731 1731 TRACE_(typelib)("(%p) memid=0x%08lx Maxname=%d\n", This, memid, … … 1740 1740 else 1741 1741 rgBstrNames[i]=TLB_DupAtoBstr(pFDesc->pParamDesc[i-1].Name); 1742 1742 1743 1743 } 1744 1744 *pcNames=i; … … 1751 1751 *pcNames=1; 1752 1752 }else{ 1753 if(This->TypeAttr.typekind==TKIND_INTERFACE && 1753 if(This->TypeAttr.typekind==TKIND_INTERFACE && 1754 1754 This->TypeAttr.cImplTypes ){ 1755 1755 /* recursive search */ 1756 1756 ITypeInfo *pTInfo; 1757 1757 HRESULT result; 1758 result=This->lpvtbl->fnGetRefTypeInfo(iface, 1758 result=This->lpvtbl->fnGetRefTypeInfo(iface, 1759 1759 This->impltypelist->reference, &pTInfo); 1760 1760 if(SUCCEEDED(result)){ 1761 result= pTInfo->lpvtbl->fnGetNames(pTInfo, memid, rgBstrNames,1761 result=ICOM_VTBL(pTInfo)->fnGetNames(pTInfo, memid, rgBstrNames, 1762 1762 cMaxNames, pcNames); 1763 pTInfo->lpvtbl->fnRelease(pTInfo);1763 ICOM_VTBL(pTInfo)->fnRelease(pTInfo); 1764 1764 return result; 1765 1765 } … … 1801 1801 1802 1802 /* ITypeInfo::GetImplTypeFlags 1803 * 1804 * Retrieves the IMPLTYPEFLAGS enumeration for one implemented interface 1803 * 1804 * Retrieves the IMPLTYPEFLAGS enumeration for one implemented interface 1805 1805 * or base interface in a type description. 1806 1806 */ … … 1830 1830 { 1831 1831 ICOM_THIS( TLBTypeInfo, iface); 1832 TLBFuncDesc * pFDesc; 1833 TLBVarDesc * pVDesc; 1832 TLBFuncDesc * pFDesc; 1833 TLBVarDesc * pVDesc; 1834 1834 HRESULT ret=S_OK; 1835 1835 PCHAR aszName= HEAP_strdupWtoA( GetProcessHeap(), 0, *rgszNames); … … 1850 1850 else 1851 1851 ret=DISP_E_UNKNOWNNAME; 1852 HeapFree( GetProcessHeap(), 0, aszPar); 1852 HeapFree( GetProcessHeap(), 0, aszPar); 1853 1853 }; 1854 1854 HeapFree (GetProcessHeap(), 0, aszName); 1855 1855 return ret; 1856 1856 } 1857 } 1857 } 1858 1858 for(pVDesc=This->varlist; pVDesc; pVDesc=pVDesc->next) { 1859 1859 if( !strcmp(aszName, pVDesc->Name)) { … … 1863 1863 } 1864 1864 } 1865 /* not found, see if this is and interface with an inheritance */ 1866 if(This->TypeAttr.typekind==TKIND_INTERFACE && 1865 /* not found, see if this is and interface with an inheritance */ 1866 if(This->TypeAttr.typekind==TKIND_INTERFACE && 1867 1867 This->TypeAttr.cImplTypes ){ 1868 1868 /* recursive search */ 1869 1869 ITypeInfo *pTInfo; 1870 ret=This->lpvtbl->fnGetRefTypeInfo(iface, 1870 ret=This->lpvtbl->fnGetRefTypeInfo(iface, 1871 1871 This->impltypelist->reference, &pTInfo); 1872 1872 if(SUCCEEDED(ret)){ 1873 ret= pTInfo->lpvtbl->fnGetIDsOfNames(pTInfo, rgszNames, cNames, pMemId );1874 pTInfo->lpvtbl->fnRelease(pTInfo);1873 ret=ICOM_VTBL(pTInfo)->fnGetIDsOfNames(pTInfo, rgszNames, cNames, pMemId ); 1874 ICOM_VTBL(pTInfo)->fnRelease(pTInfo); 1875 1875 return ret; 1876 1876 } … … 1882 1882 1883 1883 /* ITypeInfo::Invoke 1884 * 1884 * 1885 1885 * Invokes a method, or accesses a property of an object, that implements the 1886 1886 * interface described by the type description. … … 1896 1896 1897 1897 /* ITypeInfo::GetDocumentation 1898 * 1898 * 1899 1899 * Retrieves the documentation string, the complete Help file name and path, 1900 1900 * and the context ID for the Help topic for a specified type description. … … 1905 1905 { 1906 1906 ICOM_THIS( TLBTypeInfo, iface); 1907 TLBFuncDesc * pFDesc; 1908 TLBVarDesc * pVDesc; 1907 TLBFuncDesc * pFDesc; 1908 TLBVarDesc * pVDesc; 1909 1909 TRACE_(typelib)("(%p) memid %ld Name(%p) DocString(%p)" 1910 1910 " HelpContext(%p) HelpFile(%p)\n", … … 1934 1934 1935 1935 /* ITypeInfo::GetDllEntry 1936 * 1936 * 1937 1937 * Retrieves a description or specification of an entry point for a function 1938 1938 * in a DLL. … … 1948 1948 1949 1949 /* ITypeInfo::GetRefTypeInfo 1950 * 1950 * 1951 1951 * If a type description references other type descriptions, it retrieves 1952 1952 * the referenced type descriptions. … … 1960 1960 ITypeLib *pTLib; 1961 1961 int Index; 1962 result=This->lpvtbl->fnGetContainingTypeLib(iface, &pTLib, 1962 result=This->lpvtbl->fnGetContainingTypeLib(iface, &pTLib, 1963 1963 (UINT*)&Index); 1964 1964 if(SUCCEEDED(result)){ 1965 result= pTLib->lpvtbl->fnGetTypeInfo(pTLib,1965 result=ICOM_VTBL(pTLib)->fnGetTypeInfo(pTLib, 1966 1966 HREFTYPE_INDEX(hRefType), 1967 1967 ppTInfo); 1968 pTLib->lpvtbl->fnRelease(pTLib );1968 ICOM_VTBL(pTLib)->fnRelease(pTLib ); 1969 1969 } 1970 1970 } else{ … … 2003 2003 2004 2004 /* ITypeInfo::AddressOfMember 2005 * 2005 * 2006 2006 * Retrieves the addresses of static functions or variables, such as those 2007 2007 * defined in a DLL. … … 2016 2016 2017 2017 /* ITypeInfo::CreateInstance 2018 * 2019 * Creates a new instance of a type that describes a component object class 2018 * 2019 * Creates a new instance of a type that describes a component object class 2020 2020 * (coclass). 2021 2021 */ 2022 static HRESULT WINAPI ITypeInfo_fnCreateInstance( LPTYPEINFO iface, 2023 IUnknown *pUnk, REFIID riid, VOID **ppvObj) 2022 static HRESULT WINAPI ITypeInfo_fnCreateInstance( LPTYPEINFO iface, 2023 IUnknown *pUnk, REFIID riid, VOID **ppvObj) 2024 2024 { 2025 2025 ICOM_THIS( TLBTypeInfo, iface); … … 2041 2041 2042 2042 /* ITypeInfo::GetContainingTypeLib 2043 * 2043 * 2044 2044 * Retrieves the containing type library and the index of the type description 2045 2045 * within that type library. … … 2051 2051 *ppTLib=(LPTYPELIB )(This->pTypeLib); 2052 2052 *pIndex=This->index; 2053 (*ppTLib)->lpvtbl->fnAddRef(*ppTLib);2053 ICOM_VTBL(*ppTLib)->fnAddRef(*ppTLib); 2054 2054 TRACE_(typelib)("(%p) returns (%p) index %d!\n", This, *ppTLib, *pIndex); 2055 2055 return S_OK; … … 2111 2111 * Returns the type flags without any allocations. This returns a DWORD type 2112 2112 * flag, which expands the type flags without growing the TYPEATTR (type 2113 * attribute). 2113 * attribute). 2114 2114 * 2115 2115 */ … … 2136 2136 HRESULT result; 2137 2137 /* FIXME: should check for invKind??? */ 2138 for(i=0, pFuncInfo=This->funclist;pFuncInfo && 2138 for(i=0, pFuncInfo=This->funclist;pFuncInfo && 2139 2139 memid != pFuncInfo->funcdesc.memid; i++, pFuncInfo=pFuncInfo->next); 2140 2140 if(pFuncInfo){ … … 2153 2153 * 2154 2154 * Binds to a specific member based on a known DISPID, where the member name 2155 * is not known (for example, when binding to a default member). 2155 * is not known (for example, when binding to a default member). 2156 2156 * 2157 2157 */ … … 2163 2163 int i; 2164 2164 HRESULT result; 2165 for(i=0, pVarInfo=This->varlist; pVarInfo && 2165 for(i=0, pVarInfo=This->varlist; pVarInfo && 2166 2166 memid != pVarInfo->vardesc.memid; i++, pVarInfo=pVarInfo->next) 2167 2167 ; … … 2212 2212 ICOM_THIS( TLBTypeInfo, iface); 2213 2213 TLBCustData *pCData=NULL; 2214 TLBFuncDesc * pFDesc; 2214 TLBFuncDesc * pFDesc; 2215 2215 int i; 2216 2216 for(i=0, pFDesc=This->funclist; i!=index && pFDesc; i++, … … 2240 2240 static HRESULT WINAPI ITypeInfo2_fnGetParamCustData( ITypeInfo * iface, 2241 2241 UINT indexFunc, UINT indexParam, REFGUID guid, VARIANT *pVarVal) 2242 { 2242 { 2243 2243 ICOM_THIS( TLBTypeInfo, iface); 2244 2244 TLBCustData *pCData=NULL; 2245 TLBFuncDesc * pFDesc; 2245 TLBFuncDesc * pFDesc; 2246 2246 int i; 2247 2247 for(i=0, pFDesc=This->funclist; i!=indexFunc && pFDesc; i++, … … 2249 2249 ; 2250 2250 if(pFDesc && indexParam >=0 && indexParam<pFDesc->funcdesc.cParams) 2251 for(pCData=pFDesc->pParamDesc[indexParam].pCustData; pCData; 2251 for(pCData=pFDesc->pParamDesc[indexParam].pCustData; pCData; 2252 2252 pCData = pCData->next) 2253 2253 if( IsEqualIID(guid, &pCData->guid)) break; … … 2272 2272 static HRESULT WINAPI ITypeInfo2_fnGetVarCustData( ITypeInfo * iface, 2273 2273 UINT index, REFGUID guid, VARIANT *pVarVal) 2274 { 2274 { 2275 2275 ICOM_THIS( TLBTypeInfo, iface); 2276 2276 TLBCustData *pCData=NULL; 2277 TLBVarDesc * pVDesc; 2277 TLBVarDesc * pVDesc; 2278 2278 int i; 2279 2279 for(i=0, pVDesc=This->varlist; i!=index && pVDesc; i++, … … 2303 2303 static HRESULT WINAPI ITypeInfo2_fnGetImplTypeCustData( ITypeInfo * iface, 2304 2304 UINT index, REFGUID guid, VARIANT *pVarVal) 2305 { 2305 { 2306 2306 ICOM_THIS( TLBTypeInfo, iface); 2307 2307 TLBCustData *pCData=NULL; 2308 TLBRefType * pRDesc; 2308 TLBRefType * pRDesc; 2309 2309 int i; 2310 2310 for(i=0, pRDesc=This->impltypelist; i!=index && pRDesc; i++, … … 2329 2329 2330 2330 /* ITypeInfo2::GetDocumentation2 2331 * 2331 * 2332 2332 * Retrieves the documentation string, the complete Help file name and path, 2333 2333 * the localization context to use, and the context ID for the library Help … … 2340 2340 { 2341 2341 ICOM_THIS( TLBTypeInfo, iface); 2342 TLBFuncDesc * pFDesc; 2343 TLBVarDesc * pVDesc; 2342 TLBFuncDesc * pFDesc; 2343 TLBVarDesc * pVDesc; 2344 2344 TRACE_(typelib)("(%p) memid %ld lcid(0x%lx) HelpString(%p) " 2345 2345 "HelpStringContext(%p) HelpStringDll(%p)\n", … … 2388 2388 /* ITypeInfo2::GetAllCustData 2389 2389 * 2390 * Gets all custom data items for the Type info. 2390 * Gets all custom data items for the Type info. 2391 2391 * 2392 2392 */ … … 2397 2397 TLBCustData *pCData; 2398 2398 int i; 2399 TRACE_(typelib)("(%p) returning %d items\n", This, This->ctCustData); 2399 TRACE_(typelib)("(%p) returning %d items\n", This, This->ctCustData); 2400 2400 pCustData->prgCustData = (tagCUSTDATAITEM*)TLB_Alloc(This->ctCustData * sizeof(CUSTDATAITEM)); 2401 2401 if(pCustData->prgCustData ){ … … 2422 2422 ICOM_THIS( TLBTypeInfo, iface); 2423 2423 TLBCustData *pCData; 2424 TLBFuncDesc * pFDesc; 2424 TLBFuncDesc * pFDesc; 2425 2425 int i; 2426 TRACE_(typelib)("(%p) index %d\n", This, index); 2426 TRACE_(typelib)("(%p) index %d\n", This, index); 2427 2427 for(i=0, pFDesc=This->funclist; i!=index && pFDesc; i++, 2428 2428 pFDesc=pFDesc->next) … … 2458 2458 ICOM_THIS( TLBTypeInfo, iface); 2459 2459 TLBCustData *pCData=NULL; 2460 TLBFuncDesc * pFDesc; 2460 TLBFuncDesc * pFDesc; 2461 2461 int i; 2462 TRACE_(typelib)("(%p) index %d\n", This, indexFunc); 2462 TRACE_(typelib)("(%p) index %d\n", This, indexFunc); 2463 2463 for(i=0, pFDesc=This->funclist; i!=indexFunc && pFDesc; i++, 2464 2464 pFDesc=pFDesc->next) 2465 2465 ; 2466 2466 if(pFDesc && indexParam >=0 && indexParam<pFDesc->funcdesc.cParams){ 2467 pCustData->prgCustData =(tagCUSTDATAITEM*) 2467 pCustData->prgCustData =(tagCUSTDATAITEM*) 2468 2468 TLB_Alloc(pFDesc->pParamDesc[indexParam].ctCustData * 2469 2469 sizeof(CUSTDATAITEM)); … … 2495 2495 ICOM_THIS( TLBTypeInfo, iface); 2496 2496 TLBCustData *pCData; 2497 TLBVarDesc * pVDesc; 2497 TLBVarDesc * pVDesc; 2498 2498 int i; 2499 TRACE_(typelib)("(%p) index %d\n", This, index); 2499 TRACE_(typelib)("(%p) index %d\n", This, index); 2500 2500 for(i=0, pVDesc=This->varlist; i!=index && pVDesc; i++, 2501 2501 pVDesc=pVDesc->next) … … 2531 2531 ICOM_THIS( TLBTypeInfo, iface); 2532 2532 TLBCustData *pCData; 2533 TLBRefType * pRDesc; 2533 TLBRefType * pRDesc; 2534 2534 int i; 2535 TRACE_(typelib)("(%p) index %d\n", This, index); 2535 TRACE_(typelib)("(%p) index %d\n", This, index); 2536 2536 for(i=0, pRDesc=This->impltypelist; i!=index && pRDesc; i++, 2537 2537 pRDesc=pRDesc->next)
Note:
See TracChangeset
for help on using the changeset viewer.