Compartir a través de


WNetGetUniversalName (Windows CE 5.0)

Send Feedback

This function maps a local path for a network resource to a data structure containing the Universal Name Convention based name.

DWORD WNetGetUniversalName(LPCTSTR lpLocalPath, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpBufferSize );

Parameters

  • lpLocalPath
    [in] Long pointer to a null-terminated string that is a local name for a network resource. It must point to the subfolder in the \NETWORK directory.

    For example, if local name "myShare" has been mapped to a network share, and the network resource of interest is a file named SAMPLE.DOC in the directory \WIN32\EXAMPLES on that share, the local path is \NETWORK\myShare\WIN32\EXAMPLES.

  • dwInfoLevel
    [in] Specifies the type of data structure that the function will store in the buffer pointed to by lpBuffer. This parameter can be one of the following values.

    Value Description
    UNIVERSAL_NAME_INFO_LEVEL The function will store a UNIVERSAL_NAME_INFO data structure in the buffer.
    REMOTE_NAME_INFO_LEVEL The function will store a REMOTE_NAME_INFO data structure in the buffer.

    The UNIVERSAL_NAME_INFO data structure points to a Universal Naming Convention (UNC) name string.

    The REMOTE_NAME_INFO data structure points to a UNC name string and two additional connection information strings.

  • lpBuffer
    [out] Long pointer to a buffer that receives the type of data structure specified by the dwInfoLevel parameter.

  • lpBufferSize
    [in, out] Long pointer to a variable that specifies the size in bytes of the buffer pointed to by lpBuffer.

    If the function succeeds, it sets the variable pointed to by lpBufferSize to the size in bytes of the data structure stored in the buffer. If the function fails because the buffer is too small, indicated by the ERROR_MORE_DATA error value, it sets the variable pointed to by lpBufferSize to the required buffer size.

Return Values

ERROR_SUCCESS indicates success. An error value indicates failure. To get extended error information, call GetLastError. Possible GetLastError error values are described in the following table.

Value Description
ERROR_BAD_DEVICE The string pointed to by lpLocalPath is invalid.
ERROR_CONNECTION_UNAVAIL There is no current connection to the remote device, but there is a remembered, or persistent, connection to it.
ERROR_MORE_DATA The buffer pointed to by lpBuffer is too small. The function sets the variable pointed to by lpBufferSize to the required buffer size. More entries are available with subsequent calls.
ERROR_NO_NETWORK No network present.
ERROR_NOT_CONNECTED The device specified by lpLocalPath is not redirected.

Remarks

A universal form of a local path identifies a network resource in an unambiguous, computer-independent manner. The name can then be passed to processes on other computers, allowing those processes to obtain access to the resource.

The WNetGetUniversalName function currently supports one universal name form: universal naming convention (UNC) names, which look like the following example.

\\servername\sharename\path\file

Using the example from the preceding description of the lpLocalPath parameter, if the shared network drive is on a server named COOLSERVER, and the share name is HOTSHARE, the UNC name for the network resource whose local name is Network\myShare\Win32\Examples\Sample.doc would be as follows.

\\coolserver\hotshare\win32\examples\sample.doc

The UNIVERSAL_NAME_INFO data structure contains a pointer to a UNC name string. The REMOTE_NAME_INFO data structure contains a pointer to a UNC name string. It also includes pointers to two other useful strings. A program can pass the REMOTE_NAME_INFO structure's lpszConnectionInfo member into the WNetAddConnection3 function to connect a local device to the network resource, and then append the string pointed to by the lpszRemainingPath member to the local device string. The resulting string can be passed to Win32 file functions.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Winnetwk.h.
Link Library: Coredll.lib.

See Also

UNIVERSAL_NAME_INFO | REMOTE_NAME_INFO

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.