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

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

?? config.c

?? 硬盤驅動程序, 硬盤驅動程序,硬盤驅動程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
            MmUnmapIoSpace(ConfigData->ControlPortAddress,
                                        ConfigData->RangeOfControlPort);
        }

        //
        // return failure status
        //
        return(STATUS_NO_SUCH_DEVICE);

    }

    //
    // We have a drive, so now issue the IDENTIFY command and 
    // get back some disk geometry information
    //
    if (!IssueIdentify(ConfigData, buffer)) {

        //
        // The IDENTIFY failed, 
        //
#if DBG
        DbgPrint("IdeGetDiskConfig: IDENITFY issuance failed\n");
#endif

        //
        // Unmap the ControllerBase
        //

        if (ConfigData->ControllerBaseMapped) {
            MmUnmapIoSpace(ConfigData->ControllerBaseAddress,
                ConfigData->RangeOfControllerBase);
        }

        //
        // Unmap the ControlPort
        //
        if (ConfigData->ControlPortMapped) {
            MmUnmapIoSpace(ConfigData->ControlPortAddress,
                                                ConfigData->RangeOfControlPort);
        }

        //
        // return failure
        //
        return(STATUS_NO_SUCH_DEVICE);

    }

    //
    // store some of the geometry 
    //
    ConfigData->Disk.IdentifyNumberOfCylinders =
                                    ((PIDENTIFY_DATA)buffer)->NumberOfCylinders;
    ConfigData->Disk.IdentifyTracksPerCylinder =
                                    ((PIDENTIFY_DATA)buffer)->NumberOfHeads;
    ConfigData->Disk.IdentifySectorsPerTrack =
                                    ((PIDENTIFY_DATA)buffer)->SectorsPerTrack;

    //
    // Map BIOS vector 41
    //
    tmpPtr.QuadPart = PTR_TO_FDPT0_ADDRESS;
    paramVector = MmMapIoSpace(tmpPtr, sizeof(ULONG), FALSE);

    if( (*paramVector) == 0) {

        //
        // the MmMapIoSpace() was unsuccessful, so we have to
        // quit. 
        //
#if DBG
        DbgPrint("IdeGetDiskConfig: MmMapIoSpace failure for BIOS parameter table\n");
#endif

        //
        // Unmap the ControllerBase
        //
        if (ConfigData->ControllerBaseMapped) {
            MmUnmapIoSpace(ConfigData->ControllerBaseAddress,
                                    ConfigData->RangeOfControllerBase);
        }

        //
        // Unmap the ControlPort
        //
        if (ConfigData->ControlPortMapped) {
            MmUnmapIoSpace(ConfigData->ControlPortAddress,
                            ConfigData->RangeOfControlPort);
        }

        //
        // return failure
        //
        return(STATUS_NO_SUCH_DEVICE);
    }

    //
    // We've mapped the bios, so now update the ConfigData
    // structure with the bios information
    //
    UpdateWithBios(ConfigData,((*(paramVector + 1)) << 4) + *paramVector);

    //
    // Now we check the registry to see if there are
    // any parameters within the registry that needs to
    // modify the BIOS configuration data
    //
    ReconcileWithRegistry(DriverObject, ConfigData);


    //
    // unmap the BIOS
    //
    MmUnmapIoSpace(paramVector, sizeof(ULONG));

    //
    // if we've sucessfully completed all of the above,
    // then we've found a disk, so return success
    //
    return(STATUS_SUCCESS);
}



///////////////////////////////////////////////////////////////////////////////
//
//	UpdateWithBios
//
//    This routine updates the DISK_EXTENSION data in the configData from 
//    the BIOS parameter table
//
//	INPUTS:
//
//    ConfigData        - device configuration data
//    ControlFlags      - points to value to set in controller for init
//    ParameterTableOffset - ROM address of the BIOS table
//
//	OUTPUTS:
//	
//    ConfigData        - updated information
//
//	RETURNS:
//
//    None.
//
//      IRQL:
//
//    IRQL_PASSIVE_LEVEL
//
//	NOTES:
//
///////////////////////////////////////////////////////////////////////////////

