FILESYSTEM.CPP
Upload User: linklycbj
Upload Date: 2009-11-12
Package Size: 447k
Code Size: 3k
Category:

Windows Develop

Development Platform:

WINDOWS

  1. // FileSystem.cpp -- Implementation of CFileSystem
  2. // Copyright (C) 1996 by Walter Oney
  3. // All rights reserved
  4. #define NULL 0
  5. class CFileSystem;
  6. #define rh_t CFileSystem*
  7. extern "C" {
  8. #define WANTVXDWRAPS
  9. #include <basedef.h>
  10. #include <vmm.h>
  11. #include <debug.h>
  12. #include <vxdwraps.h>
  13. #include <winerror.h>
  14. #include "iosdcls.h"
  15. #include "ifsmgr.h"
  16. } // extern "C"
  17. #pragma hdrstop
  18. #include "FileSystem.h"
  19. ///////////////////////////////////////////////////////////////////////////////
  20. CFileSystem* (*CFileSystem::CreateNewFcn)() = NULL;
  21. int CFileSystem::ProviderId = 0;
  22. CFileSystem::CFileSystem()
  23. { // CFileSystem::CFileSystem
  24. } // CFileSystem::CFileSystem
  25. CFileSystem::~CFileSystem()
  26. { // CFileSystem::~CFileSystem
  27. } // CFileSystem::~CFileSystem
  28. BOOL CFileSystem::Register(CFileSystem* (*createnew)())
  29. { // CFileSystem::Register
  30. CreateNewFcn = createnew;
  31. return TRUE;
  32. } // CFileSystem::Register
  33. ///////////////////////////////////////////////////////////////////////////////
  34. #undef vt
  35. #define vt(f) int CFileSystem::f##Thunk(pioreq pir) {return pir->ir_error = ((CFileSystem*)(pir->ir_rh))->f(pir);}
  36. vt(EmptyFunc)
  37. vt(DeleteFile)
  38. vt(Dir)
  39. vt(FileAttributes)
  40. vt(FlushVolume)
  41. vt(GetDiskInfo)
  42. vt(OpenFile)
  43. vt(RenameFile)
  44. vt(SearchFile)
  45. vt(QueryResourceInfo)
  46. vt(DisconnectResource)
  47. vt(NamedPipeUNCRequest)
  48. vt(Ioctl16Drive)
  49. vt(GetDiskParms)
  50. vt(FindFirstFile)
  51. vt(DirectDiskIO)
  52. vt(FindClose)
  53. vt(FindNextFile)
  54. vt(ReadFile)
  55. vt(WriteFile)
  56. vt(FileSeek)
  57. vt(CloseFile)
  58. vt(CommitFile)
  59. vt(LockFile)
  60. vt(FileDateTime)
  61. vt(NamedPipeHandleInfo)
  62. vt(EnumerateHandle)
  63. // Default implementations of FSD functions that should be overridden:
  64. #undef vt
  65. #define vt(f) int CFileSystem::f(pioreq pir) { 
  66. ASSERT(!"Using base-class " #f); 
  67. return pir->ir_error = ERROR_INVALID_FUNCTION;}
  68. vt(DeleteFile)
  69. vt(Dir)
  70. vt(FileAttributes)
  71. vt(FlushVolume)
  72. vt(GetDiskInfo)
  73. vt(OpenFile)
  74. vt(RenameFile)
  75. vt(SearchFile)
  76. vt(QueryResourceInfo)
  77. vt(NamedPipeUNCRequest)
  78. vt(Ioctl16Drive)
  79. vt(GetDiskParms)
  80. vt(FindFirstFile)
  81. vt(DirectDiskIO)
  82. vt(FindClose)
  83. vt(FindNextFile)
  84. vt(ReadFile)
  85. vt(WriteFile)
  86. vt(FileSeek)
  87. vt(CloseFile)
  88. vt(CommitFile)
  89. vt(LockFile)
  90. vt(FileDateTime)
  91. vt(NamedPipeHandleInfo)
  92. vt(EnumerateHandle)
  93. // An instance that wants to supply an empty function should point to
  94. // EmptyFunc, which doesn't ASSERT when called:
  95. int CFileSystem::EmptyFunc(pioreq pir)
  96. { // CFileSystem::EmptyFunc
  97. return pir->ir_error = ERROR_INVALID_FUNCTION;
  98. } // CFileSystem::EmptyFunc
  99. ///////////////////////////////////////////////////////////////////////////////
  100. int CFileSystem::DisconnectResource(pioreq pir)
  101. { // CLocalFileSystem::DisconnectResource
  102. delete this;
  103. return pir->ir_error = 0;
  104. } // CLocalFileSystem::DisconnectResource
  105. ///////////////////////////////////////////////////////////////////////////////