RpcEnumPrinterDrivers (Opnum 10)

RpcEnumPrinterDrivers enumerates the printer drivers installed on a specified print server.

 DWORD RpcEnumPrinterDrivers(
   [in, string, unique] STRING_HANDLE pName,
   [in, string, unique] wchar_t* pEnvironment,
   [in] DWORD Level,
   [in, out, unique, size_is(cbBuf), disable_consistency_check] 
     BYTE* pDrivers,
   [in] DWORD cbBuf,
   [out] DWORD* pcbNeeded,
   [out] DWORD* pcReturned

pName: Specified in Print Server Name Parameters (section

pEnvironment: Specified in Environment Name Parameters (section<311>

Level: The driver information level.




Corresponds to _DRIVER_INFO_1 (section


Corresponds to _DRIVER_INFO_2 (section


Corresponds to _DRIVER_INFO_3 (section


Corresponds to _DRIVER_INFO_4 (section


Corresponds to _DRIVER_INFO_5 (section


Corresponds to _DRIVER_INFO_6 (section


Corresponds to _DRIVER_INFO_8 (section

pDrivers: A pointer to the BUFFER, as specified in INFO Structures Query Parameters (section


This parameter can be NULL if cbBuf equals zero.

cbBuf: Specified in INFO Structures Query Parameters (section

pcbNeeded: Specified in INFO Structures Query Parameters (section

pcReturned: Specified in INFO Structures Query Parameters (section

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 perform the validation steps specified in the following sections:

  • Print Server Name Parameters (section

  • Environment Name Parameters (section

  • INFO Structures Query Parameters (section

Additional validation MAY<312> be performed.

In addition, the print server SHOULD<313> validate that, if the Level parameter is 0x00000065, every printer driver installed on the print server has a driver version strictly less than 0x00000004. If that validation fails, this method MUST return ERROR_CAN_NOT_COMPLETE.

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 drivers on the specified print server that match the requested environment.

  • Using the enumerated objects, perform the processing and response steps specified in INFO Structures Query Parameters (section

  • If at any point during the operation the print server failed to calculate the size of the INFO structure for any printer driver, the print server SHOULD fail the operation immediately and return ERROR_CAN_NOT_COMPLETE.<314>

  • Return the status of the operation.