Changeset 1997 for trunk/eraser
- Timestamp:
- 5/1/2010 9:34:00 AM (3 years ago)
- Location:
- trunk/eraser/Eraser.Util.Native
- Files:
-
- 4 edited
-
Eraser.Util.Native.vcproj (modified) (4 diffs)
-
Fat.h (modified) (1 diff)
-
FatApi.h (modified) (15 diffs)
-
OpenHandle.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser/Eraser.Util.Native/Eraser.Util.Native.vcproj
r1802 r1997 51 51 RuntimeLibrary="3" 52 52 UsePrecompiledHeader="2" 53 GenerateXMLDocumentationFiles="true" 53 54 WarningLevel="4" 54 55 DebugInformationFormat="3" … … 126 127 RuntimeLibrary="3" 127 128 UsePrecompiledHeader="2" 129 GenerateXMLDocumentationFiles="true" 128 130 WarningLevel="4" 129 131 DebugInformationFormat="3" … … 200 202 RuntimeLibrary="2" 201 203 UsePrecompiledHeader="2" 204 GenerateXMLDocumentationFiles="true" 202 205 WarningLevel="4" 203 206 DebugInformationFormat="3" … … 274 277 RuntimeLibrary="2" 275 278 UsePrecompiledHeader="2" 279 GenerateXMLDocumentationFiles="true" 276 280 WarningLevel="4" 277 281 DebugInformationFormat="3" -
trunk/eraser/Eraser.Util.Native/Fat.h
r1802 r1997 133 133 union 134 134 { 135 // /EA-Index (used by OS/2 and NT) in FAT12 and FAT16135 // EA-Index (used by OS/2 and NT) in FAT12 and FAT16 136 136 unsigned short EAIndex; 137 137 138 // /High 2 bytes of first cluster number in FAT32138 // High 2 bytes of first cluster number in FAT32 139 139 unsigned short StartClusterHigh; 140 140 }; -
trunk/eraser/Eraser.Util.Native/FatApi.h
r1802 r1997 30 30 ref class FatDirectoryBase; 31 31 32 /// Represents an abstract API to interface with FAT file systems. 32 /// <summary> 33 /// Represents an abstract API to interface with FAT file systems 34 /// </summary> 33 35 public ref class FatApi abstract 34 36 { 35 37 protected: 38 /// <summary> 36 39 /// Constructor. 40 /// </summary> 37 41 /// 38 /// \param[in] info The volume to create the FAT API for. The volume handle39 /// created has read access only.42 /// <param name="info">The volume to create the FAT API for. The volume 43 /// handle created has read access only.</param> 40 44 FatApi(VolumeInfo^ info); 41 45 46 /// <summary> 42 47 /// Constructor. 48 /// </summary> 43 49 /// 44 /// \param[in] stream The stream to use to read/write to the disk.50 /// <param name="stream">The stream to use to read/write to the disk.</param> 45 51 FatApi(IO::Stream^ stream); 46 52 47 53 public: 54 /// <summary> 48 55 /// Loads the File Allocation Table from disk. 56 /// </summary> 49 57 virtual void LoadFat() = 0; 50 58 59 /// <summary> 51 60 /// Helper function to loads the directory structure representing the 52 61 /// directory with the given volume-relative path. 53 /// 54 /// \overload LoadDirectory 62 /// </summary> 55 63 FatDirectoryBase^ LoadDirectory(String^ directory); 56 64 65 /// <summary> 57 66 /// Loads the directory structure at the given cluster. 67 /// </summary> 58 68 virtual FatDirectoryBase^ LoadDirectory(unsigned cluster, String^ name, 59 69 FatDirectoryBase^ parent) = 0; 60 70 61 71 internal: 72 /// <summary> 62 73 /// Converts a sector-based address to a byte offset relative to the start 63 74 /// of the volume. 75 /// </summary> 64 76 virtual unsigned long long SectorToOffset(unsigned long long sector); 65 77 78 /// <summary> 66 79 /// Converts a cluster-based address to a byte offset relative to the start 67 80 /// of the volume. 81 /// </summary> 68 82 virtual long long ClusterToOffset(unsigned cluster) = 0; 69 83 … … 71 85 unsigned SectorSizeToSize(unsigned size); 72 86 87 /// <summary> 73 88 /// Converts a cluster-based file size fo the actual size of the file in bytes. 89 /// </summary> 74 90 unsigned ClusterSizeToSize(unsigned size); 75 91 92 /// <summary> 76 93 /// Verifies that the given cluster is allocated and in use. 77 /// 78 /// \param[in] cluster The cluster to verify.94 /// </summary> 95 /// <param name="cluster">The cluster to verify.</param> 79 96 virtual bool IsClusterAllocated(unsigned cluster) = 0; 80 97 98 /// <summary> 81 99 /// Gets the next cluster in the file. 82 /// 83 /// \param[in] cluster The current cluster to check.84 /// \return 0xFFFFFFFF if the cluster given is the last one,85 /// otherwise the next cluster in the file.100 /// </summary> 101 /// <param name="cluster">The current cluster to check.</param> 102 /// <return>0xFFFFFFFF if the cluster given is the last one, otherwise 103 /// the next cluster in the file.</return> 86 104 virtual unsigned GetNextCluster(unsigned cluster) = 0; 87 105 106 /// <summary> 88 107 /// Gets the size of the file in bytes starting at the given cluster. 89 108 /// Make sure that the given cluster is the first one, there is no way 90 109 /// to verify it is indeed the first one and if later clusters are given 91 110 /// the calculated size will be wrong. 111 /// </summary> 92 112 virtual unsigned FileSize(unsigned cluster) = 0; 93 113 114 /// <summary> 94 115 /// Gets the contents of the file starting at the given cluster. 116 /// </summary> 95 117 array<Byte>^ GetFileContents(unsigned cluster); 96 118 119 /// <summary> 97 120 /// Set the contents of the file starting at the given cluster. The length 98 121 /// of the contents must exactly match the length of the file. 99 /// 100 /// \param[in] buffer The data to write.101 /// \param[in] cluster The cluster to begin writing to.122 /// </summary> 123 /// <param name="buffer">The data to write.</param> 124 /// <param name="cluster">The cluster to begin writing to.</param> 102 125 void SetFileContents(array<Byte>^ buffer, unsigned cluster); 103 126 127 /// <summary> 104 128 /// Resolves a directory to the position on-disk 105 /// 106 /// \param[in] path A volume-relative path to the directory.129 /// </summary> 130 /// <param name="path">A volume-relative path to the directory.</param> 107 131 virtual unsigned DirectoryToCluster(String^ path) = 0; 108 132 109 133 protected: 134 /// <summary> 110 135 /// The stream used to access the volume. 136 /// </summary> 111 137 property IO::Stream^ VolumeStream 112 138 { … … 135 161 }; 136 162 163 /// <summary> 137 164 /// Represents the types of FAT directory entries. 165 /// </summary> 138 166 public enum class FatDirectoryEntryType 139 167 { … … 142 170 }; 143 171 172 /// <summary> 144 173 /// Represents a FAT directory entry. 174 /// </summary> 145 175 public ref class FatDirectoryEntry 146 176 { 147 177 public: 178 /// <summary> 148 179 /// Gets the name of the file or directory. 180 /// </summary> 149 181 property String^ Name 150 182 { … … 154 186 } 155 187 188 /// <summary> 156 189 /// Gets the full path to the file or directory. 190 /// </summary> 157 191 property String^ FullName 158 192 { … … 160 194 } 161 195 196 /// <summary> 162 197 /// Gets the parent directory of this entry. 198 /// </summary> 163 199 property FatDirectoryBase^ Parent 164 200 { … … 168 204 } 169 205 206 /// <summary> 170 207 /// Gets the type of this entry. 208 /// </summary> 171 209 property FatDirectoryEntryType EntryType 172 210 { … … 176 214 } 177 215 216 /// <summary> 178 217 /// Gets the first cluster of this entry. 218 /// </summary> 179 219 property unsigned Cluster 180 220 { … … 185 225 186 226 internal: 227 /// <summary> 187 228 /// Constructor. 188 /// 189 /// \param[in] name The name of the entry.190 /// \param[in] parent The parent directory containing this file.191 /// \param[in] type The type of this entry.192 /// \param[in] cluster The first cluster of the file.229 /// </summary> 230 /// <param name="name">The name of the entry.</param> 231 /// <param name="parent">The parent directory containing this file.</param> 232 /// <param name="type">The type of this entry.</param> 233 /// <param name="cluster">The first cluster of the file.</param> 193 234 FatDirectoryEntry(String^ name, FatDirectoryBase^ parent, FatDirectoryEntryType type, 194 235 unsigned cluster); … … 201 242 }; 202 243 244 /// <summary> 203 245 /// Represents an abstract FAT directory (can also represent the root directory of 204 246 /// FAT12 and FAT16 volumes.) 247 /// </summary> 205 248 public ref class FatDirectoryBase abstract : FatDirectoryEntry 206 249 { 207 250 protected: 251 /// <summary> 208 252 /// Constructor. 209 /// 210 /// \param[in] name The name of the current directory.211 /// \param[in] parent The parent directory containing this directory.212 /// \param[in] cluster The cluster at which the directory list starts.253 /// </summary> 254 /// <param name="name">The name of the current directory.</param> 255 /// <param name="parent">The parent directory containing this directory.</param> 256 /// <param name="cluster">The cluster at which the directory list starts.</param> 213 257 FatDirectoryBase(String^ name, FatDirectoryBase^ parent, unsigned cluster); 214 258 215 259 public: 260 /// <summary> 216 261 /// Compacts the directory structure, updating the structure on-disk as well. 262 /// </summary> 217 263 void ClearDeletedEntries(); 218 264 265 /// <summary> 219 266 /// The list of files and subfolders in this directory. 267 /// </summary> 220 268 property Collections::Generic::Dictionary<String^, FatDirectoryEntry^>^ Items 221 269 { … … 227 275 228 276 protected: 277 /// <summary> 229 278 /// Reads the directory structures from disk. 230 /// 231 /// \remarks This function must set the \see Directory instance as well as the 232 /// \see DirectorySize fields. Furthermore, call the \see ParseDirectory 233 /// function to initialise the directory entries on-disk. 279 /// </summary> 280 /// <remarks>This function must set the <see cref="Directory" /> instance 281 /// as well as the <see cref="DirectorySize" /> fields. Furthermore, call 282 /// the <see cref="ParseDirectory" /> function to initialise the directory 283 /// entries on-disk.</remarks> 234 284 virtual void ReadDirectory() = 0; 235 285 286 /// <summary> 236 287 /// Writes the directory to disk. 288 /// </summary> 237 289 virtual void WriteDirectory() = 0; 238 290 239 /// This function reads the raw directory structures in \see Directory and 240 /// sets the \see Entries field for easier access to the directory entries. 291 /// <summary> 292 /// This function reads the raw directory structures in <see cref="Directory" /> 293 /// and sets the <see cref="Entries" /> field for easier access to the directory 294 /// entries. 295 /// </summary> 241 296 void ParseDirectory(); 242 297 298 /// <summary> 243 299 /// Gets the start cluster from the given directory entry. 300 /// </summary> 244 301 virtual unsigned GetStartCluster(::FatDirectoryEntry& directory) = 0; 245 302 246 303 protected: 304 /// <summary> 247 305 /// A pointer to the directory structure. 306 /// </summary> 248 307 property ::FatDirectory Directory 249 308 { … … 252 311 } 253 312 313 /// <summary> 254 314 /// The number of entries in the directory 315 /// </summary> 255 316 property size_t DirectorySize 256 317 { … … 260 321 261 322 private: 323 /// <summary> 262 324 /// The list of parsed entries in the folder. 325 /// </summary> 263 326 Collections::Generic::Dictionary<String^, FatDirectoryEntry^>^ Entries; 264 327 … … 267 330 }; 268 331 332 /// <summary> 269 333 /// Represents a FAT directory file. 334 /// </summary> 270 335 public ref class FatDirectory abstract : FatDirectoryBase 271 336 { 272 337 protected: 338 /// <summary> 273 339 /// Constructor. 274 /// 275 /// \param[in] name The name of the current directory.276 /// \param[in] parent The parent directory containing this directory.277 /// \param[in] cluster The cluster at which the directory list starts.278 /// \param[in] api The FAT API object which is creating this object.340 /// </summary> 341 /// <param name="name">The name of the current directory.</param> 342 /// <param name="parent">The parent directory containing this directory.</param> 343 /// <param name="cluster">The cluster at which the directory list starts.</param> 344 /// <param name="api">The FAT API object which is creating this object.</param> 279 345 FatDirectory(String^ name, FatDirectoryBase^ parent, unsigned cluster, FatApi^ api); 280 346 … … 341 407 342 408 private: 409 /// <summary> 343 410 /// Retrieves the FAT value for the given cluster. 411 /// </summary> 344 412 unsigned GetFatValue(unsigned cluster); 345 413 }; -
trunk/eraser/Eraser.Util.Native/OpenHandle.h
r1812 r1997 31 31 namespace Eraser { 32 32 namespace Util { 33 /// <summary> 33 34 /// Represents one open handle in the system. 35 /// </summary> 34 36 public ref class OpenHandle 35 37 { 36 38 internal: 39 /// <summary> 37 40 /// Constructor. 38 /// 39 /// \param[in] handle The handle to wrap.40 /// \param[in] pid The Process ID of the handle.41 /// \param[in] path The path to the file.41 /// </summary> 42 /// <param name="handle">The handle to wrap.</param> 43 /// <param name="pid">The Process ID of the handle.</param> 44 /// <param name="path">The path to the file.</param> 42 45 OpenHandle(IntPtr handle, int pid, String^ path) 43 46 { … … 48 51 49 52 public: 53 /// <summary> 50 54 /// Retrieves all open handles on the system 55 /// </summary> 51 56 static property IList<OpenHandle^>^ Items 52 57 { … … 54 59 } 55 60 61 /// <summary> 56 62 /// Force the handle to close. 63 /// </summary> 57 64 bool Close(); 58 65 66 /// <summary> 59 67 /// The handle to the file, in the context of the owning process. 68 /// </summary> 60 69 property IntPtr Handle 61 70 { … … 66 75 } 67 76 77 /// <summary> 68 78 /// The path to the file. 79 /// </summary> 69 80 property String^ Path 70 81 { … … 75 86 } 76 87 88 /// <summary> 77 89 /// The process ID of the process owning the handle. 90 /// </summary> 78 91 property int ProcessId 79 92 { … … 85 98 86 99 private: 100 /// <summary> 87 101 /// Resolves a handle to a file name. 88 /// 89 /// \param[in] handle The file handle to resolve.90 /// \param[in] pid The process ID of the owning process.91 /// \return A string containing the path to the file, or null.102 /// </summary> 103 /// <param name="handle">The file handle to resolve.</param> 104 /// <param name="pid">The process ID of the owning process.</param> 105 /// <returns>A string containing the path to the file, or null.</returns> 92 106 static String^ ResolveHandlePath(IntPtr handle, int pid); 93 107
Note: See TracChangeset
for help on using the changeset viewer.
