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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? d12.c

?? s3c44b0的USB測試源碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
    // Free up any interface structures
    //

    if (deviceExtension->Interface) {
        ExFreePool(deviceExtension->Interface);
    }

    D12_KdPrint (("D12TEST.SYS: exit D12_RemoveDevice (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
D12_StopDevice(
    IN  PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    Stops a given instance of a 82930 device on the USB, this is only
    stuff we need to do if the device is still present.

Arguments:

    DeviceObject - pointer to the device object for this instance of a 82930

Return Value:

    NT status code

--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PURB urb;
    ULONG siz;

    D12_KdPrint (("D12TEST.SYS: enter D12_StopDevice\n"));

	D12_CancelAllPendingIrps(DeviceObject);

    //
    // Send the select configuration urb with a NULL pointer for the configuration
    // handle, this closes the configuration and puts the device in the 'unconfigured'
    // state.
    //

    siz = sizeof(struct _URB_SELECT_CONFIGURATION);

    urb = ExAllocatePool(NonPagedPool,
                         siz);

    if (urb) {
        NTSTATUS status;

        UsbBuildSelectConfigurationRequest(urb,
                                          (USHORT) siz,
                                          NULL);

        status = D12_CallUSBD(DeviceObject, urb);

        D12_KdPrint (("D12TEST.SYS: Device Configuration Closed status = %x usb status = %x.\n",
                        status, urb->UrbHeader.Status));

        ExFreePool(urb);
    } else {
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    D12_KdPrint (("D12TEST.SYS: exit D12_StopDevice (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
D12_PnPAddDevice(
    IN PDRIVER_OBJECT DriverObject,
    IN PDEVICE_OBJECT PhysicalDeviceObject
    )
/*++

Routine Description:

    This routine is called to create a new instance of the device

Arguments:

    DriverObject - pointer to the driver object for this instance of D12

    PhysicalDeviceObject - pointer to a device object created by the bus

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS                ntStatus = STATUS_SUCCESS;
    PDEVICE_OBJECT          deviceObject = NULL;
    PDEVICE_EXTENSION       deviceExtension;
    USBD_VERSION_INFORMATION versionInformation;
    static ULONG instance = 0;

    D12_KdPrint (("D12TEST.SYS: enter D12_PnPAddDevice\n"));

    //
    // create our funtional device object (FDO)
    //

    ntStatus =
        BulkUsb_CreateDeviceObject(DriverObject, PhysicalDeviceObject, &deviceObject);

    if (NT_SUCCESS(ntStatus)) {
        deviceExtension = deviceObject->DeviceExtension;

        deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;

        //
        // we support direct io for read/write
        //
        deviceObject->Flags |= DO_DIRECT_IO;


        //** initialize our device extension
        //
        // remember the Physical device Object
        //
        deviceExtension->PhysicalDeviceObject=PhysicalDeviceObject;

        //
        // Attach to the PDO
        //

        deviceExtension->TopOfStackDeviceObject =
            IoAttachDeviceToDeviceStack(deviceObject, PhysicalDeviceObject);

        D12_QueryCapabilities(PhysicalDeviceObject,
                                 &deviceExtension->DeviceCapabilities);            

        //
        // display the device  caps
        //
#if DBG
        {
        ULONG i;
        
        D12_KdPrint(("D12TEST.SYS:  >>>>>> DeviceCaps\n"));  
        D12_KdPrint(("D12TEST.SYS:  SystemWake = (%d)\n", 
            deviceExtension->DeviceCapabilities.SystemWake));    
        D12_KdPrint(("D12TEST.SYS:  DeviceWake = (D%d)\n",
            deviceExtension->DeviceCapabilities.DeviceWake-1));

        for (i=PowerSystemUnspecified; i< PowerSystemMaximum; i++) {
            
            D12_KdPrint(("D12TEST.SYS:  Device State Map: sysstate %d = devstate 0x%x\n", i, 
                 deviceExtension->DeviceCapabilities.DeviceState[i]));       
        }
        D12_KdPrint(("D12TEST.SYS:  '<<<<<<<<DeviceCaps\n"));
        }
#endif
        //
        // transition to zero signals the event
        //
        D12_IncrementIoCount(deviceObject);                                 
    }

    USBD_GetUSBDIVersion(&versionInformation);

    D12_KdPrint (("D12TEST.SYS: exit D12_PnPAddDevice (%x)\n", ntStatus));

    return ntStatus;
}

NTSTATUS
BulkUsb_SymbolicLink(
    IN PDEVICE_OBJECT DeviceObject,
    IN OUT PUNICODE_STRING deviceLinkUnicodeString

    )
/*++

Routine Description:

    This routine is called to create and initialize
    a GUID-based symbolic link to our device to be used to open/create 
    instances of us from user mode.

    Called from BulkUsb_CreateDeviceObject() to create the link. 

Arguments:

    DeviceObject - pointer to our Physical Device Object ( PDO )

    deviceLinkUnicodeString - Points to a unicode string structure allocated by the caller. 
        If this routine is successful, it initializes the unicode string and allocates 
        the string buffer containing the kernel-mode path to the symbolic link for this 
        device interface. 


Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/{
    NTSTATUS ntStatus = STATUS_SUCCESS;


    //  Create the symbolic link
     
    // IoRegisterDeviceInterface registers device functionality (a device interface) 
    // that a driver will enable for use by applications or other system components.

    ntStatus = IoRegisterDeviceInterface(
                DeviceObject,
                (LPGUID)&GUID_CLASS_D12_BULK,
                NULL,
                deviceLinkUnicodeString);

   if (NT_SUCCESS(ntStatus)) {

       // IoSetDeviceInterfaceState enables or disables a previously 
       // registered device interface. Applications and other system components 
       // can open only interfaces that are enabled.

        ntStatus = IoSetDeviceInterfaceState(deviceLinkUnicodeString, TRUE);


    }

    return ntStatus;
}



NTSTATUS
BulkUsb_CreateDeviceObject(
    IN PDRIVER_OBJECT DriverObject,
    IN PDEVICE_OBJECT PhysicalDeviceObject,
    IN PDEVICE_OBJECT *DeviceObject
    )
/*++

Routine Description:

    Creates a Functional DeviceObject

Arguments:

    DriverObject - pointer to the driver object for device

    DeviceObject - pointer to DeviceObject pointer to return
                    created device object.

    Instance - instance of the device create.

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS ntStatus;
    UNICODE_STRING deviceLinkUnicodeString;
    PDEVICE_EXTENSION deviceExtension;
    USHORT i;


    ntStatus = BulkUsb_SymbolicLink( PhysicalDeviceObject, &deviceLinkUnicodeString );


    if (NT_SUCCESS(ntStatus)) {

        ntStatus = IoCreateDevice (DriverObject,
                           sizeof (DEVICE_EXTENSION),
                           NULL,
                           FILE_DEVICE_UNKNOWN,
                           FILE_AUTOGENERATED_DEVICE_NAME,
                           FALSE,
                           DeviceObject);

 
        if (!NT_SUCCESS(ntStatus))  {
             return ntStatus;
        }


        // Name buffer for our named Functional device object link
        // The name is generated based on the driver's class GUID
        deviceExtension = (PDEVICE_EXTENSION) ((*DeviceObject)->DeviceExtension);

        RtlCopyMemory(deviceExtension->DeviceLinkNameBuffer,
                      deviceLinkUnicodeString.Buffer,
                      deviceLinkUnicodeString.Length);
        deviceExtension->DeviceDescriptor = NULL;
        deviceExtension->Interface = NULL;
        deviceExtension->ConfigurationHandle = NULL;
        deviceExtension->AcceptingRequests = TRUE;
        deviceExtension->PendingIoCount = 0;
        deviceExtension->UserEvent = NULL;

        KeInitializeEvent(&deviceExtension->RemoveEvent, NotificationEvent, FALSE);

        for (i=0; i<D12_MAX_PIPES; i++) {
            deviceExtension->PipeList[i].PipeInfo = NULL;
        }

		RtlFreeUnicodeString( &deviceLinkUnicodeString );
    }


    return ntStatus;
}



NTSTATUS
D12_CallUSBD(
    IN PDEVICE_OBJECT DeviceObject,
    IN PURB Urb
    )
/*++

Routine Description:

    Passes a URB to the USBD class driver

Arguments:

    DeviceObject - pointer to the device object for this instance of an 82930

    Urb - pointer to Urb request block

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS ntStatus, status = STATUS_SUCCESS;
    PDEVICE_EXTENSION deviceExtension;
    PIRP irp;
    KEVENT event;
    IO_STATUS_BLOCK ioStatus;
    PIO_STACK_LOCATION nextStack;

    D12_KdPrint (("D12TEST.SYS: enter D12_CallUSBD\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    //
    // issue a synchronous request
    //

    KeInitializeEvent(&event, NotificationEvent, FALSE);

    irp = IoBuildDeviceIoControlRequest(
                IOCTL_INTERNAL_USB_SUBMIT_URB,
                deviceExtension->TopOfStackDeviceObject,
                NULL,
                0,
                NULL,
                0,
                TRUE, /* INTERNAL */
                &event,
                &ioStatus);

    //
    // Call the class driver to perform the operation.  If the returned status
    // is PENDING, wait for the request to complete.
    //

    nextStack = IoGetNextIrpStackLocation(irp);
    ASSERT(nextStack != NULL);

    //
    // pass the URB to the USB driver stack
    //
    nextStack->Parameters.Others.Argument1 = Urb;


    D12_KdPrint (("D12TEST.SYS: calling USBD\n"));

    ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject,
                            irp);

    D12_KdPrint (("D12TEST.SYS: return from IoCallDriver USBD %x\n", ntStatus));

    if (ntStatus == STATUS_PENDING) {
        D12_KdPrint (("D12TEST.SYS: Wait for single object\n"));

        status = KeWaitForSingleObject(
                       &event,
                       Suspended,
                       KernelMode,
                       FALSE,
                       NULL);

        D12_KdPrint (("D12TEST.SYS: Wait for single object, returned %x\n", status));

    } else {
        ioStatus.Status = ntStatus;
    }

    D12_KdPrint (("D12TEST.SYS: URB status = %x status = %x irp status %x\n",
        Urb->UrbHeader.Status, status, ioStatus.Status));

    //
    // USBD maps the error code for us
    //
    ntStatus = ioStatus.Status;

    D12_KdPrint (("D12TEST.SYS: exit D12_CallUSBD (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
D12_ConfigureDevice(
    IN  PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    Initializes a given instance of the device on the USB and selects the
    configuration.

Arguments:

    DeviceObject - pointer to the device object for this instance of the 82930
                    devcice.


Return Value:

    NT status code

--*/
{
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus;
    PURB urb;
    ULONG siz;
    PUSB_CONFIGURATION_DESCRIPTOR configurationDescriptor = NULL;

    D12_KdPrint (("D12TEST.SYS: enter D12_ConfigureDevice\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    //
    // first configure the device
    //

    urb = ExAllocatePool(NonPagedPool,
                         sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST));

    if (urb) {

        // BUGBUG 82930 chokes if on the next command if you don't get
        // the entire descriptor on the first try

        siz = sizeof(USB_CONFIGURATION_DESCRIPTOR)+256;

get_config_descriptor_retry:

        configurationDescriptor = ExAllocatePool(NonPagedPool,
                                                 siz);

        if (configurationDescriptor) {

            UsbBuildGetDescriptorRequest(urb,
                                         (USHORT) sizeof (struct _URB_CONTROL_DESCRIPTOR_REQUEST),
                                         USB_CONFIGURATION_DESCRIPTOR_TYPE,
                                         0,
                                         0,
                                         configurationDescriptor,
                                         NULL,
                                         siz,
                                         NULL);

            ntStatus = D12_CallUSBD(DeviceObject, urb);

            D12_KdPrint (("D12TEST.SYS: Configuration Descriptor = %x, len %x\n",
                            configurationDescriptor,
                            urb->UrbControlDescriptorRequest.TransferBufferLength));
        } else {
            ntStatus = STATUS_INSUFFICIENT_RESOURCES;
        }

        //
        // if we got some data see if it was enough.
        //
        // NOTE: we may get an error in URB because of buffer overrun
        if (urb->UrbControlDescriptorRequest.TransferBufferLength>0 &&
                configurationDescriptor->wTotalLength > siz) {

            siz = configurationDescriptor->wTotalLength;
            ExFreePool(configurationDescriptor);
            configurationDescriptor = NULL;
            goto get_config_descriptor_retry;
        }

        ExFreePool(urb);

    } else {
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    if (configurationDescriptor) {

        //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区二区三区四区 | 欧美伊人久久久久久久久影院| 韩国精品在线观看| 蜜桃免费网站一区二区三区| 午夜电影一区二区三区| 亚洲国产精品综合小说图片区| 亚洲免费观看高清完整版在线| 国产精品第五页| 日韩一区在线看| 一区二区三区中文在线| 亚洲一区二区高清| 香蕉久久夜色精品国产使用方法| 亚洲午夜精品在线| 午夜av电影一区| 免费人成网站在线观看欧美高清| 麻豆91免费观看| 国产美女视频91| 豆国产96在线|亚洲| 91老司机福利 在线| 欧美性猛交xxxxxx富婆| 欧美精品久久久久久久多人混战| 欧美疯狂性受xxxxx喷水图片| 欧美一区二区三区在| 精品国产凹凸成av人导航| 久久久蜜臀国产一区二区| 久久精品亚洲乱码伦伦中文| 日韩一区有码在线| 午夜电影网亚洲视频| 麻豆freexxxx性91精品| 成人亚洲一区二区一| 色婷婷综合久久久久中文一区二区| 欧美三级韩国三级日本三斤| 日韩午夜在线播放| 国产欧美精品国产国产专区| 亚洲精品国产a久久久久久 | eeuss鲁一区二区三区| 91欧美一区二区| 91精品国产一区二区三区蜜臀| www激情久久| 亚洲欧美另类小说| 青青草成人在线观看| 丁香激情综合国产| 欧美日韩国产首页| 久久精品人人做| 一区二区三区在线免费视频| 久久er精品视频| 91伊人久久大香线蕉| 欧美一区二区三区不卡| 国产精品―色哟哟| 丝袜美腿亚洲色图| 成人一区二区三区视频在线观看 | 色久综合一二码| 日韩一级片在线观看| 中文字幕免费观看一区| 亚洲大型综合色站| 国产**成人网毛片九色| 欧美日韩国产天堂| 综合激情成人伊人| 国内一区二区在线| 欧美日韩综合在线| 欧美激情一区在线观看| 婷婷丁香久久五月婷婷| 成年人午夜久久久| 日韩精品一区二区在线| 一区二区三区丝袜| 国产成人午夜电影网| 在线成人免费观看| 亚洲日本va午夜在线电影| 国产一区91精品张津瑜| 欧美一级日韩一级| 伊人性伊人情综合网| 国产成人免费av在线| 欧美一区二区成人| 一级做a爱片久久| 成人精品亚洲人成在线| 日韩欧美国产不卡| 三级影片在线观看欧美日韩一区二区| 波多野结衣一区二区三区| 日韩欧美国产电影| 三级在线观看一区二区| 欧美在线观看视频在线| 国产精品嫩草99a| 国产一区在线精品| 日韩色在线观看| 亚洲第一激情av| 在线视频观看一区| 专区另类欧美日韩| 成人av在线一区二区| 欧美国产日韩一二三区| 国产中文一区二区三区| 欧美一区二区三级| 婷婷成人综合网| 欧美丰满美乳xxx高潮www| 亚洲一区中文在线| 欧美亚日韩国产aⅴ精品中极品| 中文字幕一区免费在线观看| 国产ts人妖一区二区| 久久久美女毛片| 激情图片小说一区| 精品国产不卡一区二区三区| 久久精品国产在热久久| 欧美一区二区黄| 日韩**一区毛片| 91精品国产品国语在线不卡| 天堂久久一区二区三区| 欧美精品在线观看一区二区| 视频一区在线视频| 91精品国产色综合久久| 美女视频一区二区| 精品成人一区二区三区| 国产一区二区主播在线| 国产日韩av一区二区| 高清beeg欧美| 一区在线播放视频| 91浏览器打开| 手机精品视频在线观看| 欧美一区二区三区性视频| 久久国内精品视频| 精品国产乱码久久久久久1区2区 | 日韩三级电影网址| 国产一区二区女| 日本一区二区三区免费乱视频 | 色网综合在线观看| 亚洲高清久久久| 日韩一区二区在线观看| 国产在线一区二区| 国产精品水嫩水嫩| 欧洲人成人精品| 日韩av不卡在线观看| 久久久精品2019中文字幕之3| heyzo一本久久综合| 亚洲国产综合视频在线观看| 日韩欧美一区中文| 国产91高潮流白浆在线麻豆| 亚洲美女少妇撒尿| 欧美一级高清片| 国产高清亚洲一区| 亚洲一区二区三区在线看| 欧美精品日韩精品| 国产成人午夜电影网| 亚洲欧美日韩国产手机在线| 欧美人妇做爰xxxⅹ性高电影| 韩国一区二区三区| 亚洲同性gay激情无套| 欧美美女网站色| 国产成人免费视频网站高清观看视频| 亚洲欧美日韩小说| 日韩视频永久免费| 不卡av电影在线播放| 日韩av中文字幕一区二区三区| 国产日产精品1区| 欧美欧美午夜aⅴ在线观看| 国产成人啪免费观看软件| 亚洲一区二区三区四区五区黄| 久久综合色婷婷| 日本韩国精品一区二区在线观看| 美女精品自拍一二三四| 亚洲丝袜制服诱惑| 精品久久久久久久久久久院品网| 99久久国产综合色|国产精品| 日韩和欧美一区二区三区| 中文字幕的久久| 91麻豆精品国产91久久久久| 成人黄色小视频| 美女视频黄 久久| 一区二区三区高清在线| 久久麻豆一区二区| 欧美日韩国产系列| 99v久久综合狠狠综合久久| 另类的小说在线视频另类成人小视频在线| 中文字幕一区在线| 久久综合九色综合欧美98| 欧美精品丝袜久久久中文字幕| 91在线无精精品入口| 国产精品一区二区在线观看网站| 亚洲成国产人片在线观看| 中文字幕一区二区视频| 久久亚洲私人国产精品va媚药| 欧美高清视频在线高清观看mv色露露十八| 成人av午夜影院| 精品亚洲成a人| 日韩专区欧美专区| 一区二区三区日韩在线观看| 国产精品国产自产拍高清av王其 | 国产精品丝袜黑色高跟| 日韩精品一区二区三区四区视频 | 欧美一级欧美三级在线观看| 97aⅴ精品视频一二三区| 国产精品456| 国产综合色精品一区二区三区| 日韩福利视频导航| 亚洲高清不卡在线| 亚洲国产欧美在线人成| 18欧美亚洲精品| 国产欧美一区二区在线| 久久免费精品国产久精品久久久久 | 一本到不卡免费一区二区| 成人午夜精品一区二区三区| 国产伦精品一区二区三区免费迷| 日本不卡一二三|