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.

100 lines
3.0 KiB

  1. /*++
  2. Copyright (c) 1998-2000 Microsoft Corporation
  3. Module Name :
  4. prnport.h
  5. Abstract:
  6. Printer port Device object handles one redirected printer port
  7. Revision History:
  8. --*/
  9. #pragma once
  10. /////////////////////////////////////////////////////////////////
  11. //
  12. // DrPrinterPort Class
  13. //
  14. class DrPrinterPort : public DrDevice
  15. {
  16. protected:
  17. ULONG _PortType;
  18. ULONG _PortNumber;
  19. UNICODE_STRING _SymbolicLinkName;
  20. BOOL _IsOpen;
  21. typedef struct __WorkItem {
  22. DrPrinterPort* pObj;
  23. PRDPDR_DEVICE_ANNOUNCE deviceAnnounce;
  24. } DrPrinterPortWorkItem;
  25. virtual NTSTATUS CreateDevicePath(PUNICODE_STRING DevicePath);
  26. virtual BOOL IsDeviceNameValid();
  27. public:
  28. DrPrinterPort(SmartPtr<DrSession> &Session, ULONG DeviceType,
  29. ULONG DeviceId, PUCHAR PreferredDosName);
  30. virtual ~DrPrinterPort();
  31. virtual NTSTATUS Initialize(PRDPDR_DEVICE_ANNOUNCE DeviceAnnounce, ULONG Length);
  32. NTSTATUS CreatePrinterPort(PWCHAR portName);
  33. virtual BOOL ShouldCreatePort();
  34. virtual BOOL ShouldCreatePrinter();
  35. virtual BOOL ShouldAnnouncePrintPort();
  36. NTSTATUS CreatePrinterAnnounceEvent(
  37. IN PRDPDR_DEVICE_ANNOUNCE devAnnounceMsg,
  38. IN OUT PRDPDR_PRINTERDEVICE_SUB prnAnnounceEvent,
  39. IN ULONG prnAnnounceEventSize,
  40. IN PCWSTR portName,
  41. OPTIONAL OUT ULONG *prnAnnounceEventReqSize
  42. );
  43. NTSTATUS CreatePortAnnounceEvent(
  44. IN PRDPDR_DEVICE_ANNOUNCE devAnnounceMsg,
  45. IN OUT PRDPDR_PORTDEVICE_SUB portAnnounceEvent,
  46. IN ULONG portAnnounceEventSize,
  47. IN PCWSTR portName,
  48. OPTIONAL OUT ULONG *portAnnounceEventReqSize
  49. );
  50. virtual VOID Remove();
  51. // Override the 'Write' method. This needs to go to the client at low priority
  52. // to prevent us from filling the entire pipe on a slow link with print data.
  53. virtual NTSTATUS Write(IN OUT PRX_CONTEXT RxContext, IN BOOL LowPrioSend = FALSE);
  54. virtual NTSTATUS FinishDeferredInitialization(DrPrinterPortWorkItem *pItem);
  55. virtual NTSTATUS Create(IN OUT PRX_CONTEXT RxContext);
  56. virtual NTSTATUS QueryVolumeInfo(IN OUT PRX_CONTEXT RxContext);
  57. virtual VOID NotifyClose();
  58. static VOID ProcessWorkItem(
  59. IN PDEVICE_OBJECT DeviceObject,
  60. IN PVOID context
  61. );
  62. NTSTATUS AnnouncePrinter(PRDPDR_DEVICE_ANNOUNCE devAnnounceMsg);
  63. virtual NTSTATUS AnnouncePrintPort(
  64. PRDPDR_DEVICE_ANNOUNCE devAnnounceMsg);
  65. };
  66. /////////////////////////////////////////////////////////////////
  67. //
  68. // DrPrinter Class
  69. //
  70. class DrPrinter : public DrPrinterPort
  71. {
  72. public:
  73. DrPrinter(SmartPtr<DrSession> &Session, ULONG DeviceType,
  74. ULONG DeviceId, PUCHAR PreferredDosName) :
  75. DrPrinterPort( Session, DeviceType, DeviceId, PreferredDosName )
  76. {
  77. }
  78. virtual BOOL ShouldAnnouncePrintPort() { return FALSE; }
  79. };