亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
91麻豆免费视频| 久久国产福利国产秒拍| 国产三级欧美三级| 久久综合狠狠综合久久激情| 欧美大片在线观看一区二区| 51久久夜色精品国产麻豆| 在线观看视频一区二区| 欧美午夜精品久久久久久超碰| 欧美专区在线观看一区| 欧美丝袜第三区| 欧美精品日韩综合在线| 欧美一级黄色大片| 精品国产一区二区在线观看| 久久久久久亚洲综合影院红桃| 久久午夜电影网| 国产精品拍天天在线| 成人欧美一区二区三区在线播放| 中文字幕亚洲在| 一区二区激情视频| 日本中文一区二区三区| 国产精品自拍在线| 成人精品一区二区三区四区| 一本色道亚洲精品aⅴ| 在线精品视频免费观看| 日韩亚洲欧美综合| 中文字幕va一区二区三区| 一区二区免费在线播放| 久久成人av少妇免费| 成人深夜福利app| 欧美美女视频在线观看| 久久久久久电影| 亚洲午夜久久久久久久久电影网| 美洲天堂一区二卡三卡四卡视频| 国产风韵犹存在线视精品| 91官网在线免费观看| 欧美白人最猛性xxxxx69交| 综合电影一区二区三区 | 成人免费看视频| 欧美中文一区二区三区| 久久亚洲精华国产精华液| 亚洲狼人国产精品| 国产一区二区视频在线播放| 欧美专区日韩专区| 中文一区二区在线观看| 蜜臀av性久久久久蜜臀av麻豆| 99国产精品99久久久久久| 欧美一级片在线| 亚洲最大的成人av| 成人午夜激情在线| 精品久久久久久久久久久院品网| 中文字幕一区免费在线观看| 精品一区二区综合| 欧美亚洲免费在线一区| 久久伊人中文字幕| 日韩国产欧美在线视频| 在线观看国产精品网站| 国产精品天美传媒| 韩国在线一区二区| 欧美少妇性性性| 日本韩国一区二区| 韩国理伦片一区二区三区在线播放| 91免费在线看| 中文字幕在线观看不卡视频| 久久99精品久久久| 日韩欧美区一区二| 免费精品视频在线| 欧美人妇做爰xxxⅹ性高电影 | 国产精品一区二区视频| 欧美日韩激情一区| 午夜视黄欧洲亚洲| 欧美日韩综合在线免费观看| 亚洲人123区| 色屁屁一区二区| 亚洲女同ⅹxx女同tv| 色综合久久久网| 亚洲综合在线免费观看| 91久久香蕉国产日韩欧美9色| 国产精品国产三级国产aⅴ中文| 国产剧情av麻豆香蕉精品| 久久你懂得1024| 成人白浆超碰人人人人| 亚洲国产岛国毛片在线| k8久久久一区二区三区| 国产精品不卡在线观看| 色综合久久中文字幕综合网| 亚洲一区在线视频观看| 欧美一区二区在线视频| 久久精品国产一区二区| 国产片一区二区| 99久久婷婷国产综合精品| 亚洲激情六月丁香| 欧美精品久久99| 国内精品久久久久影院一蜜桃| 国产欧美日韩在线观看| 97超碰欧美中文字幕| 亚洲成人av电影| 欧美成人女星排名| 99久久久无码国产精品| 亚洲国产精品久久久久秋霞影院 | 国产精品网站在线观看| av成人老司机| 亚洲风情在线资源站| 精品1区2区在线观看| 白白色亚洲国产精品| 婷婷综合五月天| 国产精品美女久久久久久久久久久 | 久久免费视频色| 91视频在线看| 久久国产尿小便嘘嘘尿| 成人欧美一区二区三区黑人麻豆| 欧美日韩在线三级| 国产91精品一区二区麻豆网站 | 日韩欧美一区二区视频| 成人高清免费在线播放| 日韩在线观看一区二区| 日本一二三不卡| 欧美午夜在线一二页| 国产成人免费在线观看不卡| 亚洲一区二区3| 国产精品嫩草影院av蜜臀| 欧美日韩免费观看一区三区| 夫妻av一区二区| 麻豆成人久久精品二区三区小说| 国产精品国产自产拍高清av| 欧美一区二区三区人| 一本一本大道香蕉久在线精品| 国产一区二区三区免费看| 亚洲最大成人综合| 日韩一区中文字幕| 国产三级三级三级精品8ⅰ区| 6080yy午夜一二三区久久| 色综合一区二区| 成人理论电影网| 国产99一区视频免费| 久久97超碰色| 日本伊人精品一区二区三区观看方式| 亚洲四区在线观看| 国产精品色一区二区三区| 精品久久久影院| 欧美一区二区三区在线视频| 欧美日韩中文另类| 91久久一区二区| 91久久精品一区二区三区| 99re这里只有精品6| 豆国产96在线|亚洲| 国产一区二三区| 狠狠色狠狠色综合系列| 久久99深爱久久99精品| 久久av老司机精品网站导航| 秋霞午夜鲁丝一区二区老狼| 日本网站在线观看一区二区三区| 亚洲国产精品久久久久秋霞影院| 玉米视频成人免费看| 亚洲一二三专区| 丝袜美腿高跟呻吟高潮一区| 偷窥少妇高潮呻吟av久久免费| 五月天欧美精品| 日本女人一区二区三区| 蜜臀久久99精品久久久久宅男| 午夜精品一区二区三区免费视频 | 国产乱码精品一区二区三| 激情综合亚洲精品| 国产一区二区日韩精品| 国产精品一区久久久久| av网站一区二区三区| 色欧美乱欧美15图片| 欧美日韩情趣电影| 日韩欧美综合一区| 国产三级久久久| 一区二区三区加勒比av| 日韩成人午夜电影| 国产剧情一区二区| 色哟哟精品一区| 欧美一区二区性放荡片| 久久久www免费人成精品| 国产精品毛片高清在线完整版| 亚洲青青青在线视频| 午夜欧美一区二区三区在线播放| 美女视频网站久久| 成人性视频网站| 欧美精品日韩精品| 久久久久99精品国产片| 亚洲人xxxx| 久久超碰97中文字幕| 91丨porny丨中文| 日韩免费高清视频| 亚洲人成小说网站色在线 | 在线精品国精品国产尤物884a| 欧美一区二区三区人| 中文字幕一区日韩精品欧美| 亚洲aⅴ怡春院| 国产成人8x视频一区二区| 色婷婷激情一区二区三区| 日韩免费高清电影| 亚洲欧洲制服丝袜| 国产一区 二区 三区一级| 欧美在线影院一区二区| 国产午夜精品久久久久久免费视| 亚洲一区二区美女| 成人精品一区二区三区中文字幕|