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

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

?? atamain.cpp

?? WinCE5.0BSP for Renesas SH7770
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
    CDisk *pDisk = g_pDiskRoot;

    // iterate through the global CDisk list and direct each CDisk instance to
    // power up its associated device

    while (pDisk) {
        pDisk->PowerUp();
        pDisk = pDisk->m_pNextDisk;
    }

    LeaveCriticalSection(&g_csMain);
}

/*++

DSK_PowerDown
    This function suspends a device.

Parameters:
    None

Return:
    On success, return true.  Otherwise, return false.

--*/
EXTERN_C
VOID
DSK_PowerDown(
    VOID
    )
{
    EnterCriticalSection(&g_csMain);

    CDisk *pDisk = g_pDiskRoot;

    // iterate through the global CDisk list and direct each CDist instance to
    // power down its associated device

    while (pDisk) {
        pDisk->PowerDown();
        pDisk = pDisk->m_pNextDisk;
    }

    LeaveCriticalSection(&g_csMain);
}

/*++

IDE_Init
    This function is called as a result of a bus driver enumerating an IDE/ATA
    controller.

    Each IDE/ATA controller is a "bus".  An IDE/ATA controller contains at most
    two channels, and each channel can contain a master and a slave device.
    An IDE/ATA controller's instance key will typically contain the following
    subkeys: Device0, Device1, Device2, and Device3.  Device0 is the master
    device on the primary channel.  Device1 is the slave device on the primary
    channel.  Device2 is the master device on the secondary channel.  Device3
    is the slave device on the secondary.

    This function is responsible for searching the driver's instance key for
    DeviceX subkeys and calling ActivateDevice on each DeviceX subkey found.
    The call to ActivateDevice will eventually enter DSK_Init.  DSK_Init is
    responsible for creating a CDisk instance to associate with a device.  If a
    device is present and intialization succeeds, then DSK_Init will succeed.

Parameters:
    dwContext - pointer to string containing the registry path to the active key
    of the IDE/ATA controller; the active key contains a key to the IDE/ATA
    controller's instance key, which stores all of the IDE/ATA controller's
    configuration information

Return:
    On success, return handle to IDE/ATA controller (for identification); this
    handle is passed to all subsequent IDE_Xxx calls.  Otherwise, return null.

--*/

#define IDEINIT_UNDO_CLS_KEY_ACTIVE 0x01
#define IDEINIT_UNDO_CLS_KEY_DEVICE 0x02
#define IDEINIT_UNDO_DEL_BUS        0x04
#define IDEINIT_UNDO_DEL_PORT_PRI   0x08
#define IDEINIT_UNDO_DEL_PORT_SEC   0x10
#define IDEINIT_UNDO_DEL_REG_IDE    0x20
#define IDEINIT_UNDO_DEL_REG_DSK    0x40

