WDK源码中 usbView 的编译及说明 .


WDK源码中 usbView 例子的编译及说明. 可参考文章: http://blog.csdn.net/chenyujing1234/article/details/7577320#comments
资源截图
代码片段和文件信息
/*++

Copyright (c) 1997-1998 Microsoft Corporation

Module Name:

    DEBUG.C

Abstract:

    This source file contains debug routines.

Environment:

    user mode

Revision History:

    07-08-97 : created

--*/

//*****************************************************************************
// I N C L U D E S
//*****************************************************************************

#include 
#include setyps.h>
#include 
#include 
#include “usbview.h“

#if DBG

//*****************************************************************************
// T Y P E D E F S
//*****************************************************************************

typedef struct _ALLOCHEADER
{
    LIST_ENTRY  ListEntry;

    PCTSTR       File;

    ULONG       Line;

} ALLOCHEADER *PALLOCHEADER;


//*****************************************************************************
// G L O B A L S
//*****************************************************************************

LIST_ENTRY AllocListHead =
{
    &AllocListHead
    &AllocListHead
};


//*****************************************************************************
//
// MyAlloc()
//
//*****************************************************************************

HGLOBAL
MyAlloc (
    __in PCTSTR File
    ULONG   Line
    DWORD   dwBytes

{
    PALLOCHEADER header;

    if (dwBytes)
    {
        dwBytes += sizeof(ALLOCHEADER);

        header = (PALLOCHEADER)GlobalAlloc(GPTR dwBytes);

        if (header != NULL)
        {
            InsertTailList(&AllocListHead &header->ListEntry);

            header->File = File;
            header->Line = Line;

            return (HGLOBAL)(header + 1);
        }
    }

    return NULL;
}

//*****************************************************************************
//
// MyReAlloc()
//
//*****************************************************************************

HGLOBAL
MyReAlloc (
    HGLOBAL hMem
    DWORD   dwBytes

{
    PALLOCHEADER header;
    PALLOCHEADER headerNew;

    if (hMem)
    {
        header = (PALLOCHEADER)hMem;

        header--;

        // Remove the old address from the allocation list
        //
        RemoveEntryList(&header->ListEntry);

        headerNew = GlobalReAlloc((HGLOBAL)header dwBytes GMEM_MOVEABLE|GMEM_ZEROINIT);

        if (headerNew != NULL)
        {
            // Add the new address to the allocation list
            //
            InsertTailList(&AllocListHead &headerNew->ListEntry);

            return (HGLOBAL)(headerNew + 1);
        }
        else
        {
            // If GlobalReAlloc fails the original memory is not freed
            // and the original handle and pointer are still valid.
            // Add the old address back to the allocation list.
            //
            InsertTailList(&AllocListHead &header->ListEntry)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-05-17 16:35  usbView
     文件        1846  2010-01-13 22:32  usbViewang.ico
     目录           0  2012-05-17 16:38  usbViewDebug
     文件        4171  2010-02-08 18:26  usbViewdebug.c
     文件        8896  2012-05-17 17:50  usbViewDebugBuildLog.htm
     文件       14959  2012-05-17 17:37  usbViewDebugdebug.obj
     文件       18836  2012-05-17 17:37  usbViewDebugdevnode.obj
     文件       66890  2012-05-17 17:37  usbViewDebugdispaud.obj
     文件      242106  2012-05-17 17:37  usbViewDebugdisplay.obj
     文件       60077  2012-05-17 17:37  usbViewDebugenum.obj
     文件          67  2012-05-17 17:50  usbViewDebugmt.dep
     文件        6674  2012-05-17 16:42  usbViewDebugRCa01236
     文件        6674  2012-05-17 16:41  usbViewDebugRCa02136
     文件        6674  2012-05-17 16:39  usbViewDebugRCa07960
     文件      139264  2012-05-17 17:50  usbViewDebugusbView.exe
     文件         387  2012-05-17 17:50  usbViewDebugusbView.exe.intermediate.manifest
     文件      680448  2012-05-17 17:50  usbViewDebugusbView.ilk
     文件       51560  2012-05-17 17:37  usbViewDebugusbview.obj
     文件      683008  2012-05-17 17:50  usbViewDebugusbView.pdb
     文件       16164  2012-05-17 17:50  usbViewDebugusbview.res
     文件      281600  2012-05-17 17:37  usbViewDebugvc80.idb
     文件       94208  2012-05-17 17:37  usbViewDebugvc80.pdb
     文件        4362  2012-05-17 18:21  usbViewdevnode.c
     文件       34534  2010-02-08 18:26  usbViewdispaud.c
     文件       38076  2010-02-08 18:26  usbViewdisplay.c
     文件       68490  2012-05-17 18:16  usbViewenum.c
     文件         766  2010-01-13 22:32  usbViewhub.ico
     文件        1060  2010-02-08 18:26  usbViewmakefile.mk
     文件       10134  2010-01-13 22:32  usbViewmonitor.ico
     文件         766  2010-01-13 22:32  usbViewport.ico
     文件        6712  2012-05-17 16:37  usbViewRCa00668
............此处省略14个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)