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.

135 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. DeviceProp.h
  5. Abstract:
  6. Holds outbound routing configuraton per single device
  7. Author:
  8. Eran Yariv (EranY) Nov, 1999
  9. Revision History:
  10. --*/
  11. #ifndef _DEVICE_PROP_H_
  12. #define _DEVICE_PROP_H_
  13. #include "critsec.h"
  14. /************************************
  15. * *
  16. * CDeviceRoutingInfo *
  17. * *
  18. ************************************/
  19. class CDeviceRoutingInfo
  20. {
  21. public:
  22. CDeviceRoutingInfo (DWORD Id);
  23. ~CDeviceRoutingInfo ();
  24. DWORD Id () { return m_dwId; }
  25. BOOL IsStoreEnabled () { return (m_dwFlags & LR_STORE) ? TRUE : FALSE; }
  26. BOOL IsPrintEnabled () { return (m_dwFlags & LR_PRINT) ? TRUE : FALSE; }
  27. BOOL IsEmailEnabled () { return (m_dwFlags & LR_EMAIL) ? TRUE : FALSE; }
  28. DWORD ReadConfiguration ();
  29. DWORD EnableStore (BOOL bEnabled);
  30. DWORD EnablePrint (BOOL bEnabled);
  31. DWORD EnableEmail (BOOL bEnabled);
  32. BOOL GetStoreFolder (wstring &strFolder);
  33. BOOL GetPrinter (wstring &strPrinter);
  34. BOOL GetSMTPTo (wstring &strSMTP);
  35. DWORD SetStoreFolder (LPCWSTR lpcwstrCfg)
  36. {
  37. return SetStringValue (m_strStoreFolder, REGVAL_RM_FOLDER_GUID, lpcwstrCfg);
  38. }
  39. DWORD SetPrinter (LPCWSTR lpcwstrCfg)
  40. {
  41. return SetStringValue (m_strPrinter, REGVAL_RM_PRINTING_GUID, lpcwstrCfg);
  42. }
  43. DWORD SetSMTPTo (LPCWSTR lpcwstrCfg)
  44. {
  45. return SetStringValue (m_strSMTPTo, REGVAL_RM_EMAIL_GUID, lpcwstrCfg);
  46. }
  47. HRESULT ConfigChange ( LPCWSTR lpcwstrNameGUID, // Configuration name
  48. LPBYTE lpData, // New configuration data
  49. DWORD dwDataSize // Size of new configuration data
  50. );
  51. DWORD RegisterForChangeNotifications ();
  52. DWORD UnregisterForChangeNotifications ();
  53. private:
  54. #define NUM_NOTIFICATIONS 4
  55. DWORD EnableFlag (DWORD dwFlag, BOOL bEnable);
  56. DWORD SetStringValue (wstring &wstr, LPCWSTR lpcwstrGUID, LPCWSTR lpcwstrCfg);
  57. DWORD CheckMailConfig (LPBOOL lpbConfigOk);
  58. wstring m_strStoreFolder;
  59. wstring m_strPrinter;
  60. wstring m_strSMTPTo;
  61. DWORD m_dwFlags;
  62. DWORD m_dwId;
  63. HANDLE m_NotificationHandles[NUM_NOTIFICATIONS];
  64. }; // CDeviceRoutingInfo
  65. /************************************
  66. * *
  67. * CDevicesMap *
  68. * *
  69. ************************************/
  70. typedef map <DWORD, CDeviceRoutingInfo *> DEVICES_MAP, *PDEVICES_MAP;
  71. class CDevicesMap
  72. {
  73. public:
  74. CDevicesMap () : m_bInitialized (FALSE) {}
  75. ~CDevicesMap ();
  76. DWORD Init (); // Initialize internals
  77. CDeviceRoutingInfo *FindDeviceRoutingInfo (DWORD dwDeviceId); // Just lookup device in map
  78. CDeviceRoutingInfo *GetDeviceRoutingInfo (DWORD dwDeviceId); // Lookup and create device not found in map
  79. private:
  80. BOOL m_bInitialized; // Was critical section initialized?
  81. CRITICAL_SECTION m_CsMap; // Critical section to protect map access
  82. DEVICES_MAP m_Map; // Map of known devices
  83. }; // CDevicesMap
  84. /************************************
  85. * *
  86. * Externals *
  87. * *
  88. ************************************/
  89. extern CDevicesMap g_DevicesMap; // Global map of known devices (used for late discovery).
  90. extern CFaxCriticalSection g_csRoutingStrings; // Global critical section to protect the access to
  91. // the strings of the routing methods.
  92. #endif // _DEVICE_PROP_H_