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

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

?? pnp.c

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

Copyright (C) Microsoft Corporation, 1991 - 1999

Module Name:

    pnp.c

Abstract:

    SCSI disk class driver

Environment:

    kernel mode only

Notes:

Revision History:

--*/

#include "disk.h"

extern PULONG InitSafeBootMode;
ULONG diskDeviceSequenceNumber = 0;

#ifdef ALLOC_PRAGMA

#pragma alloc_text(PAGE, DiskAddDevice)
#pragma alloc_text(PAGE, DiskInitFdo)
#pragma alloc_text(PAGE, DiskInitPdo)
#pragma alloc_text(PAGE, DiskStartFdo)
#pragma alloc_text(PAGE, DiskStartPdo)
#pragma alloc_text(PAGE, DiskQueryId)
#pragma alloc_text(PAGE, DiskGenerateDeviceName)
#pragma alloc_text(PAGE, DiskCreateSymbolicLinks)
#pragma alloc_text(PAGE, DiskDeleteSymbolicLinks)
#pragma alloc_text(PAGE, DiskRemoveDevice)

#endif


NTSTATUS
DiskAddDevice(
    IN PDRIVER_OBJECT DriverObject,
    IN PDEVICE_OBJECT PhysicalDeviceObject
    )

/*++

Routine Description:

    This routine gets a port drivers capabilities, obtains the
    inquiry data, searches the SCSI bus for the port driver and creates
    the device objects for the disks found.

Arguments:

    DriverObject - Pointer to driver object created by system.

    Pdo - Device object use to send requests to port driver.

Return Value:

    True is returned if one disk was found and successfully created.

--*/

{
    ULONG rootPartitionMountable = FALSE;

    PCONFIGURATION_INFORMATION configurationInformation;
    ULONG diskCount;

    NTSTATUS status;

    PAGED_CODE();

    //
    // See if we should be allowing file systems to mount on partition zero.
    //

    TRY {
        HANDLE deviceKey;

        UNICODE_STRING diskKeyName;
        OBJECT_ATTRIBUTES objectAttributes = {0};
        HANDLE diskKey;

        RTL_QUERY_REGISTRY_TABLE queryTable[2] = { 0 };

        status = IoOpenDeviceRegistryKey(PhysicalDeviceObject,
                                         PLUGPLAY_REGKEY_DEVICE,
                                         KEY_READ,
                                         &deviceKey);

        if(!NT_SUCCESS(status)) {
            DebugPrint((1, "DiskAddDevice: Error %#08lx opening device key "
                           "for pdo %#08lx\n",
                        status, PhysicalDeviceObject));
            LEAVE;
        }

        RtlInitUnicodeString(&diskKeyName, L"Disk");
        InitializeObjectAttributes(&objectAttributes,
                                   &diskKeyName,
                                   OBJ_CASE_INSENSITIVE,
                                   deviceKey,
                                   NULL);

        status = ZwOpenKey(&diskKey, KEY_READ, &objectAttributes);
        ZwClose(deviceKey);

        if(!NT_SUCCESS(status)) {
            DebugPrint((1, "DiskAddDevice: Error %#08lx opening disk key "
                           "for pdo %#08lx device key %#x\n",
                        status, PhysicalDeviceObject, deviceKey));
            LEAVE;
        }

        queryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
        queryTable[0].Name = L"RootPartitionMountable";
        queryTable[0].EntryContext = &(rootPartitionMountable);

        status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE,
                                        diskKey,
                                        queryTable,
                                        NULL,
                                        NULL);

        if(!NT_SUCCESS(status)) {
            DebugPrint((1, "DiskAddDevice: Error %#08lx reading value from "
                           "disk key %#x for pdo %#08lx\n",
                        status, diskKey, PhysicalDeviceObject));
        }

        ZwClose(diskKey);

    } FINALLY {

        //
        // Do nothing.
        //

        if(!NT_SUCCESS(status)) {
            DebugPrint((1, "DiskAddDevice: Will %sallow file system to mount on "
                           "partition zero of disk %#08lx\n",
                        (rootPartitionMountable ? "" : "not "),
                        PhysicalDeviceObject));
        }
    }

    //
    // Create device objects for disk
    //

    diskCount = 0;

    status = DiskCreateFdo(
                 DriverObject,
                 PhysicalDeviceObject,
                 &diskCount,
                 (BOOLEAN) !rootPartitionMountable
                 );

    //
    // Get the number of disks already initialized.
    //

    configurationInformation = IoGetConfigurationInformation();

    if (NT_SUCCESS(status)) {

        //
        // Increment system disk device count.
        //

        configurationInformation->DiskCount++;

    }

    return status;

} // end DiskAddDevice()


