Compartir a través de


3.1.4.19 NetrServerDiskEnum (Opnum 23)

The NetrServerDiskEnum method retrieves a list of disk drives on a server. The method returns an array of three-character strings (a drive letter, a colon, and a terminating null character).

 NET_API_STATUS NetrServerDiskEnum(
   [in, string, unique] SRVSVC_HANDLE ServerName,
   [in] DWORD Level,
   [in, out] DISK_ENUM_CONTAINER* DiskInfoStruct,
   [in] DWORD PreferedMaximumLength,
   [out] DWORD* TotalEntries,
   [in, out, unique] DWORD* ResumeHandle
 );

ServerName: An SRVSVC_HANDLE (section 2.2.1.1) pointer that identifies the server. The client MUST map this structure to an RPC binding handle (see [C706] sections 4.3.5 and 5.1.5.2). The server MUST ignore this parameter.

Level: Specifies the information level of the data. It MUST be the following value.

Value

Meaning

0

The buffer is of type DISK_INFO.

DiskInfoStruct: A pointer to a structure of type DISK_ENUM_CONTAINER, as specified in section 2.2.4.92. Although this parameter is defined as an [in, out] parameter, it is used only as an [out] parameter. The server MUST ignore any values that are passed in this parameter.

PreferedMaximumLength: The server MUST ignore this parameter.

TotalEntries: The number of entries being returned in the Buffer member of the DiskInfoStruct parameter. This MUST be in the range 0–26.

ResumeHandle: The server MUST ignore this parameter.

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

0x00000000

NERR_Success

The client request succeeded.

0x0000007C

ERROR_INVALID_LEVEL

The system call level is not correct.

0x00000008

ERROR_NOT_ENOUGH_MEMORY

Not enough storage is available to process this command.

0x00000005

ERROR_ACCESS_DENIED

The caller does not have the permissions to perform the operation.

The server MUST ignore the PreferedMaximumLength parameter.

The server MUST ignore the ResumeHandle parameter.

Upon successful processing of the request, the server MUST set the TotalEntries parameter equal to the number of disk drive entries that the server enumerated in the Buffer member of DiskInfoStruct and the EntriesRead member of DiskInfoStruct MUST be set to 1 plus the value set for TotalEntries.

Upon successful processing of the request, the server MUST return the enumerated disk drives in the Buffer member of DiskInfoStruct in the format of the DISK_INFO structure. The server MUST allocate the memory required to return all enumerated disk drives in the Buffer member of the InfoStruct parameter. In cases where the RPC allocated a buffer because the client specified a non-NULL value for the Buffer parameter, the server MUST free the buffer that is allocated by the RPC.

The server SHOULD<86> enforce security measures to verify that the caller has the required permissions to execute this routine. If the caller does not have the required credentials, the server SHOULD<87> fail the call.