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

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

?? pnp.c

?? The Disk sample is used with Classpnp.sys as disk driver. The sample supports Plug and Play, Power M
?? C
?? 第 1 頁 / 共 3 頁
字號:
        }
    #endif

        if(NT_SUCCESS(status)){
            diskData->LinkStatus.WellKnownNameCreated = TRUE;
        }
    }

    if((!diskData->LinkStatus.PhysicalDriveLinkCreated) &&
       (commonExtension->IsFdo)) {

        //
        // Create a physical drive N link using the device number we saved
        // away during AddDevice.
        //

        swprintf(wideSourceName,
                 L"\\DosDevices\\PhysicalDrive%d",
                 commonExtension->PartitionZeroExtension->DeviceNumber);

        RtlInitUnicodeString(&unicodeSourceName, wideSourceName);

        DebugPrint((1, "DiskCreateSymbolicLink: Linking %wZ to %wZ\n",
                    &unicodeSourceName,
                    &(commonExtension->DeviceName)));

        status = IoCreateSymbolicLink(&unicodeSourceName,
                                      &(commonExtension->DeviceName));

#if DBG

        if((status == STATUS_OBJECT_NAME_EXISTS) ||
           (status == STATUS_OBJECT_NAME_COLLISION)) {

            DebugPrint((1, "DiskCreateSymbolicLink: name %wZ already exists\n",
                        &unicodeSourceName));
        }
#endif

        if(NT_SUCCESS(status)) {
            diskData->LinkStatus.PhysicalDriveLinkCreated = TRUE;
        }
    } else if(commonExtension->IsFdo == FALSE) {
        diskData->LinkStatus.PhysicalDriveLinkCreated = FALSE;
    }

    return;
}


VOID
DiskDeleteSymbolicLinks(
    IN PDEVICE_OBJECT DeviceObject
    )

/*++

Routine Description:

    This routine will delete the well known name (symlink) for the specified
    device.  It generates the link name using information stored in the
    device extension

Arguments:

    DeviceObject - the device object we are unlinking

Return Value:

    status

--*/

{
    PCOMMON_DEVICE_EXTENSION commonExtension = DeviceObject->DeviceExtension;
    PDISK_DATA diskData = commonExtension->DriverData;

    WCHAR wideLinkName[64];
    UNICODE_STRING unicodeLinkName;

    PAGED_CODE();

    if(diskData->LinkStatus.WellKnownNameCreated) {

        swprintf(wideLinkName,
                 L"\\Device\\Harddisk%d\\Partition%d",
                 commonExtension->PartitionZeroExtension->DeviceNumber,
                 (commonExtension->IsFdo ? 0 :
                                           commonExtension->PartitionNumber));

        RtlInitUnicodeString(&unicodeLinkName, wideLinkName);

        IoDeleteSymbolicLink(&unicodeLinkName);

        diskData->LinkStatus.WellKnownNameCreated = FALSE;
    }

    if(diskData->LinkStatus.PhysicalDriveLinkCreated) {

        ASSERT_FDO(DeviceObject);

        swprintf(wideLinkName,
                 L"\\DosDevices\\PhysicalDrive%d",
                 commonExtension->PartitionZeroExtension->DeviceNumber);

        RtlInitUnicodeString(&unicodeLinkName, wideLinkName);

        IoDeleteSymbolicLink(&unicodeLinkName);

        diskData->LinkStatus.PhysicalDriveLinkCreated = FALSE;
    }

    return;
}


NTSTATUS
DiskRemoveDevice(
    IN PDEVICE_OBJECT DeviceObject,
    IN UCHAR Type
    )

/*++

Routine Description:

    This routine will release any resources the device may have allocated for
    this device object and return.

Arguments:

    DeviceObject - the device object being removed

Return Value:

    status

--*/

