Пример #1
0
COR_ILMETHOD_DECODER::COR_ILMETHOD_DECODER(COR_ILMETHOD* header, void *pInternalImport, DecoderStatus* wbStatus)
{

    STATIC_CONTRACT_NOTHROW;
    STATIC_CONTRACT_FORBID_FAULT;

    // Can't put contract because of SEH
    // CONTRACTL
    // {
    //    NOTHROW;
    //    GC_NOTRIGGER;
    //    FORBID_FAULT;
    // }
    // CONTRACTL_END

    bool errorInInit = false;

    PAL_TRY
    {
        // Decode the COR header into a more convenient form
        DecoderInit(this, (COR_ILMETHOD *) header);
    }
    PAL_EXCEPT_FILTER(FilterAllExceptions, NULL)
    {
        errorInInit = true;
        Code = 0;
        SetLocalVarSigTok(0);
        if (wbStatus != NULL)
        {
            *wbStatus = FORMAT_ERROR;
        }
    }
Пример #2
0
/*lint -save  -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
	/* Write your local variable definition here */

	/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
 	PE_low_level_init();
	/*** End of Processor Expert internal initialization.                    ***/

	/* Write your code here */
	/* For example: for(;;) { } */

	Boot_Check();
	AD1_Calibrate(TRUE);
	OLED_Init();
	unsigned char buffer[64*4];
	ClearScr(buffer,0);
	OLED_Display(buffer);
	DecoderInit();
	int T = 0;
	for(;;) {
		T++;
		ClearScr(buffer,0);
		for (int x = 0;x<64;x++)
		{
			buffer[Reader.Sync * 64 + x] = 255;
		}

		if (Reader.Sync == AUDIOREADER_SYNCED)
		{
			for (int i =0;i<theprogress/8;i++)
			{
				buffer[i] = 0xff;
			}

		}
		//else
		{
			for(int i =0 ;i<64;i++)
			{
				int y =  16 + (((History[i]-32768) * 15)/400);
				if (y>= 0 && y< 32) SetPixel(buffer, i, y);
			}
		}
		OLED_Display(buffer);

	}
	/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
  /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
  #ifdef PEX_RTOS_START
    PEX_RTOS_START();                  /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
  #endif
  /*** End of RTOS startup code.  ***/
  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
  for(;;){}
  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
Пример #3
0
//---------------------------------------------------------------------------------------
// 
COR_ILMETHOD_DECODER::COR_ILMETHOD_DECODER(
    COR_ILMETHOD *  header, 
    void *          pInternalImport, 
    DecoderStatus * wbStatus)
{
    STATIC_CONTRACT_NOTHROW;
    STATIC_CONTRACT_FORBID_FAULT;
    
    // Can't put contract because of SEH
    // CONTRACTL
    // {
    //    NOTHROW;
    //    GC_NOTRIGGER;
    //    FORBID_FAULT;
    // }
    // CONTRACTL_END
    
    bool fErrorInInit = false;
    struct Param
    {
        COR_ILMETHOD_DECODER * pThis;
        COR_ILMETHOD * header;
    } param;
    param.pThis = this;
    param.header = header;
    
    PAL_TRY(Param *, pParam, &param)
    {
        // Decode the COR header into a more convenient form
        DecoderInit(pParam->pThis, pParam->header);
    }
    PAL_EXCEPT_FILTER(FilterAllExceptions)
    {
        fErrorInInit = true;
        Code = 0;
        SetLocalVarSigTok(0);
        if (wbStatus != NULL)
        {
            *wbStatus = FORMAT_ERROR;
        }
    }
    PAL_ENDTRY
    
    if (fErrorInInit)
    {
        return;
    }
    
    // If there is a local variable sig, fetch it into 'LocalVarSig'
    if ((GetLocalVarSigTok() != 0) && (pInternalImport != NULL))
    {
        IMDInternalImport * pMDI = reinterpret_cast<IMDInternalImport *>(pInternalImport);
        
        if (wbStatus != NULL)
        {
            if ((!pMDI->IsValidToken(GetLocalVarSigTok())) || 
                (TypeFromToken(GetLocalVarSigTok()) != mdtSignature) || 
                (RidFromToken(GetLocalVarSigTok()) == 0))
            {
                *wbStatus = FORMAT_ERROR;         // failure bad local variable signature token
                return;
            }
        }
        
        if (FAILED(pMDI->GetSigFromToken(GetLocalVarSigTok(), &cbLocalVarSig, &LocalVarSig)))
        {
            // Failure bad local variable signature token
            if (wbStatus != NULL)
            {
                *wbStatus = FORMAT_ERROR;
            }
            LocalVarSig = NULL;
            cbLocalVarSig = 0;
            return;
        }
        
        if (wbStatus != NULL)
        {
            if (FAILED(validateTokenSig(GetLocalVarSigTok(), LocalVarSig, cbLocalVarSig, 0, pMDI)) || 
                (*LocalVarSig != IMAGE_CEE_CS_CALLCONV_LOCAL_SIG))
            {
                *wbStatus = VERIFICATION_ERROR;   // failure validating local variable signature
                return;
            }
        }
    }
    
    if (wbStatus != NULL)
    {
        *wbStatus = SUCCESS;
    }
} // COR_ILMETHOD_DECODER::COR_ILMETHOD_DECODER