亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? sermcmn.c

?? This is a serial mouse driver, which is compliant with Plug and Play, supports dynamic detection (vi
?? C
字號(hào):
/*++

Copyright (c) 1990-1998 Microsoft Corporation, All Rights Reserved
Copyright (c) 1993  Logitech Inc.

Module Name:

    sermcmn.c

Abstract:

    The common portions of the Microsoft serial (i8250) mouse port driver.
    This file should not require modification to support new mice
    that are similar to the serial mouse.

Environment:

    Kernel mode only.

Notes:

    NOTES:  (Future/outstanding issues)

    - Powerfail not implemented.

    - IOCTL_INTERNAL_MOUSE_DISCONNECT has not been implemented.  It's not
      needed until the class unload routine is implemented. Right now,
      we don't want to allow the mouse class driver to unload.

    - Consolidate duplicate code, where possible and appropriate.

Revision History:


--*/

#include "stdarg.h"
#include "stdio.h"
#include "string.h"
#include "ntddk.h"
#include "mouser.h"
#include "sermlog.h"
#include "debug.h"

#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, SerialMouseCreate)
#pragma alloc_text(PAGE, SerialMouseClose)
#endif

NTSTATUS
SerialMouseFlush(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP Irp
    )
{
    PDEVICE_EXTENSION  deviceExtension;
    NTSTATUS           status;

    //
    // Get a pointer to the device extension.
    //
    deviceExtension = DeviceObject->DeviceExtension;

    Print(deviceExtension, DBG_UART_INFO, ("Flush \n"));

    status = IoAcquireRemoveLock(&deviceExtension->RemoveLock, Irp);
    if (!NT_SUCCESS(status)) {
        return status;
    }

    //
    // Fire and forget
    //
    IoSkipCurrentIrpStackLocation(Irp);
    status = IoCallDriver(deviceExtension->TopOfStack, Irp);

    IoReleaseRemoveLock(&deviceExtension->RemoveLock, Irp);

    return status;
}

NTSTATUS
SerialMouseInternalDeviceControl(
    IN PDEVICE_OBJECT   DeviceObject,
    IN PIRP             Irp
    )

/*++

Routine Description:

    This routine is the dispatch routine for internal device control requests.

Arguments:

    DeviceObject - Pointer to the device object.

    Irp - Pointer to the request packet.

Return Value:

    Status is returned.

--*/

{
    PIO_STACK_LOCATION irpSp;
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS status;

    //
    // Get a pointer to the device extension.
    //
    deviceExtension = DeviceObject->DeviceExtension;

    Print(deviceExtension, DBG_IOCTL_TRACE, ("IOCTL, enter\n"));

    //
    // Initialize the returned Information field.
    //
    Irp->IoStatus.Information = 0;

    //
    // Get a pointer to the current parameters for this request.  The
    // information is contained in the current stack location.
    //
    irpSp = IoGetCurrentIrpStackLocation(Irp);

    status = IoAcquireRemoveLock(&deviceExtension->RemoveLock, Irp);
    if (!NT_SUCCESS(status)) {
        Irp->IoStatus.Status = status;
        IoCompleteRequest(Irp, IO_NO_INCREMENT);
        return status;
    }

    ASSERT (deviceExtension->Started ||
            (IOCTL_INTERNAL_MOUSE_CONNECT ==
             irpSp->Parameters.DeviceIoControl.IoControlCode));


    //
    // Case on the device control subfunction that is being performed by the
    // requestor.
    //
    switch (irpSp->Parameters.DeviceIoControl.IoControlCode) {

    //
    // Connect a mouse class device driver to the port driver.
    //

    case IOCTL_INTERNAL_MOUSE_CONNECT:

        Print(deviceExtension, DBG_IOCTL_INFO, ("connect\n"));

        //
        // Only allow one connection.
        //
        if (deviceExtension->ConnectData.ClassService != NULL) {

            Print(deviceExtension, DBG_IOCTL_ERROR, ("error - already connected\n"));

            status = STATUS_SHARING_VIOLATION;
            break;

        }
        else if (irpSp->Parameters.DeviceIoControl.InputBufferLength <
                sizeof(CONNECT_DATA)) {

            Print(deviceExtension, DBG_IOCTL_ERROR,
                  ("connect error - invalid buffer length\n"));

            status = STATUS_INVALID_PARAMETER;
            break;
        }

        //
        // Copy the connection parameters to the device extension.
        //

        deviceExtension->ConnectData =
            *((PCONNECT_DATA) (irpSp->Parameters.DeviceIoControl.Type3InputBuffer));

        status = STATUS_SUCCESS;
        break;

    //
    // Disconnect a mouse class device driver from the port driver.
    //
    // NOTE: Not implemented.
    //

    case IOCTL_INTERNAL_MOUSE_DISCONNECT:

        Print(deviceExtension, DBG_IOCTL_INFO, ("disconnect\n"));
        TRAP();

        //
        // Not implemented.
        //
        // To implement, code the following:
        // ---------------------------------
        // o ENSURE that we are NOT enabled (extension->EnableCount);
        //   o If we are, then (a) return STATUS_UNSUCCESSFUL, or
        //                     (b) disable all devices immediately; see
        //                         DISABLE IOCTL call for necessary code.
        // o SYNCHRONIZE with the mouse read completion routine (must
        //   protect the callback pointer from being dereferenced when
        //   it becomes null).  Note that no mechanism currently exists
        //   for this.
        // o CLEAR the connection parameters in the device extension;
        //   ie. extension->ConnectData = { 0, 0 }
        // o RELEASE the synchronizing lock.
        // o RETURN STATUS_SUCCESS.
        //

        //
        // Clear the connection parameters in the device extension.
        // NOTE:  Must synchronize this with the mouse ISR.
        //
        //
        //deviceExtension->ConnectData.ClassDeviceObject =
        //    Null;
        //deviceExtension->ConnectData.ClassService =
        //    Null;

        //
        // Set the completion status.
        //

        status = STATUS_NOT_IMPLEMENTED;
        break;

    case IOCTL_INTERNAL_MOUSE_ENABLE:
        //
        // Enable interrupts
        //
        Print (deviceExtension, DBG_IOCTL_ERROR,
               ("ERROR: PnP => use create not enable! \n"));
        status = STATUS_NOT_SUPPORTED;

        break;

    case IOCTL_INTERNAL_MOUSE_DISABLE:
        //
        // Disable Mouse interrupts 
        //
        Print(deviceExtension, DBG_IOCTL_ERROR,
              ("ERROR: PnP => use close not Disable! \n"));
        status = STATUS_NOT_SUPPORTED;

        break;

    //
    // Query the mouse attributes.  First check for adequate buffer
    // length.  Then, copy the mouse attributes from the device
    // extension to the output buffer.
    //

    case IOCTL_MOUSE_QUERY_ATTRIBUTES:

        Print(deviceExtension, DBG_IOCTL_INFO, ("query attributes\n"));

        if (irpSp->Parameters.DeviceIoControl.OutputBufferLength <
            sizeof(MOUSE_ATTRIBUTES)) {
            Print(deviceExtension, DBG_IOCTL_ERROR, ("QA buffer too small\n"));
            status = STATUS_BUFFER_TOO_SMALL;
        }
        else {
            //
            // Copy the attributes from the DeviceExtension to the
            // buffer.
            //

            *(PMOUSE_ATTRIBUTES) Irp->AssociatedIrp.SystemBuffer =
                deviceExtension->MouseAttributes;

            Irp->IoStatus.Information = sizeof(MOUSE_ATTRIBUTES);
            status = STATUS_SUCCESS;
        }

        break;

    default:
        Print (deviceExtension, DBG_IOCTL_ERROR,
               ("ERROR: unknown IOCTL: 0x%x \n",
                irpSp->Parameters.DeviceIoControl.IoControlCode));
        TRAP();

        status = STATUS_INVALID_DEVICE_REQUEST;
        break;
    }

    Irp->IoStatus.Status = status;
    IoCompleteRequest(Irp, IO_NO_INCREMENT);

    IoReleaseRemoveLock(&deviceExtension->RemoveLock, Irp);

    Print(deviceExtension, DBG_IOCTL_TRACE, ("IOCTL, exit (%x)\n", status));

    return status;
}

NTSTATUS
SerialMouseClose(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP Irp
    )
{
    PDEVICE_EXTENSION   deviceExtension;
    NTSTATUS            status;

    PAGED_CODE();

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

    Print(deviceExtension, DBG_CC_NOISE, 
          ("Close:   enable count is %d\n", deviceExtension->EnableCount));

    ASSERT(0 < deviceExtension->EnableCount);

    status = IoAcquireRemoveLock(&deviceExtension->RemoveLock, Irp);
    if (!NT_SUCCESS(status)) {
        goto SerialMouseCloseReject;
    }

    //
    // Serial can only handle one create/close, all others fail.  This is not
    // true for mice though.  Only send the last close on to serial.
    //
    if (0 == InterlockedDecrement(&deviceExtension->EnableCount)) {
        Print(deviceExtension, DBG_PNP_INFO | DBG_CC_INFO,
              ("Cancelling and stopping detection for close\n"));

        //
        // Cleanup:  cancel the read and stop detection
        //
        IoCancelIrp(deviceExtension->ReadIrp);
        SerialMouseStopDetection(deviceExtension);

        //
        // Restore the port to the state it was before we opened it
        //
        SerialMouseRestorePort(deviceExtension);

        IoReleaseRemoveLock(&deviceExtension->RemoveLock, Irp);

        IoSkipCurrentIrpStackLocation(Irp);
        return IoCallDriver(deviceExtension->TopOfStack, Irp);
    }
    else {
        Print(deviceExtension, DBG_CC_INFO,
              ("Close (%d)\n", deviceExtension->EnableCount));

        status = STATUS_SUCCESS;
    }

    IoReleaseRemoveLock(&deviceExtension->RemoveLock, Irp);

SerialMouseCloseReject:
    Irp->IoStatus.Status = status; 
    Irp->IoStatus.Information = 0;
    IoCompleteRequest(Irp, IO_NO_INCREMENT);

    return status;
}

NTSTATUS
SerialMouseCreate(
    IN PDEVICE_OBJECT   DeviceObject,
    IN PIRP             Irp
    )

/*++

Routine Description:

    This is the dispatch routine for create/open requests.
    These requests complete successfully.

Arguments:

    DeviceObject - Pointer to the device object.

    Irp - Pointer to the request packet.

Return Value:

    Status is returned.

--*/

{
    PIO_STACK_LOCATION  irpSp  = NULL;
    NTSTATUS            status = STATUS_SUCCESS;
    PDEVICE_EXTENSION   deviceExtension = NULL;

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

    Print(deviceExtension, DBG_CC_TRACE, ("Create: Enter.\n"));

    Print(deviceExtension, DBG_CC_NOISE, 
          ("Create:   enable count is %d\n"));

    //
    // Get a pointer to the current parameters for this request.  The
    // information is contained in the current stack location.
    //
    irpSp = IoGetCurrentIrpStackLocation (Irp);

    //
    // Determine if request is trying to open a subdirectory of the
    // given device object.  This is not allowed.
    //
    if (0 != irpSp->FileObject->FileName.Length) {
        Print(deviceExtension, DBG_CC_ERROR,
              ("ERROR: Create Access Denied.\n"));

        status = STATUS_ACCESS_DENIED;
        goto SerialMouseCreateReject;
    }

    status = IoAcquireRemoveLock(&deviceExtension->RemoveLock, Irp);
    if (!NT_SUCCESS(status)) {
        goto SerialMouseCreateReject;
    }

    if (NULL == deviceExtension->ConnectData.ClassService) {
        //
        // No Connection yet.  How can we be enabled?
        //
        Print(deviceExtension, DBG_IOCTL_ERROR,
              ("ERROR: enable before connect!\n"));
        status = STATUS_UNSUCCESSFUL;
    }
    else if ( 1 == InterlockedIncrement(&deviceExtension->EnableCount)) {
        //
        // send it down the stack
        //
        status = SerialMouseSendIrpSynchronously(deviceExtension->TopOfStack,
                                                 Irp,
                                                 TRUE);

        if (NT_SUCCESS(status) && NT_SUCCESS(Irp->IoStatus.Status)) {
            //
            // Everything worked, start up the mouse. 
            //
            status = SerialMouseStartDevice(deviceExtension, Irp, TRUE);
        }
        else {
            //
            // Create failed, decrement the enable count back to zero
            //
            InterlockedDecrement(&deviceExtension->EnableCount);
        }
    }
    else {
        //
        // Serial only handles one create/close.  Don't send this one down the
        // stack, it will fail.  The call to  InterlockedIncrement above
        // correctly adjusts the count.
        //
        ASSERT (deviceExtension->EnableCount >= 1);

        status = STATUS_SUCCESS;
    }

    IoReleaseRemoveLock(&deviceExtension->RemoveLock, Irp);

SerialMouseCreateReject:

    Irp->IoStatus.Status = status;
    Irp->IoStatus.Information = 0;
    IoCompleteRequest (Irp, IO_NO_INCREMENT);

    Print(deviceExtension, DBG_CC_TRACE,
          ("SerialMouseCreate, 0x%x\n", status));

    return status;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产白丝精品91爽爽久久| 北条麻妃国产九九精品视频| 成人夜色视频网站在线观看| 久久久一区二区| 麻豆精品一区二区三区| 欧美肥妇bbw| 婷婷综合五月天| 欧美丰满嫩嫩电影| 99久久国产免费看| 亚洲精品视频免费看| 欧洲一区二区三区免费视频| 夜夜亚洲天天久久| 51久久夜色精品国产麻豆| 九一九一国产精品| 国产日韩精品一区二区浪潮av | 日韩经典一区二区| 欧美大片一区二区| 国产精品一二三在| 中文字幕一区视频| 一本大道久久a久久综合| 一区二区激情视频| 国产精品狼人久久影院观看方式| 在线亚洲一区观看| 久久精品国产亚洲aⅴ| 国产人久久人人人人爽| 日韩一区二区在线观看| 在线播放日韩导航| 99国产精品视频免费观看| 国内精品在线播放| 亚洲精品v日韩精品| 国产精品麻豆网站| 欧美一卡二卡在线观看| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 国产精品一区二区不卡| 天天综合天天综合色| 一区二区三区欧美| 亚洲激情在线激情| 亚洲一区二区视频| 日韩精品一区二区三区在线 | 日韩一区二区视频在线观看| 欧美性生活大片视频| 韩国女主播成人在线观看| 全部av―极品视觉盛宴亚洲| 国产人成一区二区三区影院| 久久久久久久久久电影| 久久一二三国产| 色婷婷综合视频在线观看| 99r国产精品| 91麻豆产精品久久久久久 | 亚洲3atv精品一区二区三区| 久久久久久一二三区| 26uuuu精品一区二区| 久久蜜臀精品av| 国产欧美日韩久久| 亚洲人亚洲人成电影网站色| 精品视频123区在线观看| 成人免费毛片嘿嘿连载视频| www.成人在线| 色欧美日韩亚洲| 欧美久久久久久蜜桃| 欧美一级在线视频| 久久你懂得1024| 中文字幕一区三区| 亚洲国产日韩一区二区| 国产精品对白交换视频| 一区二区三区电影在线播| 亚洲成a人片在线观看中文| 青青草视频一区| 国产精品18久久久久久久网站| 制服.丝袜.亚洲.中文.综合| 欧美一激情一区二区三区| 久久久精品国产99久久精品芒果| 亚洲欧洲色图综合| 肉肉av福利一精品导航| 国产精品一二二区| 在线视频你懂得一区二区三区| 欧美精品一级二级| 国产亚洲精品超碰| 久久婷婷国产综合精品青草| 国产精品久久三| 午夜精品国产更新| 国产精品一区二区久久不卡 | 欧美国产亚洲另类动漫| 国产欧美日韩一区二区三区在线观看| 一区二区在线观看免费视频播放| 日韩电影在线观看网站| 日韩av一二三| 国产成人aaa| 精品视频色一区| 欧美—级在线免费片| 亚洲va在线va天堂| 国产成人免费视频| 成人性生交大片免费看视频在线| 欧美无砖砖区免费| 国产欧美视频在线观看| 午夜精品爽啪视频| av在线不卡电影| 欧美一级在线视频| 亚洲综合色网站| 丁香啪啪综合成人亚洲小说 | 国产精品1区2区3区| 欧美日韩色综合| 亚洲国产精品精华液2区45| 天天做天天摸天天爽国产一区| 成人av影院在线| 欧美mv日韩mv| 久久综合中文字幕| 亚洲成a人片在线不卡一二三区| 福利一区福利二区| 欧美成人vps| 丝袜亚洲另类欧美| 在线观看日韩av先锋影音电影院| 国产色爱av资源综合区| 午夜成人免费视频| 在线区一区二视频| 中文字幕色av一区二区三区| 国产精品一区二区果冻传媒| 欧美一二三区精品| 亚洲aaa精品| 欧美日韩一区小说| 一区二区三区免费| 91色|porny| 国产精品第一页第二页第三页| 国产伦精一区二区三区| 色一情一伦一子一伦一区| 中文字幕二三区不卡| 国产一区二区影院| 26uuu色噜噜精品一区| 日本在线不卡一区| 337p亚洲精品色噜噜| 亚洲成人免费电影| 在线观看www91| 亚洲一二三级电影| 欧美色综合天天久久综合精品| 亚洲色图制服丝袜| 色综合久久中文字幕综合网| 亚洲少妇最新在线视频| 99精品欧美一区二区蜜桃免费| 国产精品每日更新| 成人aa视频在线观看| 国产精品卡一卡二卡三| www.在线成人| 日韩伦理免费电影| 欧美影片第一页| 五月激情综合婷婷| 日韩视频国产视频| 韩国午夜理伦三级不卡影院| 久久久久久免费网| 成人久久视频在线观看| 亚洲欧洲日韩在线| 在线免费观看日韩欧美| 国产在线精品一区二区夜色 | 成人午夜视频免费看| 国产精品国产三级国产三级人妇| 99国产一区二区三精品乱码| 亚洲精品免费播放| 欧美麻豆精品久久久久久| 日产国产欧美视频一区精品| 精品国产免费人成在线观看| 一区二区三区美女视频| 欧美绝品在线观看成人午夜影视| 蜜臀av一级做a爰片久久| 久久亚洲精品国产精品紫薇| 成人在线视频一区二区| 亚洲免费视频中文字幕| 欧美精品1区2区3区| 国产一区二区调教| 自拍偷在线精品自拍偷无码专区| 欧美性感一类影片在线播放| 青椒成人免费视频| 亚洲国产精品t66y| 欧美色爱综合网| 开心九九激情九九欧美日韩精美视频电影| 久久久久九九视频| 一本大道久久精品懂色aⅴ| 热久久国产精品| 国产精品伦理一区二区| 欧美日韩国产一区| 亚洲国产精品尤物yw在线观看| 日韩免费一区二区| 94-欧美-setu| 蜜桃在线一区二区三区| 中文字幕一区二区三区不卡在线| 欧美色偷偷大香| 国产成人精品三级麻豆| 亚洲国产成人tv| 中文字幕国产一区二区| 91麻豆精品国产91久久久久| 粉嫩av一区二区三区| 天堂成人免费av电影一区| 日本va欧美va精品发布| 国产精品系列在线| 制服丝袜中文字幕一区| 91亚洲精品久久久蜜桃| 国产在线看一区| 无码av中文一区二区三区桃花岛| 欧美国产亚洲另类动漫| 日韩欧美在线不卡| 欧洲色大大久久| 成人性生交大片免费看中文|