FILE_RENAME_INFORMATION

Hi all:

I have tried to filter a file rename operation under W2K3,
I did move \PC\SHAREFOLDER\FILE_A \PC\SHAREFOLDER\FILE_B
FS treat it as a simple rename,that’s ok, but the problem is that
when FILE_B is already exist there,I think “ReplaceIfExists” should be
has effect on files,when I type “Yes” or “All”,I should catch
Parameters.SetFile.ReplaceIfExists = TRUE or
ReplaceIfExists = TRUE in struct FILE_RENAME_INFORMATION
but now I got both the above values FALSE, why ??

Any information is helpful.

Regards.

No suggestions ?

“S.o.l.o” wrote in message news:…
> Hi all:
>
> I have tried to filter a file rename operation under W2K3,
> I did move \PC\SHAREFOLDER\FILE_A \PC\SHAREFOLDER\FILE_B
> FS treat it as a simple rename,that’s ok, but the problem is that
> when FILE_B is already exist there,I think “ReplaceIfExists” should be
> has effect on files,when I type “Yes” or “All”,I should catch
> Parameters.SetFile.ReplaceIfExists = TRUE or
> ReplaceIfExists = TRUE in struct FILE_RENAME_INFORMATION
> but now I got both the above values FALSE, why ??
>
> Any information is helpful.
>
> Regards.

Perhaps the CMD shell (move command) deletes the target before performing
the rename instead of using “ReplaceIfExists”.

A quick trace with Filemon or Filespy should confirm this.

/ted

-----Original Message-----
From: S.o.l.o [mailto:xxxxx@hotmail.com]
Sent: Monday, June 06, 2005 5:32 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] FILE_RENAME_INFORMATION

No suggestions ?

“S.o.l.o” wrote in message news:…
> Hi all:
>
> I have tried to filter a file rename operation under W2K3,
> I did move \PC\SHAREFOLDER\FILE_A \PC\SHAREFOLDER\FILE_B
> FS treat it as a simple rename,that’s ok, but the problem is that
> when FILE_B is already exist there,I think “ReplaceIfExists” should be
> has effect on files,when I type “Yes” or “All”,I should catch
> Parameters.SetFile.ReplaceIfExists = TRUE or
> ReplaceIfExists = TRUE in struct FILE_RENAME_INFORMATION
> but now I got both the above values FALSE, why ??
>
> Any information is helpful.
>
> Regards.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@livevault.com To unsubscribe
send a blank email to xxxxx@lists.osr.com

Well, once again we get an interesting tidbit of the interface that is
seldom used. Simplest solution: write a win32 program that does a
rename for you. Or better yet, how about downloading filetest (from
osronline) and adding this as an option to the “Move File” operation;
then the community will benefit the next time someone asks this
question.

Read up on the MoveFileEx - specify the MOVEFILE_REPLACE_IF_EXISTING
flag.

Alternative if you don’t like writing code: install Services for UNIX
and use your favorite NFS file server to perform a rename operation.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ted Hess
Sent: Tuesday, June 07, 2005 2:44 PM
To: ntfsd redirect
Subject: RE: [ntfsd] FILE_RENAME_INFORMATION

Perhaps the CMD shell (move command) deletes the target before
performing
the rename instead of using “ReplaceIfExists”.

A quick trace with Filemon or Filespy should confirm this.

/ted

-----Original Message-----
From: S.o.l.o [mailto:xxxxx@hotmail.com]
Sent: Monday, June 06, 2005 5:32 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] FILE_RENAME_INFORMATION

No suggestions ?

“S.o.l.o” wrote in message news:…
> Hi all:
>
> I have tried to filter a file rename operation under W2K3,
> I did move \PC\SHAREFOLDER\FILE_A \PC\SHAREFOLDER\FILE_B
> FS treat it as a simple rename,that’s ok, but the problem is that
> when FILE_B is already exist there,I think “ReplaceIfExists” should be
> has effect on files,when I type “Yes” or “All”,I should catch
> Parameters.SetFile.ReplaceIfExists = TRUE or
> ReplaceIfExists = TRUE in struct FILE_RENAME_INFORMATION
> but now I got both the above values FALSE, why ??
>
> Any information is helpful.
>
> Regards.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@livevault.com To
unsubscribe
send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

> Or better yet, how about downloading filetest (from

osronline) and adding this as an option to the “Move File”
operation; when the community will benefit the next time

