/*++
*******************************************************************************
* Copyright (c) 1990-99 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:

   digilib.h

Abstract:

   DigiLib master include file.  DigiLib is a kernelmode library filled with utility
	routines for drivers.

Author:

   Michael Zarns

--*/

#ifndef DIGILIB
#define DIGILIB

#define UNICODE
#include <ntddk.h>
#include <ntverp.h>
#define NT5_BUILD      ( VER_PRODUCTBUILD > 1381 )

#if !NT5_BUILD
// 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

// Use STATIC for static routines.  This define makes the routines non-static in debug
// builds, allowing the debugger to see them, but makes them static for free builds
// helping the compiler to better optimize.
// *** Turned STATIC off!  Debugging free builds is nearly impossible when function **
// *** names are hidden (e.g. static).                                              **
//
// Use INLINE for inline routines.  Like STATIC, allows you to source-level step 
// through these routines, while in free builds tell the compiler you want them INLINE.
#if DBG
#define STATIC
#define INLINE
#else
#define STATIC 
#define INLINE __inline
#endif

#if !defined(MIN)
#define MIN( a, b ) 			( ((a) < (b)) ? (a) : (b) )
#endif

#if !defined (MAX)
#define MAX( a, b ) 			( ((a) > (b)) ? (a) : (b) )
#endif

#if !defined (ARRAY_SIZE)
#define ARRAY_SIZE(a)		( (sizeof (a) / sizeof (a)[0]) )
#endif

#if !defined (ELEMENT_COUNT)
#define ELEMENT_COUNT(a)	( (sizeof (a) / sizeof (a)[0]) )
#endif

// Many kernel calls require timeout values counted in units of 100 nanoseconds. Note
// that a negative number means "relative to now" and a positive number means 
// "absolute time".
// 
// A millisecond delay, relative.
#define ONE_MILLISECOND  ( -10000 )


#include "digialloc.h"
#include "digidebug.h"
#include "digifile.h"
#include "digilock.h"
#include "digilog.h"
#include "digimem.h"
#include "digireg.h"
#include "digires.h"
#include "digistring.h"
#include "memprint.h"
#include "digipnp.h"

#endif