3.2.3 Initialization

The client MUST perform initialization according to the following rules when calling an RPC method:

  • Either create an RPC binding handle to the server or use an RPC context handle. Details concerning binding handles are as specified in [C706].

  • Use context handles across multiple calls to the server for methods taking a PRINTER_HANDLE.

  • Use handles bound to a single call to the server for name-based methods taking a STRING_HANDLE. An rpc_binding_from_string_binding method MUST be implemented by the client.

  • Reuse a context handle in multiple invocations when creating a print job, such as in a call to RpcOpenPrinter followed by multiple calls to RpcStartPagePrinter and RpcWritePrinter. For an example of this sequence of calls, see section 3.2.4.2.1.

  • A context handle SHOULD be reused in multiple invocations when getting or setting information on a printer, such as in a call to RpcOpenPrinter followed by multiple calls to RpcGetPrinter, RpcGetPrinterData, RpcSetPrinter, or other methods taking a PRINTER_HANDLE or GDI_HANDLE.

  • When creating the RPC binding handle on the named pipe \pipe\spoolss, the client MUST specify an ImpersonationLevel of 2 (Impersonation [MS-SMB2] (section 2.2.13).