Changeset 1219
- Timestamp:
- 9/29/2009 1:46:48 PM (4 years ago)
- Location:
- trunk/eraser6/Eraser.Util.FileSystem
- Files:
-
- 3 edited
-
Fat32Api.cpp (modified) (1 diff)
-
FatApi.cpp (modified) (5 diffs)
-
FatApi.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser6/Eraser.Util.FileSystem/Fat32Api.cpp
r1215 r1219 38 38 } 39 39 40 Fat32Api::Fat32Api(VolumeInfo^ info, Microsoft::Win32::SafeHandles::SafeFileHandle^ handle, 41 IO::FileAccess access) : FatApi(info, handle, access) 40 Fat32Api::Fat32Api(VolumeInfo^ info, Stream^ stream) : FatApi(info, stream) 42 41 { 43 42 //Sanity checks: check that this volume is FAT32! -
trunk/eraser6/Eraser.Util.FileSystem/FatApi.cpp
r1215 r1219 29 29 using namespace System::IO; 30 30 using namespace System::Runtime::InteropServices; 31 using namespace Microsoft::Win32::SafeHandles;32 31 33 32 namespace Eraser { … … 45 44 CString volumeName(info->VolumeId); 46 45 volumeName.Truncate(volumeName.GetLength() - 1); 47 VolumeHandle = gcnew SafeFileHandle(static_cast<IntPtr>(CreateFile(volumeName, 48 GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 49 FILE_FLAG_RANDOM_ACCESS, NULL)), 50 true); 51 VolumeStream = gcnew FileStream(VolumeHandle, FileAccess::Read); 46 VolumeStream = info->Open(FileAccess::Read); 52 47 53 48 //Then read the boot sector for information … … 61 56 } 62 57 63 FatApi::FatApi(VolumeInfo^ info, Microsoft::Win32::SafeHandles::SafeFileHandle^ handle, 64 IO::FileAccess access) 58 FatApi::FatApi(VolumeInfo^ info, Stream^ stream) 65 59 { 66 60 SectorSize = info->SectorSize; … … 72 66 73 67 //Open the handle to the drive 74 VolumeHandle = handle; 75 VolumeStream = gcnew FileStream(VolumeHandle, access); 68 VolumeStream = stream; 76 69 77 70 //Then read the boot sector for information … … 80 73 VolumeStream->Read(bootSector, 0, sizeof(*BootSector)); 81 74 Marshal::Copy(bootSector, 0, static_cast<IntPtr>(BootSector), bootSector->Length); 75 76 //Then load the FAT 77 LoadFat(); 82 78 } 83 79 -
trunk/eraser6/Eraser.Util.FileSystem/FatApi.h
r1215 r1219 42 42 /// 43 43 /// \param[in] info The volume to create the FAT API for. 44 /// \param[in] handle A handle to the volume for read/write requests. 45 /// \param[in] access The access required for the volume. 46 FatApi(VolumeInfo^ info, Microsoft::Win32::SafeHandles::SafeFileHandle^ handle, 47 IO::FileAccess access); 44 /// \param[in] stream The stream to use to read/write to the disk. 45 FatApi(VolumeInfo^ info, IO::Stream^ stream); 48 46 49 47 public: … … 111 109 112 110 protected: 113 Microsoft::Win32::SafeHandles::SafeFileHandle^ VolumeHandle; 114 IO::FileStream^ VolumeStream; 111 IO::Stream^ VolumeStream; 115 112 116 113 unsigned SectorSize; // Size of one sector, in bytes … … 221 218 public: 222 219 Fat32Api(VolumeInfo^ info); 223 Fat32Api(VolumeInfo^ info, Microsoft::Win32::SafeHandles::SafeFileHandle^ handle, 224 IO::FileAccess access); 220 Fat32Api(VolumeInfo^ info, IO::Stream^ stream); 225 221 226 222 public:
Note: See TracChangeset
for help on using the changeset viewer.
