EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SetEndOfFile with 1.2.21 framework

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
Posted: 02/27/2008 08:40:06
by Franck Bonin (Standard support level)
Joined: 09/21/2007
Posts: 27

I'm currently testing CbFS driver V

And I am experiencing a new very bad behaviour :

When I'am calling SetEndOfFile(hFile, nPos) on any empty file from my storage, my OnSetEndOfFile callback is immediatly followed by a subsequant call to OnWrite() callback with nPos NULL Bytes to write.

Subsequent OnWrite callback with NULL "padding" bytes didn't occur using previous driver v 1.0.11 and new beahvior is very annoying for us.

Franck Bonin
Posted: 02/27/2008 15:09:49
by Volodymyr Zinin (EldoS Corp.)


Please specify what Windows version (including whether it's 32 or 64-bit) and what CallbackFS API (.NET 1.1, .NET 2.0, VCL, C++) are you using?

Franck Bonin wrote:
When I'am calling SetEndOfFile(hFile, nPos) ...

Could you give us a code chunk which contains this call? Unfortunately we can't reproduce the error.

Posted: 03/03/2008 02:48:11
by Franck Bonin (Standard support level)
Joined: 09/21/2007
Posts: 27

I'm using CbFS C++ API under Windows XP SP2 32bit

Here is the sample code that produce unwanted blank OnWrite call that follow expected OnSetEndOfFile call :

We suppose opened file is empty.

unsigned __int64 ui64FileSize(10); // whatever
CHAR szFilePath[]; // Wherever
DWORD dwFileAttributes(0); // whatever

HANDLE FileHandleContext = (PVOID)CreateFile(

if (INVALID_HANDLE_VALUE != FileHandleContext)
   LONG OffsetHigh = (LONG)((ui64FileSize >> 32) & 0xFFFFFFFF);
   if (INVALID_SET_FILE_POINTER == ::SetFilePointer(FileHandleContext, (LONG)(ui64FileSize & 0xFFFFFFFF), &OffsetHigh, FILE_BEGIN))
      dwError = GetLastError();

   if(ERROR_SUCCESS == dwError)


OnSetEndOfFile and OnWrite callbacks are called during '::CloseHandle()' Call.
Posted: 03/03/2008 15:31:06
by Volodymyr Zinin (EldoS Corp.)

We have corrected the code. In the next build these subsequent OnWrite callbacks won't be called for zeroing an allocated file space.
Posted: 03/04/2008 07:05:50
by Franck Bonin (Standard support level)
Joined: 09/21/2007
Posts: 27

Many thanks to you

Franck Bonin
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.



Topic viewed 3947 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!