Rename Problem

In IRP_MJ_CLOSE complete routine, I call ZwCreateFile to open the file to be renamed, and call
ZwSetInformationFile to rename the file.
the second call is failure. the return satus is STATUS_INVALID_HANDLE. i can/t find the reason. I list the source below.
any help will be appreciate

InitializeObjectAttributes(&ObjectAttributes,
&FileName, //the name is a full path name
OBJ_CASE_INSENSITIVE,
NULL, NULL);
status = ZwCreateFile(
&hFile,
DELETE |GENERIC_READ | GENERIC_WRITE ,
&ObjectAttributes,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
0,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE,
NULL,
0 );

//the target name is a full path name
RenameInfo.FileName[0] = RenameBuffer;
RenameInfo.FileNameLength = FileNameLength;
RenameInfo.ReplaceIfExists = TRUE;
RenameInfo.RootDirectory = NULL;
status = ZwSetInformationFile(
&hFile,
&IoStatusBlock,
&RenameInfo,
sizeof(RenameInfo),
FileRenameInformation);
i also try to open the target directory and ues the return handle to set the RenameInfo.RootDirectory. but the call to ZwSetInformationFile is still failure. return satus is the same.
(???r??z{e?˛???m?m?{_?֬???&j)@u?Ӣ?칻?&ޱ??i?Z?G?j)m?W???~?l??-E?"?Ǧm??(Z?X???,??&

Make sure FileNameLength does not include leading zeros. I had a problem
with that once.

Alexey Logachyov
xxxxx@vba.com.by
VirusBlokAda ltd.
http://www.vba.com.by

----- Original Message -----
From: “madforyou”
To: “File Systems Developers”
Sent: Thursday, November 29, 2001 1:43 AM
Subject: [ntfsd] Rename Problem

> In IRP_MJ_CLOSE complete routine, I call ZwCreateFile to open the file
to be renamed, and call
> ZwSetInformationFile to rename the file.
> the second call is failure. the return satus is STATUS_INVALID_HANDLE. i
can/t find the reason. I list the source below.
> any help will be appreciate
>
> InitializeObjectAttributes(&ObjectAttributes,
> &FileName, //the name is a full path name
> OBJ_CASE_INSENSITIVE,
> NULL, NULL);
> status = ZwCreateFile(
> &hFile,
> DELETE |GENERIC_READ | GENERIC_WRITE ,
> &ObjectAttributes,
> &IoStatusBlock,
> NULL,
> FILE_ATTRIBUTE_NORMAL,
> 0,
> FILE_OPEN,
> FILE_NON_DIRECTORY_FILE,
> NULL,
> 0 );
>
> //the target name is a full path name
> RenameInfo.FileName[0] = RenameBuffer;
> RenameInfo.FileNameLength = FileNameLength;
> RenameInfo.ReplaceIfExists = TRUE;
> RenameInfo.RootDirectory = NULL;
> status = ZwSetInformationFile(
> &hFile,
> &IoStatusBlock,
> &RenameInfo,
> sizeof(RenameInfo),
> FileRenameInformation);
> i also try to open the target directory and ues the return handle to set
the RenameInfo.RootDirectory. but the call to ZwSetInformationFile is still
failure. return satus is the same.
>
??آ??y˫???-+.n?+???~?Z??m~??m?ܢo??:.z?>???m???>.??zf?-?%y???{_???
X???貿?


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Check your first parameter to ZwSetInformationFile(). You -really are- passing an invalid handle. ZwSetInformationFile() accepts a HANDLE, not a PHANDLE.

Brad

-----Original Message-----
From: Alexey Logachyov [mailto:xxxxx@vba.com.by]
Sent: Thursday, November 29, 2001 1:12 AM
To: File Systems Developers
Subject: [ntfsd] Re: Rename Problem

Make sure FileNameLength does not include leading zeros. I
had a problem
with that once.

Alexey Logachyov
xxxxx@vba.com.by
VirusBlokAda ltd.
http://www.vba.com.by

----- Original Message -----
From: “madforyou”
> To: “File Systems Developers”
> Sent: Thursday, November 29, 2001 1:43 AM
> Subject: [ntfsd] Rename Problem
>
>
> > In IRP_MJ_CLOSE complete routine, I call ZwCreateFile to
> open the file
> to be renamed, and call
> > ZwSetInformationFile to rename the file.
> > the second call is failure. the return satus is
> STATUS_INVALID_HANDLE. i
> can/t find the reason. I list the source below.
> > any help will be appreciate
> >
> > InitializeObjectAttributes(&ObjectAttributes,
> > &FileName, //the name is a full path name
> > OBJ_CASE_INSENSITIVE,
> > NULL, NULL);
> > status = ZwCreateFile(
> > &hFile,
> > DELETE |GENERIC_READ | GENERIC_WRITE ,
> > &ObjectAttributes,
> > &IoStatusBlock,
> > NULL,
> > FILE_ATTRIBUTE_NORMAL,
> > 0,
> > FILE_OPEN,
> > FILE_NON_DIRECTORY_FILE,
> > NULL,
> > 0 );
> >
> > //the target name is a full path name
> > RenameInfo.FileName[0] = RenameBuffer;
> > RenameInfo.FileNameLength = FileNameLength;
> > RenameInfo.ReplaceIfExists = TRUE;
> > RenameInfo.RootDirectory = NULL;
> > status = ZwSetInformationFile(
> > &hFile,
> > &IoStatusBlock,
> > &RenameInfo,
> > sizeof(RenameInfo),
> > FileRenameInformation);
> > i also try to open the target directory and ues the return
> handle to set
> the RenameInfo.RootDirectory. but the call to
> ZwSetInformationFile is still
> failure. return satus is the same.


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com