コード例 #1
1
ファイル: hspvar_comobj.cpp プロジェクト: zakki/openhsp
static void get_interfacename( IUnknown *punk, VARIANT *vres )
{
	HRESULT hr;
	IDispatch *pDisp;
	ITypeInfo *pTI;
	BSTR bstr = NULL;
	hr = punk->QueryInterface( IID_IDispatch, (void **)&pDisp );
	if ( SUCCEEDED(hr) && pDisp != NULL ) {
		hr = pDisp->GetTypeInfo( 0, LOCALE_USER_DEFAULT, &pTI );
		if ( SUCCEEDED(hr) && pTI != NULL ) {
			hr = pTI->GetDocumentation( MEMBERID_NIL, &bstr, NULL, NULL, NULL );
			pTI->Release();
		}
		pDisp->Release();
	}
	if ( bstr == NULL ) {
		bstr = SysAllocString( L"" );
	}
	vres->bstrVal = bstr;
	vres->vt = VT_BSTR;
}
コード例 #2
1
ファイル: JSExtender.cpp プロジェクト: SmallMrKong/TANGRAM
HRESULT CJSProxyObj::SetEventNames()
{
	ITypeInfo* pInfo;
	if (m_pTypeInfo == nullptr)
		pInfo = theApp.m_pEventTypeInfo.p;
	else
		pInfo = m_pTypeInfo.p;
	TYPEATTR *pta = nullptr;;
	HRESULT hr = pInfo->GetTypeAttr(&pta);
	if (FAILED(hr))
		return hr;
	BSTR bstrName = ::SysAllocString(L"");
	FUNCDESC *pfd = nullptr;
	unsigned int uiNames = 0;
	for (int i = 0; i < pta->cFuncs; i++)
	{
		hr = pInfo->GetFuncDesc(i, &pfd);
		if (FAILED(hr))
			continue;

		hr = pInfo->GetNames(pfd->memid, &bstrName, 1, &uiNames);
		if (SUCCEEDED(hr) && bstrName && SysStringLen(bstrName))
		{
			m_mapDispId.Add(pfd->memid, bstrName);
			ATLTRACE(_T("*********Add function '%s' in Tangram*******\r\n"), OLE2T(bstrName));
		}
		pInfo->ReleaseFuncDesc(pfd);
		pfd = nullptr;
	}
	pInfo->ReleaseTypeAttr(pta);
	return hr;
}
コード例 #3
0
ITypeInfo * getConcatResultType(IHqlExpression * expr)
{
    assertex(!"not sure if this is unicode safe, but appears not to be used");
    //first work out the maximum size of the target
    unsigned max = expr->numChildren();
    unsigned idx;
    unsigned totalSize = 0;
    bool unknown = false;
    type_t resultType = type_string;

    for (idx = 0; idx < max; idx++)
    {
        ITypeInfo * type = expr->queryChild(idx)->queryType();
        unsigned size = type->getStringLen();
        if (size == UNKNOWN_LENGTH)
            unknown = true;
        else
            totalSize += size;
        if (type->getTypeCode() == type_varstring)
            resultType = type_varstring;
    }

    if (unknown)
        totalSize = 1023;
    if (resultType == type_string)
        return makeStringType(totalSize, NULL, NULL);
    return makeVarStringType(totalSize);
}
コード例 #4
0
ファイル: VideoSourceWin.cpp プロジェクト: darobin/rainbow
/* Extract GUID with name nameGUID and assign it to guid */
static void
InitTypeLibGUID(
    ITypeLib* const pTypeLib, ITypeInfo** const typeInfoPtrArray,
    MEMBERID* const memberIdArray, const nsAString& nameGUID,
    const TYPEKIND typeKindGUID, GUID& guid) {
    
    // Copy nameGUID as FindName requires a non const string
    nsString copyNameGUID(nameGUID);
    PRInt32 hashValue = 0;
    PRUint16 countFound = 1;
    HRESULT result = pTypeLib->FindName(
        copyNameGUID.BeginWriting(), hashValue, typeInfoPtrArray, 
        memberIdArray, &countFound
    );
    
    if (result == S_OK) {
        for (PRUint16 i = 0; i < countFound; ++i) {
            ITypeInfo* pTypeInfo = typeInfoPtrArray[i];
            typeInfoPtrArray[i] = 0;
            TYPEATTR* pTypeAttribute = 0;
            
            result = pTypeInfo->GetTypeAttr(&pTypeAttribute);
            if (result == S_OK) {
                if (pTypeAttribute->typekind == typeKindGUID) {
                    guid = pTypeAttribute->guid;
                }
                pTypeInfo->ReleaseTypeAttr(pTypeAttribute);
            }
        
            SAFE_RELEASE(pTypeInfo);
        }
    }
}
コード例 #5
0
ファイル: PyRecord.cpp プロジェクト: malrsrch/pywin32
static PyObject *PyRecord_reduce(PyObject *self, PyObject *args)
{
	PyObject *ret = NULL;
	PyRecord *pyrec = (PyRecord *)self;
	PyObject *obModule = NULL, *obModDict = NULL, *obFunc = NULL;
	ITypeInfo *pti = NULL;
	TYPEATTR *pta = NULL;
	ULONG cb;
	HRESULT hr;
	GUID structguid;
	if (!PyArg_ParseTuple(args, ":reduce"))
		return NULL;
	hr = pyrec->pri->GetTypeInfo(&pti);
	if (FAILED(hr)||pti==NULL) {
		PyCom_BuildPyException(hr);
		goto done;
	}
	hr = pti->GetTypeAttr(&pta);
	if (FAILED(hr)||pta==NULL) {
		PyCom_BuildPyException(hr);
		goto done;
	}
	hr = pyrec->pri->GetGuid(&structguid);
	if (FAILED(hr)) {
		PyCom_BuildPyException(hr);
		goto done;
	}
	hr = pyrec->pri->GetSize(&cb);
	if (FAILED(hr)) {
		PyCom_BuildPyException(hr);
		goto done;
	}
	obModule = PyImport_ImportModule("pythoncom");
	if (obModule)
		obModDict = PyModule_GetDict(obModule); // no ref added!
	if (obModDict)
		obFunc = PyDict_GetItemString(obModDict, "GetRecordFromGuids"); // no ref added!
	if (!obFunc) {
		PyErr_Clear();
		PyErr_SetString(PyExc_RuntimeError, "pythoncom.GetRecordFromGuids() can't be located!");
		goto done;
	}
	ret = Py_BuildValue("O(NHHiNN)",
						obFunc,
						PyWinObject_FromIID(pta->guid),
						pta->wMajorVerNum,
						pta->wMinorVerNum,
						pta->lcid,
						PyWinObject_FromIID(structguid),
						PyString_FromStringAndSize((char *)pyrec->pdata, cb));

done:
	if (pta&& pti)
		pti->ReleaseTypeAttr(pta);
	if (pti) pti->Release();
	Py_XDECREF(obModule);
	// obModDict and obFunc have no new reference.
	return ret;
}
コード例 #6
0
ファイル: atlimpl.cpp プロジェクト: mingpen/OpenNT
HRESULT CComTypeInfoHolder::GetIDsOfNames(REFIID /*riid*/, LPOLESTR* rgszNames,
	UINT cNames, LCID lcid, DISPID* rgdispid)
{
	ITypeInfo* pInfo;;
	HRESULT hRes = GetTI(lcid, &pInfo);
	return (pInfo != NULL) ?
		pInfo->GetIDsOfNames(rgszNames, cNames, rgdispid) : hRes;
}
コード例 #7
0
ファイル: PyIType.cpp プロジェクト: malrsrch/pywin32
PyObject *PyITypeInfo::GetTypeAttr()
{
	TYPEATTR *attr;
	ITypeInfo *pMyTypeInfo = GetI(this);
	if (pMyTypeInfo==NULL) return NULL;
	PY_INTERFACE_PRECALL;
	SCODE sc = pMyTypeInfo->GetTypeAttr(&attr);
	PY_INTERFACE_POSTCALL;
	if (FAILED(sc))
		return PyCom_BuildPyException(sc, pMyTypeInfo, IID_ITypeInfo);

/*	
	PyObject *obIID = PyWinObject_FromIID(attr->guid);
	PyObject *obDescAlias;
	// Some (only a few 16 bit MSOffice only one so far, and even then only occasionally!)
	// servers seem to send invalid tdescAlias when its not actually an alias.
	if (attr->typekind == TKIND_ALIAS)
		obDescAlias = MakeTypeDesc(&attr->tdescAlias);
	else {
		Py_INCREF(Py_None);
		obDescAlias=Py_None;
	}

	PyObject *obIDLDesc = MakeIDLDesc(&attr->idldescType);
	PyObject *ret = Py_BuildValue("(OiiiiiiiiiiiiiOO)",
		obIID,                   // @tupleitem 0|<o PyIID>|IID|The IID
		attr->lcid,				 // @tupleitem 1|int|lcid|The lcid
		attr->memidConstructor,	 // @tupleitem 2|int|memidConstructor|ID of constructor
		attr->memidDestructor,	 // @tupleitem 3|int|memidDestructor|ID of destructor,
		attr->cbSizeInstance,	 // @tupleitem 4|int|cbSizeInstance|The size of an instance of this type
		attr->typekind,			 // @tupleitem 5|int|typekind|The kind of type this information describes.  One of the win32con.TKIND_* constants.
		attr->cFuncs,			 // @tupleitem 6|int|cFuncs|Number of functions.
		attr->cVars,			 // @tupleitem 7|int|cVars|Number of variables/data members.
		attr->cImplTypes,		 // @tupleitem 8|int|cImplTypes|Number of implemented interfaces.
		attr->cbSizeVft,		 // @tupleitem 9|int|cbSizeVft|The size of this type's VTBL
		attr->cbAlignment,		 // @tupleitem 10|int|cbAlignment|Byte alignment for an instance of this type.
		attr->wTypeFlags,		 // @tupleitem 11|int|wTypeFlags|One of the pythoncom TYPEFLAG_
		attr->wMajorVerNum,		 // @tupleitem 12|int|wMajorVerNum|Major version number.
		attr->wMinorVerNum,		 // @tupleitem 13|int|wMinorVerNum|Minor version number.
		obDescAlias,			 // @tupleitem 14|<o TYPEDESC>|obDescAlias|If TypeKind == pythoncom.TKIND_ALIAS, specifies the type for which this type is an alias.
		obIDLDesc				 // @tupleitem 15|<o IDLDESC>|obIDLDesc|IDL attributes of the described type.
	);
	Py_XDECREF(obDescAlias);
	Py_XDECREF(obIDLDesc);
	Py_XDECREF(obIID);
***/
	PyObject *ret = PyObject_FromTYPEATTR(attr);

	{
	PY_INTERFACE_PRECALL;
	pMyTypeInfo->ReleaseTypeAttr(attr);
	PY_INTERFACE_POSTCALL;
	}

	return ret;
}
コード例 #8
0
ファイル: top.cpp プロジェクト: fumin/NtuWebmailIEPlugin
HRESULT PrintTInfo(ITypeInfo* pTinfo, int indentation){
	TYPEATTR* pTypeAttr;
	HRESULT hr = pTinfo->GetTypeAttr(&pTypeAttr); COMRet(hr);
	for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT("    "); 
	LPOLESTR guid_str;
	hr = StringFromCLSID(pTypeAttr->guid, &guid_str);
	std::wcout<<guid_str<<std::endl;

	// Inherited Interfaces, therefore we recursively call PrintInfo
	for(int i = 0; i != pTypeAttr->cImplTypes; ++i){
		HREFTYPE RefType;
		hr = pTinfo->GetRefTypeOfImplType(i, &RefType); COMRet(hr);
		ITypeInfo* pImplTinfo;
		hr = pTinfo->GetRefTypeInfo(RefType, &pImplTinfo); COMRet(hr);
		hr = PrintTInfo(pImplTinfo, indentation + 1); if(hr != S_OK && hr != TYPE_E_BADMODULEKIND) return hr; // Because this ITypeInfo is retrieved
		pImplTinfo->Release();                                                                                // directly from a .tlb file instead
		                                                                                                      // of a .dll, AddressofMember fails
	}

	//member functions
	for(int i = 0; i != pTypeAttr->cFuncs; ++i){
		FUNCDESC* pFuncDesc;
		hr = pTinfo->GetFuncDesc(i, &pFuncDesc); COMRet(hr);
		const UINT cMaxNames = 10; UINT cNames;
		BSTR rgBstrNames[cMaxNames];
		hr = pTinfo->GetNames(pFuncDesc->memid, rgBstrNames, cMaxNames, &cNames); COMRet(hr);
		void* pv;
		hr = pTinfo->AddressOfMember(pFuncDesc->memid, pFuncDesc->invkind, &pv); if(hr != S_OK && hr != TYPE_E_BADMODULEKIND) return hr;
		for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT("    ");
		std::wcout<<TEXT("Func memid = ")<<pFuncDesc->memid<<TEXT(" Name = ")<<*rgBstrNames<<TEXT(" DllAddress = ")<<pv<<std::endl;
		for(int j = 0; j != pFuncDesc->cParams; ++j){
			TCHAR szBuffer[30];
			wParamFlagsTranslate(pFuncDesc->lprgelemdescParam->paramdesc.wParamFlags, szBuffer, 30);
			for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT("    ");
			std::wcout<<TEXT(" ")<<szBuffer<<TEXT(" ")<<*(rgBstrNames+j+1)<<TEXT(": ")<<std::endl;
			TExpandPointer(pFuncDesc->lprgelemdescParam->tdesc, 2);
		}
		pTinfo->ReleaseFuncDesc(pFuncDesc);
	}

	//member variables
	for(int i = 0; i != pTypeAttr->cVars; ++i){
		VARDESC* pVarDesc;
		hr = pTinfo->GetVarDesc(i, &pVarDesc); COMRet(hr);
		for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT("    ");
		std::wcout<<TEXT("Var memid = ")<<pVarDesc->memid<<TEXT("Varkind = ")<<pVarDesc->varkind<<std::endl;
		TCHAR szBuffer[30];
		wParamFlagsTranslate(pVarDesc->elemdescVar.paramdesc.wParamFlags, szBuffer, 30);
		for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT("    ");
		std::wcout<<"  Variable wParamFlags: "<<szBuffer<<std::endl;
		TExpandPointer(pVarDesc->elemdescVar.tdesc, 1);
		pTinfo->ReleaseVarDesc(pVarDesc);
	}
	pTinfo->ReleaseTypeAttr(pTypeAttr);
	return hr;
}
コード例 #9
0
ファイル: atlimpl.cpp プロジェクト: mingpen/OpenNT
HRESULT CComTypeInfoHolder::Invoke(IDispatch* p, DISPID dispidMember, REFIID /*riid*/,
	LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult,
	EXCEPINFO* pexcepinfo, UINT* puArgErr)
{
	SetErrorInfo(0, NULL);
	ITypeInfo* pInfo;;
	HRESULT hRes = GetTI(lcid, &pInfo);
	return (pInfo != NULL) ?
		pInfo->Invoke(p, dispidMember, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr) :
		hRes;
}
コード例 #10
0
ファイル: PyIType.cpp プロジェクト: malrsrch/pywin32
PyObject *PyITypeInfo::GetRefTypeInfo(HREFTYPE href)
{
	ITypeInfo *pti;
	ITypeInfo *pMyTypeInfo = GetI(this);
	if (pMyTypeInfo==NULL) return NULL;
	PY_INTERFACE_PRECALL;
	SCODE sc = pMyTypeInfo->GetRefTypeInfo(href, &pti);
	PY_INTERFACE_POSTCALL;
	if (FAILED(sc))
		return PyCom_BuildPyException(sc, pMyTypeInfo, IID_ITypeInfo);
	return new PyITypeInfo(pti);
}
コード例 #11
0
ファイル: TypeInfo.cpp プロジェクト: enebo/racob
JNIEXPORT jobject JNICALL Java_org_racob_com_TypeInfo_getRefTypeInfo
  (JNIEnv *env, jobject obj, jint pointer, jint reftype) {
   ITypeInfo *typeInfo = (ITypeInfo *) pointer;
   ITypeInfo *newTypeInfo = NULL;
   HRESULT hr = typeInfo->GetRefTypeInfo(reftype, &newTypeInfo);
   if (!SUCCEEDED(hr)) {
      ThrowComFail(env, "getRefTypeInfo failed", hr);
      return NULL;
   }

   return makeTypeInfo(env, newTypeInfo);
}
コード例 #12
0
ファイル: TypeInfo.cpp プロジェクト: enebo/racob
JNIEXPORT jint JNICALL Java_org_racob_com_TypeInfo_getRefTypeOfImplType
  (JNIEnv *env, jobject obj, jint pointer, jint index) {
  ITypeInfo *typeInfo = (ITypeInfo *) pointer;
  HREFTYPE href;
  HRESULT hr = typeInfo->GetRefTypeOfImplType(index, &href);
  if (!SUCCEEDED(hr)) {
     ThrowComFail(env, "getRefTypeOfImplType failed", hr);
     return NULL;
  }

  return (jint) href;
}
コード例 #13
0
ファイル: TypeInfo.cpp プロジェクト: enebo/racob
JNIEXPORT jint JNICALL Java_org_racob_com_TypeInfo_getImplTypeFlags
  (JNIEnv *env, jobject obj, jint pointer, jint index) {
   ITypeInfo *typeInfo = (ITypeInfo *) pointer;
  int flags;
  HRESULT hr = typeInfo->GetImplTypeFlags(index, &flags);
  if (!SUCCEEDED(hr)) {
     ThrowComFail(env, "getImplTypeFlags failed", hr);
     return NULL;
  }

  return (jint) flags;
}
コード例 #14
0
ファイル: InterfaceAdapter.cpp プロジェクト: jbroll/tcom
STDMETHODIMP
InterfaceAdapter::GetIDsOfNames (
    InterfaceAdapter *pThis,
    REFIID,
    OLECHAR **rgszNames,
    UINT cNames,
    LCID,
    DISPID *rgDispId)
{
    ITypeInfo *pTypeInfo = pThis->m_dispatchImpl.typeInfo();
    return pTypeInfo->GetIDsOfNames(rgszNames, cNames, rgDispId);
}
コード例 #15
0
ファイル: PyIType.cpp プロジェクト: malrsrch/pywin32
PyObject *PyITypeInfo::GetRefTypeOfImplType(int index)
{
	HREFTYPE href;
	ITypeInfo *pMyTypeInfo = GetI(this);
	if (pMyTypeInfo==NULL) return NULL;
	PY_INTERFACE_PRECALL;
	SCODE sc = pMyTypeInfo->GetRefTypeOfImplType(index, &href);
	PY_INTERFACE_POSTCALL;
	if (FAILED(sc))
		return PyCom_BuildPyException(sc, pMyTypeInfo, IID_ITypeInfo);
	return Py_BuildValue("i", href);
}
コード例 #16
0
ファイル: PyIType.cpp プロジェクト: malrsrch/pywin32
PyObject *PyITypeInfo::GetTypeComp()
{
	ITypeInfo *pMyTypeInfo = GetI(this);
	ITypeComp *ptc;
	if (pMyTypeInfo==NULL) return NULL;
	PY_INTERFACE_PRECALL;
	SCODE sc = pMyTypeInfo->GetTypeComp(&ptc);
	PY_INTERFACE_POSTCALL;
	if (FAILED(sc))
		return PyCom_BuildPyException(sc, pMyTypeInfo, IID_ITypeInfo);

	return PyCom_PyObjectFromIUnknown(ptc, IID_ITypeComp);
}
コード例 #17
0
ファイル: PyIType.cpp プロジェクト: malrsrch/pywin32
PyObject *PyITypeInfo::GetFuncDesc(int index)
{
	FUNCDESC *desc;
	ITypeInfo *pMyTypeInfo = GetI(this);
	if (pMyTypeInfo==NULL) return NULL;

	PY_INTERFACE_PRECALL;
	SCODE sc = pMyTypeInfo->GetFuncDesc(index, &desc);
	PY_INTERFACE_POSTCALL;
	if (FAILED(sc))
		return PyCom_BuildPyException(sc, pMyTypeInfo, IID_ITypeInfo);
	return BuildFUNCDESC(pMyTypeInfo,desc);
}
コード例 #18
0
ファイル: PyIType.cpp プロジェクト: malrsrch/pywin32
PyObject *PyITypeInfo::GetImplTypeFlags(int index)
{
	int implFlags;
	ITypeInfo *pMyTypeInfo = GetI(this);
	if (pMyTypeInfo==NULL) return NULL;

	PY_INTERFACE_PRECALL;
	SCODE sc = pMyTypeInfo->GetImplTypeFlags(index, &implFlags);
	PY_INTERFACE_POSTCALL;
	if (FAILED(sc))
		return PyCom_BuildPyException(sc, pMyTypeInfo, IID_ITypeInfo);

	return Py_BuildValue("i", implFlags);
}
コード例 #19
0
ファイル: InterfaceAdapter.cpp プロジェクト: jbroll/tcom
STDMETHODIMP
InterfaceAdapter::GetTypeInfo (
    InterfaceAdapter *pThis, UINT index, LCID, ITypeInfo **ppTypeInfo)
{
    if (index != 0) {
        *ppTypeInfo = 0;
        return DISP_E_BADINDEX;
    }

    ITypeInfo *pTypeInfo = pThis->m_dispatchImpl.typeInfo();
    pTypeInfo->AddRef();
    *ppTypeInfo = pTypeInfo;
    return S_OK;
}
コード例 #20
0
void CAutoListMembersWindow::SetDispatch(IDispatch* pDisp)
{
	ClearMemberItems();

	UINT pctinfo;
	pDisp->GetTypeInfoCount(&pctinfo);

	ITypeInfo* pTInfo;
	HRESULT hr = pDisp->GetTypeInfo(0, NULL, &pTInfo);

	TYPEATTR* pType;
	pTInfo->GetTypeAttr(&pType);

	for (int i = 0; i < pType->cFuncs; i++)
	{
		FUNCDESC* pFuncDesc = NULL;
		if (SUCCEEDED(pTInfo->GetFuncDesc(i, &pFuncDesc)))
		{
			BSTR bname;
			UINT pcNames;
			pTInfo->GetNames(pFuncDesc->memid, &bname, 1, &pcNames);

			CMemberItem* pMItem = new CMemberItem;

			pMItem->m_name = _bstr_t(bname, false);
			pMItem->m_dispid = pFuncDesc->memid;

			if (pFuncDesc->invkind == DISPATCH_METHOD)
			{
				pMItem->m_type = 1;
			}
			else/* if (pFuncDesc->invkind == INVOKE_PROPERTYPUT ||
				pFuncDesc->invkind == INVOKE_PROPERTYGET ||
				pFuncDesc->invkind == INVOKE_PROPERTYPUTREF*/
			{
				pMItem->m_type = 0;
			}

			m_members.Add(pMItem);

			pTInfo->ReleaseFuncDesc(pFuncDesc);
		}
	}

	if (m_hWnd)
	{
		OnSize();
		Invalidate();
	}
}
コード例 #21
0
ファイル: top.cpp プロジェクト: fumin/NtuWebmailIEPlugin
int _tmain(int argc, _TCHAR* argv[]){
	const OLECHAR szFile[] = TEXT("testmidl.tlb");//TEXT("D:\\Desktop\\COM_Type_Library_Viewer\\COM_Type_Library_Viewer\\testmidl.tlb");
	ITypeLib* p_tlib;  
	ITypeInfo* pTinfo;
	HRESULT hr = LoadTypeLib(szFile, &p_tlib); 
	//hr = p_tlib->GetTypeInfoOfGuid(IID_ISum, &pTinfo);//Succeeded
	//hr = p_tlib->GetTypeInfoOfGuid(LIBID_Component, &pTinfo);
	hr = p_tlib->GetTypeInfoOfGuid(CLSID_InsideCOM, &pTinfo);//Succeeded!!
	hr = PrintTInfo(pTinfo, 0);
	pTinfo->Release();
	p_tlib->Release();
	std::getchar();
	return 1;
}
コード例 #22
0
STDMETHODIMP CJServer::GetIDsOfNames(REFIID riid
                                     , OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispID)
{
  HRESULT     hr;
  ITypeInfo  *pTI;

  if (IID_NULL!=riid)
    return ResultFromScode(DISP_E_UNKNOWNINTERFACE);

  //Get the right ITypeInfo for lcid.
  hr=GetTypeInfo(0, lcid, &pTI);
  if (SUCCEEDED(hr)) {
    hr=DispGetIDsOfNames(pTI, rgszNames, cNames, rgDispID);
    pTI->Release();
  }
  return hr;
}
コード例 #23
0
ファイル: TypeInfo.cpp プロジェクト: enebo/racob
 JNIEXPORT jobject JNICALL Java_org_racob_com_TypeInfo_getFuncDesc
  (JNIEnv *env, jobject obj, jint pointer, jint index) {
   ITypeInfo *typeInfo = (ITypeInfo *) pointer;
   if (!typeInfo) return NULL;

   FUNCDESC *funcDesc = NULL;
   HRESULT hr = typeInfo->GetFuncDesc(index, &funcDesc);
   if (!SUCCEEDED(hr)) {
      ThrowComFail(env, "getFuncDesc failed", hr);
      return NULL;
   }


   int paramLength = funcDesc->cParams;
   unsigned int nameLength = 0;
   BSTR *names = (BSTR *) malloc(sizeof(BSTR) * paramLength + 1);
   hr = typeInfo->GetNames(funcDesc->memid, names, paramLength + 1, &nameLength);
   if (FAILED(hr)) {
      typeInfo->ReleaseFuncDesc(funcDesc);
      ThrowComFail(env, "getFuncDesc failed", hr);
      return NULL;
   }
   SysFreeString(names[0]);

   jclass paramClass = env->FindClass("org/racob/com/Parameter");
   jmethodID paramCons = env->GetMethodID(paramClass, "<init>", "(Ljava/lang/String;ZZZZIZLorg/racob/com/Variant;)V");
   jobjectArray parameters = env->NewObjectArray(nameLength - 1, paramClass, 0);
   for (int i = 0; i < nameLength - 1; i++) {
      jobject parameter = createParameter(env, paramClass, paramCons,
              funcDesc->lprgelemdescParam[i], names[i+1]);
      env->SetObjectArrayElement(parameters, i, parameter);
      env->DeleteLocalRef(parameter);
   }

   jobject returnValue = createParameter(env, paramClass, paramCons, funcDesc->elemdescFunc, NULL);
   jclass autoClass = env->FindClass("org/racob/com/FuncDesc");
   jmethodID autoCons = env->GetMethodID(autoClass, "<init>", "(IIII[Lorg/racob/com/Parameter;Lorg/racob/com/Parameter;II)V");
   jobject newAuto = env->NewObject(autoClass, autoCons, funcDesc->memid,
           index, funcDesc->invkind, funcDesc->wFuncFlags, parameters,
           returnValue, funcDesc->cParamsOpt, funcDesc->oVft);

   typeInfo->ReleaseFuncDesc(funcDesc);

   return newAuto;
 }
