Highlighted
Absent Member.
Absent Member.
175 views

[archive] Universal Naming Convention

[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
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Universal Naming Convention

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.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Universal Naming Convention

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
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Universal Naming Convention

Nice solution Rob!
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.