EXTERN_C
DWORD
IDE_Init(
    DWORD dwContext
    )
{
    DWORD    dwUndo = 0;                     // undo bitset
    PTSTR    szActiveKey = (PTSTR)dwContext; // name of IDE/ATA controller's active key
    HKEY     hActiveKey;                     // handle to IDE/ATA controller's active key
    PTSTR    szDevKey = NULL;                // name of IDE/ATA controller's instance key
    HKEY     hDevKey;                        // handle to IDE/ATA controller's instance key
    PDSKREG  pDskReg;                        // ATA/ATAPI device's registry value set
    CIDEBUS *pBus = NULL;                    // return

    // open the IDE/ATA controllers's active key

    if ((ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, szActiveKey, 0, 0, &hActiveKey)) || (!hActiveKey)) {
        DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
            "Atapi!IDE_Init> Failed to open IDE/ATA controller's active key(%s)\r\n"
            ), szActiveKey));
        goto exit;
    }
    dwUndo |= IDEINIT_UNDO_CLS_KEY_ACTIVE;
    DUMPREGKEY(ZONE_INIT, szActiveKey, hActiveKey);

    // fetch the name of the IDE/ATA controller's instance key and open it

    if (!(hDevKey = AtaLoadRegKey(hActiveKey, &szDevKey)) || !szDevKey) {
        DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
            "Atapi!IDE_Init> Failed to fetch/open IDE/ATA controller's instance key from active key(%s)\r\n"
            ), szActiveKey));
        goto exit;
    }
    dwUndo |= IDEINIT_UNDO_CLS_KEY_DEVICE;
    DUMPREGKEY(ZONE_INIT, szDevKey, hDevKey);

    // instantiate an IDE/ATA controller ("bus") object

    if (!(pBus = new CIDEBUS)) {
        DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
            "Atapi!IDE_Init> Failed to instantiate IDE/ATA controller bus object; device key(%s)\r\n"
            ), szDevKey));
        goto exit;
    }
    dwUndo |= IDEINIT_UNDO_DEL_BUS;

    // instantiate primary channel port object

    pBus->m_pPrimaryPort = new CPort(pBus);
    if (!pBus->m_pPrimaryPort) {
        DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
            "Atapi!IDE_Init> Failed to allocate port for primary channel; device key(%s)\r\n"
            ), szDevKey));
        goto exit;
    }
    dwUndo |= IDEINIT_UNDO_DEL_PORT_PRI;

    // configure port instances based on I/O window information in registry

    if (!GetIoPort(hDevKey, szDevKey, pBus)) {
        DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
            "Atapi!IDE_Init> Bad I/O window information; device key(%s)\r\n"
            ), szDevKey));
        goto exit;
    }

    // fetch IDE/ATA controller registry value set (i.e., registry configuration)

    pBus->m_pIdeReg = (PIDEREG)LocalAlloc(LPTR, sizeof(IDEREG));
    if (!pBus->m_pIdeReg) {
        DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
            "Atapi!IDE_Init> Failed to allocate IDE_ registry value set; device key(%s)\r\n"
            ), szDevKey));
        goto exit;
    }
    dwUndo |= IDEINIT_UNDO_DEL_REG_IDE;
    if (!GetIDERegistryValueSet(hDevKey, pBus->m_pIdeReg)) {
        DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
            "Atapi!IDE_Init> Failed to read IDE_ registry value set from registry; device key(%s)\r\n"
            ), szDevKey));
        goto exit;
    }

    // assign IRQs
    pBus->m_pPrimaryPort->m_dwIrq = pBus->m_pIdeReg->dwIrq;

#ifdef SYSINTR_ATAPI
        pBus->m_pPrimaryPort->m_dwSysIntr = SYSINTR_ATAPI;
#else
        pBus->m_pPrimaryPort->m_dwSysIntr = pBus->m_pIdeReg->dwSysIntr;
