Export (0) Print
Expand All

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.

ValueMeaning
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

Type: DWORD

The type of resource. This member can be one of the following values defined in the Winnetwk.h header file.

ValueMeaning
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.

ValueMeaning
RESOURCEDISPLAYTYPE_GENERIC
0x00000000

The method used to display the object does not matter.

RESOURCEDISPLAYTYPE_DOMAIN
0x00000001

The object should be displayed as a domain.

RESOURCEDISPLAYTYPE_SERVER
0x00000002

The object should be displayed as a server.

RESOURCEDISPLAYTYPE_SHARE
0x00000003

The object should be displayed as a share.

RESOURCEDISPLAYTYPE_FILE
0x00000004

The object should be displayed as a file.

RESOURCEDISPLAYTYPE_GROUP
0x00000005

The object should be displayed as a group.

RESOURCEDISPLAYTYPE_NETWORK
0x00000006

The object should be displayed as a network.

RESOURCEDISPLAYTYPE_ROOT
0x00000007

The object should be displayed as a logical root for the entire network.

RESOURCEDISPLAYTYPE_SHAREADMIN
0x00000008

The object should be displayed as a administrative share.

RESOURCEDISPLAYTYPE_DIRECTORY
0x00000009

The object should be displayed as a directory.

RESOURCEDISPLAYTYPE_TREE
0x0000000A

The object should be displayed as a tree. This display type was used for a NetWare Directory Service (NDS) tree by the NetWare Workstation service supported on Windows XP and earlier.

RESOURCEDISPLAYTYPE_NDSCONTAINER
0x0000000A

The object should be displayed as a Netware Directory Service container. This display type was used by the NetWare Workstation service supported on Windows XP and earlier.

 

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.

ValueMeaning
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

Winnetwk.h

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

 

 

Community Additions

ADD
Show:
© 2014 Microsoft