共用方式為


5.50 DSNAME

DSNAME is a concrete type for representing a DSName, identifying a directory object using the values of one or more of its LDAP attributes: objectGUID, objectSid, or distinguishedName.

 typedef struct {
   unsigned long structLen;
   unsigned long SidLen;
   GUID Guid;
   NT4SID Sid;
   unsigned long NameLen;
   [range(0, 10485761)] [size_is(NameLen + 1)] 
     WCHAR StringName[];
 } DSNAME;

structLen: The length, in bytes, of the entire data structure.

SidLen: The number of bytes in the Sid field used to represent the object's objectSid attribute value. Zero indicates that the DSNAME does not identify the objectSid value of the directory object.

Guid: The value of the object's objectGUID attribute specified as a GUID structure, which is defined in [MS-DTYP] section 2.3.4. If the values for all fields in the GUID structure are zero, this indicates that the DSNAME does not identify the objectGUID value of the directory object.

Sid: The value of the object's objectSid attribute, its security identifier, specified as a SID structure, which is defined in [MS-DTYP] section 2.4.2. The size of this field is exactly 28 bytes, regardless of the value of SidLen, which specifies how many bytes in this field are used. Note that this is smaller than the theoretical size limit of a SID, which is 68 bytes. While Windows publishes a general SID format, Windows never uses that format in its full generality. 28 bytes is sufficient for a Windows SID.

NameLen: The number of characters in the StringName field, not including the terminating null character, used to represent the object's distinguishedName attribute value. Zero indicates that the DSNAME does not identify the distinguishedName value of the directory object.

StringName: A null-terminated Unicode value of the object's distinguishedName attribute, as specified in [MS-ADTS] section 3.1.1.1.4. This field always contains at least one character: the terminating null character. Each Unicode value is encoded as 2 bytes. The byte ordering is little-endian.<48>

The following table shows an alternative representation of this structure.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

structLen

SidLen

Guid.Data1

Guid.Data2

Guid.Data3

Guid.Data4...

...Guid.Data4

Sid...

...Sid...

...Sid...

...Sid...

...Sid...

...Sid...

...Sid

NameLen

StringName (Variable Length) ...

Note All fields have little-endian byte ordering.