⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 si_sq.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 3 页
字号:
		return FALSE;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeID );
	if (invokeEl == NULL)
	{	/* no invoke that matched the invoke ID */
		return FALSE;
	}

	/* now see if we can retrieve the SI external params */
	
	if ( (invokeEl->BPcallList != NULL) && 
			(invokeEl->BPcallList->theSI != NULL) &&
			(SI_GetLibCalllParams( invokeEl->BPcallList->theSI, pLibIndex, pFuncIndex, pArgOpS ) ) )
	{
		/* everything went fine */
		return TRUE;
	}
	else
	{	/* something went wrong */
		return FALSE;
	}
}



BOOL SQ_GetAnArgumentAsString( pstructOpS argOpS, WCHAR **pArgAsStr )
{
	pstructVar			theArgument = NULL;
	
	if ((argOpS == NULL) || (*pArgAsStr != NULL))
	{
		return FALSE;
	}

	theArgument = OpS_Pop( argOpS );

	if ((theArgument != NULL) && 
			(VCR_OK == Var_Convert( theArgument, typeString )))
	{
		/* now snatch the string... */ 
		*pArgAsStr = theArgument->val.theString;

		/* ...and dealloc the variable */
		theArgument->val.theString = NULL;
		theArgument->theStringLen = 0;
		Var_Delete( &theArgument );

		/* done! */
		return TRUE;
	}
	else
	{
		Var_Delete( &theArgument );
		return FALSE;
	}
}



VOID SQ_ReturnValueToScript( pstructSQ thisx, UINT8 invokeID, WCHAR **theValueStr )
/* this function becomes the owner of theValueStr  */
{
	SQ_ReturnStringValueToScript( thisx, invokeID, theValueStr );
}


VOID SQ_ReturnVarValueToScript( pstructSQ thisx, UINT8 invokeID, pstructVar *ppResultVar )
/* this function becomes the owner of theValueStr  */
{
	pstructInvokeHead			invokeEl = NULL;

	
	if (thisx == NULL)
	{	/* ERROR: not all parameters are correct! */
		Var_Delete( ppResultVar );
		return;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeID );
	if (invokeEl == NULL)
	{	/* no invoke that matched the invoke ID */
		return;
	}

	/* now see if we have an SI that is waiting for an extrenal result */
	
	if ( (invokeEl->BPcallList != NULL) && 
			(invokeEl->BPcallList->theSI != NULL) &&
			(invokeEl->BPcallList->theSI->inWaitState) )
	{
		SI_ReceiveReturnVal( invokeEl->BPcallList->theSI, ppResultVar );

		invokeEl->isInWaitState = FALSE;
		/* ready to execute again */

		/* done! */
		Var_Delete( ppResultVar );	/* should now be NULL but this is just in case */
		return;
	}
	else
	{	/* something went wrong */
		Var_Delete( ppResultVar );
		return;
	}
}


VOID SQ_ReturnStringValueToScript( pstructSQ thisx, UINT8 invokeID, WCHAR **theValueStr )
/* this function becomes the owner of theValueStr  */
{
	pstructInvokeHead			invokeEl = NULL;
	pstructVar						resultVar;
	UINT32								strLen = 0;

	
	if (thisx == NULL)
	{	/* ERROR: not all parameters are correct! */
		DEALLOC( theValueStr );
		return;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeID );
	if (invokeEl == NULL)
	{	/* no invoke that matched the invoke ID */
		return;
	}

	/* now see if we have an SI that is waiting for an extrenal result */
	
	if ( (invokeEl->BPcallList != NULL) && 
			(invokeEl->BPcallList->theSI != NULL) &&
			(invokeEl->BPcallList->theSI->inWaitState) )
	{
		strLen = (*theValueStr == NULL) ? (0) : (STRINGLENGTH( *theValueStr ));
		resultVar = Var_New();
		Var_AssignStringDirect( resultVar, strLen, theValueStr );
		SI_ReceiveReturnVal( invokeEl->BPcallList->theSI, &resultVar );

		invokeEl->isInWaitState = FALSE;
		/* ready to execute again */

		/* done! */
		Var_Delete( &resultVar );	/* theValueStr should now be NULL but this is just in case */
		DEALLOC( theValueStr );		/* theValueStr should now be NULL but this is just in case */
		return;
	}
	else
	{	/* something went wrong */
		DEALLOC( theValueStr );
		return;
	}
}


