Platform SDK: Windows Networking

NETRESOURCE

The NETRESOURCE structure contains information about a network resource. The structure is returned during enumeration of network resources. NETRESOURCE is also specified when making or querying a network connection with calls to various Windows Networking functions.

typedef struct _NETRESOURCE { 
    DWORD  dwScope; 
    DWORD  dwType; 
    DWORD  dwDisplayType; 
    DWORD  dwUsage; 
    LPTSTR lpLocalName; 
    LPTSTR lpRemoteName; 
    LPTSTR lpComment; 
    LPTSTR lpProvider; 
} NETRESOURCE; 

Members

dwScope
Specifies a DWORD value that contains the scope of the enumeration. This member can be one of the following values.
Value Meaning
RESOURCE_CONNECTED Enumerate currently connected resources. The dwUsage member cannot be specified.
RESOURCE_GLOBALNET Enumerate all resources on the network. The dwUsage member is specified.
RESOURCE_REMEMBERED Enumerate remembered (persistent) connections. The dwUsage member cannot be specified.

dwType
Specifies a DWORD value that contains a set of bit flags identifying the type of resource. This member can be one of the following values.
Value Meaning
RESOURCETYPE_ANY All resources
RESOURCETYPE_DISK Disk resources
RESOURCETYPE_PRINT Print resources

The WNetEnumResource function can also return the value RESOURCETYPE_UNKNOWN if a resource is neither a disk nor a print resource.

dwDisplayType
Specifies a DWORD value that indicates how the network object should be displayed in a network browsing user interface. This member can be one of the following values.
Value Meaning
RESOURCEDISPLAYTYPE_DOMAIN The object should be displayed as a domain.
RESOURCEDISPLAYTYPE_SERVER The object should be displayed as a server.
RESOURCEDISPLAYTYPE_SHARE The object should be displayed as a share.
RESOURCEDISPLAYTYPE_GENERIC The method used to display the object does not matter.

dwUsage
Specifies a DWORD value that contains a set of bit flags describing how the resource can be used.

Note that this member can be specified only if the dwScope member is equal to RESOURCE_GLOBALNET. This member can be one of the following values.
Value Meaning
RESOURCEUSAGE_CONNECTABLE The resource is a connectable resource; the name pointed to by the lpRemoteName member can be passed to the WNetAddConnection function to make a network connection.
RESOURCEUSAGE_CONTAINER The resource is a container resource; the name pointed to by the lpRemoteName member can be passed to the WNetOpenEnum function to enumerate the resources in the container.

lpLocalName
If the dwScope member is equal to RESOURCE_CONNECTED or RESOURCE_REMEMBERED, this member is a pointer to a null-terminated character string that specifies the name of a local device. This member is NULL if the connection does not use a device.
lpRemoteName
If the entry is a network resource, this member is a pointer to a null-terminated character string that specifies the remote network name.

If the entry is a current or persistent connection, lpRemoteName points to the network name associated with the name pointed to by the lpLocalName member.

The string can be MAX_PATH characters in length, and it must follow the network provider's naming conventions.

lpComment
Pointer to a null-terminated character string that contains a comment supplied by the network provider.
lpProvider
Pointer to a null-terminated character string that contains the name of the provider that owns the resource. This member can be NULL if the provider name is unknown. To retrieve the provider name, you can call the WNetGetProviderName function.

Remarks

For more information about setting the values of the dwType, lpLocalName, lpRemoteName, and lpProvider members, see MultinetGetConnectionPerformance, WNetAddConnection2, WNetAddConnection3, WNetGetResourceInformation, WNetGetResourceParent, and WNetUseConnection.

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Header: Declared in Npapi.h.

See Also

Windows Networking (WNet) Overview, Windows Networking Structures, MultinetGetConnectionPerformance, WNetAddConnection2, WNetAddConnection3, WNetUseConnection, WNetCloseEnum, WNetEnumResource, WNetGetProviderName, WNetGetResourceInformation, WNetGetResourceParent, WNetOpenEnum