3.1.4.9.1 RpcSyncRegisterForRemoteNotifications (Opnum 58)

RpcSyncRegisterForRemoteNotifications opens a notification handle by using a printer handle or print server handle, to listen for remote printer change notifications.

 HRESULT RpcSyncRegisterForRemoteNotifications(
   [in] PRINTER_HANDLE hPrinter,
   [in] RpcPrintPropertiesCollection* pNotifyFilter,
   [out] RMTNTFY_HANDLE* phRpcHandle
 );

hPrinter: A handle to a printer object or print server object opened by using either RpcAsyncOpenPrinter (section 3.1.4.1.1) or RpcAsyncAddPrinter (section 3.1.4.1.2).

pNotifyFilter: A pointer to an RpcPrintPropertiesCollection (section 2.2.4) instance that contains the caller-specified notification filter settings.

phRpcHandle: A pointer to a variable that receives the remote notification handle.

Return Values: This method returns either an HRESULT success value ([MS-ERREF] section 2.1) to indicate successful completion, or an HRESULT error value to indicate failure.

Exceptions Thrown: This method MUST NOT throw any exceptions other than those that are thrown by the underlying RPC protocol [MS-RPCE].

Parameter Validation Requirements: Upon receiving this method call, the server MUST validate parameters as follows:

  • The hPrinter printer object or server object handle MUST NOT be NULL and MUST point to a printer object or server object that can be monitored for notifications.

  • The printer handle MUST be authorized to monitor printer objects for notifications.<30>

  • The pNotifyFilter parameter MUST point to an RpcPrintPropertiesCollection instance that has all the name-value pairs required to register for notifications.

If parameter validation fails, the server MUST return immediately with a failure indication in its response to the client.

Processing and Response Requirements: If parameter validation succeeds, the server MUST process the method call by:

  • Creating a notification object that points to the printer object or server object and contains notification filter data sent by the client.

  • Adding the notification object to the list of notification clients for the printer object or server object.

  • Associating the notification object with an RPC handle and returning the handle to the user.

If the operation is successful, when the client calls RpcAsyncGetRemoteNotifications (section 3.1.4.9.4) with the RPC handle returned from this method, the server MUST return the changes to the object indicated by the notification filter settings since the previous call to the same method.