Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

282 lines
7.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992-2001.
  5. //
  6. // File: N O T I F Y . H
  7. //
  8. // Contents: Header file for sample notify object.
  9. //
  10. // Notes:
  11. //
  12. // Author: Alok Sinha
  13. //
  14. //----------------------------------------------------------------------------
  15. #ifndef NOTIFY_H_INCLUDE
  16. #define NOTIFY_H_INCLUDE
  17. #include <windows.h>
  18. #include <atlbase.h>
  19. extern CComModule _Module; // required by atlcom.h
  20. #include <atlcom.h>
  21. #include <devguid.h>
  22. #include <setupapi.h>
  23. #include <notifyn.h>
  24. #include "list.h"
  25. #include "adapter.h"
  26. #include "resource.h"
  27. #include "common.h"
  28. //
  29. // CMuxNotify Object - Base class for the entire notify object
  30. //
  31. class CMuxNotify :
  32. //
  33. // Must inherit from CComObjectRoot(Ex) for reference count
  34. // management and default threading model.
  35. //
  36. public CComObjectRoot,
  37. //
  38. // Define the default class factory and aggregation model.
  39. //
  40. public CComCoClass<CMuxNotify, &CLSID_CMuxNotify>,
  41. //
  42. // Notify Object's interfaces.
  43. //
  44. public INetCfgComponentControl,
  45. public INetCfgComponentSetup,
  46. public INetCfgComponentPropertyUi,
  47. public INetCfgComponentNotifyBinding,
  48. public INetCfgComponentNotifyGlobal
  49. {
  50. //
  51. // Public members.
  52. //
  53. public:
  54. //
  55. // Constructor
  56. //
  57. CMuxNotify(VOID);
  58. //
  59. // Destructors.
  60. //
  61. ~CMuxNotify(VOID);
  62. //
  63. // Notify Object's interfaces.
  64. //
  65. BEGIN_COM_MAP(CMuxNotify)
  66. COM_INTERFACE_ENTRY(INetCfgComponentControl)
  67. COM_INTERFACE_ENTRY(INetCfgComponentSetup)
  68. COM_INTERFACE_ENTRY(INetCfgComponentPropertyUi)
  69. COM_INTERFACE_ENTRY(INetCfgComponentNotifyBinding)
  70. COM_INTERFACE_ENTRY(INetCfgComponentNotifyGlobal)
  71. END_COM_MAP()
  72. //
  73. // Uncomment the the line below if you don't want your object to
  74. // support aggregation. The default is to support it
  75. //
  76. // DECLARE_NOT_AGGREGATABLE(CMuxNotify)
  77. //
  78. DECLARE_REGISTRY_RESOURCEID(IDR_REG_SAMPLE_NOTIFY)
  79. //
  80. // INetCfgComponentControl
  81. //
  82. STDMETHOD (Initialize) (
  83. IN INetCfgComponent *pIComp,
  84. IN INetCfg *pINetCfg,
  85. IN BOOL fInstalling);
  86. STDMETHOD (CancelChanges) ();
  87. STDMETHOD (ApplyRegistryChanges) ();
  88. STDMETHOD (ApplyPnpChanges) (
  89. IN INetCfgPnpReconfigCallback* pICallback);
  90. //
  91. // INetCfgComponentSetup
  92. //
  93. STDMETHOD (Install) (
  94. IN DWORD dwSetupFlags);
  95. STDMETHOD (Upgrade) (
  96. IN DWORD dwSetupFlags,
  97. IN DWORD dwUpgradeFromBuildNo);
  98. STDMETHOD (ReadAnswerFile) (
  99. IN PCWSTR szAnswerFile,
  100. IN PCWSTR szAnswerSections);
  101. STDMETHOD (Removing) ();
  102. //
  103. // INetCfgComponentPropertyUi
  104. //
  105. STDMETHOD (QueryPropertyUi) (
  106. IN IUnknown* pUnk);
  107. STDMETHOD (SetContext) (
  108. IN IUnknown* pUnk);
  109. STDMETHOD (MergePropPages) (
  110. IN OUT DWORD* pdwDefPages,
  111. OUT LPBYTE* pahpspPrivate,
  112. OUT UINT* pcPrivate,
  113. IN HWND hwndParent,
  114. OUT PCWSTR* pszStartPage);
  115. STDMETHOD (ValidateProperties) (
  116. HWND hwndSheet);
  117. STDMETHOD (CancelProperties) ();
  118. STDMETHOD (ApplyProperties) ();
  119. //
  120. // INetCfgNotifyBinding
  121. //
  122. STDMETHOD (QueryBindingPath) (
  123. IN DWORD dwChangeFlag,
  124. IN INetCfgBindingPath* pncbp);
  125. STDMETHOD (NotifyBindingPath) (
  126. IN DWORD dwChangeFlag,
  127. IN INetCfgBindingPath* pncbp);
  128. //
  129. // INetCfgNotifyGlobal
  130. //
  131. STDMETHOD (GetSupportedNotifications) (
  132. OUT DWORD* pdwNotificationFlag );
  133. STDMETHOD (SysQueryBindingPath) (
  134. IN DWORD dwChangeFlag,
  135. IN INetCfgBindingPath* pncbp);
  136. STDMETHOD (SysNotifyBindingPath) (
  137. IN DWORD dwChangeFlag,
  138. IN INetCfgBindingPath* pncbp);
  139. STDMETHOD (SysNotifyComponent) (
  140. IN DWORD dwChangeFlag,
  141. IN INetCfgComponent* pncc);
  142. //
  143. // Private members.
  144. //
  145. private:
  146. //
  147. // Private member variables.
  148. //
  149. INetCfgComponent *m_pncc; // Protocol's Net Config component
  150. INetCfg *m_pnc;
  151. ConfigAction m_eApplyAction;
  152. IUnknown* m_pUnkContext;
  153. //
  154. // List of physical adapters currently installed.
  155. //
  156. List<CMuxPhysicalAdapter *, GUID> m_AdaptersList;
  157. //
  158. // List of physical adapters to be removed.
  159. //
  160. List<CMuxPhysicalAdapter *, GUID> m_AdaptersToRemove;
  161. //
  162. // List of physical adapters to be added.
  163. //
  164. List<CMuxPhysicalAdapter *, GUID> m_AdaptersToAdd;
  165. //
  166. // Private member functions.
  167. //
  168. HRESULT HrLoadAdapterConfiguration (VOID);
  169. HRESULT HrGetUpperAndLower (INetCfgBindingPath* pncbp,
  170. INetCfgComponent **ppnccUpper,
  171. INetCfgComponent **ppnccLower);
  172. HRESULT HrAddAdapter (INetCfgComponent *pnccAdapter);
  173. HRESULT HrRemoveAdapter (INetCfgComponent *pnccAdapter);
  174. HRESULT HrAddMiniport (CMuxPhysicalAdapter *pAdapter,
  175. GUID *guidAdapter);
  176. HRESULT HrRemoveMiniport (CMuxPhysicalAdapter *pAdapter,
  177. GUID *guidAdapter);
  178. #ifdef DISABLE_PROTOCOLS_TO_PHYSICAL
  179. VOID EnableBindings (INetCfgComponent *pnccAdapter,
  180. BOOL bEnable);
  181. BOOL IfExistMux (INetCfgBindingPath *pncbp);
  182. HRESULT HrGetBindingPathEnum (INetCfgComponent *pnccAdapter,
  183. DWORD dwBindingType,
  184. IEnumNetCfgBindingPath **ppencbp);
  185. HRESULT HrGetBindingPath (IEnumNetCfgBindingPath *pencbp,
  186. INetCfgBindingPath **ppncbp);
  187. HRESULT HrGetBindingInterfaceEnum (INetCfgBindingPath *pncbp,
  188. IEnumNetCfgBindingInterface **ppencbi);
  189. HRESULT HrGetBindingInterface (IEnumNetCfgBindingInterface *pencbi,
  190. INetCfgBindingInterface **ppncbi);
  191. #endif
  192. public:
  193. LRESULT OnInitDialog (IN HWND hWnd);
  194. LRESULT OnOk (IN HWND hWnd);
  195. LRESULT OnCancel (IN HWND hWnd);
  196. };
  197. INT_PTR CALLBACK NotifyDialogProc (HWND hWnd,
  198. UINT uMsg,
  199. WPARAM wParam,
  200. LPARAM lParam);
  201. UINT CALLBACK NotifyPropSheetPageProc (HWND hWnd,
  202. UINT uMsg,
  203. LPPROPSHEETPAGE ppsp);
  204. #endif // NOTIFY_H_INCLUDE