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

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

?? d12.c

?? PHILIPS USB芯片 D12 的通用驅動,VC++ 平臺
?? 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一区二区三区免费野_久草精品视频
99久久伊人久久99| 日韩av不卡在线观看| 不卡高清视频专区| 亚洲精品写真福利| 色综合激情久久| 丝袜国产日韩另类美女| 日韩你懂的电影在线观看| 久久国产精品一区二区| 337p粉嫩大胆噜噜噜噜噜91av| 国产一区二区三区观看| 中文字幕在线一区| 欧美亚洲国产怡红院影院| 午夜精品久久久久久久99樱桃| 91精品国产综合久久久蜜臀图片 | 国产精品少妇自拍| 成人91在线观看| 婷婷夜色潮精品综合在线| 精品国产一区二区精华| 成人h版在线观看| 午夜欧美在线一二页| 精品国产污污免费网站入口 | 欧美亚洲国产bt| 裸体一区二区三区| 欧美国产精品中文字幕| 91福利国产成人精品照片| 午夜精品123| 亚洲国产精品二十页| 在线免费观看成人短视频| 久久99国产乱子伦精品免费| 亚洲欧洲国产专区| 884aa四虎影成人精品一区| 国产寡妇亲子伦一区二区| 亚洲一区电影777| 欧美国产乱子伦| 日韩美女主播在线视频一区二区三区 | av一区二区三区黑人| 免费观看成人av| 亚洲猫色日本管| 久久久久国产成人精品亚洲午夜| 在线观看免费视频综合| 国产乱国产乱300精品| 亚洲国产中文字幕在线视频综合 | 91精品国产欧美一区二区成人| 国产成人综合自拍| 蜜桃av一区二区三区| 亚洲男女毛片无遮挡| 久久精子c满五个校花| 5566中文字幕一区二区电影| 91久久香蕉国产日韩欧美9色| 麻豆91小视频| 视频一区在线播放| 伊人开心综合网| 亚洲欧洲成人av每日更新| 久久综合九色综合97婷婷| 欧美精品乱人伦久久久久久| 91丨国产丨九色丨pron| 成人av中文字幕| 国产成人啪免费观看软件| 麻豆国产一区二区| 日韩精品成人一区二区在线| 亚洲自拍与偷拍| 亚洲老司机在线| 成人免费小视频| 中文字幕五月欧美| 国产欧美日韩精品一区| 欧美精品一区二区不卡| 日韩欧美综合在线| 欧美乱熟臀69xxxxxx| 欧美日韩国产区一| 欧美色视频在线| 在线观看日韩精品| 色视频一区二区| 欧美影片第一页| 欧美在线free| 欧美三级一区二区| 欧美猛男超大videosgay| 欧美揉bbbbb揉bbbbb| 欧美日韩的一区二区| 欧美日韩二区三区| 欧美蜜桃一区二区三区| 91麻豆精品国产91| 日韩午夜激情免费电影| 欧美成人在线直播| 久久精品在这里| 国产欧美日韩中文久久| 国产精品久久久久久久久晋中| 国产精品乱码人人做人人爱 | 日韩欧美在线123| 精品国产电影一区二区| 久久久午夜精品| 国产精品久久国产精麻豆99网站| 国产精品美女久久久久高潮| 亚洲日本护士毛茸茸| 亚洲丰满少妇videoshd| 美女视频黄 久久| 粉嫩一区二区三区在线看 | 日本福利一区二区| 欧美精品电影在线播放| 欧美白人最猛性xxxxx69交| 国产女人aaa级久久久级| 一区二区三区在线视频免费| 午夜a成v人精品| 久久精品99久久久| 国产99久久久国产精品潘金网站| 成人国产在线观看| 欧美中文字幕一区二区三区| 欧美一级理论性理论a| 久久久精品一品道一区| 亚洲色图欧美激情| 免费观看在线综合| 成人精品免费看| 欧美日韩mp4| 国产精品网站一区| 亚洲午夜在线视频| 韩国在线一区二区| 色爱区综合激月婷婷| 制服.丝袜.亚洲.中文.综合| 国产午夜三级一区二区三| 亚洲色图欧美激情| 韩国精品久久久| 欧美艳星brazzers| 亚洲精品一区二区三区福利| 亚洲精品中文在线观看| 国产在线一区二区| 在线免费av一区| 国产精品麻豆欧美日韩ww| 美女网站色91| 欧洲视频一区二区| 欧美激情艳妇裸体舞| 久久激情五月婷婷| 欧美性猛交一区二区三区精品| 精品国产1区二区| 性感美女极品91精品| 成人h动漫精品| 精品久久久久一区| 亚洲国产日韩在线一区模特| 国产aⅴ综合色| 91精品国产欧美日韩| **欧美大码日韩| 国产精品综合久久| 8x福利精品第一导航| 一区二区三区不卡在线观看| 国产大片一区二区| 日韩精品一区二区三区视频| 亚洲电影一级片| 91丨九色丨蝌蚪富婆spa| 亚洲国产精品成人综合| 狠狠色丁香婷婷综合久久片| 91精品国产一区二区三区香蕉| 亚洲蜜臀av乱码久久精品蜜桃| 国产成人免费在线视频| 久久久青草青青国产亚洲免观| 免费观看30秒视频久久| 欧美二区乱c少妇| 亚洲狠狠爱一区二区三区| 91福利区一区二区三区| 一区二区三区四区在线免费观看| 成人免费毛片app| 国产拍欧美日韩视频二区| 国内成人自拍视频| 精品欧美久久久| 久久国产精品一区二区| 欧美成人高清电影在线| 全部av―极品视觉盛宴亚洲| 欧美二区乱c少妇| 日韩不卡在线观看日韩不卡视频| 欧美性一区二区| 亚洲福利一二三区| 欧美日本国产视频| 天天爽夜夜爽夜夜爽精品视频| 欧美色网一区二区| 亚洲第一精品在线| 欧美日韩精品三区| 三级亚洲高清视频| 日韩三级精品电影久久久| 久久成人麻豆午夜电影| 精品国产免费久久| 国产成人福利片| 亚洲视频一二三区| 在线影视一区二区三区| 亚洲成人综合网站| 欧美成人一区二区三区片免费| 国内精品不卡在线| 中文字幕一区二区三区不卡在线 | 欧美精品v国产精品v日韩精品| 亚洲国产日韩a在线播放性色| 91麻豆精品国产91久久久更新时间| 日本视频一区二区三区| 久久久久久免费| 91视视频在线观看入口直接观看www | 亚洲成在人线在线播放| 日韩一级二级三级| 国产精品18久久久久久久久久久久| 国产精品麻豆视频| 欧美日韩亚洲不卡| 精品无人区卡一卡二卡三乱码免费卡| 久久久久久久av麻豆果冻| 99久久免费精品| 奇米一区二区三区| 国产精品视频一二|