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

📄 debug.cpp

📁 WINDDK XP/2003 Microsoft Bitmap Printer Driver Sample Decompress to src in WINDDK and "build -cZ
💻 CPP
📖 第 1 页 / 共 4 页
字号:
/*++

Routine Description:

    Dumps the members of a OEMDMPARAM structure.
    
Arguments:

    iDebugLevel - desired output debug level
    pszInLabel - output label string
    pOemDMParam - pointer to the OEMDMPARAM strct to be dumped

Return Value:

    NONE

--*/

{
    // Check if the debug level is appropriate
    //
    if (iDebugLevel < giDebugLevel)
    {
        // Nothing to output here
        //
        return;
    }
    
    // Prepare the label string
    //
    PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pOemDMParam");
    
    // Return if strct to be dumped is invalid
    //
    if (!pOemDMParam)
    {
        OEMDebugMessage(TEXT("\npOemDMParam [%s]: NULL\r\n"), pszLabel);

        // Nothing else to output
        //
        return;
    }

    // Format the data
    //
    OEMDebugMessage(TEXT("\npOemDMParam [%s]: %#x\r\n"), pszLabel, pOemDMParam);
    OEMDebugMessage(TEXT("\tcbSize = %d\r\n"), pOemDMParam->cbSize);
    OEMDebugMessage(TEXT("\tpdriverobj = %#x\r\n"), pOemDMParam->pdriverobj);
    OEMDebugMessage(TEXT("\thPrinter = %#x\r\n"), pOemDMParam->hPrinter);
    OEMDebugMessage(TEXT("\thModule = %#x\r\n"), pOemDMParam->hModule);
    OEMDebugMessage(TEXT("\tpPublicDMIn = %#x\r\n"), pOemDMParam->pPublicDMIn);
    OEMDebugMessage(TEXT("\tpPublicDMOut = %#x\r\n"), pOemDMParam->pPublicDMOut);
    OEMDebugMessage(TEXT("\tpOEMDMIn = %#x\r\n"), pOemDMParam->pOEMDMIn);
    OEMDebugMessage(TEXT("\tpOEMDMOut = %#x\r\n"), pOemDMParam->pOEMDMOut);
    OEMDebugMessage(TEXT("\tcbBufSize = %d\r\n"), pOemDMParam->cbBufSize);

    OEMDebugMessage(TEXT("\n"));

}

#if DBG
    DBG_FLAGS gafdSURFOBJ_fjBitmap[] = {
        { L"BMF_TOPDOWN",       BMF_TOPDOWN},
        { L"BMF_NOZEROINIT",        BMF_NOZEROINIT},
        { L"BMF_DONTCACHE",     BMF_DONTCACHE},
        { L"BMF_USERMEM",       BMF_USERMEM},
        { L"BMF_KMSECTION",     BMF_KMSECTION},
        { L"BMF_NOTSYSMEM",     BMF_NOTSYSMEM},
        { L"BMF_WINDOW_BLT",    BMF_WINDOW_BLT},
        {NULL, 0}               // The NULL entry is important
//      { L"BMF_UMPDMEM",       BMF_UMPDMEM},
//      { L"BMF_RESERVED",      BMF_RESERVED},
    };
#else
    DBG_FLAGS gafdSURFOBJ_fjBitmap[] = {
        {NULL, 0}
    };
#endif

void __stdcall
COemUniDbg::
vDumpSURFOBJ(
    INT         iDebugLevel,
    PWSTR       pszInLabel,
    SURFOBJ     *pso
    )

/*++

Routine Description:

    Dumps the members of a SURFOBJ structure.
    
Arguments:

    iDebugLevel - desired output debug level
    pszInLabel - output label string
    pso - pointer to the SURFOBJ strct to be dumped

Return Value:

    NONE

--*/

