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 or persistent (i.e., returns WN_SUCCESS from WNetGetConnection). | |
RESOURCE_GLOBALNET - a network resource (may or may not be connected). | |
RESOURCE_REMEMBERED - a persistent connection. | |
RESOURCE_RECENT - a recently connected remote resource. | |
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 (e.g., a container of both print and disk resources), or a resource which is neither print or disk.
dwDisplayType
This field is set to indicate what display type a User Interface uses to represent this resource. Currently defined types are:
RESOURCEDISPLAYTYPE_ROOT | The root of networks |
RESOURCEDISPLAYTYPE_NETWORK | a network |
RESOURCEDISPLAYTYPE_DOMAIN | collection of servers |
RESOURCEDISPLAYTYPE_SERVER | a server |
RESOURCEDISPLAYTYPE_SHARE | a share point RESOURCEDISPLAYTYPE_SHAREADMIN - an administrative share point |
RESOURCEDISPLAYTYPE_DIRECTORY | a directory |
RESOURCEDISPLAYTYPE_GENERIC | unspecified |
dwUsage
This field is only defined if dwScope is RESOURCE_GLOBALNET or RESOURCE_CONTEXT.
The field is a bit mask which may contain any of:
RESOURCEUSAGE_CONNECTABLE | Can connect to resource by a call to WNetAddConnection or WNetAddConnection2. If dwType is RESOURCETYPE_DISK, then, once the resource is connected to, the file APIs (e.g., FindFirstFile, FindNextFile) can be used to enumerate any files and directories contained within it. |
RESOURCEUSAGE_CONTAINER | Resource contains other resources that can be enumerated using the WNetOpenEnum, WNetEnumResource, and WNetCloseEnum APIs. The resource may not currently contain any resources (i.e. 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 or RESOURCE_REMEMBERED, 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 WNetAddConnection to make a network connection if dwUsage has RESOURCEUSAGE_CONNECTABLE. If the entry is a current or persistent connection, this field will refer to the name of the network resource which is redirected to lpLocalName.
lpComment
This may be any NP supplied comment.
lpProvider
Specifies the name of the NP owning this resource. It may be NULL if it is not known.