EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Throw is not operated

Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.
#24982
Posted: 05/19/2013 23:28:31
by gwihwan Ji (Standard support level)
Joined: 08/24/2008
Posts: 36

Hi,

void CbFltOpenFileC(
object Sender,
string FileName,
ref ACCESS_MASK DesiredAccess,
ref UInt16 FileAttributes,
ref UInt16 ShareMode,
ref UInt32 Options,
ref UInt16 CreateDisposition,
ref bool ProcessRequest)
{
ProcessRequest = false;
throw new ECBFltError(0);
}

In a C#, I got an event from CbFltOpenFileC, but 'throw' is not opereated.
Anything I am wrong?

Best regards,
Joohyun
#24983
Posted: 05/20/2013 00:02:10
by Eugene Mayevski (EldoS Corp.)

What are you expecting to achieve? The exception can not be propagated to the process which has initiated the file operation. Instead it is handled by CallbackFilter API (in particular the function that called the callback handler) and is converted to the error code. The error code in your case is 0 (ERROR_SUCCESS).


Sincerely yours
Eugene Mayevski
#24985
Posted: 05/20/2013 03:42:58
by gwihwan Ji (Standard support level)
Joined: 08/24/2008
Posts: 36

I want to prevent create 0 byte sized file when the file didn't exist before the event.

I wanted to create new file at other location with the same context. so that after ProcessRequest = false; I use file creation.
But, 0 byte file is created at the origial destination location.

That is the reason I try to use
throw new ECBFltError(0);

Best regards,
Joohyun
#24986
Posted: 05/20/2013 04:48:06
by Vladimir Cherniga (EldoS Corp.)

throw new ECBFltError(0) did nothing, because it overlap ProcessRequest = false and return success from callback (0 == NO_ERROR). Setting ProcessRequest = false is the same as throwing ERROR_ACCESS_DENIED. There no ability to prevent file creation with error code set to zero. Did you consider a reparse callback and reparse rules as a solution for your task ?
#24989
Posted: 05/20/2013 08:08:12
by gwihwan Ji (Standard support level)
Joined: 08/24/2008
Posts: 36

Quote
Did you consider a reparse callback and reparse rules as a solution for your task ?

Yes. I consider reparse things. But I cannot use prepared reparse rule because I need to reparse files depending certain conditions like;
1. new files created should be reparsed at other location.
2. existing files updated should be reparsed at other location.
3. existing files only read are not be reparsed.
4. above condisions depends on folder or process.

Best regards,
Joohyun
#24990
Posted: 05/20/2013 08:18:41
by Vladimir Cherniga (EldoS Corp.)

Then you can't silently disable file creation, only reparse it to another location or throw an appropriate error code.
#24996
Posted: 05/20/2013 20:04:50
by gwihwan Ji (Standard support level)
Joined: 08/24/2008
Posts: 36

Quote
throw an appropriate error code.

How to throw error code is what I want.

When I code like
Code
{
ProcessRequest = false;
}

in CbFltOpenFileC, 3rd program faced 'access denied' as you explain.
How to avoid 'access denied'
Could you give me a sample code?

Best regards,
Joohyun
#24998
Posted: 05/21/2013 00:32:14
by Eugene Mayevski (EldoS Corp.)

You can throw ECbFltError with the error code you want (in CallbackFilter 2 native error codes are used, in CallbackFilter 3 you need to use Win32 error codes). Note that codes are converted to native OS format (in CallbackFilter 3) and then back to Win32 error codes, so if you choose some fancy and rare error code, it won't be converted properly. We can add new codes to conversion routine if needed.



You can not prevent the file from being opened and at the same time tell nothing to the initiator application. Access Denied is used by default.


Sincerely yours
Eugene Mayevski
#25001
Posted: 05/21/2013 01:34:35
by Vladimir Cherniga (EldoS Corp.)

To correct the previous post - ECbFltError except win32 error codes only as a source parameter. They are translated to native error codes internally by our code, but this conversion is limited by the range and can be extended if required native error code not present in conversion function. In CallbackFilter3 you have an ability to receive a callbacks for the requests completed with error status and that error code provided in native format. It may be converted by the helper function to win32 code.
#25002
Posted: 05/21/2013 02:00:15
by gwihwan Ji (Standard support level)
Joined: 08/24/2008
Posts: 36

I am sorry. I cannot understnad well about your explanation due to knowledge and English.

As a result, you mean, I cannot pretend that 'open is evented' so that 'access denied' is not messaged from OS.
My understanding is right?

Best regards,
Joohyun
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.

Reply

Statistics

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