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


C++ CLR_RT_HeapBlock_Array类代码示例

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


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

示例1: NATIVE_PROFILE_CLR_CORE

static HRESULT Interop_Marshal_NUMERIC_ARRAY
( const CLR_RT_StackFrame &stackFrame, UINT32 paramIndex, T *&pByteParam, UINT32 &arraySize, UINT32 elementSize )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock_Array *pHeapBlockArray = NULL;

    if ( stackFrame.ArgN( paramIndex ).DataType() != DATATYPE_OBJECT )
    {
        TINYCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
    }

    pHeapBlockArray = stackFrame.ArgN( paramIndex ).DereferenceArray();
    FAULT_ON_NULL(pHeapBlockArray);

    if ( pHeapBlockArray->m_sizeOfElement != elementSize )
    {
        TINYCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
    }

    arraySize  = pHeapBlockArray->m_numOfElements;
    pByteParam = (T *)pHeapBlockArray->GetFirstElement();

    TINYCLR_NOCLEANUP();
}
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:26,代码来源:CLR_RT_Interop.cpp

示例2: TINYCLR_HEADER

HRESULT Library_spot_hardware_usb_native_Microsoft_SPOT_Hardware_UsbClient_UsbStream::nativeWrite___I4__SZARRAY_U1__I4__I4( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    CLR_INT32               retVal = 0;
    CLR_INT32               controllerIndex, streamIndex, stream;
    CLR_UINT32              offset, count;
    CLR_RT_HeapBlock*       pThis;
    CLR_RT_HeapBlock_Array* array;

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

    controllerIndex = pThis[ Library_spot_hardware_usb_native_Microsoft_SPOT_Hardware_UsbClient_UsbStream::FIELD__m_controllerIndex ].NumericByRef().s4;
    streamIndex     = pThis[ Library_spot_hardware_usb_native_Microsoft_SPOT_Hardware_UsbClient_UsbStream::FIELD__m_streamIndex     ].NumericByRef().s4;
    array           = stack.Arg1().DereferenceArray(); FAULT_ON_NULL( array );
    offset          = stack.Arg2().NumericByRef().u4;
    count           = stack.Arg3().NumericByRef().u4;

    stream = (controllerIndex << USB_CONTROLLER_SHIFT) + streamIndex;
    if( array->m_numOfElements < (offset + count) )
    {
        TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER);
    }
    else
    {
        retVal = USB_Write( stream, (char*)array->GetFirstElement()+offset, count );
    }
    stack.SetResult_I4( retVal );

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

示例3: TINYCLR_HEADER

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

    CLR_RT_HeapBlock*       pThis      = stack.This();
    CLR_RT_HeapBlock_Array* pData      = stack.Arg1().DereferenceArray();
    CLR_INT32               offset     = stack.Arg2().NumericByRef().s4;
    CLR_INT32               len        = stack.Arg3().NumericByRef().s4;
    CLR_RT_HeapBlock*       pSession   = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_SessionContainer::FIELD__m_session].Dereference();
    CLR_INT32               sigLen     = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiSign::FIELD__m_signatureLength].NumericByRef().s4;
    CK_SESSION_HANDLE       hSession;

    FAULT_ON_NULL_ARG(pData);
    FAULT_ON_NULL(pSession);

    if((offset + len) > (CLR_INT32)pData->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);

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

    // TODO: add code for processing chunks at a time if size is too big
    //maxProcessingBytes = pSession[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Session::FIELD__m_maxProcessingBytes].NumericByRef().s4;

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

    CRYPTOKI_CHECK_RESULT(stack, C_SignUpdate(hSession, pData->GetElement(offset), len));

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

示例4: NATIVE_PROFILE_CLR_CORE