{
    // Check if the debug level is appropriate
    //
    if (iDebugLevel < giDebugLevel)
    {
        // Nothing to output here
        //
        return;
    }

    // Prepare the label string
    //
    PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pso");

    // Return if strct to be dumped is invalid
    //
    if (!pso)
    {
        OEMDebugMessage(TEXT("\nSURFOBJ [%s]: NULL\r\n"), pszLabel);

        // Nothing else to output
        //
        return;
    }
    
    // Format the data
    //
    OEMDebugMessage(TEXT("\nSURFOBJ [%s]: %#x\r\n"), pszLabel, pso);
    OEMDebugMessage(TEXT("\tdhSurf: %#x\r\n"), pso->dhsurf);
    OEMDebugMessage(TEXT("\thSurf: %#x\r\n"), pso->hsurf);
    OEMDebugMessage(TEXT("\tdhpdev: %#x\r\n"), pso->dhpdev);
    OEMDebugMessage(TEXT("\thdev: %#x\r\n"), pso->hdev);
    OEMDebugMessage(TEXT("\tsizlBitmap: [%ld x %ld]\r\n"), pso->sizlBitmap.cx, pso->sizlBitmap.cy);
    OEMDebugMessage(TEXT("\tcjBits: %ld\r\n"), pso->cjBits);
    OEMDebugMessage(TEXT("\tpvBits: %#x\r\n"), pso->pvBits);
    OEMDebugMessage(TEXT("\tpvScan0: %#x\r\n"), pso->pvScan0);
    OEMDebugMessage(TEXT("\tlDelta: %ld\r\n"), pso->lDelta);
    OEMDebugMessage(TEXT("\tiUniq: %ld\r\n"), pso->iUniq);

    PWSTR psziBitmapFormat = L"0";
    switch (pso->iBitmapFormat)
    {
        case BMF_1BPP : psziBitmapFormat = L"BMF_1BPP" ; break;
        case BMF_4BPP : psziBitmapFormat = L"BMF_4BPP" ; break;
        case BMF_8BPP : psziBitmapFormat = L"BMF_8BPP" ; break;
        case BMF_16BPP: psziBitmapFormat = L"BMF_16BPP"; break;
        case BMF_24BPP: psziBitmapFormat = L"BMF_24BPP"; break;
        case BMF_32BPP: psziBitmapFormat = L"BMF_32BPP"; break;
        case BMF_4RLE : psziBitmapFormat = L"BMF_4RLE" ; break;
        case BMF_8RLE : psziBitmapFormat = L"BMF_8RLE" ; break;
        case BMF_JPEG : psziBitmapFormat = L"BMF_JPEG" ; break;
        case BMF_PNG  : psziBitmapFormat = L"BMF_PNG " ; break;
    }
    OEMDebugMessage(TEXT("\tiBitmapFormat: %s\r\n"), psziBitmapFormat);

    PWSTR psziType = L"0";
    switch (pso->iType)
    {
        case STYPE_BITMAP   : psziType = L"STYPE_BITMAP"   ; break;
        case STYPE_DEVBITMAP: psziType = L"STYPE_DEVBITMAP"; break;
        case STYPE_DEVICE   : psziType = L"STYPE_DEVICE"   ; break;
    }
    OEMDebugMessage(TEXT("\tiType: %s\r\n"), psziType);

    OEMDebugMessage(TEXT("\tfjBitmap: "));
    if (STYPE_BITMAP == pso->iType)
        vDumpFlags(pso->fjBitmap, gafdSURFOBJ_fjBitmap);
    else
        OEMDebugMessage(TEXT("IGNORE\r\n"));

    OEMDebugMessage(TEXT("\n"));

}

#if DBG
    DBG_FLAGS gafdSTROBJ_flAccel[] = {
        { L"SO_FLAG_DEFAULT_PLACEMENT",             SO_FLAG_DEFAULT_PLACEMENT},
        { L"SO_HORIZONTAL",                         SO_HORIZONTAL},
        { L"SO_VERTICAL",                           SO_VERTICAL},
        { L"SO_REVERSED",                           SO_REVERSED},
        { L"SO_ZERO_BEARINGS",                      SO_ZERO_BEARINGS},
        { L"SO_CHAR_INC_EQUAL_BM_BASE",         SO_CHAR_INC_EQUAL_BM_BASE},
        { L"SO_MAXEXT_EQUAL_BM_SIDE",               SO_MAXEXT_EQUAL_BM_SIDE},
        { L"SO_DO_NOT_SUBSTITUTE_DEVICE_FONT",      SO_DO_NOT_SUBSTITUTE_DEVICE_FONT},
        { L"SO_GLYPHINDEX_TEXTOUT",                 SO_GLYPHINDEX_TEXTOUT},
        { L"SO_ESC_NOT_ORIENT",                     SO_ESC_NOT_ORIENT},
        { L"SO_DXDY",                               SO_DXDY},
        { L"SO_CHARACTER_EXTRA",                    SO_CHARACTER_EXTRA},
        { L"SO_BREAK_EXTRA",                            SO_BREAK_EXTRA},
        {NULL, 0}                                   // The NULL entry is important
    };
