NETRESOURCE structure
The NETRESOURCE structure contains information about a network resource.
Syntax
typedef struct _NETRESOURCE { DWORD dwScope; DWORD dwType; DWORD dwDisplayType; DWORD dwUsage; LPTSTR lpLocalName; LPTSTR lpRemoteName; LPTSTR lpComment; LPTSTR lpProvider; } NETRESOURCE;
Members
- dwScope
-
Type: DWORD
-
The scope of the enumeration. This member can be one of the following values defined in the Winnetwk.h header file.
- dwType
-
Type: DWORD
-
The type of resource. This member can be one of the following values defined in the Winnetwk.h header file.
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
-
Type: DWORD
-
The display options for the network object in a network browsing user interface. This member can be one of the following values defined in the Winnetwk.h header file.
- dwUsage
-
Type: DWORD
-
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 defined in the Winnetwk.h header file.
Value Meaning - RESOURCEUSAGE_CONNECTABLE
- 0x00000001
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
- 0x00000002
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.
- RESOURCEUSAGE_NOLOCALDEVICE
- 0x00000004
The resource is not a local device.
- RESOURCEUSAGE_SIBLING
- 0x00000008
The resource is a sibling. This value is not used by Windows.
- RESOURCEUSAGE_ATTACHED
- 0x00000010
The resource must be attached. This value specifies that a function to enumerate resource this should fail if the caller is not authenticated, even if the network permits enumeration without authentication.
- lpLocalName
-
Type: LPTSTR
-
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
-
Type: LPTSTR
-
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 member 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
-
Type: LPTSTR
-
A pointer to a NULL-terminated string that contains a comment supplied by the network provider.
- lpProvider
-
Type: LPTSTR
-
A pointer to a NULL-terminated 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
The NETRESOURCE structure is returned during an enumeration of network resources. The NETRESOURCE structure is also specified when making or querying a network connection with calls to various Windows Networking functions.
For Microsoft network providers, the lpRemoteName member can contain an IPv4 address in dotted-decimal notation. An example for a share might be the following:
\\192.168.1.1\share
For Microsoft network providers on Windows Vista and later, the lpRemoteName member can contain an IPv6 address. However, the IPv6 literal format must be used so that the IPv6 address is parsed correctly. An IPv6 literal address is of the form:
ipv6-address with the ':' characters replaced by '-' characters followed by the ".ipv6-literal.net" string.
For example, for the following IPv6 address:
2001:4898:9:3:c069:aa97:fe76:2449
an example for a share might be the following:
\\2001-4898-9-3-c069-aa97-fe76-2449.ipv6-literal.net\share
Other network providers may also support a lpRemoteName member that contains an IPv4 or IPv6 address, but this is up to specific network provider.
For more information about setting the values of the dwType, lpLocalName, lpRemoteName, and lpProvider members, see MultinetGetConnectionPerformance, WNetAddConnection2, WNetAddConnection3, WNetGetResourceInformation, WNetGetResourceParent, and WNetUseConnection functions.
Requirements
|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server | Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Unicode and ANSI names | NETRESOURCEW (Unicode) and NETRESOURCEA (ANSI) |
See also
- Windows Networking (WNet) Overview
- Windows Networking Structures
- MultinetGetConnectionPerformance
- WNetAddConnection2
- WNetAddConnection3
- WNetUseConnection
- WNetCloseEnum
- WNetEnumResource
- WNetGetProviderName
- WNetGetResourceInformation
- WNetGetResourceParent
- WNetOpenEnum