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 the WNetGetResourceParent function to parse and interpret a network path typed in by a user.
DWORD WNetGetResourceInformationA( LPNETRESOURCEA lpNetResource, LPVOID lpBuffer, LPDWORD lpcbBuffer, LPSTR *lplpSystem );
Pointer to a NETRESOURCE structure that specifies the network resource for which information is required.
The lpRemoteName member of the structure should specify the remote path name of the resource, typically one typed in by a user. The lpProvider and dwType members should also be filled in if known, because this operation can be memory intensive, especially if you do not specify the dwType member. If you do not know the values for these members, you should set them to NULL. All other members of the NETRESOURCE structure are ignored.
Pointer to the buffer to receive the result. On successful return, the first portion of the buffer is a NETRESOURCE structure representing that portion of the input resource path that is accessed through the WNet functions, rather than through system functions specific to the input resource type. (The remainder of the buffer contains the variable-length strings to which the members of the NETRESOURCE structure point.)
For example, if the input remote resource path is \server\share\dir1\dir2, then the output NETRESOURCE structure contains information about the resource \server\share. The \dir1\dir2 portion of the path is accessed through the file management functions. The lpRemoteName, lpProvider, dwType, dwDisplayType, and dwUsage members of NETRESOURCE are returned, with all other members set to NULL.
The lpRemoteName member is returned in the same syntax as the one 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.
Pointer to a location that, on entry, specifies the size of the lpBuffer buffer, in bytes. The buffer you allocate must be large enough to hold the NETRESOURCE structure, plus the strings to which its members point. If the buffer is too small for the result, this location receives the required buffer size, and the function returns ERROR_MORE_DATA.
If the function returns successfully, this parameter points to a string in the output buffer that specifies the part of the resource that is accessed through system functions. (This applies only to functions specific to the resource type rather than the WNet functions.)
For example, if the input remote resource name is \server\share\dir1\dir2, the lpRemoteName member 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 the lpBuffer parameter.
If the function succeeds, the return value is NO_ERROR.
If the function fails, the return value is a system error code, such as one of the following values.
||The input lpRemoteName member is not an existing network resource for any network.|
||The input dwType member does not match the type of resource specified by the lpRemoteName member.|
||A network-specific error occurred. Call WNetGetLastError to obtain a description of the error.|
||The buffer pointed to by the lpBuffer parameter is too small.|
||The network is unavailable.|
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|