Windows Vista Forums
Vista Forums Home Join Vista Forums Tech Publications Windows 7 Forum Vista Tutorials Webcasts Tags

Welcome to Vista Forums we are your forum for Windows Vista help and discussion. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Vista Newsgroups > Vista security

Odd UAC elevation issue with mapped drives

Update your Vista Drivers
Reply
 
Thread Tools Display Modes
Old 07-17-2007   #1 (permalink)
Andy Bates
Guest


 

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




My System SpecsSystem Spec
Old 07-18-2007   #2 (permalink)
Jimmy Brush
Guest


 

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
My System SpecsSystem Spec
Reply
Update your Vista Drivers

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
get mapped drives Niro PowerShell 0 02-13-2008 01:15 PM
cached credentials for mapped drives and elevation Pete Delgado Vista networking & sharing 6 08-03-2007 11:45 AM
cached credentials for mapped drives and elevation Pete Delgado Vista account administration 6 08-03-2007 11:45 AM
cached credentials for mapped drives and elevation Pete Delgado Vista security 6 08-03-2007 11:45 AM
Mapped drives have Red X? Michael Cecil Vista networking & sharing 2 01-13-2007 10:44 AM


Complimentary Industry Resources

Vista Forums has joined forces with TradePub.com to offer you a new, exciting, and entirely free professional resource. Visit http://vistax64.tradepub.com today to browse our selection of complimentary Industry magazines, white papers, webinars, podcasts, and more across 34 industry sectors. No credit cards, coupons, or promo codes required. Try it today!




Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

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