static VOID
UpdateWithBios(PCONFIG_DATA ConfigData,
              ULONG ParameterTableOffset)


{
    PFIXED_DISK_PARAMETER_TABLE parameterTable;
    PDRIVE_DATA driveData = (&ConfigData->Disk);
    LARGE_INTEGER p;

    p.QuadPart = ParameterTableOffset;

    parameterTable = MmMapIoSpace(p, DRIVE_PARAMETER_TABLE_LENGTH, FALSE);

    //
    // Initialize this drive.
    //
    driveData->BytesPerSector = 512;
    driveData->BytesPerInterrupt = 512;

    driveData->ReadCommand    = 0x20;
    driveData->WriteCommand   = 0x30;
    driveData->VerifyCommand  = 0x40;

    driveData->PretendNumberOfCylinders = parameterTable->MaxCylinders;
    driveData->PretendTracksPerCylinder = parameterTable->MaxHeads;
    driveData->PretendSectorsPerTrack = parameterTable->SectorsPerTrack;
    driveData->WritePrecomp = parameterTable->StartWritePrecomp;

    //
    // store the control flags
    //
    ConfigData->ControlFlags = parameterTable->ControlFlags;

    //
    // Some of these values might have been "pretend" values useful for
    // dealing with DOS.  If so, determine the real values.
    //
    if ((parameterTable->Signature & 0xf0) == 0xa0) {

        //
        // The values obtained were fake; get the real ones.
        //
        driveData->NumberOfCylinders = parameterTable->TranslatedMaxCylinders;
        driveData->TracksPerCylinder = parameterTable->TranslatedMaxHeads;
        driveData->SectorsPerTrack = parameterTable->TranslatedSectorsPerTrack;

    } else {

        //
        // The values obtained were correct (as far as it goes).
        //
        driveData->NumberOfCylinders = parameterTable->MaxCylinders;
        driveData->TracksPerCylinder = parameterTable->MaxHeads;
        driveData->SectorsPerTrack = parameterTable->SectorsPerTrack;


    }

    //
    // unmap the BIOS parmaeter table and return
    //
    MmUnmapIoSpace(parameterTable, sizeof(FIXED_DISK_PARAMETER_TABLE));

    return;
}



