Is "Does File/Folder Exist" working with mapped folders?

Got a problem you cannot solve? Try here.
alibaba
Posts: 314
Joined: Fri Jun 26, 2009 8:46 am
Location: Thuringia, Germany

Is "Does File/Folder Exist" working with mapped folders?

Postby alibaba » Fri Aug 21, 2015 6:20 am

Hi Francesco,

the setup sometimes has problems with the function "Does File/Folder Exist" if the file to be checked is on a network path (mapped drive).
On some systems it is working and on others not - although the file is always there.

Do you have an idea?

How could I solve it?

Thank you!

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Is "Does File/Folder Exist" working with mapped folders?

Postby FrancescoT » Fri Aug 21, 2015 8:04 am

Dear Alibaba,

the problem you are reporting I suppose is directly related to UAC restrictions and if you use Windows Vista or higher OS and need to access the network drive from an application that runs elevated (as administrator).

Unlike Windows Explorer that always runs as a standard user, in most of cases a setup package has to run as administrator, otherwise the UAC security will not allow the package installation.

That said and because the mapped drive is created under the user context, a package that runs in elevated mode will be not able to access to the mapped resource correctly and this due the fact that the UAC restrictions active with the system, do not permit such kind of access.

You may try to use the following workaround.

The code snippet supposes the existence of a mapped drive as "Z".

Code: Select all

~InstallAware Clipboard Data~
~MessageBox~
~{0FB07732-AA11-48ED-95CF-BE3C8C7113FE}~
~~
~$UNC_PATH$~
~0~
~1~
~~
~Call DLL Function~
~{8E69615C-D5B5-4C28-9C02-EBE3E21CD46A}~
~Mpr.dll,WNetGetConnectionW,void,,"pointer to UNICODE string",$MAPPED_DERIVE$,"allocated UNICODE string buffer (MAX_PATH)",$UNC_PATH$,"pointer to double word",$BUFFER_LEN$,$~
~mIDEFunc.dll\mEXEFunc.dll~
~Set Variable~
~{245A4AE2-3AC1-4049-8C15-68DBFAFB7801}~
~MAPPED_DRIVE$MYAH$MYAH$FALSE~
~z:~
~Set Variable~
~{52655DE0-BF88-47E7-87E9-59916D9229F1}~
~BUFFER_LEN$MYAH$MYAH$FALSE~
~255~
~Set Variable~
~{1AB896FD-2D90-4EF8-9E4C-20E149185A3A}~
~UNC_PATH$MYAH$MYAH$FALSE~
~~


Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

alibaba
Posts: 314
Joined: Fri Jun 26, 2009 8:46 am
Location: Thuringia, Germany

Re: Is "Does File/Folder Exist" working with mapped folders?

Postby alibaba » Mon Aug 24, 2015 3:55 am

Hi Francesco,

thank you for the tip with the user mappings, that could be the reason.

But if I understood right, the administrator user will not be able to see the mapping, so the function WNetGetConnectionW will also fail to get the path because it is running as administrator. Right?

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Is "Does File/Folder Exist" working with mapped folders?

Postby FrancescoT » Mon Aug 24, 2015 9:14 am

Dear Alibaba,

instead for what I have personally verified, the "WNetGetConnection" (Windows networking API) is able to retrieve the UNC path of the given mapped drive anyway.

I can only suppose this is due the fact that the Windows networking APIs are expressly designed for administrative use.

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: Google [Bot] and 12 guests