Real Geek Forums  

Go Back   Real Geek Forums > Archives > Operating Systems > Windows Vista > Windows Vista Security

Notices

Reply

Odd UAC elevation issue with mapped drives

 

LinkBack Thread Tools Display Modes
Old 07-17-2007, 09:51 PM   #1 (permalink)
Default Odd UAC elevation issue with mapped drives

Have been struggling with this issue for a little while now and wondered if
anyone could shed any light on the issues I'm seeing. It should be stressed
that this is a relatively clean Vista install and UAC is operational.

I have a Native C++ VS 2005 MFC application I've developed. This works
perfectly on Windows XP and previous versions but I'm seeing some odd issues
when it's run under Vista (32 and 64-bit).

An application is installed to a mapped network drive (call it Z. There
is a folder on Z: lets call it FOLDER with sub-folders under it. The
installed application runs as the invoker and operates without issue
accessing files in the folder and sub-folders under it correctly.

Another application (same development environment) runs from Z:\FOLDER and
copies files to local hard drives. Now this is where things get interesting.

The application needs to copy files from Z:\FOLDER and the sub-folders to
the local C:\ drive.

The application requests escalated rights and starts correctly. When it
tries to copy files from the sub-folders of the mapped drive it fails to
find any files to copy. Explicitly calling ::CopyFile using the mapped drive
letter (i.e. Z fails.

However if CopyFile is called using a UNC rather than a drive letter it
works correctly. Calling WNetGetConnection on Z: returns a failure (haven't
checked result but assume drive not mapped). So the issue doesn't appear to
be a rights issue.

Looking at the result from ::GetModuleFilename for the executable in this
instance it returns the UNC of the mapped network drive and not the mapped
drive letter (i.e. Z.

Now when it attempts to copy files from Z:\FOLDER (where it was invoked) it
works correctly and the files are found and copied.

Why are files in Z:\FOLDER found but files in the sub-folder not found? I'm
assuming that Z:\FOLDER is treated as an alias and gets mapped to the UNC
but that Z:\FOLDER\SUBFOLDER doesn't...

The solution appears to amend the manifest to specify that the application
should execute as the requester but I'm intrigued to know why I was seeing
the issues that I saw and how they can be resolved without executing as the
requester. Calling ::GetModuleFilename with the manifest amended in this way
returns a Z:\ based filepath and not the UNC path for the executable!

TIA

- Andy



Andy Bates
Guest
 
Posts: n/a
Reply With Quote  
Old 07-18-2007, 04:15 AM   #2 (permalink)
Default Re: Odd UAC elevation issue with mapped drives

Hello,

Drive mappings are not shared between different logons. Because of the
internal implementation of UAC, elevated programs are considered to be
in a different "logon" than non-elevated programs, even though they are
operating on the same desktop in the same user profile.

This blog explains it pretty good:
http://blogs.msdn.com/cjacks/archive...ows-vista.aspx

It sounds like UAC is doing some sort of application compatibility
kajiggering to make running an elevated program on a mapped drive work,
possibly a shim to translate the program's folder into a UNC path, but
it's not translating the path you need.

You'll need some mechanism of getting at the UNC path and using it
instead, or re-mapping the mapped drive inside of an elevated program.

- JB
Jimmy Brush
Guest
 
Posts: n/a
Reply With Quote  
Reply

Tags
None

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
cached credentials for mapped drives and elevation Pete Delgado Windows Vista Networking & Sharing 6 08-03-2007 03:45 PM
cached credentials for mapped drives and elevation Pete Delgado Windows Vista Administration 6 08-03-2007 03:45 PM
Mapped Drives Michael O Windows Vista Networking & Sharing 0 12-23-2006 12:25 PM
Mapped drives Frost Windows XP Network & Web 6 10-23-2003 03:08 PM
Mapped Drives Jeffrey Randow (MVP) Windows XP Work Remotely 0 07-02-2003 01:09 AM


All times are GMT. The time now is 11:11 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright © 2005 - 2007 RealGeek.com. All rights reserved.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90