Home | History | Annotate | Download | only in port_monitor
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CLOUD_PRINT_VIRTUAL_DRIVER_WIN_PORT_MONITOR_SPOOLER_WIN_H_
      6 #define CLOUD_PRINT_VIRTUAL_DRIVER_WIN_PORT_MONITOR_SPOOLER_WIN_H_
      7 
      8 #include <windows.h>
      9 
     10 // Compatible structures and prototypes are also defined in the Windows DDK in
     11 // winsplp.h.
     12 #ifndef _WINSPLP_
     13 
     14 typedef struct {
     15   DWORD size;
     16   BOOL (WINAPI *pfnEnumPorts)(HANDLE,
     17                               wchar_t*,
     18                               DWORD level,
     19                               BYTE*  ports,
     20                               DWORD   ports_size,
     21                               DWORD* needed_bytes,
     22                               DWORD* returned);
     23 
     24   BOOL (WINAPI *pfnOpenPort)(HANDLE monitor_data, wchar_t*, HANDLE* handle);
     25 
     26   void* pfnOpenPortEx;  // Unused.
     27 
     28   BOOL (WINAPI *pfnStartDocPort)(HANDLE port_handle,
     29                                  wchar_t* printer_name,
     30                                  DWORD job_id,
     31                                  DWORD,
     32                                  BYTE*);
     33 
     34   BOOL (WINAPI *pfnWritePort)(HANDLE port,
     35                                BYTE*  buffer,
     36                                DWORD   buffer_size,
     37                                DWORD* bytes_written);
     38 
     39   BOOL (WINAPI *pfnReadPort)(HANDLE, BYTE*, DWORD, DWORD* bytes_read);
     40 
     41   BOOL (WINAPI *pfnEndDocPort)(HANDLE port_handle);
     42 
     43   BOOL (WINAPI *pfnClosePort)(HANDLE  port_handle);
     44 
     45   void* pfnAddPort;  // Unused.
     46 
     47   void* pfnAddPortEx;  // Unused.
     48 
     49   void* pfnConfigurePort;  // Unused.
     50 
     51   void* pfnDeletePort;  // Unused.
     52 
     53   void* pfnGetPrinterDataFromPort;  // Unused.
     54 
     55   void* pfnSetPortTimeOuts;  // Unusued.
     56 
     57   BOOL (WINAPI *pfnXcvOpenPort)(HANDLE monitor,
     58                                const wchar_t*,
     59                                ACCESS_MASK granted_access,
     60                                HANDLE* handle);
     61 
     62   DWORD (WINAPI *pfnXcvDataPort)(HANDLE xcv_handle,
     63                                 const wchar_t* data_name,
     64                                 BYTE*,
     65                                 DWORD,
     66                                 BYTE* output_data,
     67                                 DWORD output_data_bytes,
     68                                 DWORD* output_data_bytes_needed);
     69 
     70   BOOL (WINAPI *pfnXcvClosePort)(HANDLE handle);
     71 
     72   VOID (WINAPI *pfnShutdown)(HANDLE monitor_handle);
     73 } MONITOR2;
     74 
     75 typedef struct {
     76   DWORD size;
     77 
     78   BOOL (WINAPI *pfnAddPortUI)(const wchar_t*,
     79                               HWND hwnd,
     80                               const wchar_t* monitor_name,
     81                               wchar_t**);
     82 
     83   BOOL (WINAPI *pfnConfigurePortUI)(const wchar_t*,
     84                                     HWND hwnd,
     85                                     const wchar_t* port_name);
     86 
     87   BOOL (WINAPI *pfnDeletePortUI)(const wchar_t*,
     88                                  HWND hwnd,
     89                                  const wchar_t* port_name);
     90 } MONITORUI;
     91 
     92 typedef struct {
     93   DWORD cbSize;
     94   HANDLE hSpooler;
     95   HKEY hckRegistryRoot;
     96   void* pMonitorReg;  // Unused
     97   BOOL bLocal;
     98   LPCWSTR pszServerName;
     99 } MONITORINIT;
    100 
    101 MONITOR2* WINAPI InitializePrintMonitor2(MONITORINIT* monitor_init,
    102                                          HANDLE* monitor_handle);
    103 
    104 MONITORUI* WINAPI InitializePrintMonitorUI(void);
    105 
    106 #endif  // ifdef USE_WIN_DDK
    107 #endif  // CLOUD_PRINT_VIRTUAL_DRIVER_WIN_PORT_MONITOR_SPOOLER_WIN_H_
    108 
    109