// winsplp.h
typedef struct _MONITOR2 {
DWORD cbSize;
BOOL( )(HANDLE hMonitor,LPWSTR pName,DWORD Level,LPBYTE pPorts,DWORD cbBuf,LPDWORD pcbNeeded,LPDWORD pcReturned) *pfnEnumPorts;
BOOL( )(HANDLE hMonitor,LPWSTR pName,PHANDLE pHandle) *pfnOpenPort;
BOOL()(HANDLE hMonitor,HANDLE hMonitorPort,LPWSTR pPortName,LPWSTR pPrinterName,PHANDLE pHandle,_MONITOR2 *pMonitor2) * pfnOpenPortEx;
BOOL( )(HANDLE hPort,LPWSTR pPrinterName,DWORD JobId,DWORD Level,LPBYTE pDocInfo) *pfnStartDocPort;
BOOL( )(HANDLE hPort,LPBYTE pBuffer,DWORD cbBuf,LPDWORD pcbWritten) *pfnWritePort;
BOOL( )(HANDLE hPort,LPBYTE pBuffer,DWORD cbBuffer,LPDWORD pcbRead) *pfnReadPort;
BOOL( )(HANDLE hPort) *pfnEndDocPort;
BOOL( )(HANDLE hPort) *pfnClosePort;
BOOL( )(HANDLE hMonitor,LPWSTR pName,HWND hWnd,LPWSTR pMonitorName) *pfnAddPort;
BOOL( )(HANDLE hMonitor,LPWSTR pName,DWORD Level,LPBYTE lpBuffer,LPWSTR lpMonitorName) *pfnAddPortEx;
BOOL( )(HANDLE hMonitor,LPWSTR pName,HWND hWnd,LPWSTR pPortName) *pfnConfigurePort;
BOOL( )(HANDLE hMonitor,LPWSTR pName,HWND hWnd,LPWSTR pPortName) *pfnDeletePort;
BOOL( )(HANDLE hPort,DWORD ControlID,LPWSTR pValueName,LPWSTR lpInBuffer,DWORD cbInBuffer,LPWSTR lpOutBuffer,DWORD cbOutBuffer,LPDWORD lpcbReturned) *pfnGetPrinterDataFromPort;
BOOL( )(HANDLE hPort,LPCOMMTIMEOUTS lpCTO,DWORD reserved) *pfnSetPortTimeOuts;
BOOL( )(HANDLE hMonitor,LPCWSTR pszObject,ACCESS_MASK GrantedAccess,PHANDLE phXcv) *pfnXcvOpenPort;
DWORD( )(HANDLE hXcv,LPCWSTR pszDataName,PBYTE pInputData,DWORD cbInputData,PBYTE pOutputData,DWORD cbOutputData,PDWORD pcbOutputNeeded) *pfnXcvDataPort;
BOOL( )(HANDLE hXcv) *pfnXcvClosePort;
VOID( )(HANDLE hMonitor) *pfnShutdown;
DWORD()(HANDLE hPort,DWORD dwAccessBit,LPCWSTR pAction,PBIDI_REQUEST_CONTAINER pReqData,PBIDI_RESPONSE_CONTAINER *ppResData) * pfnSendRecvBidiDataFromPort;
DWORD()(HANDLE hMonitor,DWORD cPorts,PCWSTR *ppszPorts) * pfnNotifyUsedPorts;
DWORD()(HANDLE hMonitor,DWORD cPorts,PCWSTR *ppszPorts) * pfnNotifyUnusedPorts;
DWORD()(HANDLE hMonitor,DWORD event,POWERBROADCAST_SETTING *pSettings) * pfnPowerEvent;
} MONITOR2, *PMONITOR2, *LPMONITOR2;
View the official Windows Driver Kit DDI referenceNo description available.
The MONITOR2 structure contains pointers to the functions defined by print monitors.
cbSizeSpecifies the size, in bytes, of the MONITOR2 structure.
pfnEnumPortsA port monitor server DLL's EnumPorts function enumerates the ports that the port monitor supports.
pfnOpenPortPointer to the print monitor's OpenPort function.
pfnOpenPortExA language monitor's OpenPortEx function opens a printer port.
pfnStartDocPortA print monitor's StartDocPort function performs the tasks required to start a print job on the specified port.
pfnWritePortPointer to the print monitor's WritePort function.
pfnReadPortPointer to the print monitor's ReadPort function.
pfnEndDocPortA print monitor's EndDocPort function performs the tasks required to end a print job on the specified port.
pfnClosePortPointer to the print monitor's ClosePort function.
pfnAddPort[!CAUTION] The AddPort function is obsolete and should not be used.
AddPort creates a port and adds it to the list of ports currently supported by the specified monitor in the spooler environment.
pfnAddPortEx(Obsolete. Must be NULL.) Pointer to the print monitor's AddPortEx function. (Port monitors only.)
pfnConfigurePort[!CAUTION] The ConfigurePort function is obsolete and should not be used. Use ConfigurePortUI instead.
ConfigurePort is a port management function that configures the specified port.
pfnDeletePort[!CAUTION] The DeletePort function is obsolete and should not be used.
DeletePort deletes a port from the monitor's environment.
pfnGetPrinterDataFromPortPointer to the print monitor's GetPrinterDataFromPort function.
pfnSetPortTimeOutsA port monitor server DLL's SetPortTimeOuts function sets port time-out values for an open port.
pfnXcvOpenPortPointer to the print monitor's XcvOpenPort function. (Port monitors only.)
pfnXcvDataPortPointer to the print monitor's XcvDataPort function. (Port monitors only.)
pfnXcvClosePortPointer to the print monitor's XcvClosePort function. (Port monitors only.)
pfnShutdownPointer to the print monitor's Shutdown function.
pfnSendRecvBidiDataFromPortPointer to the print monitor's SendRecvBidiDataFromPort function.
pfnNotifyUsedPortsPointer to the print monitor's NotifyUsedPorts function.
pfnNotifyUnusedPortsPointer to the print monitor's NotifyUnusedPorts function.
pfnPowerEventPointer to the print monitor's PowerEvent function.
Each language monitor and each port monitor server DLL must provide a MONITOR2 structure. The monitor must supply values for all structure members, and specify the structure's address as the return value for its InitializePrintMonitor2 function.
If a function is not defined, its pointer must be NULL.
The MONITOR2 structure is larger in Windows XP than it was in Windows 2000. In order to ensure that a monitor developed with the Windows XP Driver Development Kit (DDK) will install on Windows XP and Windows 2000, the monitor must do the following:
The following function determines whether the current operating system version is Windows 2000.
BOOL Is_Win2000()
{
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0;
// Initialize the OSVERSIONINFOEX structure.
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = 5;
osvi.dwMinorVersion = 0;
// Initialize the condition mask.
VER_SET_CONDITION( dwlConditionMask, VER_MAJORVERSION, VER_EQUAL );
VER_SET_CONDITION( dwlConditionMask, VER_MINORVERSION, VER_EQUAL );
// Perform the test.
return VerifyVersionInfo(
&osvi,
VER_MAJORVERSION | VER_MINORVERSION,
dwlConditionMask);
}
For a monitor that is loading on Windows 2000, the following code sets the MONITOR2 structure's cbSize member appropriately.
if ( Is_Win2000( ) )
Monitor2.cbSize = MONITOR2_SIZE_WIN2K;