This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Request for running a test application


Hi,

I have a request for help.  I need as much different information I can
get.  To get this information, I'm asking all of you to run the attached
test application and return the printed output as reply to this mail.

Just please don't send information which is already available.

The test application is a rewritten version of the GetVolInfo source
code which I have already send once or twice.  A bit of information has
been added and that's what I'm especially interested in.

To build the application call:

  gcc -o getvolinfo getvolinfo.c -lntdll

To run the application, simply call it with a POSIX or DOS path to any
existing file on a filesystem, which you have permissions to access.
The simplest method is to access the drives directly.  For instance, if
you have a drive c and a drive d, just call

  ./getvolinfo C:
  ./getvolinfo D:

Please run it on all file system combinations you can lay your hands on.
So far, I have information about:

  - Local FAT, FAT32, NTFS
  - Local CD, DVD
  - Remote NTFS
  - Remote Samba 3.x
  - USB Stick with FAT, NTFS

I'm looking for

  - Harddisk, CD, DVD over USB
  - Remote FAT, FAT32
  - Remote CD, DVD
  - Remote NFS over SFU NFS
  - Local(?) and remote HPFS
  - Disk changer systems
  - Any other file system not mentioned above.


Thanks in advance,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat
#include <stdio.h>
#include <string.h>
#include <sys/cygwin.h>
#define _WIN32_WINNT 0x0600
#include <windows.h>
#include <ddk/ntifs.h>

#ifndef FILE_READ_ONLY_VOLUME
#define FILE_READ_ONLY_VOLUME 0x80000
#endif
#ifndef FILE_SEQUENTIAL_WRITE_ONCE
#define FILE_SEQUENTIAL_WRITE_ONCE 0x100000
#endif
#ifndef FILE_SUPPORTS_TRANSACTIONS
#define FILE_SUPPORTS_TRANSACTIONS 0x200000
#endif

BOOL NTAPI RtlCreateUnicodeStringFromAsciiz (PUNICODE_STRING, PCSTR);

int __stdcall
sys_wcstombs (char *tgt, int tlen, const WCHAR *src, int slen)
{
  int ret;
    
  ret = WideCharToMultiByte (GetOEMCP (), 0, src, slen, tgt, tlen, NULL, NULL);
  if (ret)
    tgt[ret < tlen ? ret : tlen - 1] = '\0';
  return ret;
}   