#else
    DBG_FLAGS gafdSTROBJ_flAccel[] = {
        {NULL, 0}
    };
#endif

void __stdcall
COemUniDbg::
vDumpSTROBJ(
    INT         iDebugLevel,
    PWSTR       pszInLabel,
    STROBJ      *pstro
    )

/*++

Routine Description:

    Dumps the members of a STROBJ structure.
    
Arguments:

    iDebugLevel - desired output debug level
    pszInLabel - output label string
    pstro - pointer to the STROBJ strct to be dumped

Return Value:

    NONE

--*/

{
    // Check if the debug level is appropriate
    //
    if (iDebugLevel < giDebugLevel)
    {
        // Nothing to output here
        //
        return;
    }

    // Prepare the label string
    //
    PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pstro");

    // Return if strct to be dumped is invalid
    //
    if (!pstro)
    {
        OEMDebugMessage(TEXT("\nSTROBJ [%s]: NULL\r\n"), pszLabel);

        // Nothing else to output
        //
        return;
    }
    
    // Format the data
    //
    OEMDebugMessage(TEXT("\nSTROBJ [%s]: %#x\r\n"), pszLabel, pstro);
    OEMDebugMessage(TEXT("\tcGlyphs: %ld\r\n"), pstro->cGlyphs);
    OEMDebugMessage(TEXT("\tflAccel: "));
    vDumpFlags(pstro->flAccel, gafdSTROBJ_flAccel);
    OEMDebugMessage(TEXT("\tulCharInc: %ld\r\n"), pstro->ulCharInc);
    OEMDebugMessage(TEXT("\trclBkGround: (%ld, %ld) (%ld, %ld)\r\n"), pstro->rclBkGround.left, pstro->rclBkGround.top, pstro->rclBkGround.right, pstro->rclBkGround.bottom);
    if (!pstro->pgp)
        OEMDebugMessage(TEXT("\tpgp: NULL\r\n"));
    else
        OEMDebugMessage(TEXT("\tpgp: %#x\r\n"), pstro->pgp);
    OEMDebugMessage(TEXT("\tpwszOrg: \"%s\"\r\n"), pstro->pwszOrg);

    OEMDebugMessage(TEXT("\n"));

}

#if DBG
    DBG_FLAGS gafdFONTOBJ_flFontType[] = {
        { L"FO_TYPE_RASTER",        FO_TYPE_RASTER},
        { L"FO_TYPE_DEVICE",        FO_TYPE_DEVICE},
        { L"FO_TYPE_TRUETYPE",  FO_TYPE_TRUETYPE},
        { L"FO_TYPE_OPENTYPE",  0x8},
        { L"FO_SIM_BOLD",       FO_SIM_BOLD},
        { L"FO_SIM_ITALIC",     FO_SIM_ITALIC},
        { L"FO_EM_HEIGHT",      FO_EM_HEIGHT},
        { L"FO_GRAY16",         FO_GRAY16},
        { L"FO_NOGRAY16",       FO_NOGRAY16},
        { L"FO_CFF",                FO_CFF},
        { L"FO_POSTSCRIPT",     FO_POSTSCRIPT},
        { L"FO_MULTIPLEMASTER", FO_MULTIPLEMASTER},
        { L"FO_VERT_FACE",      FO_VERT_FACE},
        { L"FO_DBCS_FONT",      FO_DBCS_FONT},
        {NULL, 0}               // The NULL entry is important
    };
#else
    DBG_FLAGS gafdFONTOBJ_flFontType[] = {
        {NULL, 0}
    };
