Page 1 of 1
Convert browsed path to UNC for shared path
Posted: Sat May 05, 2007 2:57 pm
by Edhy
Hi,
In my installation, I am setting up a Windows Service and need to create a registry key with a Path information to be used by this service, problem is that Windows Services needs to use UNC path instead of shared folder, so is there anything in IA that will allow me to convert a shared folder path to a UNC path so I can update the registry key properly?
Code: Select all
Ex:
User will select folder T:\\MyShared
I need to convert that mapped drive to:
\\\\MyServer\\MySharedFolder\\MyShare, and store it in $TARGETDIR$
Thanks!
Posted: Tue May 08, 2007 10:32 pm
by Edhy
Does anybody have an idea how to get the UNC path from a shared mapped drive?
Posted: Wed May 09, 2007 7:25 am
by Gizm0
Edhy wrote:Does anybody have an idea how to get the UNC path from a shared mapped drive?
I can think of 2 ways.. Calling WNetGetConnection Win32 API using the plugin or, call "net use" command (it returns all mapped drives), write it on a temp file, read the file line by line, and when you match your Path, get the UNC path (which is on the first collumn on the "net use" command output").
Posted: Thu Jun 14, 2007 12:02 pm
by Edhy
Hi Panagiotis,
I am trying to make this function WNetGetConnection work in IA with not luck.
Can you or anybody provide me with a sample call to this function in IA?
Here is the code I had tried so far:
Code: Select all
Set Variable VOLNAME to
Set Variable LOCALNAME to
Set Variable MAXPATH to 260
Call DLL Function MPR.dll->WNetGetConnection (get result into variable VOLNAME)
MessageBox: Volume Name, Target Dir is:$NEWLINE$$TARGETDIR$$NEWLINE$$NEWLINE$VolName is:$NEWLINE$$VOLNAME$
Code: Select all
~InstallAware Clipboard Data~
~MessageBox~
~{3819D5F0-3E85-45D1-96CA-B6D4F18E8C1F}~
~Volume Name~
~Target Dir is:$NEWLINE$$TARGETDIR$$NEWLINE$$NEWLINE$VolName is:$NEWLINE$$VOLNAME$~
~0~
~1~
~~
~Call DLL Function~
~{DE7A9FAD-A5F2-44D5-A40A-3FB94BCC45C7}~
~MPR.dll,WNetGetConnection,long,VOLNAME,"pointer to string",$TARGETDIR$,"pointer to string",$LOCALNAME$,"pointer to long",$MAXPATH$,$~
~mIDEFunc.dll\\mEXEFunc.dll~
~Set Variable~
~{14F0DAF2-3180-4BA0-A068-93F1BD6348C9}~
~MAXPATH$MYAH$MYAH$FALSE~
~260~
~Set Variable~
~{4F8B82F8-AE1E-44CC-8718-4916800EEBBB}~
~LOCALNAME$MYAH$MYAH$FALSE~
~~
~Set Variable~
~{A43DABE1-3D10-44AC-B3EC-B94DC93CA5E3}~
~VOLNAME$MYAH$MYAH$FALSE~
~~
Thanks!
Posted: Mon Jul 16, 2007 1:51 am
by Tinus
Edhy,
I have enhanced the volume info plug-in to return the UNC path name.
More information and download is here:
http://www.axonet.de/eng/Axo/plugins_fo ... laware.htm
Posted: Mon Jul 16, 2007 8:24 am
by Edhy
Hi Martin,
I can not thank you a lot for adding this functionality to your Plug-In. So far I am using the Windows Firewall, which works great! and now will test this UNC which I needed to save the $TARGETDIR$ in UNC format when my application is installed on a network share folder.
Once again, thanks for taking the time and add this functionality.
Posted: Mon Jul 16, 2007 3:30 pm
by Edhy
Hi Martin,
Just to confirm that the Plug-In is working as expected, I am able to get the UNC format for the TARGETDIR variable.
Once again, thanks for sharing this with the community.
Posted: Tue Jul 17, 2007 2:22 am
by Tinus
Hi Edhy,
thanks for your confirmation.