#endif

    DEBUGCHK(pBus->m_pPrimaryPort->m_fInitialized);

    // IDE/ATA "bus" enumeration; scan the current IDE/ATA controller's instance
    // key for DeviceX subkeys

    DEBUGMSG(ZONE_INIT, (_T(
        "Atapi!IDE_Init> Start of IDE/ATA device enumeration\r\n"
        )));

    DWORD dwIndex = 0;        // index of next DeviceX subkey to fetch/enumerate
    HKEY hKey;                // handle to DeviceX subkey
    TCHAR szNewKey[MAX_PATH]; // name of DeviceX subkey
    DWORD dwNewKeySize;       // size of name of DeviceX subkey
    DWORD dwDeviceId;         // "DeviceId" read from DeviceX subkey and resolved to 0, 1

    dwNewKeySize = (sizeof(szNewKey) / sizeof(TCHAR));

    while (
        ERROR_SUCCESS == RegEnumKeyEx(
            hDevKey,       // IDE/ATA controller's instance key
            dwIndex,       // index of the subkey to fetch
            szNewKey,      // name of subkey (e.g., "Device0")
            &dwNewKeySize, // size of name of subkey
            NULL,          // lpReserved; set to NULL
            NULL,          // lpClass; not required
            NULL,          // lpcbClass; lpClass is NULL; hence, NULL
            NULL           // lpftLastWriteTime; set to NULL
    )) {

        dwIndex += 1;
        dwNewKeySize = (sizeof(szNewKey) / sizeof(TCHAR));
        pDskReg = NULL;

        // open the DeviceX subkey; copy configuration information from the
        // IDE/ATA controller's instance key to the device's DeviceX key

        if (ERROR_SUCCESS != RegOpenKeyEx(hDevKey, szNewKey, 0, 0, &hKey)) {
            DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
                "Atapi!IDE_Init> Failed to open DeviceX subkey; device key(%s)\r\n"
                ), szDevKey));
            goto exit;
        }
        if ((0 != wcscmp(szNewKey, REG_KEY_PRIMARY_MASTER)) && (0 != wcscmp(szNewKey, REG_KEY_PRIMARY_SLAVE))) {
            DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
                "Atapi!IDE_Init> Found bad DeviceX subkey(%s) in device's(%s) key; ignoring\r\n"
                ), szNewKey, szDevKey));
            dwIndex -= 1;
            continue;
        }

        // fetch the device's registry value set

        pDskReg = (PDSKREG)LocalAlloc(LPTR, sizeof(DSKREG));
        if (!pDskReg) {
            DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
                "Atapi!IDE_Init> Failed to allocate DSK_ registry value set; device key(%s)\r\n"
                ), szNewKey));
            goto exit;
        }
        dwUndo |= IDEINIT_UNDO_DEL_REG_DSK;
        if (!GetDSKRegistryValueSet(hKey, pDskReg)) {
            DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
                "Atapi!IDE_Init> Failed to read DSK_ registry value set from registry; device key(%s)\r\n"
                ), szNewKey));
            goto exit;
        }

        // resolve DeviceX subkey's "DeviceId" to (0, 1), so a CDisk instance can
        // reference the correct m_pBus->m_p(Primary, Secondary)Port->(m_pDisk, m_pDskReg)
        // array element

        dwDeviceId = pDskReg->dwDeviceId; // store the original value
        pDskReg->dwDeviceId &= 0x01;

        // write the new device ID value back to the device's instance key

        if (!AtaSetRegistryValue(hKey, REG_VAL_DSK_DEVICEID, pDskReg->dwDeviceId)) {
            DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
                "Atapi!IDE_Init> Failed to write %s(%d) DSK_ registry value to device's instance key(%s)\r\n"
                ), REG_VAL_DSK_DEVICEID, dwDeviceId, szNewKey));
            goto exit;
        }

        // the master and slave CDisk instances of a particular channel have to
        // share the port instance associated with the channel; write the heap
        // address of the port instance to the device's instance key

        if ((0 == wcscmp(szNewKey, REG_KEY_PRIMARY_MASTER)) || (0 == wcscmp(szNewKey, REG_KEY_PRIMARY_SLAVE))) {

            // store the DSK_ register value set of the master/slave device in
            // the appropriate slot of the port instance

            pBus->m_pPrimaryPort->m_pDskReg[pDskReg->dwDeviceId] = pDskReg;

            if (!AtaSetRegistryValue(hKey, REG_VALUE_PORT, (DWORD)pBus->m_pPrimaryPort)) {
                DEBUGMSG(ZONE_INIT|ZONE_ERROR, (_T(
                    "Atapi!IDE_Init> Failed to write address of primary port instance to device's(%s) DeviceX subkey(%s)\r\n"
                    ), szDevKey, szNewKey));
                goto exit;
            }

        }

        if (!pBus->m_szDevice[dwDeviceId]) {

            // save name of device's full registry key path; when we've finished
            // enumerating the "bus", we'll call ActivateDevice against all of
            // these paths

            pBus->m_szDevice[dwDeviceId] = new TCHAR[wcslen(szDevKey) + wcslen(szNewKey) + 10];
            wcscpy(pBus->m_szDevice[dwDeviceId], szDevKey);
            wcscat(pBus->m_szDevice[dwDeviceId], L"\\");
            wcscat(pBus->m_szDevice[dwDeviceId], szNewKey);

            DEBUGMSG(ZONE_INIT, (_T(
                "Atapi!IDE_Init> Enumerated IDE/ATA device %s\r\n"
                ), pBus->m_szDevice[dwDeviceId]));
        }

    } // while

    DEBUGMSG(ZONE_INIT, (_T(
        "Atapi!IDE_Init> End of IDE/ATA device enumeration\r\n"
        )));

    // initialize enumerated devices; it's imperative that we activate the
    // channel master before the channel slave

    for (dwDeviceId = 0; dwDeviceId < MAX_DEVICES_PER_CONTROLLER; dwDeviceId += 1) {
        if (pBus->m_szDevice[dwDeviceId]) {
            DEBUGMSG(ZONE_INIT, (_T(
                "Atapi!IDE_Init> Activating IDE/ATA device %s\r\n"
                ), pBus->m_szDevice[dwDeviceId]));
            pBus->m_hDevice[dwDeviceId] = ActivateDeviceEx(pBus->m_szDevice[dwDeviceId], NULL, 0, NULL);
        }
    }

    dwUndo &= ~IDEINIT_UNDO_DEL_BUS;
    dwUndo &= ~IDEINIT_UNDO_DEL_PORT_PRI;

