FILESYSTEM.H
上传用户:linklycbj
上传日期:2009-11-12
资源大小:447k
文件大小:3k
源码类别:

Windows编程

开发平台:

WINDOWS

  1. // FileSystem.h -- Interface for the CFileSystem class
  2. // Copyright (C) 1996 by Walter Oney
  3. // All rights reserved
  4. #ifndef FILESYSTEM_H
  5. #define FILESYSTEM_H
  6. #ifndef SETINITSEG
  7. #define SETINITSEG
  8. #pragma warning(disable:4075) // nonstandard init seg
  9. #pragma init_seg("INITCODE")
  10. #pragma warning(default:4075)
  11. #endif
  12. ///////////////////////////////////////////////////////////////////////////////
  13. // Useful general-purpose definitions
  14. #include <string.h>
  15. #pragma intrinsic(memcmp, memcpy, memset, strcat, strcmp, strcpy, strlen)
  16. #ifdef DEBUG
  17. #define ASSERT(e) if(!(e)){Debug_Printf("Assertion failure in " __FILE__ ", line %d: " #e "rn", __LINE__);
  18. _asm int 1
  19. }
  20. #else
  21. #define ASSERT(e)
  22. #endif
  23. #ifndef MAKELONG
  24. #define MAKELONG(low, high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
  25. #endif
  26. #ifndef FIELDOFFSET
  27. #define FIELDOFFSET(type, field) ((DWORD)(&((type *)0)->field))
  28. #endif
  29. #ifndef arraysize
  30. #define arraysize(p) (sizeof(p)/sizeof((p)[0]))
  31. #endif
  32. #ifndef min
  33. #define min(a,b) ((a) > (b) ? (b) : (a))
  34. #endif
  35. #ifndef max
  36. #define max(a,b) ((a) > (b) ? (a) : (b))
  37. #endif
  38. ///////////////////////////////////////////////////////////////////////////////
  39. // CFileSystem class:
  40. extern "C" extern ILB theILB;
  41. class CFileSystem
  42. { // CFileSystem
  43. public:
  44. CFileSystem();
  45. virtual ~CFileSystem();
  46. static CFileSystem* (*CreateNewFcn)();
  47. static int ProviderId;
  48. static BOOL Register(CFileSystem* (*createnew)());
  49. // Virtual FSD functions used by all types of file system:
  50. #undef vt
  51. #define vt(f) virtual int f(pioreq pir);
  52. vt(EmptyFunc)
  53. vt(DeleteFile)
  54. vt(Dir)
  55. vt(FileAttributes)
  56. vt(FlushVolume)
  57. vt(GetDiskInfo)
  58. vt(OpenFile)
  59. vt(RenameFile)
  60. vt(SearchFile)
  61. vt(QueryResourceInfo)
  62. vt(DisconnectResource)
  63. vt(NamedPipeUNCRequest)
  64. vt(Ioctl16Drive)
  65. vt(GetDiskParms)
  66. vt(FindFirstFile)
  67. vt(DirectDiskIO)
  68. vt(FindClose)
  69. vt(FindNextFile)
  70. vt(ReadFile)
  71. vt(WriteFile)
  72. vt(FileSeek)
  73. vt(CloseFile)
  74. vt(CommitFile)
  75. vt(LockFile)
  76. vt(FileDateTime)
  77. vt(NamedPipeHandleInfo)
  78. vt(EnumerateHandle)
  79. // The following table declares the static thunks that interface
  80. // between IFS and various virtual FSD functions:
  81. #undef vt
  82. #define vt(f) static int f##Thunk(pioreq pir);
  83. vt(EmptyFunc)
  84. vt(DeleteFile)
  85. vt(Dir)
  86. vt(FileAttributes)
  87. vt(FlushVolume)
  88. vt(GetDiskInfo)
  89. vt(OpenFile)
  90. vt(RenameFile)
  91. vt(SearchFile)
  92. vt(QueryResourceInfo)
  93. vt(DisconnectResource)
  94. vt(NamedPipeUNCRequest)
  95. vt(Ioctl16Drive)
  96. vt(GetDiskParms)
  97. vt(FindFirstFile)
  98. vt(DirectDiskIO)
  99. vt(FindClose)
  100. vt(FindNextFile)
  101. vt(ReadFile)
  102. vt(WriteFile)
  103. vt(FileSeek)
  104. vt(CloseFile)
  105. vt(CommitFile)
  106. vt(LockFile)
  107. vt(FileDateTime)
  108. vt(NamedPipeHandleInfo)
  109. vt(EnumerateHandle)
  110. }; // CFileSystem
  111. #endif // FILESYSTEM_H