NPGetResourceParent


DWORD NPGetResourceParent(
  LPNETRESOURCE lpNetResource,
  LPVOID lpBuffer,
  LPDWORD cbBuffer
  );

lpNetResource

This specifies the network resource for which the parent name is required. The NETRESOURCE could have been obtained via a previous NPEnumResource, or constructed by the caller. The lpRemoteName field of the NETRESOURCE specifies the remote name of the network resource whose parent name is required. If the calling program knows the values for the lpProvider and dwType fields, then it can fill them in, otherwise, they are set to NULL. If the lpProvider field is not NULL, then the network provider DLL can assume that the resource is owned by its network, but if it is NULL, then it must assume that the resource could be for some other network and do whatever checking is necessary to ensure that the result returned is accurate. For example, if being asked for the parent of a server, and the server is not part of a workgroup, then the network provider DLL should check to ensure that the server is part of its network and, if so, return its provider name. All other fields in the NETRESOURCE are ignored and are not initialized.

lpBuffer

A pointer to the buffer to receive the result, which is returned as a single NETRESOURCE entry representing the parent resource. The lpRemoteName, lpProvider, dwType, and dwUsage fields are returned, all other fields being set to NULL. lpProvider should be set to NULL if the provider has only done a syntactic check (i.e. does not know that the resource is specific to its network). If the provider owns a parent of the network resource, (in other words is known to be the correct network to respond to this request), then lpProvider should be filled in with a non-null entry, even if the status return is WN_BAD_VALUE. The remote name returned should be in the same syntax as that returned from an enumeration, so that the caller can do a case-sensitive string compare to determine whether an enumerated resource is this resource. If a resource has no browse parent on the network, then lpRemoteName is returned as NULL. The RESOURCEUSAGE_CONNECTABLE value in the dwUsage field does not indicate that the resource can currently be connected to, but that the resource is connectable when it is available on the network.

cbBuffer

This specifies the size in bytes of the buffer passed to the function call. If the result is WN_MORE_DATA, this will contain the buffer size required (in bytes) to hold the NETRESOURCE information.

WN_BAD_VALUE

Invalid dwScope or dwUsage or dwType, or bad combination of parameters is specified (e.g. lpRemoteName does not correspond to dwType).

WN_NOT_AUTHENTICATED

The caller does not have the necessary permissions to obtain the name of the parent.

WN_ACCESS_DENIED

The user is authenticated to the network, but does not have sufficient permissions (access rights).