Convert browsed path to UNC for shared path

Got a problem you cannot solve? Try here.
Post Reply
Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Convert browsed path to UNC for shared path

Post 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!
Edhy Rijo
Thom Child and Family Services
Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Post by Edhy »

Does anybody have an idea how to get the UNC path from a shared mapped drive?
Edhy Rijo
Thom Child and Family Services
Gizm0
Posts: 339
Joined: Wed Nov 09, 2005 8:47 pm

Post 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").
Panagiotis Kefalidis
Software Design Team Lead
\"In order to succeed, your desire for success should be greater than your fear of failure\"
Install[b]Aware[/b] Software Corporation
Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Post 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!
Edhy Rijo
Thom Child and Family Services
Tinus
Posts: 209
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Post 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
Martin Rothschink

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware
Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Post 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.
Edhy Rijo
Thom Child and Family Services
Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Post 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.
Edhy Rijo
Thom Child and Family Services
Tinus
Posts: 209
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Post by Tinus »

Hi Edhy,

thanks for your confirmation.
Martin Rothschink

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware
Post Reply