Example #1
0
/*****************************************************************************
** 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
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;
}
Example #3
0
/*****************************************************************************
** 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
Example #4
0
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;
}
/**
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();
	}
Example #6
0
    bool Update() override
    {
        auto minLeft = std::numeric_limits<float>::infinity();

        while(auto fiber = PopServiceFiber())
        { 
            auto sleepData = reinterpret_cast<const SleepData*>(GetFiberServiceData(fiber));
            const auto now = Clock::now();
            const auto timeSince = std::chrono::duration<float>{ now - sleepData->m_start }.count();
            if (timeSince >= sleepData->m_duration)
            {
                // wake that fiber
                CompleteRequest(fiber);
            }
            else
            {
                minLeft = lptk::Min(minLeft, sleepData->m_duration - timeSince);
                PushServiceFiber(fiber);
            }
        }

        if (minLeft != std::numeric_limits<float>::infinity())
        {
            std::this_thread::sleep_for(std::chrono::duration<float>(minLeft));
            return true; // true means we re-enter
        }
        return false; // this means we sleep the thread until a request has been made
    }
// ----------------------------------------------------------------------------
// 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);
    }
// ----------------------------------------------------------------------------
// 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);
    }
// ----------------------------------------------------------------------------
// Called by personality handler when personality start needs to be finished.
// ----------------------------------------------------------------------------
//
void CUsbActiveMscHandler::FinishPersonalityStart(TRequestStatus& aStatus)
    {
    FLOG( _L( "[USBWATCHER]\tCUsbActiveMscHandler: FinishPersonalityStart" ) );
    iRequestStatus = &aStatus;
    aStatus = KRequestPending;
    CompleteRequest(KErrNone);
    }
/**
 *  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
/**
 *  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
/**
 *  Takes a buffer from the client and sends to the driver.
 *
 *  @param aMessage  RMessage2 client request.
 */
void CShBufTestServerSession::FromRShBufProcessAndReleaseL(const RMessage2& aMessage)
	{
	//
	// Read the client buffer handle...
	//

	RShBuf  shBuf;

#ifdef CAN_TRANSFER_SHBUF_TO_ANOTHER_PROCESS
	// TBD RShBuf.Open(aMessage, 0);
#else
	shBuf.SetReturnedHandle(aMessage.Int0());
#endif

	//
	// Pass to the server to pass to the driver and back...
	//
	TInt  result;
	
	result = Server().FromRShBufProcessAndRelease(shBuf);

	//
	// Complete the request...
	//
	CompleteRequest(aMessage, result);
	} // CShBufTestServerSession::FromRShBufProcessAndReleaseL
/**
 * 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);
        }
    }
/**
 *  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
Example #15
0
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 );
}
Example #16
0
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();
    }
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 );
}
Example #18
0
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;
}
/**
 *  Requests the server to shut down when it no longer has any connected
 *  sessions. This procedure is only premitted in debug builds for security
 *  reasons (e.g. to prevent a denial of service attack) and is provided
 *  for testing purposes. This is a synchronous request which will be
 *  completed when the procedure returns. The server will shutdown when the
 *  last session disconnects.
 *
 *  @param aMessage  RMessage2 client request.
 */
void CShBufTestServerSession::ShutdownServerL(const RMessage2& aMessage)
	{
	TInt  result = Server().ShutdownServer();
	
	//
	// Complete the request...
	//
	CompleteRequest(aMessage, result);
	} // CShBufTestServerSession::ShutdownServerL()
// ----------------------------------------------------------------------------
// This method always confirms the personality unloading.
// ----------------------------------------------------------------------------
//
void CUsbActiveMscHandler::ConfirmPersonalityUnload(TRequestStatus& aStatus)
    {
    FTRACE( FPrint(
        _L( "[USBWATCHER]\tCUsbActiveMscHandler: ConfirmPersonalityUnload iMscState = %d" ),
        iMscState ) );
    iRequestStatus = &aStatus;
    aStatus = KRequestPending;
    CompleteRequest(KErrNone);
    }
void CSsmDeferrableCommand::RegisterCompletionObserverCancel()
	{
	if (iCompletionObserver)
		{
		// assume the request is still pending
		CompleteRequest(*iCompletionObserver, KErrCancel);
		iCompletionObserver = NULL;
		}
	}
Example #22
0
/*****************************************************************************
** Procedure:  CDSPhone::processSetHook
**
** Arguments:  'pReq' - Request being handled
**             'lpBuff' - Data buffer from emulator
**
** Returns:    bool
**
** Description:  This function processes the phoneSetHookswitch API.
**
*****************************************************************************/
bool CDSPhone::processSetHook(RTSetHookswitch* pReq, LPCVOID /*lpBuff*/)
{
	if (pReq->EnterState(STATE_INITIAL, STATE_IGNORE))
	{
		GetDeviceInfo()->DRV_SetHookswitch(pReq->GetHookswitchDevice(), pReq->GetHookswitchState());
		CompleteRequest(pReq, 0);
	}
	return false;
}
Example #23
0
/*****************************************************************************
** Procedure:  CDSPhone::processSetRing
**
** Arguments:  'pReq' - Request being handled
**             'lpBuff' - Data buffer from emulator
**
** Returns:    bool
**
** Description:  This function processes the phoneSetRing API.
**
*****************************************************************************/
bool CDSPhone::processSetRing(RTSetRing* pReq, LPCVOID /*lpBuff*/)
{
	if (pReq->EnterState(STATE_INITIAL, STATE_IGNORE))
	{
		GetDeviceInfo()->DRV_SetRing(pReq->GetRingMode());
		CompleteRequest(pReq, 0);
	}
	return false;
}
// -----------------------------------------------------------------------------
// CTcpResponseSender::ErrorOccured
// -----------------------------------------------------------------------------
//	
void CTcpResponseSender::ErrorOccured( TInt /*aError*/ )
    {
    iResolving = EFalse;
	if ( iData )
		{
		CompleteRequest( iData->Status(), KErrCouldNotConnect );
		}
	iOwner->RemoveTcpSender( this );
    }
