3.1.4.2.111 ApiGetResourceNetworkName (Opnum 112)

(Protocol Version 3) The ApiGetResourceNetworkName method retrieves the NetBIOS computer name associated with the resource upon which the designated resource depends and whose resource type, as specified in section 3.1.4.2.16, matches the Unicode string "Network Name".

The server MUST return a "Network Name" type resource even if the dependency is not direct; that is, the designated resource can have a chain of dependencies that lead to the "Network Name" type resource.

If there is more than one "Network Name" type resource on which the designated resource depends (as specified in the preceding paragraph), the server MUST return the name of one resource. The set of "Network Name" type resources that the server returns is implementation-specific.

The dependency chain, as previously specified, can include zero or more complex dependencies, as specified in section 3.1.1.1.2.2.

The server SHOULD accept an ApiGetResourceNetworkName request if its protocol server state is read-only, and the server MUST accept the request for processing if it is in the read/write state, as specified in section 3.1.1.

The server SHOULD accept an ApiGetResourceNetworkName request if the access level associated with the hResource context handle is at least "Read" (section 3.1.4).

 error_status_t ApiGetResourceNetworkName(
   [in] HRES_RPC hResource,
   [out, string] LPWSTR *lpszName,
   [out] error_status_t *rpc_status
 );

hResource: An HRES_RPC context handle that was obtained in a previous ApiOpenResource, ApiOpenResourceEx, or ApiCreateResource method call.

lpszName: A pointer to a Unicode string buffer. The lpszName parameter receives the NetBIOS computer name associated with the resource with the following properties:

  • This resource has a resource type that matches the Unicode string "Network Name".

  • This resource is depended upon by the specified resource, possibly through a chain of dependencies.

    The server MUST allocate as much memory as is required to return the resource type. If the method fails, this parameter MUST be ignored.

rpc_status: A 32-bit integer used to indicate success or failure. The RPC runtime MUST indicate, by writing to this parameter, whether it succeeded in executing this method on the server. The encoding of the value passed in this parameter MUST conform to encoding for comm_status and fault_status, as specified in Appendix E of [C706].

Return Values: The method MUST return the following error codes for the specified conditions.

Return value/code

Description

0x00000000

ERROR_SUCCESS

Success.

0x00000006

ERROR_INVALID_HANDLE

The data that is pointed to by the hResource parameter does not represent a valid HRES_RPC context handle.

0x0000138A

ERROR_DEPENDENCY_NOT_FOUND

A resource that has the resource type that matches the Unicode string "Network Name" was not found in any dependency chains that start from the designated resource.

For any other condition, this method MUST return a value that is not one of the values listed in the preceding table. The client MUST behave in one consistent, identical manner for all values that are not listed in the preceding table. The client SHOULD treat errors specified in 3.2.4.6 as recoverable errors and initiate the reconnect procedure as specified in section 3.2.4.6.