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

   digireg.h

Abstract:

   Routines to read from the registry.

Author:

   Michael Zarns

--*/
#ifndef DIGIREG
#define DIGIREG

NTSTATUS DigiRegOpenKey( OUT PHANDLE phKey,
                         IN PCWSTR   KeyName );

NTSTATUS DigiRegOpenSubkey( OUT PHANDLE phSubKey,
                            IN HANDLE   hKey,
                            IN PCWSTR   SubKeyName );

NTSTATUS DigiRegCreateKey( OUT PHANDLE phKey,
                           IN PCWSTR   KeyName );

NTSTATUS DigiRegCreateSubkey( OUT PHANDLE phSubKey,
                              IN HANDLE   hKeyParent,
                              IN PCWSTR   SubKeyName );

NTSTATUS DigiRegWriteBinary( IN HANDLE hKey,
                             IN PCWSTR pValue,
                             IN PVOID  pBuf,
                             IN ULONG  cbBuf );

NTSTATUS DigiRegWriteDword( IN HANDLE hKey,
                            IN PCWSTR pValue,
                            IN ULONG  dw );

NTSTATUS DigiRegWriteSz( IN HANDLE hKey, 
                         IN PCWSTR pValue,
                         IN PCWSTR pSz );

NTSTATUS DigiRegWriteMultiSz( IN HANDLE hKey,
                              IN PCWSTR pValue,
                              IN PUNICODE_STRING pMulti );

VOID DigiRegCloseKey( IN HANDLE hKey );

NTSTATUS DigiRegQueryMultiSz( IN HANDLE           hKey,
                              IN PCWSTR           pValue,
                              OUT PUNICODE_STRING pBuf,
                              IN ULONG            Flags,
                              IN PCWSTR           pDefault );

NTSTATUS DigiRegQuerySz( IN HANDLE           hKey,
                         IN PCWSTR           pValue,
                         OUT PUNICODE_STRING pBuf,
                         IN ULONG            Flags,
                         IN PCWSTR           pDefault );

VOID DigiRegFreeString( PUNICODE_STRING pString );


NTSTATUS DigiRegQueryDword( IN HANDLE          hKey,
                            IN PCWSTR          pValue,
                            OUT PULONG         pBuf,
                            IN ULONG           Flags,
                            IN ULONG           Default OPTIONAL );

NTSTATUS DigiRegQueryWord( IN HANDLE          hKey,
                           IN PCWSTR          pValue,
                           OUT PUSHORT        pBuf,
                           IN ULONG           Flags,
                           IN USHORT          Default OPTIONAL );

NTSTATUS DigiRegQueryByte( IN HANDLE          hKey,
                           IN PCWSTR          pValue,
                           OUT PUCHAR         pBuf,
                           IN ULONG           Flags,
                           IN UCHAR           Default OPTIONAL );

NTSTATUS DigiRegEnumSubkey( IN HANDLE           hKey,
                            IN ULONG            iSubkey,
                            OUT PUNICODE_STRING pSubkey );

// Flags values:

// If Optional is specified, the Default parameter is required.  If the registry read
// fails, the Default value will be used and the info status STATUS_BUFFER_ALL_ZEROS
// will be returned.
#define DigiRegFlagOptional			0x00000000

// If Required is specified, the Default parameter is ignored.  When a registry read
// fails, an error status is returned.
#define DigiRegFlagRequired 			0x00000001

// If ExceptionOnError is specified, an exception will be generated if the registry
// read fails.
#define DigiRegFlagExceptionOnError	0x00000002

#endif	// DIGIREG