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

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

?? ide.c

?? 硬盤驅動程序, 硬盤驅動程序,硬盤驅動程序
?? C
?? 第 1 頁 / 共 4 頁
字號:
///////////////////////////////////////////////////////////////////////////////
//
//  (C) Copyright 1995 - 1998 OSR Open Systems Resources, Inc.
//	All Rights Reserved
//      Based on a previous work by Microsoft Corporation
//      Copyright (c) 1991, 1992, 1993  Microsoft Corporation
//
//    This sofware is supplied for instructional purposes only.
//
//      OSR Open Systems Resources, Inc. (OSR) expressly disclaims any warranty
//      for this software.  THIS SOFTWARE IS PROVIDED  "AS IS" WITHOUT WARRANTY
//      OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
//      THE IMPLIED WARRANTIES OF MECHANTABILITY OR FITNESS FOR A PARTICULAR
//      PURPOSE.  THE ENTIRE RISK ARISING FROM THE USE OF THIS SOFTWARE REMAINS
//      WITH YOU.  OSR's entire liability and your exclusive remedy shall not
//      exceed the price paid for this material.  In no event shall OSR or its
//      suppliers be liable for any damages whatsoever (including, without
//      limitation, damages for loss of business profit, business interruption,
//      loss of business information, or any other pecuniary loss) arising out
//      of the use or inability to use this software, even if OSR has been
//      advised of the possibility of such damages.  Because some states/
//      jurisdictions do not allow the exclusion or limitation of liability for
//      consequential or incidental damages, the above limitation may not apply
//      to you.
//
//    This driver is the example Programmed I/O device driver that
//    accompanies the book Windows NT Device Driver Development, by
//    Peter Viscarola and W. Anthony Mason, (c) 1998 OSR Open Systems
//    Resources, Inc. and published by MacMillan Technical Publishing
//    ISBN 1578700582.  
//
//
//  OSR Open Systems Resources, Inc.
//  105 Route 101A Suite 19
//  Amherst, NH 03031  (603) 595-6500 FAX: (603) 595-6503
//  email bugs to: bugs@osr.com
//
//
//  MODULE:
//
//      $Workfile: ide.c $
//
//  ABSTRACT:
//
//      This file contains the initial entry point for the OSR Sample
//      Programmed I/O device driver for the IDE (AT) Disk Controller.
//
//  AUTHOR:
//
//      Open Systems Resources, Inc.
// 
//  REVISION:   
//
//
///////////////////////////////////////////////////////////////////////////////

#include "ntddk.h"                      // main NT include
#include "ntdddisk.h"                   // disk driver IOCTL definitions
#include "ntddscsi.h"                   // scsi IOCTL defintions
#include "hw.h"                         // the access macro/definitions
#include "ide.h"                        // general declarations/structures
#include "utils.h"                      // IdeWaitController utilities

//
// static forward declarations
//


static VOID
FinishIrp(IN PIDE_DEV_EXT devExt,
          IN NTSTATUS NtStatus);

static BOOLEAN
ResetDisk(IN PVOID Context);


///////////////////////////////////////////////////////////////////////////////
//
//  IdeDispatchCreateClose
//
//    This routine handles the Create and Close IRPs.  Since we're a 
//    disk driver, this only completes the IRP
//
//  INPUTS:
//
//    DeviceObject      - pointer to our device object
//    Irp               - pointer to the IRP
//
//  OUTPUTS:
//  
//    None.
//
//  RETURNS:
//
//    STATUS_SUCCESS, any time, all the time
//
//      IRQL:
//
//    IRQL_PASSIVE_LEVEL
//
//  NOTES:
//
///////////////////////////////////////////////////////////////////////////////
NTSTATUS
IdeDispatchCreateClose(IN PDEVICE_OBJECT DeviceObject,
IN OUT PIRP Irp)
{

    //
    // Nothing to do... Just complete the request with success and return
    //

    Irp->IoStatus.Status = STATUS_SUCCESS;
    Irp->IoStatus.Information = 0;

    //
    // Complete the irp with no increase in priority 
    //

    IoCompleteRequest(Irp, IO_NO_INCREMENT);

    //
    // return the success
    //

    return STATUS_SUCCESS;
}



