当前位置: 首页>>代码示例>>C++>>正文


C++ CLR_RT_HeapBlock_Array::GetFirstElement方法代码示例

本文整理汇总了C++中CLR_RT_HeapBlock_Array::GetFirstElement方法的典型用法代码示例。如果您正苦于以下问题:C++ CLR_RT_HeapBlock_Array::GetFirstElement方法的具体用法?C++ CLR_RT_HeapBlock_Array::GetFirstElement怎么用?C++ CLR_RT_HeapBlock_Array::GetFirstElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CLR_RT_HeapBlock_Array的用法示例。


在下文中一共展示了CLR_RT_HeapBlock_Array::GetFirstElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadAsymmetricKey

HRESULT Library_spot_native_Microsoft_SPOT_CryptoState::LoadAsymmetricKey( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    CLR_RT_HeapBlock*       pThis;
    CLR_RT_HeapBlock_Array* array;

    pThis = stack.This(); FAULT_ON_NULL(pThis);

    //
    // Init RSA key.
    //
    array = pThis[ Library_spot_native_Microsoft_SPOT_Cryptography_Key_RSA::FIELD__m_modulus ].DereferenceArray(); FAULT_ON_NULL(array);
    memcpy( &m_keyAsymmetric.module, array->GetFirstElement(), sizeof(m_keyAsymmetric.module) );

    array = pThis[ Library_spot_native_Microsoft_SPOT_Cryptography_Key_RSA::FIELD__m_exponent ].DereferenceArray(); FAULT_ON_NULL(array);
    memcpy( &m_keyAsymmetric.exponent, array->GetFirstElement(), sizeof(m_keyAsymmetric.exponent) );

    m_keyAsymmetric.exponent_len = RSA_KEY_SIZE_BYTES / sizeof(DWORD);

    TINYCLR_NOCLEANUP();
}
开发者ID:Sorcha,项目名称:NETMF-LPC,代码行数:22,代码来源:spot_native_Microsoft_SPOT_Cryptography_Key.cpp

示例2:

HRESULT Library_corlib_native_System_Random::NextBytes___VOID__SZARRAY_U1( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();
    
    CLR_RT_Random* rand;
    CLR_RT_HeapBlock_Array* buffer;

    TINYCLR_CHECK_HRESULT(GetRandom( stack, rand ));

    buffer = stack.Arg1().DereferenceArray(); FAULT_ON_NULL(buffer);

    rand->NextBytes( buffer->GetFirstElement(), buffer->m_numOfElements );
        
    TINYCLR_NOCLEANUP();
}
开发者ID:Wampamba-Nooh,项目名称:MicroFrameworkSDK-Mono,代码行数:15,代码来源:corlib_native_System_Random.cpp

示例3: memcpy

HRESULT Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiSign::SignFinalInternal___SZARRAY_U1( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    CLR_RT_HeapBlock*       pThis    = stack.This();
    CLR_RT_HeapBlock_Array* pRes;
    CLR_RT_HeapBlock*       pSession = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_SessionContainer::FIELD__m_session].Dereference();
    CK_SESSION_HANDLE       hSession;
    CLR_UINT32              sigLen   = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiSign::FIELD__m_signatureLength].NumericByRef().u4;
    CLR_RT_HeapBlock        hbRef;

    FAULT_ON_NULL(pSession);

    hSession = (CK_SESSION_HANDLE)pSession[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Session::FIELD__m_handle].NumericByRef().s4;

    if(hSession == CK_SESSION_HANDLE_INVALID) TINYCLR_SET_AND_LEAVE(CLR_E_OBJECT_DISPOSED);

    TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(hbRef, sigLen, g_CLR_RT_WellKnownTypes.m_UInt8));

    pRes = hbRef.DereferenceArray();

    CRYPTOKI_CHECK_RESULT(stack, C_SignFinal(hSession, pRes->GetFirstElement(), (CK_ULONG_PTR)&sigLen));

    if(sigLen < pRes->m_numOfElements)
    {
        TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValue(), sigLen, g_CLR_RT_WellKnownTypes.m_UInt8));

        memcpy(stack.TopValue().DereferenceArray()->GetFirstElement(), pRes->GetFirstElement(), sigLen);
    }
    else
    {
        stack.SetResult_Object(pRes);
    }

    TINYCLR_NOCLEANUP();
}
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:36,代码来源:security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiSign.cpp

