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.

172 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. scraper.cpp
  5. Abstract:
  6. Implementation of scraper base class.
  7. Author:
  8. Brian Guarraci (briangu) 2001.
  9. Revision History:
  10. --*/
  11. #include <stdio.h>
  12. #include "scraper.h"
  13. CScraper::CScraper(
  14. VOID
  15. )
  16. /*++
  17. Routine Description:
  18. Default constructor (don't use)
  19. Arguments:
  20. None
  21. Return Value:
  22. N/A
  23. --*/
  24. {
  25. m_hConBufIn = INVALID_HANDLE_VALUE;
  26. m_hConBufOut = INVALID_HANDLE_VALUE;
  27. m_IoHandler = NULL;
  28. m_wMaxCols = 0;
  29. m_wMaxRows = 0;
  30. m_wCols = 0;
  31. m_wRows = 0;
  32. }
  33. CScraper::CScraper(
  34. CIoHandler *IoHandler,
  35. WORD wCols,
  36. WORD wRows
  37. )
  38. /*++
  39. Routine Description:
  40. Constructor
  41. Arguments:
  42. IoHandler - the IoHandler to write the result of the
  43. screen scraping to
  44. wCols - the # of cols that the scraped app should have
  45. wRows - the # of rows that the scraped app should have
  46. Return Value:
  47. N/A
  48. --*/
  49. {
  50. m_hConBufIn = INVALID_HANDLE_VALUE;
  51. m_hConBufOut = INVALID_HANDLE_VALUE;
  52. m_IoHandler = IoHandler;
  53. m_wMaxCols = wCols;
  54. m_wCols = wCols;
  55. m_wMaxRows = wRows;
  56. m_wRows = wRows;
  57. }
  58. CScraper::~CScraper()
  59. /*++
  60. Routine Description:
  61. Destructor
  62. Arguments:
  63. N/A
  64. Return Value:
  65. N/A
  66. --*/
  67. {
  68. if (m_hConBufIn != INVALID_HANDLE_VALUE) {
  69. CloseHandle( m_hConBufIn );
  70. }
  71. if (m_hConBufOut != INVALID_HANDLE_VALUE) {
  72. CloseHandle( m_hConBufOut );
  73. }
  74. }
  75. VOID
  76. CScraper::SetConOut(
  77. HANDLE ConOut
  78. )
  79. /*++
  80. Routine Description:
  81. This routine sets the console output handle the screen scraper
  82. uses to scrape from. This should be the conout handle that the
  83. app the scraper is scraping for is writing to.
  84. Arguments:
  85. ConOut - the console output handle
  86. Return Value:
  87. None
  88. --*/
  89. {
  90. m_hConBufOut = ConOut;
  91. }
  92. VOID
  93. CScraper::SetConIn(
  94. HANDLE ConIn
  95. )
  96. /*++
  97. Routine Description:
  98. This routine sets the console input that the screen scraper
  99. will use - actually, this is the conin handle that will be
  100. used by the app that the screen scraper is scraping for.
  101. Arguments:
  102. ConIn - the console input handle
  103. Return Value:
  104. None
  105. --*/
  106. {
  107. m_hConBufIn = ConIn;
  108. }