Compartilhar via


3.1.4.2.16 RpcEnumPrinterData (Opnum 72)

RpcEnumPrinterData enumerates configuration data for a specified printer.<292>

 DWORD RpcEnumPrinterData(
   [in] PRINTER_HANDLE hPrinter,
   [in] DWORD dwIndex,
   [out, size_is(cbValueName/sizeof(wchar_t))] 
     wchar_t* pValueName,
   [in] DWORD cbValueName,
   [out] DWORD* pcbValueName,
   [out] DWORD* pType,
   [out, size_is(cbData)] BYTE* pData,
   [in] DWORD cbData,
   [out] DWORD* pcbData
 );

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).

dwIndex: The index of the configuration data value to retrieve. The value MUST be greater than or equal to zero and less than the total number of configuration data values for the printer. The client SHOULD use RpcEnumPrinterKeys to determine the total number of configuration data values for the printer.

pValueName: A pointer to a buffer that receives a string specifying the name of the configuration data value. For rules governing value names, see section 2.2.4.18.

This parameter can be NULL if cbValueName equals zero.

cbValueName: The size, in bytes, of the buffer that is pointed to by the pValueName parameter.

pcbValueName: A pointer to a variable that receives the number of bytes stored in the buffer that is pointed to by the pValueName parameter.

pType: A parameter specified in Dynamically Typed Query Parameters (section 3.1.4.1.2).

pData: A pointer to BUFFER as specified in Dynamically Typed Query Parameters. This parameter can be NULL if cbData equals zero.

cbData: A parameter specified in Dynamically Typed Query Parameters.

pcbData: A parameter specified in Dynamically Typed 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 value of the cbValueName parameter is not smaller than the number of bytes required to hold the string that specifies the name of the value. If that verification fails, the server MUST update the variable that is pointed to by the pcbValueName parameter with the number of bytes required and return ERROR_MORE_DATA [MS-ERREF].

  • Verify that the value of the dwIndex parameter is greater than or equal to zero, and smaller than the total number of values for the printer. If dwIndex is greater than or equal to the number of values available for the printer, the server MUST return ERROR_NO_MORE_ITEMS, as specified in [MS-ERREF]

  • Perform the validation steps specified in Dynamically Typed 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:

  • Store the name of the printer property in the string buffer that is pointed to by the pValueName parameter and store the length of the name stored in the variable that is pointed to by the pcbValueName parameter.

  • Using the data identified by pValueName,<293> perform the processing and response steps specified in Dynamically Typed Query Parameters.

  • Return the status of the operation.