示例4:

HRESULT Library_spot_update_native_Microsoft_SPOT_MFUpdate_MFNativeUpdate::DeserializeParameter___STATIC__BOOLEAN__SZARRAY_U1__OBJECT( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    CLR_INT32 offset = 0;

    CLR_RT_HeapBlock_Array* array = stack.Arg0().DereferenceArray();
    CLR_RT_HeapBlock&         obj = stack.Arg1();

    if(!DeserializeObject( &obj, array->GetFirstElement(), offset, array->m_numOfElements )) TINYCLR_SET_AND_LEAVE(CLR_E_FAIL);

    stack.SetResult_Boolean(true);

    TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:15,代码来源:spot_update_native_Microsoft_SPOT_MFUpdate_MFNativeUpdate.cpp

示例5: Invoke___OBJECT__OBJECT__SZARRAY_OBJECT

HRESULT Library_corlib_native_System_Reflection_MethodBase::Invoke___OBJECT__OBJECT__SZARRAY_OBJECT( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock&           obj     = stack.Arg1();
    CLR_RT_MethodDef_Instance   md;
    const CLR_RECORD_METHODDEF* mdR;
    CLR_RT_HeapBlock_Array*     pArray  = stack.Arg2().DereferenceArray();
    CLR_RT_HeapBlock*           args    = NULL;
    int                         numArgs = 0;
    CLR_RT_HeapBlock*           hbMeth  = stack.Arg0().Dereference();

    TINYCLR_CHECK_HRESULT(GetMethodDescriptor( stack, *hbMeth, md ));

    mdR = md.m_target;

    if(stack.m_customState == 0)
    {
        stack.m_customState = 1;

        if(pArray)
        {
            args    = (CLR_RT_HeapBlock*)pArray->GetFirstElement();
            numArgs =                    pArray->m_numOfElements;
        }

        TINYCLR_CHECK_HRESULT(stack.MakeCall( md, &obj, args, numArgs ));
    }
    else
    {                
        if(mdR->retVal != DATATYPE_VOID)
        {                    
            if(mdR->retVal < DATATYPE_I4)
            {
                stack.TopValue().ChangeDataType( mdR->retVal );
            }

            TINYCLR_CHECK_HRESULT(stack.TopValue().PerformBoxingIfNeeded());
        }
        else
        {               
            stack.SetResult_Object( NULL );
        }
    }

    TINYCLR_NOCLEANUP();
}
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:48,代码来源:corlib_native_System_Reflection_MethodBase.cpp

示例6: NativeGetPinsMap___VOID__SZARRAY_MicrosoftSPOTHardwareCpuPinUsage

HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_HardwareProvider::NativeGetPinsMap___VOID__SZARRAY_MicrosoftSPOTHardwareCpuPinUsage( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    CLR_RT_HeapBlock_Array* map;
    CLR_INT32               mapLength;
    CLR_UINT8 *             ptr;
    map = stack.Arg1().DereferenceArray();  FAULT_ON_NULL(map);

    mapLength   = map->m_numOfElements;
    ptr         = map->GetFirstElement();

   ::CPU_GPIO_GetPinsMap( ptr, mapLength );

    TINYCLR_NOCLEANUP();
}
开发者ID:Wampamba-Nooh,项目名称:MicroFrameworkSDK-Mono,代码行数:16,代码来源:spot_hardware_native_Microsoft_SPOT_Hardware_HardwareProvider.cpp

示例7:

HRESULT Library_corlib_native_System_BitConverter::ToBoolean___STATIC__BOOLEAN__SZARRAY_U1__I4( CLR_RT_StackFrame& stack )
{
	NATIVE_PROFILE_CLR_CORE();
	TINYCLR_HEADER();

	CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray();
	FAULT_ON_NULL_ARG(pArray);

	int index;
	index = stack.Arg1().NumericByRefConst().s4;
	if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);

	BYTE* p;
	p  = pArray->GetFirstElement();
	stack.SetResult_Boolean(*reinterpret_cast<bool*>(p + index));

	TINYCLR_NOCLEANUP();
}
开发者ID:NicolasG3,项目名称:NETMF4.3_Community,代码行数:18,代码来源:corlib_native_System_BitConverter.cpp

