本文整理汇总了C++中CompleteRequest函数的典型用法代码示例。如果您正苦于以下问题:C++ CompleteRequest函数的具体用法?C++ CompleteRequest怎么用?C++ CompleteRequest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CompleteRequest函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDeviceInfo
/*****************************************************************************
** Procedure: CJTLine::OnSetAgentActivity
**
** Arguments: 'pReq' - Request object representing this SetAgentActivity event
** 'lpBuff' - Our CEventBlock* pointer
**
** Returns: void
**
** Description: This function manages the lineSetAgentActivity processing
** for this service provider.
**
*****************************************************************************/
bool CJTLine::OnSetAgentActivity(RTSetAgentActivity* pRequest, LPCVOID /*lpBuff*/)
{
// Validate the activity itself and either reject it or allow it
// to be set into the agent properties. The provider manages the agent
// activities itself since the ACD doesn't support the concept.
TString strActivity = GetDeviceInfo()->GetAgentActivityById(pRequest->GetActivity());
if (strActivity.empty())
CompleteRequest(pRequest, LINEERR_INVALAGENTACTIVITY);
else
CompleteRequest(pRequest, 0);
// Let the request fall through to the unsolicited handler.
return false;
}// CJTLine::OnSetAgentActivity
示例2: DispatchReadWriteFlush
NTSTATUS DispatchReadWriteFlush(PDEVICE_OBJECT fdo, PIRP Irp)
{
KIRQL OldIrql;
ULONG count;
PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation( Irp );
if(stack->MajorFunction == IRP_MJ_WRITE)
{
if(stack->Parameters.Write.Length == 0)
{
return CompleteRequest( Irp, STATUS_SUCCESS, 0 );
}
// write
IoMarkIrpPending(Irp);
StartPacket( &pdx->dqWrite, fdo, Irp, OnCancelWrite );
}
else if(stack->MajorFunction == IRP_MJ_READ)
{
if(stack->Parameters.Read.Length == 0)
{
return CompleteRequest( Irp, STATUS_SUCCESS, 0 );
}
// read
IoAcquireRemoveLock( &pdx->RemoveLock, Irp );
IoMarkIrpPending ( Irp );
IoSetCancelRoutine ( Irp, OnCancelQueuedRead );
KeAcquireSpinLock( &pdx->ReadIrpLock, &OldIrql );
InsertTailList ( &pdx->ReadIrpList, &Irp->Tail.Overlay.ListEntry );
KeReleaseSpinLock( &pdx->ReadIrpLock, OldIrql );
CompleteQueuedReads(pdx);
}
else
{
// flush
IoMarkIrpPending( Irp );
StartPacket ( &pdx->dqWrite, fdo, Irp, OnCancelWrite );
}
return STATUS_PENDING;
}
示例3: CompleteRequest
/*****************************************************************************
** Procedure: CJTPhone::OnSetHookswitch
**
** Arguments: 'pReq' - Request object representing this phone request
** 'lpBuff' - Our CEventBlock* pointer
**
** Returns: void
**
** Description: This function manages the TSPI_phoneSetHookSwitch processing
** for this service provider.
**
*****************************************************************************/
bool CJTPhone::OnSetHookswitch(RTSetHookswitch* pRequest, LPCVOID lpBuff)
{
// Cast our pointer back to an event block
const CEventBlock* pBlock = static_cast<const CEventBlock*>(lpBuff);
// If we are in the initial state (i.e. this request has not been processed
// before by any other thread). Then move the packet to the waiting state so
// other threads will not interfere with other events or timers. This is
// guarenteed to be thread-safe and atomic.
if (pRequest->EnterState(STATE_INITIAL, STATE_WAITING))
{
// Validate the state passed
if (pRequest->GetHookswitchState() == PHONEHOOKSWITCHMODE_ONHOOK ||
pRequest->GetHookswitchState() == PHONEHOOKSWITCHMODE_MIC)
CompleteRequest(pRequest, PHONEERR_INVALHOOKSWITCHMODE);
// Send the command to the switch
else
GetDeviceInfo()->DRV_SetHookswitch(this, (pRequest->GetHookswitchState() == PHONEHOOKSWITCHMODE_MICSPEAKER) ? 1 : 0);
}
// If we are in the waiting stage (2) then see if we received an event from the
// switch (vs. an interval timer) and if that event was an ACK/NAK in response
// to the command we issued.
else if (pRequest->GetState() == STATE_WAITING && pBlock != NULL)
{
// If this is a command response for our SETGAIN, then manage it.
const CPECommand* peCommand = dynamic_cast<const CPECommand*>(pBlock->GetElement(CPBXElement::Command));
const CPEErrorCode* pidError = dynamic_cast<const CPEErrorCode*>(pBlock->GetElement(CPBXElement::ErrorCode));
if (pBlock->GetEventType() == CEventBlock::CommandResponse &&
peCommand->GetCommand() == CPECommand::SetHookSwitch && pidError != NULL)
{
// Complete the request with the appropriate error code.
TranslateErrorCode(pRequest, pidError->GetError());
return true;
}
}
// Check to see if our request has exceeded the limit for processing. If
// so, tell TAPI that the request failed and delete the request.
if (pRequest->GetState() == STATE_WAITING &&
(pRequest->GetStateTime()+REQUEST_TIMEOUT) < GetTickCount())
CompleteRequest(pRequest, PHONEERR_OPERATIONFAILED);
// Let the request fall through to the unsolicited handler where we
// set all the options concerning the newly found call.
return false;
}// CJTPhone::OnSetHookswitch
示例4: DispatchForSCSI
NTSTATUS DispatchForSCSI(IN PDEVICE_OBJECT fido, IN PIRP Irp)
{
// KdPrint((DRIVERNAME " - Enter DispatchForSCSI \n"));
PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fido->DeviceExtension;
PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp);
// Pass request down without additional processing
NTSTATUS status;
status = IoAcquireRemoveLock(&pdx->RemoveLock, Irp);
if (!NT_SUCCESS(status))
return CompleteRequest(Irp, status, 0);
IoCopyCurrentIrpStackLocationToNext(Irp);
IoSetCompletionRoutine( Irp,
USBSCSICompletion,
NULL,
TRUE,
TRUE,
TRUE );
status = IoCallDriver(pdx->LowerDeviceObject, Irp);
IoReleaseRemoveLock(&pdx->RemoveLock, Irp);
return status;
}
示例5: CompleteRequest
/**
Initialises the BIC's active object and initiates the command
@param aStatus the TRequestStatus of the active object calling this BIC
*/
void CCmdPersistHalAttributes::Execute( TRequestStatus& aStatus )
{
aStatus = KRequestPending;
iExecuteRequest = &aStatus;
CompleteRequest(iStatus, KErrNone);
SetActive();
}
示例6: FTRACE
// ----------------------------------------------------------------------------
// Standard active object cancellation function.
// ----------------------------------------------------------------------------
//
void CUsbActiveMscHandler::DoCancel()
{
FTRACE( FPrint(
_L( "[USBWATCHER]\tCUsbActiveMscHandler: DoCancel iMscState=%d" ),
iMscState ) );
//Remove all notes. The state may have changed after the confirm unload
//is started.
if (iMscState != EUsbMscStateForciblyDismounting)
{
iPersonalityParams.PersonalityNotifier().CancelAll();
}
switch (iMscState)
{
case EUsbMscStateStarting:
case EUsbMscStateStopping:
break;
case EUsbMscStateMounting:
case EUsbMscStateForciblyDismounting:
if (iDismountFatTimer)
{
iDismountFatTimer->Cancel();
}
iFs.NotifyDismountCancel();
break;
default:
FLOG(_L("[USBWATCHER]\tCUsbActiveMscHandler::DoCancel: ERROR"));
break;
}
CompleteRequest(KErrCancel);
}
示例7: FLOG
// ----------------------------------------------------------------------------
// Called by personality handler when personality stop needs to be finished.
// ----------------------------------------------------------------------------
//
void CUsbActiveMscHandler::FinishPersonalityStop(TRequestStatus& aStatus)
{
FLOG(_L("[USBWATCHER]\tCUsbActiveMscHandler: FinishPersonalityStop"));
//Mounting may be ongoing
iRequestStatus = NULL; //do not complete in DoCancel
Cancel();
//unmount in case device state not yet Undefined
if (iMountChanged)
{
UnmountMassStorage();
}
RemoveMassStorageFileSystem();
if (iIsQueryNoteShown)
{
// Remove all queries shown by this personality
iPersonalityParams.PersonalityNotifier().CancelQuery(KQueriesNotifier);
iIsQueryNoteShown = EFalse;
}
iMscState = EUsbMscStateIdle;
iRequestStatus = &aStatus;
aStatus = KRequestPending;
CompleteRequest(KErrNone);
}
示例8: bufPtr
/**
* Takes a buffer from the client, sends to the driver and back to the client.
*
* @param aMessage RMessage2 client request.
*/
void CShBufTestServerSession::FromTPtr8ProcessAndReturnL(const RMessage2& aMessage)
{
//
// Read the client buffer...
//
TPtr8 bufPtr(iSessionTempBuffer, sizeof(iSessionTempBuffer));
aMessage.ReadL(0, bufPtr);
TUint bufSize;
bufSize = aMessage.Int1();
//
// Pass to the server to pass to the driver and back...
//
TInt result;
result = Server().FromTPtr8ProcessAndReturn(bufPtr, bufSize);
//
// Write the client buffer back...
//
aMessage.WriteL(0, bufPtr);
//
// Complete the request...
//
CompleteRequest(aMessage, result);
} // CShBufTestServerSession::FromTPtr8ProcessAndReturnL
示例9: Server
/**
* Takes a buffer from the client, sends to the driver and back to the client.
*
* @param aMessage RMessage2 client request.
*/
void CShBufTestServerSession::FromRShBufProcessAndReturnL(const RMessage2& aMessage)
{
//
// Read the client handle buffer...
//
RShBuf shBuf;
TUint bufSize;
bufSize = aMessage.Int1();
//
// Pass to the server to pass to the driver and back...
//
TInt result;
result = Server().FromRShBufProcessAndReturn(shBuf, bufSize);
//
// Write the client buffer handle back...
//
#ifdef CAN_TRANSFER_SHBUF_TO_ANOTHER_PROCESS
// TDBD aMessage.Complete(shbuf->Handle());
#else
TPckg<TInt> handlePckg(shBuf.Handle());
aMessage.WriteL(0, handlePckg);
#endif
//
// Complete the request...
//
CompleteRequest(aMessage, result);
} // CShBufTestServerSession::FromRShBufProcessAndReturnL
示例10: LBS_RDEBUG_VAR_INT
/**
* From CActive
*/
void CPositionRequest::RunL()
{
LBS_RDEBUG_VAR_INT("CPositionRequest::RunL() iRequestPhase", iRequestPhase);
TInt err = iStatus.Int();
switch (iRequestPhase)
{
case EPosReqPositionRequest:
{
LBS_RDEBUG_INFO("CPositionRequest::RunL() EPosReqPositionRequest");
// Position request finished. Cancel timer.
iTimeoutTimer->Cancel();
iRequestPhase = EPosReqInactive;
CompleteRequest(err);
HandleTrackingStateL(); // don't care if it leaves
break;
}
case EPosWaitForTracking:
StartPositionDataRequestPhase();
break;
default :
DEBUG_TRACE("CPositionRequest::RunL() panicing", __LINE__)
DebugPanic(EPosServerPanicRequestInconsistency);
}
}
示例11: shPoolInfoPckg
/**
* Allows the client to ask the test server to open a buffer pool.
*
* @param aMessage RMessage2 client request.
*/
void CShBufTestServerSession::OpenRShBufPoolL(const RMessage2& aMessage)
{
//
// Read the handle...
//
TInt poolHandle = aMessage.Int0();
//
// Read the pool info...
//
TShPoolInfo shPoolInfo;
TPckg<TShPoolInfo> shPoolInfoPckg(shPoolInfo);
aMessage.ReadL(1, shPoolInfoPckg);
//
// Pass to the server to open the pool...
//
TInt result = Server().OpenRShBufPool(poolHandle, shPoolInfo);
//
// Complete the request...
//
CompleteRequest(aMessage, result);
} // CShBufTestServerSession::OpenRShBufPoolL
示例12: OstTraceFunctionEntry0
void CAcmWriter::WriteCompleted(TInt aError)
/**
* This function is called when a write on the LDD has completed.
* This checks whether any data remains to be written, if so the
* read and write requests are re-issued until there in no data
* left or an error occurs.
*
* @param aError Error with which the write completed.
*/
{
OstTraceFunctionEntry0( CACMWRITER_WRITECOMPLETED_ENTRY );
OstTrace1( TRACE_NORMAL, CACMWRITER_WRITECOMPLETED, "CAcmWriter::WriteCompleted;aError=%d", (TInt)aError );
if(iLengthToGo == 0 || aError != KErrNone)
{
OstTrace1( TRACE_NORMAL, CACMWRITER_WRITECOMPLETED_DUP1,
"CAcmWriter::WriteCompleted;\tcompleting request with %d", aError );
CompleteRequest(aError);
}
else
{
//there is some data remaining to be read so reissue the Read & Write
//requests until there is no data left.
ReadDataFromClient();
IssueWrite();
}
OstTraceFunctionExit0( CACMWRITER_WRITECOMPLETED_EXIT );
}
示例13: config
void CNetworkPsy2::CancelNotifyPositionUpdate()
{
if(iRequestStatus &&
iCurrentIndex>=0 && iCurrentIndex<iPsyConfigArray.Count())
{
TPsyConfig& config(iPsyConfigArray[iCurrentIndex]);
if(config.iData.iLRConfig.iNumOfResponse>1)
{
config.iData.iLRConfig.iNumOfResponse--;
}
else if(config.iData.iLRConfig.iNumOfResponse>0)
{
iCurrentIndex++;
if(iCurrentIndex>=iPsyConfigArray.Count())
{
//When all items are used, then clean the config items
iPsyConfigArray.Reset();
iCurrentIndex = 0;
}
}
else
{
//0 means forever response with this
}
iTimer->Cancel();
}
CompleteRequest(KErrCancel);
StartTimerIfNeeded();
}
示例14: DispatchCreate
NTSTATUS DispatchCreate( PDEVICE_OBJECT fdo, PIRP Irp )
{
PIO_STACK_LOCATION stack;
PDEVICE_EXTENSION pdx;
UNICODE_STRING interfaceName;
NTSTATUS status;
pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
stack = IoGetCurrentIrpStackLocation( Irp );
status = STATUS_SUCCESS;
RtlInitUnicodeString( &interfaceName, OperationInterfaceFile );
if(0 == RtlCompareUnicodeString( &interfaceName, &stack->FileObject->FileName, TRUE))
{
// we allow only exclusive access to the device
if(InterlockedIncrement(&pdx->handles) != 1)
{
InterlockedDecrement( &pdx->handles );
status = STATUS_ACCESS_DENIED;
KdPrint((DRIVERNAME " - ACCESS DENIED\n"));
}
}
return CompleteRequest( Irp, status, 0 );
}
示例15: SwdmDispatchWrite
NTSTATUS
SwdmDispatchWrite(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
PVOID Buf; //Buffer provided by user program
ULONG BufLen; //Buffer length for user provided buffer
LONGLONG Offset;//Buffer Offset
PVOID DataBuf; //Buffer provided by Driver
ULONG DataLen; //Buffer length for Driver Data Buffer
ULONG ByteTransferred;
PIO_STACK_LOCATION pStk;
PDEVICE_EXTENSION pCtx;
//NTSTATUS status;
DbgPrintEx( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "IRP_MJ_WRITE : Begin\r\n");
//Get I/o Stack Location & Device Extension
pStk = IoGetCurrentIrpStackLocation(Irp);
pCtx = DeviceObject->DeviceExtension;
//Get User Input Buffer & Length
BufLen = pStk->Parameters.Write.Length;
Offset = pStk->Parameters.Read.ByteOffset.QuadPart;
Buf = (PUCHAR)(Irp->AssociatedIrp.SystemBuffer) + Offset;
//Get Driver Data Buffer & Length
DataBuf = pCtx->DataBuffer;
DataLen = 1024;
IoAcquireRemoveLock(&pCtx->RemoveLock, Irp);
DbgPrintEx( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "Input Buffer Length : %d\r\n", BufLen);
DbgPrintEx( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "Driver Data Length : %d\r\n", DataLen);
if (BufLen <= DataLen) {
ByteTransferred = BufLen;
} else {
ByteTransferred = DataLen;
}
ByteTransferred = BufLen;
RtlZeroMemory(
pCtx->DataBuffer,
1024);
RtlCopyMemory(
DataBuf,
Buf,
ByteTransferred);
IoReleaseRemoveLock(&pCtx->RemoveLock, Irp);
CompleteRequest(Irp, STATUS_SUCCESS, ByteTransferred);
DbgPrintEx( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "IRP_MJ_WRITE : End\r\n");
return STATUS_SUCCESS;
}