[This is preliminary documentation and subject to change.]
When provided with a remote path to a network resource, the WNetGetResourceInformation function identifies the network provider that owns the resource and obtains information about the type of the resource. The function is typically used in conjunction with WNetGetResourceParent to parse and interpret a network path typed in by a user.
DWORD WNetGetResourceInformation (
LPNETRESOURCE lpNetResource, // Specifies the network resource
// for which information is required
LPVOID lpBuffer, // Species a buffer to contain
// the information
LPDWORD lpcbBuffer, // Specifies the size of the buffer
// pointed to by lpBuffer
LPTSTR *lplpSystem // Pointer to a string in the
// output buffer
);
The lpRemoteName parameter is returned in the same syntax as that returned from an enumeration by the WNetEnumResource function. This allows the caller to perform a string comparison to determine whether the resource passed to WNetGetResourceInformation is the same as the resource returned by a separate call to WNetEnumResource.
For example, if the input remote resource name was \\server\share\dir1\dir2, the lpRemoteName parameter of the output NETRESOURCE structure points to \\server\share. Also, the lplpSystem parameter points to \dir1\dir2. Both strings are stored in the buffer pointed to by lpBuffer.
If the function succeeds, the return value is NO_ERROR.
If the function fails, the return value is one of the following error codes
Value | Meaning |
---|---|
ERROR_BAD_NET_NAME | The lpRemoteName parameter is not an existing network resource for any network. |
ERROR_BAD_DEV_TYPE | The dwType parameter does not match the type of the resource specified by lpRemoteName. |
ERROR_EXTENDED_ERROR | A network-specific error occurred. Call WNetGetLastError to obtain a description of the error. |
ERROR_MORE_DATA | The buffer pointed to by lpBuffer is too small. |
ERROR_NO_NETWORK | The network is not present. |
Header: Declared in winnetwk.h.
Import Library: Link with mpr.lib.
Windows NT: Use version 3.5 or later.
Windows: Use Windows 95 or later.
Windows CE: Use version 2.0 or later.
Header: Declared in winnetwk.h.
Import Library: Use mpr.lib.
Windows Networking (WNet) Overview, Windows Networking Functions, WNetGetResourceParent