Or the best yet - *I* will add this to the filetest and
send it to PeterGV to upload it to the OSR download site :slight_smile:

L.

Given that CIFS is involved this might be a case where the SMB rdr is
modifying the rename operation. CIFS has three flavors of rename:
SMB_COM_RENAME, SMB_COM_NT_RENAME and as the (undocumented)
SMB_FILE_RENAME_INFO level in
SMB_COM_TRANSACTION2:TRANS2_SET_FILE_INFORMATION. The first two are purely
path based and do not have ReplaceIfExists option; only the TRANS2 version
appears to support handle based renames and the full ZwSetFileInformation
semantics.

A quick look at Filespy output for a move operation on a client indicates
that ReplaceIfExists is set to 1. However the corresponding network trace
shows that the client first deletes the file and then issues SMB_COM_RENAME.
SMB_COM_RENAME appears never to set ReplaceIfExists to 1 on the server. This
would explain the pattern that was observed.

Why rdr would prefer to use delete followed by a legacy rename over the
TRANS2 version is a mystery, especially since doing so would also appear to
violate the atomicity of the operation (what if the delete succeeds and the
subsequent rename fails?). Maybe someone from Microsoft can shed some light
on this and as to whether or not rdr can be encouraged to use the newer
TRANS2 style renames.

-Shirish

-----Original Message-----
From: Tony Mason [mailto:xxxxx@osr.com]
Sent: Tuesday, June 07, 2005 4:19 PM
Subject: RE: FILE_RENAME_INFORMATION

Well, once again we get an interesting tidbit of the interface that is
seldom used. Simplest solution: write a win32 program that does a
rename for you. Or better yet, how about downloading filetest (from
osronline) and adding this as an option to the “Move File” operation;
then the community will benefit the next time someone asks this
question.

Read up on the MoveFileEx - specify the MOVEFILE_REPLACE_IF_EXISTING
flag.

Alternative if you don’t like writing code: install Services for UNIX
and use your favorite NFS file server to perform a rename operation.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ted Hess
Sent: Tuesday, June 07, 2005 2:44 PM
To: ntfsd redirect
Subject: RE: [ntfsd] FILE_RENAME_INFORMATION

Perhaps the CMD shell (move command) deletes the target before
performing
the rename instead of using “ReplaceIfExists”.

A quick trace with Filemon or Filespy should confirm this.

/ted

-----Original Message-----
From: S.o.l.o [mailto:xxxxx@hotmail.com]
Sent: Monday, June 06, 2005 5:32 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] FILE_RENAME_INFORMATION

No suggestions ?

“S.o.l.o” wrote in message news:…
> Hi all:
>
> I have tried to filter a file rename operation under W2K3,
> I did move \PC\SHAREFOLDER\FILE_A \PC\SHAREFOLDER\FILE_B
> FS treat it as a simple rename,that’s ok, but the problem is that
> when FILE_B is already exist there,I think “ReplaceIfExists” should be
> has effect on files,when I type “Yes” or “All”,I should catch
> Parameters.SetFile.ReplaceIfExists = TRUE or
> ReplaceIfExists = TRUE in struct FILE_RENAME_INFORMATION
> but now I got both the above values FALSE, why ??
>
> Any information is helpful.
>
> Regards.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@livevault.com To
unsubscribe
send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

One more thing,
The first issue for this move operation I have found was that
W2K3 treat it as Simple Rename,but W2K told me as Fully
Qualified Rename.
I suppose these 2 problem are relational.

“S.o.l.o” wrote in message news:xxxxx@ntfsd…
> No suggestions ?
>
> “S.o.l.o” wrote in message news:…
> > Hi all:
> >
> > I have tried to filter a file rename operation under W2K3,
> > I did move \PC\SHAREFOLDER\FILE_A \PC\SHAREFOLDER\FILE_B
> > FS treat it as a simple rename,that’s ok, but the problem is that
> > when FILE_B is already exist there,I think “ReplaceIfExists” should be
> > has effect on files,when I type “Yes” or “All”,I should catch
> > Parameters.SetFile.ReplaceIfExists = TRUE or
> > ReplaceIfExists = TRUE in struct FILE_RENAME_INFORMATION
> > but now I got both the above values FALSE, why ??
> >
> > Any information is helpful.
> >
> > Regards.
>