Ahh Lyndon, sarcasm :), been there, done that simple program, thank you.
I said any way to reproduce it in a way like cut and paste operation in
explorer, or any other application that will do it.
I want to reproduce it in a very natural way, not “force it” with my own
simple program.
As far as documentation goes
("RootDirectory
If the file is not being moved to a different directory, or if the FileName
member contains the full pathname, this member is NULL"), it should come
natural each time a rename (that means a move to another dir) of a file, is
outside of the file’s parent directory, but that does not happen.
I know, I know, this is no necessary when the FileName member offers’s the
fully qualified name, but this is something I am trying to avoid right now.
Thank you for the reply, and for posting code.
With respect,
Bercea Gabriel.
GaMiTech Software Development
Mobile contact: (+40)0740049634
eMail: xxxxx@gmail.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Lyndon J Clarke
Sent: Monday, December 01, 2008 11:24 PM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] How to force relative renames
Fair enough, sometimes my expectations …, ah well let’s not go into that,
eh? Anyhow, below, bit of scrap code I wrote an age ago, warts an’ all, link
against ntdll.lib … ymmv
--------------------- %< -------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <ntddk.h>
typedef UCHAR BYTE;
typedef BYTE BOOL;
#define K (1024)
#define M ((K)*(K))
#define BUFFERSIZE (M)
static BYTE buffer[BUFFERSIZE];
typedef struct _FILE_RENAME_INFORMATION {
BOOLEAN ReplaceIfExists;
HANDLE RootDirectory;
ULONG FileNameLength;
WCHAR FileName[1];
} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
BOOL RenameRelative(HANDLE handle, HANDLE relative, LPWSTR target)
{
NTSTATUS status;
IO_STATUS_BLOCK iosb;
FILE_RENAME_INFORMATION *info = (FILE_RENAME_INFORMATION *)buffer;
info->ReplaceIfExists = TRUE;
info->RootDirectory = relative;
info->FileNameLength = 0;
info->FileName[0] = L’\0’;
if (target)
{
info->FileNameLength = wcslen(target) * sizeof(WCHAR);
memcpy(info->FileName, target, info->FileNameLength);
}
status = ZwSetInformationFile(handle, &iosb, buffer, BUFFERSIZE,
FileRenameInformation);
if (! NT_SUCCESS(status))
{
fwprintf(stderr, L"ZwSetInformationFile fails 0X%08X\n", status);
return FALSE;
}
return TRUE;
}
--------------------- %< -------------------------------------
“Bercea Gabriel” wrote in message news:xxxxx@ntfsd…
> Maybe I am missing the obvious, but I work with filetest, and I don’t
> recall
> seeing any rename tasks there. The Move file task will also result in a
> fully qualified rename.
>
>
> Cu respect,
> Bercea Gabriel.
>
> GaMiTech Software Development
> Mobile contact: (+40)0740049634
> eMail: xxxxx@gmail.com
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Lyndon J Clarke
> Sent: Monday, December 01, 2008 7:18 PM
> To: Windows File Systems Devs Interest List
> Subject: Re:[ntfsd] How to force relative renames
>
> Sure, write some code against nt native api, that works! I expect
> ladislav’s
>
> filetest http://www.osronline.com/article.cfm?article=360 will do this for
> you.
>
> wrote in message news:xxxxx@ntfsd…
>>I am trying to test my FS filter, in rename operations, but all I get is
>>the fully qualified renames.
>> I want to be able to test it in relative renames, but it seems that
>> however I rename a file, copy it, move it, I only get fully the fully
>> qualified rename.
>> Is there a way to force a rename operation other than filly qualified,
>> preferably relative rename.
>>
>> Thank you.
>>
>>
>
>
>
> —
> NTFSD is sponsored by OSR
>
> For our schedule debugging and file system seminars
> (including our new fs mini-filter seminar) visit:
> http://www.osr.com/seminars
>
> You are currently subscribed to ntfsd as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
—
NTFSD is sponsored by OSR
For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars
You are currently subscribed to ntfsd as: xxxxx@gmail.com
To unsubscribe send a blank email to xxxxx@lists.osr.com</ntddk.h></stdlib.h></stdio.h>