亚洲欧美第一页_禁久久精品乱码_粉嫩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;
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);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧洲色大大久久| 日韩一区中文字幕| 日本一区二区三区dvd视频在线| 中文字幕一区日韩精品欧美| 午夜免费欧美电影| 成人精品小蝌蚪| 精品国产免费久久| 婷婷久久综合九色国产成人| 成人国产亚洲欧美成人综合网| 5858s免费视频成人| 亚洲视频在线一区| 国产成人av影院| 欧美一区二区福利在线| 亚洲精品高清在线| 北条麻妃国产九九精品视频| 欧美va亚洲va香蕉在线| 亚州成人在线电影| 一本到不卡免费一区二区| 国产欧美va欧美不卡在线| 蜜臀av一级做a爰片久久| 欧美怡红院视频| 亚洲色图色小说| a亚洲天堂av| 久久一日本道色综合| 三级一区在线视频先锋 | 中文字幕av一区二区三区免费看| 亚洲一区在线视频| 色成人在线视频| 中文字幕一区二区三区视频| 蜜臀av性久久久久蜜臀av麻豆| 欧美二区三区91| 午夜一区二区三区在线观看| 在线亚洲一区观看| 亚洲男人的天堂在线aⅴ视频| 成人黄色软件下载| 国产精品久久久久久久久图文区| 丁香五精品蜜臀久久久久99网站| 久久综合九色综合欧美就去吻| 九九九久久久精品| 精品av综合导航| 国产福利精品导航| 中文字幕av一区二区三区高 | www欧美成人18+| 国产剧情一区二区| 中文字幕一区二区三区不卡| 99综合电影在线视频| 亚洲特级片在线| 欧美亚洲综合另类| 麻豆精品一区二区三区| 欧美精品一区二区在线播放| 国产伦精品一区二区三区在线观看| 久久色.com| www.久久精品| 亚洲电影欧美电影有声小说| 在线成人小视频| 韩国精品久久久| 成人免费一区二区三区视频| 欧美亚洲高清一区二区三区不卡| 日本va欧美va精品发布| wwwwxxxxx欧美| 99精品视频一区二区三区| 亚洲成av人片在线| 欧美精品一区二区三区久久久| 成人黄色片在线观看| 亚洲aⅴ怡春院| 欧美激情在线观看视频免费| 欧美写真视频网站| 韩国欧美国产一区| 亚洲综合免费观看高清完整版在线| 欧美私模裸体表演在线观看| 久久99精品久久久| 亚洲免费大片在线观看| 欧美mv和日韩mv的网站| 99久久精品99国产精品| 久久不见久久见免费视频7 | 亚洲乱码国产乱码精品精小说 | 日韩福利视频网| 久久蜜桃一区二区| 欧美色电影在线| 懂色av中文字幕一区二区三区| 亚洲一区二区av电影| 精品国产91久久久久久久妲己| 91福利在线看| 成人一级视频在线观看| 久久精品国产在热久久| 一区二区三区资源| 久久久精品影视| 51午夜精品国产| 色狠狠桃花综合| 波多野结衣中文一区| 久久精品久久99精品久久| 亚洲图片欧美综合| 中文字幕一区在线观看| 久久久亚洲午夜电影| 欧美一二三区精品| 在线亚洲免费视频| 9久草视频在线视频精品| 国产精品一级二级三级| 美女久久久精品| 婷婷成人综合网| 亚洲第四色夜色| 夜夜精品视频一区二区| 18涩涩午夜精品.www| 国产精品嫩草久久久久| 久久精品欧美日韩| 久久综合久久99| www国产成人| ww亚洲ww在线观看国产| 欧美刺激脚交jootjob| 这里只有精品视频在线观看| 欧美午夜精品久久久| 欧美色偷偷大香| 欧美日韩精品三区| 精品污污网站免费看| 欧美在线高清视频| 欧美偷拍一区二区| 欧美日韩国产色站一区二区三区| 欧美视频一区在线| 欧美精品乱码久久久久久| 欧美精品日日鲁夜夜添| 欧美男女性生活在线直播观看| 欧美喷潮久久久xxxxx| 欧美精品一二三四| 日韩精品一区在线观看| 亚洲精品一区二区三区蜜桃下载| 久久蜜桃av一区二区天堂| 国产亚洲欧美激情| 亚洲色图视频网| 亚洲国产视频一区二区| 午夜伦欧美伦电影理论片| 免费欧美高清视频| 国产精华液一区二区三区| 成人中文字幕合集| 在线看国产一区二区| 欧美高清视频www夜色资源网| 欧美一二三区在线观看| 久久精品视频免费| 亚洲欧美另类小说| 日本系列欧美系列| 风间由美一区二区三区在线观看| 99re8在线精品视频免费播放| 欧洲一区二区三区免费视频| 91精品免费观看| 日本一区二区三区国色天香| 一区二区三区在线免费视频| 青娱乐精品在线视频| 国产不卡在线播放| 欧美综合视频在线观看| 欧美大胆一级视频| 中文字幕五月欧美| 美国欧美日韩国产在线播放| 成人黄色国产精品网站大全在线免费观看| 91丨porny丨蝌蚪视频| 91精品国产乱码久久蜜臀| 国产日本欧美一区二区| 亚洲午夜激情网站| 国产不卡在线一区| 欧美一区二区三区免费大片| 国产精品久久久久久久裸模| 日本在线播放一区二区三区| 国产高清在线精品| 91精品午夜视频| 亚洲素人一区二区| 国产在线播放一区| 欧美日韩亚洲综合一区二区三区| 久久精品视频免费观看| 天天色综合天天| 91在线视频免费观看| 亚洲精品在线一区二区| 亚洲成人资源在线| 91在线视频播放地址| 久久一区二区三区四区| 亚洲超碰精品一区二区| 99精品1区2区| 久久久一区二区三区| 免费成人你懂的| 欧美亚洲尤物久久| 国产精品入口麻豆九色| 韩国女主播成人在线观看| 欧美日韩国产一级片| 一区二区在线电影| 菠萝蜜视频在线观看一区| 国产夜色精品一区二区av| 久久国产精品99精品国产 | 国产成人免费视频精品含羞草妖精| 欧美色图第一页| 亚洲精品日韩一| 波多野结衣亚洲| 国产精品嫩草99a| 国产98色在线|日韩| 欧美精品一区二区三区在线播放 | 亚洲女爱视频在线| 国产成人精品影视| 久久精品人人爽人人爽| 国产综合久久久久影院| 337p粉嫩大胆噜噜噜噜噜91av | 亚洲一区免费视频| 91激情五月电影| 亚洲一区二区三区中文字幕| 91福利资源站|