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.

146 lines
3.6 KiB

  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2001 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: io.h
  6. *
  7. * Content: DirectPlay Thread Pool I/O functions header file.
  8. *
  9. * History:
  10. * Date By Reason
  11. * ======== ======== =========
  12. * 10/31/01 VanceO Created.
  13. *
  14. ******************************************************************************/
  15. #ifndef __IO_H__
  16. #define __IO_H__
  17. // Overlapped I/O is not supported on Windows CE.
  18. #ifndef WINCE
  19. //=============================================================================
  20. // External Globals
  21. //=============================================================================
  22. extern CFixedPool g_TrackedFilePool;
  23. //=============================================================================
  24. // Classes
  25. //=============================================================================
  26. class CTrackedFile
  27. {
  28. public:
  29. #undef DPF_MODNAME
  30. #define DPF_MODNAME "CTrackedFile::FPM_Alloc"
  31. static BOOL FPM_Alloc(void * pvItem, void * pvContext)
  32. {
  33. CTrackedFile * pTrackedFile = (CTrackedFile*) pvItem;
  34. pTrackedFile->m_Sig[0] = 'T';
  35. pTrackedFile->m_Sig[1] = 'K';
  36. pTrackedFile->m_Sig[2] = 'F';
  37. pTrackedFile->m_Sig[3] = 'L';
  38. pTrackedFile->m_blList.Initialize();
  39. pTrackedFile->m_hFile = DNINVALID_HANDLE_VALUE;
  40. return TRUE;
  41. }
  42. /*
  43. #undef DPF_MODNAME
  44. #define DPF_MODNAME "CTrackedFile::FPM_Get"
  45. static void FPM_Get(void * pvItem, void * pvContext)
  46. {
  47. CTrackedFile * pTrackedFile = (CTrackedFile*) pvItem;
  48. }
  49. #undef DPF_MODNAME
  50. #define DPF_MODNAME "CTrackedFile::FPM_Release"
  51. static void FPM_Release(void * pvItem)
  52. {
  53. CTrackedFile * pTrackedFile = (CTrackedFile*) pvItem;
  54. }
  55. #undef DPF_MODNAME
  56. #define DPF_MODNAME "CTrackedFile::FPM_Dealloc"
  57. static void FPM_Dealloc(void * pvItem)
  58. {
  59. CTrackedFile * pTrackedFile = (CTrackedFile*) pvItem;
  60. }
  61. */
  62. #ifdef DBG
  63. BOOL IsValid(void)
  64. {
  65. if ((m_Sig[0] == 'T') &&
  66. (m_Sig[1] == 'K') &&
  67. (m_Sig[2] == 'F') &&
  68. (m_Sig[3] == 'L'))
  69. {
  70. return TRUE;
  71. }
  72. return FALSE;
  73. }
  74. #endif // DBG
  75. BYTE m_Sig[4]; // debugging signature ('TKFL')
  76. CBilink m_blList; // entry in list of tracked handles
  77. DNHANDLE m_hFile; // handle to file
  78. };
  79. //=============================================================================
  80. // Function prototypes
  81. //=============================================================================
  82. HRESULT InitializeWorkQueueIoInfo(DPTPWORKQUEUE * const pWorkQueue);
  83. void DeinitializeWorkQueueIoInfo(DPTPWORKQUEUE * const pWorkQueue);
  84. HRESULT StartTrackingFileIo(DPTPWORKQUEUE * const pWorkQueue,
  85. const HANDLE hFile);
  86. HRESULT StopTrackingFileIo(DPTPWORKQUEUE * const pWorkQueue,
  87. const HANDLE hFile);
  88. void CancelIoForThisThread(DPTPWORKQUEUE * const pWorkQueue);
  89. CWorkItem * CreateOverlappedIoWorkItem(DPTPWORKQUEUE * const pWorkQueue,
  90. const PFNDPTNWORKCALLBACK pfnWorkCallback,
  91. PVOID const pvCallbackContext);
  92. void ReleaseOverlappedIoWorkItem(DPTPWORKQUEUE * const pWorkQueue,
  93. CWorkItem * const pWorkItem);
  94. #ifndef DPNBUILD_USEIOCOMPLETIONPORTS
  95. void SubmitIoOperation(DPTPWORKQUEUE * const pWorkQueue,
  96. CWorkItem * const pWorkItem);
  97. void ProcessIo(DPTPWORKQUEUE * const pWorkQueue,
  98. DNSLIST_ENTRY ** const ppHead,
  99. DNSLIST_ENTRY ** const ppTail,
  100. USHORT * const pusCount);
  101. #endif // ! DPNBUILD_USEIOCOMPLETIONPORTS
  102. #endif // ! WINCE
  103. #endif // __IO_H__