示例#1
0
文件: typout.cpp 项目: mingpen/OpenNT
// load an external type library
VOID FAR LoadExtTypeLib
(
    LPIMPORTLIB lpImpLib
)
{
    ITypeLib FAR* lptlib;
    HRESULT res;
    BSTR bstrName;

    SETITEMCUR(lpImpLib->lpszFileName);

    // get * to ITypeLib interface
    CHECKRESULT(LoadTypeLib(ToW(lpImpLib->lpszFileName), &lptlib));
    lpImpLib->lptlib = lptlib;

    // get name of this library
    CHECKRESULT(lptlib->GetDocumentation(-1, &bstrName, NULL, NULL, NULL));
    // copy library name from the BSTR
    lpImpLib->lpszLibName = _fstrdup(ToA(bstrName));

    SysFreeString(bstrName);		// free the BSTR

    // get * to ITypeComp interface
    CHECKRESULT(lptlib->GetTypeComp(&(lpImpLib->lptcomp)));
    
    // get library attributes
    CHECKRESULT(lptlib->GetLibAttr(&(lpImpLib->lptlibattr)));

}
MStatus particleSystemInfoCmd::parseArgs( const MArgList& args )
{
	// Parse the arguments.
	MStatus stat = MS::kSuccess;

	if( args.length() > 1 )
	{
		MGlobal::displayError( "Too many arguments." );
		return MS::kFailure;
	}

	if( args.length() == 1 )
	{
	        MString particleName = args.asString( 0, &stat );
		CHECKRESULT(stat, "Failed to parse particle node name argument." );

		nodeFromName( particleName, particleNode );
		
		if( !particleNode.isNull() && !particleNode.hasFn( MFn::kParticle ) )
		{
		        MGlobal::displayError( "The named node is not a particle system." );
			return MS::kFailure;
		}
	} 
	return MS::kSuccess;
}
示例#3
0
void MMCapture::captureInit(UINT framesPerSecond, UINT audioBufferSize) {
  DWORD style = WS_CHILD;

  m_captureWindow = capCreateCaptureWindow(_T("my capture window"), style,0,0,640,480,m_receiver.getWindow(),1);
  if(m_captureWindow == NULL) {
    throwException(_T("%s:Cannot create CaptureWindow:%s"),__TFUNCTION__,getLastErrorText().cstr());
  }

  try {
    CHECKRESULT(capSetUserData(  m_captureWindow, this));
    if(captureVideo()) {
      CHECKRESULT(capDriverConnect(m_captureWindow, 0   ));
      m_webCamConnected = true;
    }

    CAPTUREPARMS param;

    CHECKRESULT(capCaptureGetSetup(m_captureWindow,&param,sizeof(param)));
    param.dwRequestMicroSecPerFrame = 1000000 / framesPerSecond;
    param.fYield            = TRUE;
    param.AVStreamMaster    = AVSTREAMMASTER_AUDIO; // AVSTREAMMASTER_NONE;
    param.dwAudioBufferSize = audioBufferSize;

    CHECKRESULT(capCaptureSetSetup(m_captureWindow,&param,sizeof(param)));
    if(captureAudio()) {
      int audioFormatSize = capGetAudioFormat(m_captureWindow,&m_audioFormat, sizeof(m_audioFormat));
      CHECKRESULT(capSetCallbackOnWaveStream( m_captureWindow, captureWaveStreamCallback));
    }
    if(captureVideo()) {
      int videoFormatSize = capGetVideoFormat(m_captureWindow,&m_videoFormat, sizeof(m_videoFormat));
      CHECKRESULT(capSetCallbackOnVideoStream(m_captureWindow, captureVideoStreamCallback));
      CHECKRESULT(capSetCallbackOnFrame(      m_captureWindow, captureFrameCallback));
    }
    CHECKRESULT(capSetCallbackOnStatus(     m_captureWindow, captureStatusCallback));
    CHECKRESULT(capSetCallbackOnCapControl( m_captureWindow, captureControlCallback));
    CHECKRESULT(capSetCallbackOnError(      m_captureWindow, captureErrorCallback));

    if(captureAudio() && m_playAudio) {
      m_audioThread = new AudioPlayerThread(*this); TRACE_NEW(m_audioThread);
      m_audioThread->start();
    }
  } catch(...) {
    captureCleanup();
    throw;
  }
}
示例#4
0
文件: typout.cpp 项目: mingpen/OpenNT
VOID NEAR OutputBaseInterfaces
(
    ICreateTypeInfo FAR* lpdtinfo,
    LPENTRY pEntry,
    TYPEKIND tkind
)
{
    HREFTYPE	hreftype;
    HRESULT	res;
    LPINTER	lpinterList = pEntry->type.inter.interList;
    LPINTER	lpinter;
    SHORT	i;		
    INT		implTypeFlags;

    Assert (lpinterList);	// caller should have checked this for use
    // point to first base interface
    lpinter = (LPINTER)ListFirst(lpinterList);
    for (i=0;;i++)
	{
	    // get index of typeinfo of base interface/dispinterface
	    if (lpinter->ptypeInter->lptinfo == NULL)
		ItemError(szFmtErrOutput, lpinter->ptypeInter->szName, OERR_NO_DEF);

	    CHECKRESULT(lpdtinfo->AddRefTypeInfo(lpinter->ptypeInter->lptinfo, &hreftype));

	    CHECKRESULT(lpdtinfo->AddImplType(i, hreftype));

	    // 
	    if (tkind == TKIND_COCLASS) {
		// need to always set the flags for items in a coclass
	        implTypeFlags = 0;
	        if (lpinter->fAttr & fDEFAULT)
		    implTypeFlags |= IMPLTYPEFLAG_FDEFAULT;
	        if (lpinter->fAttr & fRESTRICTED)
	            implTypeFlags |= IMPLTYPEFLAG_FRESTRICTED;
	        if (lpinter->fAttr & fSOURCE)
	            implTypeFlags |= IMPLTYPEFLAG_FSOURCE;
	        CHECKRESULT(lpdtinfo->SetImplTypeFlags(i, implTypeFlags));
	    }

	    // advance to next entry if not all done
	    if (lpinter == (LPINTER)ListLast(lpinterList))
		break;			// exit if all done
	    lpinter = (LPINTER)lpinter->pNext;
	} // WHILE
}
示例#5
0
void MMCapture::captureCleanup() {
  if(m_audioThread != NULL) {
    m_audioQueue.put(AudioQueueElement());
    while(m_audioThread->stillActive()) {
      Sleep(100);
    }
    SAFEDELETE(m_audioThread);
  }
  if(m_webCamConnected) {
    CHECKRESULT(capDriverDisconnect(m_captureWindow));
    m_webCamConnected = false;
  }
  if(m_captureWindow != NULL) {
    CHECKRESULT(DestroyWindow(m_captureWindow));
    m_captureWindow = NULL;
  }
}
bool D3DeviceFactory::supportFormatConversion(D3DDEVTYPE deviceType, D3DFORMAT srcFormat, D3DFORMAT dstFormat, UINT adapter) { // static
  const HRESULT hr = s_direct3D->CheckDeviceFormatConversion(adapter, deviceType, srcFormat, dstFormat);
  switch(hr) {
  case D3D_OK             : return true;
  case D3DERR_NOTAVAILABLE: return false;
  default                 : CHECKRESULT(hr);
                            return false;
  }
}
CompactArray<D3DDISPLAYMODE> D3DeviceFactory::getDisplayModes(UINT adapter) { // static
  CompactArray<D3DDISPLAYMODE> result;
  D3DDISPLAYMODE adapterMode = D3DeviceFactory::getDisplayMode(adapter);
  const UINT modeCount = s_direct3D->GetAdapterModeCount(adapter, adapterMode.Format);
  for (UINT mode = 0; mode < modeCount; mode++) {
    D3DDISPLAYMODE dp;
    CHECKRESULT(s_direct3D->EnumAdapterModes(adapter, adapterMode.Format, mode, &dp));
    result.add(dp);
  };
  return result;
}
示例#8
0
文件: typout.cpp 项目: mingpen/OpenNT
VOID NEAR OutputAlias
(
    ICreateTypeInfo FAR* lpdtinfo,
    LPTYPE lpTypeAlias
)
{
    HRESULT res;

    // update the tdesc.hreftype field of the base type if it's
    // a user-defined type.
    UpdateHRefType(lpdtinfo, lpTypeAlias);

    // Define the alias:
    CHECKRESULT(lpdtinfo->SetTypeDescAlias(&(lpTypePublic(lpTypeAlias)->tdesc)));
}
LPDIRECT3DDEVICE D3DeviceFactory::createDevice(HWND hwnd, D3DPRESENT_PARAMETERS *param, UINT adapter) { // static
  if(s_direct3D == NULL) {
    initDirect3D();
  }

  D3DPRESENT_PARAMETERS tmpParam;
  if(param == NULL) {
    tmpParam = getDefaultPresentParameters(hwnd, adapter);
    param = &tmpParam;
  }
  LPDIRECT3DDEVICE device;

  CHECKRESULT(s_direct3D->CreateDeviceEx(adapter
                                        ,D3DDEVTYPE_HAL
                                        ,hwnd
                                        ,D3DCREATE_SOFTWARE_VERTEXPROCESSING
                                        ,param
                                        ,NULL
                                        ,&device));
  TRACE_CREATE(device);

  return device;
}
示例#10
0
文件: typout.cpp 项目: mingpen/OpenNT
// update the tdesc.HRefType field of the base type prior to
// using a given type.
VOID NEAR UpdateHRefType
(
    ICreateTypeInfo FAR* lpdtinfo,
    LPTYPE lpTypeBase
)
{

    HRESULT	res;
    HREFTYPE	hreftype;
    LPSTR	szTypeName;
    LPTYPE	lpTypeCArray;

    // get * to real base type, ignoring non-public typedef's
    lpTypeBase = lpTypePublic(lpTypeBase);
    lpTypeCArray = NULL;		// assume not a C array

    // CONSIDER: non-pointer to a forward declare with no def yet should give an
    // CONSIDER: error. This isn't the right check, but it's close.
    // CONSIDER: error currently gets caught by Layout() so it's no big deal.
    //if (lpTypeBase->tdesc.vt == VT_USERDEFINED && (lpTypeBase->tentrykind & ~tFORWARD))
    //	  goto NoDef;


    while (lpTypeBase->tentrykind == tREF)	// for VT_PTR, VT_SAFEARRAY or
						// VT_CARRAY
	{
	    if (lpTypeBase->tdesc.vt == VT_CARRAY)
	        lpTypeCArray = lpTypeBase;
	    else
	        lpTypeCArray = NULL;	// not a C array
	    lpTypeBase = lpTypeBase->ref.ptypeBase;

 	    // get * to real base type, ignoring non-public typedef's
	    lpTypeBase = lpTypePublic(lpTypeBase);
	}


    // update the tdesc.hreftype of the base type if necessary
    if (lpTypeBase->tdesc.vt == VT_USERDEFINED)
	{

	    if (lpTypeBase->lptinfo == NULL)
		{   // we're trying to use a forward declaration to a
		    // type with no real definition
//NoDef:
		    switch (lpTypeBase->tentrykind & ~tFORWARD)
			{
			case tSTRUCT:
			case tENUM:
			case tUNION:
			    szTypeName = lpTypeBase->structenum.szTag;
			    break;
			default:
			    szTypeName = lpTypeBase->szName;
			    break;
			}
		    ItemError(szFmtErrOutput, szTypeName, OERR_NO_DEF);
		}

	    // get reference to given typeinfo
	    CHECKRESULT(lpdtinfo->AddRefTypeInfo(lpTypeBase->lptinfo, &hreftype));

	    // store this in the appropriate tdesc
	    if (lpTypeCArray)	// C arrays have a separate tdesc
	        lpTypeCArray->tdesc.lpadesc->tdescElem.hreftype = hreftype;
	    else
	        lpTypeBase->tdesc.hreftype = hreftype;
	}
}
示例#11
0
MStatus moveCmd::action( int flag )
//
// Description
// 		Do the actual work here to move the objects	by vector
//
{
	MStatus stat;
	MVector vector = delta;

	switch( flag )
	{
		case UNDOIT:	// undo
			vector.x = -vector.x;
			vector.y = -vector.y;
			vector.z = -vector.z;
			break;
		case REDOIT:	// redo
			break;
		case DOIT:		// do command
			break;
		default:
			break;
	}

	// Create a selection list iterator
	//
	MSelectionList slist;
 	MGlobal::getActiveSelectionList( slist );
	MItSelectionList iter( slist, MFn::kInvalid, &stat );

	if ( MS::kSuccess == stat ) {
		MDagPath 	mdagPath;		// Item dag path
		MObject 	mComponent;		// Current component
		MSpace::Space spc = MSpace::kWorld;

		// Translate all selected objects
		//
		for ( ; !iter.isDone(); iter.next() ) 
		{
			// Get path and possibly a component
			//
			iter.getDagPath( mdagPath, mComponent );

			MFnTransform transFn( mdagPath, &stat );
			if ( MS::kSuccess == stat ) {
				stat = transFn.translateBy( vector, spc );
				CHECKRESULT(stat,"Error doing translate on transform");
				continue;
			}

			MItCurveCV cvFn( mdagPath, mComponent, &stat );
			if ( MS::kSuccess == stat ) {
				for ( ; !cvFn.isDone(); cvFn.next() ) {
					stat = cvFn.translateBy( vector, spc );
					CHECKRESULT(stat,"Error setting CV");
				}
				cvFn.updateCurve();
			}

			MItSurfaceCV sCvFn( mdagPath, mComponent, true, &stat );
			if ( MS::kSuccess == stat ) {
				for ( ; !sCvFn.isDone(); sCvFn.nextRow() ) {
					for ( ; !sCvFn.isRowDone(); sCvFn.next() ) {
						stat = sCvFn.translateBy( vector, spc );
						CHECKRESULT(stat,"Error setting CV");
					}
				}
				sCvFn.updateSurface();
			}

			MItMeshVertex vtxFn( mdagPath, mComponent, &stat );
			if ( MS::kSuccess == stat ) {
				for ( ; !vtxFn.isDone(); vtxFn.next() ) {
					stat = vtxFn.translateBy( vector, spc );
					CHECKRESULT(stat,"Error setting Vertex");
				}
				vtxFn.updateSurface();
			}
		} // for
	}
	else {
		cerr << "Error creating selection list iterator" << endl;
	}
	return MS::kSuccess;
}
示例#12
0
static void
process_message(isc_buffer_t *source) {
	dns_message_t *message;
	isc_result_t result;
	int i;

	message = NULL;
	result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &message);
	CHECKRESULT(result, "dns_message_create failed");

	result = dns_message_parse(message, source, parseflags);
	if (result == DNS_R_RECOVERABLE)
		result = ISC_R_SUCCESS;
	CHECKRESULT(result, "dns_message_parse failed");

	result = printmessage(message);
	CHECKRESULT(result, "printmessage() failed");

	if (printmemstats)
		isc_mem_stats(mctx, stdout);

	if (dorender) {
		unsigned char b2[64 * 1024];
		isc_buffer_t buffer;
		dns_compress_t cctx;

		isc_buffer_init(&buffer, b2, sizeof(b2));

		/*
		 * XXXMLG
		 * Changing this here is a hack, and should not be done in
		 * reasonable application code, ever.
	 	*/
		message->from_to_wire = DNS_MESSAGE_INTENTRENDER;

 		for (i = 0; i < DNS_SECTION_MAX; i++)
			message->counts[i] = 0;  /* Another hack XXX */

		result = dns_compress_init(&cctx, -1, mctx);
		CHECKRESULT(result, "dns_compress_init() failed");

		result = dns_message_renderbegin(message, &cctx, &buffer);
		CHECKRESULT(result, "dns_message_renderbegin() failed");

		result = dns_message_rendersection(message,
						   DNS_SECTION_QUESTION, 0);
		CHECKRESULT(result,
			    "dns_message_rendersection(QUESTION) failed");

		result = dns_message_rendersection(message,
						   DNS_SECTION_ANSWER, 0);
		CHECKRESULT(result,
			    "dns_message_rendersection(ANSWER) failed");

		result = dns_message_rendersection(message,
						   DNS_SECTION_AUTHORITY, 0);
		CHECKRESULT(result,
			    "dns_message_rendersection(AUTHORITY) failed");

		result = dns_message_rendersection(message,
						   DNS_SECTION_ADDITIONAL, 0);
		CHECKRESULT(result,
			    "dns_message_rendersection(ADDITIONAL) failed");

		dns_message_renderend(message);

		dns_compress_invalidate(&cctx);

		message->from_to_wire = DNS_MESSAGE_INTENTPARSE;
		dns_message_destroy(&message);

		printf("Message rendered.\n");
		if (printmemstats)
			isc_mem_stats(mctx, stdout);

		result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE,
					    &message);
		CHECKRESULT(result, "dns_message_create failed");

		result = dns_message_parse(message, &buffer, parseflags);
		CHECKRESULT(result, "dns_message_parse failed");

		result = printmessage(message);
		CHECKRESULT(result, "printmessage() failed");
	}
	dns_message_destroy(&message);
}
//
// Main routine
///////////////////////////////////////////////////////////////////////////////
MStatus particleSystemInfoCmd::doIt( const MArgList& args )
{
	MStatus stat = parseArgs( args );
	if( stat != MS::kSuccess ) return stat;

	if( particleNode.isNull() ) {
	        MObject parent;
		MFnParticleSystem dummy;
		particleNode = dummy.create(&stat);
		CHECKRESULT(stat,"MFnParticleSystem::create(status) failed!");

		MFnParticleSystem ps( particleNode, &stat );
		CHECKRESULT(stat,"MFnParticleSystem::MFnParticleSystem(MObject,status) failed!");

		MPointArray posArray;
		posArray.append(MPoint(-5,  5, 0));
		posArray.append(MPoint(-5, 10, 0));

		MVectorArray velArray;
		velArray.append(MPoint(1, 1, 0));
		velArray.append(MPoint(1, 1, 0));
		stat = ps.emit(posArray, velArray);
		CHECKRESULT(stat,"MFnParticleSystem::emit(posArray,velArray) failed!");

		stat = ps.emit(MPoint(5,  5, 0));
		CHECKRESULT(stat,"MFnParticleSystem::emit(pos) failed!");
		stat = ps.emit(MPoint(5, 10, 0));
		CHECKRESULT(stat,"MFnParticleSystem::emit(pos) failed!");

		stat = ps.saveInitialState();
		CHECKRESULT(stat,"MFnParticleSystem::saveInitialState() failed!");

		MVectorArray accArray;
		accArray.setLength(4);
		for( unsigned int i=0; i<accArray.length(); i++ )
		{
		        MVector& acc = accArray[i];
			acc.x = acc.y = acc.z = 3.0;
		}
		MString accName("acceleration");
		ps.setPerParticleAttribute( accName, accArray, &stat );
		CHECKRESULT(stat,"MFnParticleSystem::setPerParticleAttribute(vectorArray) failed!");
	} 

	MFnParticleSystem ps( particleNode, &stat );
	CHECKRESULT(stat,"MFnParticleSystem::MFnParticleSystem(MObject,status) failed!");

	if( ! ps.isValid() )
	{
		MGlobal::displayError( "The function set is invalid!" );
		return MS::kFailure;
	}

	const MString name = ps.particleName();
	const MFnParticleSystem::RenderType psType = ps.renderType();
	const unsigned int count = ps.count();

	const char* typeString = NULL;
	switch( psType )
	{
	case MFnParticleSystem::kCloud:
		typeString = "Cloud";
		break;
	case MFnParticleSystem::kTube:
		typeString = "Tube system";
		break;
	case MFnParticleSystem::kBlobby:
		typeString = "Blobby";
		break;
	case MFnParticleSystem::kMultiPoint:
		typeString = "MultiPoint";
		break;
	case MFnParticleSystem::kMultiStreak:
		typeString = "MultiStreak";
		break;
	case MFnParticleSystem::kNumeric:
		typeString = "Numeric";
		break;
	case MFnParticleSystem::kPoints:
		typeString = "Points";
		break;
	case MFnParticleSystem::kSpheres:
		typeString = "Spheres";
		break;
	case MFnParticleSystem::kSprites:
		typeString = "Sprites";
		break;
	case MFnParticleSystem::kStreak:
		typeString = "Streak";
		break;
	default:
		typeString = "Particle system";
		assert( false );
		break;
	}

	char buffer[256];

	sprintf( buffer, "%s \"%s\" has %u primitives.", typeString, name.asChar(), count );
	MGlobal::displayInfo( buffer );

	unsigned i;

	MIntArray ids;
	ps.particleIds( ids );

	sprintf( buffer, "count : %u ", count );
	MGlobal::displayInfo( buffer );
	sprintf( buffer, "%u ids.", ids.length() );
	MGlobal::displayInfo( buffer );

	assert( ids.length() == count );
	for( i=0; i<ids.length(); i++ )
	{
		sprintf( buffer, "id %d  ", ids[i] );
		MGlobal::displayInfo( buffer );
	}

	MVectorArray positions;
	ps.position( positions );
	assert( positions.length() == count );
	for( i=0; i<positions.length(); i++ )
	{
		MVector& p = positions[i];
		sprintf( buffer, "pos %f %f %f  ", p[0], p[1], p[2] );
		MGlobal::displayInfo( buffer );
	}

	MVectorArray vels;
	ps.velocity( vels );
	assert( vels.length() == count );
	for( i=0; i<vels.length(); i++ )
	{
		const MVector& v = vels[i];
		sprintf( buffer, "vel %f %f %f  ", v[0], v[1], v[2] );
		MGlobal::displayInfo( buffer );
	}

	MVectorArray accs;
	ps.acceleration( accs );
	assert( accs.length() == count );
	for( i=0; i<accs.length(); i++ )
	{
		const MVector& a = accs[i];
		sprintf( buffer, "acc %f %f %f  ", a[0], a[1], a[2] );
		MGlobal::displayInfo( buffer );
	}

	bool flag = ps.isDeformedParticleShape(&stat);
	CHECKRESULT(stat,"MFnParticleSystem::isDeformedParticleShape() failed!");
	if( flag ) {
	        MObject obj = ps.originalParticleShape(&stat);
		CHECKRESULT(stat,"MFnParticleSystem::originalParticleShape() failed!");
		if( obj != MObject::kNullObj ) {
		        MFnParticleSystem ps( obj );
			sprintf( buffer, "original particle shape : %s ", ps.particleName().asChar() );
			MGlobal::displayInfo( buffer );
		}
	}

	flag = ps.isDeformedParticleShape(&stat);
	CHECKRESULT(stat,"MFnParticleSystem::isDeformedParticleShape() failed!");
	if( !flag ) {
	        MObject obj = ps.deformedParticleShape(&stat);
		CHECKRESULT(stat,"MFnParticleSystem::deformedParticleShape() failed!");
		if( obj != MObject::kNullObj ) {
		        MFnParticleSystem ps( obj );
			sprintf( buffer, "deformed particle shape : %s ", ps.particleName().asChar() );
			MGlobal::displayInfo( buffer );
		}
	}

	if( ids.length() == positions.length() &&
	    ids.length() == vels.length()      &&
	    ids.length() == accs.length()       ) { 
	        setResult( int(ids.length()) );
	} else {
	        setResult( int(-1) );
	}

	return MS::kSuccess;
}
示例#14
0
文件: typout.cpp 项目: mingpen/OpenNT
// find type defined in an external type library,
// and add it to the type table if found.
// lpszLibName is NULL if we're to look in ALL external type libraries.
LPTYPE FAR FindExtType
(
    LPSTR lpszLibName,
    LPSTR lpszTypeName
)
{
    LPIMPORTLIB lpImpLib;
    HRESULT	res;
    ULONG	lHashVal;
    ITypeInfo FAR* lptinfo;
    ITypeComp FAR* lptcomp;

    Assert (lpszTypeName != NULL);

    if (typlib.pImpLib != NULL)   // if any imported type libraries
	{
	    // point to first imported library entry
	    lpImpLib = (LPIMPORTLIB)ListFirst(typlib.pImpLib);

	    for (;;)
		{

		    // if we're to look in all libraries, or this specific lib
		    if (lpszLibName == NULL || !FCmpCaseIns(lpszLibName, lpImpLib->lpszLibName))
			{

			    SETITEMCUR(lpImpLib->lpszFileName);
			    lHashVal = LHashValOfNameSysA(lpImpLib->lptlibattr->syskind,
						      lpImpLib->lptlibattr->lcid,
						      lpszTypeName);

			    CHECKRESULT(lpImpLib->lptcomp->BindType(ToW(lpszTypeName), lHashVal, &lptinfo, &lptcomp));
			    if (lptinfo)		// if found
				{
				    // create a type table entry for this guy
				    ListInsert(&typlib.pEntry, sizeof(TYPE));

				    // lpszTypeName will get freed by caller.
				    // We must allocate new memory for it.
				    typlib.pEntry->type.szName = _fstrdup(lpszTypeName);

				    // CONSIDER: do a GetTypeAttr on this guy,
				    // to ensure it's not a 'module' type

				    typlib.pEntry->type.tdesc.vt = VT_USERDEFINED;
				    // init this now in case of error, since
				    // error cleanup code looks at this.
				    typlib.pEntry->type.lptinfo = NULL;

				    LPTYPEATTR ptypeattr;
				    TENTRYKIND tentrykind;

				    CHECKRESULT(lptinfo->GetTypeAttr(&ptypeattr));
				    // Get the interface typeinfo instead of
				    // the Dispinteface version. 
				    if (ptypeattr->wTypeFlags & TYPEFLAG_FDUAL){
					ITypeInfo FAR* lptinfo2;
					HREFTYPE hreftype;
					CHECKRESULT(lptinfo->GetRefTypeOfImplType((unsigned int)-1, &hreftype));
					CHECKRESULT(lptinfo->GetRefTypeInfo(hreftype, &lptinfo2));
					lptinfo->Release();
				        lptinfo->ReleaseTypeAttr(ptypeattr);
					lptinfo = lptinfo2;
				        CHECKRESULT(lptinfo->GetTypeAttr(&ptypeattr));
				    }
				    typlib.pEntry->type.lptinfo = lptinfo;

				    // assume generic imported type
				    tentrykind = (TENTRYKIND)(rgtentrykind[ptypeattr->typekind] | tIMPORTED);
				    if (lpszLibName) {
				      tentrykind = (TENTRYKIND)(tentrykind | tQUAL);
				    }
				    typlib.pEntry->type.tentrykind = tentrykind;
				    typlib.pEntry->type.import.wTypeFlags = ptypeattr->wTypeFlags;

				    lptinfo->ReleaseTypeAttr(ptypeattr);
				    return &(typlib.pEntry->type); // all done
				}
			}
	    
		    // advance to next entry if not all done
		    if (lpImpLib == (LPIMPORTLIB)ListLast(typlib.pImpLib))
			break;			// exit if all done
		    lpImpLib = lpImpLib->pNext;
		} // WHILE
	}
    return (LPTYPE)NULL;	//type not found
}
D3DDISPLAYMODE D3DeviceFactory::getDisplayMode(UINT adapter) { // static
  D3DDISPLAYMODE result;
  CHECKRESULT(s_direct3D->GetAdapterDisplayMode(adapter, &result));
  return result;
}
示例#16
0
文件: typout.cpp 项目: mingpen/OpenNT
VOID FAR OutputTyplib
(
  CHAR * szTypeLibFile
)
{
    HRESULT res;
    ICreateTypeLib FAR * lpdtlib;
#ifndef MAC
    CHAR szTypeLibFileTmp[128];
#endif //!MAC
    WORD wLibFlags;

    fDoingOutput = TRUE;		// signal to error reporting code
    SETITEMCUR(typlib.szLibName);

#ifndef MAC
    // pre-pend ".\" to filename if unqualified name, to work-around OLE path
    // searching bug.

    if (!XStrChr(szTypeLibFile, '\\') && !XStrChr(szTypeLibFile, '/') &&
	 *(szTypeLibFile+1) != ':')
	{	// if unqualified name
	   strcpy(szTypeLibFileTmp, ".\\");
	   strcpy(szTypeLibFileTmp+2, szTypeLibFile);
	   // this name is used later -- don't free it
	   //free(szTypeLibFile);
	   szTypeLibFile = szTypeLibFileTmp;
	}

#endif

    // 1. Get * to ICreateTypeLib interface
    CHECKRESULT(CreateTypeLib(SysKind, ToW(szTypeLibFile), &lpdtlib));

    // WARNING: SetLCID must be called before the anything in the nammgr is used
    // it needs to be called even if the user doesn't specifiy an lcid
    // (in which case we default to an lcid of 0).
    CHECKRESULT(lpdtlib->SetLcid(
       (typlib.attr.fAttr & fLCID) ? typlib.attr.lLcid : 0
	));

    // 2. Set the library name:
    CHECKRESULT(lpdtlib->SetName(ToW(typlib.szLibName)));
    
    // 3. Set the library attributes, if present:
    if (typlib.attr.fAttr & fHELPSTRING)
	CHECKRESULT(lpdtlib->SetDocString(ToW(typlib.attr.lpszHelpString)));

    if (typlib.attr.fAttr & fHELPCONTEXT)
	CHECKRESULT(lpdtlib->SetHelpContext(typlib.attr.lHelpContext));

    if (typlib.attr.fAttr & fHELPFILE)
	CHECKRESULT(lpdtlib->SetHelpFileName(ToW(typlib.attr.lpszHelpFile)));

    if (typlib.attr.fAttr & fVERSION)
	CHECKRESULT(lpdtlib->SetVersion(typlib.attr.wVerMajor, typlib.attr.wVerMinor));

    if (typlib.attr.fAttr & fUUID)
	CHECKRESULT(lpdtlib->SetGuid(*typlib.attr.lpUuid));

    wLibFlags = 0;
    if (typlib.attr.fAttr & fRESTRICTED)
        wLibFlags |= LIBFLAG_FRESTRICTED;
    if (typlib.attr.fAttr2 & f2CONTROL)
        wLibFlags |= LIBFLAG_FCONTROL;
    if (typlib.attr.fAttr & fHIDDEN)
        wLibFlags |= LIBFLAG_FHIDDEN;
    CHECKRESULT(lpdtlib->SetLibFlags(wLibFlags));

    // 4. Output all the typinfo's into the type library
    if (typlib.pEntry)			// if any entries
        OutputTypeInfos(lpdtlib);

    // 5. Save the typlib to the give file
    SETITEMCUR(typlib.szLibName);

    CHECKRESULT(lpdtlib->SaveAllChanges());

    // 6. Cleanup.  All done -- release release the ICreateTypeLib.
    lpdtlib->Release();		// release the ICreateTypeLib

}
示例#17
0
文件: typout.cpp 项目: mingpen/OpenNT
// For each library entry, creates a typeinfo in the typelib,
// and fills it in.
VOID NEAR OutputTypeInfos
(
    ICreateTypeLib FAR * lpdtlib
)
{
    LPENTRY	pEntry;
    TYPEKIND	tkind;
    HRESULT	res;
    ICreateTypeInfo FAR* lpdtinfo;
    WORD	wTypeFlags;

    // First allocate an array of ELEMDESCs to hold the max # of
    // args of any function we need to describe.
    rgFuncArgs = (ELEMDESC FAR*)_fmalloc(cArgsMax * sizeof(ELEMDESC));
    rgszFuncArgNames = (LPOLESTR FAR *)_fmalloc((cArgsMax+1) * sizeof(LPOLESTR));
    if (rgFuncArgs == NULL || rgszFuncArgNames == NULL)
	ParseError(ERR_OM);

    // pass 1 -- create the typeinfo's
    pEntry = (LPENTRY)ListFirst(typlib.pEntry);	// point to first entry
    for (;;)
	{

	    // determine if we are going to create a typeinfo for this guy
	    switch (pEntry->type.tentrykind)
		{
		case tTYPEDEF:
		    if (pEntry->attr.fAttr)	// create lpdtinfo only if
			break;			// this is a 'PUBLIC' typedef

NoTypeInfos:
		    pEntry->lpdtinfo = NULL;	// no lpdtinfo for this

		case tREF:			// no typeinfo's made for these
		case tINTRINSIC:
		    goto Next_Entry1;

		default:
		    // no typeinfo's made for forward declarations
		    if (pEntry->type.tentrykind & tFORWARD)
			goto NoTypeInfos;
		    if (pEntry->type.tentrykind & tIMPORTED)
			goto Next_Entry1;	// nothing for imported types
		    break;
		}

	    // 1. determine kind of typeinfo to create
	    tkind = rgtkind[pEntry->type.tentrykind];

	    // 2. Create type library entry (TypeInfo) of a given name/and
	    //    type, getting a pointer to the ICreateTypeInfo interface
	    SETITEMCUR(pEntry->type.szName);
	    CHECKRESULT(lpdtlib->CreateTypeInfo(ToW(pEntry->type.szName), tkind, &lpdtinfo));
	    pEntry->lpdtinfo = lpdtinfo;

	    // 3. Set the item's attributes:
	    if (pEntry->attr.fAttr & fUUID)
		CHECKRESULT(lpdtinfo->SetGuid(*pEntry->attr.lpUuid));

	    if (pEntry->attr.fAttr & fHELPSTRING)
		CHECKRESULT(lpdtinfo->SetDocString(ToW(pEntry->attr.lpszHelpString)));

	    if (pEntry->attr.fAttr & fHELPCONTEXT)
		CHECKRESULT(lpdtinfo->SetHelpContext(pEntry->attr.lHelpContext));

	    if (pEntry->attr.fAttr & fVERSION)
		CHECKRESULT(lpdtinfo->SetVersion(pEntry->attr.wVerMajor, pEntry->attr.wVerMinor));

	    // 4. save lptinfo for this guy in case somebody references it
	    CHECKRESULT(lpdtinfo->QueryInterface(IID_ITypeInfo, (VOID FAR* FAR*)&pEntry->type.lptinfo));

	    // if this type has a forward declaration
	    if (pEntry->lpEntryForward)
		{
		    // copy "real" type info over top of forward declaration,
		    // because folks have pointers to the forward declaration
		    pEntry->lpEntryForward->type.tdesc = pEntry->type.tdesc;
		    pEntry->lpEntryForward->type.lptinfo = pEntry->type.lptinfo;
		    // Only need to copy these 2 fields from the type (the
		    // others aren't referenced at type creation time.
		}

Next_Entry1:
	    // advance to next entry if not all done
	    if (pEntry == (LPENTRY)ListLast(typlib.pEntry))
		break;			// exit if all done
	    pEntry = (LPENTRY)pEntry->type.pNext;
	}


    // pass 2 -- process each entry
    pEntry = (LPENTRY)ListFirst(typlib.pEntry);	// point to first entry
    for (;;)
	{

	    // 1.  Get our lpdtinfo again if we have one

	    switch (pEntry->type.tentrykind)
		{
		case tREF:
		case tINTRINSIC:
		    goto Next_Entry2;	// these guys don't have lpdtinfo field
		default:
		    if (pEntry->type.tentrykind & tIMPORTED)
			goto Next_Entry2;	// no lpdtinfo field
		    break;
		}

	    lpdtinfo = pEntry->lpdtinfo;
	    if (lpdtinfo == NULL)	// skip if no lpdtinfo created
		goto Next_Entry2;	// (forward decl or non-public typedef)

	    // set up for error reporting
	    SETITEMCUR(pEntry->type.szName);

	    // 2. determine kind of typeinfo we're dealing with
	    tkind = rgtkind[pEntry->type.tentrykind];

	    // 2a. Set the typeinfo flags
	    wTypeFlags = 0;
	    if (tkind == TKIND_COCLASS) {
		// COCLASSs always have FCANCREATE bit set
		wTypeFlags |= TYPEFLAG_FCANCREATE;
		// these are only valid on COCLASSs
	        if (pEntry->attr.fAttr & fAPPOBJECT)
		    wTypeFlags |= (WORD)TYPEFLAG_FAPPOBJECT;
	        if (pEntry->attr.fAttr & fLICENSED)
		    wTypeFlags |= (WORD)TYPEFLAG_FLICENSED;
	        if (pEntry->attr.fAttr & fPREDECLID)
		    wTypeFlags |= (WORD)TYPEFLAG_FPREDECLID;
 	    }
	    if (pEntry->attr.fAttr & fHIDDEN)
		wTypeFlags |= (WORD)TYPEFLAG_FHIDDEN;
	    if (pEntry->attr.fAttr2 & f2CONTROL)
		wTypeFlags |= (WORD)TYPEFLAG_FCONTROL;
	    if (pEntry->attr.fAttr2 & f2NONEXTENSIBLE)
		wTypeFlags |= (WORD)TYPEFLAG_FNONEXTENSIBLE;
	    if (pEntry->attr.fAttr2 & f2DUAL) // DUAL implies OLEAUTOMATION
		wTypeFlags |= (WORD)(TYPEFLAG_FDUAL | TYPEFLAG_FOLEAUTOMATION);
	    if (pEntry->attr.fAttr2 & f2OLEAUTOMATION)
		wTypeFlags |= (WORD)TYPEFLAG_FOLEAUTOMATION;
	    CHECKRESULT(lpdtinfo->SetTypeFlags(wTypeFlags));

	    // 3. now process each kind of entry
	    switch (tkind)
		{
		case TKIND_ALIAS:
	
		    OutputAlias(lpdtinfo, pEntry->type.td.ptypeAlias);
		    break;

		case TKIND_RECORD: 	// struct's, enum's, and union's are
		case TKIND_ENUM:	// all very similar
		case TKIND_UNION:
		    OutputElems(lpdtinfo, pEntry->type.structenum.elemList, tkind);
		    break;

		case TKIND_MODULE:
		    OutputFuncs(lpdtinfo, pEntry, pEntry->module.funcList, tkind);
		    OutputElems(lpdtinfo, pEntry->module.constList, tkind);
		    break;

		case TKIND_INTERFACE:
		    OutputInterface(lpdtinfo, pEntry);
		    break;

		case TKIND_DISPATCH:
		    OutputDispinter(lpdtinfo, pEntry);
		    break;

		case TKIND_COCLASS:
		    OutputClass(lpdtinfo, pEntry);
		    break;

#if FV_PROPSET
		case TKIND_PROPSET:
		    // CONSIDER: (FV_PROPSET) do something with base_propset name
		    OutputElems(lpdtinfo, pEntry->propset.propList, tkind);
		    break;
#endif //FV_PROPSET
		default:
		    Assert(FALSE);
		};

            // 3a. Set the alignment for this TypeInfo.  Must be done before
	    // Layout().
            CHECKRESULT(lpdtinfo->SetAlignment(iAlignMax));

	    // 4. Compile this typeinfo we've just created.
	    SETITEMCUR(pEntry->type.szName);
	    CHECKRESULT(lpdtinfo->LayOut());

	    // 5. Cleanup.  All done with lpdtinfo.
	    lpdtinfo->Release();

Next_Entry2:
	    // advance to next entry if not all done
	    if (pEntry == (LPENTRY)ListLast(typlib.pEntry))
		break;			// exit if all done
	    pEntry = (LPENTRY)pEntry->type.pNext;
	}


    // now clean up everything else
    _ffree(rgFuncArgs);	 	// done with function args we allocated
    _ffree(rgszFuncArgNames);

}
示例#18
0
MStatus richMoveCmd::action( int flag )
//
// Description
// 		Do the actual work here to move the objects	by vector
//
{
	MStatus stat;
	MVector vector = delta;

	switch( flag )
	{
		case UNDOIT:	// undo
			vector.x = -vector.x;
			vector.y = -vector.y;
			vector.z = -vector.z;
			break;
		case REDOIT:	// redo
			break;
		case DOIT:		// do command
			break;
		default:
			break;
	}

	// Create a selection list iterator
	//
	MSelectionList slist;
	MSpace::Space spc = MSpace::kWorld;
	MRichSelection rs;
	MGlobal::getRichSelection( rs);

	// Translate all selected objects
	//
	rs.getSelection( slist);
	if( !slist.isEmpty())
	{
		for ( MItSelectionList iter( slist, MFn::kInvalid); !iter.isDone(); iter.next() ) 
		{
			// Get path and possibly a component
			//
			MDagPath 	mdagPath;		// Item dag path
			MObject 	mComponent;		// Current component
			iter.getDagPath( mdagPath, mComponent );
			MPlane seam;
			rs.getSymmetryPlane( mdagPath, spc, seam);

			if( mComponent.isNull())
			{
				// Transform move
				MFnTransform transFn( mdagPath, &stat );
				if ( MS::kSuccess == stat ) {
					stat = transFn.translateBy( vector, spc );
					CHECKRESULT(stat,"Error doing translate on transform");
					continue;
				}
			}
			else
			{
				// Component move
				iter.getDagPath( mdagPath, mComponent );
				for( MItGeometry geoIter( mdagPath, mComponent); !geoIter.isDone(); geoIter.next())
				{
					MVector origPosition = geoIter.position( spc);
					MWeight weight = geoIter.weight();

					// Calculate the soft move
					MVector position = origPosition + vector * weight.influence();

					// Calculate the soft seam
					position += seam.normal() * (weight.seam() * (seam.directedDistance( origPosition) - seam.directedDistance( position)));
					geoIter.setPosition( position, spc);
				}
			}
		}
	}

	// Translate all symmetry objects
	//
	slist.clear();
	rs.getSymmetry( slist);
	if( !slist.isEmpty())
	{
		for ( MItSelectionList iter( slist, MFn::kInvalid); !iter.isDone(); iter.next() ) 
		{
			// Get path and possibly a component
			//
			MDagPath 	mdagPath;		// Item dag path
			MObject 	mComponent;		// Current component
			iter.getDagPath( mdagPath, mComponent );
			MPlane seam;
			rs.getSymmetryPlane( mdagPath, spc, seam);

			// Reflect our world space move
			//
			MMatrix symmetryMatrix;
			rs.getSymmetryMatrix( mdagPath, spc, symmetryMatrix);
			MVector symmetryVector =  vector * symmetryMatrix;

			if( mComponent.isNull())
			{
				// Transform move
				MFnTransform transFn( mdagPath, &stat );
				if ( MS::kSuccess == stat ) {
					stat = transFn.translateBy( symmetryVector, spc );
					CHECKRESULT(stat,"Error doing translate on transform");
					continue;
				}
			}
			else
			{
				// Component move
				iter.getDagPath( mdagPath, mComponent );
				for( MItGeometry geoIter( mdagPath, mComponent); !geoIter.isDone(); geoIter.next())
				{
					MVector origPosition = geoIter.position( spc);
					MWeight weight = geoIter.weight();

					// Calculate the soft move
					MVector position = origPosition + symmetryVector * weight.influence();

					// Calculate the soft seam
					position += seam.normal() * (weight.seam() * (seam.directedDistance( origPosition) - seam.directedDistance( position)));
					geoIter.setPosition( position, spc);
				}
			}
		}
	}

	return MS::kSuccess;
}
示例#19
0
CAPSTATUS MMCapture::getStatus() const {
  CAPSTATUS result;
  CHECKRESULT(capGetStatus(m_captureWindow, &result, sizeof(CAPSTATUS)));
  return result;
}
示例#20
0
文件: typout.cpp 项目: mingpen/OpenNT
VOID NEAR OutputElems
(
    ICreateTypeInfo FAR* lpdtinfo,
    LPELEM	pElemList,
    TYPEKIND	tkind
)
{

    LPELEM	pElem;
    HRESULT	res;
    UINT	iElem = 0;		// element index
    VARDESC	VarDesc;


    if (pElemList == NULL)
	return;

    pElem = (LPELEM)ListFirst(pElemList);	// point to first entry

    for (;;)
	{

	    // First fill in the VARDESC structure with the element's info
	    SETITEMCUR(pElem->szElemName);

	    VarDesc.memid = DISPID_UNKNOWN;	// assume not a dispinterface

	    // Set up varkind
	    switch (tkind)
		{
		case TKIND_ENUM:		// for enum elements
		case TKIND_MODULE:		// for const's
		    VarDesc.varkind =  VAR_CONST;
		    VarDesc.lpvarValue = pElem->lpElemVal;	// * to value
		    if (tkind == TKIND_MODULE)
		        goto DoLoadElemDesc;		// set up the tdesc

		    // For ENUM elements, can't call LoadElemDesc, because
		    // we have no pElem->elemType.  Do the required work here.

		    VarDesc.elemdescVar.tdesc.vt = VT_INT;	// element type
								// is an INT
		    VarDesc.elemdescVar.idldesc.wIDLFlags = 0;	// no IDL info
#ifdef WIN16
		    VarDesc.elemdescVar.idldesc.bstrIDLInfo = NULL;
#else //WIN16
		    VarDesc.elemdescVar.idldesc.dwReserved = 0;
#endif //WIN16
		    break;

		case TKIND_RECORD:
		case TKIND_UNION:
		    VarDesc.varkind =  VAR_PERINSTANCE;
		    goto DoLoadElemDesc;

		default:
#if FV_PROPSET
		    Assert(tkind == TKIND_DISPATCH || tkind == TKIND_PROPSET);
#else //FV_PROPSET
		    Assert(tkind == TKIND_DISPATCH);
#endif //FV_PROPSET
		    VarDesc.varkind =  VAR_DISPATCH;

		    // id' attribute required
		    Assert (pElem->attr.fAttr & fID);
		    VarDesc.memid = pElem->attr.lId;

DoLoadElemDesc:
		    // Set up elemdescVar.  Contains name, and type of item.
		    LoadElemDesc(lpdtinfo, &(VarDesc.elemdescVar), pElem);
		}

	    // VarDesc.oInst is not used when doing AddVarDesc
	    VarDesc.wVarFlags = 0;
	    if (pElem->attr.fAttr & fREADONLY)
	        VarDesc.wVarFlags |= (WORD)VARFLAG_FREADONLY;
	    if (pElem->attr.fAttr & fSOURCE)
	        VarDesc.wVarFlags |= (WORD)VARFLAG_FSOURCE;
	    if (pElem->attr.fAttr & fBINDABLE)
	        VarDesc.wVarFlags |= (WORD)VARFLAG_FBINDABLE;
	    if (pElem->attr.fAttr & fREQUESTEDIT)
	        VarDesc.wVarFlags |= (WORD)VARFLAG_FREQUESTEDIT;
	    if (pElem->attr.fAttr & fDISPLAYBIND)
	        VarDesc.wVarFlags |= (WORD)VARFLAG_FDISPLAYBIND;
	    if (pElem->attr.fAttr & fDEFAULTBIND)
	        VarDesc.wVarFlags |= (WORD)VARFLAG_FDEFAULTBIND;
	    if (pElem->attr.fAttr & fHIDDEN)
	        VarDesc.wVarFlags |= (WORD)VARFLAG_FHIDDEN;

	    // Now define the element
	    CHECKRESULT(lpdtinfo->AddVarDesc(iElem, &VarDesc));

	    // Lastly, set element's remaining attributes:
	    CHECKRESULT(lpdtinfo->SetVarName(iElem, ToW(pElem->szElemName)));

	    if (pElem->attr.fAttr & fHELPSTRING)
		CHECKRESULT(lpdtinfo->SetVarDocString(iElem, ToW(pElem->attr.lpszHelpString)));
	    if (pElem->attr.fAttr & fHELPCONTEXT)
		CHECKRESULT(lpdtinfo->SetVarHelpContext(iElem, pElem->attr.lHelpContext));
	    // advance to next entry if not all done
	    if (pElem == (LPELEM)ListLast(pElemList))
		break;			// exit if all done
	    pElem = pElem->pNext;
	    iElem++;			// advance element counter
	}
}
示例#21
0
文件: typout.cpp 项目: mingpen/OpenNT
VOID NEAR OutputFuncs
(
    ICreateTypeInfo FAR* lpdtinfo,
    LPENTRY	pEntry,
    LPFUNC	pFuncList,
    TYPEKIND	tkind
)
{

    LPFUNC	pFunc;
    LPELEM	pArg;
    HRESULT	res;
    UINT	iFunc = 0;		// function index
    LPOLESTR	lpszDllName;
    LPSTR	lpszProcName;
    SHORT	i;
    FUNCDESC	FuncDesc;
    LPOLESTR FAR*  lplpszArgName;

    if (pFuncList == NULL)		// just return if no functions to output
	return;

    FuncDesc.lprgelemdescParam = rgFuncArgs;	// set up array of args

    pFunc = (LPFUNC)ListFirst(pFuncList);	// point to first entry
#if FV_UNICODE_OLE
    lpszDllName = (pEntry->attr.fAttr & fDLLNAME ? ToNewW(pEntry->attr.lpszDllName) : NULL);
#else
    lpszDllName = pEntry->attr.lpszDllName;
#endif

    for (;;)
	{
	    // Fill in the FUNCDESC structure with the function's info

	    // set up funckind
	    switch (tkind) {
		case TKIND_MODULE:
		    FuncDesc.funckind = FUNC_STATIC;
		    break;
		case TKIND_INTERFACE:
		    FuncDesc.funckind = FUNC_PUREVIRTUAL;
		    break;
		case TKIND_DISPATCH:
		    FuncDesc.funckind = FUNC_DISPATCH;
		    break;
		default:
		    Assert(FALSE);
	    }

	    // set up invkind
	    FuncDesc.invkind = INVOKE_FUNC;	// default
	    if (pFunc->func.attr.fAttr & fPROPGET)
	        FuncDesc.invkind = INVOKE_PROPERTYGET;
	    else if (pFunc->func.attr.fAttr & fPROPPUT)
	        FuncDesc.invkind = INVOKE_PROPERTYPUT;
	    else if (pFunc->func.attr.fAttr & fPROPPUTREF)
	        FuncDesc.invkind = INVOKE_PROPERTYPUTREF;

	    // set up callconv
	    if (pFunc->func.attr.fAttr2 & f2PASCAL)
		// CC_MACPASCAL if /mac specified, CC_MSCPASCAL otherwise
	        FuncDesc.callconv = (CALLCONV)(SysKind == SYS_MAC ? CC_MACPASCAL: CC_MSCPASCAL);
	    else if (pFunc->func.attr.fAttr2 & f2CDECL)
	        FuncDesc.callconv = CC_CDECL;
	    else if (pFunc->func.attr.fAttr2 & f2STDCALL)
	        FuncDesc.callconv = CC_STDCALL;
#ifdef	DEBUG
	    else Assert(FALSE);
#endif	//DEBUG

	    FuncDesc.wFuncFlags = 0;
	    if (pFunc->func.attr.fAttr & fRESTRICTED)
	        FuncDesc.wFuncFlags |= (WORD)FUNCFLAG_FRESTRICTED;
	    if (pFunc->func.attr.fAttr & fSOURCE)
	        FuncDesc.wFuncFlags |= (WORD)FUNCFLAG_FSOURCE;
	    if (pFunc->func.attr.fAttr & fBINDABLE)
	        FuncDesc.wFuncFlags |= (WORD)FUNCFLAG_FBINDABLE;
	    if (pFunc->func.attr.fAttr & fREQUESTEDIT)
	        FuncDesc.wFuncFlags |= (WORD)FUNCFLAG_FREQUESTEDIT;
	    if (pFunc->func.attr.fAttr & fDISPLAYBIND)
	        FuncDesc.wFuncFlags |= (WORD)FUNCFLAG_FDISPLAYBIND;
	    if (pFunc->func.attr.fAttr & fDEFAULTBIND)
	        FuncDesc.wFuncFlags |= (WORD)FUNCFLAG_FDEFAULTBIND;
	    if (pFunc->func.attr.fAttr & fHIDDEN)
	        FuncDesc.wFuncFlags |= (WORD)FUNCFLAG_FHIDDEN;

	    // set up cParams & cParamsOpt
	    FuncDesc.cParams = pFunc->cArgs;
	    FuncDesc.cParamsOpt = pFunc->cOptArgs;
	    //NOTE: cParamsOpt can be set to -1, to note that last parm is a
	    //NOTE: [safe] array of variant args.  This corresponds to the
	    //NOTE: 'vararg' attribute in the input description.  If this was
	    //NOTE: specified, the parser set pFunc->cOptArgs to -1 for us.
 
	    // set up misc unused stuff
	    FuncDesc.oVft = 0;		// only used for FUNC_VIRTUAL
	    FuncDesc.cScodes = -1;	// list of SCODEs unknown
	    FuncDesc.lprgscode = NULL;

	    // set id field if 'id' attribute specified
	    if (pFunc->func.attr.fAttr & fID)
	        FuncDesc.memid = pFunc->func.attr.lId;
	    else
	        FuncDesc.memid = DISPID_UNKNOWN;

	    // set up elemdescFunc
	    // Contains the ID, name, and return type of the function
	    LoadElemDesc(lpdtinfo, &(FuncDesc.elemdescFunc), &pFunc->func);

	    // save function name
	    lplpszArgName = rgszFuncArgNames;
	    *lplpszArgName++ = ToNewW(pFunc->func.szElemName);
	    SETITEMCUR(pFunc->func.szElemName);

	    // set up the lprgelemdescParam array of info for each parameter
	    pArg = pFunc->argList;	// point to last arg, if any
	    for (i = 0; i < pFunc->cArgs; i++)
		{
		    pArg = pArg->pNext;		// point to next arg (first arg
						// first time through loop)
		    LoadElemDesc(lpdtinfo, &(FuncDesc.lprgelemdescParam[i]), pArg);
		    *lplpszArgName++ = ToNewW(pArg->szElemName); // save arg name
		}

	    // Define the function item:
	    CHECKRESULT(lpdtinfo->AddFuncDesc(iFunc, &FuncDesc));

	    // set the names of the function and the parameters
	    Assert(i == pFunc->cArgs);

	    // don't set the name of the last param for proput/putref functions
	    if (pFunc->func.attr.fAttr & (fPROPPUT | fPROPPUTREF)) {
		i--;
	    }

	    CHECKRESULT(lpdtinfo->SetFuncAndParamNames(iFunc, rgszFuncArgNames, i+1));
#if FV_UNICODE_OLE
            // free the unicode function & param names
	    lplpszArgName = rgszFuncArgNames;
	    for (i = 0; i <= pFunc->cArgs; i++) {
              _ffree(*lplpszArgName);	 	// done with unicode name
	      lplpszArgName++;
            }
#endif //FV_UNICODE_OLE

	    // Set the function item's remaining attributes:
	    if (pFunc->func.attr.fAttr & fHELPSTRING)
		CHECKRESULT(lpdtinfo->SetFuncDocString(iFunc, ToW(pFunc->func.attr.lpszHelpString)));
	    if (pFunc->func.attr.fAttr & fHELPCONTEXT)
		CHECKRESULT(lpdtinfo->SetFuncHelpContext(iFunc, pFunc->func.attr.lHelpContext));
	    // Handle case of a DLL entrypoint
	    if (pFunc->func.attr.fAttr & fENTRY)
		{
		    // If high word of name is zero, then call by ordnal
		    // If high word of name is non-zero, then call by name
		    // (same as GetProcAddress)

		    lpszProcName = pFunc->func.attr.lpszProcName;
#if FV_UNICODE_OLE
		    if (HIWORD(lpszProcName)) {
                        lpszProcName = (LPSTR)ToW(lpszProcName);
		    }
#endif //FV_UNICODE_OLE
		    CHECKRESULT(lpdtinfo->DefineFuncAsDllEntry(iFunc, lpszDllName, (LPOLESTR)lpszProcName));
		}

	    // advance to next entry if not all done
	    if (pFunc == (LPFUNC)ListLast(pFuncList))
		break;			// exit if all done
	    pFunc = (LPFUNC)pFunc->func.pNext;
	    iFunc++;			// advance function counter
	}
#if FV_UNICODE_OLE
    if (lpszDllName)
        _ffree(lpszDllName);	 	// done with unicode name
#endif //FV_UNICODE_OLE
}
示例#22
0
CAPDRIVERCAPS MMCapture::getDriverCapabilities() const {
  CAPDRIVERCAPS result;
  CHECKRESULT(capDriverGetCaps(m_captureWindow, &result, sizeof(CAPDRIVERCAPS)));
  return result;
}
示例#23
0
bool run_idmap_tdb_common_test(int dummy)
{
	bool result;
	struct idmap_tdb_common_context *ctx;
	struct idmap_domain *dom;

	TALLOC_CTX *memctx = talloc_new(NULL);
	TALLOC_CTX *stack = talloc_stackframe();

	ctx = createcontext(memctx);
	if(!ctx) {
		return false;
	}

	dom = createdomain(memctx);

	dom->private_data = ctx;

	/* test a single allocation from pool (no mapping) */
	result = test_getnewid1(memctx, dom);
	CHECKRESULT(result);

	/* test idmap_tdb_common_set_mapping */
	result = test_setmap1(memctx, dom);
	CHECKRESULT(result);

	/* test idmap_tdb_common_sid_to_unixid */
	result = test_sid2unixid1(memctx, dom);
	CHECKRESULT(result);
	result = test_sid2unixid2(memctx, dom);
	CHECKRESULT(result);

	/* test idmap_tdb_common_sids_to_unixids */
	result = test_sids2unixids1(memctx, dom);
	CHECKRESULT(result);
	result = test_sids2unixids2(memctx, dom);
	CHECKRESULT(result);
	result = test_sids2unixids3(memctx, dom);
	CHECKRESULT(result);

	/* test idmap_tdb_common_unixid_to_sid */
	result = test_unixid2sid1(memctx, dom);
	CHECKRESULT(result);
	result = test_unixid2sid2(memctx, dom);
	CHECKRESULT(result);
	result = test_unixid2sid3(memctx, dom);
	CHECKRESULT(result);

	/* test idmap_tdb_common_unixids_to_sids */
	result = test_unixids2sids1(memctx, dom);
	CHECKRESULT(result);
	result = test_unixids2sids2(memctx, dom);
	CHECKRESULT(result);
	result = test_unixids2sids3(memctx, dom);
	CHECKRESULT(result);

	/* test filling up the range */
	result = test_getnewid2(memctx, dom);
	CHECKRESULT(result);

	talloc_free(memctx);
	talloc_free(stack);

	return true;
}