CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2000
    Posts
    18

    drive powered down??

    I'm not sure if mine is a windows question or a C++/MFC question, but it is making me crazy. I am trying to solve a problem where a drive spins down "at a bad time". It occurs during a game, where a 3-second delay is a real problem. I tried writing a little program to determine how reading cached data affects when a drive powers down. Right now, I cannot seem to get the drive to power up when I expect it to. I have a hard drive with a 32MB cache. I first create a 1mb reference file and 1024 more files of the same size. All 1025 files have 1MB strings of random characters and the strings of characters are different from each other, My intention is to fill the files with data that cannot easily be compressed. I then read each of the 1024 files 3 times, leaving the first file untouched. My intention is to make sure that whatever cache there is does not contain anything related to my first file. BTW, after writing each file, I delete the CFile object. The program then loops through a process, where it tests the power state of the drive every second until it spins down. I then read the original file, thinking that the drive will need to power up to retrieve the data. The drive does read the data into the buffer (1024 reads of 1024 characters), but the drive is still powered down. If I try to do anything else, like delete the files, I can hear the drive power up. I have no idea where the data came from. Any ideas?

    Thank you.

  2. #2
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: drive powered down??

    are you sure it's powering down ? or are you seeing drive temperature calibration ?

  3. #3
    Join Date
    Aug 2000
    Posts
    18

    Re: drive powered down??

    I call this function GetDevicePowerState(hFile, &PowerState).

    I think I am sure. PowerState is set to TRUE when it is powered up and FALSE when it is powered down. After I hear it spin up, PowerState changes from FALSE to True. After sitting with no disk activity, PowerState changes from TRUE to FALSE. I was able to get around the issue by initially creating the reference file without buffering. (FILE_FLAG_NO_BUFFERING)
    Last edited by richk; October 27th, 2015 at 11:29 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured