// Viewer.h: interface for the CViewer class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_VIEWER_H__E8C127E1_D5E3_11D4_B688_004033A4E3E4__INCLUDED_)
#define AFX_VIEWER_H__E8C127E1_D5E3_11D4_B688_004033A4E3E4__INCLUDED_

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

#include <windows.h>
#include <wininet.h>

class CDUiMan;
class CDUiWindow;
class CDUiListBox;
class CDUiEditBox;
class CDUiText;
class CDUiButton;
class CRasConnection;

#define WM_SPAWNED_PROCESS  (WM_USER+1)

class CViewer  
{
public:
	CViewer();
	virtual ~CViewer();

    LRESULT WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam);
    DWORD   Initialize(HINSTANCE hInstance, HWND hWnd);
        
    void SetDUiMan(CDUiMan *pDUiMan) { m_pDUiMan = pDUiMan; };
protected:
    BOOL CreateHelpWindow();
    
    void OnBootCD();
    void OnDblclkList();
    void OnSelChangeViewSelector();
    void OnSelChangeListBox();
    void LaunchProgram();
    void PlayWaveFile();

    BOOL GetChangedDirectory(CDUiText *pText, CDUiListBox *pListBox);
    BOOL ChangeDirectory(WCHAR *wszDirectory, CDUiText *pText, CDUiListBox *pListBox);
    BOOL IsRootPath(WCHAR *wszDirectory);

    BOOL ChangeRegistryKey(WCHAR *wszKey);
    BOOL IsRootKey(WCHAR *wszKey);

    BOOL ToggleWindow(CDUiWindow *pWindow);

    DWORD LoadBootFiles(BYTE **pbtIP, BYTE **pbtBoot, DWORD *pdwBootSize);
    enum
    {
        VIEWING_FILES,
        VIEWING_REGISTRY
    };

    CDUiMan     *m_pDUiMan;
    CDUiWindow  *m_pDebugWindow;
    CDUiWindow  *m_pHelpWindow;

    CDUiWindow  *m_pMainWindow;
    CDUiListBox *m_pViewSelector;
    CDUiListBox *m_pDetails;
    CDUiListBox *m_pListBox;
    CDUiText    *m_pTextBox;

    HWND m_hWnd;
    HINSTANCE m_hParentInstance;

    DWORD m_dwCurrentViewing;

    WCHAR m_wszCurrentDirectory[512];

    WCHAR m_wszCurrentRegistryKey[2048];
    HKEY  m_hkCurrentRegistryRoot;
    HANDLE m_hCD;

    BYTE *m_pbtStoredIP;
    BYTE *m_pbtStoredBoot;
    DWORD m_dwStoredBootSize;
};

#endif // !defined(AFX_VIEWER_H__E8C127E1_D5E3_11D4_B688_004033A4E3E4__INCLUDED_)
