Skip to main content

[archive] Universal Naming Convention

  • July 20, 2009
  • 4 replies
  • 0 views

[Migrated content. Thread originally posted on 17 July 2009]

Hi all

I would like to convert a regular file naming for a file e.g (K:\\folder\\a.txt) to Universal Naming Convention (UNC)
If "K:" is a network drive connected to "\\\\server\\folder_1\\folder_2", I would like to get "\\\\server\\folder_1\\folder_2\\folder\\a.txt"

I am trying to use the WNetGetUniversalNameA function (part of mpr.dll) but with no success...

Is there any other way?

I am not so experienced with running API functions.
I supposed it's something like:

CALL "MPR.DLL"
CALL "WNetGetUniversalNameA" USING

I think I am missing something with the declaration of parameters

I will apreciate any help...

Thanos

P.S. My computer runs XP, Acubench version is 7.2.0

4 replies

[Migrated content. Thread originally posted on 17 July 2009]

Hi all

I would like to convert a regular file naming for a file e.g (K:\\folder\\a.txt) to Universal Naming Convention (UNC)
If "K:" is a network drive connected to "\\\\server\\folder_1\\folder_2", I would like to get "\\\\server\\folder_1\\folder_2\\folder\\a.txt"

I am trying to use the WNetGetUniversalNameA function (part of mpr.dll) but with no success...

Is there any other way?

I am not so experienced with running API functions.
I supposed it's something like:

CALL "MPR.DLL"
CALL "WNetGetUniversalNameA" USING

I think I am missing something with the declaration of parameters

I will apreciate any help...

Thanos

P.S. My computer runs XP, Acubench version is 7.2.0
The function return variable sized group data, e.g. containing pointers. Hence, it is a bit complex because you will have to allocate/deallocate memory and copy memory.

Interesting though, I will see if I may have an example around.

[Migrated content. Thread originally posted on 17 July 2009]

Hi all

I would like to convert a regular file naming for a file e.g (K:\\folder\\a.txt) to Universal Naming Convention (UNC)
If "K:" is a network drive connected to "\\\\server\\folder_1\\folder_2", I would like to get "\\\\server\\folder_1\\folder_2\\folder\\a.txt"

I am trying to use the WNetGetUniversalNameA function (part of mpr.dll) but with no success...

Is there any other way?

I am not so experienced with running API functions.
I supposed it's something like:

CALL "MPR.DLL"
CALL "WNetGetUniversalNameA" USING

I think I am missing something with the declaration of parameters

I will apreciate any help...

Thanos

P.S. My computer runs XP, Acubench version is 7.2.0
I am doing this by reading the windows registry.

Under HKEY_CURRENT_USER, there is a Network node, and nodes underneath that for any mapped drives. Under that node, the RemotePath is what the UNC name is for the mapped drive. This has worked well for me.

Rob

[Migrated content. Thread originally posted on 17 July 2009]

Hi all

I would like to convert a regular file naming for a file e.g (K:\\folder\\a.txt) to Universal Naming Convention (UNC)
If "K:" is a network drive connected to "\\\\server\\folder_1\\folder_2", I would like to get "\\\\server\\folder_1\\folder_2\\folder\\a.txt"

I am trying to use the WNetGetUniversalNameA function (part of mpr.dll) but with no success...

Is there any other way?

I am not so experienced with running API functions.
I supposed it's something like:

CALL "MPR.DLL"
CALL "WNetGetUniversalNameA" USING

I think I am missing something with the declaration of parameters

I will apreciate any help...

Thanos

P.S. My computer runs XP, Acubench version is 7.2.0
I am doing this by reading the windows registry.

Under HKEY_CURRENT_USER, there is a Network node, and nodes underneath that for any mapped drives. Under that node, the RemotePath is what the UNC name is for the mapped drive. This has worked well for me.

Rob

[Migrated content. Thread originally posted on 17 July 2009]

Hi all

I would like to convert a regular file naming for a file e.g (K:\\folder\\a.txt) to Universal Naming Convention (UNC)
If "K:" is a network drive connected to "\\\\server\\folder_1\\folder_2", I would like to get "\\\\server\\folder_1\\folder_2\\folder\\a.txt"

I am trying to use the WNetGetUniversalNameA function (part of mpr.dll) but with no success...

Is there any other way?

I am not so experienced with running API functions.
I supposed it's something like:

CALL "MPR.DLL"
CALL "WNetGetUniversalNameA" USING

I think I am missing something with the declaration of parameters

I will apreciate any help...

Thanos

P.S. My computer runs XP, Acubench version is 7.2.0
Nice solution Rob!