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.

390 lines
10 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1993 **/
  4. /**********************************************************************/
  5. /*
  6. nwc.hxx
  7. Class declarations for the NWC applet
  8. FILE HISTORY:
  9. ChuckC 17-Jul-1993 Created
  10. */
  11. #ifndef _NWC_HXX_
  12. #define _NWC_HXX_
  13. #include <security.hxx>
  14. class SHARES_LBOX ;
  15. /*************************************************************************
  16. NAME: NWC_DIALOG
  17. SYNOPSIS: This is the NWC applet main dialog.
  18. INTERFACE: NWC_DIALOG() - Class constructor.
  19. ~NWC_DIALOG() - Class destructor.
  20. PARENT: DIALOG_WINDOW
  21. USES:
  22. HISTORY:
  23. ChuckC 17-Jul-1992 Created
  24. **************************************************************************/
  25. class NWC_DIALOG: public DIALOG_WINDOW
  26. {
  27. private:
  28. COMBOBOX _comboPreferredServers ;
  29. CHECKBOX _chkboxFormFeed ;
  30. CHECKBOX _chkboxPrintNotify ;
  31. CHECKBOX _chkboxPrintBanner ;
  32. CHECKBOX _chkboxLogonScript ;
  33. DWORD _dwShareDrive ;
  34. SLT _sltCurrentPreferredServer ;
  35. SLT _sltUserName ;
  36. PUSH_BUTTON _pbOverview ;
  37. PUSH_BUTTON _pbGateway ;
  38. MAGIC_GROUP _mgrpPreferred ;
  39. SLE _sleContext ;
  40. SLE _sleTree ;
  41. NLS_STR _nlsOldPreferredServer;
  42. DWORD _dwOldPrintOptions;
  43. DWORD _dwOldLogonScriptOptions;
  44. VOID OnNWCHelp();
  45. protected:
  46. virtual BOOL OnOK();
  47. virtual BOOL OnCommand( const CONTROL_EVENT & event );
  48. virtual ULONG QueryHelpContext( VOID );
  49. APIERR FillPreferredServersCombo(void) ;
  50. public:
  51. NWC_DIALOG( HWND hwndOwner, BOOL fIsWinnt) ;
  52. ~NWC_DIALOG();
  53. };
  54. /*************************************************************************
  55. NAME: SHARES_LBI
  56. SYNOPSIS: This class represents one item in the SHARES_LBOX.
  57. INTERFACE: SHARES_LBI - Class constructor.
  58. ~SHARES_LBI - Class destructor.
  59. Paint - Draw an item.
  60. QueryLeadingChar - Query the first character for
  61. the keyboard interface.
  62. Compare - Compare two items.
  63. QueryShareName - Query the share name for this item.
  64. QueryPathName - Query the path name for this item.
  65. QueryDrive - Query the drive name for this item.
  66. PARENT: LBI
  67. USES: NLS_STR
  68. HISTORY:
  69. ChuckC 11/3/93 Created
  70. **************************************************************************/
  71. class SHARES_LBI : public LBI
  72. {
  73. protected:
  74. /*
  75. * These data members represent the various
  76. * columns to be displayed in the listbox.
  77. */
  78. NLS_STR _nlsShareName;
  79. NLS_STR _nlsPathName;
  80. NLS_STR _nlsDrive;
  81. RESOURCE_STR _nlsUserLimit;
  82. /*
  83. * This method returns the first character in the
  84. * listbox item. This is used for the listbox
  85. * keyboard interface.
  86. */
  87. virtual WCHAR QueryLeadingChar() const;
  88. virtual INT Compare( const LBI * plbi ) const;
  89. virtual VOID Paint( LISTBOX * plb,
  90. HDC hdc,
  91. const RECT * prect,
  92. GUILTT_INFO * pGUILTT ) const;
  93. public:
  94. SHARES_LBI( const TCHAR *pszShareName,
  95. const TCHAR *pszPathName,
  96. const TCHAR *pszDrive,
  97. const ULONG ulUserLimit ) ;
  98. virtual ~SHARES_LBI() ;
  99. const TCHAR * QueryShareName() const
  100. { return _nlsShareName.QueryPch(); }
  101. const TCHAR * QueryPathName() const
  102. { return _nlsPathName.QueryPch(); }
  103. const TCHAR * QueryDrive() const
  104. { return _nlsDrive.QueryPch(); }
  105. const TCHAR * QueryUserLimit() const
  106. { return _nlsUserLimit.QueryPch(); }
  107. };
  108. /*************************************************************************
  109. NAME: SHARES_LBOX
  110. SYNOPSIS: This listbox displays the files open on a server.
  111. INTERFACE: SHARES_LBOX - Class constructor.
  112. ~SHARES_LBOX - Class destructor.
  113. Refresh - Refresh the list of open files.
  114. Fill - Fills the listbox with the
  115. files open on the target server.
  116. QueryColumnWidths - Called by SHARES_LBI::Paint(),
  117. this is the column width table
  118. used for painting the listbox
  119. items.
  120. PARENT: BLT_LISTBOX
  121. USES: NLS_STR
  122. HISTORY:
  123. ChuckC 10/6/91 Created
  124. **************************************************************************/
  125. class SHARES_LBOX : public BLT_LISTBOX
  126. {
  127. private:
  128. protected:
  129. //
  130. // This array contains the column widths used
  131. // while painting the listbox item. This array
  132. // is generated by the BuildColumnWidthTable()
  133. // function.
  134. //
  135. UINT _adx[4];
  136. public:
  137. SHARES_LBOX( OWNER_WINDOW *powOwner,
  138. CID cid) ;
  139. ~SHARES_LBOX();
  140. /*
  141. * Methods that fill and refresh the listbox.
  142. */
  143. APIERR Fill();
  144. APIERR Refresh();
  145. //
  146. // This method is called by the SHARES_LBI::Paint()
  147. // method for retrieving the column width table.
  148. //
  149. const UINT * QueryColumnWidths() const
  150. { return _adx; }
  151. //
  152. // The following macro will declare (& define) a new
  153. // QueryItem() method which will return an SHARES_LBI *.
  154. //
  155. DECLARE_LB_QUERY_ITEM( SHARES_LBI )
  156. };
  157. /*************************************************************************
  158. NAME: NWC_GATEWAY_DIALOG
  159. SYNOPSIS: This is the NWC gateway dialog.
  160. INTERFACE: NWC_GATEWAY_DIALOG() - Class constructor.
  161. ~NWC_GATEWAY_DIALOG() - Class destructor.
  162. PARENT: DIALOG_WINDOW
  163. USES:
  164. HISTORY:
  165. ChuckC 17-Jul-1992 Created
  166. **************************************************************************/
  167. class NWC_GATEWAY_DIALOG: public DIALOG_WINDOW
  168. {
  169. private:
  170. CHECKBOX _chkboxEnable ;
  171. SLE _sleAccount ;
  172. SLE _slePassword ;
  173. SLE _sleConfirmPassword ;
  174. SHARES_LBOX _lbShares ;
  175. PUSH_BUTTON _pbAdd ;
  176. PUSH_BUTTON _pbDelete ;
  177. PUSH_BUTTON _pbPermissions ;
  178. BOOL _fPasswordChanged ;
  179. BOOL _fEnabledInitially;
  180. NLS_STR _nlsConfirmPassword ;
  181. RESOURCE_STR _nlsDeleted ;
  182. NLS_STR _nlsSavedAccount ;
  183. NLS_STR _nlsSavedPassword ;
  184. APIERR OnShareAdd();
  185. APIERR OnShareDel();
  186. APIERR OnSharePerm();
  187. APIERR ReadGatewayParameters(BOOL *pfReshare) ;
  188. APIERR WriteGatewayParameters(BOOL fReshare) ;
  189. APIERR WriteServiceDependencies(BOOL fReshare) ;
  190. APIERR EnableControls(BOOL fReshare) ;
  191. APIERR EnableButtons(void) ;
  192. DWORD CalcNullNullSize(TCHAR *pszNullNull) ;
  193. TCHAR *FindStringInNullNull(TCHAR *pszNullNull, TCHAR *pszString) ;
  194. APIERR ModifyDependencyList(TCHAR **lplpDependencies,
  195. BOOL fReshare,
  196. BUFFER *pBuffer) ;
  197. protected:
  198. virtual BOOL OnOK();
  199. virtual BOOL OnCommand( const CONTROL_EVENT & event );
  200. virtual ULONG QueryHelpContext( VOID );
  201. public:
  202. NWC_GATEWAY_DIALOG( HWND hwndOwner) ;
  203. ~NWC_GATEWAY_DIALOG();
  204. };
  205. /*************************************************************************
  206. NAME: NWC_ADDSHARE_DIALOG
  207. SYNOPSIS: This is the NWC gateway dialog.
  208. INTERFACE: NWC_ADDSHARE_DIALOG() - Class constructor.
  209. ~NWC_ADDSHARE_DIALOG() - Class destructor.
  210. PARENT: DIALOG_WINDOW
  211. USES:
  212. HISTORY:
  213. ChuckC 17-Jul-1992 Created
  214. **************************************************************************/
  215. class NWC_ADDSHARE_DIALOG: public DIALOG_WINDOW
  216. {
  217. private:
  218. SLE _sleShare ;
  219. SLE _slePath ;
  220. COMBOBOX _comboDrives ;
  221. SLE _sleComment;
  222. MAGIC_GROUP _mgrpUserLimit;
  223. SPIN_SLE_NUM _spsleUsers;
  224. SPIN_GROUP _spgrpUsers;
  225. NLS_STR * _pnlsAccount ;
  226. NLS_STR * _pnlsPassword ;
  227. //
  228. // Fill the drives combo
  229. //
  230. APIERR FillDrivesCombo(void) ;
  231. //
  232. // Query or set the contents of the SLE comment
  233. //
  234. APIERR QueryComment( NLS_STR *pnlsComment ) const
  235. { return _sleComment.QueryText( pnlsComment ); }
  236. VOID SetComment( const TCHAR *pszComment )
  237. { _sleComment.SetText( pszComment ); }
  238. //
  239. // Query or set the contents of User Limit
  240. //
  241. ULONG QueryUserLimit( VOID ) const;
  242. protected:
  243. virtual BOOL OnOK();
  244. virtual ULONG QueryHelpContext( VOID );
  245. public:
  246. NWC_ADDSHARE_DIALOG( HWND hwndOwner,
  247. NLS_STR *pnlsAccount,
  248. NLS_STR *pnlsPassword) ;
  249. ~NWC_ADDSHARE_DIALOG();
  250. };
  251. //
  252. // share ACL manipulation routines
  253. //
  254. APIERR EditShareAcl( HWND hwndParent,
  255. const TCHAR *pszServer,
  256. const TCHAR *pszResource,
  257. BOOL *pfSecDescModified,
  258. OS_SECURITY_DESCRIPTOR **ppOsSecDesc,
  259. ULONG ulHelpContextBase ) ;
  260. APIERR CreateDefaultAcl( OS_SECURITY_DESCRIPTOR ** ppOsSecDesc ) ;
  261. APIERR GetSharePerm (const TCHAR *pszServer,
  262. const TCHAR *pszShare,
  263. OS_SECURITY_DESCRIPTOR ** ppOsSecDesc ) ;
  264. APIERR SetSharePerm (const TCHAR *pszServer,
  265. const TCHAR *pszShare,
  266. const OS_SECURITY_DESCRIPTOR *pOsSecDesc ) ;
  267. /*
  268. * Share General Permissions
  269. */
  270. #define FILE_PERM_GEN_NO_ACCESS (0)
  271. #define FILE_PERM_GEN_READ (GENERIC_READ |\
  272. GENERIC_EXECUTE)
  273. #define FILE_PERM_GEN_MODIFY (GENERIC_READ |\
  274. GENERIC_EXECUTE |\
  275. GENERIC_WRITE |\
  276. DELETE )
  277. #define FILE_PERM_GEN_ALL (GENERIC_ALL)
  278. #endif // _NWC_HXX_