3.1.4.2.20 RpcEnumPrinterDataEx (Opnum 79)

RpcEnumPrinterDataEx enumerates all value names and data for a specified printer and key.<304> This method is similar to RpcEnumPrinterData (section 3.1.4.2.16) but also allows the caller to specify the registry key from which to enumerate the data, and allows retrieving several values in a single call.

 DWORD RpcEnumPrinterDataEx(
   [in] PRINTER_HANDLE hPrinter,
   [in, string] const wchar_t* pKeyName,
   [out, size_is(cbEnumValues)] BYTE* pEnumValues,
   [in] DWORD cbEnumValues,
   [out] DWORD* pcbEnumValues,
   [out] DWORD* pnEnumValues
 );

hPrinter: A handle to a printer object that was opened by RpcAddPrinter (section 3.1.4.2.3), RpcAddPrinterEx (section 3.1.4.2.15), RpcOpenPrinter (section 3.1.4.2.2), or RpcOpenPrinterEx (section 3.1.4.2.14).

pKeyName: A pointer to a string that specifies the key containing the values to enumerate. A key name is an arbitrary string defined by the printer driver associated with the printer object. For rules governing key names, see section 2.2.4.7.

pEnumValues: A pointer to BUFFER as specified in PRINTER_ENUM_VALUES Structures Query Parameters (section 3.1.4.1.10).

This parameter can be NULL if cbEnumValues equals zero.

cbEnumValues: A parameter specified in PRINTER_ENUM_VALUES Structures Query Parameters.

pcbEnumValues: A parameter specified in PRINTER_ENUM_VALUES Structures Query Parameters.

pnEnumValues: A parameter specified in PRINTER_ENUM_VALUES Structures Query Parameters.

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 specified in PRINTER_HANDLE Parameters (section 3.1.4.1.11). This method SHOULD assume that the handle to the printer object can be used without further access checks.

  • Verify that the pKeyName parameter points to a string that complies with the rules for key names specified in section 2.2.4.7. If this verification fails, return ERROR_INVALID_PARAMETER.

  • Perform the validation steps specified in PRINTER_ENUM_VALUES Structures Query Parameters.

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:

  • Enumerate all the values referenced by the specified printer data key.

  • Using the enumerated objects, perform the processing and response steps specified in PRINTER_ENUM_VALUES Structures Query Parameters.

  • Return the status of the operation.