⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debug.cpp

📁 3sc2443的CF卡IDE源代码,肯定好用.
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
#include <windows.h>
#include <debug.h>

#ifdef DEBUG

void
DumpRegKey(
    DWORD dwZone,
    PTSTR szKey,
    HKEY hKey
    )
{
    DWORD dwIndex = 0;
    WCHAR szValueName[MAX_PATH];
    DWORD dwValueNameSize = MAX_PATH;
    BYTE pValueData[256];
    DWORD dwType;
    DWORD dwValueDataSize = sizeof(pValueData);

    DEBUGMSG(dwZone, (TEXT("Atapi!DumpRegKey> %s \r\n"), szKey));
    while (ERROR_SUCCESS == RegEnumValue(
        hKey, dwIndex,
        szValueName,
        &dwValueNameSize,
        NULL, &dwType,
        pValueData,
        &dwValueDataSize
    )) {
        if (REG_SZ == dwType) {
            DEBUGMSG(dwZone, (TEXT("\t\t%s = %s\r\n"), szValueName, (LPWSTR)pValueData));
        }
        else
        if (REG_DWORD == dwType) {
            DEBUGMSG(dwZone, (TEXT("\t\t%s = %08X\r\n"), szValueName, *(PDWORD)pValueData));
        }
        else
        if (REG_MULTI_SZ == dwType) {
            PWSTR pValueTemp = (PWSTR)pValueData;
            DEBUGMSG(dwZone, (TEXT("\t\t%s :\r\n"), szValueName));
            while (*pValueTemp) {
                DEBUGMSG(dwZone, (TEXT("\t\t\t%s\r\n"), (LPWSTR)pValueTemp));
                pValueTemp += (wcslen(pValueTemp) + 1);
            }
        }
        dwIndex++;
        dwValueDataSize = sizeof(pValueData);
        dwValueNameSize = MAX_PATH;
    }
}