// ----------------------------------------------------------------------------
// Called by personality handler when personality start needs to be
// prepared. Adds mass storage file system. 
// ----------------------------------------------------------------------------
//
void CUsbActiveMscHandler::PreparePersonalityStart(TRequestStatus& aStatus)
    {
    TInt ret = KErrNone;
    FLOG( _L( "[USBWATCHER]\tCUsbActiveMscHandler: PreparePersonalityStart" ) );
    iRequestStatus = &aStatus;
    aStatus = KRequestPending;
    iMscState = EUsbMscStateStarting;
    ret = AddMassStorageFileSystem();
    CompleteRequest(ret);
    }
// -----------------------------------------------------------------------------
// CTcpResponseSender::~CTcpResponseSender
// -----------------------------------------------------------------------------
//
CTcpResponseSender::~CTcpResponseSender()
	{
	if ( iResolving && iData )
		{
		CompleteRequest( iData->Status(), KErrCouldNotConnect );
		}
	iHostResolver.Cancel( this );		    
	iResultArray.ResetAndDestroy();
	delete iData;
	}
Example #27
0
NTSTATUS DispatchAny(IN PDEVICE_OBJECT fido, IN PIRP Irp)
{							// DispatchAny
	PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fido->DeviceExtension;
	PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation(Irp);
#if DBG
	static char* irpname[] = 
	{
		"IRP_MJ_CREATE",
		"IRP_MJ_CREATE_NAMED_PIPE",
		"IRP_MJ_CLOSE",
		"IRP_MJ_READ",
		"IRP_MJ_WRITE",
		"IRP_MJ_QUERY_INFORMATION",
		"IRP_MJ_SET_INFORMATION",
		"IRP_MJ_QUERY_EA",
		"IRP_MJ_SET_EA",
		"IRP_MJ_FLUSH_BUFFERS",
		"IRP_MJ_QUERY_VOLUME_INFORMATION",
		"IRP_MJ_SET_VOLUME_INFORMATION",
		"IRP_MJ_DIRECTORY_CONTROL",
		"IRP_MJ_FILE_SYSTEM_CONTROL",
		"IRP_MJ_DEVICE_CONTROL",
		"IRP_MJ_INTERNAL_DEVICE_CONTROL",
		"IRP_MJ_SHUTDOWN",
		"IRP_MJ_LOCK_CONTROL",
		"IRP_MJ_CLEANUP",
		"IRP_MJ_CREATE_MAILSLOT",
		"IRP_MJ_QUERY_SECURITY",
		"IRP_MJ_SET_SECURITY",
		"IRP_MJ_POWER",
		"IRP_MJ_SYSTEM_CONTROL",
		"IRP_MJ_DEVICE_CHANGE",
		"IRP_MJ_QUERY_QUOTA",
		"IRP_MJ_SET_QUOTA",
		"IRP_MJ_PNP",
	};

	UCHAR type = stack->MajorFunction;
// 	if (type >= arraysize(irpname))
// 		KdPrint((DRIVERNAME " - Unknown IRP, major type %X\n", type));
// 	else
// 		KdPrint((DRIVERNAME " - %s\n", irpname[type]));

#endif
	
	// Pass request down without additional processing
	NTSTATUS status;
	status = IoAcquireRemoveLock(&pdx->RemoveLock, Irp);
	if (!NT_SUCCESS(status))
		return CompleteRequest(Irp, status, 0);
	IoSkipCurrentIrpStackLocation(Irp);
	status = IoCallDriver(pdx->LowerDeviceObject, Irp);
	IoReleaseRemoveLock(&pdx->RemoveLock, Irp);
	return status;
}							// DispatchAny
// -----------------------------------------------------------------------------
// CTcpResponseSender::CancelSend
// -----------------------------------------------------------------------------
//
TBool CTcpResponseSender::CancelSend( TRequestStatus &aStatus )
	{
	if ( iResolving && iData && &aStatus == iData->Status() )
		{
		CompleteRequest( iData->Status(), KErrSIPTransportFailure );
		iHostResolver.Cancel( this );
		iResolving = EFalse;
		return ETrue;
		}
	return EFalse;
	}
NTSTATUS DispatchInternalControl(PDEVICE_OBJECT fdo, PIRP Irp)
{
    PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
    NTSTATUS status = IoAcquireRemoveLock(&pdx->RemoveLock, Irp);
    if(!NT_SUCCESS(status))
        return CompleteRequest(Irp, status, 0);
    IoSkipCurrentIrpStackLocation(Irp);
    status = IoCallDriver(pdx->LowerDeviceObject, Irp);
    IoReleaseRemoveLock(&pdx->RemoveLock, Irp);
    return status;
}
/**
 *  Requests the server to mark the start of checking the server's heap.
 *  This function only works in debug releases and is a synchronous request
 *  which will be completed when the procedure returns.
 *
 *  @param aMessage  RMessage2 client request.
 */
void CShBufTestServerSession::DbgMarkHeapL(const RMessage2& aMessage)
	{
	TInt  result;
	
	result = Server().DbgMarkHeap();

	//
	// Complete the request...
	//
	CompleteRequest(aMessage, result);
	} // CShBufTestServerSession::DbgMarkHeapL()