GetPrinterDataFromPort function pointer

A port monitor's GetPrinterDataFromPort function obtains status information from a bidirectional printer and returns it to the caller.

Syntax


typedef BOOL ( WINAPI *pfnGetPrinterDataFromPort)(
  _In_   HANDLE hPort,
  _In_   DWORD ControlID,
  _In_   LPWSTR pValueName,
  _In_   LPWSTR lpInBuffer,
  _In_   DWORD cbInBuffer,
  _Out_  LPWSTR lpOutBuffer,
  _In_   DWORD cbOutBuffer,
  _Out_  LPDWORD lpcbReturned
);

Parameters

hPort [in]

Caller-supplied port handle.

ControlID [in]

Caller-supplied device I/O control code. A value of zero indicates a value name is supplied by pValueName. See the following Remarks section.

pValueName [in]

Caller-supplied pointer to a string identifying the information being requested. Valid only if ControlID is zero. See the following Remarks section.

lpInBuffer [in]

Caller-supplied pointer to a buffer containing input data. Used only if ControlID is nonzero. See the following Remarks section.

cbInBuffer [in]

Caller-supplied size, in bytes, of the buffer pointed to by lpInBuffer.

lpOutBuffer [out]

Caller-supplied pointer to a buffer to receive the requested data.

cbOutBuffer [in]

Caller-supplied size, in bytes, of the buffer pointed to by lpOutBuffer.

lpcbReturned [out]

Caller-supplied pointer to a location to receive the number of bytes written into the buffer pointed to by lpOutBuffer.

Return value

If the operation succeeds, the function should return TRUE. Otherwise it should return FALSE.

Requesting a Language Monitor to Poll the Printer Port

Requesting a Port Monitor to Send an I/O Control Code

Remarks

Language monitors and port monitor server DLLs can optionally define a GetPrinterDataFromPort function and include the function's address in a MONITOR2 structure.

The function is meant for use with bidirectional printers, and can be used in the following two ways:

  • As a means for requesting a language monitor to poll the printer port, to obtain the current value of printer-specific information that is stored in the registry.

  • As a means for requesting a port monitor to send an I/O control code to the port driver.

If a language monitor's GetPrinterDataFromPort function receives a string pointer in pValueName, it should return a value in the supplied output buffer. Typically, the string represents a registry value name, and the spooler calls GetPrinterDataFromPort when an application calls the GetPrinterData function (described in the Microsoft Windows SDK documentation).

The language monitor's responsibility is to send a command to the printer hardware by calling the port monitor's WritePort function, and reading the response by calling ReadPort, to obtain the needed value. For example, pjlmon.dll, the sample language monitor, can return values for a port's "Installed Memory" and "Available Memory" registry value names.

After the spooler calls GetPrinterDataFromPort to obtain a registry value, it updates the registry with the new value.

Typically, port monitors do not support calls to GetPrinterDataFromPort that include a string pointer in pValueName.

If a language monitor's GetPrinterDataFromPort function receives a nonzero I/O control code in ControlID, it should just call the associated port monitor's GetPrinterDataFromPort function and return the result. The Kernel-Mode Drivers Reference lists I/O control codes for parallel and serial ports.

When a port monitor's GetPrinterDataFromPort function receives a nonzero I/O control code in ControlID, it should call DeviceIOControl (described in the Windows SDK documentation) to pass the control code to the kernel-mode port driver. The lpInBuffer, cbInBuffer, lpOutBuffer, cbOutBuffer, and lpcbReturned parameter values should also be passed to DeviceIOControl.

Requirements

Header

Winsplp.h (include Winsplp.h)

See also

WritePort
ReadPort

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft