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.

136 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. monitorhndl.hxx
  5. Abstract:
  6. This is the class that wrapps the port/language monitor
  7. handle. Monitor's OpenPort method is not expected to be called multiple
  8. times without calling ClosePort. For this reason, the monitor handle
  9. is refcounted and shared between threads
  10. (StartDocPrinter, WritePrinter, FlushPrinter, ReadPrinter, EndDocPrinter,
  11. GetPrinterDataFromPort, SendRecvBidiData).
  12. Author:
  13. Adina Trufinescu July 16th, 2002
  14. Revision History:
  15. --*/
  16. #ifndef _MONHNDL_HXX_
  17. #define _MONHNDL_HXX_
  18. #ifdef __cplusplus
  19. class TMonitorHandle
  20. {
  21. public:
  22. TMonitorHandle(
  23. IN PINIPORT,
  24. IN PINIMONITOR,
  25. IN LPWSTR
  26. );
  27. ~TMonitorHandle(
  28. VOID
  29. );
  30. HRESULT
  31. IsValid(
  32. VOID
  33. );
  34. ULONG
  35. AddRef(
  36. VOID
  37. );
  38. ULONG
  39. Release(
  40. VOID
  41. );
  42. ULONG
  43. InUse(
  44. VOID
  45. );
  46. operator PINIMONITOR(
  47. VOID
  48. );
  49. operator HANDLE(
  50. VOID
  51. );
  52. private:
  53. HRESULT
  54. Open(
  55. VOID
  56. );
  57. HRESULT
  58. Close(
  59. VOID
  60. );
  61. HRESULT
  62. OpenLangMonitorUplevel(
  63. VOID
  64. );
  65. HRESULT
  66. OpenLangMonitorDownlevel(
  67. VOID
  68. );
  69. HRESULT
  70. OpenMonitorForFILEPort(
  71. VOID
  72. );
  73. HRESULT
  74. OpenPortMonitor(
  75. VOID
  76. );
  77. VOID
  78. LeaveSpoolerSem(
  79. VOID
  80. );
  81. VOID
  82. ReEnterSpoolerSem(
  83. VOID
  84. );
  85. enum EMonitorType
  86. {
  87. kNone = 0,
  88. kLanguage,
  89. kPort,
  90. kFile,
  91. };
  92. PINIPORT m_pIniPort;
  93. PINIMONITOR m_pIniLangMonitor;
  94. LPWSTR m_pszPrinterName;
  95. LONG m_RefCnt;
  96. HRESULT m_hValid;
  97. HANDLE m_hPort;
  98. EMonitorType m_OpenedMonitorType;
  99. static
  100. WCHAR m_szFILE[];
  101. };
  102. #endif // __cplusplus
  103. #endif //