I observed that DTM created a lot of directory or file names with special
characters in < > : " / \ | ? *. How can a user mode program create files
whose names include special chars? We need to create a test program to test
a FS filter.
Thanks,
Shangwu
There’s probably a user mode program out there (maybe even part of some MSFT kit?) that will do this for you, but you can do this
yourself by using the native API (ntdll), but it’s all undocumented.
Good luck,
mm
Shangwu wrote:
I observed that DTM created a lot of directory or file names with
special characters in < > : " / \ | ? *. How can a user mode program
create files whose names include special chars? We need to create a test
program to test a FS filter.
Thanks,
Shangwu
Hey Martin
I’ve tried this in the past, using ZwCreateFile, but typically ended up with
STATUS_OBJECT_NAME_INVALID - is there a magic trick?
Cheers,
Lyndon
HANDLE CreateRelative(HANDLE relative, LPWSTR name)
{
HANDLE handle;
NTSTATUS status;
IO_STATUS_BLOCK iosb;
UNICODE_STRING unicode;
OBJECT_ATTRIBUTES attributes;
unicode.MaximumLength = unicode.Length = 0;
unicode.Buffer = NULL;
if (name)
{
unicode.MaximumLength = unicode.Length = wcslen(name) * sizeof(WCHAR);
unicode.Buffer = name;
}
InitializeObjectAttributes(&attributes, &unicode, OBJ_CASE_INSENSITIVE,
relative, NULL);
status = ZwCreateFile(&handle,
SYNCHRONIZE | FILE_WRITE_DATA,
&attributes,
&iosb,
0,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_WRITE,
FILE_CREATE,
FILE_SYNCHRONOUS_IO_NONALERT,
NULL,
0);
“Martin O’Brien” wrote in message
news:xxxxx@ntfsd…
> There’s probably a user mode program out there (maybe even part of some
> MSFT kit?) that will do this for you, but you can do this yourself by
> using the native API (ntdll), but it’s all undocumented.
>
>
> Good luck,
>
> mm
>
> Shangwu wrote:
>> I observed that DTM created a lot of directory or file names with special
>> characters in < > : " / \ | ? *. How can a user mode program create files
>> whose names include special chars? We need to create a test program to
>> test a FS filter.
>>
>> Thanks,
>>
>> Shangwu
>>
>
Those special characters are allowed by POSIX. Have you tried the posix
semantics option?
Tony
OSR
Tony, thanks, that’s the trick ![:slight_smile: :slight_smile:](/images/emoji/twitter/slight_smile.png?v=12)
“Tony Mason” wrote in message news:xxxxx@ntfsd…
Those special characters are allowed by POSIX. Have you tried the posix
semantics option?
Tony
OSR