///////////////////////////////////////////////////////////////////////////////
//
//	ReconcileWithRegistry
//
//    This routine checks the geometry data returned from the bios with
//    information in the registry
//
//	INPUTS:
//
//    DriverObject      - pointer to our driver object
//    ConfigData        - current configuration data
//
//	OUTPUTS:
//	
//    ConfigData        - updated configuration data
//
//	RETURNS:
//
//    TRUE if information for this disk existed in the registry from BIOS
//
//      IRQL:
//
//    IRQL_PASSIVE_LEVEL
//
//	NOTES:
//
///////////////////////////////////////////////////////////////////////////////
static BOOLEAN
ReconcileWithRegistry(PDRIVER_OBJECT DriverObject,
                    PCONFIG_DATA ConfigData)
{
    OBJECT_ATTRIBUTES objectAttributes;
    UNICODE_STRING valueName;
    NTSTATUS status;
    PCM_FULL_RESOURCE_DESCRIPTOR resourceDescriptor;
    PKEY_VALUE_FULL_INFORMATION keyData;
    PUCHAR buffer;
    ULONG length;
    ULONG numberOfDrives;
    HANDLE biosKey;
    PCM_INT13_DRIVE_PARAMETER int13ParamTable;
    PDRIVE_DATA driveData = (&ConfigData->Disk);

    //
    // Initialize the object for the key.
    //
    InitializeObjectAttributes(&objectAttributes,
                            DriverObject->HardwareDatabase,
                            OBJ_CASE_INSENSITIVE,
                            NULL,
                            (PSECURITY_DESCRIPTOR) NULL);

    //
    // Create the key.
    //
    status =  ZwOpenKey(&biosKey,
                        KEY_READ,
                        &objectAttributes);

    //
    // If the key's not there, then we dont' have much to do
    //
    if (!NT_SUCCESS(status)) {
        return FALSE;
    }

    //
    // Look for "Configuration Data" as the value
    //
    RtlInitUnicodeString(&valueName, L"Configuration Data");

    //
    // allocate memory for the expected information
    //
    keyData = ExAllocatePool(PagedPool, 2048);

    //
    // However, if we don't get any memory...
    //
    if (keyData == NULL) {

        ZwClose(biosKey);

        return(FALSE);
    }

    //
    // query the registry for this guy
    //
    status = ZwQueryValueKey(biosKey,
                        &valueName,
                        KeyValueFullInformation,
                        keyData,
                        2048,
                        &length);
    ZwClose(biosKey);

    //
    // if the key did not exist, then we're done
    //

    if (!NT_SUCCESS(status))  {
        ExFreePool(keyData);
        return(FALSE);
    }

    //
    // key existed, so we need to decode the data
    //
    resourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR) ((PUCHAR) keyData +
        keyData->DataOffset);

    //
    // check the lengths
    //

    if (keyData->DataLength < sizeof(CM_FULL_RESOURCE_DESCRIPTOR) ||
        resourceDescriptor->PartialResourceList.Count == 0 ||
        resourceDescriptor->PartialResourceList.PartialDescriptors[0].Type !=
        CmResourceTypeDeviceSpecific ||
        resourceDescriptor->PartialResourceList.PartialDescriptors[0]
        .u.DeviceSpecificData.DataSize < sizeof(ULONG)
       ) 
    {

        //
        // the lenght didn't add up right, so we fail
        //

        ExFreePool(keyData);
        return FALSE;
    }

    length = resourceDescriptor->PartialResourceList.PartialDescriptors[0].u.DeviceSpecificData.DataSize;

    //
    // Point to the BIOS data. The BIOS data is located after the first
    // partial Resource list which should be device specific data.
    //

    buffer = (PUCHAR) keyData + keyData->DataOffset +
    sizeof(CM_FULL_RESOURCE_DESCRIPTOR);

    //
    // determine the number of CM_INT13_DRIVE_PARAMETER structures based 
    // on the length of the data
    //

    numberOfDrives = length / sizeof(CM_INT13_DRIVE_PARAMETER);

    //
    // Use the defaults if the drive number is greater than the
    // number of drives detected by the BIOS.
    //

    if (numberOfDrives <= 0) 
    {
        ExFreePool(keyData);
        return FALSE;
    }

    //
    // Point to the array of drive parameters.
    //
    int13ParamTable = (PCM_INT13_DRIVE_PARAMETER) buffer;

    driveData->PretendNumberOfCylinders = (USHORT)(int13ParamTable->MaxCylinders + 1);
    driveData->PretendTracksPerCylinder = (int13ParamTable->MaxHeads + 1);
    driveData->PretendSectorsPerTrack = int13ParamTable->SectorsPerTrack;

    //
    // all done.  Cleanup and go home
    //
    ExFreePool(keyData);

    return TRUE;
}





///////////////////////////////////////////////////////////////////////////////
//
//	IssueIdentify
//
//    This routine issues the IDENTIFY command to collect disk information
//
//	INPUTS:
//
//    ConfigData        - pointer to the current configuration
//    Buffer            - buffer to store geometry information
//
//	OUTPUTS:
//	
//    Buffer            - geometry information
//
//	RETURNS:
//
//    TRUE if the IDENTIFY command succeeds
//
//      IRQL:
//
//    IRQL_PASSIVE_LEVEL
//
//	NOTES:
//
//    The majority of this routine is debug output...
//
///////////////////////////////////////////////////////////////////////////////