HRESULT Library_corlib_native_System_Reflection_ConstructorInfo::Invoke___OBJECT__SZARRAY_OBJECT( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock*           thisRef = stack.ThisRef().Dereference();
    CLR_RT_MethodDef_Instance   md;
    CLR_RT_HeapBlock_Array*     pArray  = stack.Arg1().DereferenceArray();
    CLR_RT_HeapBlock*           args    = NULL;
    int                         numArgs = 0;

    if(md.InitializeFromIndex( thisRef->ReflectionDataConst().m_data.m_method ) == false) TINYCLR_SET_AND_LEAVE(CLR_E_NULL_REFERENCE);

    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, NULL, args, numArgs ));
    }   

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

示例5: TINYCLR_HEADER

HRESULT Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiVerify::VerifyInternal___BOOLEAN__SZARRAY_U1__I4__I4__SZARRAY_U1__I4__I4( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    CLR_RT_HeapBlock*       pThis    = stack.This();
    CLR_RT_HeapBlock_Array* pData    = stack.Arg1().DereferenceArray(); 
    CLR_INT32               offset   = stack.Arg2().NumericByRef().s4;
    CLR_INT32               len      = stack.Arg3().NumericByRef().s4;
    CLR_RT_HeapBlock_Array* pSig     = stack.Arg4().DereferenceArray(); 
    CLR_INT32               sigOff   = stack.Arg5().NumericByRef().s4;
    CLR_INT32               sigLen   = stack.Arg6().NumericByRef().s4;
    CLR_RT_HeapBlock*       pSession = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_SessionContainer::FIELD__m_session].Dereference();
    CK_SESSION_HANDLE       hSession;
    bool                    retVal   = false;
    CK_RV                   result;

    FAULT_ON_NULL_ARG(pData);
    FAULT_ON_NULL_ARG(pSig);

    if((offset + len   ) > (CLR_INT32)pData->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);
    if((sigOff + sigLen) > (CLR_INT32)pSig->m_numOfElements ) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);

    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);

    result = C_Verify(hSession, pData->GetElement(offset), len, pSig->GetElement(sigOff), sigLen);

    retVal = CKR_OK == result;

    stack.SetResult_Boolean(retVal);

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

示例6: NATIVE_PROFILE_CLR_CORE

HRESULT Library_corlib_native_System_BitConverter::ToString___STATIC__STRING__SZARRAY_U1__I4__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;
	int length;
	length = stack.Arg2().NumericByRefConst().s4;
	if (pArray->m_numOfElements == 0 && index == 0 && length == 0)
	{
		TINYCLR_CHECK_HRESULT(stack.SetResult_String(""));
	}
	else
	{
		if (index < 0 || length < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);
		if ((unsigned int)index + length > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER);

		BYTE* p;
		p  = pArray->GetFirstElement();
		char* pOutput = ByteArrayToHex(p, index, length);
		TINYCLR_CHECK_HRESULT(stack.SetResult_String(pOutput));
		delete[] pOutput;
	}

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

示例7: NATIVE_PROFILE_CLR_CORE

HRESULT CLR_RT_HeapBlock_MemoryStream::ToArray( CLR_RT_HeapBlock& ref )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_UINT32              tot;
    CLR_RT_HeapBlock_Array* array;
    CLR_UINT8*              buf;

    tot = 0;
    TINYCLR_FOREACH_NODE(Buffer,node,m_buffers)
    {
        tot += node->m_length;
    }
    TINYCLR_FOREACH_NODE_END();

    TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( ref, tot, g_CLR_RT_WellKnownTypes.m_UInt8 ));

    array = ref.DereferenceArray();
    buf   = array->GetFirstElement();

    TINYCLR_FOREACH_NODE(Buffer,node,m_buffers)
    {
        memcpy( buf, node->m_payload, node->m_length ); buf += node->m_length;
    }
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:25,代码来源:Streams.cpp

示例8: TINYCLR_HEADER

