EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Question for ReparseCallback

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#22724
Posted: 12/05/2012 07:15:37
by Mia Pak (Priority Standard support level)
Joined: 11/19/2012
Posts: 16

Hello

I have two questions about reparsecallback.

I'm developing to support the encryption file that have the specified extension for a specific folder.
(File extension will be changed by type of encryption)

So I used reparsecallback, but It's some problem during the test.

When I tried to open file not applied reparse rule, Application occurred that the file can not be found error.
So, I used "OpenFile" function defined at CCallbackFilter Class in reparsecallback to check file existing or not.
But It made my application unstable.

Is there another way to check file existing or not?
and Is there a way to check whether created path is a directory or not?


Thank you.
#22727
Posted: 12/05/2012 08:26:26
by Vladimir Cherniga (EldoS Corp.)

Quote
The second question, Is there a way to check in reparsecallback that creating path is a directory or not?

It doesn't possible anyway because reparse and create file callbacks are performed in pre-create file system path. Use OpenFile api with caution as it is intended to use with the same file that is current callback processed. Use CreateNonCbFile to obtain file handle that will not triggers any unwanted callbacks. If your target path in reparse callback doesn't filtered with a CallbackFilter rules then you may use any other win32 api to check file attributes.
#22745
Posted: 12/06/2012 08:37:20
by Mia Pak (Priority Standard support level)
Joined: 11/19/2012
Posts: 16

I used “Createfile” in “ReparseFileName” to check the existence of the file that I need to confirm.
Am I going right direction?

And what you meant from your reply was that there is no way that I can distinguish between directory and files and then change the name using “ReparseFileName callback”?
If that is the case, what should I do to change only file name?
#22746
Posted: 12/06/2012 08:51:12
by Vladimir Cherniga (EldoS Corp.)

Quote
And what you meant from your reply was that there is no way that I can distinguish between directory and files and then change the name using “ReparseFileName callback”?

I meant that it cannot be done in reparse or create/open callback without requesting the underlying file system (GetFileAttributes, etc.)
Quote
I used “Createfile” in “ReparseFileName” to check the existence of the file that I need to confirm.
Am I going right direction?

As i said before you may doing in this way, if only your target file name not in CallbackFilter rules list. Otherwise you may be locked with recursive callbacks, triggered by you CreateFile() win32 api call. In this case use CallbackFilter::CreateNonCbFile() library function.
#22852
Posted: 12/18/2012 00:09:08
by Mia Pak (Priority Standard support level)
Joined: 11/19/2012
Posts: 16

Hello.

I use Reparsecallback to modify file's extension when filtered file is created.
so I registered to AddReparseFileNameRule like below.

AddReparseFileNameRule(L"*.*", L"*.*);

I modifed NewFileName parameter in ReparseCallback and It works good.
But I want to rename only file's extension not folder.

How can I pass the folder in Reparsecallback when folder is created.

I checked file's attributes in OnOpenFile/OnCreateFile when folder is created before Reparsecallback called. but I can't check FILE_ATTRIBUTE_DIRECTORY
attribute.
#22853
Posted: 12/18/2012 02:48:16
by Vladimir Cherniga (EldoS Corp.)

Hello,
if your target directory not exists, you may trust the CreateOptions flag in OnOpenFile/OnCreateFile that is must contain a bit equal to FILE_DIRECTORY_FILE = 0x00000001. Otherwise you must check file attributes manually, requesting file attributes.
#22857
Posted: 12/18/2012 05:37:16
by Mia Pak (Priority Standard support level)
Joined: 11/19/2012
Posts: 16

When directory is created, OnCreateFile/OnOpenFile Callback does not return FILE_DIRECTORY_FILE flag.

CbFltOpenFileFileC - FileName(d:\test\new folder), FileAttributes(0x0), CreateOptions(0x40200000), CreateDisposition(0x1)
CbFltOpenFileFileC - FileName(d:\test\new folder), FileAttributes(0x0), CreateOptions(0x40200000), CreateDisposition(0x1)
CbFltOpenFileFileC - FileName(d:\test\new folder), FileAttributes(0x0), CreateOptions(0x40200000), CreateDisposition(0x1)
CbFltOpenFileFileC - FileName(d:\test\new folder), FileAttributes(0x0), CreateOptions(0x40200000), CreateDisposition(0x1)
CbFltCreateFileC - FileName(d:\test\new folder), FileAttributes(0x80), CreateOptions(0x0), CreateDisposition(0x2)
#22861
Posted: 12/18/2012 06:25:55
by Vladimir Cherniga (EldoS Corp.)

Unfortunately this flag is lost during CreateOptions parameter translation from NT format to the Win32 flags, because FILE_DIRECTORY_FILE = 0x00000001 doesn't have equivalent in user mode api flags. We will add this parameter as is in the next build of Callback Filter.
#22870
Posted: 12/18/2012 08:35:21
by Mia Pak (Priority Standard support level)
Joined: 11/19/2012
Posts: 16

Thank you for your answer.
Can you tell us the schedule of the next version?
#22871
Posted: 12/18/2012 08:40:37
by Vladimir Cherniga (EldoS Corp.)

It is going to be a CallbackFilter version 3 with a virtual file supports. And it will be available this month.
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

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