msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can I force a read operation to actually read the media?

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI
Author Message
mike



Joined: 19 Jan 2008
Posts: 29

PostPosted: Thu Jan 24, 2008 8:04 am    Post subject: Can I force a read operation to actually read the media? Reply with quote

>> I'm trying to detect data corruption on a usb hard drive.
>> My test program writes then reads the disk, but never finds
>> any corruption. But if I unmount/unplug and replug the usb, the
>> corruption appears.
>>
>> It occurs that Windows 2k/xp may have cached the small files.
>> Since the changes didn't come thru the OS, the OS thinks the
>> data is good and just hands me what's in the cache from the previous
>> read.
>> I'm trying to do this with simple VB6 (legacy) code:
>>
>> Open filenamestring For Input As #1
>> inputstring = Input(14, #1)
>> Close #1
>>
>> to keep it simple.
>>
>> Is there a way to force the OS to flush the disk buffers/cache and give
>> me what's actually on the disk the next time I open the file?
>>
>> Or maybe force an unmount/remount the usb drive?
>>
>> Or do I need a more complicated file handler?
>>
>> Or maybe I'm barking up the wrong tree??? Better tree?
>>
>> I've googled for cache, flush, buffer and unbuffered and every
>> combination I can think of. Nothing useful found.

Thanks, mike
--
Return address is VALID!

Archived from group: microsoft>public>vb>winapi
Back to top
View user's profile Send private message
expvb



Joined: 04 Oct 2007
Posts: 525

PostPosted: Thu Jan 24, 2008 7:27 am    Post subject: Re: Can I force a read operation to actually read the media? Reply with quote

Check FILE_FLAG_NO_BUFFERING flag description in CreateFile(). I never tried
it though.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group