HRESULT Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_FindObjectEnum::FindObjectsInit___VOID__SZARRAY_MicrosoftSPOTCryptokiCryptokiAttribute( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();
    CLR_RT_HeapBlock*       pThis      = stack.This();
    CLR_RT_HeapBlock_Array* pAttribs   = stack.Arg1().DereferenceArray();
    CLR_RT_HeapBlock*       pAttrib;
    CLR_RT_HeapBlock*       pSession   = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_FindObjectEnum::FIELD__m_session].Dereference();
    CK_SESSION_HANDLE       hSession;
    CK_ATTRIBUTE            attribs[20];
    CLR_UINT32              i;

    FAULT_ON_NULL_ARG(pAttribs);
    FAULT_ON_NULL(pSession);

    if(pAttribs->m_numOfElements > ARRAYSIZE(attribs)) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);

    hSession = pSession[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Session::FIELD__m_handle].NumericByRef().u4;
    pAttrib  = (CLR_RT_HeapBlock*)pAttribs->GetFirstElement();

    for(i=0; i<pAttribs->m_numOfElements; i++)
    {
        CLR_RT_HeapBlock*       pElement    = pAttrib->Dereference();  FAULT_ON_NULL(pElement);
        CLR_RT_HeapBlock_Array* pValueArray = pElement[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiAttribute::FIELD__Value].DereferenceArray();  FAULT_ON_NULL(pValueArray);

        attribs[i].type       = pElement[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiAttribute::FIELD__Type].NumericByRef().u4;
        attribs[i].pValue     = pValueArray->GetFirstElement();
        attribs[i].ulValueLen = pValueArray->m_numOfElements;

        pAttrib++;
    }

    CRYPTOKI_CHECK_RESULT(stack, C_FindObjectsInit(hSession, attribs, pAttribs->m_numOfElements));

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

示例9: NATIVE_PROFILE_CLR_NETWORK

HRESULT Library_spot_net_native_Microsoft_SPOT_Net_SocketNative::MarshalSockAddress( CLR_RT_HeapBlock& blkDst, const struct SOCK_sockaddr* addrSrc, CLR_UINT32 addrLenSrc )
{
    NATIVE_PROFILE_CLR_NETWORK();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock_Array* arr = NULL;

    CLR_RT_HeapBlock blkArr; blkArr.SetObjectReference( NULL );
    CLR_RT_ProtectFromGC gc( blkArr );
    SOCK_sockaddr_in* dst;
    SOCK_sockaddr_in* src = (SOCK_sockaddr_in*)addrSrc;
        
    TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( blkArr, addrLenSrc, g_CLR_RT_WellKnownTypes.m_UInt8 ));
    
    arr = blkArr.DereferenceArray();

    _ASSERTE(arr);

    dst = (SOCK_sockaddr_in*)arr->GetFirstElement();

    dst->sin_family           = SwapEndianIfBEc16(src->sin_family);
    dst->sin_port             = src->sin_port;
    dst->sin_addr.S_un.S_addr = src->sin_addr.S_un.S_addr;

    memcpy(dst->sin_zero, src->sin_zero, sizeof(dst->sin_zero));

    _ASSERTE(blkDst.DataType() == DATATYPE_BYREF || blkDst.DataType() == DATATYPE_ARRAY_BYREF);

    TINYCLR_CHECK_HRESULT(blkArr.StoreToReference( blkDst, 0 ));

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

示例10: NATIVE_PROFILE_CLR_HARDWARE

HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_SPI::InternalWriteRead___VOID__SZARRAY_U2__I4__I4__SZARRAY_U2__I4__I4__I4( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_HARDWARE();
    TINYCLR_HEADER();
    {
        CLR_RT_HeapBlock*       pThis           = stack.This();                    FAULT_ON_NULL(pThis);
        CLR_RT_HeapBlock_Array* writeBuffer     = stack.Arg1().DereferenceArray(); FAULT_ON_NULL(writeBuffer);
        CLR_INT32               writeOffset     = stack.Arg2().NumericByRef().s4;
        CLR_INT32               writeCount      = stack.Arg3().NumericByRef().s4;
        CLR_RT_HeapBlock_Array* readBuffer      = stack.Arg4().DereferenceArray(); 
        CLR_INT32               readOffset      = stack.Arg5().NumericByRef().s4;
        CLR_INT32               readCount       = stack.Arg6().NumericByRef().s4;
        CLR_UINT32              startReadOffset = stack.Arg7().NumericByRef().s4;
        
        SPI_CONFIGURATION       config;
        TINYCLR_CHECK_HRESULT(Library_spot_hardware_native_Microsoft_SPOT_Hardware_SPI__Configuration::GetInitialConfig( pThis[ FIELD__m_config ], config ));

        config.MD_16bits = TRUE;

        CPU_SPI_Initialize();
        
        if(!::CPU_SPI_nWrite16_nRead16(
                                    config,
                                    (CLR_UINT16*)writeBuffer->GetElement(writeOffset), 
                                    writeCount,
                                    readBuffer == NULL ? NULL : (CLR_UINT16*)readBuffer ->GetElement(readOffset), 
                                    readBuffer == NULL ? 0    : readCount,
                                    startReadOffset
                                  ))
        {
            TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_OPERATION);
        }
    }
    TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:35,代码来源:spot_hardware_native_Microsoft_SPOT_Hardware_SPI.cpp

示例11: TINYCLR_HEADER

// TODO: Make common functions for transformBlock for encrypt/decrypt when async logic is in place
HRESULT Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Decryptor::TransformBlockInternal___I4__SZARRAY_U1__I4__I4__SZARRAY_U1__I4( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    CLR_RT_HeapBlock*       pThis      = stack.This();
    CLR_RT_HeapBlock_Array* pData      = stack.Arg1().DereferenceArray(); 
    CLR_INT32               dataOffset = stack.Arg2().NumericByRef().s4;
    CLR_INT32               dataLen    = stack.Arg3().NumericByRef().s4;
    CLR_RT_HeapBlock_Array* pOutput    = stack.Arg4().DereferenceArray(); 
    CLR_INT32               outOffset  = stack.Arg5().NumericByRef().s4;
    CLR_RT_HeapBlock*       pSession   = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_SessionContainer::FIELD__m_session].Dereference();
    CK_SESSION_HANDLE       hSession;
    CLR_UINT32              decrSize;   

    FAULT_ON_NULL_ARG(pData);
    FAULT_ON_NULL_ARG(pOutput);
    FAULT_ON_NULL_ARG(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);

    if((dataOffset + dataLen) > (CLR_INT32)pData->m_numOfElements  ) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);
    if((outOffset           ) > (CLR_INT32)pOutput->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);

    decrSize = pOutput->m_numOfElements - outOffset;

    CRYPTOKI_CHECK_RESULT(stack, C_DecryptUpdate(hSession, pData->GetElement(dataOffset), dataLen, pOutput->GetElement(outOffset), (CK_ULONG_PTR)&decrSize));

    stack.SetResult_I4(decrSize);

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

示例12: NATIVE_PROFILE_CLR_CORE

HRESULT CLR_RT_HeapBlock_Queue::Clear()
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock_Array* array = GetArray();
    CLR_INT32               size  = GetSize();
    CLR_INT32               head  =    Head();
    CLR_INT32               tail  = GetTail();

    if(size > 0)
    {
        if(head < tail)
        {
            TINYCLR_CHECK_HRESULT(array->ClearElements( head, size ));
        }
        else
        {
            TINYCLR_CHECK_HRESULT(array->ClearElements( head, array->m_numOfElements - head ));
            TINYCLR_CHECK_HRESULT(array->ClearElements( 0   , tail                          ));
        }
        
        SetSize( 0 );
    }

    SetHead( 0 );
    SetTail( 0 );

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