int
main (int argc, char **argv)
{
  char winpath[256];
  DWORD flags = 0;
  HANDLE h;
  UNICODE_STRING wpath;
  UNICODE_STRING upath;
  OBJECT_ATTRIBUTES attr;
  IO_STATUS_BLOCK io;
  NTSTATUS stat;
  ULONG ret;

  if (argc < 2)
    {
      fprintf (stderr, "usage: %s path\n", argv[0]);
      return 1;
    }
  cygwin_conv_to_full_win32_path (argv[1], winpath);
  if (!RtlCreateUnicodeStringFromAsciiz (&wpath, winpath))
    {
      fprintf (stderr, "RtlCreateUnicodeStringFromAsciiz failed\n");
      return 1;
    }
  if (!RtlDosPathNameToNtPathName_U (wpath.Buffer, &upath, NULL, NULL))
    {
      fprintf (stderr, "RtlDosPathNameToNtPathName_U failed\n");
      RtlFreeUnicodeString (&wpath);
      return 1;
    }
  InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE, NULL, NULL);
  stat = ZwOpenFile (&h, 0, &attr, &io, FILE_SHARE_VALID_FLAGS,
		     FILE_OPEN_FOR_BACKUP_INTENT);
  if (NT_SUCCESS (stat))
    {
      char buf[1024];
      char name[256];

      stat = ZwQueryVolumeInformationFile (h, &io, buf, 1024,
						    FileFsDeviceInformation);
      if (NT_SUCCESS (stat))
        {
	  PFILE_FS_DEVICE_INFORMATION pfi =
	  	(PFILE_FS_DEVICE_INFORMATION) buf;
	  printf ("Device Type        : %lx\n", pfi->DeviceType);
	  printf ("Characteristics    : %lx\n", pfi->Characteristics);
	}
      stat = ZwQueryVolumeInformationFile (h, &io, buf, 1024,
						    FileFsVolumeInformation);
      if (NT_SUCCESS (stat))
        {
	  PFILE_FS_VOLUME_INFORMATION pfi =
	  	(PFILE_FS_VOLUME_INFORMATION) buf;
	  if (pfi->VolumeLabelLength)
	    {
	      sys_wcstombs (name, 256, pfi->VolumeLabel,
			    pfi->VolumeLabelLength / sizeof (WCHAR));
	      printf ("Volume Name        : <%s>\n", name);
	    }
	  else
	    printf ("Volume Name        : <>\n");
	  printf ("Serial Number      : %lu\n", pfi->VolumeSerialNumber);
	}
      stat = ZwQueryVolumeInformationFile (h, &io, buf, 1024,
					   FileFsAttributeInformation);
      if (NT_SUCCESS (stat))
        {
	  PFILE_FS_ATTRIBUTE_INFORMATION pfi =
	  	(PFILE_FS_ATTRIBUTE_INFORMATION) buf;
	  printf ("Max Filenamelength : %lu\n",pfi->MaximumComponentNameLength);
	  sys_wcstombs (name, 256, pfi->FileSystemName,
	  		pfi->FileSystemNameLength / sizeof (WCHAR));
	  printf ("Filesystemname     : <%s>\n", name);
	  printf ("Flags              : %lx\n",
		  flags = pfi->FileSystemAttributes);

	  printf ("  FILE_CASE_SENSITIVE_SEARCH  : %s\n",
		  (flags & FILE_CASE_SENSITIVE_SEARCH) ? "TRUE" : "FALSE");
	  printf ("  FILE_CASE_PRESERVED_NAMES   : %s\n",
		  (flags & FILE_CASE_PRESERVED_NAMES) ? "TRUE" : "FALSE");
	  printf ("  FILE_UNICODE_ON_DISK        : %s\n",
		  (flags & FILE_UNICODE_ON_DISK) ? "TRUE" : "FALSE");
	  printf ("  FILE_PERSISTENT_ACLS        : %s\n",
		  (flags & FILE_PERSISTENT_ACLS) ? "TRUE" : "FALSE");
	  printf ("  FILE_FILE_COMPRESSION       : %s\n",
		  (flags & FILE_FILE_COMPRESSION) ? "TRUE" : "FALSE");
	  printf ("  FILE_VOLUME_QUOTAS          : %s\n",
		  (flags & FILE_VOLUME_QUOTAS) ? "TRUE" : "FALSE");
	  printf ("  FILE_SUPPORTS_SPARSE_FILES  : %s\n",
		  (flags & FILE_SUPPORTS_SPARSE_FILES) ? "TRUE" : "FALSE");
	  printf ("  FILE_SUPPORTS_REPARSE_POINTS: %s\n",
		  (flags & FILE_SUPPORTS_REPARSE_POINTS) ? "TRUE" : "FALSE");
	  printf ("  FILE_SUPPORTS_REMOTE_STORAGE: %s\n",
		  (flags & FILE_SUPPORTS_REMOTE_STORAGE) ? "TRUE" : "FALSE");
	  printf ("  FILE_VOLUME_IS_COMPRESSED   : %s\n",
		  (flags & FILE_VOLUME_IS_COMPRESSED) ? "TRUE" : "FALSE");
	  printf ("  FILE_SUPPORTS_OBJECT_IDS    : %s\n",
		  (flags & FILE_SUPPORTS_OBJECT_IDS) ? "TRUE" : "FALSE");
	  printf ("  FILE_SUPPORTS_ENCRYPTION    : %s\n",
		  (flags & FILE_SUPPORTS_ENCRYPTION) ? "TRUE" : "FALSE");
	  printf ("  FILE_NAMED_STREAMS          : %s\n",
		  (flags & FILE_NAMED_STREAMS) ? "TRUE" : "FALSE");
	  printf ("  FILE_READ_ONLY_VOLUME       : %s\n",
		  (flags & FILE_READ_ONLY_VOLUME) ? "TRUE" : "FALSE");
	  printf ("  FILE_SEQUENTIAL_WRITE_ONCE  : %s\n",
		  (flags & FILE_SEQUENTIAL_WRITE_ONCE) ? "TRUE" : "FALSE");
	  printf ("  FILE_SUPPORTS_TRANSACTIONS  : %s\n",
		  (flags & FILE_SUPPORTS_TRANSACTIONS) ? "TRUE" : "FALSE");
	}
      ZwClose (h);
    }
  RtlFreeUnicodeString (&upath);
  RtlFreeUnicodeString (&wpath);
  return 0;
}

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]