{
    PCOMMON_DEVICE_EXTENSION commonExtension = DeviceObject->DeviceExtension;
    PDISK_DATA diskData = commonExtension->DriverData;

    PAGED_CODE();

    //
    // Handle query and cancel
    //

    if((Type == IRP_MN_QUERY_REMOVE_DEVICE) ||
       (Type == IRP_MN_CANCEL_REMOVE_DEVICE))  {
        return STATUS_SUCCESS;
    }

    if(commonExtension->IsFdo) {

        PFUNCTIONAL_DEVICE_EXTENSION fdoExtension =
            DeviceObject->DeviceExtension;

        //
        // Purge the cached partition table (if any).
        //

        DiskAcquirePartitioningLock(fdoExtension);
        DiskInvalidatePartitionTable(fdoExtension, TRUE);
        DiskReleasePartitioningLock(fdoExtension);

        //
        // Delete our object directory.
        //

        if(fdoExtension->AdapterDescriptor) {
            ExFreePool(fdoExtension->AdapterDescriptor);
            fdoExtension->AdapterDescriptor = NULL;
        }

        if(fdoExtension->DeviceDescriptor) {
            ExFreePool(fdoExtension->DeviceDescriptor);
            fdoExtension->DeviceDescriptor = NULL;
        }

        if(fdoExtension->SenseData) {
            ExFreePool(fdoExtension->SenseData);
            fdoExtension->SenseData = NULL;
        }

        if(fdoExtension->DeviceDirectory != NULL) {
            ZwMakeTemporaryObject(fdoExtension->DeviceDirectory);
            ZwClose(fdoExtension->DeviceDirectory);
            fdoExtension->DeviceDirectory = NULL;
        }

        if(Type == IRP_MN_REMOVE_DEVICE) {
            IoGetConfigurationInformation()->DiskCount--;
        }

    } else {

        PPHYSICAL_DEVICE_EXTENSION pdoExtension = DeviceObject->DeviceExtension;

    }

    DiskDeleteSymbolicLinks(DeviceObject);

    //
    // Release the mounted device interface if we've set it.
    //

    if(diskData->PartitionInterfaceString.Buffer != NULL) {
        IoSetDeviceInterfaceState(&(diskData->PartitionInterfaceString), FALSE);
        RtlFreeUnicodeString(&(diskData->PartitionInterfaceString));
        RtlInitUnicodeString(&(diskData->PartitionInterfaceString), NULL);
    }
    if(diskData->DiskInterfaceString.Buffer != NULL) {
        IoSetDeviceInterfaceState(&(diskData->DiskInterfaceString), FALSE);
        RtlFreeUnicodeString(&(diskData->DiskInterfaceString));
        RtlInitUnicodeString(&(diskData->DiskInterfaceString), NULL);
    }

    ClassDeleteSrbLookasideList(commonExtension);
    return STATUS_SUCCESS;
}


NTSTATUS
DiskStartFdo(
    IN PDEVICE_OBJECT Fdo
    )

/*++

Routine Description:

    This routine will query the underlying device for any information necessary
    to complete initialization of the device.  This will include physical
    disk geometry, mode sense information and such.

    This routine does not perform partition enumeration - that is left to the
    re-enumeration routine

    If this routine fails it will return an error value.  It does not clean up
    any resources - that is left for the Stop/Remove routine.

Arguments:

    Fdo - a pointer to the functional device object for this device

Return Value:

    status

--*/

