126.96.36.199 NetrUseEnum (Opnum 11)
The NetrUseEnum method lists open connections between a workstation server and a remote SMB server. The server SHOULD NOT allow this method to be invoked remotely<50> and SHOULD return ERROR_CALL_NOT_IMPLEMENTED.
unsigned long NetrUseEnum( [in, string, unique] WKSSVC_IDENTIFY_HANDLE ServerName, [in, out] LPUSE_ENUM_STRUCT InfoStruct, [in] unsigned long PreferredMaximumLength, [out] unsigned long* TotalEntries, [in, out, unique] unsigned long* ResumeHandle );
ServerName: A WKSSVC_IDENTIFY_HANDLE (section 188.8.131.52) that identifies the server. The client MUST map this structure to an RPC binding handle ([C706] sections 4.3.5 and 184.108.40.206). The server MUST ignore this parameter.
InfoStruct: The USE_ENUM_STRUCT (section 220.127.116.11) structure contains a Level parameter that indicates the type of structure to return.
Specifies a local device name and the share name of a remote resource.
Specifies information about the connection between a local device and a shared resource, including connection status and type.
Specifies information about the connection between a local device and a shared resource, including the connection status, connection type, user name, and domain name.
PreferredMaximumLength: The number of bytes to allocate for the return data.
TotalEntries: The total number of entries that could have been enumerated if the buffer were big enough to hold all the entries.
ResumeHandle: A pointer that, if specified and if this method returns ERROR_MORE_DATA, MUST receive an implementation-specific value that can be passed in subsequent calls to this method in order to continue with the enumeration of currently logged-on users.
If this parameter is NULL or points to zero, the enumeration MUST start from the beginning of the list of currently logged-on users.
Return Values: The method returns 0x00000000 (NERR_Success) to indicate success; otherwise, it returns a nonzero error code. The method can take any specific error code value, as specified in [MS-ERREF] section 2.2. The most common error codes are listed in the following table.
The client request succeeded.
The system call level is not correct.
The client request succeeded. More entries are available. Not all entries could be returned in the buffer size that is specified by PreferredMaximumLength.
Not enough storage is available to process this command.
The client request succeeded. More entries are available. The buffer size that is specified by PreferredMaximumLength was too small to fit even a single entry.
The server SHOULD<51> enforce security measures to verify that the caller has the required permissions to execute this routine. If the server enforces security measures and the caller does not have the required credentials, the server MUST fail the call with ERROR_ACCESS_DENIED. Specifications for determining the identity of the caller for the purpose of performing an access check are in [MS-RPCE] section 18.104.22.168.3.
The InfoStruct parameter has a Level member. The value of Level MUST be 0, 1, or 2. If the Level member is not equal to one of the valid values, the server MUST fail the call with an ERROR_INVALID_LEVEL error code.
The server MUST invoke the event to impersonate the client as specified in [MS-RPCE] section 22.214.171.124.3.1, passing in NULL as input parameter. If this event fails, the server MUST return an error. If the event returns UserToken, the server MUST look in the UseTable for the user where UseEntry.UserToken matches UserToken. If no match is found, the server MUST set the value of TotalEntries to 0 and return a NERR_Success.
If a matching UserToken is found for the user in UseTable, the server MUST enumerate connections in UseEntry.ConnectionTable and fill the return structures as follows:
If the Level member is 0, the server MUST return the information about the connection by filling the USE_INFO_0_CONTAINER (section 126.96.36.199) structure in the Buffer field of the InfoStruct parameter as follows. USE_INFO_0_CONTAINER contains an array of USE_INFO_0 (section 188.8.131.52) structures.
ui0_local set to Connection.local
ui0_remote set to Connection.remote
If the Level member is 1, the server MUST return the information about the connection by filling the USE_INFO_1_CONTAINER (section 184.108.40.206) structure in the Buffer field of the InfoStruct parameter as follows. The USE_INFO_1_CONTAINER structure contains an array of USE_INFO_1 (section 220.127.116.11) structures.
ui1_local set to Connection.local
ui1_remote set to Connection.remote
ui1_password set to NULL
ui1_status set to Connection.status
ui1_asg_type set to Connection.asgtype
ui1_refcount set to Connection.refcount
ui1_usecount set to Connection.useCount
If the Level member is 2, the server MUST return the information about the connection by filling the USE_INFO_2_CONTAINER (section 18.104.22.168) structure in the Buffer field of the InfoStruct parameter as follows. USE_INFO_2_CONTAINER contains an array of USE_INFO_2 (section 22.214.171.124) structures.
ui2_local set to Connection.local
ui2_remote set to Connection.remote
ui2_password set to NULL
ui2_status set to Connection.status
ui2_asg_type set to Connection.asgtype
ui2_refcount set to Connection.refcount
ui2_usecount set to Connection.useCount
ui2_domainname set to Connection.domain
If the PreferredMaximumLength parameter equals MAX_PREFERRED_LENGTH, the server MUST return all the requested data. If PreferredMaximumLength is insufficient to hold all the entries, the server MUST return the maximum number of entries that fit in the InfoStruct buffer and return NERR_BufTooSmall.
The following rules specify processing of the ResumeHandle parameter:
If the ResumeHandle parameter either is NULL or points to 0x00000000, the enumeration MUST start from the beginning of the list of the currently established connections.
If the ResumeHandle parameter is nonzero, the server MUST begin enumeration based on the value of ResumeHandle. The server is not required to maintain any state between calls invoking the NetrUseEnum method.
If the client specified ResumeHandle and if the server returns NERR_BufTooSmall, the server MUST set ResumeHandle to an implementation-specific value<52> that allow the server to continue with this enumeration on a subsequent call to this method, using the same value for ResumeHandle.
The server is not required to maintain any state between calls to the NetrUseEnum method. If the server returns NERR_Success, it MUST set the TotalEntries parameter to equal the total number of entries that could have been enumerated from the current resume position. If the server returns NERR_BufTooSmall, it SHOULD set the TotalEntries value to the total number of entries that could have been enumerated from the current resume position.
The server MUST invoke the event to end the client impersonation as specified in [MS-RPCE] section 126.96.36.199.3.3.