共用方式為


3.1.4.32 NetprNameValidate (Opnum 33)

The NetprNameValidate method performs checks to ensure that the specified name is a valid name for the specified type.

 NET_API_STATUS NetprNameValidate(
   [in, string, unique] SRVSVC_HANDLE ServerName,
   [in, string] WCHAR* Name,
   [in] DWORD NameType,
   [in] DWORD Flags
 );

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.

Name: A pointer to a null-terminated UTF-16 string that specifies the name to check.

NameType: The type of Name. It MUST be one of the values defined in section 2.2.2.8.

Flags: Reserved, MUST be zero.

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.

If the Flags parameter is not equal to zero, the server SHOULD fail the call with an implementation-specific error code.<120>

In response to a NetprNameValidate message, the server MUST validate the value of the Name parameter to ensure that it contains only the characters that are allowed for the specified NameType and that the length of the Name parameter is no greater than the maximum allowed length for its NameType (as specified in section 2.2.2.8).

The NameType parameter determines what validation is done on the name that is specified by the Name parameter. Valid values for the NameType parameter are as specified in section 2.2.2.8. If the NameType parameter does not have a valid value, the server MUST fail the call with an ERROR_INVALID_PARAMETER error code.

The value of NameType identifies the minimum and maximum lengths for a particular NameType and the characters that are permitted in a name for that NameType. The server MUST validate the specified name by being sure that its length is within the minimum and maximum lengths for its type and that there are no characters in its name that are invalid for its type. If any of these checks fail, the server MUST fail the call with an ERROR_INVALID_NAME error code.

The server MAY<121> enforce security measures to verify that the caller has the required permissions to execute this call. If the server enforces these security measures and the caller does not have the required credentials, the server SHOULD<122> fail the call.