www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/03/10:44:57

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Tue, 3 Nov 2009 16:44:30 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Accessing GLOBALROOT paths - a potential compromise???
Message-ID: <20091103154430.GO7831@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <19183 DOT 53891 DOT 243601 DOT 62109 AT consult DOT pretender>
MIME-Version: 1.0
In-Reply-To: <19183.53891.243601.62109@consult.pretender>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Nov  3 01:49, Jeffrey J. Kosowsky wrote:
> I know that there have been multiple threads about the pros/cons of
> being able to access XP/Vista style \\?\GLOBALROOT paths.
> 
> However, not being able to access them limits one's abilities to use
> things like shadow copies since they create shadow devices that are only
> accessible by such a path. For example
> 		   \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1

In Cygwin 1.7 you can do this for any subdir in your volume shadow copy:

  $ ls -l //?/GLOBALROOT/Device/HarddiskVolumeShadowCopy1/subdir

It just doesn't work for the root directory of a drive due to internal
path handling restrictions.  But there's a simple workaround.  Use your
own tool as below.
  
> The only hack that I have found to get around this is to use an *old*,
> *unsupported* Microsoft routine called 'dosdev' which allows you to
> assign drive letters to devices, including using the GLOBALROOT
> format.

Try this:

  $ cat > DefDosDevice.c << EOF
  #include <stdio.h>
  #include <windows.h>

  int
  main (int argc, char **argv)
  {
    DWORD flags = 0;

    if (argc < 2)
      {
	fprintf (stderr, "usage: %s DosDevice [NTDevice]\n", argv[0]);
	return 1;
      }
    if (argc == 2)
      flags = DDD_REMOVE_DEFINITION;
    else
      flags = DDD_RAW_TARGET_PATH;
    if (!DefineDosDevice (flags, argv[1], argc == 2 ? NULL : argv[2]))
      {
	fprintf (stderr, "Error %d\n", GetLastError ());
	return 1;
      }
    return 0;
  }
  EOF
  $ gcc DefDosDevice.c -o DefDosDevice
  $ ./DefDosDevice X: '\??\GLOBALROOT\Device\HarddiskVolumeShadowCopy1
  $ cd /mnt/x
  $ ls
  [...]
  $ cd /mnt/c
  $ ./DefDosDevice X:   # this deletes drive X: again

Drive X: is not visible in Explorer, but you can access it from CMD and
any Cygwin process just fine.  To make it visible in Explorer, assign
another drive letter using subst:

  $ cmd /c subst W: X:\\

Afterwards you can access drive X: as drive W: from Explorer which,
for some reason, thinks it's accessing a "RAM Disk" on Windows 7.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019