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


// DigiInf.h : main header file for the DIGIINF DLL
//

#if !defined(AFX_INFENTRY_H__3D8A19D4_D476_11D1_BAB6_00805F9E3135__INCLUDED_)
#define AFX_INFENTRY_H__3D8A19D4_D476_11D1_BAB6_00805F9E3135__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif

#include <afxmt.h>

#if defined NT5
#include <htmlhelp.h>
#include <newdev.h>
#endif // #if defined NT5

#include "resource.h"      // main symbols
#include "Adapter.h"
#include "TreeDialog.h"

#if defined NT5

// Prototypes for global functions
BOOL OpenAdapterKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, HKEY * const phKey);
BOOL OpenAdapterParamsKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, HKEY * const phKey);
void RemoveAdapterParams(HDEVINFO DeviceInfoSet,PSP_DEVINFO_DATA DeviceInfoData);
void WriteAdapterParams (HDEVINFO DeviceInfoSet,PSP_DEVINFO_DATA DeviceInfoData, BOOL fCreateAdapter =TRUE);
BOOL WriteAdapterLineProtocol(   HDEVINFO DeviceInfoSet,
                                 PSP_DEVINFO_DATA DeviceInfoData,
                                 CString const LineProtocol);
BOOL AdapterDefaultRequiresPropChange( HDEVINFO DeviceInfoSet,
                                       PSP_DEVINFO_DATA DeviceInfoData
                                       );

// Data for the PrivateData member of the 
// PCOINSTALLER_CONTEXT_DATA structure, used
// to maintain state across DI_FUNCTION msgs.
typedef struct
{
   BOOL     m_bDoUpdateDriver;
   BOOL     m_bUpgradingFromWanlinks;
   CString *m_pcsFriendlyName;
} DIGI_CO_INSTALLER_PRIVATE_DATA, *PDIGI_CO_INSTALLER_PRIVATE_DATA;

// Fcns. to maintain state between DIF_INSTALLDEVICE msgs.
void CreatePrivateData(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PCOINSTALLER_CONTEXT_DATA Context);
void PostProcessPrivateData(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PCOINSTALLER_CONTEXT_DATA Context);

// DIF_INSTALLDEVICE and DIF_REMOVE helper fcns. for DigiDxbCoInstaller
void CleanupUninstalledWanlinksInstallation(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PDIGI_CO_INSTALLER_PRIVATE_DATA PrivateData);
void CleanupRegistryServicesKeys(CString const & driverPrefix);
void CleanupRegistrySoftwareKey(CString const & strSubKey);

// DIF_INSTALLDEVICE and DIF_REMOVE helper fcns. for DigiDxbClientCoInstaller
void PreparePortNameForClassInstaller(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData);
void CleanupRegistrySerialcommKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData);

void CompleteModemClassUpdate(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData);

// Data for the PropPages
typedef struct
{
   HDEVINFO                    DeviceInfoSet;
   PSP_DEVINFO_DATA            DeviceInfoData;
} PROPPAGEPARAMS, *PPROPPAGEPARAMS;

// This keeps track of our storage, used on a list so multiple instances of the
// configuration are supported (NT5's Device Manager allows this...)
class CHwWizProtocolPropPage; // forward
class CHwWizDigiWizPage;      // forward

class CDevPrivateData : public CObject
{
public:
   CDevPrivateData(CString AdapterType, CString AdapterRegPath);
   ~CDevPrivateData();
   // data
   CString m_strAdapterType;          // Strings used to identify the instance
   CString m_strAdapterRegPath;
   CTreeDialog * m_pTree;             // Advanced properties page
   CHwWizProtocolPropPage * m_pHwWizProtocolPropPage; // Hardware Wiz prop page
   CHwWizDigiWizPage * m_pHwWizDigiWizPage;           // Wrapper for Digi Wizard....
};

#endif // #if defined NT5

/////////////////////////////////////////////////////////////////////////////
// CINFEntryApp
// See DigiInf.cpp for the implementation of this class
//

class CINFEntryApp : public CWinApp
{
public:
   CINFEntryApp();
   ~CINFEntryApp();

   void SetConfigureCwnd(char const * const pszInfWnd);
#if !defined NT5
   void SetAdapterType(CString const & strAdapterType) { m_strAdapterType = strAdapterType; }
   void SetAdapterInstance(CString const & strAdapterInstance) { m_strAdapterInstance = strAdapterInstance; }
   CString GetAdapterInstance(void) {return m_strAdapterInstance;}
   void SetAdapterRegPath(CString const & strAdapterRegPath) { m_strAdapterRegPath = strAdapterRegPath; }
   CString GetAdapterRegPath(void) {return m_strAdapterRegPath;}
#endif // #if !defined NT5
   BOOL RefreshAdapter(CAdapter ** const ppAdapter = NULL);
   UINT GetAGoin(void);
   UINT RunInstallWizard(CAdapter * const pAdapter, BOOL fSetParameters = FALSE);
   void ConfigPamA(void);
#if defined NT5
   CDevPrivateData * const GetDevicePrivateData(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData);
   void RemoveDevicePrivateData(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData);
   void RemovePamA(CString const & serviceName);
#endif // #if defined NT5

// Overrides
   // ClassWizard generated virtual function overrides
   //{{AFX_VIRTUAL(CINFEntryApp)
   public:
   virtual void WinHelp(DWORD dwData, UINT nCmd = HELP_CONTEXT);
   //}}AFX_VIRTUAL

   //{{AFX_MSG(CINFEntryApp)
      // NOTE - the ClassWizard will add and remove member functions here.
      //    DO NOT EDIT what you see in these blocks of generated code !
   //}}AFX_MSG
   DECLARE_MESSAGE_MAP()

public:

#if !defined NT5
   CAdapter * m_pAdapter;
   CTreeDialog * m_pTreeDialog;
#endif // #if !defined NT5

private:

#if defined NT5
   // List containing private data associated with the device instances
   CObList m_PrivateDataList;
   // Synchro for the list
   CCriticalSection * m_pCriticalSection;
#else // #if defined NT5
   CString m_strAdapterType;
   CString m_strAdapterInstance;
   CString m_strAdapterRegPath;
#endif // #if defined NT5

   BOOL m_fInWizard;
   BOOL m_fInTreeDialog;

   CWnd m_InfCwnd;

   void SetHelpFilePath(void);
   UINT RunTreeDialog(void);
};


/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_INFENTRY_H__3D8A19D4_D476_11D1_BAB6_00805F9E3135__INCLUDED_)
