Mail Archives: cygwin/2011/12/09/15:36:33
--98e8jtXdkpgskNou
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi guys,
I have a well-known problem. I just don't have all filesystems
available for testing. What I need are testers for a certain, very
simple functionality on any filesystem you can get hold of.
I tested it locally on NTFS and FAT, as well as CDFS, as well as on 3.x
Samba and via NFS. I tested from W2K, W2K3 and W7. I would be very
interested to learn if this functionality is supported by other
filesystems as well.
Testing is simple. Attached you'll find the source code of a very
simple testcase which calls certain native NT functions. For ease of
use, the application allows to enter a Cygwin POSIX path and converts
that to native NT notation by itself.
You have access to AFS, MVFS, NWFS, NcFsd, Netapp, UDF, UNIXFS, SUNWNFS,
any CIFS or old Samba versions? Please test! Also, if you try it on
local or remote NTFS or FAT filesystems and it fails, I'd like to see
the results.
For testing, run the application twice per filesystem, one time for a
directory, one time for a file. Also, please report your OS version per
the output of `uname -s'. It's possible that different OSes show
different results.
So, here's how you do it. Build it like this:
$ gcc -o test-qfif test-qfif.c -lntdll
Then test for existing local dir and file:
$ uname -s
CYGWIN_NT-x.x
$ /usr/lib/csih/getVolInfo //server/share
Device Type : 7
Characteristics : 20
[...etc...]
$ ./test-qfif /cygdrive/d/dir /cygdrive/d/dir/file
NtQueryFullAttributesFile(\??\D:\dir) by name works
NtQueryFullAttributesFile(\??\D:\dir) by handle works
NtQueryFullAttributesFile(\??\D:\dir\file) by name works
NtQueryFullAttributesFile(\??\D:\dir\file) by handle works
Or for a share (with example for a failure):
$ uname -s
CYGWIN_NT-x.x
$ /usr/lib/csih/getVolInfo //server/share
[...]
$ ./test-qfif //server/share //server/share/file
NtQueryFullAttributesFile(\??\D:\dir) by name works
NtQueryFullAttributesFile(\??\D:\dir) by handle fails, status code 0xc000000d
NtQueryFullAttributesFile(\??\D:\dir\file) by name works
NtQueryFullAttributesFile(\??\D:\dir\file) by handle works
Thanks for your help,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--98e8jtXdkpgskNou
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="test-qfif.c"
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include <errno.h>
#include <locale.h>
#include <windows.h>
#include <ddk/ntifs.h>
#include <sys/cygwin.h>
int
main (int argc, char **argv)
{
WCHAR pathbuf[1024]; /* Should be big enough for this test */
WCHAR *path;
UNICODE_STRING upath;
OBJECT_ATTRIBUTES attr, attr2;
NTSTATUS status;
HANDLE h;
IO_STATUS_BLOCK io;
FILE_NETWORK_OPEN_INFORMATION fnoi;
if (argc < 2)
{
fprintf (stderr, "Usage: %s path\n", argv[0]);
return 1;
}
setlocale (LC_ALL, "");
while (--argc > 0)
{
if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, *++argv, pathbuf + 6,
1024 * sizeof (WCHAR)))
{
fprintf (stderr, "%s: Path conversion failed: %s\n",
strerror (errno));
continue;
}
if (pathbuf[6] == L'\\' && pathbuf[7] == L'\\')
path = wcsncpy (pathbuf, L"\\??\\UNC", 7);
else
path = wcsncpy (pathbuf + 2, L"\\??\\", 4);
RtlInitUnicodeString (&upath, path);
InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE,
NULL, NULL);
status = NtQueryFullAttributesFile (&attr, &fnoi);
if (!NT_SUCCESS (status))
printf ("NtQueryFullAttributesFile(%ls) by name failed,\n"
"status code 0x%08lx\n", path, status);
else
printf ("NtQueryFullAttributesFile(%ls) by name works\n", path);
status = NtOpenFile (&h, READ_CONTROL | FILE_READ_ATTRIBUTES, &attr, &io,
FILE_SHARE_VALID_FLAGS, 0);
if (!NT_SUCCESS (status))
{
fprintf (stderr, "NtOpenFile(%ls) failed, status code 0x%08lx\n",
path, status);
continue;
}
RtlInitUnicodeString (&upath, L"");
InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE, h, NULL);
status = NtQueryFullAttributesFile (&attr, &fnoi);
if (!NT_SUCCESS (status))
printf ("NtQueryFullAttributesFile(%ls) by handle failed,\n"
"status code 0x%08lx\n", path, status);
else
printf ("NtQueryFullAttributesFile(%ls) by handle works\n", path);
NtClose (h);
}
return 0;
}
--98e8jtXdkpgskNou
Content-Type: text/plain; charset=us-ascii
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
--98e8jtXdkpgskNou--
- Raw text -