VOID
DumpIdentify(
    PIDENTIFY_DATA pId
    )
{
    DWORD i;
    PUCHAR pCh;
    TCHAR OutBuf[128];
    LPTSTR pOut;
    PUSHORT tempS;
    UCHAR tempByte;
    ULONG j,k;

    DEBUGMSG(ZONE_INIT, (TEXT("Atapi!DumpIdentify> ...\r\n")));
    i = sizeof(IDENTIFY_DATA);
    pCh = (PUCHAR)pId;
    while (i) {
        pOut = OutBuf;
        k = (i < 16) ? i : 16;
        for (j = 0; j < k; j++) {
            pOut += wsprintf(pOut, TEXT("%2x "), pCh[j]);
        }
        if (k < 16) {
            for (j = 0; j < 16 - k; j++) {
                pOut += wsprintf(pOut, TEXT("   "));
            }
        }
        for (j = 0; j < k; j++) {
            if ((pCh[j] < ' ') || (pCh[j] > '~')) {
                pOut += wsprintf(pOut, TEXT("."));
            } else {
                pOut += wsprintf(pOut, TEXT("%c"), pCh[j]);
            }
        }
        DEBUGMSG(ZONE_INIT,(TEXT("%s\r\n"), OutBuf));
        i -= k;
        pCh += k;
    }
    if (pId->GeneralConfiguration & 0x8000) {
        DEBUGMSG(ZONE_INIT, (TEXT("    non-magnetic media\r\n")));
    }
    if (pId->GeneralConfiguration & 0x4000) {
        DEBUGMSG(ZONE_INIT, (TEXT("    format speed tolerance gap required\r\n")));
    }
    if (pId->GeneralConfiguration & 0x2000) {
        DEBUGMSG(ZONE_INIT, (TEXT("    track offset option available\r\n")));
    }
    if (pId->GeneralConfiguration & 0x1000) {
        DEBUGMSG(ZONE_INIT, (TEXT("    data strobe offset option available\r\n")));
    }
    if (pId->GeneralConfiguration & 0x0800) {
        DEBUGMSG(ZONE_INIT, (TEXT("    rotational speed tolerance is > 0,5%\r\n")));
    }
    if (pId->GeneralConfiguration & 0x0400) {
        DEBUGMSG(ZONE_INIT, (TEXT("    disk transfer rate > 10Mbs\r\n")));
    }
    if (pId->GeneralConfiguration & 0x0200) {
        DEBUGMSG(ZONE_INIT, (TEXT("    disk transfer rate > 5Mbs but <= 10Mbs\r\n")));
    }
    if (pId->GeneralConfiguration & 0x0100) {
        DEBUGMSG(ZONE_INIT, (TEXT("    disk transfer rate <= 5Mbs\r\n")));
    }
    if (pId->GeneralConfiguration & 0x0080) {
        DEBUGMSG(ZONE_INIT, (TEXT("    removeable cartridge drive\r\n")));
    }
    if (pId->GeneralConfiguration & 0x0040) {
        DEBUGMSG(ZONE_INIT, (TEXT("    fixed drive\r\n")));
    }
    if (pId->GeneralConfiguration & 0x0020) {
        DEBUGMSG(ZONE_INIT, (TEXT("    spindle motor control option implemented\r\n")));
    }
    if (pId->GeneralConfiguration & 0x0010) {
        DEBUGMSG(ZONE_INIT, (TEXT("    head switch time > 15us\r\n")));
    }
    if (pId->GeneralConfiguration & 0x0008) {
        DEBUGMSG(ZONE_INIT, (TEXT("    not MFM encoded\r\n")));
    }
    if (pId->GeneralConfiguration & 0x0004) {
        DEBUGMSG(ZONE_INIT, (TEXT("    soft sectored\r\n")));
    }
    if (pId->GeneralConfiguration & 0x0002) {
        DEBUGMSG(ZONE_INIT, (TEXT("    hard sectored\r\n")));
    }
    DEBUGMSG(ZONE_INIT, (TEXT(
            "    number of cylinders                        : %d\r\n"), pId->NumberOfCylinders));
    DEBUGMSG(ZONE_INIT, (TEXT(
            "    number of heads                            : %d\r\n"),pId->NumberOfHeads));
    DEBUGMSG(ZONE_INIT, (TEXT(
            "    unformatted bytes per track                : %d\r\n"),pId->UnformattedBytesPerTrack));
    DEBUGMSG(ZONE_INIT, (TEXT(
            "    unformatted bytes per sector               : %d\r\n"),pId->UnformattedBytesPerSector));
    DEBUGMSG(ZONE_INIT, (TEXT(
            "    sectors per track                          : %d\r\n"),pId->SectorsPerTrack));
    tempS = pId->ModelNumber;
    for (k=0; k<20; k++) {
        tempByte = (UCHAR)(tempS[k] & 0x00FF);
        tempS[k] = tempS[k] >> 8;
        tempS[k] |= tempByte << 8;
    }
    tempS = pId->FirmwareRevision;
    for (k=0; k<4; k++) {
        tempByte = (UCHAR)(tempS[k] & 0x00FF);
        tempS[k] = tempS[k] >> 8;
        tempS[k] |= tempByte << 8;
    }
    tempS = pId->SerialNumber;
    for (k=0; k<10; k++) {
        tempByte = (UCHAR)(tempS[k] & 0x00FF);
        tempS[k] = tempS[k] >> 8;
        tempS[k] |= tempByte << 8;
    }
    if (pId->BufferType == 0) {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    buffer type                                : unspecified\r\n")));
    }
    if (pId->BufferType == 1) {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    buffer type                                : single port; no simultaneous transfers\r\n")));
    }
    if (pId->BufferType == 2) {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    buffer type                                : dual port; simultaneous transfers supported\r\n")));
    }
    if (pId->BufferType == 3) {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    buffer type                                : dual port; simultaneous transfer supported, read cache supported\r\n")));
    }
    if (pId->BufferType >= 4) {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    buffer type                                : reserved\r\n")));
    }
    if (pId->BufferSectorSize == 0) {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    buffer size                                : unspecified\r\n")));
    }
    else {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    buffer size                                : %d sectors\r\n"),pId->BufferSectorSize));
    }
    if (pId->MaximumBlockTransfer == 0) {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    read/write multiple                        : not supported\r\n")));
    }
    else {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    read/write multiple                        : supported, %d sectors/interrupt\r\n"),
            pId->MaximumBlockTransfer));
    }
    if (pId->DoubleWordIo == 0) {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    double word IO                             : not supported\r\n")));
    }
    else if (pId->DoubleWordIo == 1) {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    double word IO                             : supported\r\n")));
    }
    else {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    double word IO                             : unrecognized mode\r\n")));
    }
    if (pId->Capabilities & 0x0200) {
        DEBUGMSG(ZONE_INIT, (TEXT(
            "    LBA mode                                   : supported\r\n")));
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -