PDA

View Full Version : Mapped Drive problem (again)



Chris
06-24-2013, 10:25 AM
My application and MyComputer can see the mapped drive, but SB8 installer does not see the mapped drive. I have searched this Forum and I think the problem is a common issue, eg. as described:

>> IMO, you have the typical mapped drive UAC issue. See this:
>> http://www.lindersoft.com/forums/showthread.php?t=31410
>> Friedrich

OK, I see what the problem is. It does not happen on all machines, only some. It doesn't happen when I test on my network for example. This suggests a solution lies in the way the user Maps the drive originally.

Please can you suggest what might work. eg. How can the user map the drive so that SETUP.EXE can also see the mapped drive?

linder
06-24-2013, 10:37 AM
Chris,

This is how Windows works and is by Windows design ;) The "setup.exe" is running elevated and if the elevated running application can't see (or use) the mapped drive then the drive was mapped in a non-elevated context. An elevated running application (e.g. "setup.exe") can only see and use a mapped drive if the drive was also mapped in the elevated context.

BTW, Microsoft suggests the following workaround (but please note that MS does NOT support that workaround at all):

http://www.lindersoft.com/forums/showthread.php?p=67608#post67608

Or let the user map the drive in the elevated context!

Some more interesting readings:

http://www.lindersoft.com/forums/showthread.php?p=65380#post65380
http://www.lindersoft.com/forums/showthread.php?p=60495#post60495
http://www.lindersoft.com/forums/showthread.php?p=67603#post67603

Hope this helps a bit.

Friedrich

linder
06-24-2013, 10:42 AM
BTW, you can very easily reproduce it on your own UAC-aware machine (Vista+). When UAC is turned on, map the drive in a non-elevated (per-user) context. As a result, only this specific user can see the mapped drive -- any other user and elevated running apps can NOT see or use the mapped drive.

Friedrich

Chris
06-24-2013, 11:04 AM
Thank you for the superfast reply (about 5 minutes -- WOW :-)

I understand all the above, but please could you give an explanation in simple terms of "elevated"

And also, does SB8 ALWAYS install as an "elevated" context? Or is that determined by some setting/option either in SB or Windows?

And I need to talk end users through mapping the network share as an "elevated" user, and they know a lot less about PCs than me, so please REALLY make it simple :-) :-)

Chris
06-24-2013, 03:33 PM
It's just the word "elevated" I am not certain of:

Does "elevated" mean to run as administrator?? Is that all??


And does an SB8 install HAVE TO run as administrator?
Does SB8 ALWAYS run as administrator?

If user maps a drive while UAC is OFF, will an SB8 install "see" that mapped drive?

(Of course I can do experiments to investigate all the above, but that might take hours while maybe you can answer in seconds :-)

linder
06-25-2013, 12:54 AM
Chris,

"Elevated" means to gain all rights not enabled due to UAC. And elevated running application has access to all protected system resources.

By default, an installation always requests administrator execution level privileges to install your application "machine-wide", so all current and future users of the computer system can use your program. You can also do "per-user" installations (General Information -> UAC Execution Level -> asInvoker option), but then you do NOT have access to any protected Windows area (e.g. "Program Files" folder tree, the Windows folder tree, HKEY_LOCAL_MACHINE registry, you can't register .OCX or Fonts, etc.). 99% of all applications make use of the per-machine install method.

I assume that your own application is fully UAC-aware and mixed-mode compatible (runs elevated and non-elevated). By default, your application (asInvoker manifested) should run non-elevated. But it should also work fine when the user starts it elevated ("Run as administrator"). In this case, a completely different user profile will be accessed.

BTW, you do not have control over the UAC status (enabled or disabled). NEVER EVER suggest to turn UAC off. This will open a very large security hole and their lawyers might come looking for you <g>

So the only resolution is this:

http://technet.microsoft.com/en-us/library/ee844140(v=ws.10).aspx

Or provide an option from your own install to map a drive ("Map/Disconnect Network drive..." script function).

Friedrich

linder
06-25-2013, 12:59 AM
BTW, you can also programmatically handle the "resolution" descried in the above Microsoft link from your install (after you prompted the user "Would you like to do this Yes/No"), including a system reboot. However, it is NOT RECOMMENDED and VERY BAD PRACTICE -- but you can do it with SetupBuilder if you want <g>. Again, NOT RECOMMENDED AT ALL ;)

Friedrich

Chris
06-25-2013, 03:04 AM
Thank you so much for the excellent reply. Things are now much clearer.

linder
06-25-2013, 03:11 AM
You are welcome :)

Friedrich

Chris
06-25-2013, 04:52 AM
Would this work??

Get the user to map the shared folder twice:
eg. Log on as normal user and map as drive G.
And when elevated, map a drive H.

That way both the installer and the app should see the shared folder, (though they would see different drive letters -- which doesn't matter to me :-) ??


(I am only asking about MY users, who often have just 2 or 3 PCs, and only my software and maybe MS Office (and email/browser/etc). ie. a very simple small system)

linder
06-25-2013, 05:19 AM
Yes, absolutely no problem. Different users have different user settings, like printers, mapped network drives and so on. So if there are different accounts on one machine (JoeUser, BillyIdol, etc.) then they all have completely different user settings. If JoeUser has mapped a drive (non-elevated) then it's not visible in the BillyIdol account. But if a drive was mapped elevated then an elevated running application can "see" that drive mapping from all current and future accounts.

Your customers only have to launch, say, the command prompt elevated ("run as administrator") and then enter something like:

net use H: \\server\share /persistent:yes

This will then map the drive in an elevated context.

Friedrich

Chris
06-25-2013, 05:46 AM
Thank you so much Friedrich,

And.. (sorry): just to be certain:

When you say "No problem",
do you mean "Yes this will work, and will solve the problem" ?

linder
06-25-2013, 05:57 AM
Hi Chris,

sorry for the confusion. Yes, your users can map the drive non-elevated and elevated.

For example, on Windows 7, they click the Start button and in the "Search programs and files" field they enter 'command prompt'. Search will bring up the "Command Prompt" program. Your users right-click the Command Prompt item and select "Run as administrator".

The following will then create a mapped H: drive letter:

net use H: \\server\share /persistent:yes

As a result, non-elevated running applications can see and use all drives that have been mapped in a non-elevated context and elevated running apps (e.g. setup.exe or your own application started with administrator execution level privileges) can see and use the drives that have been mapped in an elevated context.

Friedrich

Chris
06-25-2013, 07:39 AM
Perfect. Thank you.

linder
06-25-2013, 07:43 AM
:)

Friedrich