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.

153 lines
3.6 KiB

  1. // Copyright (c) 1997-1999 Microsoft Corporation
  2. #ifndef _UIHELPERS_H_
  3. #define _UIHELPERS_H_
  4. #include "..\common\sshWbemHelpers.h"
  5. #include <windowsx.h>
  6. #include "PageBase.h"
  7. // supports the page coordinating routines.
  8. #define PB_LOGGING 0
  9. #define PB_BACKUP 1
  10. #define PB_ADVANCED 2
  11. #define PB_LASTPAGE 2
  12. extern const TCHAR c_HelpFile[];
  13. typedef struct {
  14. LPTSTR lpName;
  15. UINT cName;
  16. bool *local;
  17. LOGIN_CREDENTIALS *credentials;
  18. } CONN_NAME;
  19. class WbemServiceThread;
  20. class DataSource;
  21. void CredentialUserA(LOGIN_CREDENTIALS *credentials, char **user);
  22. void CredentialUserW(LOGIN_CREDENTIALS *credentials, wchar_t **user);
  23. #ifdef UNICODE
  24. #define CredentialUser CredentialUserW
  25. #else
  26. #define CredentialUser CredentialUserA
  27. #endif
  28. // 0 means any version of NT will do.
  29. bool IsNT(DWORD ver = 0);
  30. //-------------------------------------------------------------------
  31. // NOTE: These 'sid' routines came from \winmgmt\common\wbemntsec.*.
  32. class CNtSid
  33. {
  34. PSID m_pSid;
  35. LPTSTR m_pMachine;
  36. LPTSTR m_pDomain;
  37. DWORD m_dwStatus;
  38. public:
  39. enum {NoError, Failed, NullSid, InvalidSid, InternalError, AccessDenied = 0x5};
  40. enum SidType {CURRENT_USER, CURRENT_THREAD};
  41. CNtSid(SidType st);
  42. ~CNtSid();
  43. BOOL IsValid() { return (m_pSid && IsValidSid(m_pSid)); }
  44. // Checks the validity of the internal SID.
  45. int GetInfo(LPTSTR *pRetAccount, // Account, use operator delete
  46. LPTSTR *pRetDomain, // Domain, use operator delete
  47. DWORD *pdwUse); // See SID_NAME_USE for values
  48. };
  49. class CUIHelpers : public CBasePage
  50. {
  51. public:
  52. CUIHelpers(DataSource *ds, WbemServiceThread *serviceThread, bool htmlSupport);
  53. CUIHelpers(CWbemServices &service, bool htmlSupport);
  54. virtual ~CUIHelpers( void );
  55. CONN_NAME m_cfg;
  56. bool m_ImaWizard;
  57. static INT_PTR DisplayCompBrowser(HWND hWnd,
  58. LPTSTR lpName, UINT cName,
  59. bool *local, LOGIN_CREDENTIALS *credentials);
  60. protected:
  61. void SetWbemService(IWbemServices *pServices);
  62. long m_sessionID;
  63. void HTMLHelper(HWND hDlg);
  64. bool m_htmlSupport;
  65. #define NO_UI 0 // for uCaption
  66. bool ServiceIsReady(UINT uCaption,
  67. UINT uWaitMsg,
  68. UINT uBadMsg);
  69. #ifndef SNAPIN
  70. INT_PTR DisplayLoginDlg(HWND hWnd,
  71. LOGIN_CREDENTIALS *credentials);
  72. #endif
  73. INT_PTR DisplayNSBrowser(HWND hWnd,
  74. LPTSTR lpName, UINT cName);
  75. INT_PTR DisplayEditDlg(HWND hWnd,
  76. UINT idCaption,
  77. UINT idMsg,
  78. LPTSTR lpEdit,
  79. UINT cEdit);
  80. bool BrowseForFile(HWND hDlg,
  81. UINT idTitle,
  82. LPCTSTR lpstrFilter,
  83. LPCTSTR initialFile,
  84. LPTSTR pathFile,
  85. UINT pathFileSize,
  86. DWORD moreFlags = 0);
  87. LPTSTR CloneString( LPTSTR pszSrc );
  88. HWND m_AVIbox;
  89. INT_PTR DisplayAVIBox(HWND hWnd,
  90. LPCTSTR lpCaption,
  91. LPCTSTR lpClientMsg,
  92. HWND *boxHwnd,
  93. BOOL cancelBtn = TRUE);
  94. // call when a control changes. It sends the PSM_CHANGED for you.
  95. void PageChanged(int page, bool needToPut);
  96. // call from OnApply(). Caches property Puts into one PutInstance.
  97. // It sends the PSM_UNCHANGED for you.
  98. HRESULT NeedToPut(int page, BOOL refresh);
  99. private:
  100. static int m_needToPut[3];
  101. bool m_userCancelled; // the connectServer() thread.
  102. };
  103. //===========================================================
  104. class ConnectPage : public CUIHelpers
  105. {
  106. public:
  107. ConnectPage(DataSource *ds, bool htmlSupport);
  108. ~ConnectPage(void);
  109. private:
  110. virtual BOOL DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  111. bool m_isLocal;
  112. };
  113. #endif /* _UIHELPERS_H_ */