3.2.4.1.1 RpcReplyOpenPrinter (Opnum 58)

RpcReplyOpenPrinter establishes a context handle from a print server to a print client.<412> The server uses the RPC context handle returned by this method to send notification data to the client machine.

 DWORD RpcReplyOpenPrinter(
   [in, string] STRING_HANDLE pMachine,
   [out] PRINTER_HANDLE* phPrinterNotify,
   [in] DWORD dwPrinterRemote,
   [in] DWORD dwType,
   [in, range(0,512)] DWORD cbBuffer,
   [in, unique, size_is(cbBuffer), disable_consistency_check] 
     BYTE* pBuffer
 );

pMachine: A string that specifies the print client computer name. It is synonymous with pName, as specified in Print Server Name Parameters (section 3.1.4.1.4).

phPrinterNotify: A pointer to a remote printer RPC context handle that is used by a print server to send notifications to a print client. RPC context handles are specified in [C706].

dwPrinterRemote: A value that is supplied to the server by the dwPrinterLocal parameter of a corresponding call to RpcRemoteFindFirstPrinterChangeNotification (section 3.1.4.10.3) or RpcRemoteFindFirstPrinterChangeNotificationEx (section 3.1.4.10.4). This value MUST NOT be zero.

dwType: A value that MUST be 0x00000001.

cbBuffer: A value that SHOULD be set to zero when sent and MUST be ignored on receipt.

pBuffer: A pointer that SHOULD be set to NULL when sent and MUST be ignored on receipt.

Return Values: This method MUST return zero (ERROR_SUCCESS) to indicate successful completion or a nonzero Windows error code to indicate failure [MS-ERREF].

Upon receiving this message, the client MUST validate parameters by verifying that the pMachine parameter corresponds to the current machine.

This method SHOULD execute without further access checks.

If parameter validation fails, the client MUST fail the operation immediately and return a nonzero error response to the server. Otherwise, the client MUST process the message as follows:

  • Locate the notification state that is identified by the dwPrinterRemote parameter.

  • Create a back channel RPC context handle and associate it with this notification state.

  • Store the back channel RPC context handle in the handle pointed to by phPrinterNotify.

  • Return the status of the operation.<413>