2 * PROJECT: ReactOS Local Port Monitor
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Precompiled Header for all source files
5 * COPYRIGHT: Copyright 2015 Colin Finck (colin@reactos.org)
11 #define WIN32_NO_STATUS
21 #include <ndk/rtlfuncs.h>
25 #include <wine/debug.h>
26 WINE_DEFAULT_DEBUG_CHANNEL(localmon
);
32 * Describes the monitor handle returned by InitializePrintMonitor2.
33 * Manages all available ports in this instance.
35 typedef struct _LOCALMON_HANDLE
37 CRITICAL_SECTION Section
; /** Critical Section for modifying or reading the ports. */
38 LIST_ENTRY FilePorts
; /** Ports created when a document is printed on FILE: and the user entered a file name. */
39 LIST_ENTRY RegistryPorts
; /** Valid ports loaded from the local registry. */
40 LIST_ENTRY XcvHandles
; /** Xcv handles created with LocalmonXcvOpenPort. */
42 LOCALMON_HANDLE
, *PLOCALMON_HANDLE
;
45 * Describes the port handle returned by LocalmonOpenPort.
46 * Manages a legacy port (COM/LPT) or virtual FILE: port for printing as well as its associated printer and job.
48 typedef struct _LOCALMON_PORT
52 PortType_Other
= 0, /** Any port that doesn't belong into the other categories (default). */
53 PortType_FILE
, /** A port created when a document is printed on FILE: and the user entered a file name. */
54 PortType_PhysicalCOM
, /** A physical serial port (COM) */
55 PortType_PhysicalLPT
/** A physical parallel port (LPT) */
58 BOOL bStartedDoc
; /** Whether a document has been started with StartDocPort. */
59 DWORD dwJobID
; /** ID of the printing job we are processing (for later reporting progress using SetJobW). */
60 HANDLE hFile
; /** Handle to the opened port or INVALID_HANDLE_VALUE if it isn't currently opened. */
61 HANDLE hPrinter
; /** Handle to the printer for the job on this port (for using SetJobW). */
62 PLOCALMON_HANDLE pLocalmon
; /** Pointer to the parent LOCALMON_HANDLE structure. */
63 PWSTR pwszMapping
; /** The current mapping of the DOS Device corresponding to this port at the time _CreateNonspooledPort has been called. */
64 PWSTR pwszPortName
; /** The name of this port including the trailing colon. Empty for virtual file ports. */
66 LOCALMON_PORT
, *PLOCALMON_PORT
;
69 * Describes the Xcv handle returned by LocalmonXcvOpenPort.
70 * Manages the required data for the Xcv* calls.
72 typedef struct _LOCALMON_XCV
75 ACCESS_MASK GrantedAccess
;
76 PLOCALMON_HANDLE pLocalmon
;
79 LOCALMON_XCV
, *PLOCALMON_XCV
;
82 extern DWORD cbLocalMonitor
;
83 extern DWORD cbLocalPort
;
84 extern PCWSTR pwszLocalMonitor
;
85 extern PCWSTR pwszLocalPort
;
86 void WINAPI
LocalmonShutdown(HANDLE hMonitor
);
89 BOOL WINAPI
LocalmonClosePort(HANDLE hPort
);
90 BOOL WINAPI
LocalmonEndDocPort(HANDLE hPort
);
91 BOOL WINAPI
LocalmonEnumPorts(HANDLE hMonitor
, PWSTR pName
, DWORD Level
, PBYTE pPorts
, DWORD cbBuf
, PDWORD pcbNeeded
, PDWORD pcReturned
);
92 BOOL WINAPI
LocalmonGetPrinterDataFromPort(HANDLE hPort
, DWORD ControlID
, PWSTR pValueName
, PWSTR lpInBuffer
, DWORD cbInBuffer
, PWSTR lpOutBuffer
, DWORD cbOutBuffer
, PDWORD lpcbReturned
);
93 BOOL WINAPI
LocalmonOpenPort(HANDLE hMonitor
, PWSTR pName
, PHANDLE pHandle
);
94 BOOL WINAPI
LocalmonReadPort(HANDLE hPort
, PBYTE pBuffer
, DWORD cbBuffer
, PDWORD pcbRead
);
95 BOOL WINAPI
LocalmonSetPortTimeOuts(HANDLE hPort
, LPCOMMTIMEOUTS lpCTO
, DWORD Reserved
);
96 BOOL WINAPI
LocalmonStartDocPort(HANDLE hPort
, PWSTR pPrinterName
, DWORD JobId
, DWORD Level
, PBYTE pDocInfo
);
97 BOOL WINAPI
LocalmonWritePort(HANDLE hPort
, PBYTE pBuffer
, DWORD cbBuf
, PDWORD pcbWritten
);
100 BOOL
DoesPortExist(PCWSTR pwszPortName
);
101 DWORD
GetLPTTransmissionRetryTimeout(VOID
);
102 DWORD
GetPortNameWithoutColon(PCWSTR pwszPortName
, PWSTR
* ppwszPortNameWithoutColon
);
105 BOOL WINAPI
LocalmonXcvClosePort(HANDLE hXcv
);
106 DWORD WINAPI
LocalmonXcvDataPort(HANDLE hXcv
, PCWSTR pszDataName
, PBYTE pInputData
, DWORD cbInputData
, PBYTE pOutputData
, DWORD cbOutputData
, PDWORD pcbOutputNeeded
);
107 BOOL WINAPI
LocalmonXcvOpenPort(HANDLE hMonitor
, PCWSTR pszObject
, ACCESS_MASK GrantedAccess
, PHANDLE phXcv
);