VOID SQ_ReturnBoolValueToScript( pstructSQ thisx, UINT8 invokeID, BOOL theValue )
{
	pstructInvokeHead			invokeEl = NULL;
	pstructVar						resultVar;

	
	if (thisx == NULL)
	{	/* ERROR: not all parameters are correct! */
		return;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeID );
	if (invokeEl == NULL)
	{	/* no invoke that matched the invoke ID */
		return;
	}

	/* now see if we have an SI that is waiting for an extrenal result */
	
	if ( (invokeEl->BPcallList != NULL) && 
			(invokeEl->BPcallList->theSI != NULL) &&
			(invokeEl->BPcallList->theSI->inWaitState) )
	{
		resultVar = Var_New();
		Var_AssignBool( resultVar, theValue );
		SI_ReceiveReturnVal( invokeEl->BPcallList->theSI, &resultVar );

		invokeEl->isInWaitState = FALSE;
		/* ready to execute again */

		/* done! */
		Var_Delete( &resultVar );	/* theValueStr should now be NULL but this is just in case */
		return;
	}
}

VOID SQ_ReturnIntValueToScript( pstructSQ thisx, UINT8 invokeID, INT32 theValue )
{
	pstructInvokeHead			invokeEl = NULL;
	pstructVar						resultVar;

	
	if (thisx == NULL)
	{	/* ERROR: not all parameters are correct! */
		return;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeID );
	if (invokeEl == NULL)
	{	/* no invoke that matched the invoke ID */
		return;
	}

	/* now see if we have an SI that is waiting for an extrenal result */
	
	if ( (invokeEl->BPcallList != NULL) && 
			(invokeEl->BPcallList->theSI != NULL) &&
			(invokeEl->BPcallList->theSI->inWaitState) )
	{
		resultVar = Var_New();
		Var_AssignInt( resultVar, theValue );
		SI_ReceiveReturnVal( invokeEl->BPcallList->theSI, &resultVar );

		invokeEl->isInWaitState = FALSE;
		/* ready to execute again */

		/* done! */
		Var_Delete( &resultVar );	/* theValueStr should now be NULL but this is just in case */
		return;
	}
}


VOID SQ_LoadErrorReceived( pstructSQ thisx, UINT8 invokeID )
{
	pstructInvokeHead			invokeEl = NULL;

	
	if (thisx == NULL)
	{	/* can't do anything */
		return;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeID );
	if ((invokeEl != NULL) &&
			(invokeEl->isInWaitState) )
	{
		invokeEl->isInWaitState = FALSE;
		invokeEl->isDone = TRUE;
		invokeEl->errorCode = ERR_WAE_WMLS_LOAD;
		SQ_ClearBPCallList( invokeEl );
	}
}



VOID SQ_LoadDoneReceived( pstructSQ thisx, UINT8 invokeID, BYTE **pBP, UINT32 BPlen, INT16 IANAcharset )
{
	pstructInvokeHead			invokeEl = NULL;

	if (thisx == NULL)
	{	/* can't do anything */
		/* dealloc the BP */
		DEALLOC( pBP );
		return;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeID );
	if ((invokeEl != NULL) &&
			(invokeEl->isInWaitState) &&
			(invokeEl->BPcallList != NULL) &&
			(invokeEl->BPcallList->theSI == NULL) &&
			(invokeEl->BPcallList->BP == NULL) &&
			(invokeEl->BPcallList->isInitialBPInvoked == FALSE) )
	{

		invokeEl->BPcallList->BPlen = BPlen;
		invokeEl->BPcallList->BP = *pBP;
  	invokeEl->BPcallList->IANAcharset = IANAcharset;
		*pBP = NULL;
		invokeEl->isInWaitState = FALSE;
		/* ready to execute again */
	}	
	else
	{
		/* dealloc the BP */
		DEALLOC( pBP );
	}
}


VOID SQ_LoadStringDone( pstructSQ thisx, UINT8 invokeID, INT16 charSet, BYTE **pValueStr, UINT32 strLen )
/* this function becomes the owner of theValueStr  */
{
	pstructInvokeHead			invokeEl = NULL;

	if (thisx == NULL)
	{	/* ERROR: not all parameters are correct! */
		DEALLOC( pValueStr );
		return;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeID );
	if (invokeEl == NULL)
	{	/* no invoke that matched the invoke ID */
		DEALLOC( pValueStr );
		return;
	}

	/* now see if we have an SI that is waiting for an extrenal result */
	
	if ( (invokeEl->BPcallList != NULL) && 
			(invokeEl->BPcallList->theSI != NULL) &&
			(invokeEl->BPcallList->theSI->inWaitState) )
	{
		SI_LoadStringDone( invokeEl->BPcallList->theSI, charSet, pValueStr, strLen );

		invokeEl->isInWaitState = FALSE;

		DEALLOC( pValueStr );		/* theValueStr should now be NULL but this is just in case */
		return;
	}
	else
	{	/* something went wrong */
		DEALLOC( pValueStr );
		return;
	}
}



