亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
久久99国产精品久久| 成人精品视频一区二区三区| 成人97人人超碰人人99| 国产色产综合色产在线视频| 日本欧美加勒比视频| 91精品久久久久久久久99蜜臂| 综合分类小说区另类春色亚洲小说欧美| caoporn国产精品| 中文无字幕一区二区三区| 国产一二精品视频| 欧美午夜精品久久久久久超碰 | 亚洲午夜激情网页| 99re视频精品| 亚洲欧美电影一区二区| 97超碰欧美中文字幕| 亚洲永久精品国产| 欧美蜜桃一区二区三区| 性做久久久久久免费观看欧美| 97精品国产97久久久久久久久久久久| 国产精品免费视频一区| 97超碰欧美中文字幕| 日韩av成人高清| 欧美大片国产精品| 国产成人在线电影| 国产精品欧美一级免费| 一本一道久久a久久精品| 亚洲一区二区影院| 欧美日韩国产色站一区二区三区| 久久99国产精品免费| 中文字幕av在线一区二区三区| 不卡av在线网| 一区二区三区精品| 日韩女优av电影在线观看| 极品少妇xxxx精品少妇| 国产精品私房写真福利视频| 欧美色国产精品| 精品一区二区三区在线观看| 国产精品沙发午睡系列990531| 欧美色视频在线观看| 国精产品一区一区三区mba视频 | 色欧美乱欧美15图片| 亚洲色图.com| 亚洲精品在线三区| 99国产一区二区三精品乱码| 亚洲欧洲制服丝袜| 久久久无码精品亚洲日韩按摩| 99久久99久久综合| 午夜婷婷国产麻豆精品| 成人欧美一区二区三区小说| 欧美日韩免费电影| 国产福利精品一区二区| 亚洲少妇屁股交4| 久久久另类综合| 欧美午夜精品电影| 丁香网亚洲国际| 久久99久久久欧美国产| 亚洲综合一二区| 亚洲精品一区二区三区四区高清| 成人黄色小视频在线观看| 麻豆精品在线播放| 亚洲裸体在线观看| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美日韩三级一区| 成人精品高清在线| 精品在线播放免费| 亚洲一区二区三区四区五区黄| 国产精品久久久久久久久动漫| 日韩一区二区三区三四区视频在线观看 | 亚洲一线二线三线久久久| 欧美激情一区二区三区| 在线播放91灌醉迷j高跟美女| 成人中文字幕在线| 国产91精品精华液一区二区三区| 日本亚洲欧美天堂免费| 一区av在线播放| 国产三级欧美三级日产三级99| xfplay精品久久| 欧美欧美欧美欧美| 在线国产电影不卡| 免费观看在线色综合| 男人的天堂亚洲一区| 亚洲成人自拍偷拍| 伊人一区二区三区| 一区二区三区四区亚洲| 亚洲色图在线播放| 中文一区在线播放 | 综合久久给合久久狠狠狠97色 | 久久精品人人爽人人爽| 欧美成人一级视频| 日韩欧美美女一区二区三区| 538prom精品视频线放| 欧美日韩精品是欧美日韩精品| 色老汉一区二区三区| 91网站在线观看视频| av亚洲精华国产精华精华 | 欧美色男人天堂| 欧美视频一区二区三区在线观看| 一本一道久久a久久精品综合蜜臀| a在线播放不卡| 99国产精品国产精品毛片| 99久久精品久久久久久清纯| 97久久久精品综合88久久| 99国产精品久久久| 色婷婷久久久亚洲一区二区三区| 欧美日本一区二区在线观看| 在线成人av影院| 久久国产人妖系列| zzijzzij亚洲日本少妇熟睡| 久久嫩草精品久久久精品| 日韩一区二区精品| 欧美日韩亚洲国产综合| 99精品久久只有精品| 在线观看亚洲一区| 56国语精品自产拍在线观看| 久久久综合激的五月天| 亚洲欧美日韩综合aⅴ视频| 免费观看91视频大全| 成人三级伦理片| 91美女在线观看| 色综合一区二区| 欧美日韩国产免费一区二区| 在线免费观看一区| 欧美日韩高清一区二区| 91精品午夜视频| 亚洲视频免费在线观看| 国产一区三区三区| 中文字幕va一区二区三区| 国产一区二区三区黄视频 | 国产在线视频不卡二| 亚洲男同1069视频| 精品国精品国产| 99国产精品国产精品久久| 中文字幕佐山爱一区二区免费| 韩日精品视频一区| 日韩免费视频一区| 久久成人免费电影| 一区二区三区欧美| 日韩西西人体444www| 不卡电影一区二区三区| 午夜精品一区在线观看| 日韩免费看的电影| 99久久久久久| 欧美一区二区三区四区五区| 丁香婷婷综合色啪| 欧美日韩国产免费| 亚洲免费观看高清在线观看| 国产精品夜夜爽| 91精品国产黑色紧身裤美女| 亚洲另类春色国产| 成人高清免费观看| 国产亚洲成年网址在线观看| 日产国产高清一区二区三区| 欧美在线三级电影| 亚洲精品成人悠悠色影视| 国产成人午夜视频| 2022国产精品视频| 精品一区二区三区在线观看国产| 7777精品伊人久久久大香线蕉超级流畅| 亚洲激情五月婷婷| 91网上在线视频| 1000精品久久久久久久久| 成人av在线资源| 中文字幕第一区第二区| 丁香一区二区三区| 国产91精品在线观看| 欧美三级日韩在线| 色婷婷精品久久二区二区蜜臀av| 日本中文在线一区| 亚洲天堂av一区| 久久午夜色播影院免费高清| 在线观看日韩毛片| 久久国内精品自在自线400部| 国产精品久久久久久亚洲毛片| 久久综合九色综合97_久久久| 91精品国产一区二区| 制服丝袜日韩国产| 国产精品妹子av| 亚洲欧洲精品天堂一级 | 一区二区三区中文在线观看| 日本aⅴ精品一区二区三区| 高清国产一区二区| 久久综合久久99| 亚洲1区2区3区4区| 欧美群妇大交群的观看方式| 久久久久久久久久久久电影| 亚洲午夜在线观看视频在线| 国产成人啪免费观看软件| 精品一区二区三区久久久| 国产成人综合亚洲91猫咪| 91亚洲精华国产精华精华液| 在线观看国产日韩| 欧美精品一区男女天堂| 91麻豆123| 精品一区二区三区av| 国产毛片精品国产一区二区三区| 精品一区二区三区免费| 成人激情校园春色| 欧美美女一区二区三区| 国产九色sp调教91| 91欧美激情一区二区三区成人|