NTSTATUS
DiskInitFdo(
    IN PDEVICE_OBJECT Fdo
    )

/*++

Routine Description:

    This routine is called to do one-time initialization of new device objects


Arguments:

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

Return Value:

    status

--*/

{
    PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = Fdo->DeviceExtension;
    PDISK_DATA diskData = (PDISK_DATA) fdoExtension->CommonExtension.DriverData;

    ULONG srbFlags = 0;
    ULONG timeOut = 0;
    ULONG bytesPerSector;

    PULONG dmSkew;

    NTSTATUS status = STATUS_SUCCESS;

    PAGED_CODE();

    //
    // Build the lookaside list for srb's for the physical disk. Should only
    // need a couple.  If this fails then we don't have an emergency SRB so
    // fail the call to initialize.
    //

    ClassInitializeSrbLookasideList((PCOMMON_DEVICE_EXTENSION) fdoExtension,
                                    PARTITION0_LIST_SIZE);

    if (fdoExtension->DeviceDescriptor->RemovableMedia)
    {
        SET_FLAG(Fdo->Characteristics, FILE_REMOVABLE_MEDIA);
    }

    //
    // Initialize the srb flags.
    //

    //
    // Because all requests share a common sense buffer, it is possible
    // for the buffer to be overwritten if the port driver completes
    // multiple failed requests that require a request sense before the
    // class driver's completion routine can consume the data in the buffer.
    // To prevent this, we allow the port driver to allocate a unique sense
    // buffer each time it needs one.  We are responsible for freeing this
    // buffer.  This also allows the adapter to be configured to support
    // additional sense data beyond the minimum 18 bytes.
    //

    SET_FLAG(fdoExtension->SrbFlags, SRB_FLAGS_PORT_DRIVER_ALLOCSENSE);

    if (fdoExtension->DeviceDescriptor->CommandQueueing &&
        fdoExtension->AdapterDescriptor->CommandQueueing) {

        SET_FLAG(fdoExtension->SrbFlags, SRB_FLAGS_QUEUE_ACTION_ENABLE);

    }

    //
    // Look for controllers that require special flags.
    //

    ClassScanForSpecial(fdoExtension, DiskBadControllers, DiskSetSpecialHacks);

    srbFlags = fdoExtension->SrbFlags;

    //
    // Clear buffer for drive geometry.
    //

    RtlZeroMemory(&(fdoExtension->DiskGeometry),
                  sizeof(DISK_GEOMETRY));

    //
    // Allocate request sense buffer.
    //

    fdoExtension->SenseData = ExAllocatePoolWithTag(NonPagedPoolCacheAligned,
                                                    SENSE_BUFFER_SIZE,
                                                    DISK_TAG_START);

    if (fdoExtension->SenseData == NULL) {

        //
        // The buffer can not be allocated.
        //

        DebugPrint((1, "DiskInitFdo: Can not allocate request sense buffer\n"));

        status = STATUS_INSUFFICIENT_RESOURCES;
        return status;
    }

    //
    // Physical device object will describe the entire
    // device, starting at byte offset 0.
    //

    fdoExtension->CommonExtension.StartingOffset.QuadPart = (LONGLONG)(0);

    //
    // Set timeout value in seconds.
    //

    timeOut = ClassQueryTimeOutRegistryValue(Fdo);
    if (timeOut) {
        fdoExtension->TimeOutValue = timeOut;
    } else {
        fdoExtension->TimeOutValue = SCSI_DISK_TIMEOUT;
    }

    //
    // If this is a removable drive, build an entry in devicemap\scsi
    // indicating it's physicaldriveN name, set up the appropriate
    // update partitions routine and set the flags correctly.
    // note: only do this after the timeout value is set, above.
    //

    if (TEST_FLAG(Fdo->Characteristics, FILE_REMOVABLE_MEDIA)) {

        ClassUpdateInformationInRegistry( Fdo,
                                          "PhysicalDrive",
                                          fdoExtension->DeviceNumber,
                                          NULL,
                                          0);
        //
        // Enable media change notification for removable disks
        //
        ClassInitializeMediaChangeDetection(fdoExtension,
                                            "Disk");

        diskData->UpdatePartitionRoutine = DiskUpdateRemovablePartitions;

    } else {

        SET_FLAG(fdoExtension->DeviceFlags, DEV_SAFE_START_UNIT);
        SET_FLAG(fdoExtension->SrbFlags, SRB_FLAGS_NO_QUEUE_FREEZE);
        diskData->UpdatePartitionRoutine = DiskUpdatePartitions;

    }

    //
    // Read the drive capacity.  Don't use the disk version of the routine here
    // since we don't know the disk signature yet - the disk version will
    // attempt to determine the BIOS reported geometry.
    //

    ClassReadDriveCapacity(Fdo);

    //
    // Set up sector size fields.
    //
    // Stack variables will be used to update
    // the partition device extensions.
    //
    // The device extension field SectorShift is
    // used to calculate sectors in I/O transfers.
    //
    // The DiskGeometry structure is used to service
    // IOCTls used by the format utility.
    //

    bytesPerSector = fdoExtension->DiskGeometry.BytesPerSector;

    //
    // Make sure sector size is not zero.
    //

    if (bytesPerSector == 0) {

        //
        // Default sector size for disk is 512.
        //

        bytesPerSector = fdoExtension->DiskGeometry.BytesPerSector = 512;
        fdoExtension->SectorShift = 9;
    }

    //
    // Determine is DM Driver is loaded on an IDE drive that is
    // under control of Atapi - this could be either a crashdump or
    // an Atapi device is sharing the controller with an IDE disk.
    //

    HalExamineMBR(fdoExtension->CommonExtension.DeviceObject,
                  fdoExtension->DiskGeometry.BytesPerSector,
                  (ULONG)0x54,
                  &dmSkew);

    if (dmSkew) {

        //
        // Update the device extension, so that the call to IoReadPartitionTable
        // will get the correct information. Any I/O to this disk will have
        // to be skewed by *dmSkew sectors aka DMByteSkew.
        //

        fdoExtension->DMSkew     = *dmSkew;
        fdoExtension->DMActive   = TRUE;
        fdoExtension->DMByteSkew = fdoExtension->DMSkew * bytesPerSector;

        ExFreePool(dmSkew);
    }

#if defined(_X86_) || defined(_AMD64_)

    //
    // Try to read the signature off the disk and determine the correct drive
    // geometry based on that.  This requires rereading the disk size to get
    // the cylinder count updated correctly.
    //

    if(!TEST_FLAG(Fdo->Characteristics, FILE_REMOVABLE_MEDIA)) {

        DiskReadSignature(Fdo);
        DiskReadDriveCapacity(Fdo);

        if (diskData->GeometrySource == DiskGeometryUnknown)
        {
            //
            // Neither the  BIOS  nor the port driver could provide us with a  reliable
            // geometry.  Before we use the default,  look to see if it was partitioned
            // under Windows NT4 [or earlier] and apply the one that was used back then
            //

            if (DiskIsNT4Geometry(fdoExtension))
            {
                diskData->RealGeometry = fdoExtension->DiskGeometry;
                diskData->RealGeometry.SectorsPerTrack   = 0x20;
                diskData->RealGeometry.TracksPerCylinder = 0x40;
                fdoExtension->DiskGeometry = diskData->RealGeometry;

                diskData->GeometrySource = DiskGeometryFromNT4;
            }
        }
    }

#endif

    //
    // Register interfaces for this device
    //
    {
        UNICODE_STRING interfaceName;

        RtlInitUnicodeString(&interfaceName, NULL);

        status = IoRegisterDeviceInterface(fdoExtension->LowerPdo,
                                           (LPGUID) &DiskClassGuid,
                                           NULL,
                                           &interfaceName);

        if(NT_SUCCESS(status)) {

            diskData->DiskInterfaceString = interfaceName;
            status = IoSetDeviceInterfaceState(&interfaceName, TRUE);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区三区三区| 中文字幕亚洲成人| 成人h版在线观看| 亚洲一区欧美一区| 久久综合久久综合九色| 色综合天天性综合| 精品在线一区二区三区| 一区二区三区中文字幕精品精品| 精品乱码亚洲一区二区不卡| 欧美性色欧美a在线播放| 成人免费视频网站在线观看| 美女爽到高潮91| 亚洲永久精品大片| 国产精品色噜噜| 精品久久久久久久久久久久久久久久久 | 日韩欧美一区二区不卡| 色综合天天综合网天天看片| 国产乱码精品1区2区3区| 免费成人在线视频观看| 亚洲一区二区三区视频在线 | 一本一道波多野结衣一区二区| 麻豆成人免费电影| 亚洲午夜一区二区三区| 亚洲人吸女人奶水| 国产日韩欧美制服另类| 精品黑人一区二区三区久久 | 欧美精品一区二区三区四区| 欧美日韩电影在线播放| 欧美中文字幕亚洲一区二区va在线| 成人激情校园春色| 成人一区二区三区中文字幕| 国产河南妇女毛片精品久久久| 蜜臀av一区二区三区| 污片在线观看一区二区| 香港成人在线视频| 亚洲一级电影视频| 一区二区成人在线| 亚洲激情在线播放| 亚洲美女屁股眼交3| 亚洲久草在线视频| 亚洲欧美欧美一区二区三区| 亚洲天堂成人网| 亚洲欧美国产毛片在线| 亚洲精品第1页| 亚洲综合另类小说| 亚洲国产欧美在线人成| 亚洲高清久久久| 日韩精品五月天| 日本不卡在线视频| 国内精品久久久久影院一蜜桃| 久久精品国产精品亚洲红杏| 久久精品国产网站| 成人小视频在线| 91在线无精精品入口| 欧洲人成人精品| 91精品国产综合久久久久久漫画| 欧美丰满少妇xxxbbb| 日韩小视频在线观看专区| 精品日韩99亚洲| 国产精品视频在线看| 亚洲精品免费视频| 午夜精品福利久久久| 欧美a级理论片| 国产丶欧美丶日本不卡视频| 不卡一区二区三区四区| 欧美唯美清纯偷拍| 日韩欧美色综合网站| 欧美激情一二三区| 亚洲一线二线三线视频| 美女一区二区视频| 成人丝袜高跟foot| 在线观看视频一区二区| 91精品国产福利| 国产亚洲自拍一区| 一区二区三区国产精华| 精品系列免费在线观看| av在线免费不卡| 欧美欧美午夜aⅴ在线观看| 欧美精品一区二区蜜臀亚洲| 成人欧美一区二区三区小说| 亚洲成人免费av| 国产另类ts人妖一区二区| youjizz久久| 这里是久久伊人| 中文字幕在线一区| 日本va欧美va精品发布| 成人国产精品免费网站| 777色狠狠一区二区三区| 欧美国产日产图区| 日本成人在线一区| 91在线精品一区二区| 日韩欧美色综合网站| 亚洲免费视频中文字幕| 激情六月婷婷综合| 欧美在线视频日韩| 久久精品人人做人人综合 | 久久香蕉国产线看观看99| 一区二区三区日韩精品| 国产精品亚洲综合一区在线观看| 欧美图区在线视频| 国产精品欧美一区喷水| 日本不卡视频在线观看| 91麻豆免费在线观看| 久久久噜噜噜久久人人看| 亚洲大片一区二区三区| 97se亚洲国产综合自在线| 欧美精品一区二区在线播放| 亚洲成人av在线电影| 99精品黄色片免费大全| 久久综合久久综合九色| 日av在线不卡| 欧美视频一区在线观看| 亚洲免费三区一区二区| 成人午夜精品在线| 精品国产成人系列| 美女视频黄 久久| 欧美日韩黄色影视| 一区二区三区四区亚洲| aaa欧美色吧激情视频| 亚洲精品在线免费观看视频| 蜜臀久久99精品久久久久久9 | 岛国精品一区二区| 日韩精品一区二区三区视频在线观看| 亚洲综合999| 99国产精品99久久久久久| 亚洲国产精品激情在线观看| 狠狠色狠狠色合久久伊人| 日韩精品中文字幕一区| 美腿丝袜一区二区三区| 欧美高清hd18日本| 日韩经典中文字幕一区| 欧美理论电影在线| 婷婷六月综合亚洲| 欧美酷刑日本凌虐凌虐| 午夜一区二区三区视频| 欧美日韩中文字幕一区| 午夜欧美视频在线观看| 91精品国产全国免费观看| 日韩av电影免费观看高清完整版在线观看 | 国产精品乱码一区二区三区软件 | 精品国产乱码久久久久久老虎| 日韩黄色在线观看| 欧美变态凌虐bdsm| 激情六月婷婷久久| 国产欧美日韩麻豆91| 福利一区二区在线| 国产精品国产三级国产普通话99| 91香蕉视频污在线| 一区二区国产盗摄色噜噜| 欧美专区在线观看一区| 午夜电影网亚洲视频| 欧美成人精精品一区二区频| 精彩视频一区二区三区| 久久久夜色精品亚洲| 成人av片在线观看| 一区二区三区不卡在线观看| 欧美日韩久久不卡| 蜜桃一区二区三区在线观看| 久久久一区二区三区捆绑**| 成人激情免费网站| 一区二区三区小说| 欧美一二三区精品| 成人网在线播放| 午夜视频在线观看一区二区三区| 日韩欧美一二三区| 成人av在线网| 亚洲444eee在线观看| 亚洲精品在线三区| 色综合网站在线| 另类小说综合欧美亚洲| 亚洲国产精品成人综合色在线婷婷 | 亚洲综合色自拍一区| 日韩一区二区三区免费看 | 欧美乱妇15p| 国产成人免费视频一区| 一区二区三区日韩精品视频| 日韩午夜av一区| 9i在线看片成人免费| 日韩精品一二区| 中文字幕精品一区二区三区精品| 欧洲一区二区三区免费视频| 国内成人免费视频| 亚洲黄色录像片| 精品久久久久久久久久久久久久久久久| 成人av电影在线| 麻豆精品久久久| 亚洲视频在线一区二区| 日韩精品一区二区在线观看| 色呦呦网站一区| 国产剧情一区在线| 午夜av一区二区| 亚洲欧洲成人自拍| 欧美成人精品1314www| 日本黄色一区二区| 国产成人在线免费| 久久国产人妖系列| 一区二区三区免费网站| 久久精品欧美一区二区三区麻豆 | 国产精品天美传媒| 日韩美女一区二区三区四区|