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.

718 lines
12 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1995 - 1999
  3. All rights reserved.
  4. Module Name:
  5. srvprop.hxx
  6. Abstract:
  7. Server properties header.
  8. Author:
  9. Steve Kiraly (steveKi) 11-Nov-1995
  10. Revision History:
  11. --*/
  12. #ifndef _SVRPROP_HXX
  13. #define _SVRPROP_HXX
  14. /********************************************************************
  15. Defines a function to return the specified page id.
  16. ********************************************************************/
  17. #define DEFINE_PAGE_IDENTIFIER( PageId ) \
  18. protected: \
  19. UINT \
  20. uGetPageId( \
  21. VOID \
  22. ) const \
  23. { \
  24. return PageId; \
  25. }
  26. /********************************************************************
  27. Server property data.
  28. ********************************************************************/
  29. class TServerData : public MSingletonWin {
  30. SIGNATURE( 'svpr' )
  31. SAFE_NEW
  32. public:
  33. VAR( UINT, uStartPage );
  34. VAR( INT, iCmdShow );
  35. VAR( BOOL, bAdministrator );
  36. VAR( BOOL, bRebootRequired );
  37. VAR( TString, strTitle );
  38. VAR( HANDLE, hPrintServer );
  39. VAR( LPCTSTR, pszServerName );
  40. VAR( TString, strMachineName );
  41. VAR( HICON, hDefaultSmallIcon );
  42. VAR( BOOL, bCancelButtonIsClose );
  43. VAR( DWORD, dwDriverVersion );
  44. VAR( BOOL, bRemoteDownLevel );
  45. TServerData(
  46. IN LPCTSTR pszServerName,
  47. IN INT iCmdShow,
  48. IN LPARAM lParam,
  49. IN HWND hwnd,
  50. IN BOOL bModal
  51. );
  52. ~TServerData(
  53. VOID
  54. );
  55. BOOL
  56. bValid(
  57. VOID
  58. );
  59. BOOL
  60. bLoad(
  61. VOID
  62. );
  63. private:
  64. //
  65. // Copying and assignment are not defined.
  66. //
  67. TServerData(
  68. const TServerData &
  69. );
  70. TServerData &
  71. operator =(
  72. const TServerData &
  73. );
  74. BOOL
  75. bStore(
  76. VOID
  77. );
  78. VOID
  79. vCreateMachineName(
  80. IN const TString &strServerName,
  81. IN BOOL bLocal,
  82. IN TString &strMachineName
  83. );
  84. BOOL _bIsDataStored;
  85. BOOL _bValid;
  86. };
  87. /********************************************************************
  88. ServerProp.
  89. Base class for server property sheets. This class should not
  90. not contain any information/services that is not generic to all
  91. derived classes.
  92. ********************************************************************/
  93. class TServerProp : public MGenericProp {
  94. SIGNATURE( 'prsv' )
  95. SAFE_NEW
  96. protected:
  97. TServerProp(
  98. IN TServerData *pServerData
  99. );
  100. virtual
  101. ~TServerProp(
  102. VOID
  103. );
  104. BOOL
  105. bValid(
  106. VOID
  107. );
  108. BOOL
  109. bHandleMessage(
  110. IN UINT uMsg,
  111. IN WPARAM wParam,
  112. IN LPARAM lParam
  113. );
  114. VOID
  115. vCancelToClose(
  116. IN HWND hDlg
  117. );
  118. virtual
  119. BOOL
  120. bSetUI(
  121. VOID
  122. ) = 0;
  123. virtual
  124. BOOL
  125. bReadUI(
  126. VOID
  127. ) = 0;
  128. virtual
  129. BOOL
  130. bSaveUI(
  131. VOID
  132. ) = 0;
  133. virtual
  134. UINT
  135. uGetPageId(
  136. VOID
  137. ) const = 0;
  138. TServerData *_pServerData;
  139. private:
  140. //
  141. // Copying and assignment are not defined.
  142. //
  143. TServerProp(
  144. const TServerProp &
  145. );
  146. TServerProp &
  147. operator =(
  148. const TServerProp &
  149. );
  150. };
  151. /********************************************************************
  152. General server settings page.
  153. ********************************************************************/
  154. class TServerSettings : public TServerProp {
  155. SIGNATURE( 'stsv' )
  156. SAFE_NEW
  157. DEFINE_PAGE_IDENTIFIER( DLG_SERVER_SETTINGS );
  158. public:
  159. TServerSettings(
  160. IN TServerData* pServerData
  161. );
  162. ~TServerSettings(
  163. );
  164. BOOL
  165. bValid(
  166. VOID
  167. );
  168. BOOL
  169. bHandleMessage(
  170. IN UINT uMsg,
  171. IN WPARAM wParam,
  172. IN LPARAM lParam
  173. );
  174. BOOL
  175. bSetUI(
  176. VOID
  177. );
  178. BOOL
  179. bSetUI(
  180. INT LoadType
  181. );
  182. BOOL
  183. bReadUI(
  184. VOID
  185. );
  186. BOOL
  187. bSaveUI(
  188. VOID
  189. );
  190. private:
  191. enum EStatus {
  192. kStatusError,
  193. kStatusSuccess,
  194. kStatusInvalidSpoolDirectory,
  195. kStatusCannotSaveUserNotification,
  196. };
  197. enum CONSTANTS {
  198. kServerAttributesLoad,
  199. kServerAttributesStore,
  200. kServerAttributesDefault,
  201. };
  202. TString _strSpoolDirectoryOrig;
  203. TString _strSpoolDirectory;
  204. BOOL _bBeepErrorJobs;
  205. BOOL _bEventLogging;
  206. BOOL _bNotifyPrintedJobs;
  207. BOOL _bNotifyLocalPrintedJobs;
  208. BOOL _bNotifyNetworkPrintedJobs;
  209. BOOL _bNotifyPrintedJobsComputer;
  210. BOOL _bChanged;
  211. BOOL _bDownLevelServer;
  212. BOOL _bNewOptionSupport;
  213. private:
  214. //
  215. // Copying and assignment are not defined.
  216. //
  217. TServerSettings(
  218. const TServerSettings &
  219. );
  220. TServerSettings &
  221. operator =(
  222. const TServerSettings &
  223. );
  224. INT
  225. sServerAttributes(
  226. BOOL bDirection
  227. );
  228. VOID
  229. TServerSettings::
  230. vEnable(
  231. BOOL bState
  232. );
  233. };
  234. /********************************************************************
  235. Forms server property page.
  236. ********************************************************************/
  237. class TServerForms : public TServerProp {
  238. SIGNATURE( 'fmsv' )
  239. SAFE_NEW
  240. DEFINE_PAGE_IDENTIFIER( DLG_FORMS );
  241. public:
  242. TServerForms(
  243. IN TServerData* pServerData
  244. );
  245. ~TServerForms(
  246. VOID
  247. );
  248. BOOL
  249. bValid(
  250. VOID
  251. );
  252. BOOL
  253. bHandleMessage(
  254. IN UINT uMsg,
  255. IN WPARAM wParam,
  256. IN LPARAM lParam
  257. );
  258. BOOL
  259. bSetUI(
  260. VOID
  261. );
  262. BOOL
  263. bReadUI(
  264. VOID
  265. );
  266. BOOL
  267. bSaveUI(
  268. VOID
  269. );
  270. private:
  271. enum {
  272. kMagic = 0xDEAD
  273. };
  274. //
  275. // Copying and assignment are not defined.
  276. //
  277. TServerForms(
  278. const TServerForms &
  279. );
  280. TServerForms &
  281. operator =(
  282. const TServerForms &
  283. );
  284. PVOID _p;
  285. };
  286. /********************************************************************
  287. Ports server property page.
  288. ********************************************************************/
  289. class TServerPorts : public TServerProp {
  290. SIGNATURE( 'posv' )
  291. SAFE_NEW
  292. DEFINE_PAGE_IDENTIFIER( DLG_SERVER_PORTS );
  293. public:
  294. TServerPorts(
  295. IN TServerData* pServerData
  296. );
  297. ~TServerPorts(
  298. VOID
  299. );
  300. BOOL
  301. bValid(
  302. VOID
  303. );
  304. BOOL
  305. bSetUI(
  306. VOID
  307. );
  308. BOOL
  309. bReadUI(
  310. VOID
  311. );
  312. BOOL
  313. bSaveUI(
  314. VOID
  315. );
  316. BOOL
  317. bHandleMessage(
  318. IN UINT uMsg,
  319. IN WPARAM wParam,
  320. IN LPARAM lParam
  321. );
  322. private:
  323. //
  324. // Copying and assignment are not defined.
  325. //
  326. TServerPorts(
  327. const TServerPorts &
  328. );
  329. TServerPorts &
  330. operator =(
  331. const TServerPorts &
  332. );
  333. TPortsLV _PortsLV;
  334. };
  335. /********************************************************************
  336. Server Driver Administration.
  337. ********************************************************************/
  338. class TServerDrivers : public TServerProp {
  339. SIGNATURE( 'drsv' )
  340. SAFE_NEW
  341. DEFINE_PAGE_IDENTIFIER( DLG_SERVER_DRIVERS );
  342. friend class TServerDriverNotify;
  343. public:
  344. TServerDrivers(
  345. IN TServerData* pServerData
  346. );
  347. ~TServerDrivers(
  348. VOID
  349. );
  350. BOOL
  351. bValid(
  352. VOID
  353. );
  354. BOOL
  355. bSetUI(
  356. VOID
  357. );
  358. BOOL
  359. bReadUI(
  360. VOID
  361. );
  362. BOOL
  363. bSaveUI(
  364. VOID
  365. );
  366. BOOL
  367. bHandleMessage(
  368. IN UINT uMsg,
  369. IN WPARAM wParam,
  370. IN LPARAM lParam
  371. );
  372. private:
  373. //
  374. // Copying and assignment are not defined.
  375. //
  376. TServerDrivers(
  377. const TServerDrivers &
  378. );
  379. TServerDrivers &
  380. operator =(
  381. const TServerDrivers &
  382. );
  383. BOOL
  384. bHandleAddDriver(
  385. UINT uMsg,
  386. WPARAM wParam,
  387. LPARAM lParam
  388. );
  389. BOOL
  390. bHandleRemoveDriver(
  391. UINT uMsg,
  392. WPARAM wParam,
  393. LPARAM lParam
  394. );
  395. BOOL
  396. TServerDrivers::
  397. bHandleUpdateDriver(
  398. UINT uMsg,
  399. WPARAM wParam,
  400. LPARAM lParam
  401. );
  402. BOOL
  403. bHandleDriverDetails(
  404. UINT uMsg,
  405. WPARAM wParam,
  406. LPARAM lParam
  407. );
  408. BOOL
  409. bHandleDriverItemSelection(
  410. UINT uMsg,
  411. WPARAM wParam,
  412. LPARAM lParam
  413. );
  414. VOID
  415. vUpdateButtons(
  416. VOID
  417. );
  418. BOOL
  419. bRemoveDriverCallback(
  420. IN TDriverInfo *pDriverInfo,
  421. IN DWORD dwFlags,
  422. IN DWORD dwRefdata
  423. );
  424. BOOL
  425. bWarnUserDriverDeletion(
  426. IN TDriverInfo *pDriverInfo,
  427. IN UINT nCount
  428. ) const;
  429. BOOL
  430. TServerDrivers::
  431. bWarnUserDriverUpdate(
  432. IN TDriverInfo *pDriverInfo,
  433. IN UINT nCount
  434. ) const;
  435. TDriversLV _DriversLV;
  436. BOOL _bChanged;
  437. BOOL _bCanRemoveDrivers;
  438. };
  439. /********************************************************************
  440. Driver Remove Notify class.
  441. ********************************************************************/
  442. class TServerDriverNotify : public TDriversLVNotify {
  443. public:
  444. TServerDriverNotify(
  445. IN TServerDrivers *ServerDrivers
  446. );
  447. ~TServerDriverNotify(
  448. VOID
  449. );
  450. BOOL
  451. bNotify(
  452. IN TDriverInfo *pDriverInfo
  453. );
  454. private:
  455. //
  456. // Copying and assignment are not defined.
  457. //
  458. TServerDriverNotify(
  459. const TServerDriverNotify &
  460. );
  461. TServerDriverNotify &
  462. operator =(
  463. const TServerDriverNotify &
  464. );
  465. BOOL
  466. bInstall(
  467. IN TDriverInfo *pDriverInfo
  468. );
  469. BOOL
  470. bRemove(
  471. IN TDriverInfo *pDriverInfo
  472. );
  473. BOOL
  474. bUpdate(
  475. IN TDriverInfo *pDriverInfo
  476. );
  477. TServerDrivers *_pServerDrivers;
  478. TPrinterDriverInstallation *_pDi;
  479. BOOL _bActionFailed;
  480. UINT _uNotifyCount;
  481. };
  482. /********************************************************************
  483. Server property windows.
  484. ********************************************************************/
  485. class TServerWindows {
  486. SIGNATURE( 'svrw' )
  487. SAFE_NEW
  488. public:
  489. TServerWindows(
  490. IN TServerData *pServerData
  491. );
  492. ~TServerWindows(
  493. VOID
  494. );
  495. BOOL
  496. bValid(
  497. VOID
  498. );
  499. BOOL
  500. bBuildPages(
  501. VOID
  502. );
  503. BOOL
  504. bDisplayPages(
  505. VOID
  506. );
  507. private:
  508. //
  509. // Copying and assignment are not defined.
  510. //
  511. TServerWindows(
  512. const TServerWindows &
  513. );
  514. TServerWindows &
  515. operator =(
  516. const TServerWindows &
  517. );
  518. TServerData *_pServerData;
  519. TServerForms _Forms;
  520. TServerPorts _Ports;
  521. TServerSettings _Settings;
  522. TServerDrivers _Drivers;
  523. };
  524. /********************************************************************
  525. Global scoped functions.
  526. ********************************************************************/
  527. VOID
  528. vServerPropPages(
  529. IN HWND hwnd,
  530. IN LPCTSTR pszServerName,
  531. IN INT iCmdShow,
  532. IN LPARAM lParam
  533. );
  534. INT WINAPI
  535. iServerPropPagesProc(
  536. IN TServerData *pServerData
  537. );
  538. #endif