bool get_printer(handle printer,
                 unsigned level,
                 byte* printer,
                 unsigned size,
                 unsigned* required)

This function obtains information about a printer.


handle printer

The handle of the printer for which information is being sought.

unsigned level

The level of information to be stored in the given buffer. This can be 1, 2, 3, 4, 5 or 7.

byte* status

A pointer to a buffer to receive the information. about the specified printer. The buffer must be large enough to accommodate the structure and any data that the members of the structure point to. If the buffer is insufficient in size, the value *Required is set to be the required buffer size. The type of structure that is returned is determined by the value of previous parameter - as depicted in the table below.

Level wclass Brief Description
1 printer_information1 Contains general printer information.
2 printer_information2 Contains detailed information about the printer.
3 printer_information3 Contains the printer's security information.
4 printer_information4 Contains minimal printer information.
5 printer_information5 Contains printer information such as attributes and time-out settings.
7 printer_information7 Indicates whether the printer is published in the directory service.

unsigned size

The size (in bytes) of the buffer supplied by the previous parameter.

unsigned* required

A pointer to a variable that is updated to hold the size (in bytes) of the printer information. If the specified buffer size is smaller than this value, the function sets the value to the required buffer size and returns false. If the given buffer size is adequate, the value is set to the number of bytes stored in the buffer.



true The function succeeded.
false The call failed.


The level 2 and level 3 printer information classes contain a pointer to a security descriptor. This function obtains only the components of the descriptor that the caller has permission to read. To obtain a particular descriptor component, the necessary access rights must be specified when opening the printer. The following table shows the access rights required to read security descriptor components.

Access Right Security Descriptor Component
access_type::read Owner Primary Group
Discretionary Access Control List (DACL)
access_type::system_security System Access Control List (SACL)