#endif

void __stdcall
COemUniDbg::
vDumpFONTOBJ(
    INT         iDebugLevel,
    PWSTR       pszInLabel,
    FONTOBJ     *pfo
    )

/*++

Routine Description:

    Dumps the members of a FONTOBJ structure.
    
Arguments:

    iDebugLevel - desired output debug level
    pszInLabel - output label string
    pfo - pointer to the FONTOBJ strct to be dumped

Return Value:

    NONE

--*/

{
    // Check if the debug level is appropriate
    //
    if (iDebugLevel < giDebugLevel)
    {
        // Nothing to output here
        //
        return;
    }

    // Prepare the label string
    //
    PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pfo");

    // Return if strct to be dumped is invalid
    //
    if (!pfo)
    {
        OEMDebugMessage(TEXT("\nFONTOBJ [%s]: NULL\r\n"), pszLabel);

        // Nothing else to output
        //
        return;
    }
    
    // Format the data
    //
    OEMDebugMessage(TEXT("\nFONTOBJ [%s]: %#x\r\n"), pszLabel, pfo);
    OEMDebugMessage(TEXT("\tiUniq: %ld\r\n"), pfo->iUniq);
    OEMDebugMessage(TEXT("\tiFace: %ld\r\n"), pfo->iFace);
    OEMDebugMessage(TEXT("\tcxMax: %ld\r\n"), pfo->cxMax);
    OEMDebugMessage(TEXT("\tflFontType: "));
    vDumpFlags(pfo->flFontType, gafdFONTOBJ_flFontType);
    OEMDebugMessage(TEXT("\tiTTUniq: %#x\r\n"), pfo->iTTUniq);
    OEMDebugMessage(TEXT("\tiFile: %#x\r\n"), pfo->iFile);
    OEMDebugMessage(TEXT("\tsizLogResPpi: [%ld x %ld]\r\n"), pfo->sizLogResPpi.cx, pfo->sizLogResPpi.cy);
    OEMDebugMessage(TEXT("\tulStyleSize: %ld\r\n"), pfo->ulStyleSize);
    if (!pfo->pvConsumer)
        OEMDebugMessage(TEXT("\tpvConsumer: NULL\r\n"));
    else
        OEMDebugMessage(TEXT("\tpvConsumer: %#x\r\n"), pfo->pvConsumer);
    if (!pfo->pvProducer)
        OEMDebugMessage(TEXT("\tpvProducer: NULL\r\n"));
    else
        OEMDebugMessage(TEXT("\tpvProducer: %#x\r\n"), pfo->pvProducer);

    OEMDebugMessage(TEXT("\n"));

}

void __stdcall
COemUniDbg::
vDumpCLIPOBJ(
    INT         iDebugLevel,
    PWSTR       pszInLabel,
    CLIPOBJ     *pco
    )

/*++

Routine Description:

    Dumps the members of a CLIPOBJ structure.
    
Arguments:

    iDebugLevel - desired output debug level
    pszInLabel - output label string
    pco - pointer to the CLIPOBJ strct to be dumped

Return Value:

    NONE

--*/

{
    // Check if the debug level is appropriate
    //
    if (iDebugLevel < giDebugLevel)
    {
        // Nothing to output here
        //
        return;
    }

    // Prepare the label string
    //
    PCWSTR pszLabel = EnsureLabel(pszInLabel, L"pco");

    // Return if strct to be dumped is invalid
    //
    if (!pco)
    {
        OEMDebugMessage(TEXT("\nCLIPOBJ [%s]: NULL\r\n"), pszLabel);

        // Nothing else to output
        //
        return;
    }
    
    // Format the data
    //
    OEMDebugMessage(TEXT("\nCLIPOBJ [%s]: %#x\r\n"), pszLabel, pco);
    OEMDebugMessage(TEXT("\tiUniq: %ld\r\n"), pco->iUniq);
    OEMDebugMessage(TEXT("\trclBounds: (%ld, %ld) (%ld, %ld)\r\n"), pco->rclBounds.left, pco->rclBounds.top, pco->rclBounds.right, pco->rclBounds.bottom);

⌨️ 快捷键说明

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