Hello,
I don't think my problem is related to the ReplaceIfExisting flag.
In the example I gave it is always set to 0. Windows is asking for a
merge so I guess this makes sense.
I also can't use windows api function since my files aren't on the
file system, I have to implement the move on my own.
My problem is that after asking for user confirmation (after I checked
that the target already exists and returned the appropriate error
code, which is what the windows function MoveFile() would have done if
I had used it), the operating system does not call back the Dokan Move
file function, so I can't actually do the move. (and actually, even if
it did, I would probably end up looping since I would check again if
the target already exists...)
So I'm confused about how the move file operation should be
implemented in case of a merge.
On Nov 12, 9:46 am, Smurf IV <
smurf...@gmail.com> wrote:
> UInt32 dwFlags = (uint)(replaceIfExisting ? 1 : 0);
> // If the file is to be moved to a different volume, the
> function simulates the move by using the
> // CopyFile and DeleteFile functions.
> dwFlags += 2; // MOVEFILE_COPY_ALLOWED
>
> // The function does not return until the file is actually
> moved on the disk.
> // Setting this value guarantees that a move performed as a
> copy and delete operation
> // is flushed to disk before the function returns. The flush
> occurs at the end of the copy operation.
> dwFlags += 8; // MOVEFILE_WRITE_THROUGH
>
> if (!MoveFileEx(pathSource, pathTarget, dwFlags))
> Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
>
> This is what I use in C# to move / rename a directory, but it would probably
> be the same in C++ / Win32
> Read the following
>
> //
http://msdn.microsoft.com/en-us/library/aa365240%28VS.85%29.aspx
>
> On Thu, Nov 11, 2010 at 6:37 PM, Sylvain Friquet
> <
sylvain.friq...@gmail.com>wrote:
>
> > Hello,
>
> > I'm using Dokan to build a remote file system and I'm having issues
> > with my MoveFile implementation.
>
> > I obviously can't use the windows MoveFile() and MoveFileEx()
> > functions as seen in the mirror example, since my files are on a
> > remote server.
>
> > The problem I'm having occurs when I try to rename a folder to a name
> > that already exists.
> > When I do so, MoveFile gets called, I return -183
> > (ERROR_ALREADY_EXISTS), and windows then asks me if I want to merge
> > the folders.
> > If I click no, nothing happens as expected, but if I click yes,
> > windows delete the folder I was renaming and MoveFile isn't called
> > again ...
> > Hence the folder I was trying to rename is lost and nothing is merged.
>
> > I'm wondering what my implementation of MoveFile should be in that
> > case?
>
> > Thank you in advance,
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Dokan" group.
> > To post to this group, send email to
do...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
dokan+un...@googlegroups.com <
dokan%2Bunsu...@googlegroups.com>.