220.127.116.11.9 RpcClosePrinter (Opnum 29)
RpcClosePrinter closes a handle to a printer object, server object, job object, or port object.
DWORD RpcClosePrinter( [in, out] PRINTER_HANDLE* phPrinter );
phPrinter: A pointer to a handle to a printer object, server object, job object, or port object that was opened by RpcAddPrinter (section 18.104.22.168.3), RpcAddPrinterEx (section 22.214.171.124.15), RpcOpenPrinter (section 126.96.36.199.2), or RpcOpenPrinterEx (section 188.8.131.52.14).
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 184.108.40.206.11). This method SHOULD assume that the handle to the printer object, server object, job object, or port object can be used without further access checks.
If parameter validation fails, the server MUST fail the operation immediately and return a nonzero error response to the client.
Otherwise, the server MUST process the message and compose a response to the client as follows:
If there is an active notification context associated with the object, as a result of the client not calling RpcFindClosePrinterChangeNotification, the server MUST close the notification context now by calling the client's RpcReplyClosePrinter method.
Free any internal state that is associated with the handle that is pointed to by phPrinter.
Store NULL in the variable that is pointed to by phPrinter.
Decrement the reference count on that object.
If the object is a printer object marked as "Delete Pending", and the usage count is zero, the following steps MUST be performed:
Handle any pending jobs in an implementation-specific manner.
Clear references to this printer from any other data structures.
Delete the printer object.
Return the status of the operation.