summaryrefslogtreecommitdiffstats
path: root/cloud_print
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-29 22:37:39 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-29 22:37:39 +0000
commitc22c42f2afc6d2bae160e2705674c1795c46b4a3 (patch)
treeae6720d47484ab2f0d1080511c29478ecde312a7 /cloud_print
parentb3c186db2ee6141df9c2b67a990bf93914c09d47 (diff)
downloadchromium_src-c22c42f2afc6d2bae160e2705674c1795c46b4a3.zip
chromium_src-c22c42f2afc6d2bae160e2705674c1795c46b4a3.tar.gz
chromium_src-c22c42f2afc6d2bae160e2705674c1795c46b4a3.tar.bz2
Removed spurious CRs.
BUG=None TEST=None. TBR=abodenha@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cloud_print')
-rw-r--r--cloud_print/virtual_driver/win/install/setup.cc258
-rw-r--r--cloud_print/virtual_driver/win/port_monitor/port_monitor.cc40
-rw-r--r--cloud_print/virtual_driver/win/virtual_driver_consts.cc8
-rw-r--r--cloud_print/virtual_driver/win/virtual_driver_consts.h4
4 files changed, 155 insertions, 155 deletions
diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc
index 820acf7..84bd746 100644
--- a/cloud_print/virtual_driver/win/install/setup.cc
+++ b/cloud_print/virtual_driver/win/install/setup.cc
@@ -11,135 +11,135 @@
#include "base/process_util.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
-#include "cloud_print/virtual_driver/win/virtual_driver_consts.h"
+#include "cloud_print/virtual_driver/win/virtual_driver_consts.h"
#include "cloud_print/virtual_driver/win/virtual_driver_helpers.h"
-
-namespace {
-
-bool IsSystem64Bit() {
- base::win::OSInfo::WindowsArchitecture arch =
- base::win::OSInfo::GetInstance()->architecture();
- return (arch == base::win::OSInfo::X64_ARCHITECTURE) ||
- (arch == base::win::OSInfo::IA64_ARCHITECTURE);
-}
-
-const wchar_t *GetPortMonitorDllName() {
- if (IsSystem64Bit()) {
- return cloud_print::kPortMonitorDllName64;
- } else {
- return cloud_print::kPortMonitorDllName32;
- }
-}
-
-HRESULT GetPortMonitorDllPath(FilePath* path) {
- if (!PathService::Get(base::DIR_EXE, path)) {
- return ERROR_PATH_NOT_FOUND;
- }
- *path = path->Append(GetPortMonitorDllName());
- return S_OK;
-}
-
-HRESULT GetPortMonitorInstallPath(FilePath* path) {
- if (IsSystem64Bit()) {
- if (!PathService::Get(base::DIR_WINDOWS, path)) {
- return ERROR_PATH_NOT_FOUND;
- }
- // Sysnative will bypass filesystem redirection and give us
- // the location of the 64bit system32 from a 32 bit process.
- *path = path->Append(L"sysnative");
- } else {
- if (!PathService::Get(base::DIR_SYSTEM, path)) {
- return ERROR_PATH_NOT_FOUND;
- }
- }
- *path = path->Append(GetPortMonitorDllName());
- return S_OK;
-}
-
-HRESULT GetRegsvr32Path(FilePath* path) {
- if (!PathService::Get(base::DIR_SYSTEM, path)) {
- return ERROR_PATH_NOT_FOUND;
- }
- *path = path->Append(FilePath(L"regsvr32.exe"));
- return S_OK;
-}
-
-HRESULT RegisterPortMonitor(bool install) {
- FilePath target_path;
- HRESULT result = S_OK;
- result = GetPortMonitorInstallPath(&target_path);
- if (!SUCCEEDED(result)) {
- return result;
- }
- FilePath dll_path;
- result = GetPortMonitorDllPath(&dll_path);
- if (!SUCCEEDED(result)) {
- return result;
- }
- if (install) {
- if (!file_util::CopyFileW(dll_path, target_path)) {
- return cloud_print::GetLastHResult();
- }
- }
- FilePath regsvr32_path;
- result = GetRegsvr32Path(&regsvr32_path);
- if (!SUCCEEDED(result)) {
- return result;
- }
- CommandLine command_line(regsvr32_path);
- command_line.AppendArg("/s");
- if (!install) {
- command_line.AppendArg("/u");
- }
- command_line.AppendArgPath(dll_path);
- HANDLE process_handle;
- if (!base::LaunchApp(command_line.command_line_string(),
- true,
- false,
- &process_handle)) {
- return cloud_print::GetLastHResult();
- }
- base::win::ScopedHandle scoped_process_handle(process_handle);
- DWORD exit_code = S_OK;
- if (!GetExitCodeProcess(scoped_process_handle, &exit_code)) {
- return cloud_print::GetLastHResult();
- }
- if (exit_code != 0) {
- return HRESULT_FROM_WIN32(exit_code);
- }
- if (!install) {
- if (!file_util::Delete(target_path, false)) {
- return cloud_print::GetLastHResult();
- }
- }
- return S_OK;
-}
-
-HRESULT InstallVirtualDriver(void) {
- return RegisterPortMonitor(true);
-}
-
-HRESULT UninstallVirtualDriver(void) {
- return RegisterPortMonitor(false);
-}
-} // namespace
-
-int WINAPI WinMain(__in HINSTANCE hInstance,
- __in HINSTANCE hPrevInstance,
- __in LPSTR lpCmdLine,
- __in int nCmdShow) {
+namespace {
+
+bool IsSystem64Bit() {
+ base::win::OSInfo::WindowsArchitecture arch =
+ base::win::OSInfo::GetInstance()->architecture();
+ return (arch == base::win::OSInfo::X64_ARCHITECTURE) ||
+ (arch == base::win::OSInfo::IA64_ARCHITECTURE);
+}
+
+const wchar_t *GetPortMonitorDllName() {
+ if (IsSystem64Bit()) {
+ return cloud_print::kPortMonitorDllName64;
+ } else {
+ return cloud_print::kPortMonitorDllName32;
+ }
+}
+
+HRESULT GetPortMonitorDllPath(FilePath* path) {
+ if (!PathService::Get(base::DIR_EXE, path)) {
+ return ERROR_PATH_NOT_FOUND;
+ }
+ *path = path->Append(GetPortMonitorDllName());
+ return S_OK;
+}
+
+HRESULT GetPortMonitorInstallPath(FilePath* path) {
+ if (IsSystem64Bit()) {
+ if (!PathService::Get(base::DIR_WINDOWS, path)) {
+ return ERROR_PATH_NOT_FOUND;
+ }
+ // Sysnative will bypass filesystem redirection and give us
+ // the location of the 64bit system32 from a 32 bit process.
+ *path = path->Append(L"sysnative");
+ } else {
+ if (!PathService::Get(base::DIR_SYSTEM, path)) {
+ return ERROR_PATH_NOT_FOUND;
+ }
+ }
+ *path = path->Append(GetPortMonitorDllName());
+ return S_OK;
+}
+
+HRESULT GetRegsvr32Path(FilePath* path) {
+ if (!PathService::Get(base::DIR_SYSTEM, path)) {
+ return ERROR_PATH_NOT_FOUND;
+ }
+ *path = path->Append(FilePath(L"regsvr32.exe"));
+ return S_OK;
+}
+
+HRESULT RegisterPortMonitor(bool install) {
+ FilePath target_path;
+ HRESULT result = S_OK;
+ result = GetPortMonitorInstallPath(&target_path);
+ if (!SUCCEEDED(result)) {
+ return result;
+ }
+ FilePath dll_path;
+ result = GetPortMonitorDllPath(&dll_path);
+ if (!SUCCEEDED(result)) {
+ return result;
+ }
+ if (install) {
+ if (!file_util::CopyFileW(dll_path, target_path)) {
+ return cloud_print::GetLastHResult();
+ }
+ }
+ FilePath regsvr32_path;
+ result = GetRegsvr32Path(&regsvr32_path);
+ if (!SUCCEEDED(result)) {
+ return result;
+ }
+ CommandLine command_line(regsvr32_path);
+ command_line.AppendArg("/s");
+ if (!install) {
+ command_line.AppendArg("/u");
+ }
+ command_line.AppendArgPath(dll_path);
+ HANDLE process_handle;
+ if (!base::LaunchApp(command_line.command_line_string(),
+ true,
+ false,
+ &process_handle)) {
+ return cloud_print::GetLastHResult();
+ }
+ base::win::ScopedHandle scoped_process_handle(process_handle);
+ DWORD exit_code = S_OK;
+ if (!GetExitCodeProcess(scoped_process_handle, &exit_code)) {
+ return cloud_print::GetLastHResult();
+ }
+ if (exit_code != 0) {
+ return HRESULT_FROM_WIN32(exit_code);
+ }
+ if (!install) {
+ if (!file_util::Delete(target_path, false)) {
+ return cloud_print::GetLastHResult();
+ }
+ }
+ return S_OK;
+}
+
+HRESULT InstallVirtualDriver(void) {
+ return RegisterPortMonitor(true);
+}
+
+HRESULT UninstallVirtualDriver(void) {
+ return RegisterPortMonitor(false);
+}
+
+} // namespace
+
+int WINAPI WinMain(__in HINSTANCE hInstance,
+ __in HINSTANCE hPrevInstance,
+ __in LPSTR lpCmdLine,
+ __in int nCmdShow) {
base::AtExitManager at_exit_manager;
- CommandLine::Init(0, NULL);
- HRESULT retval = S_OK;
- if (CommandLine::ForCurrentProcess()->HasSwitch("uninstall")) {
- retval = UninstallVirtualDriver();
- } else {
- retval = InstallVirtualDriver();
- }
- if (!CommandLine::ForCurrentProcess()->HasSwitch("silent")) {
- cloud_print::DisplayWindowsMessage(NULL, retval);
- }
- return retval;
-}
-
+ CommandLine::Init(0, NULL);
+ HRESULT retval = S_OK;
+ if (CommandLine::ForCurrentProcess()->HasSwitch("uninstall")) {
+ retval = UninstallVirtualDriver();
+ } else {
+ retval = InstallVirtualDriver();
+ }
+ if (!CommandLine::ForCurrentProcess()->HasSwitch("silent")) {
+ cloud_print::DisplayWindowsMessage(NULL, retval);
+ }
+ return retval;
+}
+
diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
index 6b4449f..ff43e1e 100644
--- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
+++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
@@ -23,7 +23,7 @@
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "cloud_print/virtual_driver/win/port_monitor/spooler_win.h"
-#include "cloud_print/virtual_driver/win/virtual_driver_consts.h"
+#include "cloud_print/virtual_driver/win/virtual_driver_consts.h"
#include "cloud_print/virtual_driver/win/virtual_driver_helpers.h"
namespace switches {
@@ -117,24 +117,24 @@ MONITOR2 g_monitor_2 = {
Monitor2Shutdown
};
-// Gets the standard install path for "version 3" print drivers.
-HRESULT GetPrinterDriverPath(FilePath* path) {
- BYTE driver_dir_buffer[MAX_PATH * sizeof(wchar_t)];
- DWORD needed = 0;
- if (!GetPrinterDriverDirectory(NULL,
- NULL,
- 1,
- driver_dir_buffer,
- MAX_PATH * sizeof(wchar_t),
- &needed)) {
- // We could try to allocate a larger buffer if needed > MAX_PATH
- // but that really shouldn't happen.
- return cloud_print::GetLastHResult();
- }
- *path = FilePath(reinterpret_cast<wchar_t*>(driver_dir_buffer));
+// Gets the standard install path for "version 3" print drivers.
+HRESULT GetPrinterDriverPath(FilePath* path) {
+ BYTE driver_dir_buffer[MAX_PATH * sizeof(wchar_t)];
+ DWORD needed = 0;
+ if (!GetPrinterDriverDirectory(NULL,
+ NULL,
+ 1,
+ driver_dir_buffer,
+ MAX_PATH * sizeof(wchar_t),
+ &needed)) {
+ // We could try to allocate a larger buffer if needed > MAX_PATH
+ // but that really shouldn't happen.
+ return cloud_print::GetLastHResult();
+ }
+ *path = FilePath(reinterpret_cast<wchar_t*>(driver_dir_buffer));
*path = path->Append(L"3");
- return S_OK;
-}
+ return S_OK;
+}
// Returns true if Xps support is installed.
bool XpsIsInstalled() {
@@ -653,7 +653,7 @@ HRESULT WINAPI DllRegisterServer(void) {
if (AddMonitor(NULL, 2, reinterpret_cast<BYTE*>(&monitor_info))) {
return S_OK;
}
- return cloud_print::GetLastHResult();
+ return cloud_print::GetLastHResult();
}
HRESULT WINAPI DllUnregisterServer(void) {
@@ -666,5 +666,5 @@ HRESULT WINAPI DllUnregisterServer(void) {
const_cast<LPWSTR>(cloud_print::kPortMonitorDllName))) {
return S_OK;
}
- return cloud_print::GetLastHResult();
+ return cloud_print::GetLastHResult();
}
diff --git a/cloud_print/virtual_driver/win/virtual_driver_consts.cc b/cloud_print/virtual_driver/win/virtual_driver_consts.cc
index cd177b5..78117f8 100644
--- a/cloud_print/virtual_driver/win/virtual_driver_consts.cc
+++ b/cloud_print/virtual_driver/win/virtual_driver_consts.cc
@@ -7,7 +7,7 @@
#include "cloud_print/virtual_driver/win/virtual_driver_helpers.h"
namespace cloud_print {
-const wchar_t kPortMonitorDllName64[] = L"gcp_portmon64.dll";
-const wchar_t kPortMonitorDllName32[] = L"gcp_portmon.dll";
-}
-
+const wchar_t kPortMonitorDllName64[] = L"gcp_portmon64.dll";
+const wchar_t kPortMonitorDllName32[] = L"gcp_portmon.dll";
+}
+
diff --git a/cloud_print/virtual_driver/win/virtual_driver_consts.h b/cloud_print/virtual_driver/win/virtual_driver_consts.h
index 6cd995f..6d92ea8 100644
--- a/cloud_print/virtual_driver/win/virtual_driver_consts.h
+++ b/cloud_print/virtual_driver/win/virtual_driver_consts.h
@@ -7,8 +7,8 @@
#pragma once
namespace cloud_print {
-extern const wchar_t kPortMonitorDllName64[];
-extern const wchar_t kPortMonitorDllName32[];
+extern const wchar_t kPortMonitorDllName64[];
+extern const wchar_t kPortMonitorDllName32[];
}
#endif // CLOUD_PRINT_VIRTUAL_DRIVER_WIN_VIRTUAL_DRIVER_CONSTS_H_