Source code of Windows XP (NT5)
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.

135 lines
4.5 KiB

  1. //
  2. // S F N O B J . H
  3. //
  4. // Declaration of CSFNCfg and helper functions
  5. //
  6. #pragma once
  7. #include <ncxbase.h>
  8. #include <ncatlps.h>
  9. #include <nceh.h>
  10. #include <notifval.h>
  11. #include "resource.h"
  12. EXTERN_C const CLSID CLSID_CSfnCfg;
  13. //---[ Typedefs for FPNWCFG functions ]----------------------------------------
  14. //
  15. // Typedefs for the functions that we'll GetProcAddress from the
  16. // NetWare config DLL. We'll use VOID * for the RUNNCPDLG/COMMITNCPDLG because:
  17. // 1: We don't want to muck with the data ourselves. This makes
  18. // that a tad easier to enforce.
  19. // 2: Bringing in an NCP_INFO structure involves a
  20. // ridiculous amount of header inclusion, including BLT
  21. // stuff that we should really avoid.
  22. typedef BOOL (PASCAL *FPNWCFG_RUNNCPDLG_PROC)(HWND, BOOL, VOID **, BOOL *);
  23. typedef BOOL (PASCAL *FPNWCFG_COMMITNCPDLG_PROC)(HWND, BOOL, VOID *);
  24. typedef BOOL (PASCAL *FPNWCFG_REMOVENCPSERVER_PROC)(HWND);
  25. typedef BOOL (PASCAL *FPNWCFG_ISSPOOLERRUNNING_PROC)();
  26. //---[ Constants ]-------------------------------------------------------------
  27. const INT c_iMaxNetWareServerName = 47;
  28. const INT c_iMaxNetWarePassword = 127;
  29. const WCHAR c_dwDefaultTuning = 3;
  30. //---[ SFNCfg ]----------------------------------------------------------------
  31. class ATL_NO_VTABLE CSFNCfg :
  32. public CComObjectRoot,
  33. public CComCoClass<CSFNCfg, &CLSID_CSfnCfg>,
  34. public INetCfgComponentSetup,
  35. public INetCfgComponentControl
  36. {
  37. public:
  38. CSFNCfg();
  39. ~CSFNCfg();
  40. BEGIN_COM_MAP(CSFNCfg)
  41. COM_INTERFACE_ENTRY(INetCfgComponentControl)
  42. COM_INTERFACE_ENTRY(INetCfgComponentSetup)
  43. END_COM_MAP()
  44. // DECLARE_NOT_AGGREGATABLE(CSFNCfg)
  45. // Remove the comment from the line above if you don't want your object to
  46. // support aggregation. The default is to support it
  47. DECLARE_REGISTRY(CSFNCfg,
  48. L"Microsoft.SFNCfg.1",
  49. L"Microsoft.SFNCfg",
  50. IDS_DESC_COMOBJ_SFNCFG, THREADFLAGS_BOTH)
  51. // INetCfgComponentControl
  52. STDMETHOD (Initialize) (
  53. IN INetCfgComponent* pIComp,
  54. IN INetCfg* pINetCfg,
  55. IN BOOL fInstalling);
  56. STDMETHOD (ApplyRegistryChanges) ();
  57. STDMETHOD (ApplyPnpChanges) (
  58. IN INetCfgPnpReconfigCallback* pICallback) { return S_OK; }
  59. STDMETHOD (CancelChanges) ();
  60. STDMETHOD (Validate) ();
  61. // INetCfgComponentSetup
  62. STDMETHOD (ReadAnswerFile) (PCWSTR pszAnswerFile,
  63. PCWSTR pszAnswerSection);
  64. STDMETHOD (Upgrade) (DWORD dwSetupFlags,
  65. DWORD dwUpgradeFromBuildNo);
  66. STDMETHOD (Install) (DWORD);
  67. STDMETHOD (Removing) ();
  68. public:
  69. // Helper functions.
  70. HRESULT HrCodeFromOldINF();
  71. // Load and free the config DLL
  72. HRESULT HrLoadConfigDLL();
  73. VOID FreeConfigDLL();
  74. // FPNW UI parameters.
  75. DWORD m_dwTuning;
  76. WCHAR m_szSysVol[MAX_PATH+1];
  77. WCHAR m_szFPNWServerName[c_iMaxNetWareServerName+1];
  78. WCHAR m_szPassword[c_iMaxNetWarePassword+1];
  79. // Private state info
  80. private:
  81. // Install Action (Unknown, Install, Remove)
  82. enum INSTALLACTION {eActUnknown, eActInstall, eActRemove};
  83. INSTALLACTION m_eInstallAction;
  84. HINSTANCE m_hlibConfig; // From LoadLibrary call.
  85. INetCfgComponent * m_pncc; // Place to keep my component
  86. INetCfg * m_pnc; // Place to keep the Netcfg object
  87. VOID * m_pNcpInfoHandle; // Handle to opaque data struct from fpnwcfg
  88. BOOL m_fDirty;
  89. BOOL m_fAlreadyInstalled; // TRUE if component is already installed
  90. FPNWCFG_ISSPOOLERRUNNING_PROC m_pfnIsSpoolerRunning;
  91. FPNWCFG_RUNNCPDLG_PROC m_pfnRunNcpDlg;
  92. FPNWCFG_REMOVENCPSERVER_PROC m_pfnRemoveNcpServer;
  93. FPNWCFG_COMMITNCPDLG_PROC m_pfnCommitNcpDlg;
  94. // number of property sheet pages
  95. enum PAGES
  96. {
  97. c_cPages = 2
  98. };
  99. // Generic dialog data
  100. CPropSheetPage * m_apspObj[c_cPages];// pointer to each of the prop
  101. // sheet page objects
  102. HRESULT HrSetupPropSheets(HPROPSHEETPAGE **pahpsp, INT cPages);
  103. VOID CleanupPropPages(VOID);
  104. // CheckForSAPExistance removed. See slm logs to revive
  105. // HRESULT HrCheckForSAPExistance(); // Check to see if SAP is already installed.
  106. HRESULT HrDoConfigDialog();
  107. HRESULT HrWriteDefaultSysVol();
  108. };