exit:;

    if (dwUndo & IDEINIT_UNDO_CLS_KEY_ACTIVE) {
        RegCloseKey(hActiveKey);
    }
    if (dwUndo & IDEINIT_UNDO_CLS_KEY_DEVICE) {
        RegCloseKey(hDevKey);
    }
    if (szDevKey) {
        LocalFree(szDevKey);
    }
    if ((NULL != pBus) && (dwUndo & IDEINIT_UNDO_DEL_BUS)) {
        delete pBus;
        pBus = NULL;
    }

    return (DWORD)pBus;
}

/*++

IDE_Deinit
    This function deallocates the associated IDE/ATA controller ("bus") instance.

Parameters:
    dwHandle - pointer to associated bus instance (initially returned by
    IDE_Init)

Return:
    This function always succeeds.

--*/
EXTERN_C
BOOL
IDE_Deinit(
    DWORD dwHandle
    )
{   
    CIDEBUS *pBus = (CIDEBUS *)dwHandle;

    DEBUGCHK(pBus != NULL);
    delete pBus;

    return TRUE;
}

/*++

IDE_Open
    This function is not supported.

Parameters:
    N/A

Return:
    This function always fails.

--*/
EXTERN_C
DWORD
IDE_Open(
    HANDLE dwHandle,
    DWORD dwAccess,
    DWORD dwShareMode
    )
{
    SetLastError(ERROR_NOT_SUPPORTED);
    return NULL;
}


/*++

IDE_Close
    This function is not supported.

Parameters:
    N/A

Return:
    This function always fails.

--*/
EXTERN_C
BOOL
IDE_Close(
    DWORD dwHandle
    )
{
    SetLastError(ERROR_NOT_SUPPORTED);
    return FALSE;
}

/*++

IDE_IOControl
    This function is not supported.

Parameters:
    N/A

Return:
    This function always fails.

--*/
EXTERN_C
BOOL
IDE_IOControl(
    DWORD dwHandle,
    DWORD dwIoControlCode,
    PBYTE pInBuf,
    DWORD nInBufSize,
    PBYTE pOutBuf,
    DWORD nOutBufSize,
    PDWORD pBytesReturned,
    PDWORD pOverlapped
    )
{
    SetLastError(ERROR_NOT_SUPPORTED);
    return FALSE;
}

