亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
www亚洲一区| 国产午夜亚洲精品午夜鲁丝片| 久久精品噜噜噜成人88aⅴ| 国产日韩精品久久久| 在线区一区二视频| 懂色av一区二区夜夜嗨| 日韩黄色片在线观看| 亚洲日穴在线视频| 久久亚洲精精品中文字幕早川悠里| 日本韩国欧美三级| 成人妖精视频yjsp地址| 免费一区二区视频| 一级中文字幕一区二区| 中文字幕乱码日本亚洲一区二区| 日韩欧美国产麻豆| 69久久夜色精品国产69蝌蚪网| 91在线你懂得| 国产69精品久久777的优势| 日本一区中文字幕| 亚洲线精品一区二区三区八戒| 中文字幕第一区综合| 26uuu亚洲综合色欧美| 91精品国产色综合久久不卡电影 | 国产九九视频一区二区三区| 视频在线观看一区二区三区| 亚洲精品高清在线| 亚洲欧美日韩国产成人精品影院 | 日韩电影免费一区| 亚洲夂夂婷婷色拍ww47| 亚洲三级电影网站| 综合分类小说区另类春色亚洲小说欧美| 久久综合久久综合久久综合| 日韩一区二区免费在线电影| 91精品中文字幕一区二区三区| 欧美日韩一区二区三区在线看| 色婷婷激情久久| 色久优优欧美色久优优| 91传媒视频在线播放| 欧美综合视频在线观看| 欧美亚洲一区二区在线观看| 中文字幕精品一区二区三区精品| 精品久久久久av影院| 久久日一线二线三线suv| 久久亚洲一区二区三区四区| 久久久影视传媒| 中文字幕精品在线不卡| 自拍偷拍国产精品| 亚洲激情图片一区| 视频一区二区三区在线| 午夜欧美在线一二页| 免费观看一级欧美片| 国产在线看一区| 成人午夜免费电影| 91福利资源站| 日韩一区二区电影| 久久久精品国产免费观看同学| 中文字幕av一区二区三区高| 国产精品国产成人国产三级| 亚洲综合免费观看高清完整版| 午夜天堂影视香蕉久久| 韩国av一区二区三区在线观看| 国产大陆亚洲精品国产| 91香蕉视频污在线| 欧美美女一区二区在线观看| www国产成人| 中文字幕日韩精品一区| 亚洲综合色噜噜狠狠| 久久超级碰视频| heyzo一本久久综合| 欧美日韩一区二区三区高清| 精品成人一区二区| 最新热久久免费视频| 日韩极品在线观看| 国产成人午夜99999| 欧美午夜在线观看| 久久人人爽爽爽人久久久| 亚洲日本在线观看| 日本一不卡视频| jlzzjlzz欧美大全| 91精品国产麻豆国产自产在线 | 亚洲图片欧美激情| 日韩中文字幕91| 成人美女在线观看| 制服丝袜一区二区三区| 国产精品天美传媒沈樵| 天天影视色香欲综合网老头| 成人免费视频视频在线观看免费| 欧美三级蜜桃2在线观看| 国产亚洲精品aa| 91美女蜜桃在线| 亚洲精品在线三区| 亚洲一区二区不卡免费| 国产成人av电影在线播放| 在线不卡a资源高清| 综合在线观看色| 国产一区美女在线| 在线播放亚洲一区| 亚洲精品久久久久久国产精华液| 国产一区在线精品| 欧美一区在线视频| 亚洲最大成人综合| 成人午夜视频福利| 久久久久97国产精华液好用吗| 婷婷成人综合网| 91黄色激情网站| 国产精品久久久久久久久图文区| 精品影视av免费| 欧美日韩情趣电影| 亚洲美女一区二区三区| 高清国产午夜精品久久久久久| 日韩三级在线观看| 亚洲成人av中文| 一本色道久久综合精品竹菊| 欧美激情综合网| 激情欧美一区二区| 欧美xxxx老人做受| 免费亚洲电影在线| 欧美视频在线观看一区二区| 亚洲麻豆国产自偷在线| 99国产欧美另类久久久精品 | 亚洲成人福利片| 欧美伊人久久大香线蕉综合69| 中文字幕中文字幕中文字幕亚洲无线| 精品系列免费在线观看| 日产国产高清一区二区三区| 日韩三级视频在线看| 日韩vs国产vs欧美| 在线成人免费视频| 日韩和欧美一区二区| 欧美精品日韩精品| 日韩影院免费视频| 91精品国产入口| 另类的小说在线视频另类成人小视频在线 | 日韩成人免费看| 91精品久久久久久久99蜜桃| 三级亚洲高清视频| 91精品午夜视频| 视频一区欧美日韩| 日韩精品一区二区三区四区视频 | 欧美伊人精品成人久久综合97 | 国产白丝精品91爽爽久久| 国产三级精品三级| 国产99久久久国产精品潘金网站| 国产日韩欧美综合在线| 岛国精品在线播放| 亚洲色图在线播放| 在线观看国产一区二区| 香蕉成人啪国产精品视频综合网| 欧美剧在线免费观看网站| 日本不卡123| 欧美成人在线直播| 国产乱码字幕精品高清av| 国产精品久久毛片| 91成人国产精品| 日本午夜精品一区二区三区电影| 亚洲黄色在线视频| 欧美日韩成人在线| 久久66热re国产| 国产精品五月天| 精品视频一区二区三区免费| 蜜臀av一区二区在线观看| 国产欧美视频在线观看| 99久久国产综合精品麻豆 | 成人午夜av电影| 一区二区三区在线不卡| 3atv一区二区三区| 成人在线视频一区| 一区二区三区四区不卡视频| 欧美一区二区免费| 成人中文字幕合集| 丝袜脚交一区二区| 欧美国产综合一区二区| 欧美三级乱人伦电影| 国产精品123区| 亚洲一区二区三区精品在线| 欧美mv日韩mv国产网站| 91在线观看高清| 麻豆中文一区二区| ●精品国产综合乱码久久久久 | 久久精品视频在线看| 在线看一区二区| 国产剧情一区二区三区| 亚洲午夜成aⅴ人片| 日本一区二区三区四区在线视频| 欧美色视频一区| 风流少妇一区二区| 日韩国产在线一| 国产精品白丝在线| 精品国产乱码久久久久久免费| 色综合色狠狠天天综合色| 精品一区二区三区视频| 亚洲免费色视频| 欧美国产丝袜视频| 日韩一区二区免费在线观看| 99麻豆久久久国产精品免费| 久久精品国产秦先生| 亚洲激情第一区| 国产精品久久久久影视| 精品国免费一区二区三区| 欧美日韩一区不卡|