Another IoCreateFile(...) Question

Howdy!

I am running into problems with the IoCreateFile(…) function. In order
to create a target file object for a rename op, I need to call
IoCreateFile(…) with the IO_OPEN_TARGET_DIRECTORY. Assuming I have a
file f:\blob.txt and I want to move it and rename it to f:\bar\foo.txt,
here is what I have code-wise:

//--------------------------------------------------------------------------
WCHAR newName = L"\??\f:\bar\foo.txt";

RtlZeroMemory( &ObjectAttributes, sizeof(OBJECT_ATTRIBUTES) );
RtlZeroMemory( &ioStatusBlock, sizeof(IO_STATUS_BLOCK) );

RtlInitUnicodeString(&newNameUni, newName);

InitializeObjectAttributes( &ObjectAttributes, &newNameUni,
OBJ_CASE_INSENSITIVE, NULL, NULL );

ntStatus = IoCreateFile( &targetDirHandle,
GENERIC_READ,
&ObjectAttributes,
&ioStatusBlock,
0,
FILE_ATTRIBUTE_NORMAL,
0,
FILE_OPEN,
FILE_DIRECTORY_FILE,
NULL,
0,
CreateFileTypeNone,
NULL,
IO_OPEN_TARGET_DIRECTORY );

//--------------------------------------------------------------------------

Do I want to call IoCreateFile with the full path of the target file or
with the target file’s destination directory (I assume the former). When I
execute this I am getting errors. I believe this is due to a
misunderstanding (on my part) of the necessary parameters needed to support
the IO_OPEN_TARGET_DIRECTORY call. I’m not seeing this info in the DDK or
IFS kit.

any advice?

thanks! - jb


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