/*	function : SetCell ()
		this function sets the value of a cell, then registers a SET action on the
		action course.
		if this function fails for any reasons, it registers instead a BAD_OPERATION
		action and sets the _BAD_OPERATION state flag.
		return value :
			-	if succeeded	: true.
			-	if failed		: false.
*/
bool	sudokuBoard::SetCell (Cell * target , sudokuValue NewVal)
{
	target ->v = NewVal ;

	bool status = this ->pushAction ( actionRecord ( actionRecord::SET , *target , true ) );

	// if a failure happened, try to signal it.
	if ( !status )
	{
		state |= ! sudokuState::_BAD_OPERATION ;
		// try to signal a bad operation.
		try
		{
			if( ! this->pushAction ( actionRecord(actionRecord::BAD_OPERATION , Cell() , false ) ) )
				throw int();
		}
		catch( int x )
		{
			// if couldn't signal the bad operation, then terminate the program.
			UNREFERENCED_VAR(x);
			std::cerr << "Fatal error, pushAction failure.\nGenerated from function :\t"__FUNCTION__<<std::endl;
			std::cerr << "\tTerminating . . ."<<std::endl;
			std::terminate();
		}
		return false;
	}

	else return true;
}
//=============================================================================
NTSTATUS
PropertyHandler_MicInTopoFilter
( 
    _In_ PPCPROPERTY_REQUEST      PropertyRequest 
)
/*++

Routine Description:

  Redirects property request to miniport object

Arguments:

  PropertyRequest - 

Return Value:

  NT status code.

--*/
{
    PAGED_CODE();

    ASSERT(PropertyRequest);

    DPF_ENTER(("[PropertyHandler_MicInTopoFilter]"));

    // PropertryRequest structure is filled by portcls. 
    // MajorTarget is a pointer to miniport object for miniports.
    //
    NTSTATUS            ntStatus = STATUS_INVALID_DEVICE_REQUEST;

    //
    // This line shows how to get a pointer to the miniport topology object.
    //
    PCMiniportTopology  pMiniport = (PCMiniportTopology)PropertyRequest->MajorTarget;
    UNREFERENCED_VAR(pMiniport);

    if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Jack))
    {
        if (PropertyRequest->PropertyItem->Id == KSPROPERTY_JACK_DESCRIPTION)
        {
            ntStatus = PropertyHandler_MicInJackDescription(PropertyRequest);
        }
        else if (PropertyRequest->PropertyItem->Id == KSPROPERTY_JACK_DESCRIPTION2)
        {
            ntStatus = PropertyHandler_MicInJackDescription2(PropertyRequest);
        }
    }

    return ntStatus;
} // PropertyHandler_MicInTopoFilter
Beispiel #3
0
NTSTATUS
PropertyHandler_BthHfpMicTopoFilter
(
    _In_ PPCPROPERTY_REQUEST      PropertyRequest
)
/*++

Routine Description:

  Redirects property request to miniport object

Arguments:

  PropertyRequest -

Return Value:

  NT status code.

--*/
{
    PAGED_CODE();

    ASSERT(PropertyRequest);

    DPF_ENTER(("[PropertyHandler_BthHfpMicTopoFilter]"));

    // PropertryRequest structure is filled by portcls.
    // MajorTarget is a pointer to miniport object for miniports.
    //
    NTSTATUS            ntStatus = STATUS_INVALID_DEVICE_REQUEST;

    //
    // This line shows how to get a pointer to the miniport topology object.
    //
    PCMiniportTopology  pMiniport = (PCMiniportTopology)PropertyRequest->MajorTarget;
    UNREFERENCED_VAR(pMiniport);

    if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Jack))
    {
        switch(PropertyRequest->PropertyItem->Id)
        {
        case KSPROPERTY_JACK_DESCRIPTION:
            ntStatus = PropertyHandler_BthHfpJackDescription(
                           PropertyRequest,
                           ARRAYSIZE(BthHfpMicJackDescriptions),
                           BthHfpMicJackDescriptions);
            break;

        case KSPROPERTY_JACK_DESCRIPTION2:
            ntStatus = PropertyHandler_BthHfpJackDescription2(
                           PropertyRequest,
                           ARRAYSIZE(BthHfpMicJackDescriptions),
                           BthHfpMicJackDescriptions);
            break;

        case KSPROPERTY_JACK_CONTAINERID:
            ntStatus = PropertyHandler_BthHfpJackContainerId(
                           PropertyRequest,
                           ARRAYSIZE(BthHfpMicJackDescriptions),
                           BthHfpMicJackDescriptions);
            break;
        }
    }
    else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_BtAudio))
    {
        switch(PropertyRequest->PropertyItem->Id)
        {
        case KSPROPERTY_ONESHOT_RECONNECT:
            ntStatus = PropertyHandler_BthHfpOneShotReconnect(PropertyRequest);
            break;

        case KSPROPERTY_ONESHOT_DISCONNECT:
            ntStatus = PropertyHandler_BthHfpOneDisconnect(PropertyRequest);
            break;
        }
    }

    return ntStatus;
} // PropertyHandler_BthHfpMicTopoFilter