The PRINTER_INFO_7 structure specifies directory services printer information. Use this structure with the SetPrinter function to publish a printer's data in the directory service (DS), or to update or remove a printer's published data from the DS. Use this structure with the GetPrinter function to determine whether a printer is published in the DS.
Syntax
typedef struct _PRINTER_INFO_7 {
LPTSTR pszObjectGUID;
DWORD dwAction;
} PRINTER_INFO_7, *PPRINTER_INFO_7;
Members
pszObjectGUID
A pointer to a null-terminated string containing the GUID of the directory service print queue object associated with a published printer. Use the GetPrinter function to retrieve this GUID.
Before calling SetPrinter, set pszObjectGUID to NULL.
dwAction
Indicates the action for the SetPrinter function to perform. For the GetPrinter function, this member indicates whether the specified printer is published. This member can be a combination of the following values.
| Value | Meaning |
|---|---|
| DSPRINT_PENDING 0x80000000 | GetPrinter: Indicates that the system is attempting to complete a publish or unpublish operation started by a SetPrinter call. SetPrinter: This value is not valid. |
| DSPRINT_PUBLISH 0x00000001 | SetPrinter: Publishes the printer's data in the DS. GetPrinter: Indicates the printer is published. |
| DSPRINT_REPUBLISH 0x00000008 | SetPrinter: The DS data for the printer is unpublished and then published again, refreshing all properties in the published printer. Re-publishing also changes the GUID of the published printer. GetPrinter: Never returns this value. |
| DSPRINT_UNPUBLISH 0x00000004 | SetPrinter: Removes the printer's published data from the DS. GetPrinter: Indicates the printer is not published. |
| DSPRINT_UPDATE 0x00000002 | SetPrinter: Updates the printer's published data in the DS. GetPrinter: Never returns this value. |
Remarks
The PRINTER_INFO_7 structure is used in a SetPrinter call to publish printer information to the directory service. The published data includes all values and data for the specified printer found under the SPLDS_SPOOLER_KEY, SPLDS_DRIVER_KEY, or SPLDS_USER_KEY keys created by SetPrinterDataEx.
For SetPrinter, pszObjectGUID should be set to NULL. For GetPrinter, pszObjectGUID returns the GUID of the directory services print queue object associated with a published printer. You can use this GUID with Active Directory Services Interface (ADSI) methods to retrieve published data for the printer. However, the recommended method for retrieving published data is to call the GetPrinterDataEx function.
Requirements
| Requirement | Value |
|---|---|
| Minimum supported client | Windows 2000 Professional [desktop apps only] |
| Minimum supported server | Windows 2000 Server [desktop apps only] |
| Header | Winspool.h (include Windows.h) |
| Unicode and ANSI names | _PRINTER_INFO_7W (Unicode) and _PRINTER_INFO_7A (ANSI) |
See also
Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
