Home | History | Annotate | Download | only in port_monitor
      1 // Copyright (c) 2012 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_PORT_MONITOR_H_
      6 #define CLOUD_PRINT_VIRTUAL_DRIVER_WIN_PORT_MONITOR_PORT_MONITOR_H_
      7 
      8 #include <windows.h>
      9 #include <string>
     10 #include "base/file_util.h"
     11 #include "base/process/process.h"
     12 #include "base/strings/string16.h"
     13 
     14 namespace cloud_print {
     15 
     16 // Returns path to be used for launching Chrome.
     17 base::FilePath GetChromeExePath();
     18 
     19 // Returns path to user profile to be used for launching Chrome.
     20 base::FilePath GetChromeProfilePath();
     21 
     22 // Implementations for the function pointers in the MONITOR2 structure
     23 // returned by InitializePrintMonitor2.  The prototypes and behaviors
     24 // are as described in the MONITOR2 documentation from Microsoft.
     25 
     26 BOOL WINAPI Monitor2EnumPorts(HANDLE,
     27                               wchar_t*,
     28                               DWORD level,
     29                               BYTE*  ports,
     30                               DWORD   ports_size,
     31                               DWORD* needed_bytes,
     32                               DWORD* returned);
     33 
     34 BOOL WINAPI Monitor2OpenPort(HANDLE monitor_data, wchar_t*, HANDLE* handle);
     35 
     36 BOOL WINAPI Monitor2StartDocPort(HANDLE port_handle,
     37                                  wchar_t* printer_name,
     38                                  DWORD job_id,
     39                                  DWORD,
     40                                  BYTE*);
     41 
     42 BOOL WINAPI Monitor2WritePort(HANDLE port,
     43                               BYTE*  buffer,
     44                               DWORD   buffer_size,
     45                               DWORD* bytes_written);
     46 
     47 BOOL WINAPI Monitor2ReadPort(HANDLE, BYTE*, DWORD, DWORD* bytes_read);
     48 
     49 BOOL WINAPI Monitor2EndDocPort(HANDLE port_handle);
     50 
     51 BOOL WINAPI Monitor2ClosePort(HANDLE port_handle);
     52 
     53 VOID WINAPI Monitor2Shutdown(HANDLE monitor_handle);
     54 
     55 BOOL WINAPI Monitor2XcvOpenPort(HANDLE monitor,
     56                                 const wchar_t*,
     57                                 ACCESS_MASK granted_access,
     58                                 HANDLE* handle);
     59 
     60 DWORD WINAPI Monitor2XcvDataPort(HANDLE xcv_handle,
     61                                  const wchar_t* data_name,
     62                                  BYTE*,
     63                                  DWORD,
     64                                  BYTE* output_data,
     65                                  DWORD output_data_bytes,
     66                                  DWORD* output_data_bytes_needed);
     67 
     68 BOOL WINAPI Monitor2XcvClosePort(HANDLE handle);
     69 
     70 // Implementations for the function pointers in the MONITORUI structure
     71 // returned by InitializePrintMonitorUI.  The prototypes and behaviors
     72 // are as described in the MONITORUI documentation from Microsoft.
     73 
     74 BOOL WINAPI MonitorUiAddPortUi(const wchar_t*,
     75                                HWND hwnd,
     76                                const wchar_t* monitor_name,
     77                                wchar_t**);
     78 
     79 BOOL WINAPI MonitorUiConfigureOrDeletePortUI(const wchar_t*,
     80                                              HWND hwnd,
     81                                              const wchar_t* port_name);
     82 
     83 extern const wchar_t kChromeExePath[];
     84 extern const wchar_t kChromeExePathRegValue[];
     85 extern const wchar_t kChromeProfilePathRegValue[];
     86 extern const bool kIsUnittest;
     87 
     88 }   // namespace cloud_print
     89 
     90 #endif  // CLOUD_PRINT_VIRTUAL_DRIVER_WIN_PORT_MONITOR_PORT_MONITOR_H_
     91 
     92