示例13: NATIVE_PROFILE_CLR_CORE

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

    size_t                  cMaxBytes;
    LPCSTR                  str         = stack.Arg1().RecoverString();
    CLR_INT32               strIdx      = stack.Arg2().NumericByRef().s4;
    CLR_INT32               strCnt      = stack.Arg3().NumericByRef().s4;
    CLR_RT_HeapBlock_Array* pArrayBytes = stack.Arg4().DereferenceArray();
    CLR_INT32               byteIdx     = stack.Arg5().NumericByRef().s4;

    FAULT_ON_NULL(str);
    FAULT_ON_NULL(pArrayBytes);

    cMaxBytes = hal_strlen_s(str);

    if((strIdx  + strCnt) > (CLR_INT32)cMaxBytes                   ) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);
    if((byteIdx + strCnt) > (CLR_INT32)pArrayBytes->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);

    memcpy(pArrayBytes->GetElement(byteIdx), &str[strIdx], strCnt);

    stack.SetResult_I4(strCnt);

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

示例14: TINYCLR_HEADER

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

    CLR_INT32  handle       = stack.Arg0().NumericByRef().s4;
    CLR_INT32  pktIndex     = stack.Arg1().NumericByRef().s4;
    CLR_RT_HeapBlock_Array* pPacket     = stack.Arg2().DereferenceArray();
    CLR_RT_HeapBlock_Array* pValidation = stack.Arg3().DereferenceArray();
    CLR_UINT8* pValidData;
    CLR_INT32 validLen;

    FAULT_ON_NULL(pPacket);

    if(pValidation == NULL)
    {
        pValidData = NULL;
        validLen = 0;
    }
    else
    {
        pValidData = pValidation->GetFirstElement();
        validLen = pValidation->m_numOfElements;
    }

    stack.SetResult_Boolean(TRUE == MFUpdate_AddPacket(handle, pktIndex, pPacket->GetFirstElement(), pPacket->m_numOfElements, pValidData, validLen));

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

示例15: NATIVE_PROFILE_CLR_NETWORK

HRESULT Library_spot_net_native_Microsoft_SPOT_Net_NetworkInformation_NetworkInterface::UpdateConfiguration___VOID__I4( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_NETWORK();
    TINYCLR_HEADER();

    SOCK_NetworkConfiguration config; 
    CLR_RT_HeapBlock* pConfig           = stack.Arg0().Dereference();  _ASSERTE(pConfig != NULL);
    CLR_UINT32 interfaceIndex           = pConfig[ FIELD___interfaceIndex ].NumericByRefConst().u4;
    CLR_UINT32 updateFlags              = stack.Arg1().NumericByRef().u4;
    CLR_RT_HeapBlock_Array* pMACAddress = pConfig[ FIELD___macAddress ].DereferenceArray();

    TINYCLR_CLEAR(config);

    config.flags                = pConfig[ FIELD___flags                ].NumericByRef().u4;
    config.ipaddr               = pConfig[ FIELD___ipAddress            ].NumericByRef().u4;
    config.gateway              = pConfig[ FIELD___gatewayAddress       ].NumericByRef().u4;
    config.subnetmask           = pConfig[ FIELD___subnetMask           ].NumericByRef().u4;
    config.dnsServer1           = pConfig[ FIELD___dnsAddress1          ].NumericByRef().u4;
    config.dnsServer2           = pConfig[ FIELD___dnsAddress2          ].NumericByRef().u4;
    config.networkInterfaceType = pConfig[ FIELD___networkInterfaceType ].NumericByRef().u4;
    
    if(pMACAddress != NULL)
    {
        config.macAddressLen = pMACAddress->m_numOfElements;
        
        if(config.macAddressLen > sizeof(config.macAddressBuffer)) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER);
        
        memcpy( &config.macAddressBuffer, pMACAddress->GetFirstElement(), config.macAddressLen ); 
    }

    TINYCLR_CHECK_HRESULT(SOCK_CONFIGURATION_UpdateAdapterConfiguration( interfaceIndex, updateFlags, &config ));

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


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