NETRESOURCE

The following structure is returned during enumeration of resources on the network, and during enumeration of currently connected resources.

typedef struct _NETRESOURCE { 
  DWORD dwScope;
  DWORD dwType;
  DWORD dwDisplayType;
  DWORD dwUsage;
  LPTSTR lpLocalName;
  LPTSTR lpRemoteName;
  LPTSTR lpComment;
  LPTSTR lpProvider;
} NETRESOURCE, *LPNETRESOURCE;
 
dwScope
This is one of:
RESOURCE_CONNECTED A network resource that is currently connected.
RESOURCE_GLOBALNET A network resource (may or may not be connected).
RESOURCE_CONTEXT The resources associated with the user's current and default network context.

dwType
This can be one of:
RESOURCETYPE_DISK
RESOURCETYPE_PRINT
RESOURCETYPE_ANY

The value RESOURCETYPE_ANY is used if the resource matches more than one (such as a container of both print and disk resources), or a resource which is neither print or disk.

dwDisplayType
This field is set by the provider to indicate what display type a user interface uses to represent this resource. Currently defined types are:
RESOURCEDISPLAYTYPE_NETWORK A network.
RESOURCEDISPLAYTYPE_DOMAIN A collection of servers.
RESOURCEDISPLAYTYPE_SERVER A server.
RESOURCEDISPLAYTYPE_SHARE A share point.
RESOURCEDISPLAYTYPE_DIRECTORY A directory.
RESOURCEDISPLAYTYPE_GENERIC Unspecified (for providers that don't know or don't care).

In addition, an NP may register additional types by supporting the NPDisplayLayout function. In this case, the NP can supply additional values here. See the NPDisplayLayout function for more details about assigning display types.

dwUsage
This field is defined only if dwScope is RESOURCE_GLOBALNET.

The field is a bit mask which may contain any of the following:
RESOURCEUSAGE_CONNECTABLE Can connect to resource by a call to NPAddConnection. If dwType is RESOURCETYPE_DISK, then, once the resource is connected to, the file APIs (such as FindFirstFile, FindNextFile) can be used to enumerate any files and directories contained within it.
RESOURCEUSAGE_CONTAINER Resource is a container for other resources that can be enumerated using the NPOpenEnum, NPEnumResource, and NPCloseEnum APIs. The resource may not currently contain any resources (for example, the first NPEnumResource call may return WN_NO_MORE_ENTRIES).
RESOURCEUSAGE_NOLOCALDEVICE Resource can be connected to without associating a local device (such as D: or LPT1).
RESOURCEUSAGE_SIBLING Resource is a sibling of the previous resource returned from the current enumeration (only set if dwScope is RESOURCE_CONTEXT, since resources are always siblings of each other if dwScope is RESOURCE_GLOBALNET).

lpLocalName
If dwScope is RESOURCE_CONNECTED this will contain the name of a redirected local device (NULL if the connection is a deviceless connection). It is undefined otherwise.
lpRemoteName
This contains a remote network name if the entry is a network resource. This name may be then passed to NPAddConnection to make a network connection if dwUsage has RESOURCEUSAGE_CONNECTABLE. If the entry is a current connection, this field will refer to the name of the network resource that is redirected to lpLocalName.
lpComment
This may be any NP-supplied comment.
lpProvider
Specifies the name of the provider owning this resource. The name is case-sensitive for matching in SPI calls.