PDA

View Full Version : Get mapped drive letter path to installer



NewsArchive
06-11-2007, 08:18 AM
Hi Friedrich,

I have a reqirement to find the path to the installer that's run over a
network and if it's a mapped drive letter report that path. The "Get System
Information", "Get Installer Path Name" SetupBuilder function always returns
the UNC path. So, I used the "Call DLL" function to call the Windows API
GetFullPathNameA. That works great for everything but Vista which returns
the UNC path.

I think that this is happening becuase the installer is running as
administrator and the drive letter is mapped in the user's account. Is
there any way to map a drive letter to All Users? Any other suggestions are
welcome too?

I can send a small SB 6 script for testing if you'd like.

Thanks,
Larry Sand

NewsArchive
06-11-2007, 08:19 AM
Some more information. If I start a command prompt with Run as
Administrator and map the drive letter, and then run the installer over the
network as the user with the same drive letter, the user account returns the
UNC. However, if run the installer from the command prompt run as
administrator it reports the mapped drive letter.

Thanks,
Larry Sand

NewsArchive
06-11-2007, 08:19 AM
Hi Larry,

The MapDrive function uses the "WNetAddConnection2" Windows API. I think
the problem is caused by the fact that WNet functions create and delete
network drive letters in the MS-DOS device namespace associated with a logon
session.

If there is a solution available (I don't know of any solution) then it's
not easy.

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6.5
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
06-11-2007, 08:19 AM
Hi Friedrich,

I had a sneaking suspicion that you were going to say that!
If I find a solution, I'll let you know.

Thanks for your help,
Larry Sand

NewsArchive
06-11-2007, 08:20 AM
Hi Larry,

That would be great, thank you!

Friedrich

NewsArchive
06-12-2007, 04:20 AM
It gets worse...LOL...
Try this:
Log on as an administrator.
Open one command prompt elevated, one regular command prompt.
In the elevated prompt, net use x: \\somemachine\someshare

Switch to the other prompt. It shows x: as "unavailable".
In the other (non-elevated) prompt, do net use y: \\somemachine\someshare
(mapping to the same share). Now you can access that from the non-elevated
prompt.

Switch back to the elevated prompt. Type net use.
It will show x: (that you mapped from the elevated prompt) and that's
usable.
It will show y: as "unavailable".

Argh!

Jane Fleming

NewsArchive
06-12-2007, 04:20 AM
Vista application development/deployment is most definitely getting more and
more complicated... <g>

Friedrich

NewsArchive
06-12-2007, 04:21 AM
Friedrich

I found that if I run asInvoker the mapped drive letter is returned. So I'm
trying to pass the information on the command line from a script with
asInvoker privledges, to an installer with requireAdministrator privledges.
Under Vista I receive ERROR_ELEVATION_REQUIRED (740). I don't see the
elevation dialog. Is there a way to execute the elevated installer from
another program?

Thanks,
Larry Sand

NewsArchive
06-12-2007, 04:21 AM
To invoke a requireAdministrator app from an asInvoker app, you'll need to
use ShellExecute() in the invoking app.

Jane

NewsArchive
06-12-2007, 04:21 AM
Thanks Jane,

That works, and so does the kludge.

Larry Sand

NewsArchive
06-12-2007, 04:21 AM
Argh... is right! I noticed that too.

Larry Sand