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.

55 lines
1.3 KiB

  1. #include "interface.h"
  2. #include "kernel.h"
  3. #pragma PAGEDCODE
  4. CReaderInterface::CReaderInterface()
  5. {
  6. protocol = NULL;
  7. memory = NULL;
  8. debug = NULL;
  9. Initialized = FALSE;
  10. Mode = READER_MODE_NATIVE;
  11. };
  12. CReaderInterface::CReaderInterface(CProtocol* protocol)
  13. {
  14. debug = kernel->createDebug();
  15. if(protocol) this->protocol = protocol;
  16. memory = kernel->createMemory();
  17. if(memory)
  18. {
  19. pOutputBuffer = (PUCHAR) memory->allocate(NonPagedPool,INTERFACE_OUTPUT_BUFFER_SIZE);
  20. pInputBuffer = (PUCHAR) memory->allocate(NonPagedPool,INTERFACE_INPUT_BUFFER_SIZE);
  21. if(pOutputBuffer && pInputBuffer)
  22. {
  23. OutputBufferLength = INTERFACE_OUTPUT_BUFFER_SIZE;
  24. InputBufferLength = INTERFACE_INPUT_BUFFER_SIZE;
  25. }
  26. else
  27. {
  28. if(pOutputBuffer) memory->free(pOutputBuffer);
  29. if(pInputBuffer) memory->free(pInputBuffer);
  30. pOutputBuffer = NULL;
  31. pInputBuffer = NULL;
  32. }
  33. }
  34. Initialized = FALSE;
  35. Mode = READER_MODE_NATIVE;
  36. TRACE("********* ReaderInterface object created ...\n");
  37. };
  38. CReaderInterface::~CReaderInterface()
  39. {
  40. TRACE("******* Destroing ReaderInterface object...\n");
  41. if(memory)
  42. {
  43. if(pOutputBuffer) memory->free(pOutputBuffer);
  44. if(pInputBuffer) memory->free(pInputBuffer);
  45. memory->dispose();
  46. }
  47. if(protocol) protocol->dispose();
  48. if(debug) debug->dispose();
  49. };