{
    PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = Fdo->DeviceExtension;
    PCOMMON_DEVICE_EXTENSION commonExtension = &(fdoExtension->CommonExtension);
    PDISK_DATA diskData = commonExtension->DriverData;
    STORAGE_HOTPLUG_INFO hotplugInfo;
    ULONG writeCacheOverride = DiskWriteCacheDefault;
    DISK_CACHE_INFORMATION cacheInfo;
    NTSTATUS status;

    PAGED_CODE();

    //
    // Get the hotplug information, so we can turn off write cache if needed
    //
    // NOTE: Capabilities info is not good enough to determine hotplugedness
    //       as  we cannot determine device relations  information and other
    //       dependencies. Get the hotplug info instead
    //

    {
        PIRP irp;
        KEVENT event;
        IO_STATUS_BLOCK statusBlock;

        KeInitializeEvent(&event, SynchronizationEvent, FALSE);
        RtlZeroMemory(&hotplugInfo, sizeof(STORAGE_HOTPLUG_INFO));

        irp = IoBuildDeviceIoControlRequest(IOCTL_STORAGE_GET_HOTPLUG_INFO,
                                            Fdo,
                                            NULL,
                                            0L,
                                            &hotplugInfo,
                                            sizeof(STORAGE_HOTPLUG_INFO),
                                            FALSE,
                                            &event,
                                            &statusBlock);

        if (irp != NULL) {

            // send to self -- classpnp handles this
            status = IoCallDriver(Fdo, irp);
            if (status == STATUS_PENDING) {
                KeWaitForSingleObject(&event,
                                      Executive,
                                      KernelMode,
                                      FALSE,
                                      NULL);
                status = statusBlock.Status;
            }
        }
    }

    //
    // Clear the DEV_WRITE_CACHE flag now  and set
    // it below only if we read that from the disk
    //

    CLEAR_FLAG(fdoExtension->DeviceFlags, DEV_WRITE_CACHE);

    if (TEST_FLAG(fdoExtension->ScanForSpecialFlags, CLASS_SPECIAL_DISABLE_WRITE_CACHE))
    {
        //
        // This flag overrides the user's  setting, because  faulty firmware
        // may cause the filesystem to refuse to format media on this device
        //
        DebugPrint((1,
                    "DiskStartFdo: Shutting off write cache for %p due to %s\n",
                    Fdo,
                    "Possible Firmware Issue"));

        writeCacheOverride = DiskWriteCacheDisable;
    }
    else
    {
        //
        // Look into the registry to  see if the user
        // has chosen to override the default setting
        //
        ClassGetDeviceParameter(fdoExtension,
                                DiskDeviceParameterSubkey,
                                DiskDeviceUserWriteCacheSetting,
                                &writeCacheOverride);

        if (writeCacheOverride == DiskWriteCacheDefault)
        {
            //
            // The user has not overridden the default settings
            //
            if (hotplugInfo.DeviceHotplug && !hotplugInfo.WriteCacheEnableOverride)
            {
                DebugPrint((1,
                            "DiskStartFdo: Shutting off write cache for %p due to %s\n",
                            Fdo,
                            "Hotplug Device"));

                writeCacheOverride = DiskWriteCacheDisable;
            }
            else if (hotplugInfo.MediaHotplug)
            {
                DebugPrint((1,
                            "DiskStartFdo: Shutting off write cache for %p due to %s\n",
                            Fdo,
                            "Hotplug (unlockable) Media"));

                writeCacheOverride = DiskWriteCacheDisable;
            }
            else
            {
                //
                // We enable write cache if this device has no specific issues
                //
                writeCacheOverride = DiskWriteCacheEnable;
            }
        }
    }

    //
    // Query the disk to see if write cache is enabled
    // and  set the DEV_WRITE_CACHE flag appropriately
    //

    RtlZeroMemory(&cacheInfo, sizeof(DISK_CACHE_INFORMATION));

    status = DiskGetCacheInformation(fdoExtension, &cacheInfo);

    if (NT_SUCCESS(status))
    {
        if (cacheInfo.WriteCacheEnabled == TRUE)
        {
            if (writeCacheOverride == DiskWriteCacheDisable)
            {
                //
                // Write cache is currently enabled on this
                // device, but we would like to turn it off
                //
                cacheInfo.WriteCacheEnabled = FALSE;

                status = DiskSetCacheInformation(fdoExtension, &cacheInfo);
            }
            else
            {
                //
                // The write cache setting either matches
                // our needs or we don't care
                //
                SET_FLAG(fdoExtension->DeviceFlags, DEV_WRITE_CACHE);
            }
        }
        else
        {
            if (writeCacheOverride == DiskWriteCacheEnable)
            {
                //
                // Write cache is currently disabled on this
                // device, but we  would  like to turn it on
                //
                cacheInfo.WriteCacheEnabled = TRUE;

                status = DiskSetCacheInformation(fdoExtension, &cacheInfo);

                SET_FLAG(fdoExtension->DeviceFlags, DEV_WRITE_CACHE);
            }
        }
    }

    //
    // In the event that there's a cached partition table flush it now.
    //

    DiskAcquirePartitioningLock(fdoExtension);
    DiskInvalidatePartitionTable(fdoExtension, TRUE);
    DiskReleasePartitioningLock(fdoExtension);

    //
    // Get the SCSI address if it's available for use with SMART ioctls.
    //

    {
        PIRP irp;
        KEVENT event;
        IO_STATUS_BLOCK statusBlock;

        KeInitializeEvent(&event, SynchronizationEvent, FALSE);

        irp = IoBuildDeviceIoControlRequest(IOCTL_SCSI_GET_ADDRESS,
                                            commonExtension->LowerDeviceObject,
                                            NULL,
                                            0L,
                                            &(diskData->ScsiAddress),
                                            sizeof(SCSI_ADDRESS),
                                            FALSE,
                                            &event,
                                            &statusBlock);

        if(irp != NULL) {


            status = IoCallDriver(commonExtension->LowerDeviceObject, irp);

            if(status == STATUS_PENDING) {
                KeWaitForSingleObject(&event,
                                      Executive,
                                      KernelMode,
                                      FALSE,
                                      NULL);
                status = statusBlock.Status;
            }
        }
    }

    return STATUS_SUCCESS;

} // end DiskStartFdo()

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日韩在线不卡| 伊人一区二区三区| 亚洲欧美成人一区二区三区| 亚洲福利视频一区| 成人性色生活片免费看爆迷你毛片| 在线视频综合导航| 国产精品私人自拍| 久久精品国产999大香线蕉| 在线亚洲+欧美+日本专区| 欧美国产日韩精品免费观看| 免费看黄色91| 欧美一区二区三区小说| 亚洲综合色视频| 99国产精品国产精品久久| 久久久久久久性| 激情文学综合插| 欧美一级爆毛片| 麻豆精品在线看| 91麻豆精品91久久久久同性| 一区二区三区日韩在线观看| av电影在线观看一区| 欧美激情中文字幕一区二区| 国产精一区二区三区| 久久久蜜桃精品| 国产一区美女在线| 精品国产乱码久久久久久夜甘婷婷| 亚洲444eee在线观看| 欧美网站一区二区| 午夜精品久久久久久久久| 91精品婷婷国产综合久久| 亚洲bdsm女犯bdsm网站| 欧美精品在线观看播放| 日韩经典一区二区| 日韩午夜激情电影| 精品一区二区久久久| 欧美www视频| 国产大陆亚洲精品国产| 国产精品午夜久久| aaa欧美色吧激情视频| 中文字幕一区二区视频| 99久久精品免费精品国产| 成人免费在线视频| 91高清视频免费看| 免费看欧美女人艹b| 久久免费国产精品| 99久久精品国产导航| 亚洲已满18点击进入久久| 91精品国产综合久久国产大片| 免费高清成人在线| 欧美国产精品一区| 欧美在线|欧美| 久久精品免费看| 中文字幕中文字幕一区| 欧美在线不卡一区| 蜜桃av一区二区在线观看| 久久久国产精品麻豆| 色狠狠色噜噜噜综合网| 人人精品人人爱| 国产女人18毛片水真多成人如厕| 9l国产精品久久久久麻豆| 亚洲国产成人av| 久久蜜桃香蕉精品一区二区三区| 99热这里都是精品| 三级欧美韩日大片在线看| 国产精品美女久久久久久久| 欧美日韩一区二区三区在线| 国产在线视频不卡二| 亚洲视频一区在线| 欧美一级国产精品| 99精品热视频| 久久精品国产免费看久久精品| 亚洲同性同志一二三专区| 日韩欧美国产综合在线一区二区三区| 国产成人av自拍| 日韩国产精品久久久久久亚洲| 久久人人97超碰com| 在线观看视频91| 国产成人免费在线观看| 日本女人一区二区三区| 中文字幕一区免费在线观看| 欧美不卡一区二区| 色综合视频一区二区三区高清| 另类中文字幕网| 亚洲成av人片观看| 亚洲视频一区在线| 久久久久久久久久久久电影 | 国产成人鲁色资源国产91色综| 亚洲欧美视频在线观看视频| 久久综合九色欧美综合狠狠| 91福利在线看| 成年人国产精品| 国产成人啪免费观看软件| 青青草97国产精品免费观看无弹窗版| 国产精品免费久久| 久久精品一二三| 欧美mv和日韩mv的网站| 欧美日韩免费观看一区三区| av一区二区三区在线| 国产露脸91国语对白| 日av在线不卡| 丝袜诱惑亚洲看片| 亚洲mv大片欧洲mv大片精品| 亚洲精品高清视频在线观看| 欧美激情中文字幕| 日本一区二区三区视频视频| 久久久久免费观看| 精品不卡在线视频| 精品国产乱子伦一区| 精品国产亚洲在线| 亚洲精品一区二区三区蜜桃下载| 91精品久久久久久久99蜜桃| 欧美日韩国产不卡| 91精品国模一区二区三区| 91精品国产色综合久久不卡电影| 欧美日韩激情一区二区| 7777精品伊人久久久大香线蕉 | 久久久青草青青国产亚洲免观| 欧美一级高清片| 精品久久免费看| 精品国产乱码久久久久久免费| 精品日韩一区二区三区| 久久精品亚洲一区二区三区浴池| www成人在线观看| 久久久久久久久久久久久女国产乱| 久久综合网色—综合色88| 国产日韩高清在线| 国产精品全国免费观看高清 | 在线一区二区三区四区| 日本精品视频一区二区三区| 91色porny| 欧美一区二区三区四区五区| 欧美电影免费观看完整版| 欧美国产欧美综合| 亚洲欧美电影院| 日本欧美加勒比视频| 国产乱淫av一区二区三区| 99riav久久精品riav| 这里只有精品99re| 日本一区二区动态图| 亚洲一区二区三区精品在线| 久草在线在线精品观看| heyzo一本久久综合| 欧美日韩一区二区三区免费看| 欧美一区二区三区在线| 欧美激情综合五月色丁香| 亚洲成人免费av| 国产精品一二三四区| 欧美综合视频在线观看| 精品福利视频一区二区三区| 中文字幕一区二区三区不卡在线| 亚洲成在人线免费| 高清不卡一区二区在线| 欧美区视频在线观看| 国产婷婷一区二区| 日日夜夜精品视频天天综合网| 激情综合色综合久久| 91天堂素人约啪| 亚洲精品一区二区三区香蕉| 一区二区在线观看av| 精品影视av免费| 欧美在线观看18| 国产精品福利影院| 免费一级片91| 在线区一区二视频| 国产欧美精品一区二区色综合朱莉| 亚洲电影视频在线| 成人av在线资源| 精品国产免费视频| 丝袜亚洲另类丝袜在线| 91国在线观看| 国产日韩视频一区二区三区| 视频一区视频二区中文| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 91在线一区二区| 国产亚洲欧美在线| 激情文学综合网| 欧美一级在线免费| 亚洲成人一区在线| 91国模大尺度私拍在线视频| 国产精品久久久久久久久搜平片| 蜜桃精品视频在线观看| 欧美一区二区三区在线看| 亚洲成av人在线观看| 欧美亚洲动漫制服丝袜| 亚洲色图都市小说| 粉嫩一区二区三区性色av| 精品久久人人做人人爽| 久久精品国产秦先生| 日韩欧美不卡在线观看视频| 日韩国产精品久久久久久亚洲| 欧美在线短视频| 午夜国产精品一区| 在线综合亚洲欧美在线视频| 天天做天天摸天天爽国产一区| 在线免费精品视频| 亚洲妇女屁股眼交7| 欧美日韩国产色站一区二区三区| 亚洲天堂2016| 91成人国产精品| 日韩主播视频在线|