Source code of Windows XP (NT5)
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.

94 lines
2.6 KiB

  1. //---------------------------------------------------------------------
  2. // Copyright (C)1998 Microsoft Corporation, All Rights Reserved.
  3. //
  4. // iostatus.cpp
  5. //
  6. // Author:
  7. //
  8. // Edward Reus (edwardr) 02-28-98 Initial coding.
  9. //
  10. //---------------------------------------------------------------------
  11. #include "precomp.h"
  12. //---------------------------------------------------------------------
  13. // CIOSTATUS::CIOSTATUS()
  14. //
  15. //---------------------------------------------------------------------
  16. CIOSTATUS::CIOSTATUS()
  17. {
  18. m_dwMainThreadId = 0;
  19. m_hIoCompletionPort = INVALID_HANDLE_VALUE;
  20. m_lNumThreads = 0;
  21. m_lNumPendingThreads = 0;
  22. m_phRpcBinding = 0;
  23. }
  24. //---------------------------------------------------------------------
  25. // CIOSTATUS::~CIOSTATUS()
  26. //
  27. //---------------------------------------------------------------------
  28. CIOSTATUS::~CIOSTATUS()
  29. {
  30. CloseHandle(m_hIoCompletionPort);
  31. }
  32. //------------------------------------------------------------------------
  33. // CIOSTATUS::operator new()
  34. //
  35. //------------------------------------------------------------------------
  36. void *CIOSTATUS::operator new( IN size_t Size )
  37. {
  38. void *pObj = AllocateMemory(Size);
  39. return pObj;
  40. }
  41. //------------------------------------------------------------------------
  42. // CIOSTATUS::operator delete()
  43. //
  44. //------------------------------------------------------------------------
  45. void CIOSTATUS::operator delete( IN void *pObj,
  46. IN size_t Size )
  47. {
  48. if (pObj)
  49. {
  50. DWORD dwStatus = FreeMemory(pObj);
  51. #ifdef DBG_MEM
  52. if (dwStatus)
  53. {
  54. DbgPrint("IrXfer: IrTran-P: CIOSTATUS::delete Failed: %d\n",
  55. dwStatus );
  56. }
  57. #endif
  58. }
  59. }
  60. //---------------------------------------------------------------------
  61. // CIOSTATUS::Initialize();
  62. //
  63. //---------------------------------------------------------------------
  64. DWORD CIOSTATUS::Initialize()
  65. {
  66. DWORD dwStatus = NO_ERROR;
  67. m_dwMainThreadId = GetCurrentThreadId();
  68. // Create an IO completion port to use in our asynchronous IO.
  69. m_hIoCompletionPort = CreateIoCompletionPort( INVALID_HANDLE_VALUE,
  70. 0,
  71. 0,
  72. 0 );
  73. if (!m_hIoCompletionPort)
  74. {
  75. dwStatus = GetLastError();
  76. #ifdef DBG_ERROR
  77. DbgPrint("CreateIoCompletionPort(): Failed: %d\n",dwStatus);
  78. #endif
  79. return dwStatus;
  80. }
  81. return dwStatus;
  82. }