示例8:

HRESULT Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiRNG::SeedRandom___VOID__SZARRAY_U1( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    CLR_RT_HeapBlock*       pThis    = stack.This();
    CLR_RT_HeapBlock_Array* pData    = stack.Arg1().DereferenceArray();
    CLR_RT_HeapBlock*       pSession;
    CK_SESSION_HANDLE       hSession;

    FAULT_ON_NULL_ARG(pData);

    pSession = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_SessionContainer::FIELD__m_session].Dereference(); FAULT_ON_NULL(pSession);
    hSession = pSession[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Session::FIELD__m_handle].NumericByRef().s4;

    CRYPTOKI_CHECK_RESULT(stack, C_SeedRandom(hSession, pData->GetFirstElement(), pData->m_numOfElements));

    TINYCLR_NOCLEANUP();
}
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:18,代码来源:security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiRNG.cpp

示例9:

HRESULT Library_corlib_native_System_BitConverter::ToUInt16___STATIC__U2__SZARRAY_U1__I4(CLR_RT_StackFrame& stack)
{
	NATIVE_PROFILE_CLR_CORE();
	TINYCLR_HEADER();

	BYTE *p = NULL;
	int index = 0;

	CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray();
	FAULT_ON_NULL_ARG(pArray);

	index = stack.Arg1().NumericByRefConst().s4;
	if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);
	if ((unsigned int)index + 2 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER);

	p = pArray->GetFirstElement();
	stack.SetResult(*reinterpret_cast<unsigned short*>(p + index), DATATYPE_U2);

	TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:20,代码来源:corlib_native_System_BitConverter.cpp

示例10: MarshalSockAddress

HRESULT Library_spot_net_native_Microsoft_SPOT_Net_SocketNative::MarshalSockAddress( struct SOCK_sockaddr* addrDst, CLR_UINT32& addrLen, const CLR_RT_HeapBlock& blkSockAddress )
{        
    NATIVE_PROFILE_CLR_NETWORK();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock_Array* ptrSockAddress;

    ptrSockAddress = blkSockAddress.DereferenceArray();                    
    FAULT_ON_NULL(ptrSockAddress);

    if(ptrSockAddress->m_numOfElements > addrLen) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER);

    memcpy( addrDst, ptrSockAddress->GetFirstElement(), ptrSockAddress->m_numOfElements );

    addrLen = ptrSockAddress->m_numOfElements;

    _ASSERTE(addrDst->sa_family == SOCK_AF_INET);

    TINYCLR_NOCLEANUP();
}
开发者ID:Wampamba-Nooh,项目名称:MicroFrameworkSDK-Mono,代码行数:20,代码来源:spot_net_native_Microsoft_SPOT_Net_SocketNative.cpp

示例11:

