Пример #1
0
int restrictEnabled() {
  LARGE_INTEGER curtime, diff;
  KeQuerySystemTime(&curtime);
  diff = RtlLargeIntegerSubtract(curtime, Globals.DRIVERSTARTTIME);
  
  if (RtlLargeIntegerGreaterThan(diff,
				 Globals.RESTRICT_STARTUP_TIMEOUT))
    return 1;
  return 0;
}
Пример #2
0
VOID
SoundMixerNotify(
    IN OUT PIRP        pIrp,
    IN OUT PMIXER_INFO MixerInfo
)
/*++

Routine Description:

    Mixer notification dispatcher

Arguments:

    pIrp - Pointer to IO request packet
    MixerInfo - mixer specific data

Return Value:

    None

Notes:
    It's ASSUMED that the Irp will be completed by this routine and has been
    removed from any lists etc.  This assumption will be valid either because

        some data has changed so all current notification Irps will become 'old'
        (note - we don't put them on the list if they're 'new' and, because we're
        using buffered IO the application can't change the data once we've got it).
    or
        We're received a new notification Irp which is 'old'.


--*/
{
    PMIXER_DD_REQUEST_NOTIFY MixerNotifyData;
    PMIXER_DATA_ITEM LastChanged;

    MixerNotifyData = (PMIXER_DD_REQUEST_NOTIFY)
                         pIrp->AssociatedIrp.SystemBuffer;

    /*
    **  Find the oldest item to dispatch.  However, there won't be
    **  many so start at the beginning.
    **
    **  It is assumed that if this routine is called then there must
    **  be something to dispatch.
    */

    {
        PLIST_ENTRY ListEntry;

        /*
        **  If we get in here the list must have at least one entry in
        **  it otherwise the current time would never have got above 0
        */

        ASSERTMSG("No changed items but notify routine called!",
                  MixerInfo->ChangedItems.Flink != &MixerInfo->ChangedItems);

        LastChanged =
            CONTAINING_RECORD(MixerInfo->ChangedItems.Flink,
                              MIXER_DATA_ITEM,
                              Entry);

        ASSERTMSG("Last changed not current!",
                  RtlLargeIntegerEqualTo(LastChanged->LastSet,
                                         MixerInfo->CurrentLogicalTime));

        for (ListEntry = MixerInfo->ChangedItems.Flink->Flink;
             ListEntry != &MixerInfo->ChangedItems;
             ListEntry = ListEntry->Flink) {

             PMIXER_DATA_ITEM MixerDataItem;

             MixerDataItem =
                 CONTAINING_RECORD(ListEntry, MIXER_DATA_ITEM, Entry);

             if (RtlLargeIntegerGreaterThan(
                     MixerDataItem->LastSet,
                     MixerNotifyData->CurrentLogicalTime)
                ) {

                 /*
                 **  The item we're looking at is more recent than the
                 **  the Irp so it's a candidate - continue search
                 */

                 LastChanged = MixerDataItem;

             } else {

                 /*
                 **  The item is older (or of equal vintage) to the Irp
                 **  so stop the search and use the last (cached) item
                 */

                 break;
             }
        }
    }

    /*
    **  Note - we MUST have found something
    **
    **  Dispatch the Irp with the requisite data
    */

    MixerNotifyData->Message            = LastChanged->Message;
    MixerNotifyData->Id                 = LastChanged->Id;
    MixerNotifyData->CurrentLogicalTime = LastChanged->LastSet;

    /*
    **  Make sure the data gets copied back when this finally
    **  completes.
    */

    pIrp->IoStatus.Information = sizeof(MIXER_DD_REQUEST_NOTIFY);
    pIrp->IoStatus.Status      = STATUS_SUCCESS;

    /*
    **  There's no need to give the huge IO_SOUND_INCREMENT - this stuff
    **  is for user interface update.
    */

    IoCompleteRequest(pIrp, IO_KEYBOARD_INCREMENT);
}