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

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;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
9191久久久久久久久久久| 一区二区三区影院| 国产精品二区一区二区aⅴ污介绍| 亚洲免费观看高清完整版在线观看 | 国产喷白浆一区二区三区| 中文字幕制服丝袜一区二区三区| 亚洲午夜三级在线| 国产黄色精品网站| 欧美无砖专区一中文字| 久久久久久久网| 亚洲成精国产精品女| 国产精品一区免费视频| 在线视频你懂得一区| 久久久久久毛片| 亚洲与欧洲av电影| 国产一区999| 欧美午夜片在线观看| 国产亚洲欧美日韩在线一区| 亚洲电影一区二区| 国产成人精品aa毛片| 91麻豆精品国产91久久久久久久久 | 亚洲成人激情社区| 国产成人在线电影| 欧美日韩1234| 最新国产成人在线观看| 国产综合色在线| 欧美日本在线看| 亚洲欧美怡红院| 国产综合久久久久久久久久久久 | 午夜欧美大尺度福利影院在线看| 国产黑丝在线一区二区三区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 久久久久久久久岛国免费| 午夜精品影院在线观看| 高清日韩电视剧大全免费| 日韩一区二区免费视频| 亚洲一区二区三区自拍| 成人精品视频一区二区三区| 日韩一区二区三区四区五区六区| 一区二区三区av电影| 中文幕一区二区三区久久蜜桃| 亚洲chinese男男1069| 一本一道久久a久久精品综合蜜臀| 久久免费偷拍视频| 美女免费视频一区二区| 欧美日韩黄色一区二区| 一区二区在线看| 94-欧美-setu| 中文字幕中文字幕一区| 国产高清在线精品| 日韩免费看的电影| 日韩精品午夜视频| 91.xcao| 五月婷婷另类国产| 欧美怡红院视频| 亚洲美女精品一区| 91美女福利视频| 国产精品第一页第二页第三页| 国产999精品久久久久久绿帽| 精品国产一区二区三区av性色| 蜜臀久久久久久久| 欧美一级久久久久久久大片| 丝袜美腿亚洲一区二区图片| 欧美美女直播网站| 午夜视频一区二区| 91精品免费观看| 日韩电影在线免费观看| 91精品国产综合久久福利| 天天综合色天天综合| 欧美一区二区三区精品| 日本视频免费一区| 欧美成人精品福利| 国产一二精品视频| 中文字幕av一区二区三区高 | 亚洲欧美偷拍三级| 91蜜桃在线观看| 亚洲精选一二三| 日本丰满少妇一区二区三区| 樱花影视一区二区| 欧美三级欧美一级| 青青草原综合久久大伊人精品优势| 欧美一区二区视频免费观看| 麻豆一区二区99久久久久| 精品国产一区二区在线观看| 国产精品影视在线观看| 欧美韩国日本综合| 色综合一区二区| 视频一区在线视频| 精品久久久久香蕉网| 国产91精品一区二区麻豆网站 | 欧美三级电影网站| 丝袜美腿一区二区三区| 精品不卡在线视频| 成人丝袜高跟foot| 亚洲一区二区三区在线看| 欧美一区二区精美| 国产精品18久久久久久vr| **性色生活片久久毛片| 欧美三级电影精品| 九九久久精品视频| 亚洲欧洲精品天堂一级| 欧美日韩国产一级二级| 久久精品999| 国产精品免费丝袜| 欧美日韩精品一区二区三区蜜桃| 久久精品国产精品亚洲红杏| 中文字幕在线不卡视频| 欧美日韩色一区| 国产亚洲一区二区在线观看| 91在线视频网址| 日韩国产在线一| 欧美国产日韩亚洲一区| 在线免费观看视频一区| 久久精品国产精品亚洲综合| 中文字幕一区二区三区在线播放 | 视频一区中文字幕| 日本一二三四高清不卡| 欧美视频一二三区| 国产成人综合亚洲网站| 亚洲一卡二卡三卡四卡五卡| 日韩午夜激情视频| 99视频在线精品| 免费看精品久久片| 18成人在线观看| 欧美大片在线观看| 99re热这里只有精品视频| 日韩精品久久久久久| 国产精品传媒入口麻豆| 91精品免费观看| 不卡电影一区二区三区| 免费日本视频一区| 亚洲女与黑人做爰| 久久新电视剧免费观看| 在线观看三级视频欧美| 国产成人鲁色资源国产91色综| 午夜精品在线看| √…a在线天堂一区| 日韩精品一区二区三区四区| 欧美午夜寂寞影院| jiyouzz国产精品久久| 麻豆精品一区二区综合av| 一区二区三区高清| 国产无一区二区| 欧美电影免费观看高清完整版| 欧美午夜一区二区三区免费大片| 不卡视频免费播放| 国产精品一区二区视频| 日韩不卡手机在线v区| 一区二区激情视频| 中文字幕一区在线| 国产欧美一区二区精品性| 欧美一卡在线观看| 欧美裸体一区二区三区| 一本大道久久a久久综合| 成人激情综合网站| 国产福利精品一区| 激情综合一区二区三区| 日韩福利视频导航| 爽好多水快深点欧美视频| 亚洲一区二区三区四区五区中文| 国产精品久久久久久久久免费丝袜| 日韩美女一区二区三区| 欧美一区二区三区免费大片| 欧美日韩aaaaaa| 欧美日韩成人一区二区| 精品视频色一区| 欧美性淫爽ww久久久久无| 在线亚洲精品福利网址导航| 99久久99久久精品免费看蜜桃| 国产+成+人+亚洲欧洲自线| 国产精品99久| 国产乱子伦一区二区三区国色天香 | 99久久精品国产毛片| 成人app软件下载大全免费| 国产精品99久久久久久似苏梦涵| 久久99精品国产麻豆婷婷洗澡| 欧美va亚洲va在线观看蝴蝶网| 欧美一区二区不卡视频| 日韩视频免费观看高清完整版在线观看 | 国产性做久久久久久| 久久久久久久久久久久久女国产乱| 精品女同一区二区| 久久久三级国产网站| 久久久久久久久一| 国产精品麻豆欧美日韩ww| 中文字幕一区三区| 一区二区三区精品在线| 亚洲www啪成人一区二区麻豆| 三级影片在线观看欧美日韩一区二区| 丝袜亚洲另类欧美| 六月丁香综合在线视频| 国产精品1区2区3区| 成人涩涩免费视频| 91蜜桃网址入口| 欧美日韩成人在线| 精品久久久久久久久久久久久久久久久| 欧美sm极限捆绑bd| 国产精品免费视频观看| 一区二区三区蜜桃网| 免费av成人在线|