GdiGetSpoolFileHandle - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTUSER_H

// rev
/**
 * The GdiGetSpoolFileHandle routine provides the operation described below.
 *
 * DeviceName is passed to CreateDCW; SpoolerName is passed to OpenPrinterW.
 *
 * \param DeviceName The device name argument.
 * \param DeviceMode The device mode argument.
 * \param SpoolerName The spooler name argument.
 *
 * \returns The HANDLE result described above.
 */
NTSYSAPI
HANDLE
NTAPI
GdiGetSpoolFileHandle(
    _In_ PWSTR DeviceName,
    _In_opt_ PDEVMODEW DeviceMode,
    _In_ PWSTR SpoolerName
    );

#endif

View code on GitHub
// winppi.h

HANDLE GdiGetSpoolFileHandle(
  LPWSTR     pwszPrinterName,
  LPDEVMODEW pDevmode,
  LPWSTR     pwszDocName
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-winppi-gdigetspoolfilehandle)

Description

The GdiGetSpoolFileHandle function returns a handle to a print job's EMF file.

Parameters

pwszPrinterName

Caller-supplied pointer to a string representing the name of the target printer. See the following Remarks section.

pDevmode

Caller-supplied pointer to a DEVMODEW structure. See the following Remarks section.

pwszDocName

Caller-supplied pointer to the print job's document name. See the following Remarks section.

Return value

If the operation succeeds, the function returns a spool file handle. Otherwise the function returns NULL.

Remarks

The GdiGetSpoolFileHandle function is exported by gdi32.dll for use within a print processor's PrintDocumentOnPrintProcessor function.

When a print processor calls GdiGetSpoolFileHandle, it should supply arguments as illustrated in the following table.

Parameter Argument
pwszPrinterName Pointer to the printer name received by the print processor's OpenPrintProcessor function.
pDevmode Pointer to the DEVMODEW structure contained in the PRINTPROCESSOROPENDATA structure, received by the print processor's OpenPrintProcessor function.
pwszDocName Document name pointer received by the print processor's PrintDocumentOnPrintProcessor function.

A print processor must call the GdiGetSpoolFileHandle function before calling any other GDI printing functions, because the returned handle must be passed to the other functions. The function calls OpenPrinter to open a connection to the printer, and CreateDC to create a device context for drawing. The print processor can obtain the device context's handle by calling GdiGetDC.

For additional information, see Using GDI Functions in Print Processors.

See also

GdiDeleteSpoolFileHandle