/*++

DllMain
    This function is the main ATAPI.DLL entry point.

Parameters:
    hInstance - a handle to the dll; this value is the base address of the DLL
    dwReason - the reason for the DLL is being entered
    lpReserved - not used

Return:
    On success, return true.  Otherwise, return false.

--*/
BOOL
WINAPI
DllMain(
    HANDLE hInstance,
    DWORD dwReason,
    LPVOID lpReserved
    )
{
    switch (dwReason) {

    case DLL_PROCESS_ATTACH:

        // initialize global data
        g_hInstance = (HINSTANCE)hInstance;
        InitializeCriticalSection(&g_csMain);
        // register debug zones
        RegisterDbgZones((HMODULE)hInstance, &dpCurSettings);
        DisableThreadLibraryCalls((HMODULE)hInstance);
        DEBUGMSG(ZONE_INIT, (_T("ATAPI DLL_PROCESS_ATTACH\r\n")));

        break;

    case DLL_PROCESS_DETACH:

        // deinitialize global data
        DeleteCriticalSection(&g_csMain);
        DEBUGMSG(ZONE_INIT, (TEXT("ATAPI DLL_PROCESS_DETACH\r\n")));

        break;
    }

    return TRUE;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩国产综合| 精品国产乱码久久| 亚洲国产日韩一区二区| 欧美中文字幕一二三区视频| 一级中文字幕一区二区| 欧美日韩免费观看一区二区三区| 日韩精品久久久久久| 日韩精品一区二区三区在线观看| 激情五月婷婷综合| 国产精品欧美一级免费| 色综合中文字幕国产 | 色综合久久久网| 亚洲欧洲中文日韩久久av乱码| 欧美亚洲另类激情小说| 免费成人在线观看| 国产精品久久久久aaaa| 日本韩国视频一区二区| 蜜臀久久99精品久久久画质超高清| 久久久影视传媒| 日本道在线观看一区二区| 美女国产一区二区| 中文无字幕一区二区三区| 在线日韩av片| 精彩视频一区二区三区| 亚洲精品中文字幕在线观看| 日韩午夜激情视频| 97aⅴ精品视频一二三区| 五月天婷婷综合| 欧美韩日一区二区三区| 欧美日韩你懂得| 波多野结衣中文字幕一区| 天天爽夜夜爽夜夜爽精品视频| 中文字幕一区二区三| 欧美福利一区二区| 99久久精品一区二区| 激情小说欧美图片| 亚洲国产日韩在线一区模特| 中文幕一区二区三区久久蜜桃| 欧美情侣在线播放| av色综合久久天堂av综合| 另类综合日韩欧美亚洲| 亚洲蜜臀av乱码久久精品蜜桃| 精品对白一区国产伦| 在线欧美一区二区| fc2成人免费人成在线观看播放| 日韩高清在线不卡| 亚洲午夜精品久久久久久久久| 欧美国产97人人爽人人喊| 日韩免费成人网| 欧美日韩一区二区在线视频| 97精品国产露脸对白| 国产最新精品免费| 久久精品国产精品亚洲红杏| 亚洲资源中文字幕| 国产三级精品在线| 精品理论电影在线| 5月丁香婷婷综合| 色成年激情久久综合| 风间由美一区二区av101 | 国产亚洲视频系列| 日韩三级中文字幕| 7777精品伊人久久久大香线蕉完整版 | av一区二区三区在线| 国产精品18久久久久久久久| 麻豆视频观看网址久久| 日本麻豆一区二区三区视频| 亚洲一区二区精品3399| 夜夜嗨av一区二区三区网页| 亚洲欧美另类久久久精品2019| 亚洲欧美综合色| 国产精品色哟哟网站| 国产精品美日韩| 中文字幕成人在线观看| 国产色综合一区| 国产精品人妖ts系列视频| 久久久久高清精品| 国产婷婷色一区二区三区四区 | 极品少妇xxxx精品少妇偷拍| 蜜桃av噜噜一区| 蜜桃久久av一区| 寂寞少妇一区二区三区| 国产精品系列在线播放| 国产精品12区| 99久久夜色精品国产网站| 91蝌蚪porny| 在线观看亚洲一区| 欧美日韩成人激情| 精品国产区一区| 国产亚洲午夜高清国产拍精品| 国产精品久久影院| 亚洲综合一区二区精品导航| 日韩精品成人一区二区在线| 久久丁香综合五月国产三级网站| 国产一区二区毛片| av综合在线播放| 欧美另类videos死尸| 日韩美女视频一区二区在线观看| 国产精品区一区二区三| 一区二区三区免费网站| 丝瓜av网站精品一区二区 | 日韩精品一区第一页| 美国十次综合导航| 国产成人精品一区二区三区四区 | 麻豆精品新av中文字幕| 国产一区二区影院| 99久久久久免费精品国产| 欧美日韩成人激情| 国产午夜精品一区二区三区嫩草| 亚洲丝袜制服诱惑| 秋霞成人午夜伦在线观看| 成人免费精品视频| 欧美日韩精品久久久| 久久久久久久精| 亚洲一区二区三区四区在线| 激情五月激情综合网| 日本高清不卡一区| 精品成人在线观看| 亚洲在线视频网站| 国产精品一区在线观看你懂的| 色综合天天综合网天天看片| 精品嫩草影院久久| 亚洲综合在线第一页| 国产成人午夜99999| 欧美日本一区二区三区四区| 中文字幕av免费专区久久| 亚洲成人福利片| 成人激情午夜影院| 日韩欧美二区三区| 亚洲国产综合色| 成人免费视频视频| 精品欧美乱码久久久久久| 亚洲一区免费视频| 国产91精品一区二区麻豆网站| 3751色影院一区二区三区| 亚洲伦理在线精品| 国产成人精品免费| 精品噜噜噜噜久久久久久久久试看| 一区二区三区中文字幕| 成人午夜av影视| 久久亚洲一区二区三区明星换脸| 亚洲一级在线观看| 色视频成人在线观看免| 国产精品毛片大码女人| 国产麻豆一精品一av一免费| 欧美一区二区日韩一区二区| 亚洲福利视频一区| 91国在线观看| 亚洲色图在线播放| 99re这里只有精品6| 中文字幕成人在线观看| 国产麻豆视频精品| 久久久蜜臀国产一区二区| 男女性色大片免费观看一区二区| 欧美日韩一区二区在线观看| 亚洲一区二区欧美| 欧美中文字幕亚洲一区二区va在线 | 亚洲乱码国产乱码精品精的特点| www.欧美色图| 日本一区二区高清| 国产一区二区三区高清播放| 欧美一区欧美二区| 青娱乐精品视频在线| 正在播放亚洲一区| 蜜臀av性久久久久蜜臀av麻豆| 欧美一级片免费看| 麻豆国产精品一区二区三区| 日韩欧美一区电影| 黄网站免费久久| 久久精品一二三| 成人黄色在线网站| 亚洲精品视频一区| 日韩制服丝袜av| 欧美女孩性生活视频| 亚洲成国产人片在线观看| 欧美日韩一区二区三区在线| 五月开心婷婷久久| 欧美成va人片在线观看| 韩国三级电影一区二区| 国产亚洲成av人在线观看导航| 国产成人亚洲精品狼色在线| 中文字幕在线不卡| 欧美日韩专区在线| 日韩av一二三| 久久精品一区八戒影视| 97精品国产露脸对白| 亚洲在线免费播放| 欧美草草影院在线视频| 成人免费av资源| 亚洲自拍偷拍欧美| 日韩无一区二区| 国产91丝袜在线18| 亚洲一区二区三区在线看| 日韩免费在线观看| 成人免费高清视频在线观看| 亚洲一区二区视频| 久久中文字幕电影| 日本福利一区二区| 麻豆极品一区二区三区| 亚洲日韩欧美一区二区在线| 欧美男男青年gay1069videost|