VOID SQ_LibraryErrorReceived( pstructSQ thisx, UINT8 invokeID )
{
	pstructInvokeHead			invokeEl = NULL;

	
	if (thisx == NULL)
	{	/* can't do anything */
		return;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeID );
	if ((invokeEl != NULL) &&
			(invokeEl->isInWaitState) )
	{
		invokeEl->isInWaitState = FALSE;
		invokeEl->isDone = TRUE;
		invokeEl->errorCode = ERR_WAE_WMLS_LIB;
		SQ_ClearBPCallList( invokeEl );
	}
}


BOOL SQ_GetViewId( pstructSQ thisx, UINT8 invokeID, UINT8 *pResult )
{
	pstructInvokeHead			invokeEl = NULL;

	
	if (thisx == NULL)
	{	/* can't do anything */
		return FALSE;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeID );
	if ((invokeEl != NULL) &&
			(invokeEl->theUAStruct != NULL) )
	{
		*pResult = invokeEl->theUAStruct->iViewID;
		return TRUE;
	}
	else
	{
		return FALSE;
	}
}




VOID SQ_DeleteArgOpS( pstructOpS *pArgOpS )
{
	OpS_Delete( pArgOpS );
}


#ifdef CAN_SIGN_TEXT
VOID SQ_TextSigned( pstructSQ thisx, UINT8 invokeId, UINT8 algorithm, UINT16 sigLen, CHAR *signature, CHAR *hashedKey, UINT16 hashedKeyLen, CHAR *certificate, UINT16 certificateLen, UINT8 certificateType, UINT16 err)
{
	pstructInvokeHead			invokeEl = NULL;

	if (thisx == NULL)
	{	/* ERROR: not all parameters are correct! */
		DEALLOC( &signature );
		DEALLOC( &hashedKey );
		DEALLOC( &certificate );
		return;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeId );
	if (invokeEl == NULL)
	{	/* no invoke that matched the invoke ID */
		DEALLOC( &signature );
		DEALLOC( &hashedKey );
		DEALLOC( &certificate );
		return;
	}

	/* now see if we have an SI that is waiting for an external result */
	
	if ( (invokeEl->BPcallList != NULL) && 
			(invokeEl->BPcallList->theSI != NULL) &&
			(invokeEl->BPcallList->theSI->inWaitState) )
	{
		Lib_textSigned( invokeEl->BPcallList->theSI, algorithm, sigLen, signature, hashedKey, hashedKeyLen, 
										certificate, certificateLen, certificateType, err );

		invokeEl->isInWaitState = FALSE;
		return;
	}
	else
	{	/* something went wrong */
		DEALLOC( &signature );
		DEALLOC( &hashedKey );
		DEALLOC( &certificate );
		return;
	}
}
/* CAN_SIGN_TEXT */
#endif

#ifdef USE_PROPRIETARY_WMLS_LIBS

VOID SQ_ProprietaryLibraryFunctionResponse( pstructSQ thisx, UINT8 invokeID, WMLSvar** pResultVar )
{
	pstructInvokeHead			invokeEl = NULL;

	if (thisx == NULL)
	{	/* ERROR: not all parameters are correct! */
		WMLSvar_Delete( pResultVar, FALSE );
		return;
	}

	/* find the invoke which has the supplied invoke ID */
	invokeEl = SQ_FindInvokeHead( thisx, invokeID );
	if (invokeEl == NULL)
	{	/* no invoke that matched the invoke ID */
		WMLSvar_Delete( pResultVar, FALSE );
		return;
	}

	/* now see if we have an SI that is waiting for an external result */
	
	if ( (invokeEl->BPcallList != NULL) && 
			(invokeEl->BPcallList->theSI != NULL) &&
			(invokeEl->BPcallList->theSI->inWaitState) )
	{
		enumErrorCode anErrCode;
		
		anErrCode = Lib_ProprietaryLibraryFunctionResponse( invokeEl->BPcallList->theSI, pResultVar );

		if (anErrCode != ERR_WAE_WMLS_NONE)
		{
			invokeEl->isDone = TRUE;
			invokeEl->errorCode = anErrCode;
		}

		invokeEl->isInWaitState = FALSE;
		return;
	}
	else
	{	/* something went wrong */
		WMLSvar_Delete( pResultVar, FALSE );
		return;
	}
}

/* USE_PROPRIETARY_WMLS_LIBS */
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -