188.8.131.52 NetrShareCheck (Opnum 20)
The NetrShareCheck method checks whether a server is sharing a device.
NET_API_STATUS NetrShareCheck( [in, string, unique] SRVSVC_HANDLE ServerName, [in, string] WCHAR* Device, [out] DWORD* Type );
ServerName: An SRVSVC_HANDLE (section 184.108.40.206) pointer that identifies the server. The client MUST map this structure to an RPC binding handle (see [C706] sections 4.3.5 and 220.127.116.11). The server MUST ignore this parameter.
Device: A pointer to a null-terminated UTF-16 string that specifies the name of the device to check for shared access.
Type: A pointer to a DWORD that receives the type of the shared device. This parameter is set only if the method returns successfully. On success, the server MUST set this parameter as specified in section 18.104.22.168, except that STYPE_SPECIAL is not returned.
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.
Return value/code Description
The client request succeeded.
Not enough storage is available to process this command.
The device is not shared.
In response to a NetrShareCheck request, the server MUST scan through the ShareList. For each share, if Share.LocalPath, as specified in [MS-SMB2] section 22.214.171.124 or [MS-CIFS] section 126.96.36.199, points to the device or volume specified by the caller, the server MUST return the type of the matching device in the Type parameter. The type can be one of the values that are listed in Share Types (section 188.8.131.52). In response to a NetrShareCheck message, the server MUST check whether it is sharing a device and return a response to the client.
The Device parameter specifies the name of the shared device to check for. The server MUST enumerate the active shared devices, and if it finds a match to the Device parameter, the server MUST return the type of the matching device in the Type parameter. The type can be one of the values that are listed in Share Types. The server MUST set the STYPE_CLUSTER_FS, STYPE_CLUSTER_SOFS, and STYPE_CLUSTER_DFS bits of the Type parameter to zero; the client MUST ignore them on receipt.
If no match is found, the server MUST fail the call by using an NERR_DeviceNotShared error code.
The server does not enforce any security measures when it processes this call.