4.1 Connect to the Server

To begin, the client creates an RPC binding handle to the server with the "ncacn_ip_tcp" protocol sequence and the RPC_C_AUTHN_WINNT authentication method.

The client then establishes a Session Context with the server by using the EcDoConnectEx method, as described in section 3.1.4.1, and sets the parameters as follows:

hBinding: Binding handle returned from the EcDoConnectEx method call.

pcxh: Pointer to session context handle to hold output value. In this example, the client initializes the session context handle to zero.

szUserDN: "/o=First Organization/ou=First Administrative Group/CN=recipients/CN=janedow" (This is the user's DN. A string that contains the DN of the user who is making the EcDoConnectEx method call in a directory service.)

ulFlags: 0x00000000 (Regular user access.)

ulConMod: 0x00340567 (Client-computed hash on the szUserDN parameter value.)

cbLimit: 0x00000000

ulCpid: 0x000004E4 (Code page 1252.)

ulLcidString: 0x00000409 (Locale 1033 "en-us".)

ulLcidSort: 0x00000409 (Locale 1033 "en-us".)

ulIcxrLink: 0xFFFFFFFF (No session link.)

usFCanConvertCodePages: 0x0001

rgwClientVersion: Pointer to unsigned short array containing values 0x000C, 0x183E, and 0x03E8. Client supports protocol client version 12.6206.1000.

pulTimeStamp: Pointer to unsigned long value 0x00000000.

rgbAuxIn: NULL pointer value.

cbAuxIn: 0x00000000

rgbAuxOut: Pointer to buffer of size 0x1008.

pcbAuxOut: Pointer to unsigned long value 0x00001008.

The server processes the EcDoConnectEx method request. The server verifies that authentication context associated with the hBinding parameter binding handle has ownership privileges to a directory service object that contains a DN that is in the szUserDN parameter. The server creates a Session Context and assigns a session context handle (using 0x00001234 for this example). The server returns the following output values:

pcxh: Value at session context handle pointer is 0x00001234. Note that the actual RPC context handle returned to the client in this parameter might not be what the server returned. The RPC layer on the server and client might map the context handle. The context handle returned to the client is guaranteed to be unique and will map back to the server-assigned context handle if used on subsequent calls to the server.

pcmsPollsMax: Value at unsigned long pointer is 0x0000EA60. (The client is instructed to poll for events every 60 seconds.)

pcRetry: Value at unsigned long pointer is 0x00000006. (The client is instructed to retry six times before failing.)

pcmsRetryDelay: Value at unsigned long pointer is 0x00001770. (The client is instructed to wait 10 seconds between each retry.)

picxr: Value at unsigned short pointer is a server-assigned session index with value 0x0304.

szDNPrefix: Value at unsigned CHAR pointer is a pointer to a null-terminated ANSI string with value "/o=First Group/ou=First Administrative Group/CN=Configuration/CN=Servers/CN=MBX-SRV-02".

szDisplayName: Value at unsigned CHAR pointer is a pointer to a null-terminated ANSI string with value "MBX-SRV-02".

rgwServerVersion: Value at unsigned short array contains values 0x0008, 0x82B4, and 0x0003. (Server supports protocol server version 8.0.692.3.)

rgwBestVersion: Value at unsigned short array contains values 0x000C, 0x183E, and 0x03E8.

pulTimeStamp: Value at unsigned long pointer is a 32-bit value that represents the internal server time when the Session Context was created.

rgbAuxOut: The server returns the following extended buffer and payload containing auxiliary information.

RPC_HEADER_EXT

Payload

AUX_HEADER

AUX_EXORGINFO

Version

Flags

Size

SizeActual

Size

Version

Type

OrgFlags

0x0000

0x0004

0x0008

0x0008

0x0008

0x01

0x17

0x00000001

(Payload is not compressed and not obfuscated.)

pcbAuxOut: Value at unsigned long pointer is 0x00000010. (The rgbAuxOut parameter is 16 bytes in length.)

Return Value: 0x00000000