Partager via


3.1.4.34 NetprNameCompare (Opnum 35)

The NetprNameCompare method does comparison of two names of a specific name type.

 long NetprNameCompare(
   [in, string, unique] SRVSVC_HANDLE ServerName,
   [in, string] WCHAR* Name1,
   [in, string] WCHAR* Name2,
   [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.

Name1: A pointer to a null-terminated UTF-16 string that contains the first name to compare.

Name2: A pointer to a null-terminated UTF-16 string that contains the second name to compare.

NameType: The type of names, as specified in section 2.2.2.8.

Flags: A bitmask that MUST contain the bitwise OR of zero or more of the following values, which specify controlling flags.

Value

Meaning

0x80000000

Enable LM2.x compatibility.

0x00000001

SHOULD be set if both names have already been canonicalized (by using NetprNameCanonicalize).

Return Values: MUST return 0 if both paths are the same. Other values indicate that either the paths are different or an error occurred when the client request was processed.

In response to a NetprNameCompare message, the server MUST compare the two names that are specified as parameters to ensure that they contain only the characters that are allowed for the specified NameType and that the length is no greater than the maximum allowed length for its NameType (as specified in section 2.2.2.8). If the supplied names are not canonicalized, the server MUST do the canonicalization of the names.

The Name1 parameter and Name2 parameter specify the two names to be compared.

The Flags parameter is a bitmask that specifies certain controlling flags that affect how the server processes this message. The valid bits are 0x80000000 and 0x1. If any other bit is set, the server MUST fail the call with an ERROR_INVALID_PARAMETER error code.

If (Flags & 0x80000000) is true, it implies that the server MUST enable NTLM version 2.x compatibility. This implies that the rules that are used for comparison and canonicalization (if needed) MUST be those that are defined for NTLM version 2.x. For details about the effect on canonicalization, see NetprNameCanonicalize (Opnum 34) (section 3.1.4.33). With respect to comparison, if (Flags & 0x80000000) is true and the NameType being compared is NAMETYPE_PASSWORD, NAMETYPE_SHAREPASSWORD, NAMETYPE_MESSAGE, or NAMETYPE_MESSAGEDEST, the server MUST perform a case-sensitive comparison. Otherwise, the server MUST perform a case-insensitive comparison.

If (Flags & 0x1) is true, the names that are specified by Name1 and Name2 are already canonicalized, and the NameType parameter MUST specify the name type for the two names. Valid values for the NameType parameter are listed in Name Types (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.

If (Flags & 0x1) is not true, the server MUST canonicalize the specified names and obtain their name types, as specified in NetprNameCanonicalize (section 3.1.4.33). If this fails, the server MUST fail the call with an ERROR_INVALID_PARAMETER error code.

The server MUST compare the canonicalized version of the names, if the names were not already canonicalized; otherwise, it MUST compare the original names and MUST return 0 if both names are the same, –1 if Name1 is less than Name2, and 1 if Name1 is greater than Name2. The comparison is implementation-specific.<125>

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