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

📄 ptutils.cpp

📁 这个还是关于驱动与应用层通信的,主要是中间层的问题
💻 CPP
字号:
/////////////////////////////////////////////////////////////////////////////
//// INCLUDE FILES

#include "stdafx.h"
#include "ptuserio.h"
#include <ntddndis.h>

// Copyright And Configuration Management ----------------------------------
//
//               PassThruEx Support Utilities - ptutils.cpp
//
//                  Companion Sample Code for the Article
//
//        "Extending the Microsoft PassThru NDIS Intermediate Driver"
//
//    Copyright (c) 2003 Printing Communications Associates, Inc. (PCAUSA)
//                          http://www.pcausa.com
//
// The right to use this code in your own derivative works is granted so long
// as 1.) your own derivative works include significant modifications of your
// own, 2.) you retain the above copyright notices and this paragraph in its
// entirety within sources derived from this code.
// This product includes software developed by PCAUSA. The name of PCAUSA
// may not be used to endorse or promote products derived from this software
// without specific prior written permission.
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// End ---------------------------------------------------------------------

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

using namespace std;



/////////////////////////////////////////////////////////////////////////////
//// HexDump
//
// Purpose
// Dump a HEX/ASCII representation of a buffer to the console display.
//
// Parameters
//
// Return Value
//
// Remarks
//

int UTIL_HexDump( long start, PUCHAR buf, int len )
{
   int i;

   //
   // Sanity Checks
   //
   if( !buf )
   {
      return( 0 );
   }

   if( len == 0L )
   {
      return( 0 );
   }

   while( len > 0L )
   {
      printf( "%6.6X: ", start );

      //
      // Print The HEX Representations
      //
      for( i = 0; i < 8; ++i )
      {
         if( len - i > 0 )
         {
            printf( " %2.2X", buf[ i ] & 0xFF );
         }
         else
         {
            printf( "   " );
         }
      }

      printf( " :" );

      for( i = 8; i < 16; ++i )
      {
         if( len - i > 0 )
         {
            printf( " %2.2X", buf[ i ] & 0xFF );
         }
         else
         {
            printf( "   " );
         }
      }


      //
      // Print The ASCII Representations
      //
      printf( "    " );

      for( i = 0; i < 16; ++i )
      {
         if( len - i > 0 )
         {
            if( isprint( buf[ i ] ) )
            {
               printf( "%c", buf[ i ] );
            }
            else
            {
               printf( "%c", '.' );
            }
         }
         else
         {
            printf( "%c", '.' );
         }
      }


      printf( "\n" );

      len -= 16;
      start += 16L;
      buf += 16;
   }

   return( 0 );
}



⌨️ 快捷键说明

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