亚洲欧美第一页_禁久久精品乱码_粉嫩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 頁
字號:
/*++

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;

#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;
        HANDLE diskKey;

        RTL_QUERY_REGISTRY_TABLE queryTable[2];

        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;
        }

        RtlZeroMemory(queryTable, sizeof(queryTable));

        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;
    UCHAR sectorShift;

    BOOLEAN dmActive = FALSE;
    PULONG dmSkew;
    ULONG dmByteSkew;

    NTSTATUS status;

    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);

    //
    // 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.
    //

    fdoExtension->SrbFlags = SRB_FLAGS_PORT_DRIVER_ALLOCSENSE;

    //
    // Initialize the srb flags.
    //

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

        fdoExtension->SrbFlags = SRB_FLAGS_QUEUE_ACTION_ENABLE;

    }

    if (!TEST_FLAG(Fdo->Characteristics, FILE_REMOVABLE_MEDIA)) {
        SET_FLAG(fdoExtension->DeviceFlags, DEV_SAFE_START_UNIT);
    }

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

    ClassScanForSpecial(fdoExtension, DiskBadControllers, DiskSetSpecialHacks);

    //
    // Look into the registry to see if this device
    // requires special attention - [ like a hack ]
    //

    DiskScanRegistryForSpecial(fdoExtension);

    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 (fdoExtension->DeviceDescriptor->RemovableMedia) {
        ClassUpdateInformationInRegistry( Fdo,
                                          "PhysicalDrive",
                                          fdoExtension->DeviceNumber,
                                          NULL,
                                          0);
        //
        // Enable media change notification for removable disks
        //
        ClassInitializeMediaChangeDetection(fdoExtension,
                                            "Disk");

        SET_FLAG(Fdo->Characteristics, FILE_REMOVABLE_MEDIA);
        diskData->UpdatePartitionRoutine = DiskUpdateRemovablePartitions;

    } else {

        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.
    //

    status = ClassReadDriveCapacity(Fdo);

    //
    // If the read capcity failed then just return, unless this is a
    // removable disk where a device object partition needs to be created.
    //

    if (!NT_SUCCESS(status) &&
        !(Fdo->Characteristics & FILE_REMOVABLE_MEDIA)) {

        DebugPrint((1,
            "DiskInitFdo: Can't read capacity for device %p\n",
            Fdo));

        if (fdoExtension->DeviceDescriptor->RemovableMedia) {
            fdoExtension->DiskGeometry.MediaType = RemovableMedia;
            Fdo->Flags &= ~DO_VERIFY_VOLUME;
        } else {
            fdoExtension->DiskGeometry.MediaType = FixedMedia;
        }

        status = STATUS_SUCCESS;
    }

    //
    // 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;
    }

    sectorShift = fdoExtension->SectorShift;

    //
    // 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;

        //
        // Save away the infomation that we need, since this deviceExtension will soon be
        // blown away.
        //

        dmActive = TRUE;
        dmByteSkew = fdoExtension->DMByteSkew;

    }

#if defined(_X86_)
    //
    // 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(fdoExtension->DeviceDescriptor->RemovableMedia == FALSE) {
        DiskReadSignature(Fdo);
        DiskReadDriveCapacity(Fdo);
    }
#endif

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
eeuss鲁一区二区三区| 99国产麻豆精品| 国产精品久久久久三级| 欧美日韩免费不卡视频一区二区三区 | 三级欧美在线一区| 久久久影视传媒| 91久久国产最好的精华液| 久久9热精品视频| 亚洲精品国久久99热| 日韩精品专区在线影院观看| 91网站最新地址| 国产精品99久| 青青青伊人色综合久久| 亚洲激情一二三区| 国产欧美在线观看一区| 欧美一区二区视频在线观看| 色av综合在线| 成人av电影在线| 国产一区二区三区免费播放| 天堂一区二区在线| 一区二区三区精品视频| 国产精品久久久久一区| 久久网站热最新地址| 日韩一区二区免费视频| 欧美日韩视频在线观看一区二区三区 | 一区二区三区精品| 国产精品美女久久久久久久网站| 日韩欧美电影一二三| 欧美高清视频一二三区 | 性久久久久久久| 亚洲精品视频在线| 日本一区二区三区在线观看| 精品国产青草久久久久福利| 日韩欧美中文字幕制服| 欧美日本在线视频| 欧美日韩中文字幕一区二区| 日本道免费精品一区二区三区| proumb性欧美在线观看| 国产成人精品免费看| 国产精品一区二区久久精品爱涩| 久久99精品国产.久久久久久| 日本伊人精品一区二区三区观看方式 | 欧美日韩久久不卡| 欧美日韩精品一二三区| 欧美精品一级二级三级| 欧美日韩一级视频| 宅男在线国产精品| 5566中文字幕一区二区电影| 777午夜精品视频在线播放| 欧美裸体一区二区三区| 欧美一区国产二区| 日韩精品在线网站| 国产亚洲成aⅴ人片在线观看 | 国产精品88av| 丰满白嫩尤物一区二区| 99re热这里只有精品视频| 97久久超碰精品国产| 欧洲日韩一区二区三区| 欧美亚洲另类激情小说| 欧美精品99久久久**| 精品少妇一区二区| 国产免费成人在线视频| 亚洲精品免费在线| 亚洲国产aⅴ天堂久久| 青青草原综合久久大伊人精品优势 | 色一情一伦一子一伦一区| 91亚洲精品一区二区乱码| 欧美中文字幕亚洲一区二区va在线 | 欧美在线免费播放| 欧美精品第1页| 久久综合九色综合欧美就去吻 | 91污在线观看| 3d成人h动漫网站入口| 亚洲精品一区二区三区蜜桃下载| 中文字幕电影一区| 亚洲午夜久久久久久久久电影网 | 5566中文字幕一区二区电影| 久久久一区二区| 日韩理论片一区二区| 日韩国产精品久久久| 国产一区二区三区不卡在线观看| 成人黄色综合网站| 欧美精品乱码久久久久久 | 亚洲精品国产成人久久av盗摄| 午夜激情综合网| 国产精品1区二区.| 欧美日韩欧美一区二区| 国产三级一区二区| 亚洲午夜久久久久| 大胆欧美人体老妇| 日韩视频在线你懂得| 国产精品久久看| 男女男精品网站| 91电影在线观看| 精品久久久网站| 午夜精品成人在线| eeuss鲁片一区二区三区 | 国产mv日韩mv欧美| 欧美日韩国产乱码电影| 久久综合狠狠综合久久激情| 一区二区三区av电影| 国产精品18久久久久久久久| 欧美午夜寂寞影院| 国产精品天天看| 久久99久久99| 欧美性受极品xxxx喷水| 国产精品免费人成网站| 蜜桃av一区二区三区电影| 色婷婷av一区二区三区软件| 久久精品日韩一区二区三区| 日韩精品一二三四| 91精品福利视频| 1024国产精品| 国产精品99久久久久久久女警 | 中文字幕精品一区二区精品绿巨人 | 国内精品视频一区二区三区八戒| 欧美综合色免费| 国产精品国产自产拍在线| 久久精品国产第一区二区三区| 欧美午夜在线观看| 亚洲愉拍自拍另类高清精品| 懂色一区二区三区免费观看| 欧美不卡视频一区| 日韩精品1区2区3区| 欧美性感一类影片在线播放| 亚洲情趣在线观看| 99精品热视频| 国产精品污网站| 成人免费视频caoporn| 久久蜜桃一区二区| 国产在线看一区| 欧美成人aa大片| 美女爽到高潮91| 欧美一区二区视频在线观看| 天天综合天天综合色| 欧美日韩三级一区| 青青青爽久久午夜综合久久午夜| 欧美三区在线观看| 亚洲成av人片在线观看无码| 在线观看中文字幕不卡| 一级精品视频在线观看宜春院 | 韩国欧美国产1区| 日韩精品综合一本久道在线视频| 免播放器亚洲一区| 精品国产乱子伦一区| 国产在线精品视频| 久久久精品人体av艺术| 国产精品99久久久久| 国产精品久久久久久久久快鸭 | 亚洲永久精品大片| 欧美人体做爰大胆视频| 天天综合天天综合色| 日韩免费观看高清完整版在线观看| 奇米影视一区二区三区小说| 亚洲精品一区在线观看| 懂色av一区二区在线播放| 亚洲三级免费观看| 欧美性受xxxx| 久久99久久久久久久久久久| 久久综合九色欧美综合狠狠| 粉嫩av一区二区三区在线播放| 亚洲美女视频在线| 678五月天丁香亚洲综合网| 久久99精品久久久久婷婷| 国产精品丝袜一区| 色偷偷成人一区二区三区91 | 亚洲一二三四久久| 欧美群妇大交群的观看方式| 免费高清不卡av| 国产精品久久综合| 欧美精选一区二区| 国产一区在线看| 亚洲综合小说图片| 日韩三级视频在线观看| 成人午夜电影小说| 亚洲地区一二三色| 国产欧美日韩综合精品一区二区| 91丨九色porny丨蝌蚪| 日韩成人免费看| 国产精品每日更新| 在线成人免费视频| 成人在线综合网| 天天色天天操综合| 国产蜜臀97一区二区三区| 在线观看成人免费视频| 国产精品一二三| 亚洲va国产天堂va久久en| 国产亚洲精品超碰| 欧美日本高清视频在线观看| 国产精品69毛片高清亚洲| 亚洲高清中文字幕| 日本一区二区三区国色天香| 欧美色老头old∨ideo| 国内精品伊人久久久久av影院| 一区二区三区毛片| 亚洲国产成人私人影院tom| 欧美区在线观看| 色综合视频一区二区三区高清| 久久精品国内一区二区三区 | 韩日精品视频一区|