RpcSetPrinterData (Opnum 27)

RpcSetPrinterData sets the configuration data for a printer or print server.

 DWORD RpcSetPrinterData(
   [in] PRINTER_HANDLE hPrinter,
   [in, string] wchar_t* pValueName,
   [in] DWORD Type,
   [in, size_is(cbData)] BYTE* pData,
   [in] DWORD cbData

hPrinter: A handle to a printer object or server object that was opened by RpcAddPrinter (section, RpcAddPrinterEx (section, RpcOpenPrinter (section, or RpcOpenPrinterEx (section

pValueName: A pointer to a string that identifies the configuration data to set. For rules governing value names, see section

For print servers, the value name is one of the predefined strings listed in Server Handle Key Values (section

For printer objects, the value name is an arbitrary string defined by the printer driver associated with the printer object. The value name "ChangeID"<265> is reserved by the protocol and MUST NOT be used in a call to RpcSetPrinterData.

Type: The type value for data pointed to by the pData parameter. This value SHOULD be one of the type codes defined in section For rules governing registry type values, see section

pData: A pointer to an array of bytes that contain the printer configuration data. The type of the data in the buffer is specified by the Type parameter.

cbData: The size, in bytes, of the pData array. This value SHOULD NOT be zero.

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 validates parameters as follows:

  • The server MUST perform the validation steps that are specified in PRINTER_HANDLE Parameters (section,.

  • For server objects, the server MUST verify that the pValueName parameter points to a string that is one of the predefined value names listed in Server Handle Key Values with the "read-write" column selected. If this verification fails, return ERROR_INVALID_PARAMETER.

  • For printer objects, the server MAY verify that the pValueName parameter points to a string that complies with the rules specified in section

  • Additional validation SHOULD<266> be performed.

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:

  • Set the printer data associated with pValueName to the data pointed to by pData.<267>

  • Return the status of the operation.