static BOOLEAN
IssueIdentify(PCONFIG_DATA ConfigData,
              PUCHAR Buffer)
{
    ULONG i;
    UCHAR statusByte;

    //
    // Always drive 1
    //

    WRITE_PORT_UCHAR(ConfigData->ControllerBaseAddress + DRIVE_HEAD_REGISTER,
        (DRIVE_1));

    //
    // If the second drive is selected but it doesn't exist the controller
    // may behave randomly. Check that the status register makes sense.
    //
    statusByte = READ_PORT_UCHAR(ConfigData->ControllerBaseAddress + STATUS_REGISTER);

    //
    // Get rid of the IDX bit.
    //
    statusByte &= 0xfc;

    if (statusByte != 0x50) {

        //
        // Select drive zero again so that the controller
        // will return to normal behaviour.
        //
        WRITE_PORT_UCHAR(ConfigData->ControllerBaseAddress + DRIVE_HEAD_REGISTER,
            DRIVE_1);

        return FALSE;
    }

    //
    // Send IDENTIFY command.
    //
    WRITE_PORT_UCHAR(ConfigData->ControllerBaseAddress + COMMAND_REGISTER,
                                                            IDENTIFY_COMMAND);

    //
    // Wait for up to 3 seconds for DRQ or ERROR.
    //
    for (i=0; i<300000; i++) {

        statusByte = READ_PORT_UCHAR(ConfigData->ControllerBaseAddress + STATUS_REGISTER);

        if (statusByte & ERROR_STATUS) {
            return FALSE;
        } 
        else if (statusByte & DATA_REQUEST_STATUS) {
            break;
        } 
        else {
            KeStallExecutionProcessor(10L);
        }
    }

        if (i == 10000) {
            return FALSE;
        }

    //
    // Get 256 words of information
    //
    READ_PORT_BUFFER_USHORT(
        (PUSHORT)ConfigData->ControllerBaseAddress + DATA_REGISTER,
        (PUSHORT)Buffer,
        256);


    return TRUE;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色乱码一区二区三区88| 91高清在线观看| 亚洲欧洲综合另类| 91麻豆精品91久久久久久清纯 | 久久aⅴ国产欧美74aaa| 国产精品天美传媒沈樵| 日韩写真欧美这视频| 色系网站成人免费| 国产98色在线|日韩| 日韩高清国产一区在线| 亚洲欧美日韩国产另类专区| 久久精品水蜜桃av综合天堂| 欧美一区二区三区的| 色狠狠一区二区| 国产精品一色哟哟哟| 六月丁香婷婷久久| 午夜成人免费视频| 亚洲乱码国产乱码精品精小说| 久久久精品免费观看| 日韩亚洲欧美高清| 欧美精品丝袜久久久中文字幕| 91麻豆国产精品久久| 成人在线视频一区二区| 色综合久久久久| 国产精品456露脸| 蜜桃91丨九色丨蝌蚪91桃色| 日韩av电影免费观看高清完整版 | 精品国产一区二区三区四区四 | 国产91丝袜在线观看| 免费成人在线影院| 首页国产丝袜综合| 亚洲成av人在线观看| 亚洲国产视频一区| 亚洲制服欧美中文字幕中文字幕| 亚洲日本va在线观看| 成人欧美一区二区三区白人| 日本一区二区三区在线不卡| 久久精品综合网| 国产欧美中文在线| 国产欧美日韩三区| 久久综合久久综合九色| 久久久亚洲精华液精华液精华液| 久久综合久色欧美综合狠狠| 久久久久88色偷偷免费| 国产免费观看久久| 中文字幕免费不卡| 国产精品久久精品日日| ...xxx性欧美| 亚洲一区免费在线观看| 五月婷婷综合在线| 免费在线看一区| 精品一区二区国语对白| 国产精品99精品久久免费| 国产不卡免费视频| 99天天综合性| 欧洲一区在线观看| 欧美精品色一区二区三区| 日韩一区二区三区免费观看| 欧美成人r级一区二区三区| 精品国产免费一区二区三区香蕉| 国产目拍亚洲精品99久久精品 | 蜜臂av日日欢夜夜爽一区| 精品在线播放午夜| 国产福利91精品一区二区三区| 99久久久久久99| 欧美日韩激情在线| 国产精品污污网站在线观看| 国产精品久久久久久久久免费丝袜 | 99国产一区二区三精品乱码| 91久久精品午夜一区二区| 欧美疯狂做受xxxx富婆| 久久免费看少妇高潮| 国产精品久久久久久久久久久免费看 | 国产精品美女视频| 一区二区三区精品| 久久精品二区亚洲w码| www..com久久爱| 欧美另类z0zxhd电影| 国产午夜精品一区二区| 一区二区三区在线视频播放| 青青草国产成人99久久| 成人激情免费电影网址| 欧美日韩国产另类一区| 久久久久久久综合日本| 亚洲一区二区五区| 国产一区二区在线看| 色美美综合视频| www久久精品| 亚洲va天堂va国产va久| 东方欧美亚洲色图在线| 欧美日本精品一区二区三区| 中文在线一区二区| 免费成人在线影院| 色丁香久综合在线久综合在线观看| 精品日韩一区二区三区| 一区二区三区不卡视频| 国产精品99久久久久久似苏梦涵 | 中文字幕一区不卡| 男人的天堂久久精品| 色悠悠久久综合| 久久久精品天堂| 日韩av不卡一区二区| 91视频在线观看| 久久久久久久久久久久久女国产乱| 亚洲成人av福利| 91在线一区二区三区| 久久夜色精品国产欧美乱极品| 亚洲国产精品一区二区www在线| 波多野结衣在线一区| 精品国产一区久久| 免费成人av在线播放| 欧美区一区二区三区| 亚洲激情网站免费观看| 成人av免费在线播放| 久久久久久久久久久黄色| 另类小说综合欧美亚洲| 欧美v国产在线一区二区三区| 亚洲激情自拍视频| 99久久99久久免费精品蜜臀| 国产欧美日韩三区| 国产综合久久久久影院| 欧美一级淫片007| 婷婷一区二区三区| 欧美日韩高清不卡| 亚洲成人tv网| 欧美日韩国产免费一区二区 | 日韩码欧中文字| 成人午夜视频在线观看| 久久精品人人做人人爽97| 狂野欧美性猛交blacked| 91精品一区二区三区久久久久久| 亚洲一区免费视频| 在线亚洲人成电影网站色www| 亚洲精品日韩专区silk| 色一情一伦一子一伦一区| 亚洲男人的天堂在线观看| 99久久精品99国产精品| 一区二区三区在线观看动漫| 一本一本大道香蕉久在线精品 | 国产成a人亚洲| 国产精品视频线看| 成人亚洲精品久久久久软件| 国产精品色噜噜| av成人动漫在线观看| 亚洲日本va在线观看| 日本韩国精品一区二区在线观看| 一区二区三区欧美久久| 欧美日韩国产片| 美腿丝袜亚洲一区| 欧美精品一区二区久久婷婷| 国产成人日日夜夜| 中文字幕永久在线不卡| 一本大道av伊人久久综合| 亚洲成av人在线观看| 日韩亚洲电影在线| 风间由美性色一区二区三区| 成人欧美一区二区三区| 欧美挠脚心视频网站| 韩国精品久久久| 综合精品久久久| 欧美久久一区二区| 韩国毛片一区二区三区| 中文字幕一区二区在线观看| 91久久精品国产91性色tv| 男男视频亚洲欧美| 国产色产综合色产在线视频| 99久久精品国产观看| 视频一区视频二区在线观看| 精品国产a毛片| 色综合天天综合网国产成人综合天| 亚洲综合清纯丝袜自拍| 日韩精品一区在线观看| 99re在线精品| 蜜桃精品视频在线| 综合av第一页| 欧美一区二区视频网站| 成人涩涩免费视频| 丝袜美腿亚洲色图| 国产精品色在线| 制服丝袜中文字幕一区| 99在线视频精品| 久久99国产精品尤物| 亚洲少妇屁股交4| 欧美不卡视频一区| 一本到一区二区三区| 精品夜夜嗨av一区二区三区| 亚洲日本va在线观看| 欧美哺乳videos| 欧美视频一区二区| 成人一区在线观看| 视频一区欧美日韩| 亚洲另类在线一区| 久久久久久久网| 欧美日韩一区久久| 成人av在线影院| 蜜臀av在线播放一区二区三区| 亚洲女人****多毛耸耸8| 久久久亚洲午夜电影| 欧美片在线播放| 欧美综合久久久|