HRESULT Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Decryptor::DecryptInit___VOID__MicrosoftSPOTCryptokiSession__MicrosoftSPOTCryptokiMechanism__SystemSecurityCryptographyCryptoKey( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    CLR_RT_HeapBlock*       pSession   = stack.Arg1().Dereference(); 
    CLR_RT_HeapBlock*       pMech      = stack.Arg2().Dereference(); 
    CLR_RT_HeapBlock*       pKeyHandle = stack.Arg3().Dereference();
    CLR_RT_HeapBlock_Array* pArrParam;
    CK_MECHANISM            mech;
    CK_OBJECT_HANDLE        hKey;
    CK_SESSION_HANDLE       hSession;

    FAULT_ON_NULL_ARG(pSession);
    FAULT_ON_NULL_ARG(pMech);
    FAULT_ON_NULL_ARG(pKeyHandle);

    hSession = (CK_SESSION_HANDLE)pSession[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Session::FIELD__m_handle].NumericByRef().s4;

    if(hSession == CK_SESSION_HANDLE_INVALID) TINYCLR_SET_AND_LEAVE(CLR_E_OBJECT_DISPOSED);

    mech.mechanism = pMech[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Mechanism::FIELD__Type].NumericByRef().u4;

    pArrParam = pMech[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Mechanism::FIELD__Parameter].DereferenceArray();

    if(pArrParam != NULL && pArrParam->m_numOfElements > 0)
    {
        mech.pParameter     = pArrParam->GetFirstElement();
        mech.ulParameterLen = pArrParam->m_numOfElements;
    }
    else
    {
        mech.pParameter     = NULL;
        mech.ulParameterLen = 0;
    }

    hKey = (CK_OBJECT_HANDLE)pKeyHandle[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiObject::FIELD__m_handle].NumericByRef().s4;

    CRYPTOKI_CHECK_RESULT(stack, C_DecryptInit(hSession, &mech, hKey));

    TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:41,代码来源:security_pkcs11_native_Microsoft_SPOT_Cryptoki_Decryptor.cpp

示例12: memcpy

HRESULT Library_corlib_native_System_Text_UTF8Encoding::GetBytes___SZARRAY_U1__STRING( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    size_t                  cBytes;
    CLR_RT_HeapBlock_Array* arr;
    LPCSTR                  str;
    CLR_RT_HeapBlock&       ret = stack.PushValueAndClear();

    str    = stack.Arg1().RecoverString();
    FAULT_ON_NULL(str);
    cBytes = hal_strlen_s(str);

    TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( ret, (CLR_UINT32)cBytes, g_CLR_RT_WellKnownTypes.m_UInt8 ));

    arr = ret.DereferenceArray();

    memcpy( arr->GetFirstElement(), str, cBytes );

    TINYCLR_NOCLEANUP();
}
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:22,代码来源:corlib_native_System_Text_UTF8Encoding.cpp

示例13: sizeof

HRESULT Library_spot_native_Microsoft_SPOT_Messaging_EndPoint::ReplyRaw___VOID__MicrosoftSPOTMessagingMessage__SZARRAY_U1( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_MESSAGING();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock*                            pThis;
    CLR_RT_HeapBlock*                            pMsg;
    CLR_RT_HeapBlock_Array*                      pData;
    CLR_RT_HeapBlock_EndPoint*                   ep;
    CLR_Messaging_Commands::Messaging_Reply*     rpc = NULL;
    CLR_UINT32                                   len;

    pThis = stack.This()                   ; FAULT_ON_NULL(pThis);
    pMsg  = stack.Arg1().Dereference()     ; FAULT_ON_NULL(pMsg );
    pData = stack.Arg2().DereferenceArray(); FAULT_ON_NULL(pData);

    TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_EndPoint::ExtractInstance( pThis[ FIELD__m_handle ], ep ));

    len = sizeof(CLR_RT_HeapBlock_EndPoint::Address) + pData->m_numOfElements;
    rpc = (CLR_Messaging_Commands::Messaging_Reply*)CLR_RT_Memory::Allocate( len ); CHECK_ALLOCATION(rpc);

    rpc->m_addr.m_seq         = pMsg[ Library_spot_native_Microsoft_SPOT_Messaging_Message::FIELD__m_seq      ].NumericByRefConst  ().u4;
    rpc->m_addr.m_to          = ep->m_addr;
    rpc->m_addr.m_from.m_type = pMsg[ Library_spot_native_Microsoft_SPOT_Messaging_Message::FIELD__m_selector ].ReflectionDataConst().GetTypeHash();
    rpc->m_addr.m_from.m_id   = pMsg[ Library_spot_native_Microsoft_SPOT_Messaging_Message::FIELD__m_id       ].NumericByRefConst  ().u4;

    memcpy( rpc->m_data, pData->GetFirstElement(), pData->m_numOfElements );

    CLR_EE_MSG_EVENT_RPC(CLR_Messaging_Commands::c_Messaging_Reply,len,rpc,WP_Flags::c_NonCritical);

    TINYCLR_CLEANUP();

    if(rpc)
    {
        CLR_RT_Memory::Release( rpc );
    }

    TINYCLR_CLEANUP_END();
}
开发者ID:prabby,项目名称:miniclr,代码行数:39,代码来源:spot_native_Microsoft_SPOT_Messaging_EndPoint.cpp

