1 | /*
|
---|
2 | * TAP-Win32 -- A kernel driver to provide virtual tap device functionality
|
---|
3 | * on Windows. Originally derived from the CIPE-Win32
|
---|
4 | * project by Damion K. Wilson, with extensive modifications by
|
---|
5 | * James Yonan.
|
---|
6 | *
|
---|
7 | * All source code which derives from the CIPE-Win32 project is
|
---|
8 | * Copyright (C) Damion K. Wilson, 2003, and is released under the
|
---|
9 | * GPL version 2 (see below).
|
---|
10 | *
|
---|
11 | * All other source code is Copyright (C) 2002-2005 OpenVPN Solutions LLC,
|
---|
12 | * and is released under the GPL version 2 (see below).
|
---|
13 | *
|
---|
14 | * This program is free software; you can redistribute it and/or modify
|
---|
15 | * it under the terms of the GNU General Public License version 2
|
---|
16 | * as published by the Free Software Foundation.
|
---|
17 | *
|
---|
18 | * This program is distributed in the hope that it will be useful,
|
---|
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
21 | * GNU General Public License for more details.
|
---|
22 | *
|
---|
23 | * You should have received a copy of the GNU General Public License
|
---|
24 | * along with this program (see the file COPYING included with this
|
---|
25 | * distribution); if not, write to the Free Software Foundation, Inc.,
|
---|
26 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
27 | */
|
---|
28 |
|
---|
29 | #ifdef __cplusplus
|
---|
30 | extern "C" {
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include "hexdump.h"
|
---|
34 |
|
---|
35 | #ifndef NDIS_MINIPORT_DRIVER
|
---|
36 |
|
---|
37 | VOID (*DbgMessage)(char *p_Format, ...) = DisplayDebugString;
|
---|
38 |
|
---|
39 | VOID DisplayDebugString (char *p_Format, ...)
|
---|
40 | {
|
---|
41 | static char l_Buffer [4096];
|
---|
42 |
|
---|
43 | va_list l_ArgumentList;
|
---|
44 | va_start (l_ArgumentList, p_Format);
|
---|
45 | vsprintf (l_Buffer, p_Format, l_ArgumentList);
|
---|
46 | va_end (l_ArgumentList);
|
---|
47 |
|
---|
48 | OutputDebugStringA (l_Buffer);
|
---|
49 | }
|
---|
50 |
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | VOID HexDump (unsigned char *p_Buffer, unsigned long p_Size)
|
---|
54 | {
|
---|
55 | unsigned long l_Index, l_Idx;
|
---|
56 | unsigned char l_Row [17];
|
---|
57 |
|
---|
58 | for (l_Index = l_Row [16] = 0; l_Index < p_Size || l_Index % 16; ++l_Index)
|
---|
59 | {
|
---|
60 | if (l_Index % 16 == 0)
|
---|
61 | DEBUGP (("%05x ", l_Index));
|
---|
62 | DEBUGP (("%02x ", l_Row [l_Index % 16] = (l_Index < p_Size ? p_Buffer [l_Index] : 0)));
|
---|
63 | l_Row [l_Index % 16] = IfPrint (l_Row [l_Index % 16]);
|
---|
64 | if ((l_Index + 1) % 16 == 0)
|
---|
65 | DEBUGP ((" %s\n", l_Row));
|
---|
66 | }
|
---|
67 |
|
---|
68 | DEBUGP (("\n"));
|
---|
69 | }
|
---|
70 |
|
---|
71 | #ifdef __cplusplus
|
---|
72 | }
|
---|
73 | #endif
|
---|
74 |
|
---|