/*++
*******************************************************************************
* Copyright (c) 1999-2000 Digi International Inc., All Rights Reserved        *
*                                                                             *
* This software contains proprietary and confidential information of Digi     *
* International Inc.  By accepting transfer of this copy, Recipient agrees    *
* to retain this software in confidence, to prevent disclosure to others,     *
* and to make no use of this software other than that for which it was        *
* delivered.  This is an unpublished copyrighted work of Digi International   *
* Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly   *
* prohibited.                                                                 *
*                                                                             *
* Restricted Rights Legend                                                    *
*                                                                             *
* Use, duplication, or disclosure by the Government is subject to             *
* restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in         *
* Technical Data and Computer Software clause at DFARS 252.227-7031 or        *
* subparagraphs (c)(1) and (2) of the Commercial Computer Software -          *
* Restricted Rights at 48 CFR 52.227-19, as applicable.                       *
*                                                                             *
* Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343          *
*                                                                             *
*******************************************************************************

Module Name:

	kdwrap.h

Abstract:

	Wrapper functions for kd APIs.  These can be called from a ddk-centric module, 
	avoiding an attempt to #include usermode windbg headers alongside ddk headers.

	Trying to include both NT4 DDK headers and new (e.g. win2k) Platform SDK windbg
	headers is disasterous due to changes for 64-bit windows in the new sdk.

Author:

	Michael Zarns

--*/

#ifndef KDWRAP_H
#define KDWRAP_H

#ifdef __cplusplus
#define WDBG_CPPMOD extern "C"
#else
#define WDBG_CPPMOD
#endif

#ifdef __cplusplus
extern "C" {
#endif

#define NT5_BUILD      ( VER_PRODUCTBUILD > 1381 )

#if !NT5_BUILD && !_M_IA64
// NT5 and newer DDKs define these types.  They float (at compile time) from 32 to 64
// bit width depending on the size of pointers in the system being compiled for.
// Define it for NT4.
typedef ULONG        ULONG_PTR, *PULONG_PTR;
typedef LONG         LONG_PTR,  *PLONG_PTR;
typedef int          INT_PTR,   *PINT_PTR;
typedef unsigned int UINT_PTR,  *PUINT_PTR;
#endif

void
__cdecl WdbgPrint( PCSTR pFormat, ... );

ULONG_PTR WdbgGetExpression( PCSTR pExpression );

ULONG WdbgReadMemory( ULONG_PTR Offset, PVOID pBuffer, ULONG cb, PULONG pcbRead );

ULONG WdbgCheckControlC( VOID );

#define WDBG_API(s)                                \
    WDBG_CPPMOD VOID                               \
    s(                                             \
        HANDLE                 hCurrentProcess,    \
        HANDLE                 hCurrentThread,     \
        ULONG                  dwCurrentPc,        \
        ULONG                  dwProcessor,        \
        PCSTR                  args                \
     )

#ifdef __cplusplus
}
#endif

#endif