コード例 #24
0
ファイル: PyIType.cpp プロジェクト: malrsrch/pywin32
PyObject *PyITypeInfo::GetVarDesc(int index)
{
	VARDESC *desc;
	ITypeInfo *pMyTypeInfo = GetI(this);
	if (pMyTypeInfo==NULL) return NULL;
	PY_INTERFACE_PRECALL;
	SCODE sc = pMyTypeInfo->GetVarDesc(index, &desc);
	PY_INTERFACE_POSTCALL;
	if (FAILED(sc))
		return PyCom_BuildPyException(sc, pMyTypeInfo, IID_ITypeInfo);
	PyObject *ret = PyObject_FromVARDESC(desc);
	{
	PY_INTERFACE_PRECALL;
	pMyTypeInfo->ReleaseVarDesc(desc);
	PY_INTERFACE_POSTCALL;
	}
	return ret;
}
コード例 #25
0
void DataSourceMetaData::addSimpleField(const char * name, const char * xpath, ITypeInfo * type, unsigned flag)
{
    ITypeInfo * promoted = type->queryPromotedType();
    unsigned size = promoted->getSize();
    unsigned thisBits = 0;
    if (size == UNKNOWN_LENGTH)
    {
        isStoredFixedWidth = false;
        switch (type->getTypeCode())
        {
        case type_set:
            minRecordSize += sizeof(bool) + sizeof(size32_t);
            break;
        case type_varstring:
            minRecordSize += 1;
            break;
        case type_packedint:
            minRecordSize += 1;
            break;
        case type_varunicode:
            minRecordSize += sizeof(UChar);
            break;
        default:
            minRecordSize += sizeof(size32_t);
            break;
        }
    }
    else if (type->getTypeCode() == type_bitfield)
    {
        thisBits = type->getBitSize();
        if (thisBits > bitsRemaining)
        {
            size = type->queryChildType()->getSize();
            minRecordSize += size;
            bitsRemaining = size * 8;
        }
        bitsRemaining -= thisBits;
    }
    else
        minRecordSize += size;
    if (thisBits == 0)
        bitsRemaining = 0;
    fields.append(*new DataSourceMetaItem(flag, name, xpath, type));
}
コード例 #26
0
ファイル: hqlcppcase.cpp プロジェクト: RogerDev/HPCC-Platform
IHqlExpression * HqlCppCaseInfo::buildIndexedMap(BuildCtx & ctx, IHqlExpression * test, unsigned lower, unsigned upper)
{
    ITypeInfo * compareType = test->queryType()->queryPromotedType();
    type_t compareTypeCode = compareType->getTypeCode();

    HqlExprArray values;
    IHqlExpression * dft = queryActiveTableSelector();  // value doesn't matter as long as it will not occur
    unsigned num = (upper-lower+1);
    values.ensure(num);
    unsigned idx;
    for (idx = 0; idx < num; idx++)
        values.append(*LINK(dft));

    ForEachItemIn(idx2, pairs)
    {
        IHqlExpression & cur = pairs.item(idx2);
        IValue * value = cur.queryChild(0)->queryValue();
        unsigned replaceIndex;
        switch (compareTypeCode)
        {
        case type_int:
            replaceIndex = (int)value->getIntValue()-lower;
            break;
        case type_string:
            {
                StringBuffer temp;
                value->getStringValue(temp);
                replaceIndex = (int)(unsigned char)temp.charAt(0)-lower;
                break;
            }
        default:
            throwUnexpectedType(compareType);
        }

        IHqlExpression * mapTo = cur.queryChild(1);
        if (mapTo->getOperator() != no_constant)
            throwUnexpected();
        if (replaceIndex >= num)
            translator.reportWarning(CategoryIgnored, HQLWRN_CaseCanNeverMatch, "CASE entry %d can never match the test condition", replaceIndex);
        else
            values.replace(*LINK(mapTo),replaceIndex);
    }
コード例 #27
0
ファイル: jdllcomx.cpp プロジェクト: EdKeith/core
STDMETHODIMP CJServer::Invoke(DISPID dispID, REFIID riid
    , LCID lcid, unsigned short wFlags, DISPPARAMS *pDispParams
    , VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
    HRESULT     hr;
    ITypeInfo  *pTI;
    LANGID      langID=PRIMARYLANGID(lcid);

    if (IID_NULL!=riid) return DISP_E_UNKNOWNINTERFACE;
    hr=GetTypeInfo(0, lcid, &pTI);
    if (FAILED(hr)) return hr;

    //This is exactly what DispInvoke does--so skip the overhead.
    hr=pTI->Invoke((SERVERCLASS *)this, dispID, wFlags
        , pDispParams, pVarResult, pExcepInfo, puArgErr);

    //Exception handling is done within ITypeInfo::Invoke
    pTI->Release();
    return hr;
}
コード例 #28
0
ファイル: hspvar_comobj.cpp プロジェクト: zakki/openhsp
static void get_coclassname( IUnknown *punk, VARIANT *vres )
{
	HRESULT hr;
	IProvideClassInfo *pPCI;
	ITypeInfo *pTI;
	BSTR bstr = NULL;
	hr = punk->QueryInterface( IID_IProvideClassInfo, (void **)&pPCI );
	if ( SUCCEEDED(hr) && pPCI != NULL ) {
		hr = pPCI->GetClassInfo( &pTI );
		if ( SUCCEEDED(hr) && pTI != NULL ) {
			hr = pTI->GetDocumentation( MEMBERID_NIL, &bstr, NULL, NULL, NULL );
			pTI->Release();
		}
		pPCI->Release();
	}
	if ( bstr == NULL ) {
		bstr = SysAllocString( L"" );
	}
	vres->bstrVal = bstr;
	vres->vt = VT_BSTR;
}
コード例 #29
0
STDMETHODIMP
CBaseDispatch::GetIDsOfNames(
  REFIID riid,
  OLECHAR  ** rgszNames,
  UINT cNames,
  LCID lcid,
  DISPID * rgdispid)
{
    // although the IDispatch riid is dead, we use this to pass from
    // the interface implementation class to us the iid we are talking about.

    ITypeInfo * pti;
    HRESULT hr = GetTypeInfo(riid, 0, lcid, &pti);

    if (SUCCEEDED(hr)) {
	hr = pti->GetIDsOfNames(rgszNames, cNames, rgdispid);

	pti->Release();
    }
    return hr;
}
コード例 #30
0
ファイル: deffield.cpp プロジェクト: aa0/HPCC-Platform
static void serializeElement(MemoryBuffer & target, IDefRecordElement * elem)
{
    byte kind = elem ? elem->getKind() : DEKnone;
    target.append(kind);
    switch (kind)
    {
    case DEKnone:
        break;
    case DEKrecord:
        {
            size32_t maxSize = elem->getMaxSize();
            unsigned numChildren = elem->numChildren();
            target.append(maxSize).append(numChildren);
            for (unsigned i=0; i < numChildren; i++)
                serializeElement(target, elem->queryChild(i));
            break;
        }
    case DEKifblock:
        {
            IValue * value = elem->queryCompareValue();
            serializeValue(target, value);
            serializeElement(target, elem->queryChild(0));
            serializeElement(target, elem->queryChild(1));
            break;
        }
    case DEKfield:
        {
            _ATOM name = elem->queryName();
            ITypeInfo * type = elem->queryType();
            size32_t maxSize = elem->getMaxSize();
            serializeAtom(target, name);
            type->serialize(target);
            serializeElement(target, elem->queryChild(0));
            target.append(maxSize);
            break;
        }
    default:
        throwUnexpected();
    }
}