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

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

?? init.c

?? 硬盤驅動的例子
?? C
?? 第 1 頁 / 共 3 頁
字號:
///////////////////////////////////////////////////////////////////////////////
//
//  (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.  
//
//	MODULE:
//
//		$Workfile: init.c $
//
//	ABSTRACT:
//
//    This module handles the initialization of the IDE driver, specifically
//    the DriverEntry entry point
//
//	AUTHOR:
//
//		Open Systems Resources, Inc.
// 
//	REVISION:   
//
//
///////////////////////////////////////////////////////////////////////////////
#include "ntddk.h"                      // main NT include
#include "ntdddisk.h"                   // disk driver IOCTL definitions
#include "hw.h"                         // the access macro/definitions
#include "ide.h"                        // general declarations/structures
#include "utils.h"                      // IdeWaitController utilities
#include "config.h"                     // IdeGetConfigData declarations

//
// static forward declarations
//

static NTSTATUS
InitializeController(
IN PDRIVER_OBJECT DriverObject,
IN PCONFIG_DATA ConfigData
);

static NTSTATUS
InitializeDisk(IN PDRIVER_OBJECT DriverObject,
               IN PCONFIG_DATA ConfigData,
               IN OUT PCONTROLLER_DATA ControllerData);

static BOOLEAN
ReportUsage(IN PDRIVER_OBJECT DriverObject,
            IN PCONFIG_DATA ConfigData);



///////////////////////////////////////////////////////////////////////////////
//
//	DriverEntry
//
//    This is the mail entry point for the IDE driver
//
//	INPUTS:
//
//    DriverObject      - pointer to our device driver object
//    Registrypath      - this driver's service registry path
//
//	OUTPUTS:
//	
//    None.
//
//	RETURNS:
//
//    STATUS_SUCCESS if initialization is successful, otherwise
//    the appropriate failure status
//
//      IRQL:
//
//    IRQL_PASSIVE_LEVEL
//
//	NOTES:
//
//    While this routine is normally physically very large, many of the
//    functions have been partitioned off to other files.  DriverEntry calls:
//
//      IdeGetConfigData        - gets the bus/drive (configuration) data
//      InitializeController    - initialization of the controller and disk
//                                This calls InitializeDisk to init the disk
//                                The DeviceObject->DeviceExtension will 
//                                contain the IDE_DEV_EXT structure
//
///////////////////////////////////////////////////////////////////////////////


NTSTATUS
DriverEntry(IN OUT PDRIVER_OBJECT DriverObject,
            IN PUNICODE_STRING RegistryPath)
{

    PCONFIG_DATA        configData;     // pointer to config mgr's returned data
    NTSTATUS            ntStatus;

    //
    // let folks know who we are
    //
    DbgPrint("DriverEntry: Osr Ide Sample Disk Driver\n");

    //
    // Allocate and zero the data structure used during initialization.
    //
    configData = ExAllocatePool(PagedPool, sizeof (CONFIG_DATA));

    //
    // If we can't get the memory for the CONFIG_DATA structure, we fail
    //
    if (configData == NULL) {

        DbgPrint( 
            "DriverEntry: Can't allocate memory for config data\n");

        return(STATUS_INSUFFICIENT_RESOURCES);
    }

    //
    // Insure that the structure is clean
    //
    RtlZeroMemory(configData, sizeof(CONFIG_DATA));

    //
    // Get the bus and disk configuration and data
    //
    ntStatus = IdeGetConfigData(DriverObject, RegistryPath, configData);

    //
    // If IdeGetConfigInfo() failed, just exit returning the error to the
    // I/O Manager
    //
    if(!NT_SUCCESS(ntStatus)) {

        //
        // Cleanup and return the error to the I/O Manger
        //
        ExFreePool(configData);

        return ntStatus;
    }

    //
    // Initialize the driver object with this driver's entry points.
    //
    DriverObject->MajorFunction[IRP_MJ_CREATE] = IdeDispatchCreateClose;
    DriverObject->MajorFunction[IRP_MJ_CLOSE] = IdeDispatchCreateClose;
    DriverObject->MajorFunction[IRP_MJ_READ] = IdeDispatchReadWrite;
    DriverObject->MajorFunction[IRP_MJ_WRITE] = IdeDispatchReadWrite;
    DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IdeDispatchDeviceControl;

    DriverObject->DriverStartIo = IdeStartIo;

    //
    // Call ReportUsage() (which calls IoReportResourceUsage()) to
    // determine if there are any resource conflicts
    //
    if (ReportUsage(DriverObject, configData)) {

        //
        // There are no resource conflicts, so now initialize the
        // controller
        //
        ntStatus = InitializeController(DriverObject, configData);

    }  else {

        //
        // There were resource conflicts, so set the return status
        // to an error
        //

        ntStatus = STATUS_INSUFFICIENT_RESOURCES;

    }

    //
    // Cleanup and return the error to the I/O Manger
    //
    // Tell Emmy, Katy and Bethy it's time to start working.
    //
    ExFreePool(configData);

    return(ntStatus);
}




