22.214.171.124.18 RpcSetPrinterDataEx (Opnum 77)
RpcSetPrinterDataEx sets the configuration data for a printer or print server.<344> This method is similar to RpcSetPrinterData (section 126.96.36.199.8) but additionally allows the caller to specify the registry key under which to store the data.
DWORD RpcSetPrinterDataEx( [in] PRINTER_HANDLE hPrinter, [in, string] const wchar_t* pKeyName, [in, string] const 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 188.8.131.52.3), RpcAddPrinterEx (section 184.108.40.206.15), RpcOpenPrinter (section 220.127.116.11.2), or RpcOpenPrinterEx (section 18.104.22.168.14).
pKeyName: A pointer to a string that specifies the key under which the value is to be set. A key name is an arbitrary string defined by the printer driver associated with the printer object. For rules governing key names, see section 22.214.171.124.
If hPrinter is a handle to a server object, the key name can be NULL, and the server MUST ignore this parameter.
pValueName: A pointer to a string that identifies the data to set. For rules governing value names, see section 126.96.36.199.
For print servers, a value name MUST be one of the predefined strings listed in Server Handle Key Values (section 188.8.131.52).
For printer objects, a value name is an arbitrary string defined by the printer driver associated with the printer object. The value name "ChangeID"<345> is reserved by the protocol and MAY NOT be used in a call to RpcSetPrinterDataEx.
Type: A code that indicates the type of data that is pointed to by the pData parameter. The value SHOULD be one of the possible type codes defined by type values in section 184.108.40.206. For rules governing registry type values, see section 220.127.116.11.
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, as specified in [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 18.104.22.168.11).
If the hPrinter parameter is a handle to a printer object, the server MUST verify that the pKeyName parameter points to a string that complies with the rules for key names specified in section 22.214.171.124.
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 (section 126.96.36.199) 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 188.8.131.52.
Additional validation SHOULD<346> 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:
If the hPrinter parameter is a handle to a printer object, store the data that is provided by pData with the type that is supplied by Type in the printer data value that is identified by pKeyName and pValueName.
If hPrinter is a handle to a server object, store the data that is provided by pData with the type that is supplied by Type in the server data value that is identified by the pValueName parameter.
Return the status of the operation.