diff options
43 files changed, 170 insertions, 227 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc index adf6608..405a7da 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -605,8 +605,8 @@ int WriteFile(const FilePath& filename, const char* data, int size) { 0, NULL)); if (!file) { - DLOG_GETLASTERROR(WARNING) << "CreateFile failed for path " - << UTF16ToUTF8(filename.value()); + DPLOG(WARNING) << "CreateFile failed for path " + << UTF16ToUTF8(filename.value()); return -1; } @@ -617,8 +617,8 @@ int WriteFile(const FilePath& filename, const char* data, int size) { if (!result) { // WriteFile failed. - DLOG_GETLASTERROR(WARNING) << "writing file " - << UTF16ToUTF8(filename.value()) << " failed"; + DPLOG(WARNING) << "writing file " << UTF16ToUTF8(filename.value()) + << " failed"; } else { // Didn't write all the bytes. DLOG(WARNING) << "wrote" << written << " bytes to " @@ -637,8 +637,8 @@ int AppendToFile(const FilePath& filename, const char* data, int size) { 0, NULL)); if (!file) { - DLOG_GETLASTERROR(WARNING) << "CreateFile failed for path " - << UTF16ToUTF8(filename.value()); + DPLOG(WARNING) << "CreateFile failed for path " + << UTF16ToUTF8(filename.value()); return -1; } @@ -649,9 +649,8 @@ int AppendToFile(const FilePath& filename, const char* data, int size) { if (!result) { // WriteFile failed. - DLOG_GETLASTERROR(WARNING) << "writing file " - << UTF16ToUTF8(filename.value()) - << " failed"; + DPLOG(WARNING) << "writing file " << UTF16ToUTF8(filename.value()) + << " failed"; } else { // Didn't write all the bytes. DLOG(WARNING) << "wrote" << written << " bytes to " diff --git a/base/logging.h b/base/logging.h index dd17bce..5027ce7 100644 --- a/base/logging.h +++ b/base/logging.h @@ -613,15 +613,6 @@ enum { DEBUG_MODE = ENABLE_DLOG }; #define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) -// TODO(vitalybuka): following should be removed and replaced with PLOG. -#if defined(OS_WIN) -#define LOG_GETLASTERROR(severity) PLOG(severity) -#define DLOG_GETLASTERROR(severity) DPLOG(severity) -#elif defined(OS_POSIX) -#define LOG_ERRNO(severity) PLOG(severity) -#define DLOG_ERRNO(severity) DPLOG(severity) -#endif - // Definitions for DCHECK et al. #if DCHECK_IS_ON diff --git a/base/mac/os_crash_dumps.cc b/base/mac/os_crash_dumps.cc index e6b0996..e50ac39 100644 --- a/base/mac/os_crash_dumps.cc +++ b/base/mac/os_crash_dumps.cc @@ -47,9 +47,9 @@ void DisableOSCrashDumps() { act.sa_flags = SA_ONSTACK; if (sigemptyset(&act.sa_mask) != 0) - DLOG_ERRNO(FATAL) << "sigemptyset() failed"; + DPLOG(FATAL) << "sigemptyset() failed"; if (sigaction(signals_to_intercept[i], &act, NULL) != 0) - DLOG_ERRNO(FATAL) << "sigaction() failed"; + DPLOG(FATAL) << "sigaction() failed"; } } diff --git a/base/power_monitor/power_monitor_device_source_win.cc b/base/power_monitor/power_monitor_device_source_win.cc index ba00f2f..b8b16e1 100644 --- a/base/power_monitor/power_monitor_device_source_win.cc +++ b/base/power_monitor/power_monitor_device_source_win.cc @@ -55,7 +55,7 @@ void ProcessWmPowerBroadcastMessage(WPARAM event_id) { bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() { SYSTEM_POWER_STATUS status; if (!GetSystemPowerStatus(&status)) { - DLOG_GETLASTERROR(ERROR) << "GetSystemPowerStatus failed"; + DPLOG(ERROR) << "GetSystemPowerStatus failed"; return false; } return (status.ACLineStatus == 0); diff --git a/base/process/kill_win.cc b/base/process/kill_win.cc index 99a7c66..aaf3f30 100644 --- a/base/process/kill_win.cc +++ b/base/process/kill_win.cc @@ -96,9 +96,9 @@ bool KillProcess(ProcessHandle process, int exit_code, bool wait) { if (result && wait) { // The process may not end immediately due to pending I/O if (WAIT_OBJECT_0 != WaitForSingleObject(process, 60 * 1000)) - DLOG_GETLASTERROR(ERROR) << "Error waiting for process exit"; + DPLOG(ERROR) << "Error waiting for process exit"; } else if (!result) { - DLOG_GETLASTERROR(ERROR) << "Unable to terminate process"; + DPLOG(ERROR) << "Unable to terminate process"; } return result; } @@ -111,7 +111,7 @@ bool KillProcessById(ProcessId process_id, int exit_code, bool wait) { FALSE, // Don't inherit handle process_id); if (!process) { - DLOG_GETLASTERROR(ERROR) << "Unable to open process " << process_id; + DPLOG(ERROR) << "Unable to open process " << process_id; return false; } bool ret = KillProcess(process, exit_code, wait); @@ -123,7 +123,7 @@ TerminationStatus GetTerminationStatus(ProcessHandle handle, int* exit_code) { DWORD tmp_exit_code = 0; if (!::GetExitCodeProcess(handle, &tmp_exit_code)) { - DLOG_GETLASTERROR(FATAL) << "GetExitCodeProcess() failed"; + DPLOG(FATAL) << "GetExitCodeProcess() failed"; if (exit_code) { // This really is a random number. We haven't received any // information about the exit code, presumably because this @@ -149,7 +149,7 @@ TerminationStatus GetTerminationStatus(ProcessHandle handle, int* exit_code) { } if (wait_result == WAIT_FAILED) { - DLOG_GETLASTERROR(ERROR) << "WaitForSingleObject() failed"; + DPLOG(ERROR) << "WaitForSingleObject() failed"; } else { DCHECK_EQ(WAIT_OBJECT_0, wait_result); diff --git a/base/sha1_win.cc b/base/sha1_win.cc index 98c3840..b64c9eb 100644 --- a/base/sha1_win.cc +++ b/base/sha1_win.cc @@ -18,20 +18,20 @@ std::string SHA1HashString(const std::string& str) { ScopedHCRYPTPROV provider; if (!CryptAcquireContext(provider.receive(), NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { - DLOG_GETLASTERROR(ERROR) << "CryptAcquireContext failed"; + DPLOG(ERROR) << "CryptAcquireContext failed"; return std::string(kSHA1Length, '\0'); } { ScopedHCRYPTHASH hash; if (!CryptCreateHash(provider, CALG_SHA1, 0, 0, hash.receive())) { - DLOG_GETLASTERROR(ERROR) << "CryptCreateHash failed"; + DPLOG(ERROR) << "CryptCreateHash failed"; return std::string(kSHA1Length, '\0'); } if (!CryptHashData(hash, reinterpret_cast<CONST BYTE*>(str.data()), static_cast<DWORD>(str.length()), 0)) { - DLOG_GETLASTERROR(ERROR) << "CryptHashData failed"; + DPLOG(ERROR) << "CryptHashData failed"; return std::string(kSHA1Length, '\0'); } @@ -40,7 +40,7 @@ std::string SHA1HashString(const std::string& str) { if (!CryptGetHashParam(hash, HP_HASHSIZE, reinterpret_cast<unsigned char*>(&hash_len), &buffer_size, 0)) { - DLOG_GETLASTERROR(ERROR) << "CryptGetHashParam(HP_HASHSIZE) failed"; + DPLOG(ERROR) << "CryptGetHashParam(HP_HASHSIZE) failed"; return std::string(kSHA1Length, '\0'); } @@ -50,7 +50,7 @@ std::string SHA1HashString(const std::string& str) { // but so that result.length() is correctly set to |hash_len|. reinterpret_cast<BYTE*>(WriteInto(&result, hash_len + 1)), &hash_len, 0))) { - DLOG_GETLASTERROR(ERROR) << "CryptGetHashParam(HP_HASHVAL) failed"; + DPLOG(ERROR) << "CryptGetHashParam(HP_HASHVAL) failed"; return std::string(kSHA1Length, '\0'); } diff --git a/base/synchronization/waitable_event_win.cc b/base/synchronization/waitable_event_win.cc index 8259cb7..04746b5 100644 --- a/base/synchronization/waitable_event_win.cc +++ b/base/synchronization/waitable_event_win.cc @@ -92,7 +92,7 @@ size_t WaitableEvent::WaitMany(WaitableEvent** events, size_t count) { FALSE, // don't wait for all the objects INFINITE); // no timeout if (result >= WAIT_OBJECT_0 + count) { - DLOG_GETLASTERROR(FATAL) << "WaitForMultipleObjects failed"; + DPLOG(FATAL) << "WaitForMultipleObjects failed"; return 0; } diff --git a/base/threading/worker_pool_win.cc b/base/threading/worker_pool_win.cc index 8dd323b..fa11dc5 100644 --- a/base/threading/worker_pool_win.cc +++ b/base/threading/worker_pool_win.cc @@ -48,7 +48,7 @@ bool PostTaskInternal(PendingTask* pending_task, bool task_is_slow) { flags |= WT_EXECUTELONGFUNCTION; if (!QueueUserWorkItem(WorkItemCallback, pending_task, flags)) { - DLOG_GETLASTERROR(ERROR) << "QueueUserWorkItem failed"; + DPLOG(ERROR) << "QueueUserWorkItem failed"; delete pending_task; return false; } diff --git a/base/time/time_posix.cc b/base/time/time_posix.cc index d83e9e6..6b08bb3 100644 --- a/base/time/time_posix.cc +++ b/base/time/time_posix.cc @@ -140,7 +140,7 @@ Time Time::Now() { struct timezone tz = { 0, 0 }; // UTC if (gettimeofday(&tv, &tz) != 0) { DCHECK(0) << "Could not determine time of day"; - LOG_ERRNO(ERROR) << "Call to gettimeofday failed."; + PLOG(ERROR) << "Call to gettimeofday failed."; // Return null instead of uninitialized |tv| value, which contains random // garbage data. This may result in the crash seen in crbug.com/147570. return Time(); diff --git a/base/win/message_window.cc b/base/win/message_window.cc index 5666074..57fe64c 100644 --- a/base/win/message_window.cc +++ b/base/win/message_window.cc @@ -52,7 +52,7 @@ MessageWindow::WindowClass::WindowClass() window_class.hIconSm = NULL; atom_ = RegisterClassEx(&window_class); if (atom_ == 0) { - LOG_GETLASTERROR(ERROR) + PLOG(ERROR) << "Failed to register the window class for a message-only window"; } } @@ -108,7 +108,7 @@ bool MessageWindow::DoCreate(const MessageCallback& message_callback, window_ = CreateWindow(MAKEINTATOM(window_class.atom()), window_name, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, window_class.instance(), this); if (!window_) { - LOG_GETLASTERROR(ERROR) << "Failed to create a message-only window"; + PLOG(ERROR) << "Failed to create a message-only window"; return false; } diff --git a/base/win/object_watcher.cc b/base/win/object_watcher.cc index 078f5b9..3bb1cd3 100644 --- a/base/win/object_watcher.cc +++ b/base/win/object_watcher.cc @@ -43,7 +43,7 @@ bool ObjectWatcher::StartWatching(HANDLE object, Delegate* delegate) { if (!RegisterWaitForSingleObject(&wait_object_, object, DoneWaiting, this, INFINITE, wait_flags)) { - DLOG_GETLASTERROR(FATAL) << "RegisterWaitForSingleObject failed"; + DPLOG(FATAL) << "RegisterWaitForSingleObject failed"; object_ = NULL; wait_object_ = NULL; return false; @@ -65,7 +65,7 @@ bool ObjectWatcher::StopWatching() { // Blocking call to cancel the wait. Any callbacks already in progress will // finish before we return from this call. if (!UnregisterWaitEx(wait_object_, INVALID_HANDLE_VALUE)) { - DLOG_GETLASTERROR(FATAL) << "UnregisterWaitEx failed"; + DPLOG(FATAL) << "UnregisterWaitEx failed"; return false; } diff --git a/components/nacl/loader/nonsfi/irt_memory.cc b/components/nacl/loader/nonsfi/irt_memory.cc index 06f76ea..89a3719 100644 --- a/components/nacl/loader/nonsfi/irt_memory.cc +++ b/components/nacl/loader/nonsfi/irt_memory.cc @@ -58,7 +58,7 @@ int IrtMMap(void** addr, size_t len, int prot, int flags, if (host_prot & PROT_EXEC) { if (mprotect(result, len, host_prot) != 0) { // This aborts here because it cannot easily undo the mmap() call. - LOG_ERRNO(FATAL) << "IrtMMap: mprotect to turn on PROT_EXEC failed."; + PLOG(FATAL) << "IrtMMap: mprotect to turn on PROT_EXEC failed."; } } diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index a30a62e..6f2a7e4 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -1047,7 +1047,7 @@ bool BrowserMainLoop::InitializeToolkit() { config.dwSize = sizeof(config); config.dwICC = ICC_WIN95_CLASSES; if (!InitCommonControlsEx(&config)) - LOG_GETLASTERROR(FATAL); + PLOG(FATAL); #endif #if defined(USE_AURA) diff --git a/content/browser/gamepad/raw_input_data_fetcher_win.cc b/content/browser/gamepad/raw_input_data_fetcher_win.cc index 50eb3dc..0574821 100644 --- a/content/browser/gamepad/raw_input_data_fetcher_win.cc +++ b/content/browser/gamepad/raw_input_data_fetcher_win.cc @@ -65,7 +65,7 @@ void RawInputDataFetcher::StartMonitor() { window_.reset(new base::win::MessageWindow()); if (!window_->Create(base::Bind(&RawInputDataFetcher::HandleMessage, base::Unretained(this)))) { - LOG_GETLASTERROR(ERROR) << "Failed to create the raw input window"; + PLOG(ERROR) << "Failed to create the raw input window"; window_.reset(); return; } @@ -75,8 +75,7 @@ void RawInputDataFetcher::StartMonitor() { scoped_ptr<RAWINPUTDEVICE[]> devices(GetRawInputDevices(RIDEV_INPUTSINK)); if (!RegisterRawInputDevices(devices.get(), arraysize(DeviceUsages), sizeof(RAWINPUTDEVICE))) { - LOG_GETLASTERROR(ERROR) - << "RegisterRawInputDevices() failed for RIDEV_INPUTSINK"; + PLOG(ERROR) << "RegisterRawInputDevices() failed for RIDEV_INPUTSINK"; window_.reset(); return; } @@ -99,8 +98,7 @@ void RawInputDataFetcher::StopMonitor() { if (!RegisterRawInputDevices(devices.get(), arraysize(DeviceUsages), sizeof(RAWINPUTDEVICE))) { - LOG_GETLASTERROR(INFO) - << "RegisterRawInputDevices() failed for RIDEV_REMOVE"; + PLOG(INFO) << "RegisterRawInputDevices() failed for RIDEV_REMOVE"; } events_monitored_ = false; @@ -127,7 +125,7 @@ std::vector<RawGamepadInfo*> RawInputDataFetcher::EnumerateDevices() { UINT count = 0; UINT result = GetRawInputDeviceList(NULL, &count, sizeof(RAWINPUTDEVICELIST)); if (result == static_cast<UINT>(-1)) { - LOG_GETLASTERROR(ERROR) << "GetRawInputDeviceList() failed"; + PLOG(ERROR) << "GetRawInputDeviceList() failed"; return valid_controllers; } DCHECK_EQ(0u, result); @@ -136,7 +134,7 @@ std::vector<RawGamepadInfo*> RawInputDataFetcher::EnumerateDevices() { result = GetRawInputDeviceList(device_list.get(), &count, sizeof(RAWINPUTDEVICELIST)); if (result == static_cast<UINT>(-1)) { - LOG_GETLASTERROR(ERROR) << "GetRawInputDeviceList() failed"; + PLOG(ERROR) << "GetRawInputDeviceList() failed"; return valid_controllers; } DCHECK_EQ(count, result); @@ -173,7 +171,7 @@ RawGamepadInfo* RawInputDataFetcher::ParseGamepadInfo(HANDLE hDevice) { UINT result = GetRawInputDeviceInfo(hDevice, RIDI_DEVICEINFO, NULL, &size); if (result == static_cast<UINT>(-1)) { - LOG_GETLASTERROR(ERROR) << "GetRawInputDeviceInfo() failed"; + PLOG(ERROR) << "GetRawInputDeviceInfo() failed"; return NULL; } DCHECK_EQ(0u, result); @@ -184,7 +182,7 @@ RawGamepadInfo* RawInputDataFetcher::ParseGamepadInfo(HANDLE hDevice) { result = GetRawInputDeviceInfo(hDevice, RIDI_DEVICEINFO, di_buffer.get(), &size); if (result == static_cast<UINT>(-1)) { - LOG_GETLASTERROR(ERROR) << "GetRawInputDeviceInfo() failed"; + PLOG(ERROR) << "GetRawInputDeviceInfo() failed"; return NULL; } DCHECK_EQ(size, result); @@ -215,7 +213,7 @@ RawGamepadInfo* RawInputDataFetcher::ParseGamepadInfo(HANDLE hDevice) { result = GetRawInputDeviceInfo(hDevice, RIDI_DEVICENAME, NULL, &size); if (result == static_cast<UINT>(-1)) { - LOG_GETLASTERROR(ERROR) << "GetRawInputDeviceInfo() failed"; + PLOG(ERROR) << "GetRawInputDeviceInfo() failed"; return NULL; } DCHECK_EQ(0u, result); @@ -224,7 +222,7 @@ RawGamepadInfo* RawInputDataFetcher::ParseGamepadInfo(HANDLE hDevice) { result = GetRawInputDeviceInfo(hDevice, RIDI_DEVICENAME, name_buffer.get(), &size); if (result == static_cast<UINT>(-1)) { - LOG_GETLASTERROR(ERROR) << "GetRawInputDeviceInfo() failed"; + PLOG(ERROR) << "GetRawInputDeviceInfo() failed"; return NULL; } DCHECK_EQ(size, result); @@ -252,7 +250,7 @@ RawGamepadInfo* RawInputDataFetcher::ParseGamepadInfo(HANDLE hDevice) { result = GetRawInputDeviceInfo(hDevice, RIDI_PREPARSEDDATA, NULL, &size); if (result == static_cast<UINT>(-1)) { - LOG_GETLASTERROR(ERROR) << "GetRawInputDeviceInfo() failed"; + PLOG(ERROR) << "GetRawInputDeviceInfo() failed"; return NULL; } DCHECK_EQ(0u, result); @@ -263,7 +261,7 @@ RawGamepadInfo* RawInputDataFetcher::ParseGamepadInfo(HANDLE hDevice) { result = GetRawInputDeviceInfo(hDevice, RIDI_PREPARSEDDATA, gamepad_info->ppd_buffer.get(), &size); if (result == static_cast<UINT>(-1)) { - LOG_GETLASTERROR(ERROR) << "GetRawInputDeviceInfo() failed"; + PLOG(ERROR) << "GetRawInputDeviceInfo() failed"; return NULL; } DCHECK_EQ(size, result); @@ -421,7 +419,7 @@ LRESULT RawInputDataFetcher::OnInput(HRAWINPUT input_handle) { UINT result = GetRawInputData( input_handle, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)); if (result == static_cast<UINT>(-1)) { - LOG_GETLASTERROR(ERROR) << "GetRawInputData() failed"; + PLOG(ERROR) << "GetRawInputData() failed"; return 0; } DCHECK_EQ(0u, result); @@ -432,7 +430,7 @@ LRESULT RawInputDataFetcher::OnInput(HRAWINPUT input_handle) { result = GetRawInputData( input_handle, RID_INPUT, buffer.get(), &size, sizeof(RAWINPUTHEADER)); if (result == static_cast<UINT>(-1)) { - LOG_GETLASTERROR(ERROR) << "GetRawInputData() failed"; + PLOG(ERROR) << "GetRawInputData() failed"; return 0; } DCHECK_EQ(size, result); diff --git a/device/hid/hid_service_win.cc b/device/hid/hid_service_win.cc index 42c9a3a..312bd5b 100644 --- a/device/hid/hid_service_win.cc +++ b/device/hid/hid_service_win.cc @@ -227,7 +227,7 @@ scoped_refptr<HidConnection> HidServiceWin::Connect( return NULL; scoped_refptr<HidConnectionWin> connection(new HidConnectionWin(device_info)); if (!connection->available()) { - LOG_GETLASTERROR(ERROR) << "Failed to open device."; + PLOG(ERROR) << "Failed to open device."; return NULL; } return connection; diff --git a/media/audio/win/audio_low_latency_output_win.cc b/media/audio/win/audio_low_latency_output_win.cc index 5c3205c..6aad434 100644 --- a/media/audio/win/audio_low_latency_output_win.cc +++ b/media/audio/win/audio_low_latency_output_win.cc @@ -252,8 +252,7 @@ void WASAPIAudioOutputStream::Start(AudioSourceCallback* callback) { // Start streaming data between the endpoint buffer and the audio engine. HRESULT hr = audio_client_->Start(); if (FAILED(hr)) { - LOG_GETLASTERROR(ERROR) - << "Failed to start output streaming: " << std::hex << hr; + PLOG(ERROR) << "Failed to start output streaming: " << std::hex << hr; StopThread(); callback->OnError(this); } @@ -268,8 +267,7 @@ void WASAPIAudioOutputStream::Stop() { // Stop output audio streaming. HRESULT hr = audio_client_->Stop(); if (FAILED(hr)) { - LOG_GETLASTERROR(ERROR) - << "Failed to stop output streaming: " << std::hex << hr; + PLOG(ERROR) << "Failed to stop output streaming: " << std::hex << hr; source_->OnError(this); } @@ -280,8 +278,7 @@ void WASAPIAudioOutputStream::Stop() { // Flush all pending data and reset the audio clock stream position to 0. hr = audio_client_->Reset(); if (FAILED(hr)) { - LOG_GETLASTERROR(ERROR) - << "Failed to reset streaming: " << std::hex << hr; + PLOG(ERROR) << "Failed to reset streaming: " << std::hex << hr; callback->OnError(this); } diff --git a/media/base/user_input_monitor_win.cc b/media/base/user_input_monitor_win.cc index e9340d8..6efdc52 100644 --- a/media/base/user_input_monitor_win.cc +++ b/media/base/user_input_monitor_win.cc @@ -128,7 +128,7 @@ void UserInputMonitorWinCore::StartMonitor(EventBitMask type) { window_.reset(new base::win::MessageWindow()); if (!window_->Create(base::Bind(&UserInputMonitorWinCore::HandleMessage, base::Unretained(this)))) { - LOG_GETLASTERROR(ERROR) << "Failed to create the raw input window"; + PLOG(ERROR) << "Failed to create the raw input window"; window_.reset(); return; } @@ -137,8 +137,7 @@ void UserInputMonitorWinCore::StartMonitor(EventBitMask type) { // Register to receive raw mouse and/or keyboard input. scoped_ptr<RAWINPUTDEVICE> device(GetRawInputDevices(type, RIDEV_INPUTSINK)); if (!RegisterRawInputDevices(device.get(), 1, sizeof(*device))) { - LOG_GETLASTERROR(ERROR) - << "RegisterRawInputDevices() failed for RIDEV_INPUTSINK"; + PLOG(ERROR) << "RegisterRawInputDevices() failed for RIDEV_INPUTSINK"; window_.reset(); return; } @@ -162,8 +161,7 @@ void UserInputMonitorWinCore::StopMonitor(EventBitMask type) { scoped_ptr<RAWINPUTDEVICE> device(GetRawInputDevices(type, RIDEV_REMOVE)); if (!RegisterRawInputDevices(device.get(), 1, sizeof(*device))) { - LOG_GETLASTERROR(INFO) - << "RegisterRawInputDevices() failed for RIDEV_REMOVE"; + PLOG(INFO) << "RegisterRawInputDevices() failed for RIDEV_REMOVE"; } events_monitored_ &= ~type; @@ -183,7 +181,7 @@ LRESULT UserInputMonitorWinCore::OnInput(HRAWINPUT input_handle) { UINT result = GetRawInputData( input_handle, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)); if (result == -1) { - LOG_GETLASTERROR(ERROR) << "GetRawInputData() failed"; + PLOG(ERROR) << "GetRawInputData() failed"; return 0; } DCHECK_EQ(0u, result); @@ -194,7 +192,7 @@ LRESULT UserInputMonitorWinCore::OnInput(HRAWINPUT input_handle) { result = GetRawInputData( input_handle, RID_INPUT, buffer.get(), &size, sizeof(RAWINPUTHEADER)); if (result == -1) { - LOG_GETLASTERROR(ERROR) << "GetRawInputData() failed"; + PLOG(ERROR) << "GetRawInputData() failed"; return 0; } DCHECK_EQ(size, result); diff --git a/remoting/host/curtain_mode_win.cc b/remoting/host/curtain_mode_win.cc index d94d615..d4d50ea 100644 --- a/remoting/host/curtain_mode_win.cc +++ b/remoting/host/curtain_mode_win.cc @@ -33,7 +33,7 @@ bool CurtainModeWin::Activate() { DWORD session_id; if (!ProcessIdToSessionId(GetCurrentProcessId(), &session_id)) { - LOG_GETLASTERROR(ERROR) << "Failed to map the current PID to session ID"; + PLOG(ERROR) << "Failed to map the current PID to session ID"; return false; } diff --git a/remoting/host/daemon_process_win.cc b/remoting/host/daemon_process_win.cc index a03140d..205c9c4 100644 --- a/remoting/host/daemon_process_win.cc +++ b/remoting/host/daemon_process_win.cc @@ -167,7 +167,7 @@ bool DaemonProcessWin::OnDesktopSessionAgentAttached( 0, FALSE, DUPLICATE_SAME_ACCESS)) { - LOG_GETLASTERROR(ERROR) << "Failed to duplicate the desktop process handle"; + PLOG(ERROR) << "Failed to duplicate the desktop process handle"; return false; } @@ -238,8 +238,7 @@ void DaemonProcessWin::DisableAutoStart() { OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CONNECT | SC_MANAGER_ENUMERATE_SERVICE)); if (!scmanager.IsValid()) { - LOG_GETLASTERROR(INFO) - << "Failed to connect to the service control manager"; + PLOG(INFO) << "Failed to connect to the service control manager"; return; } @@ -247,8 +246,8 @@ void DaemonProcessWin::DisableAutoStart() { ScopedScHandle service( OpenService(scmanager, kWindowsServiceName, desired_access)); if (!service.IsValid()) { - LOG_GETLASTERROR(INFO) - << "Failed to open to the '" << kWindowsServiceName << "' service"; + PLOG(INFO) << "Failed to open to the '" << kWindowsServiceName + << "' service"; return; } @@ -265,9 +264,8 @@ void DaemonProcessWin::DisableAutoStart() { NULL, NULL, NULL)) { - LOG_GETLASTERROR(INFO) - << "Failed to change the '" << kWindowsServiceName - << "'service start type to 'manual'"; + PLOG(INFO) << "Failed to change the '" << kWindowsServiceName + << "'service start type to 'manual'"; } } diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc index d077d5a..73497f9 100644 --- a/remoting/host/desktop_session_proxy.cc +++ b/remoting/host/desktop_session_proxy.cc @@ -233,8 +233,7 @@ bool DesktopSessionProxy::AttachToDesktop( HANDLE temp_handle; if (!DuplicateHandle(desktop_process_, desktop_pipe, GetCurrentProcess(), &temp_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) { - LOG_GETLASTERROR(ERROR) << "Failed to duplicate the desktop-to-network" - " pipe handle"; + PLOG(ERROR) << "Failed to duplicate the desktop-to-network pipe handle"; desktop_process_ = base::kNullProcessHandle; base::CloseProcessHandle(desktop_process); diff --git a/remoting/host/desktop_shape_tracker_win.cc b/remoting/host/desktop_shape_tracker_win.cc index 8655ed5..6b31c0c 100644 --- a/remoting/host/desktop_shape_tracker_win.cc +++ b/remoting/host/desktop_shape_tracker_win.cc @@ -57,7 +57,7 @@ void DesktopShapeTrackerWin::RefreshDesktopShape() { // Accumulate a new desktop shape from current window positions. scoped_ptr<EnumDesktopShapeData> shape_data(new EnumDesktopShapeData); if (!EnumWindows(EnumWindowsCallback, (LPARAM)shape_data.get())) { - LOG_GETLASTERROR(ERROR) << "Failed to enumerate windows"; + PLOG(ERROR) << "Failed to enumerate windows"; desktop_shape_.Clear(); return; } diff --git a/remoting/host/host_event_logger_win.cc b/remoting/host/host_event_logger_win.cc index a9e22ad..acd6aaf 100644 --- a/remoting/host/host_event_logger_win.cc +++ b/remoting/host/host_event_logger_win.cc @@ -65,8 +65,7 @@ HostEventLoggerWin::HostEventLoggerWin(base::WeakPtr<HostStatusMonitor> monitor, if (event_log_ != NULL) { monitor_->AddStatusObserver(this); } else { - LOG_GETLASTERROR(ERROR) << "Failed to register the event source: " - << application_name; + PLOG(ERROR) << "Failed to register the event source: " << application_name; } } @@ -135,7 +134,7 @@ void HostEventLoggerWin::Log(WORD type, 0, &raw_strings[0], NULL)) { - LOG_GETLASTERROR(ERROR) << "Failed to write an event to the event log"; + PLOG(ERROR) << "Failed to write an event to the event log"; } } diff --git a/remoting/host/host_main.cc b/remoting/host/host_main.cc index 9a19b46f..7312e13 100644 --- a/remoting/host/host_main.cc +++ b/remoting/host/host_main.cc @@ -119,7 +119,7 @@ int RunElevated() { if (!ShellExecuteEx(&info)) { DWORD exit_code = GetLastError(); - LOG_GETLASTERROR(ERROR) << "Unable to launch '" << binary.value() << "'"; + PLOG(ERROR) << "Unable to launch '" << binary.value() << "'"; return exit_code; } diff --git a/remoting/host/input_injector_win.cc b/remoting/host/input_injector_win.cc index 235f45e..c40e150 100644 --- a/remoting/host/input_injector_win.cc +++ b/remoting/host/input_injector_win.cc @@ -44,7 +44,7 @@ void SendKeyboardInput(uint32_t flags, uint16_t scancode) { } if (SendInput(1, &input, sizeof(INPUT)) == 0) - LOG_GETLASTERROR(ERROR) << "Failed to inject a key event"; + PLOG(ERROR) << "Failed to inject a key event"; } using protocol::ClipboardEvent; @@ -316,7 +316,7 @@ void InputInjectorWin::Core::HandleMouse(const MouseEvent& event) { if (input.mi.dwFlags) { if (SendInput(1, &input, sizeof(INPUT)) == 0) - LOG_GETLASTERROR(ERROR) << "Failed to inject a mouse event"; + PLOG(ERROR) << "Failed to inject a mouse event"; } } diff --git a/remoting/host/ipc_util_win.cc b/remoting/host/ipc_util_win.cc index a8c28db..37c3383 100644 --- a/remoting/host/ipc_util_win.cc +++ b/remoting/host/ipc_util_win.cc @@ -78,7 +78,7 @@ bool CreateConnectedIpcChannel( FILE_FLAG_OVERLAPPED, NULL)); if (!client.IsValid()) { - LOG_GETLASTERROR(ERROR) << "Failed to connect to '" << pipe_name << "'"; + PLOG(ERROR) << "Failed to connect to '" << pipe_name << "'"; return false; } @@ -94,8 +94,8 @@ bool CreateIpcChannel( // Create security descriptor for the channel. ScopedSd sd = ConvertSddlToSd(pipe_security_descriptor); if (!sd) { - LOG_GETLASTERROR(ERROR) << - "Failed to create a security descriptor for the Chromoting IPC channel"; + PLOG(ERROR) << "Failed to create a security descriptor for the Chromoting " + "IPC channel"; return false; } @@ -121,8 +121,8 @@ bool CreateIpcChannel( 5000, &security_attributes)); if (!pipe.IsValid()) { - LOG_GETLASTERROR(ERROR) << - "Failed to create the server end of the Chromoting IPC channel"; + PLOG(ERROR) + << "Failed to create the server end of the Chromoting IPC channel"; return false; } diff --git a/remoting/host/local_input_monitor_win.cc b/remoting/host/local_input_monitor_win.cc index c96663b..13bee41 100644 --- a/remoting/host/local_input_monitor_win.cc +++ b/remoting/host/local_input_monitor_win.cc @@ -128,7 +128,7 @@ void LocalInputMonitorWin::Core::StartOnUiThread() { window_.reset(new base::win::MessageWindow()); if (!window_->Create(base::Bind(&Core::HandleMessage, base::Unretained(this)))) { - LOG_GETLASTERROR(ERROR) << "Failed to create the raw input window"; + PLOG(ERROR) << "Failed to create the raw input window"; window_.reset(); // If the local input cannot be monitored, the remote user can take over @@ -168,7 +168,7 @@ LRESULT LocalInputMonitorWin::Core::OnInput(HRAWINPUT input_handle) { &size, sizeof(RAWINPUTHEADER)); if (result == -1) { - LOG_GETLASTERROR(ERROR) << "GetRawInputData() failed"; + PLOG(ERROR) << "GetRawInputData() failed"; return 0; } @@ -181,7 +181,7 @@ LRESULT LocalInputMonitorWin::Core::OnInput(HRAWINPUT input_handle) { &size, sizeof(RAWINPUTHEADER)); if (result == -1) { - LOG_GETLASTERROR(ERROR) << "GetRawInputData() failed"; + PLOG(ERROR) << "GetRawInputData() failed"; return 0; } @@ -217,7 +217,7 @@ bool LocalInputMonitorWin::Core::HandleMessage( if (RegisterRawInputDevices(&device, 1, sizeof(device))) { *result = 0; } else { - LOG_GETLASTERROR(ERROR) << "RegisterRawInputDevices() failed"; + PLOG(ERROR) << "RegisterRawInputDevices() failed"; *result = -1; } return true; diff --git a/remoting/host/sas_injector_win.cc b/remoting/host/sas_injector_win.cc index 1a866f6..c79ae72 100644 --- a/remoting/host/sas_injector_win.cc +++ b/remoting/host/sas_injector_win.cc @@ -65,8 +65,7 @@ ScopedSoftwareSasPolicy::~ScopedSoftwareSasPolicy() { LONG result = system_policy_.DeleteValue(kSoftwareSasValueName); if (result != ERROR_SUCCESS) { SetLastError(result); - LOG_GETLASTERROR(ERROR) - << "Failed to restore the software SAS generation policy"; + PLOG(ERROR) << "Failed to restore the software SAS generation policy"; } } } @@ -79,8 +78,7 @@ bool ScopedSoftwareSasPolicy::Apply() { KEY_WOW64_64KEY); if (result != ERROR_SUCCESS) { SetLastError(result); - LOG_GETLASTERROR(ERROR) << "Failed to open 'HKLM\\" - << kSystemPolicyKeyName << "'"; + PLOG(ERROR) << "Failed to open 'HKLM\\" << kSystemPolicyKeyName << "'"; return false; } @@ -92,8 +90,7 @@ bool ScopedSoftwareSasPolicy::Apply() { kEnableSoftwareSasByServices); if (result != ERROR_SUCCESS) { SetLastError(result); - LOG_GETLASTERROR(ERROR) - << "Failed to enable software SAS generation by services"; + PLOG(ERROR) << "Failed to enable software SAS generation by services"; return false; } else { restore_policy_ = true; @@ -193,22 +190,20 @@ bool SasInjectorXp::InjectSas() { scoped_ptr<webrtc::Desktop> winlogon_desktop( webrtc::Desktop::GetDesktop(kWinlogonDesktopName)); if (!winlogon_desktop.get()) { - LOG_GETLASTERROR(ERROR) - << "Failed to open '" << kWinlogonDesktopName << "' desktop"; + PLOG(ERROR) << "Failed to open '" << kWinlogonDesktopName << "' desktop"; return false; } webrtc::ScopedThreadDesktop desktop; if (!desktop.SetThreadDesktop(winlogon_desktop.release())) { - LOG_GETLASTERROR(ERROR) - << "Failed to switch to '" << kWinlogonDesktopName << "' desktop"; + PLOG(ERROR) << "Failed to switch to '" << kWinlogonDesktopName + << "' desktop"; return false; } HWND window = FindWindow(kSasWindowClassName, kSasWindowTitle); if (!window) { - LOG_GETLASTERROR(ERROR) - << "Failed to find '" << kSasWindowTitle << "' window"; + PLOG(ERROR) << "Failed to find '" << kSasWindowTitle << "' window"; return false; } @@ -216,8 +211,7 @@ bool SasInjectorXp::InjectSas() { WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE)) == 0) { - LOG_GETLASTERROR(ERROR) - << "Failed to post WM_HOTKEY message"; + PLOG(ERROR) << "Failed to post WM_HOTKEY message"; return false; } diff --git a/remoting/host/setup/daemon_controller_delegate_win.cc b/remoting/host/setup/daemon_controller_delegate_win.cc index 4ff6571..1f965cd 100644 --- a/remoting/host/setup/daemon_controller_delegate_win.cc +++ b/remoting/host/setup/daemon_controller_delegate_win.cc @@ -94,8 +94,7 @@ DWORD OpenService(ScopedScHandle* service_out) { SC_MANAGER_CONNECT | SC_MANAGER_ENUMERATE_SERVICE)); if (!scmanager.IsValid()) { DWORD error = GetLastError(); - LOG_GETLASTERROR(ERROR) - << "Failed to connect to the service control manager"; + PLOG(ERROR) << "Failed to connect to the service control manager"; return error; } @@ -104,8 +103,8 @@ DWORD OpenService(ScopedScHandle* service_out) { if (!service.IsValid()) { DWORD error = GetLastError(); if (error != ERROR_SERVICE_DOES_NOT_EXIST) { - LOG_GETLASTERROR(ERROR) - << "Failed to open to the '" << kWindowsServiceName << "' service"; + PLOG(ERROR) << "Failed to open to the '" << kWindowsServiceName + << "' service"; } return error; } @@ -157,9 +156,8 @@ DaemonController::State DaemonControllerDelegateWin::GetState() { if (::QueryServiceStatus(service, &status)) { return ConvertToDaemonState(status.dwCurrentState); } else { - LOG_GETLASTERROR(ERROR) - << "Failed to query the state of the '" << kWindowsServiceName - << "' service"; + PLOG(ERROR) << "Failed to query the state of the '" + << kWindowsServiceName << "' service"; return DaemonController::STATE_UNKNOWN; } break; diff --git a/remoting/host/setup/me2me_native_messaging_host.cc b/remoting/host/setup/me2me_native_messaging_host.cc index 72076db..339c6454 100644 --- a/remoting/host/setup/me2me_native_messaging_host.cc +++ b/remoting/host/setup/me2me_native_messaging_host.cc @@ -541,8 +541,8 @@ void Me2MeNativeMessagingHost::EnsureElevatedHostCreated() { ScopedSd sd = ConvertSddlToSd(security_descriptor); if (!sd) { - LOG_GETLASTERROR(ERROR) << "Failed to create a security descriptor for the" - << "Chromoting Me2Me native messaging host."; + PLOG(ERROR) << "Failed to create a security descriptor for the" + << "Chromoting Me2Me native messaging host."; OnError(); return; } @@ -567,8 +567,7 @@ void Me2MeNativeMessagingHost::EnsureElevatedHostCreated() { &security_attributes)); if (!delegate_write_handle.IsValid()) { - LOG_GETLASTERROR(ERROR) << - "Failed to create named pipe '" << input_pipe_name << "'"; + PLOG(ERROR) << "Failed to create named pipe '" << input_pipe_name << "'"; OnError(); return; } @@ -588,8 +587,7 @@ void Me2MeNativeMessagingHost::EnsureElevatedHostCreated() { &security_attributes)); if (!delegate_read_handle.IsValid()) { - LOG_GETLASTERROR(ERROR) << - "Failed to create named pipe '" << output_pipe_name << "'"; + PLOG(ERROR) << "Failed to create named pipe '" << output_pipe_name << "'"; OnError(); return; } @@ -631,7 +629,7 @@ void Me2MeNativeMessagingHost::EnsureElevatedHostCreated() { if (!ShellExecuteEx(&info)) { DWORD error = ::GetLastError(); - LOG_GETLASTERROR(ERROR) << "Unable to launch '" << binary.value() << "'"; + PLOG(ERROR) << "Unable to launch '" << binary.value() << "'"; if (error != ERROR_CANCELLED) { OnError(); } @@ -641,8 +639,7 @@ void Me2MeNativeMessagingHost::EnsureElevatedHostCreated() { if (!::ConnectNamedPipe(delegate_write_handle.Get(), NULL)) { DWORD error = ::GetLastError(); if (error != ERROR_PIPE_CONNECTED) { - LOG_GETLASTERROR(ERROR) << "Unable to connect '" - << input_pipe_name << "'"; + PLOG(ERROR) << "Unable to connect '" << input_pipe_name << "'"; OnError(); return; } @@ -651,8 +648,7 @@ void Me2MeNativeMessagingHost::EnsureElevatedHostCreated() { if (!::ConnectNamedPipe(delegate_read_handle.Get(), NULL)) { DWORD error = ::GetLastError(); if (error != ERROR_PIPE_CONNECTED) { - LOG_GETLASTERROR(ERROR) << "Unable to connect '" - << output_pipe_name << "'"; + PLOG(ERROR) << "Unable to connect '" << output_pipe_name << "'"; OnError(); return; } diff --git a/remoting/host/setup/me2me_native_messaging_host_main.cc b/remoting/host/setup/me2me_native_messaging_host_main.cc index d164bec..ee6aad8 100644 --- a/remoting/host/setup/me2me_native_messaging_host_main.cc +++ b/remoting/host/setup/me2me_native_messaging_host_main.cc @@ -134,8 +134,7 @@ int StartMe2MeNativeMessagingHost() { input_pipe_name.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)); if (!read_file.IsValid()) { - LOG_GETLASTERROR(ERROR) << - "CreateFile failed on '" << input_pipe_name << "'"; + PLOG(ERROR) << "CreateFile failed on '" << input_pipe_name << "'"; return kInitializationFailed; } @@ -143,8 +142,7 @@ int StartMe2MeNativeMessagingHost() { output_pipe_name.c_str(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)); if (!write_file.IsValid()) { - LOG_GETLASTERROR(ERROR) << - "CreateFile failed on '" << output_pipe_name << "'"; + PLOG(ERROR) << "CreateFile failed on '" << output_pipe_name << "'"; return kInitializationFailed; } } else { diff --git a/remoting/host/usage_stats_consent_win.cc b/remoting/host/usage_stats_consent_win.cc index d06cfb1..bacab67 100644 --- a/remoting/host/usage_stats_consent_win.cc +++ b/remoting/host/usage_stats_consent_win.cc @@ -86,8 +86,7 @@ bool SetUsageStatsConsent(bool allowed) { } } - LOG_GETLASTERROR(ERROR) - << "Failed to record the user's consent to crash dump reporting"; + PLOG(ERROR) << "Failed to record the user's consent to crash dump reporting"; return false; } diff --git a/remoting/host/win/com_security.cc b/remoting/host/win/com_security.cc index 34b3dc4..9cefaad 100644 --- a/remoting/host/win/com_security.cc +++ b/remoting/host/win/com_security.cc @@ -25,7 +25,7 @@ bool InitializeComSecurity(const std::string& security_descriptor, // Convert the SDDL description into a security descriptor in absolute format. ScopedSd relative_sd = ConvertSddlToSd(sddl); if (!relative_sd) { - LOG_GETLASTERROR(ERROR) << "Failed to create a security descriptor"; + PLOG(ERROR) << "Failed to create a security descriptor"; return false; } ScopedSd absolute_sd; @@ -35,7 +35,7 @@ bool InitializeComSecurity(const std::string& security_descriptor, ScopedAcl sacl; if (!MakeScopedAbsoluteSd(relative_sd, &absolute_sd, &dacl, &group, &owner, &sacl)) { - LOG_GETLASTERROR(ERROR) << "MakeScopedAbsoluteSd() failed"; + PLOG(ERROR) << "MakeScopedAbsoluteSd() failed"; return false; } diff --git a/remoting/host/win/elevated_controller.cc b/remoting/host/win/elevated_controller.cc index d826dc9..7da5ab8 100644 --- a/remoting/host/win/elevated_controller.cc +++ b/remoting/host/win/elevated_controller.cc @@ -108,8 +108,7 @@ HRESULT ReadConfig(const base::FilePath& filename, if (!file.IsValid()) { DWORD error = GetLastError(); - LOG_GETLASTERROR(ERROR) - << "Failed to open '" << filename.value() << "'"; + PLOG(ERROR) << "Failed to open '" << filename.value() << "'"; return HRESULT_FROM_WIN32(error); } @@ -117,8 +116,7 @@ HRESULT ReadConfig(const base::FilePath& filename, DWORD size = kMaxConfigFileSize; if (!::ReadFile(file, &buffer[0], size, &size, NULL)) { DWORD error = GetLastError(); - LOG_GETLASTERROR(ERROR) - << "Failed to read '" << filename.value() << "'"; + PLOG(ERROR) << "Failed to read '" << filename.value() << "'"; return HRESULT_FROM_WIN32(error); } @@ -151,8 +149,8 @@ HRESULT WriteConfigFileToTemp(const base::FilePath& filename, ScopedSd sd = ConvertSddlToSd(security_descriptor); if (!sd) { DWORD error = GetLastError(); - LOG_GETLASTERROR(ERROR) << - "Failed to create a security descriptor for the configuration file"; + PLOG(ERROR) + << "Failed to create a security descriptor for the configuration file"; return HRESULT_FROM_WIN32(error); } @@ -174,16 +172,14 @@ HRESULT WriteConfigFileToTemp(const base::FilePath& filename, if (!file.IsValid()) { DWORD error = GetLastError(); - LOG_GETLASTERROR(ERROR) - << "Failed to create '" << filename.value() << "'"; + PLOG(ERROR) << "Failed to create '" << filename.value() << "'"; return HRESULT_FROM_WIN32(error); } DWORD written; if (!WriteFile(file, content, static_cast<DWORD>(length), &written, NULL)) { DWORD error = GetLastError(); - LOG_GETLASTERROR(ERROR) - << "Failed to write to '" << filename.value() << "'"; + PLOG(ERROR) << "Failed to write to '" << filename.value() << "'"; return HRESULT_FROM_WIN32(error); } @@ -199,9 +195,8 @@ HRESULT MoveConfigFileFromTemp(const base::FilePath& filename) { filename.value().c_str(), MOVEFILE_REPLACE_EXISTING)) { DWORD error = GetLastError(); - LOG_GETLASTERROR(ERROR) - << "Failed to rename '" << tempname.value() << "' to '" - << filename.value() << "'"; + PLOG(ERROR) << "Failed to rename '" << tempname.value() << "' to '" + << filename.value() << "'"; return HRESULT_FROM_WIN32(error); } @@ -389,9 +384,8 @@ STDMETHODIMP ElevatedController::StartDaemon() { NULL, NULL)) { DWORD error = GetLastError(); - LOG_GETLASTERROR(ERROR) - << "Failed to change the '" << kWindowsServiceName - << "'service start type to 'auto'"; + PLOG(ERROR) << "Failed to change the '" << kWindowsServiceName + << "'service start type to 'auto'"; return HRESULT_FROM_WIN32(error); } @@ -399,8 +393,8 @@ STDMETHODIMP ElevatedController::StartDaemon() { if (!StartService(service, 0, NULL)) { DWORD error = GetLastError(); if (error != ERROR_SERVICE_ALREADY_RUNNING) { - LOG_GETLASTERROR(ERROR) - << "Failed to start the '" << kWindowsServiceName << "'service"; + PLOG(ERROR) << "Failed to start the '" << kWindowsServiceName + << "'service"; return HRESULT_FROM_WIN32(error); } @@ -429,9 +423,8 @@ STDMETHODIMP ElevatedController::StopDaemon() { NULL, NULL)) { DWORD error = GetLastError(); - LOG_GETLASTERROR(ERROR) - << "Failed to change the '" << kWindowsServiceName - << "'service start type to 'manual'"; + PLOG(ERROR) << "Failed to change the '" << kWindowsServiceName + << "'service start type to 'manual'"; return HRESULT_FROM_WIN32(error); } @@ -440,8 +433,8 @@ STDMETHODIMP ElevatedController::StopDaemon() { if (!ControlService(service, SERVICE_CONTROL_STOP, &status)) { DWORD error = GetLastError(); if (error != ERROR_SERVICE_NOT_ACTIVE) { - LOG_GETLASTERROR(ERROR) - << "Failed to stop the '" << kWindowsServiceName << "'service"; + PLOG(ERROR) << "Failed to stop the '" << kWindowsServiceName + << "'service"; return HRESULT_FROM_WIN32(error); } } @@ -512,8 +505,7 @@ HRESULT ElevatedController::OpenService(ScopedScHandle* service_out) { SC_MANAGER_CONNECT | SC_MANAGER_ENUMERATE_SERVICE)); if (!scmanager.IsValid()) { error = GetLastError(); - LOG_GETLASTERROR(ERROR) - << "Failed to connect to the service control manager"; + PLOG(ERROR) << "Failed to connect to the service control manager"; return HRESULT_FROM_WIN32(error); } @@ -524,8 +516,8 @@ HRESULT ElevatedController::OpenService(ScopedScHandle* service_out) { ::OpenServiceW(scmanager, kWindowsServiceName, desired_access)); if (!service.IsValid()) { error = GetLastError(); - LOG_GETLASTERROR(ERROR) - << "Failed to open to the '" << kWindowsServiceName << "' service"; + PLOG(ERROR) << "Failed to open to the '" << kWindowsServiceName + << "' service"; return HRESULT_FROM_WIN32(error); } diff --git a/remoting/host/win/host_service.cc b/remoting/host/win/host_service.cc index 8a9ff9e..2fe2943 100644 --- a/remoting/host/win/host_service.cc +++ b/remoting/host/win/host_service.cc @@ -224,8 +224,7 @@ int HostService::RunAsService() { }; if (!StartServiceCtrlDispatcherW(dispatch_table)) { - LOG_GETLASTERROR(ERROR) - << "Failed to connect to the service control manager"; + PLOG(ERROR) << "Failed to connect to the service control manager"; return kInitializationFailed; } @@ -247,8 +246,7 @@ void HostService::RunAsServiceImpl() { service_status_handle_ = RegisterServiceCtrlHandlerExW( kWindowsServiceName, &HostService::ServiceControlHandler, this); if (service_status_handle_ == 0) { - LOG_GETLASTERROR(ERROR) - << "Failed to register the service control handler"; + PLOG(ERROR) << "Failed to register the service control handler"; return; } @@ -262,7 +260,7 @@ void HostService::RunAsServiceImpl() { SERVICE_ACCEPT_SESSIONCHANGE; service_status.dwWin32ExitCode = kSuccessExitCode; if (!SetServiceStatus(service_status_handle_, &service_status)) { - LOG_GETLASTERROR(ERROR) + PLOG(ERROR) << "Failed to report service status to the service control manager"; return; } @@ -290,7 +288,7 @@ void HostService::RunAsServiceImpl() { service_status.dwCurrentState = SERVICE_STOPPED; service_status.dwControlsAccepted = 0; if (!SetServiceStatus(service_status_handle_, &service_status)) { - LOG_GETLASTERROR(ERROR) + PLOG(ERROR) << "Failed to report service status to the service control manager"; return; } @@ -317,8 +315,7 @@ int HostService::RunInConsole() { // Subscribe to Ctrl-C and other console events. if (!SetConsoleCtrlHandler(&HostService::ConsoleControlHandler, TRUE)) { - LOG_GETLASTERROR(ERROR) - << "Failed to set console control handler"; + PLOG(ERROR) << "Failed to set console control handler"; return result; } @@ -326,8 +323,7 @@ int HostService::RunInConsole() { base::win::MessageWindow window; if (!window.Create(base::Bind(&HostService::HandleMessage, base::Unretained(this)))) { - LOG_GETLASTERROR(ERROR) - << "Failed to create the session notification window"; + PLOG(ERROR) << "Failed to create the session notification window"; goto cleanup; } diff --git a/remoting/host/win/launch_process_with_token.cc b/remoting/host/win/launch_process_with_token.cc index 5e9ad81..6f7e407 100644 --- a/remoting/host/win/launch_process_with_token.cc +++ b/remoting/host/win/launch_process_with_token.cc @@ -112,7 +112,7 @@ bool ConnectToExecutionServer(uint32 session_id, } if (!pipe.IsValid()) { - LOG_GETLASTERROR(ERROR) << "Failed to connect to '" << pipe_name << "'"; + PLOG(ERROR) << "Failed to connect to '" << pipe_name << "'"; return false; } @@ -127,7 +127,7 @@ bool CopyProcessToken(DWORD desired_access, ScopedHandle* token_out) { if (!OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE | desired_access, &temp_handle)) { - LOG_GETLASTERROR(ERROR) << "Failed to open process token"; + PLOG(ERROR) << "Failed to open process token"; return false; } ScopedHandle process_token(temp_handle); @@ -138,7 +138,7 @@ bool CopyProcessToken(DWORD desired_access, ScopedHandle* token_out) { SecurityImpersonation, TokenPrimary, &temp_handle)) { - LOG_GETLASTERROR(ERROR) << "Failed to duplicate the process token"; + PLOG(ERROR) << "Failed to duplicate the process token"; return false; } @@ -160,15 +160,13 @@ bool CreatePrivilegedToken(ScopedHandle* token_out) { state.PrivilegeCount = 1; state.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; if (!LookupPrivilegeValue(NULL, SE_TCB_NAME, &state.Privileges[0].Luid)) { - LOG_GETLASTERROR(ERROR) << - "Failed to lookup the LUID for the SE_TCB_NAME privilege"; + PLOG(ERROR) << "Failed to lookup the LUID for the SE_TCB_NAME privilege"; return false; } // Enable the SE_TCB_NAME privilege. if (!AdjustTokenPrivileges(privileged_token, FALSE, &state, 0, NULL, 0)) { - LOG_GETLASTERROR(ERROR) << - "Failed to enable SE_TCB_NAME privilege in a token"; + PLOG(ERROR) << "Failed to enable SE_TCB_NAME privilege in a token"; return false; } @@ -206,8 +204,8 @@ bool ProcessCreateProcessResponse(DWORD creation_flags, FALSE, process_information->dwProcessId); if (!process_information->hProcess) { - LOG_GETLASTERROR(ERROR) << "Failed to open the process " - << process_information->dwProcessId; + PLOG(ERROR) << "Failed to open the process " + << process_information->dwProcessId; return false; } } @@ -233,8 +231,8 @@ bool ProcessCreateProcessResponse(DWORD creation_flags, FALSE, process_information->dwThreadId); if (!process_information->hThread) { - LOG_GETLASTERROR(ERROR) << "Failed to open the thread " - << process_information->dwThreadId; + PLOG(ERROR) << "Failed to open the thread " + << process_information->dwThreadId; return false; } } @@ -242,8 +240,8 @@ bool ProcessCreateProcessResponse(DWORD creation_flags, // Resume the thread if the caller didn't want to suspend the process. if ((creation_flags & CREATE_SUSPENDED) == 0) { if (!ResumeThread(process_information->hThread)) { - LOG_GETLASTERROR(ERROR) << "Failed to resume the thread " - << process_information->dwThreadId; + PLOG(ERROR) << "Failed to resume the thread " + << process_information->dwThreadId; return false; } } @@ -265,7 +263,7 @@ bool ReceiveCreateProcessResponse( DWORD bytes; CreateProcessResponse response; if (!ReadFile(pipe, &response, sizeof(response), &bytes, NULL)) { - LOG_GETLASTERROR(ERROR) << "Failed to receive CreateProcessAsUser response"; + PLOG(ERROR) << "Failed to receive CreateProcessAsUser response"; return false; } @@ -359,7 +357,7 @@ bool SendCreateProcessRequest( // Pass the request to create a process in the target session. DWORD bytes; if (!WriteFile(pipe, buffer.get(), size, &bytes, NULL)) { - LOG_GETLASTERROR(ERROR) << "Failed to send CreateProcessAsUser request"; + PLOG(ERROR) << "Failed to send CreateProcessAsUser request"; return false; } @@ -425,8 +423,7 @@ bool CreateSessionToken(uint32 session_id, ScopedHandle* token_out) { return false; } if (!ImpersonateLoggedOnUser(privileged_token)) { - LOG_GETLASTERROR(ERROR) << - "Failed to impersonate the privileged token"; + PLOG(ERROR) << "Failed to impersonate the privileged token"; return false; } @@ -436,7 +433,7 @@ bool CreateSessionToken(uint32 session_id, ScopedHandle* token_out) { TokenSessionId, &new_session_id, sizeof(new_session_id))) { - LOG_GETLASTERROR(ERROR) << "Failed to change session ID of a token"; + PLOG(ERROR) << "Failed to change session ID of a token"; // Revert to the default token. CHECK(RevertToSelf()); @@ -512,8 +509,7 @@ bool LaunchProcessWithToken(const base::FilePath& binary, } if (!result) { - LOG_GETLASTERROR(ERROR) << - "Failed to launch a process with a user token"; + PLOG(ERROR) << "Failed to launch a process with a user token"; return false; } diff --git a/remoting/host/win/rdp_client_window.cc b/remoting/host/win/rdp_client_window.cc index fe3da3c..9b483b0 100644 --- a/remoting/host/win/rdp_client_window.cc +++ b/remoting/host/win/rdp_client_window.cc @@ -161,7 +161,7 @@ void RdpClientWindow::InjectSas() { BYTE keyboard_state[kKeyboardStateLength]; if (!GetKeyboardState(keyboard_state)) { - LOG_GETLASTERROR(ERROR) << "Failed to get the keyboard state."; + PLOG(ERROR) << "Failed to get the keyboard state."; return; } diff --git a/remoting/host/win/unprivileged_process_delegate.cc b/remoting/host/win/unprivileged_process_delegate.cc index 1457bd7..b8ae249 100644 --- a/remoting/host/win/unprivileged_process_delegate.cc +++ b/remoting/host/win/unprivileged_process_delegate.cc @@ -113,7 +113,7 @@ bool CreateWindowStationAndDesktop(ScopedSid logon_sid, // Convert the logon SID into a string. std::string logon_sid_string = ConvertSidToString(logon_sid.get()); if (logon_sid_string.empty()) { - LOG_GETLASTERROR(ERROR) << "Failed to convert a SID to string"; + PLOG(ERROR) << "Failed to convert a SID to string"; return false; } @@ -134,7 +134,7 @@ bool CreateWindowStationAndDesktop(ScopedSid logon_sid, ScopedSd desktop_sd = ConvertSddlToSd(desktop_sddl); ScopedSd window_station_sd = ConvertSddlToSd(window_station_sddl); if (!desktop_sd || !window_station_sd) { - LOG_GETLASTERROR(ERROR) << "Failed to create a security descriptor."; + PLOG(ERROR) << "Failed to create a security descriptor."; return false; } @@ -169,13 +169,13 @@ bool CreateWindowStationAndDesktop(ScopedSid logon_sid, base::UTF8ToUTF16(window_station_name).c_str(), window_station_flags, desired_access, &security_attributes)); if (!handles.window_station()) { - LOG_GETLASTERROR(ERROR) << "CreateWindowStation() failed"; + PLOG(ERROR) << "CreateWindowStation() failed"; return false; } // Switch to the new window station and create a desktop on it. if (!SetProcessWindowStation(handles.window_station())) { - LOG_GETLASTERROR(ERROR) << "SetProcessWindowStation() failed"; + PLOG(ERROR) << "SetProcessWindowStation() failed"; return false; } @@ -196,12 +196,12 @@ bool CreateWindowStationAndDesktop(ScopedSid logon_sid, // Switch back to the original window station. if (!SetProcessWindowStation(current_window_station)) { - LOG_GETLASTERROR(ERROR) << "SetProcessWindowStation() failed"; + PLOG(ERROR) << "SetProcessWindowStation() failed"; return false; } if (!handles.desktop()) { - LOG_GETLASTERROR(ERROR) << "CreateDesktop() failed"; + PLOG(ERROR) << "CreateDesktop() failed"; return false; } @@ -237,8 +237,7 @@ void UnprivilegedProcessDelegate::LaunchProcess( // Create a restricted token that will be used to run the worker process. ScopedHandle token; if (!CreateRestrictedToken(&token)) { - LOG_GETLASTERROR(ERROR) - << "Failed to create a restricted LocalService token"; + PLOG(ERROR) << "Failed to create a restricted LocalService token"; ReportFatalError(); return; } @@ -247,7 +246,7 @@ void UnprivilegedProcessDelegate::LaunchProcess( // and desktop. ScopedSid logon_sid = GetLogonSid(token); if (!logon_sid) { - LOG_GETLASTERROR(ERROR) << "Failed to retrieve the logon SID"; + PLOG(ERROR) << "Failed to retrieve the logon SID"; ReportFatalError(); return; } @@ -256,7 +255,7 @@ void UnprivilegedProcessDelegate::LaunchProcess( ScopedSd process_sd = ConvertSddlToSd(kWorkerProcessSd); ScopedSd thread_sd = ConvertSddlToSd(kWorkerThreadSd); if (!process_sd || !thread_sd) { - LOG_GETLASTERROR(ERROR) << "Failed to create a security descriptor"; + PLOG(ERROR) << "Failed to create a security descriptor"; ReportFatalError(); return; } @@ -298,8 +297,7 @@ void UnprivilegedProcessDelegate::LaunchProcess( // Create our own window station and desktop accessible by |logon_sid|. WindowStationAndDesktop handles; if (!CreateWindowStationAndDesktop(logon_sid.Pass(), &handles)) { - LOG_GETLASTERROR(ERROR) - << "Failed to create a window station and desktop"; + PLOG(ERROR) << "Failed to create a window station and desktop"; ReportFatalError(); return; } @@ -411,7 +409,7 @@ void UnprivilegedProcessDelegate::ReportProcessLaunched( desired_access, FALSE, 0)) { - LOG_GETLASTERROR(ERROR) << "Failed to duplicate a handle"; + PLOG(ERROR) << "Failed to duplicate a handle"; ReportFatalError(); return; } diff --git a/remoting/host/win/worker_process_launcher.cc b/remoting/host/win/worker_process_launcher.cc index 779fdab..f7d89ef 100644 --- a/remoting/host/win/worker_process_launcher.cc +++ b/remoting/host/win/worker_process_launcher.cc @@ -171,8 +171,7 @@ void WorkerProcessLauncher::OnObjectSignaled(HANDLE object) { // Get exit code of the worker process if it is available. if (!::GetExitCodeProcess(worker_process_, &exit_code_)) { - LOG_GETLASTERROR(INFO) - << "Failed to query the exit code of the worker process"; + PLOG(INFO) << "Failed to query the exit code of the worker process"; exit_code_ = CONTROL_C_EXIT; } diff --git a/remoting/host/win/wts_session_process_delegate.cc b/remoting/host/win/wts_session_process_delegate.cc index f19b37d..65f79ff 100644 --- a/remoting/host/win/wts_session_process_delegate.cc +++ b/remoting/host/win/wts_session_process_delegate.cc @@ -176,7 +176,7 @@ bool WtsSessionProcessDelegate::Core::Initialize(uint32 session_id) { ScopedHandle job; job.Set(CreateJobObject(NULL, NULL)); if (!job.IsValid()) { - LOG_GETLASTERROR(ERROR) << "Failed to create a job object"; + PLOG(ERROR) << "Failed to create a job object"; return false; } @@ -192,7 +192,7 @@ bool WtsSessionProcessDelegate::Core::Initialize(uint32 session_id) { JobObjectExtendedLimitInformation, &info, sizeof(info))) { - LOG_GETLASTERROR(ERROR) << "Failed to set limits on the job object"; + PLOG(ERROR) << "Failed to set limits on the job object"; return false; } @@ -307,7 +307,7 @@ void WtsSessionProcessDelegate::Core::OnChannelConnected(int32 peer_pid) { if (launch_elevated_) { DWORD pid; if (!get_named_pipe_client_pid_(pipe_, &pid)) { - LOG_GETLASTERROR(ERROR) << "Failed to retrive PID of the client"; + PLOG(ERROR) << "Failed to retrive PID of the client"; ReportFatalError(); return; } @@ -324,7 +324,7 @@ void WtsSessionProcessDelegate::Core::OnChannelConnected(int32 peer_pid) { SYNCHRONIZE | PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION; ScopedHandle worker_process(OpenProcess(desired_access, false, pid)); if (!worker_process.IsValid()) { - LOG_GETLASTERROR(ERROR) << "Failed to open process " << pid; + PLOG(ERROR) << "Failed to open process " << pid; ReportFatalError(); return; } @@ -408,15 +408,14 @@ void WtsSessionProcessDelegate::Core::DoLaunchProcess() { if (launch_elevated_) { if (!AssignProcessToJobObject(job_, worker_process)) { - LOG_GETLASTERROR(ERROR) - << "Failed to assign the worker to the job object"; + PLOG(ERROR) << "Failed to assign the worker to the job object"; ReportFatalError(); return; } } if (!ResumeThread(worker_thread)) { - LOG_GETLASTERROR(ERROR) << "Failed to resume the worker thread"; + PLOG(ERROR) << "Failed to resume the worker thread"; ReportFatalError(); return; } @@ -460,8 +459,7 @@ void WtsSessionProcessDelegate::Core::InitializeJob( // Register to receive job notifications via the I/O thread's completion port. if (!base::MessageLoopForIO::current()->RegisterJobObject(job->Get(), this)) { - LOG_GETLASTERROR(ERROR) - << "Failed to associate the job object with a completion port"; + PLOG(ERROR) << "Failed to associate the job object with a completion port"; return; } @@ -521,7 +519,7 @@ void WtsSessionProcessDelegate::Core::ReportProcessLaunched( desired_access, FALSE, 0)) { - LOG_GETLASTERROR(ERROR) << "Failed to duplicate a handle"; + PLOG(ERROR) << "Failed to duplicate a handle"; ReportFatalError(); return; } diff --git a/remoting/host/win/wts_terminal_monitor.cc b/remoting/host/win/wts_terminal_monitor.cc index 6c65479..705019b 100644 --- a/remoting/host/win/wts_terminal_monitor.cc +++ b/remoting/host/win/wts_terminal_monitor.cc @@ -61,7 +61,7 @@ uint32 WtsTerminalMonitor::LookupSessionId(const std::string& terminal_id) { DWORD session_info_count; if (!WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, &session_info, &session_info_count)) { - LOG_GETLASTERROR(ERROR) << "Failed to enumerate all sessions"; + PLOG(ERROR) << "Failed to enumerate all sessions"; return kInvalidSessionId; } for (DWORD i = 0; i < session_info_count; ++i) { diff --git a/remoting/tools/breakpad_tester_win.cc b/remoting/tools/breakpad_tester_win.cc index b87d878..846d61e 100644 --- a/remoting/tools/breakpad_tester_win.cc +++ b/remoting/tools/breakpad_tester_win.cc @@ -64,7 +64,7 @@ int main(int argc, char** argv) { base::win::ScopedHandle process; process.Set(OpenProcess(desired_access, FALSE, pid)); if (!process.IsValid()) { - LOG_GETLASTERROR(ERROR) << "Failed to open the process " << pid; + PLOG(ERROR) << "Failed to open the process " << pid; return kErrorExitCode; } @@ -73,7 +73,7 @@ int main(int argc, char** argv) { thread.Set(CreateRemoteThread(process.Get(), NULL, 0, NULL, NULL, 0, &thread_id)); if (!thread.IsValid()) { - LOG_GETLASTERROR(ERROR) << "Failed to create a remote thread in " << pid; + PLOG(ERROR) << "Failed to create a remote thread in " << pid; return kErrorExitCode; } diff --git a/ui/gfx/win/hwnd_util.cc b/ui/gfx/win/hwnd_util.cc index e28398a..050aa9b 100644 --- a/ui/gfx/win/hwnd_util.cc +++ b/ui/gfx/win/hwnd_util.cc @@ -54,16 +54,16 @@ void AdjustWindowToFit(HWND hwnd, const RECT& bounds, bool fit_to_monitor) { MSVC_DISABLE_OPTIMIZE(); void CrashOutOfMemory() { - LOG_GETLASTERROR(FATAL); + PLOG(FATAL); } void CrashAccessDenied() { - LOG_GETLASTERROR(FATAL); + PLOG(FATAL); } // Crash isn't one of the ones we commonly see. void CrashOther() { - LOG_GETLASTERROR(FATAL); + PLOG(FATAL); } MSVC_ENABLE_OPTIMIZE(); @@ -200,7 +200,7 @@ void CheckWindowCreated(HWND hwnd) { CrashOther(); break; } - LOG_GETLASTERROR(FATAL); + PLOG(FATAL); } } diff --git a/ui/views/corewm/tooltip_win.cc b/ui/views/corewm/tooltip_win.cc index 34ea171..1ed788f 100644 --- a/ui/views/corewm/tooltip_win.cc +++ b/ui/views/corewm/tooltip_win.cc @@ -65,7 +65,7 @@ bool TooltipWin::EnsureTooltipWindow() { TOOLTIPS_CLASS, NULL, TTS_NOPREFIX | WS_POPUP, 0, 0, 0, 0, parent_hwnd_, NULL, NULL, NULL); if (!tooltip_hwnd_) { - LOG_GETLASTERROR(WARNING) << "tooltip creation failed, disabling tooltips"; + PLOG(WARNING) << "tooltip creation failed, disabling tooltips"; return false; } |