///////////////////////////////////////////////////////////////////////////////
//
//  IdeDispatchDeviceControl
//
//    This routine handles the device control IRPs
//
//  INPUTS:
//
//    DeviceObject      - pointer to our device object
//    Irp               - pointer to the IRP
//
//  OUTPUTS:
//  
//    None.
//
//  RETURNS:
//
//    STATUS_SUCCESS upon completion of the request, otherwise
//    STATUS_INVALID_DEVICE_REQUEST , STATUS_INVALID_PARAMETER
//
//      IRQL:
//
//    IRQL_PASSIVE_LEVEL
//
//  NOTES:
//
///////////////////////////////////////////////////////////////////////////////
NTSTATUS
IdeDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject,
                        IN OUT PIRP Irp)
{
    PPARTITION_DATA partitionData;
    PIDE_DEV_EXT devExt;
    PCONTROLLER_DATA controllerData;
    PIO_STACK_LOCATION ioStack;
    NTSTATUS ntStatus;

    //
    // Set up some locals
    //
    partitionData = DeviceObject->DeviceExtension;
    devExt = partitionData->Partition0;
    controllerData = devExt->ControllerData;




        //
    // Get the current stack location
    //
    ioStack = IoGetCurrentIrpStackLocation(Irp);

    //
    // Determine which I/O control code was specified.  
    // In this sample driver, we support the absolute minimum IOCTL
    // necessar.  See NTDDDISK.H for the complete set of definitions.
    //
    switch (ioStack->Parameters.DeviceIoControl.IoControlCode) {

        //
        // Return the drive geometry
        //
        case IOCTL_DISK_GET_DRIVE_GEOMETRY: 

            //
            // Validate the size of the requestor's buffer
            //
            if (ioStack->Parameters.DeviceIoControl.OutputBufferLength <
                    sizeof(DISK_GEOMETRY)) {

            Irp->IoStatus.Information = 0;
            Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;

            } else {

                PDISK_GEOMETRY obuf;

                //
                // Since the IOCTL is specified as METHOD_BUFFERED, the
                // output buffer is in system pool, pointed to by the
                // AssociatedIrp.SystemBuffer field in the IRP
                //
                obuf = (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer;

                //
                // This is known to be a fixed hard disk, so we return
                // FixedMedia (defined in NTDDDISK.H)
                //
                obuf->MediaType = FixedMedia;

                //
                // The actual disk geometry is retrieved from the 
                // devExt structure.  This was filled in during 
                // device initialization (see InitializeDisk())
                //
                obuf->Cylinders.QuadPart = devExt->PretendNumberOfCylinders;
                obuf->TracksPerCylinder = devExt->PretendTracksPerCylinder;
                obuf->SectorsPerTrack = devExt->PretendSectorsPerTrack;
                obuf->BytesPerSector = devExt->BytesPerSector; 

                //
                // Fill in the I/O Status Block for completion
                //
                Irp->IoStatus.Information = sizeof(DISK_GEOMETRY);

                Irp->IoStatus.Status = STATUS_SUCCESS;

            }

            break ;

        //
        // Return the information about the partition specified by the
        // device object.
        //
        case IOCTL_DISK_GET_PARTITION_INFO: 

            //
            // Validate the size of the requestor's buffer
            //
            if (ioStack->Parameters.DeviceIoControl.OutputBufferLength <
                    sizeof(PARTITION_INFORMATION)) {

                Irp->IoStatus.Information = 0;
                Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;

            } else {


                //
                // Is this request for the physical device (i.e. Partition0)?
                //
                if (partitionData == (PPARTITION_DATA)devExt) {

                    //
                    // The request is for the physical device.  This isn't
                    // a sensible request... so fail it.
                    //
                    Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;

                } else {

                    PPARTITION_INFORMATION obuf;

                    //
                    // The request is for an actual partition on the drive,
                    // not the physical device.

                    //
                    // Since this IOCTL uses METHOD_BUFFERED, we locate
                    // the intermediate buffer to be used to return data to
                    // the requestor in AssociatedIrp.SystemBuffer
                    //
                    obuf = (PPARTITION_INFORMATION)Irp->AssociatedIrp.SystemBuffer;

                    //
                    // Fill in the partition information obtained during
                    // the initilaization process (see InitalizeDisk()
                    //
                    obuf->PartitionType = partitionData->Pi.PartitionType;
                    obuf->BootIndicator = partitionData->Pi.BootIndicator;

                    //
                    // If it wasn't regcognized, we wouldn't have a partition
                    // device object...
                    //
                    obuf->RecognizedPartition = TRUE;

                    obuf->RewritePartition = FALSE;
                    obuf->PartitionNumber = partitionData->Pi.PartitionNumber;
                    obuf->StartingOffset = partitionData->Pi.StartingOffset;
                    obuf->PartitionLength = partitionData->Pi.PartitionLength;
                    obuf->HiddenSectors = partitionData->Pi.HiddenSectors;

                    //
                    // Set the length of the returned data in the Information
                    // field and set the STATUS_SUCCESS for the Irp
                    //
                    Irp->IoStatus.Information = sizeof(PARTITION_INFORMATION);

                    Irp->IoStatus.Status = STATUS_SUCCESS;
                }

            }

            break ;

        //
        // Set some partition information
        //
        case IOCTL_DISK_SET_PARTITION_INFO:

            //
            // Validate the input buffer size.  If it's not correct,
            // complete the IRP with an error status.
            //
            if (ioStack->Parameters.DeviceIoControl.InputBufferLength <
                    sizeof(SET_PARTITION_INFORMATION)) {

                Irp->IoStatus.Information = 0;
                Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;

            } else {


                //
                // Is the requestor trying to set partition info for
                // Partion zero, which is the physical disk?
                //
                if (partitionData == (PPARTITION_DATA)devExt) {

                    //
                    // Can't set the part info on a physical disk, silly!
                    //
                    Irp->IoStatus.Information = 0;
                    Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;

                } else {

                    PSET_PARTITION_INFORMATION inputBuffer;

                    //
                    // Since the IOCTL uses METHOD_BUFFERED, we locate
                    // the intermediate buffer with the requestor's set
                    // partition information in it.
                    //
                    inputBuffer =
                            (PSET_PARTITION_INFORMATION)Irp->AssociatedIrp.SystemBuffer;

                    //
                    // Invoke the kernel function to set the partition information
                    //

                    //
                    // If this were a REAL IDE driver, we might want to VALIDATE
                    // the partition information being set before lofting this
                    // request down to the I/O Manager.  But seeing as how
                    // this is just a sample...
                    //
                    ntStatus = IoSetPartitionInformation(devExt->DeviceObject,
                            devExt->BytesPerSector,
                            partitionData->PartitionOrdinal,
                            inputBuffer->PartitionType);

                    //
                    // Update our information
                    //
                    if (NT_SUCCESS(ntStatus)) {

                        partitionData->Pi.PartitionType = inputBuffer->PartitionType;
                    }

                    //
                    // 
                    //
                    Irp->IoStatus.Status = ntStatus;
                    Irp->IoStatus.Information = 0;
                }

            }
            break ;

        //
        // Return the partition layout for the physical drive.  Note that
        // the layout is returned for the actual physical drive, regardless
        // of which partition was specified for the request.
        //
        case IOCTL_DISK_GET_DRIVE_LAYOUT: 

            //
            // Check that the input buffer is of the correct size.
            // If not, then return an error
            //
            if (ioStack->Parameters.DeviceIoControl.OutputBufferLength <
                    sizeof(DRIVE_LAYOUT_INFORMATION)) {

                Irp->IoStatus.Information = 0;
                Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;

            } else {

                PDRIVE_LAYOUT_INFORMATION partitionList;

                //
                // Call the service to read the partition table.  The
                // result will be stored in a "partition buffer" allocated
                // by the IoReadPartitionTable() function in non-paged
                // pool.  We free this memory below...
                //
                ntStatus = IoReadPartitionTable(devExt->DeviceObject,
                        devExt->BytesPerSector,
                        FALSE,
                        &partitionList);

                //
                // if the read fails, then set the status
                //
                if (!NT_SUCCESS(ntStatus)) {

                    Irp->IoStatus.Information = 0;

                    Irp->IoStatus.Status = ntStatus;

                } else {

                    ULONG tempSize;

                    //
                    // The disk layout has been returned in the partitionList
                    // buffer.
                    //
                    // First, we must determine the size of the returned
                    // information to see if the data will fit into the
                    // IOCTL buffer.   The DRIVE_LAYOUT_INFORMATION
                    // structure (defined in NTDDDISK.H) consists of a
                    // variable number of PARTITION_INFORMATION structures
                    // (also defined in NTDDDISK.H).  So, first we use the
                    // MACRO FIELD_OFFSET (defined in NTDEF.H) which
                    // will determine the size of the DRIVE_LAYOUT_INFORMATION
                    // structure less the start of the PARTITION_INFORMATION
                    // structures.
                    //
                    tempSize = FIELD_OFFSET(DRIVE_LAYOUT_INFORMATION,
                            PartitionEntry[0]);

                    //
                    // We now add to tempSize the size of all of the 
                    // PARTITION_INFORMATION structures
                    //
                    tempSize += partitionList->PartitionCount *
                            sizeof(PARTITION_INFORMATION);

                    //
                    // If this total size is larger than the requestor's
                    // OutputBufferLength, then return an error
                    //
                    if (tempSize >
                            ioStack->Parameters.DeviceIoControl.OutputBufferLength) {

                        Irp->IoStatus.Information = 0;

                        Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;

                    } else {

                        //
                        // The buffer is large enough, so move the data
                        //
                        RtlMoveMemory(Irp->AssociatedIrp.SystemBuffer,
                                partitionList,
                                tempSize);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品黑人性xxxx| 国产美女视频91| 日本高清视频一区二区| 亚洲伦理在线精品| 在线中文字幕一区二区| 亚洲成人免费视频| 日韩一区二区三区三四区视频在线观看| 亚洲va欧美va人人爽午夜| 欧美高清视频一二三区 | 国产精品美女久久福利网站 | 99热在这里有精品免费| 亚洲欧美偷拍卡通变态| 欧美日韩一区二区不卡| 六月丁香婷婷久久| 国产欧美一区二区三区鸳鸯浴| 99久久精品情趣| 天天影视涩香欲综合网| 久久久久久久电影| 色哟哟国产精品| 久草这里只有精品视频| 中文字幕一区二| 制服视频三区第一页精品| 国产综合成人久久大片91| 亚洲男同性视频| 欧美大片一区二区| 色综合久久久网| 韩国精品主播一区二区在线观看| 中文字幕av不卡| 欧美男男青年gay1069videost| 国产精品自拍一区| 亚洲444eee在线观看| 国产欧美日韩在线视频| 欧美肥妇毛茸茸| a在线播放不卡| 美女网站在线免费欧美精品| 最新日韩av在线| 2021中文字幕一区亚洲| 欧美日韩极品在线观看一区| 国模少妇一区二区三区| 亚洲v日本v欧美v久久精品| 欧美极品aⅴ影院| 欧美一区二区视频网站| 日本丶国产丶欧美色综合| 国产精品911| 久久成人免费日本黄色| 一区二区三区av电影| 日本一区二区动态图| 日韩欧美三级在线| 欧美性受xxxx黑人xyx性爽| 成人精品一区二区三区中文字幕| 五月激情综合色| 亚洲伦理在线精品| 一色桃子久久精品亚洲| 亚洲精品在线网站| 欧美一级理论片| 欧美日韩激情一区二区| 日本二三区不卡| 91一区一区三区| 成人丝袜视频网| 国产成人精品亚洲日本在线桃色 | 成人免费va视频| 精品一区二区三区久久久| 亚洲444eee在线观看| 亚洲一区成人在线| 亚洲精品视频一区| 亚洲人成网站影音先锋播放| 国产精品久久三| 国产精品久久久久影视| 国产色综合久久| 国产日产欧美一区| 国产亚洲女人久久久久毛片| 精品国产一区二区三区不卡| 欧美成人video| 久久众筹精品私拍模特| 精品福利av导航| 久久精品一级爱片| 国产欧美日韩不卡| 中文无字幕一区二区三区 | 欧美一区二区国产| 91精品啪在线观看国产60岁| 欧美丰满少妇xxxbbb| 欧美大片顶级少妇| 久久久久久久综合| 亚洲综合色噜噜狠狠| 一区二区三区在线视频免费 | 国产欧美一区二区三区鸳鸯浴| 2021中文字幕一区亚洲| 欧美国产精品专区| 亚洲女同一区二区| 一区二区三区视频在线看| 亚洲一区免费在线观看| 日本不卡不码高清免费观看| 蜜臂av日日欢夜夜爽一区| 国产麻豆精品在线| 成人精品一区二区三区中文字幕| 91视频一区二区三区| 欧美中文一区二区三区| 777a∨成人精品桃花网| 欧美电影免费观看高清完整版在| 久久丝袜美腿综合| 一区在线播放视频| 午夜精品国产更新| 国产精品中文欧美| 一本大道综合伊人精品热热| 7777女厕盗摄久久久| 久久久精品综合| 综合久久一区二区三区| 丝袜美腿高跟呻吟高潮一区| 国内精品写真在线观看| 91在线看国产| 日韩欧美激情四射| 国产亚洲精品资源在线26u| 国产一区在线观看麻豆| av中文字幕在线不卡| 欧美乱熟臀69xxxxxx| 久久久久国产精品人| 夜夜精品视频一区二区| 韩国欧美国产1区| 99久久综合国产精品| 欧美电影在线免费观看| 国产午夜一区二区三区| 亚洲自拍另类综合| 国产一区二区三区最好精华液| 在线看一区二区| 久久久久久黄色| 香蕉久久一区二区不卡无毒影院| 国产精品正在播放| 91精品国产欧美日韩| 自拍偷拍亚洲激情| 久久成人久久爱| 欧美视频精品在线| 国产精品区一区二区三| 另类小说色综合网站| 欧美日韩一级黄| 亚洲桃色在线一区| 国产成人免费av在线| 日韩欧美一级二级三级久久久| 亚洲乱码国产乱码精品精98午夜 | 国产精品久久久久久久久免费相片| 午夜视频一区二区| 一本色道久久综合亚洲aⅴ蜜桃| 26uuu亚洲婷婷狠狠天堂| 午夜在线成人av| 成人丝袜高跟foot| 久久九九国产精品| 美女国产一区二区| 欧美精品第1页| 一区二区在线电影| 91污片在线观看| 国产亚洲欧美日韩在线一区| 久久se这里有精品| 欧美一级在线免费| 日韩国产在线观看| 欧美日韩免费一区二区三区视频| 亚洲少妇屁股交4| bt欧美亚洲午夜电影天堂| 国产色91在线| 国产精品亚洲午夜一区二区三区| 91精品国产色综合久久| 日韩精品福利网| 91精品国产综合久久婷婷香蕉| 夜夜嗨av一区二区三区| 91久久精品日日躁夜夜躁欧美| 亚洲日本一区二区三区| av亚洲产国偷v产偷v自拍| 欧美极品美女视频| 不卡一区中文字幕| 18欧美乱大交hd1984| 99久久久精品| 亚洲精品高清视频在线观看| 91天堂素人约啪| 一区二区国产盗摄色噜噜| 欧美亚洲动漫精品| 香蕉久久一区二区不卡无毒影院 | 国产乱淫av一区二区三区| 欧美精品一区二区三区高清aⅴ| 韩国精品一区二区| 国产欧美视频一区二区| 99久免费精品视频在线观看| 亚洲免费av高清| 欧美久久久久久蜜桃| 青青草91视频| 久久久久久久久久久99999| 成人午夜视频在线| 亚洲欧美一区二区不卡| 欧美日韩国产美| 久99久精品视频免费观看| 国产亚洲欧美日韩日本| 色一区在线观看| 视频一区视频二区中文| 精品国产伦一区二区三区观看体验| 国产在线视频一区二区三区| 中文字幕在线一区免费| 在线亚洲人成电影网站色www| 亚洲国产日韩综合久久精品| 欧美一级淫片007| 成人精品视频一区二区三区尤物| 亚洲三级在线看| 91精品国产一区二区| 粉嫩欧美一区二区三区高清影视|