18.104.22.168.1 RpcWaitForPrinterChange (Opnum 28)
RpcWaitForPrinterChange retrieves information about the most recent change notification that is associated with a printer or print server.
DWORD RpcWaitForPrinterChange( [in] PRINTER_HANDLE hPrinter, [in] DWORD Flags, [out] DWORD* pFlags );
hPrinter: A handle to a printer object or server object that was opened by RpcAddPrinter (section 22.214.171.124.3), RpcAddPrinterEx (section 126.96.36.199.15), RpcOpenPrinter (section 188.8.131.52.2), or RpcOpenPrinterEx (section 184.108.40.206.14).
Flags: The change notifications to wait for. The value of this parameter is a bitwise OR of one or more printer change values, defined in sections 220.127.116.11.1 and 18.104.22.168.2. For rules governing printer change values, see section 22.214.171.124.
pFlags: A pointer to a variable that receives the bitwise OR combination of one or more printer change values.
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 server MUST validate parameters as follows:
Perform the validation steps that are specified in PRINTER_HANDLE Parameters, section 126.96.36.199.11. This method SHOULD assume that the handle to the printer or server object can be used without further access checks.
If parameter validation fails, the server MUST fail the operation immediately, returning a nonzero error response to the client. Otherwise, the server MUST process the message and compose a response to the client as follows:
Add the client and the requested change notifications to the list of notification clients for the printer or server object.
Wait for an implementation-specific period of time,<363> or until one of the changes specified by the value of the Flags parameter occurs.
Remove the client from the list of notification clients for the printer or server object.
If the hPrinter handle is closed with RpcClosePrinter (section 188.8.131.52.9) during this wait period, return ERROR_INVALID_HANDLE.
If one or more of the specified changes occurred within the time-out period, write a bitwise OR combination of the changes to the variable that is pointed to by pFlags and return zero.
If the time-out period has expired without any of the specified changes, return PRINTER_CHANGE_TIMEOUT [MS-ERREF].
Note: Because this method waits for an implementation-specific, potentially long, period of time, it can cause the client system to stop responding. Therefore, this method is deprecated and SHOULD NOT be used. The implementer of a protocol client SHOULD consider using RpcRemoteFindFirstPrinterChangeNotificationEx instead.