示例14: ByteArrayToHex

HRESULT Library_corlib_native_System_BitConverter::ToString___STATIC__STRING__SZARRAY_U1(CLR_RT_StackFrame& stack)
{
	NATIVE_PROFILE_CLR_CORE();
	TINYCLR_HEADER();

	CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray();
	FAULT_ON_NULL_ARG(pArray);

	if (pArray->m_numOfElements == 0)
	{
		TINYCLR_CHECK_HRESULT(stack.SetResult_String(""));
	}
	else
	{
		BYTE* p = pArray->GetFirstElement();
		char* pOutput = ByteArrayToHex(p, 0, pArray->m_numOfElements);
		TINYCLR_CHECK_HRESULT(stack.SetResult_String(pOutput));
		delete[] pOutput;
	}

	TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:22,代码来源:corlib_native_System_BitConverter.cpp

示例15:

HRESULT Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Cryptoki::GetSlotsInternal___STATIC__SZARRAY_MicrosoftSPOTCryptokiSlot( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    CK_ULONG                i;
    CK_SLOT_ID              slots[NETMF_CRYPTOKI_MAX_SLOTS];
    CK_ULONG                count = NETMF_CRYPTOKI_MAX_SLOTS;
    CLR_RT_HeapBlock_Array* pSlots;
    CLR_RT_HeapBlock        ref;
    CLR_RT_HeapBlock*       pSlotRef;

    CRYPTOKI_CHECK_RESULT(stack, C_GetSlotList(CK_FALSE, slots, &count));

    TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(ref, (CLR_UINT32)count, g_CLR_RT_WellKnownTypes.m_CryptokiSlot));

    pSlots = ref.DereferenceArray();

    pSlotRef = (CLR_RT_HeapBlock*)pSlots->GetFirstElement();
            
    for(i=0; i<count; i++)
    {
        CLR_RT_HeapBlock* pSlot;
        
        TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex( pSlotRef[i], g_CLR_RT_WellKnownTypes.m_CryptokiSlot ));

        pSlot = pSlotRef[i].Dereference();
      
        pSlot[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Slot::FIELD__m_slotIndex    ].SetInteger        ((CLR_INT32)slots[i]);
        pSlot[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Slot::FIELD__m_disposed     ].SetBoolean        (false              );
        pSlot[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Slot::FIELD__m_evtDispatcher].SetObjectReference(NULL               );
        pSlot[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Slot::FIELD__m_slotEvent    ].SetObjectReference(NULL               );
        pSlot[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Slot::FIELD__m_slotInfo     ].SetObjectReference(NULL               );
    }

    stack.SetResult_Object(pSlots);

    TINYCLR_NOCLEANUP();
}
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:38,代码来源:security_pkcs11_native_Microsoft_SPOT_Cryptoki_Cryptoki.cpp


注:本文中的CLR_RT_HeapBlock_Array::GetFirstElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。