|
-
Jan 10th, 2013, 08:47 PM
#1
Thread Starter
Frenzied Member
SetFilePointer doesn't work with ReadFile for physical drive reading
Nevermind I figured out what to change.
Last edited by Ben321; Jan 10th, 2013 at 08:54 PM.
-
Jan 11th, 2013, 02:06 AM
#2
Thread Starter
Frenzied Member
Re: SetFilePointer doesn't work with ReadFile for physical drive reading
And now I have a new problem. I can read from ANYWHERE on my removable drive (USB thumb flash drive). But I can only WRITE to the first sector Trying to write ANYWHERE ELSE causes the API function to fail, and thus the write does not occur.
Please tell me why.
-
Jan 11th, 2013, 03:27 AM
#3
Re: SetFilePointer doesn't work with ReadFile for physical drive reading
If you're using the WriteFile function, then the following applies:
If you write directly to a volume that has a mounted file system, you must first obtain exclusive access to the volume. Otherwise, you risk causing data corruption or system instability, because your application's writes may conflict with other changes coming from the file system and leave the contents of the volume in an inconsistent state. To prevent these problems, the following changes have been made in Windows Vista and later:
- A write on a volume handle will succeed if the volume does not have a mounted file system, or if one of the following conditions is true:
- The sectors to be written to are boot sectors.
- The sectors to be written to reside outside of file system space.
- You have explicitly locked or dismounted the volume by using FSCTL_LOCK_VOLUME or FSCTL_DISMOUNT_VOLUME.
- The volume has no actual file system. (In other words, it has a RAW file system mounted.)
- A write on a disk handle will succeed if one of the following conditions is true:
- The sectors to be written to do not fall within a volume's extents.
- The sectors to be written to fall within a mounted volume, but you have explicitly locked or dismounted the volume by using FSCTL_LOCK_VOLUME or FSCTL_DISMOUNT_VOLUME.
- The sectors to be written to fall within a volume that has no mounted file system other than RAW.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|