共用方式為


3.1.4.1.5 Printer Name Parameters

pPrinterName: This parameter is a pointer to a string that specifies the name of the printer connection, printer object, server object, job object, or port object. The string that is referenced by this parameter MUST NOT be empty. For rules governing printer names, see section 2.2.4.14.

The individual method sections include the following parameter validation steps by reference:

  • Verify that the string pointed to by pPrinterName is well-formed according to the rules governing printer names. If that verification fails, return the error code ERROR_INVALID_PRINTER_NAME. When the string pointed to by pPrinterName contains a printer name postfix string appended at the end, the server SHOULD:

    • Ignore both the comma character preceding the postfix string and the postfix string.

    • Use only the printer name specified by the prefix string.

    • Validate the prefix string according to the rules governing printer names.

    The server can execute additional implementation-specific validation of the postfix string, including rejecting unsupported postfix string values by returning an implementation-specific error code.

  • For server names, verify that the server name portion of the string corresponds to a server name. If that verification fails, return any of the following error codes: ERROR_INVALID_NAME, ERROR_INVALID_PARAMETER, or ERROR_INVALID_PRINTER_NAME.

    The server SHOULD perform this validation step to ensure correctness with clients that do not derive the RPC binding directly from the STRING_HANDLE parameter.<256>

  • For printer, job, or port names, verify that the remainder of the string corresponds to a printer, job, or port name. If that verification fails, return the error code ERROR_INVALID_PRINTER_NAME.

  • For port and port monitor, open requests by using RpcOpenPrinter or RpcOpenPrinterEx, and verify that the port monitor supports all the optional methods: XcvOpenPort, XcvDataPort, and XcvClosePort. And if that verification fails, return ERROR_INVALID_PRINT_MONITOR.