summaryrefslogtreecommitdiff
path: root/Common/ComponentHolder.h
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2003-09-17 19:07:23 +0000
committerStef Walter <stef@thewalter.net>2003-09-17 19:07:23 +0000
commit3f95d417d9e623ac0c74df8ef11d7a01846392dd (patch)
tree45ec73f2dc07eafd7f41a6f62a8cdfbaa279469f /Common/ComponentHolder.h
Initial ImportHEADmaster
Diffstat (limited to 'Common/ComponentHolder.h')
-rw-r--r--Common/ComponentHolder.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/Common/ComponentHolder.h b/Common/ComponentHolder.h
new file mode 100644
index 0000000..66b90e2
--- /dev/null
+++ b/Common/ComponentHolder.h
@@ -0,0 +1,104 @@
+//////////////////////////////////////////////////////////////////
+//
+// ComponentHolder.h: interface for the CComponentHolder class.
+//
+// Holds one componet (either DOS or Windows)
+//
+// Is Initialized when either DOS or Windows pointer is valid
+//
+// virtual functions make it possible to override the funtionality
+// and create host based app specific components.
+// See shutdown.exe program for example of this
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(COMPONENTHOLDER_H__FDBF1422_18AE_11D2_B2D4_0020182B97FC__INCLUDED_)
+#define COMPONENTHOLDER_H__FDBF1422_18AE_11D2_B2D4_0020182B97FC__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#include "../common/defines.h"
+#include "../common/interfaces.h"
+#include "../common/ComponentData.h"
+
+#include <mystring.h>
+
+#define CComObjectMember CComObjectGlobal
+
+class CComponentHolder
+{
+
+public:
+ CComponentHolder();
+ virtual ~CComponentHolder();
+
+ // Calls main component function for Windows Components
+ virtual HRESULT DoShutdown(DWORD dwMode, HWND hwndParent = NULL);
+ // Calls main component function for DOS Components
+ virtual HRESULT GetBatchText(string& sBatchText);
+
+
+ // Initialization
+ // Needs Registry Key to Initialize and Save the Component Data
+ virtual bool IsInitialized();
+ virtual HRESULT Initialize(const CLSID& clsid, const string& sRegKey);
+ virtual HRESULT Initialize(const string& sID, const string& sRegKey);
+
+
+ virtual HRESULT Release();
+
+ // Returns type (DOS or Windows)
+ virtual UINT GetType();
+
+ // Get's a IUnknown to the Component
+ virtual IUnknown* GetUnknown();
+
+protected:
+ ISecureShutdownDOS* m_pComponentDOS;
+ ISecureShutdownWin* m_pComponentWin;
+
+ // Component ID
+protected:
+ string m_sID;
+public:
+ virtual const string& GetID() const { return m_sID; };
+
+ // Name
+protected:
+ string m_sName;
+public:
+ const string& GetName() const { return m_sName; };
+
+/*
+#ifndef NS_NO_PROPPAGE
+ // Component Property Page
+protected:
+ CComObjectMember<CPropPageHolder> m_PropPage;
+public:
+// virtual HRESULT GetPropPage(CPropPageHolder** pPropPage);
+// bool HasPropPage();
+#endif // NS_NO_PROPPAGE
+*/
+
+ // Component's Data
+protected:
+ CComObjectMember<CComponentData> m_Data;
+public:
+ virtual CComponentData* GetData() { return &m_Data; };
+
+
+ // Host specific Funtions for accessing component data
+public:
+ int GetInfoInt(NightSecInfo nsItem, int nDefault);
+ string GetInfoStr(NightSecInfo nsItem, const string& sDefault);
+ CComVariant GetInfo(NightSecInfo nsItem);
+ virtual bool IsEnabled() { return m_Data.GetInt(ENABLED_KEY, false) ? true : false; };
+ virtual bool Enable(bool bEnable) { return m_Data.WriteInt(ENABLED_KEY, bEnable); } ;
+ virtual int GetPos() { return m_Data.GetInt(POSITION_KEY, 1); } ;
+ virtual bool SetPos(int nPos) { return m_Data.WriteInt(POSITION_KEY, nPos); } ;
+
+};
+
+#endif // !defined(COMPONENTHOLDER_H__FDBF1422_18AE_11D2_B2D4_0020182B97FC__INCLUDED_)