///////////////////////////////////////////////////////////////////////////////
//
//	InitializeController
//
//    This routine initializes the disk controller
//
//	INPUTS:
//
//    ConfigData        - pointer to the configuration data
//    DriverObject      - pointer to our driver object
//
//	OUTPUTS:
//	
//    None.
//
//	RETURNS:
//
//    STATUS_SUCCESS if controller and disk are initialized
//
//      IRQL:
//
//    IRQL_PASSIVE_LEVEL
//
//	NOTES:
//
//    If the controller is properly initialized, the disk is then
//    initialized via InitializeDisk.
//
///////////////////////////////////////////////////////////////////////////////

static NTSTATUS
InitializeController(IN PDRIVER_OBJECT DriverObject,
                     IN PCONFIG_DATA ConfigData)
{
    PCONTROLLER_DATA    controllerData;
    NTSTATUS            ntStatus;

    //
    // Allocate the controller data structure out of NonPagedPool so
    // that this structure is always available
    //
    controllerData = ExAllocatePool(NonPagedPool, sizeof (CONTROLLER_DATA));

    //
    // Fail if we can't get the memory
    //
    if (controllerData == NULL) {

        DbgPrint("InitializeController: Couldn't create the controllerData structure.\n");

        return(STATUS_INSUFFICIENT_RESOURCES);
    }


    //
    // Make sure that the data area is clean.
    //
    RtlZeroMemory(controllerData, sizeof(CONTROLLER_DATA));

    //
    // save away some addresses and flags
    //
    controllerData->ControllerAddress = ConfigData->ControllerBaseAddress;

    controllerData->ControlPortAddress = ConfigData->ControlPortAddress;

    controllerData->ControlFlags = ConfigData->ControlFlags;

    //
    // Connect to the interrupt here, but delay the enable of the 
    // interrupt until the disk device object is complete.
    //
    // Note that there is some code in IdeISR() which checks to make sure
    // that the controllerData->DeviceObject is filled in.  If true, then
    // we know that the interrupt belongs to us and not some other device
    // which may be sharing this interrupt.
    //
    // Note that for this Isa device, we assume the interrupt mode is latched
    //

    ntStatus = IoConnectInterrupt(&controllerData->InterruptObject,  
                IdeISR,                         // our ISR routine
                controllerData,                 // the ISR context
                NULL,                           // no optional spinlock
                ConfigData->ControllerVector,   // from HalGetInterruptVector
                ConfigData->ControllerIrql,     // from HalGetInterruptVector
                ConfigData->ControllerIrql,     // from HalGetInterruptVector
                Latched,                        // we're Latched and not LevelSensitive
                FALSE,                          // we're not sharing this interrupt
                ConfigData->ProcessorNumber,    // from HalGetInterruptVector
                FALSE);                         // don't save the FP state

    //
    // If we can't get the Interrupt vector, then notify the user and
    // exit this routine
    //
    if (!NT_SUCCESS(ntStatus)) {

        DbgPrint("InitializeController: Couldn't connect to the interrupt - status %x\n",ntStatus);
        return ntStatus;
    }

    //
    // It doesn't matter whether we have any devices yet.  The interrupt
    // service routine will simply dismiss any iterrupts until it's ready.
    //
    // Well wait up to 2 seconds for the controller to accept the reset.
    //
    WRITE_PORT_UCHAR(controllerData->ControlPortAddress,RESET_CONTROLLER);

    IdeWaitControllerBusy(controllerData->ControllerAddress + STATUS_REGISTER,
                        20,
                        75000);

    WRITE_PORT_UCHAR(controllerData->ControlPortAddress,
                    (UCHAR)(ENABLE_INTERRUPTS | controllerData->ControlFlags));

    //
    // Initialize the disk and hook the controllerData to the disk
    //
    ASSERT((ConfigData->Disk.DriveType != 0));

    ntStatus = InitializeDisk(DriverObject, ConfigData, controllerData);

    //
    // If we succeed, then we can continue along
    //
    if (NT_SUCCESS(ntStatus)) 
    {
        //
        // increment the global disk count.  This pointer was obtained
        // from IoGetConfigurationInformation in IdeGetConfigData()
        //

        (*(ConfigData->HardDiskCount))++;

    } 
    else {

            //
            // InitilaizeDisk() failed for some reason, so we need to 
            // cleanup.  First, disconnnect the interrupt
            //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线观看禁18| 国产成人免费视频精品含羞草妖精| 欧美日韩国产免费| 色偷偷成人一区二区三区91 | 狠狠色狠狠色综合系列| 午夜精品久久久久久久| 天天爽夜夜爽夜夜爽精品视频| 亚洲一二三四在线观看| 亚洲国产精品久久久久婷婷884| 亚洲精品乱码久久久久久久久| 亚洲精品国产成人久久av盗摄| 一区二区三区在线观看网站| 亚洲免费av在线| 午夜精品123| 麻豆视频观看网址久久| 激情综合网激情| 国产电影精品久久禁18| eeuss鲁一区二区三区| av电影天堂一区二区在线| 91亚洲精品一区二区乱码| 欧美性猛交xxxxxx富婆| 欧美吻胸吃奶大尺度电影| 欧美卡1卡2卡| 久久午夜色播影院免费高清| 久久亚洲精品国产精品紫薇 | 成人理论电影网| eeuss鲁片一区二区三区| 欧美专区亚洲专区| 欧美成人a在线| 亚洲国产精品黑人久久久| 亚洲欧美日本在线| 欧美a级理论片| 成人免费视频caoporn| 欧美无人高清视频在线观看| 久久亚洲综合色| 一区二区三区免费观看| 九九久久精品视频| 99re成人精品视频| 日韩欧美视频一区| 一区二区三区四区蜜桃| 久久精品国产77777蜜臀| 色综合久久综合中文综合网| 欧美肥大bbwbbw高潮| 国产精品久久久久久久岛一牛影视 | 免费观看久久久4p| av电影在线观看完整版一区二区| 欧美久久婷婷综合色| 国产欧美一区二区精品性色 | 国产视频一区在线播放| 亚洲国产成人porn| 99精品国产视频| 亚洲精品一区二区三区蜜桃下载| 亚洲午夜精品一区二区三区他趣| 国产成人亚洲综合a∨猫咪| 在线不卡一区二区| 亚洲黄色尤物视频| 成人在线视频首页| 久久久精品国产免大香伊| 亚洲成人av免费| 色综合久久综合网欧美综合网 | 成a人片亚洲日本久久| 精品少妇一区二区三区免费观看| 亚洲影院理伦片| 9i看片成人免费高清| 国产亚洲综合在线| 国产一区激情在线| 日韩精品自拍偷拍| 九一九一国产精品| 欧美www视频| 六月婷婷色综合| 欧美一二三四在线| 蜜臀av一区二区在线免费观看 | 国内外精品视频| 日韩亚洲欧美在线| 喷水一区二区三区| 日韩精品一区在线| 精品一区精品二区高清| 欧美一区二区福利视频| 蜜桃精品在线观看| 欧美成人精品1314www| 麻豆91免费看| 久久久久久久久岛国免费| 国产毛片精品一区| 中文字幕av一区二区三区免费看| 成人免费毛片app| 中文字幕一区二区三区乱码在线| 99在线精品免费| 伊人一区二区三区| 欧美日韩国产成人在线91| 日韩国产欧美在线视频| 日韩欧美一卡二卡| 国产一区视频在线看| 国产精品久久久一区麻豆最新章节| 丁香五精品蜜臀久久久久99网站| 中文字幕日本不卡| 欧美亚洲免费在线一区| 欧美aaa在线| 欧美国产禁国产网站cc| 91热门视频在线观看| 日韩激情av在线| 久久九九影视网| 91激情在线视频| 另类小说图片综合网| 日本一区二区免费在线观看视频| 99视频精品在线| 日本欧美一区二区三区乱码| 久久在线观看免费| 欧美午夜电影网| 国产精品综合二区| 亚洲国产成人av| 欧美国产在线观看| 91麻豆精品久久久久蜜臀| 国产精品中文字幕日韩精品| 一区二区三区加勒比av| 欧美成人精品1314www| 色综合久久九月婷婷色综合| 日本视频在线一区| 亚洲欧美电影院| www日韩大片| 欧美在线综合视频| 国产成人亚洲精品狼色在线| 亚洲成人黄色影院| 国产精品卡一卡二| 精品福利av导航| 在线观看国产精品网站| 成人精品电影在线观看| 日韩电影免费一区| 一区二区三区四区高清精品免费观看 | 日本韩国一区二区| 国产成人鲁色资源国产91色综| 偷窥少妇高潮呻吟av久久免费| 国产精品天美传媒沈樵| 日韩视频一区二区在线观看| 97精品国产97久久久久久久久久久久| 免费高清在线一区| 婷婷成人激情在线网| 亚洲欧美日本在线| 17c精品麻豆一区二区免费| 精品国产三级电影在线观看| 欧美久久久久久久久久| 色综合久久综合网欧美综合网| 国产精品 欧美精品| 麻豆精品视频在线观看| 亚洲大尺度视频在线观看| 一区二区三区久久| 亚洲精品你懂的| 综合网在线视频| 中文字幕一区二区三区精华液| 国产区在线观看成人精品 | 国产**成人网毛片九色| 韩国av一区二区三区四区| 美国十次了思思久久精品导航| 亚洲成人一区二区| 亚洲国产精品久久久久秋霞影院| 亚洲精品乱码久久久久久黑人| 亚洲男人都懂的| 一级精品视频在线观看宜春院| 亚洲日本va在线观看| 亚洲欧美日韩国产成人精品影院| 亚洲三级在线观看| 亚洲精品国产无天堂网2021| 一二三四社区欧美黄| 一区二区三区日韩在线观看| 亚洲欧美日韩国产中文在线| 亚洲精品你懂的| 图片区小说区区亚洲影院| 奇米色777欧美一区二区| 国产在线日韩欧美| 岛国av在线一区| 91精品福利在线| 欧美一区二区三区日韩视频| 日韩欧美电影一二三| 久久久久久一二三区| 亚洲国产精品国自产拍av| 亚洲乱码国产乱码精品精可以看 | 毛片一区二区三区| 风间由美性色一区二区三区| av电影一区二区| 欧美美女激情18p| www国产成人| 亚洲人成在线播放网站岛国| 亚洲国产精品久久不卡毛片 | 在线不卡中文字幕| 久久久五月婷婷| 亚洲欧美激情在线| 六月丁香婷婷久久| 色综合天天狠狠| 欧美tickling挠脚心丨vk| 中文字幕乱码一区二区免费| 亚洲h在线观看| 成人开心网精品视频| 在线播放中文一区| 中文字幕欧美国产| 免费人成精品欧美精品| 成人高清视频免费观看| 6080国产精品一区二区| 中文字幕成人在线观看| 日本不卡中文字幕| 91啪九色porn原创视频在线观看| 日韩一区二区电影网|