EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Copying vs. creating a file

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.
#5635
Posted: 03/26/2008 15:00:32
by Volodymyr Zinin (EldoS Corp.)

Quote
Sid Schipper wrote:
... My subroutine that emulates opening files is fairly sophisticated and like the Windows CreateFile routine, it also has flags like CREATE_NEW, OPEN_EXISTING, GENERIC_READ, etc. (although in my API the flags have different names). I need to make decisions about which of these flags to set when the user does whatever it is he does.

In the Open callback you must open an existing file or return an error.
In the Create callback you must create a file if it doesn't exist or return an error (usually ERROR_ALREADY_EXISTS).

Quote
Sid Schipper wrote:
I noticed in your mapper sample, that you make certain decisions about what flags to use on the CreateFile call, but the decisions you make seem to be fixed and not dependent upon what the user is doing. I want to make sure that I emulate exactly what the user is trying to do. So, for example, if he is trying to open a file for Read Only access, I want to make sure I call my open emulation subroutine with the Read Only flag.

You don't have to open files in Open callback. You can open them only when it's necessary - i.e. in Read/Write callbacks. And close them either at the end of Read/Write callbacks or in Close callback (in the latter case a file will have been opened already when a next Read/Write is called and you don't have to open it again).
Also you can open a file with read-only access and reopened it in read-write access only if it's really necessary.



#5636
Posted: 03/27/2008 09:32:29
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

OK, I think I know what I need to do now. Thank you for all your help.

Reply

Statistics

Topic viewed 10898 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!