diff --git a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.dsp b/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.dsp index 2fcd77565a2e..4687c62dacf7 100644 --- a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.dsp +++ b/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.dsp @@ -102,6 +102,14 @@ SOURCE=.\RegMozCtlDlg.cpp # End Source File # Begin Source File +SOURCE=.\RegTask.cpp +# End Source File +# Begin Source File + +SOURCE=.\RegTaskManager.cpp +# End Source File +# Begin Source File + SOURCE=.\StdAfx.cpp # ADD CPP /Yc"stdafx.h" # End Source File @@ -119,6 +127,14 @@ SOURCE=.\RegMozCtlDlg.h # End Source File # Begin Source File +SOURCE=.\RegTask.h +# End Source File +# Begin Source File + +SOURCE=.\RegTaskManager.h +# End Source File +# Begin Source File + SOURCE=.\Resource.h # End Source File # Begin Source File diff --git a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.h b/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.h index 695a7a082477..02b0c5831ecb 100644 --- a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.h +++ b/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.h @@ -40,6 +40,7 @@ public: DECLARE_MESSAGE_MAP() }; +static const TCHAR *c_szValueBinDirPath = _T("BinDirPath"); ///////////////////////////////////////////////////////////////////////////// diff --git a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.rc b/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.rc index cef8bc10930e..7c10366fe87c 100644 --- a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.rc +++ b/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.rc @@ -26,32 +26,24 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // Dialog // -IDD_REGMOZCTL_DIALOG DIALOGEX 0, 0, 210, 199 +IDD_REGMOZCTL_DIALOG DIALOGEX 0, 0, 270, 241 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW CAPTION "RegMozCtl" FONT 8, "MS Sans Serif" BEGIN - ICON IDI_MOZILLA,IDC_STATIC,7,7,20,20 - LTEXT "This application registers/deregisters the Mozilla Control and ensures that its dependent DLLs are listed as SHARED so that they can be found when the control is used by other applications.", - IDC_STATIC,34,7,169,35 + ICON IDI_MOZILLA,IDC_STATIC,7,7,21,20 + LTEXT "This application registers/deregisters the Mozilla Control and ensures that Mozilla path and registry values are set so the control can be used by other applications.", + IDC_STATIC,35,7,228,30 LTEXT "You must choose the directory containing the Mozilla control and click on the Register or Deregister as appropriate.", - IDC_STATIC,7,47,196,17 - EDITTEXT IDC_MOZILLADIR,7,70,182,14,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_PICKDIR,190,70,13,14 - LTEXT "Now choose the component registry file and component directory the control uses or let RegMozCtl try to guess correct values for you.", - IDC_STATIC,7,89,196,27 - EDITTEXT IDC_COMPONENTFILE,7,134,182,14,ES_AUTOHSCROLL | - WS_DISABLED - PUSHBUTTON "...",IDC_PICKCOMPONENTFILE,190,134,13,14,WS_DISABLED - EDITTEXT IDC_COMPONENTPATH,7,157,182,14,ES_AUTOHSCROLL | - WS_DISABLED - PUSHBUTTON "...",IDC_PICKCOMPONENTPATH,190,157,13,14,WS_DISABLED - DEFPUSHBUTTON "&Register",IDC_REGISTER,7,178,50,14 - PUSHBUTTON "&Unregister",IDC_UNREGISTER,80,178,50,14 - PUSHBUTTON "&Close",IDCANCEL,153,178,50,14 - CONTROL "Automatic",IDC_AUTOMATIC,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,119,46,10 + IDC_STATIC,7,36,256,17 + EDITTEXT IDC_MOZILLADIR,7,55,242,14,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_PICKDIR,250,55,13,14 + DEFPUSHBUTTON "&Register",IDC_REGISTER,7,220,50,14 + PUSHBUTTON "&Unregister",IDC_UNREGISTER,80,220,50,14 + PUSHBUTTON "&Close",IDCANCEL,213,220,50,14 + CONTROL "List1",IDC_TASKLIST,"SysListView32",LVS_REPORT | + WS_BORDER | WS_TABSTOP,7,75,256,134 END @@ -109,9 +101,9 @@ BEGIN IDD_REGMOZCTL_DIALOG, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 203 + RIGHTMARGIN, 263 TOPMARGIN, 7 - BOTTOMMARGIN, 192 + BOTTOMMARGIN, 234 END END #endif // APSTUDIO_INVOKED diff --git a/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp b/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp index c24d85c4bb1f..31a2df456953 100644 --- a/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp +++ b/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp @@ -11,11 +11,6 @@ static char THIS_FILE[] = __FILE__; #endif -#define MOZ_CONTROL_REG_KEY _T("Software\\Mozilla\\") -#define MOZ_CONTROL_REG_VALUE_DIR _T("Dir") -#define MOZ_CONTROL_REG_VALUE_COMPONENT_PATH _T("ComponentPath") -#define MOZ_CONTROL_REG_VALUE_COMPONENT_FILE _T("ComponentFile") - ///////////////////////////////////////////////////////////////////////////// // CRegMozCtlDlg dialog @@ -24,14 +19,10 @@ CRegMozCtlDlg::CRegMozCtlDlg(CWnd* pParent /*=NULL*/) { //{{AFX_DATA_INIT(CRegMozCtlDlg) m_szMozillaDir = _T(""); - m_szComponentPath = _T(""); - m_szComponentFile = _T(""); - m_bAutomatic = FALSE; //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDI_MOZILLA); - m_bAutomatic = TRUE; GetCurrentDirectory(1024, m_szMozillaDir.GetBuffer(1024)); m_szMozillaDir.ReleaseBuffer(); } @@ -40,14 +31,8 @@ void CRegMozCtlDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CRegMozCtlDlg) - DDX_Control(pDX, IDC_COMPONENTPATH, m_edtComponentPath); - DDX_Control(pDX, IDC_COMPONENTFILE, m_edtComponentFile); - DDX_Control(pDX, IDC_PICKCOMPONENTPATH, m_btnPickComponentPath); - DDX_Control(pDX, IDC_PICKCOMPONENTFILE, m_btnPickComponentFile); + DDX_Control(pDX, IDC_TASKLIST, m_cTaskList); DDX_Text(pDX, IDC_MOZILLADIR, m_szMozillaDir); - DDX_Text(pDX, IDC_COMPONENTPATH, m_szComponentPath); - DDX_Text(pDX, IDC_COMPONENTFILE, m_szComponentFile); - DDX_Check(pDX, IDC_AUTOMATIC, m_bAutomatic); //}}AFX_DATA_MAP } @@ -58,9 +43,6 @@ BEGIN_MESSAGE_MAP(CRegMozCtlDlg, CDialog) ON_BN_CLICKED(IDC_REGISTER, OnRegister) ON_BN_CLICKED(IDC_UNREGISTER, OnUnregister) ON_BN_CLICKED(IDC_PICKDIR, OnPickDir) - ON_BN_CLICKED(IDC_PICKCOMPONENTFILE, OnPickComponentFile) - ON_BN_CLICKED(IDC_PICKCOMPONENTPATH, OnPickComponentPath) - ON_BN_CLICKED(IDC_AUTOMATIC, OnAutomatic) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -81,26 +63,75 @@ BOOL CRegMozCtlDlg::OnInitDialog() cKey.Create(HKEY_LOCAL_MACHINE, MOZ_CONTROL_REG_KEY); memset(szValue, 0, sizeof(szValue)); - if (cKey.QueryValue(szValue, MOZ_CONTROL_REG_VALUE_COMPONENT_PATH, &dwSize) == ERROR_SUCCESS) - { - m_szComponentPath = CString(szValue); - } - - dwSize = sizeof(szValue) / sizeof(szValue[0]); - memset(szValue, 0, sizeof(szValue)); - if (cKey.QueryValue(szValue, MOZ_CONTROL_REG_VALUE_COMPONENT_FILE, &dwSize) == ERROR_SUCCESS) - { - m_szComponentFile = CString(szValue); - } - - dwSize = sizeof(szValue) / sizeof(szValue[0]); - memset(szValue, 0, sizeof(szValue)); - if (cKey.QueryValue(szValue, MOZ_CONTROL_REG_VALUE_DIR, &dwSize) == ERROR_SUCCESS) + if (cKey.QueryValue(szValue, MOZ_CONTROL_REG_VALUE_BIN_DIR_PATH, &dwSize) == ERROR_SUCCESS) { m_szMozillaDir = CString(szValue); } + + CDialog::OnInitDialog(); + + CRegTask::PopulateTasks(m_cTaskMgr); + + // Add icons to image list +// m_cImageList.Create(16, 16, ILC_MASK, 0, 5); +// m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_DOESNTCONTAINIE)); +// m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CONTAINSIE)); +// m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CONTAINSMOZILLA)); +// m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_UNKNOWNSTATUS)); + + // Associate image list with file list +// m_cFileList.SetImageList(&m_cImageList, LVSIL_SMALL); + + struct ColumnData + { + TCHAR *sColumnTitle; + int nPercentageWidth; + int nFormat; + }; + + ColumnData aColData[] = + { + { _T("Task"), 70, LVCFMT_LEFT }, + { _T("Status"), 30, LVCFMT_LEFT } + }; + + // Get the size of the file list control and neatly + // divide it into columns + + CRect rcList; + m_cTaskList.GetClientRect(&rcList); + + int nColTotal = sizeof(aColData) / sizeof(aColData[0]); + int nWidthRemaining = rcList.Width(); - CDialog::OnInitDialog(); + for (int nCol = 0; nCol < nColTotal; nCol++) + { + ColumnData *pData = &aColData[nCol]; + + int nColWidth = (rcList.Width() * pData->nPercentageWidth) / 100; + if (nCol == nColTotal - 1) + { + nColWidth = nWidthRemaining; + } + else if (nColWidth > nWidthRemaining) + { + nColWidth = nWidthRemaining; + } + + m_cTaskList.InsertColumn(nCol, pData->sColumnTitle, pData->nFormat, nColWidth); + + nWidthRemaining -= nColWidth; + if (nColWidth <= 0) + { + break; + } + } + + for (int i = 0; i < m_cTaskMgr.GetTaskCount(); i++) + { + CRegTask *pTask = m_cTaskMgr.GetTask(i); + m_cTaskList.InsertItem(i, pTask->GetDescription()); + } return TRUE; // return TRUE unless you set the focus to a control } @@ -155,56 +186,15 @@ void CRegMozCtlDlg::RegisterMozillaControl(BOOL bRegister) { UpdateData(); - CFileFind cFind; - CString szFile; - CString szPath; + m_cTaskMgr.SetValue(c_szValueBinDirPath, m_szMozillaDir); - SetCurrentDirectory(m_szMozillaDir); + for (int i = 0; i < m_cTaskMgr.GetTaskCount(); i++) + { + CRegTask *pTask = m_cTaskMgr.GetTask(i); + pTask->DoTask(); + } - CRegKey cKey; - if (cKey.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\SharedDlls")) != ERROR_SUCCESS) - { - AfxMessageBox(_T("Can't open registry key \"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\SharedDlls\"")); - return; - } - - // Iterate through directory registering each DLL as a shared DLL - BOOL bWorking = cFind.FindFile("*.dll"); - while (bWorking) - { - bWorking = cFind.FindNextFile(); - szFile = cFind.GetFileName(); - szPath = m_szMozillaDir + CString(_T("\\")) + szFile; - if (bRegister) - { - cKey.SetValue(1, szPath); - } - else - { - cKey.DeleteValue(szPath); - } - } - cKey.Close(); - - cKey.Create(HKEY_LOCAL_MACHINE, MOZ_CONTROL_REG_KEY); - cKey.SetValue(m_szMozillaDir, MOZ_CONTROL_REG_VALUE_DIR); - cKey.Close(); - - // Now register the mozilla control - CString szMozCtl = m_szMozillaDir + CString(_T("\\npmozctl.dll")); - HINSTANCE hMod = LoadLibrary(szMozCtl); - if (hMod == NULL) - { - AfxMessageBox(_T("Can't find npmozctl.dll in current directory")); - } - FARPROC pfn = GetProcAddress(hMod, bRegister ? _T("DllRegisterServer") : _T("DllUnregisterServer")); - if (pfn) - { - pfn(); - } - FreeLibrary(hMod); - - AfxMessageBox(bRegister ? _T("Register completed") : _T("Unregister completed")); + AfxMessageBox(bRegister ? _T("Register completed") : _T("Unregister completed")); } void CRegMozCtlDlg::OnPickDir() @@ -244,11 +234,6 @@ void CRegMozCtlDlg::OnPickDir() } m_szMozillaDir = CString(szPath); - if (m_bAutomatic) - { - m_szComponentPath = m_szMozillaDir + "\\components"; - m_szComponentFile = m_szMozillaDir + "\\component.reg"; - } UpdateData(FALSE); } @@ -259,70 +244,6 @@ void CRegMozCtlDlg::OnPickDir() } } -void CRegMozCtlDlg::OnPickComponentFile() -{ - CFileDialog dlg(TRUE, NULL, m_szComponentFile); - if (dlg.DoModal() == IDOK) - { - m_szComponentFile = dlg.GetPathName(); - UpdateData(FALSE); - } -} - -void CRegMozCtlDlg::OnPickComponentPath() -{ - BROWSEINFO bi; - TCHAR szFolder[MAX_PATH + 1]; - - memset(szFolder, 0, sizeof(szFolder)); - - memset(&bi, 0, sizeof(bi)); - bi.hwndOwner = GetSafeHwnd(); - bi.pidlRoot = NULL; - bi.pszDisplayName = szFolder; - bi.lpszTitle = _T("Pick a folder to scan"); - - // Open the folder browser dialog - LPITEMIDLIST pItemList = SHBrowseForFolder(&bi); - if (pItemList) - { - IMalloc *pShellAllocator = NULL; - - SHGetMalloc(&pShellAllocator); - if (pShellAllocator) - { - char szPath[MAX_PATH + 1]; - - if (SHGetPathFromIDList(pItemList, szPath)) - { - // Chop off the end path separator - int nPathSize = strlen(szPath); - if (nPathSize > 0) - { - if (szPath[nPathSize - 1] == '\\') - { - szPath[nPathSize - 1] = '\0'; - } - } - - m_szComponentPath = CString(szPath); - UpdateData(FALSE); - } - - pShellAllocator->Free(pItemList); - pShellAllocator->Release(); - } - } -} - -void CRegMozCtlDlg::OnAutomatic() -{ - UpdateData(TRUE); - m_edtComponentFile.EnableWindow(!m_bAutomatic); - m_btnPickComponentFile.EnableWindow(!m_bAutomatic); - m_edtComponentPath.EnableWindow(!m_bAutomatic); - m_btnPickComponentPath.EnableWindow(!m_bAutomatic); -} CString CRegMozCtlDlg::GetSystemPath() { diff --git a/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.h b/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.h index 617df382aaff..cb35aac03087 100644 --- a/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.h +++ b/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.h @@ -8,6 +8,8 @@ #pragma once #endif // _MSC_VER > 1000 +#include "RegTaskManager.h" + ///////////////////////////////////////////////////////////////////////////// // CRegMozCtlDlg dialog @@ -20,14 +22,8 @@ public: // Dialog Data //{{AFX_DATA(CRegMozCtlDlg) enum { IDD = IDD_REGMOZCTL_DIALOG }; - CEdit m_edtComponentPath; - CEdit m_edtComponentFile; - CButton m_btnPickComponentPath; - CButton m_btnPickComponentFile; + CListCtrl m_cTaskList; CString m_szMozillaDir; - CString m_szComponentPath; - CString m_szComponentFile; - BOOL m_bAutomatic; //}}AFX_DATA // ClassWizard generated virtual function overrides @@ -39,6 +35,8 @@ public: // Implementation protected: HICON m_hIcon; + CRegTaskManager m_cTaskMgr; + // Generated message map functions //{{AFX_MSG(CRegMozCtlDlg) @@ -48,9 +46,6 @@ protected: afx_msg void OnRegister(); afx_msg void OnUnregister(); afx_msg void OnPickDir(); - afx_msg void OnPickComponentFile(); - afx_msg void OnPickComponentPath(); - afx_msg void OnAutomatic(); //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/embedding/browser/activex/tests/RegMozCtl/RegTask.cpp b/embedding/browser/activex/tests/RegMozCtl/RegTask.cpp new file mode 100644 index 000000000000..82d0af91c629 --- /dev/null +++ b/embedding/browser/activex/tests/RegMozCtl/RegTask.cpp @@ -0,0 +1,154 @@ +// RegTask.cpp: implementation of the CRegTask class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "regmozctl.h" +#include "RegTask.h" +#include "RegTaskManager.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CRegTask::CRegTask() +{ + +} + +CRegTask::CRegTask(CRegTaskManager *pMgr) +{ + m_pTaskMgr = pMgr; +} + +CRegTask::~CRegTask() +{ + +} + +////////////////////////////////////////////////////////////////////// + +class CRegTaskRegistry : public CRegTask +{ +public: + CRegTaskRegistry(CRegTaskManager *pMgr) : CRegTask(pMgr) + { + m_szDesc = _T("Set BinDirectoryPath registry entry"); + } + HRESULT DoTask(); +}; + + +HRESULT CRegTaskRegistry::DoTask() +{ + CString szBinDirPath; + m_pTaskMgr->GetValue(c_szValueBinDirPath, szBinDirPath); + // Create registry key + CRegKey cKey; + cKey.Create(HKEY_LOCAL_MACHINE, MOZ_CONTROL_REG_KEY); + cKey.SetValue(szBinDirPath, MOZ_CONTROL_REG_VALUE_BIN_DIR_PATH); + cKey.Close(); + return S_OK; +} + +////////////////////////////////////////////////////////////////////// + +class CRegTaskRegSvr : public CRegTask +{ +public: + CRegTaskRegSvr(CRegTaskManager *pMgr) : CRegTask(pMgr) + { + m_szDesc = _T("Register Mozilla Control"); + } + HRESULT DoTask(); +}; + + +HRESULT CRegTaskRegSvr::DoTask() +{ + BOOL bRegister = TRUE; + CString szBinDirPath; + m_pTaskMgr->GetValue(c_szValueBinDirPath, szBinDirPath); + SetCurrentDirectory(szBinDirPath); + + // Now register the mozilla control + CString szMozCtl = szBinDirPath + CString(_T("\\mozctl.dll")); + HINSTANCE hMod = LoadLibrary(szMozCtl); + if (hMod == NULL) + { + AfxMessageBox(_T("Can't find mozctl.dll in current directory")); + return E_FAIL; + } + + HRESULT hr = E_FAIL; + FARPROC pfn = GetProcAddress(hMod, bRegister ? _T("DllRegisterServer") : _T("DllUnregisterServer")); + if (pfn) + { + hr = pfn(); + } + FreeLibrary(hMod); + return hr; +} + +////////////////////////////////////////////////////////////////////// + +class CRegTaskPATH : public CRegTask +{ +public: + CRegTaskPATH(CRegTaskManager *pMgr) : CRegTask(pMgr) + { + m_szDesc = _T("Set PATH environment variable"); + } + HRESULT DoTask(); +}; + + +HRESULT CRegTaskPATH::DoTask() +{ + CString szBinDirPath; + m_pTaskMgr->GetValue(c_szValueBinDirPath, szBinDirPath); + + OSVERSIONINFO osvi; + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) + GetVersionEx(&osvi); + + if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + } + else if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) + { + FILE *f = fopen("c:\\autoexec.bat", "rw"); + if (f == NULL) + { + return NULL; + } + + // TODO read autoexec.bat if necessary and add Mozilla bin path to it + + // READ whole thing into memory + // grep for magic control tags + // if there then replace section + // else append new section + + fclose(f); + } + + return S_OK; +} + +////////////////////////////////////////////////////////////////////// + +HRESULT CRegTask::PopulateTasks(CRegTaskManager &cMgr) +{ + cMgr.AddTask(new CRegTaskRegistry(&cMgr)); + cMgr.AddTask(new CRegTaskPATH(&cMgr)); + cMgr.AddTask(new CRegTaskRegSvr(&cMgr)); + return S_OK; +} + diff --git a/embedding/browser/activex/tests/RegMozCtl/RegTask.h b/embedding/browser/activex/tests/RegMozCtl/RegTask.h new file mode 100644 index 000000000000..19e88a77d12f --- /dev/null +++ b/embedding/browser/activex/tests/RegMozCtl/RegTask.h @@ -0,0 +1,36 @@ +// RegTask.h: interface for the CRegTask class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_REGTASK_H__28D3BD27_F767_4412_B00B_236E3562B214__INCLUDED_) +#define AFX_REGTASK_H__28D3BD27_F767_4412_B00B_236E3562B214__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CRegTaskManager; + +class CRegTask +{ +protected: + CRegTaskManager *m_pTaskMgr; + CString m_szDesc; + +public: + static HRESULT PopulateTasks(CRegTaskManager &cMgr); + +public: + CRegTask(); + CRegTask(CRegTaskManager *pMgr); + virtual ~CRegTask(); + + CString GetDescription() + { + return m_szDesc; + } + + virtual HRESULT DoTask() = 0; +}; + +#endif // !defined(AFX_REGTASK_H__28D3BD27_F767_4412_B00B_236E3562B214__INCLUDED_) diff --git a/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.cpp b/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.cpp new file mode 100644 index 000000000000..c010841a1dae --- /dev/null +++ b/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.cpp @@ -0,0 +1,58 @@ +// RegTaskManager.cpp: implementation of the CRegTaskManager class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "regmozctl.h" +#include "RegTaskManager.h" + +#include +#include + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CRegTaskManager::CRegTaskManager() +{ + m_bNeedReboot = FALSE; +} + +CRegTaskManager::~CRegTaskManager() +{ + +} + +void CRegTaskManager::SetNeedReboot() +{ + m_bNeedReboot = TRUE; +} + +void CRegTaskManager::AddTask(CRegTask *pTask) +{ + m_cTasks.push_back(pTask); +} + + +void CRegTaskManager::SetValue(const TCHAR *szName, const TCHAR *szValue) +{ + if (_tcscmp(szName, c_szValueBinDirPath) == 0) + { + m_szBinDirPath = szValue; + } +} + +void CRegTaskManager::GetValue(const TCHAR *szName, CString &szValue) +{ + if (_tcscmp(szName, c_szValueBinDirPath) == 0) + { + szValue = m_szBinDirPath; + } +} diff --git a/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.h b/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.h new file mode 100644 index 000000000000..3e30f1d5fd38 --- /dev/null +++ b/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.h @@ -0,0 +1,37 @@ +// RegTaskManager.h: interface for the CRegTaskManager class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_REGTASKMANAGER_H__516D62F5_00EC_4450_B965_003425CF33E1__INCLUDED_) +#define AFX_REGTASKMANAGER_H__516D62F5_00EC_4450_B965_003425CF33E1__INCLUDED_ + +#include + +#include "RegTask.h" + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CRegTaskManager +{ + std::vector m_cTasks; + BOOL m_bNeedReboot; + + CString m_szBinDirPath; + +public: + CRegTaskManager(); + virtual ~CRegTaskManager(); + + void SetValue(const TCHAR *szName, const TCHAR *szValue); + void GetValue(const TCHAR *szName, CString &szValue); + void SetNeedReboot(); + + void AddTask(CRegTask *pTask); + int GetTaskCount() const { return m_cTasks.size(); } + CRegTask *GetTask(int nIndex) { return m_cTasks[nIndex]; } +}; + + +#endif // !defined(AFX_REGTASKMANAGER_H__516D62F5_00EC_4450_B965_003425CF33E1__INCLUDED_) diff --git a/embedding/browser/activex/tests/RegMozCtl/StdAfx.h b/embedding/browser/activex/tests/RegMozCtl/StdAfx.h index 8d9fe79dc6d7..d568d24e0f58 100644 --- a/embedding/browser/activex/tests/RegMozCtl/StdAfx.h +++ b/embedding/browser/activex/tests/RegMozCtl/StdAfx.h @@ -21,7 +21,8 @@ #endif // _AFX_NO_AFXCMN_SUPPORT #include - +#define MOZ_CONTROL_REG_KEY _T("Software\\Mozilla\\") +#define MOZ_CONTROL_REG_VALUE_BIN_DIR_PATH _T("BinDirectoryPath") //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. diff --git a/embedding/browser/activex/tests/RegMozCtl/resource.h b/embedding/browser/activex/tests/RegMozCtl/resource.h index f36eb8c6b7e8..15a4ac1334c1 100644 --- a/embedding/browser/activex/tests/RegMozCtl/resource.h +++ b/embedding/browser/activex/tests/RegMozCtl/resource.h @@ -14,6 +14,7 @@ #define IDC_COMPONENTPATH 1007 #define IDC_PICKCOMPONENTPATH 1008 #define IDC_AUTOMATIC 1009 +#define IDC_TASKLIST 1010 // Next default values for new objects // @@ -21,7 +22,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 131 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1010 +#define _APS_NEXT_CONTROL_VALUE 1011 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif