Jump to content

Recent Status Updates

  • Photo
      16 Apr

    If you're reading this, you're on my profile and I know you're on my profile because I'm probably viewing yours.

    Show comments (6)
  • Photo
      10 Apr

    Finally (and hopefully) i'm getting a team together that knows a little of this and a little of that; and maybe all my open source projects that are half written can begin to be released. :)

View All Updates
- - - - -

Making a Drive Full!

diskfree tfilestream

This topic has been archived. This means that you cannot reply to this topic.
13 replies to this topic

#13 WingedPanther


    A spammer's worst nightmare

  • Moderator
  • 16,633 posts

Posted 08 March 2013 - 10:57 AM

2^32-2 = 4,294,967,294 or about 4GB. Based on Luthfi's earlier answer, I believe we have found the issue.

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#14 Luthfi


    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1,318 posts

Posted 08 March 2013 - 08:39 PM


WingedPanther had summed it up for you. Both your free space sizes surpass the limitation of SetFilePointer (when missing lpDistanceToMoveHigh). Actually it seems that my earlier answer was based from wrong documentation. The online documentation (which url I gave you already) states that the limitation would be (2^31)-2. So, actually the limitation is 2GB-2B. Now we have the answer to what caused the failure in your code.


The solution? Make SetFilePointer to use proper lpDistanceToMoveHigh value. I don't recommend to alter TFileStream, so you better rewrite your code to directly use windows api instead of TFileStream.

Edited by LuthfiHakim, 08 March 2013 - 08:39 PM.