Article View: borland.public.cppbuilder.nativeapi
Article #11049Re: FindFirstFile, FindNext Problem
From: Martin C
Date: Mon, 01 Mar 2004 06:54
Date: Mon, 01 Mar 2004 06:54
62 lines
3401 bytes
3401 bytes
Hi Remy Thank you so much for your reply, please find my answers below. "Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message news:4042e5f3@newsgroups.borland.com... > > > Why are you calling FindFirstFile() again? You already have all of the > relavant file information available for the given file before you call > SecureDeleteFiles() (btw, why is the function name plural if you are only > deleting a single file?). > This was a dummy mistake from me, when I used my old code, I didn't have the (wfd.nFileSizeHigh, wfd.nFileSizeLow) and I forgot to change my code after I added the code you posted. Concerning the function name, this is a typo mistake. > > SecureDelete1(FileName.c_str(), FindFileData.nFileSizeHigh, > > FindFileData.nFileSizeLow); > > Where is FileName declared and where does it get its value from? Again, you > are showing bits of pieces of incomplete code that suggest you are not > copy/pasting your actual code as-is directly from your project. If you are, > in fact, copy/pasting your code directly, then you have a bug in your code > in that you are not using the function's FileInformation parameter when > calling SecureDelete1(). Remy it is not that I am not showing all of my code, but I am showing all the code I use for the secure erasing, there is no reason to hide it. and as I said above it was a mistake and I fixed it. > > BTW, shouldn't that if() statement be the other way around? Naming a > variable 'SecureDeleteOn' suggests that you want secure deleting when the > value is 'true', but you did not actually code it that way. > > > SetFilePointer( hFile, FileLengthLo, (PLONG)&FileLengthHi, FILE_BEGIN); > > If all you are trying to do is seek to the end of the file, you could use > FILE_END instead: > > SetFilePointer( hFile, -1, NULL, FILE_END ); > > > CloseHandle( hFile ); > > Try calling FlushFileBuffers() before closing the file handle. > Ok, first of all all of my code is inside a Thread, and (SecureDeleteOn) is a property of this thread, where I set its value based on reading a registry value at the execution of the thread (under thread Execute). I will try using FlushFileBuffer and all the comments you have mentioned above and I will let you know the results. Once again thank you so much for your help and support. BR
Technical Details
Message-ID:
<404340e2@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4042b3bc@newsgroups.borland.com> <4042b964$1@newsgroups.borland.com> <4042c611@newsgroups.borland.com> <4042e5f3@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,cd3253abe6cdd94c X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-03-01 06:10:12 PST From: "Martin C" <martinc@aol.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4042b3bc@newsgroups.borland.com> <4042b964$1@newsgroups.borland.com> <4042c611@newsgroups.borland.com> <4042e5f3@newsgroups.borland.com> Subject: Re: FindFirstFile, FindNext Problem Date: Mon, 1 Mar 2004 08:54:21 +0200 Lines: 64 Organization: V Safe X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 62.135.27.47 Message-ID: <404340e2@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1078149346 62.135.27.47 (1 Mar 2004 05:55:46 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail