EldoS | Feel safer!

Software components for data protection, secure storage and transfer

GetFileInfo and NotifyDirectoryChanged problem

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#13638
Posted: 06/10/2010 04:51:17
by Bastian Moldenhauer (Standard support level)
Joined: 06/04/2009
Posts: 40

hey,

i have a problem with these too methods.

First to the scenario. In order to quickly allow applications like notepad, word etc. to save the changes and/or close the file i develop some sort of background uploader. that first saves these changes and then uploads them to a temp file on the remote location. when this upload is finished i delete the original file on the remote location and rename the temp file to the original.(much like the office family is doing this)
in order to show the user that a file is still uploading, i developed a shell extension which requests a "status-file" for each file in a directory and depending on that shows an overlay icon.

this whole mechanism worked with cbfs 2.5 but it doesn't with cbfs 3.0.

the shell extension requests this status file via GetFileInfo(..). since this is cached or had been cached, i call the notifydirectorychanged after finishing upload and rename on both files, but i dont see any getfileinfo on those files involved.

the calls:

//the original file
string relPath = wdFileInfo.RelativeRemotePath;
//statusfile
string relGuidPath = relPath + SHELL_GUID_EXTENSION;

m_cbFs.NotifyDirectoryChange(relPath, callbackFS.CbFsNotifyFileAction.fanModified, true);

m_cbFs.NotifyDirectoryChange(relGuidPath, CallbackFS.CbFsNotifyFileAction.fanModified, true);

RefreshOverlayIcon(Drive.DriveLetter + ":" + relGuidPath);

i tried some different calls to the notify.. function but none did work. so i am asking for help here =)

any thoughts?

regards
#13640
Posted: 06/10/2010 09:16:23
by Volodymyr Zinin (EldoS Corp.)

Hello Bastian,

What is it - GetFileInfo?
And what a process calls the code you specified? Is it a process that supports the CallbackFS callbacks or a part of the shell extension?
#13758
Posted: 06/26/2010 21:24:22
by Gavin McKay (Standard support level)
Joined: 09/01/2009
Posts: 48

Hi Bastian,

If I understand correctly, you want to return the save result to your client application (notepad/word) as quickly as possible? i.e. notepad/word don't have to wait until the remote location file is updated?

It sounds like your remote uploader is already doing the right thing:

1. Using normal "Write" methods in callbackfs, write to your internal memory/file so that notepad/word thinks its work is done
2. Start a background process to perform your temp file save/rename on the remote site

This way word/notepad doesn't have to wait.

In this circumstance you *do not* need to call NotifyDirectoryChange. You only require NotifyDirectoryChange if your remote filesystem changes the file without the client requesting it i.e. the client didn't click "Save", but the remote system made a change to the file for some reason.

I believe you are not getting a GetFileInfo because the file has not actually changed. It is identical to the copy that notepad/word saved. Even though the remote server is making changes to the files, this is all transparent to the user.

(I've found this the hardest part to understand in CallbackFS, so I'll try and explain a bit better - please ignore if you already get it!)

NotifyDirectoryChange is used to inform Windows Explorer that someone else *on a differect pc/server* changed the file. For example, if Bob, located in Ireland, creates a file and saves it via CallbackFS, it is stored in the remote filesystem as a 1024 byte file. You don't need to use NotifyDirectoryChange for this, because Bob's Windows Explorer already knows the size of the file.

If Susan, located in Sweden, updates this same file to 2048 bytes, then Bob needs to know the file has changed. In this case, you would use NotifyDirectoryChange to inform Bob (not Susan!) that the size of the file has changed. Susan made the change, so her Windows Explorer already knows the correct size of the file.

Is this what you were after?
#13768
Posted: 06/28/2010 10:03:29
by Bastian Moldenhauer (Standard support level)
Joined: 06/04/2009
Posts: 40

Hey,

thanks for your replies.

To keep it short. I fixed this issue and again the devil lies in the details. I found out that my background api changed a bit in the behavior and returned to me a slightly different filename than I expected it to be. After i fixed that it was "easy" to get the job done.

@Gavin: Thanks for your ideas. I guess i implemented it the way you described it. But working with office is really tough, since it works on 2 files with a sequence of create, write, delete, rename calls.
I understood what NoftiyDirectoryChange is needed for and since the upload is happening in the background i used it to inform my shellextension that the file is completely uploaded to the remote site.

So thanks again :-)

Reply

Statistics

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