| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/win/rdp_client_window.h" | 5 #include "remoting/host/win/rdp_client_window.h" |
| 6 | 6 |
| 7 #include <wtsdefs.h> | 7 #include <wtsdefs.h> |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 | 10 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 result = activex_window.CreateControlEx( | 280 result = activex_window.CreateControlEx( |
| 281 OLESTR("MsTscAx.MsTscAx"), | 281 OLESTR("MsTscAx.MsTscAx"), |
| 282 nullptr, | 282 nullptr, |
| 283 nullptr, | 283 nullptr, |
| 284 control.Receive(), | 284 control.Receive(), |
| 285 __uuidof(mstsc::IMsTscAxEvents), | 285 __uuidof(mstsc::IMsTscAxEvents), |
| 286 reinterpret_cast<IUnknown*>(static_cast<RdpEventsSink*>(this))); | 286 reinterpret_cast<IUnknown*>(static_cast<RdpEventsSink*>(this))); |
| 287 if (FAILED(result)) | 287 if (FAILED(result)) |
| 288 return LogOnCreateError(result); | 288 return LogOnCreateError(result); |
| 289 | 289 |
| 290 result = control.QueryInterface(client_.Receive()); | 290 result = control.CopyTo(client_.Receive()); |
| 291 if (FAILED(result)) | 291 if (FAILED(result)) |
| 292 return LogOnCreateError(result); | 292 return LogOnCreateError(result); |
| 293 | 293 |
| 294 // Use 32-bit color. | 294 // Use 32-bit color. |
| 295 result = client_->put_ColorDepth(32); | 295 result = client_->put_ColorDepth(32); |
| 296 if (FAILED(result)) | 296 if (FAILED(result)) |
| 297 return LogOnCreateError(result); | 297 return LogOnCreateError(result); |
| 298 | 298 |
| 299 // Set dimensions of the remote desktop. | 299 // Set dimensions of the remote desktop. |
| 300 result = client_->put_DesktopWidth(screen_resolution_.dimensions().width()); | 300 result = client_->put_DesktopWidth(screen_resolution_.dimensions().width()); |
| 301 if (FAILED(result)) | 301 if (FAILED(result)) |
| 302 return LogOnCreateError(result); | 302 return LogOnCreateError(result); |
| 303 result = client_->put_DesktopHeight(screen_resolution_.dimensions().height()); | 303 result = client_->put_DesktopHeight(screen_resolution_.dimensions().height()); |
| 304 if (FAILED(result)) | 304 if (FAILED(result)) |
| 305 return LogOnCreateError(result); | 305 return LogOnCreateError(result); |
| 306 | 306 |
| 307 // Check to see if the platform exposes the interface used for resizing. | 307 // Check to see if the platform exposes the interface used for resizing. |
| 308 result = client_.QueryInterface(client_9_.Receive()); | 308 result = client_.CopyTo(client_9_.Receive()); |
| 309 if (FAILED(result) && result != E_NOINTERFACE) { | 309 if (FAILED(result) && result != E_NOINTERFACE) { |
| 310 return LogOnCreateError(result); | 310 return LogOnCreateError(result); |
| 311 } | 311 } |
| 312 | 312 |
| 313 // Set the server name to connect to. | 313 // Set the server name to connect to. |
| 314 result = client_->put_Server(server_name); | 314 result = client_->put_Server(server_name); |
| 315 if (FAILED(result)) | 315 if (FAILED(result)) |
| 316 return LogOnCreateError(result); | 316 return LogOnCreateError(result); |
| 317 | 317 |
| 318 // Fetch IMsRdpClientAdvancedSettings interface for the client. | 318 // Fetch IMsRdpClientAdvancedSettings interface for the client. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 462 |
| 463 // Get the extended disconnect reason code. | 463 // Get the extended disconnect reason code. |
| 464 mstsc::ExtendedDisconnectReasonCode extended_code; | 464 mstsc::ExtendedDisconnectReasonCode extended_code; |
| 465 HRESULT result = client_->get_ExtendedDisconnectReason(&extended_code); | 465 HRESULT result = client_->get_ExtendedDisconnectReason(&extended_code); |
| 466 if (FAILED(result)) | 466 if (FAILED(result)) |
| 467 extended_code = mstsc::exDiscReasonNoInfo; | 467 extended_code = mstsc::exDiscReasonNoInfo; |
| 468 | 468 |
| 469 // Get the error message as well. | 469 // Get the error message as well. |
| 470 base::win::ScopedBstr error_message; | 470 base::win::ScopedBstr error_message; |
| 471 base::win::ScopedComPtr<mstsc::IMsRdpClient5> client5; | 471 base::win::ScopedComPtr<mstsc::IMsRdpClient5> client5; |
| 472 result = client_.QueryInterface(client5.Receive()); | 472 result = client_.CopyTo(client5.Receive()); |
| 473 if (SUCCEEDED(result)) { | 473 if (SUCCEEDED(result)) { |
| 474 result = client5->GetErrorDescription(reason, extended_code, | 474 result = client5->GetErrorDescription(reason, extended_code, |
| 475 error_message.Receive()); | 475 error_message.Receive()); |
| 476 if (FAILED(result)) | 476 if (FAILED(result)) |
| 477 error_message.Reset(); | 477 error_message.Reset(); |
| 478 } | 478 } |
| 479 | 479 |
| 480 LOG(ERROR) << "RDP: disconnected from " << server_endpoint_.ToString() | 480 LOG(ERROR) << "RDP: disconnected from " << server_endpoint_.ToString() |
| 481 << ": " << error_message << " (reason=" << reason | 481 << ": " << error_message << " (reason=" << reason |
| 482 << ", extended_code=" << extended_code << ")"; | 482 << ", extended_code=" << extended_code << ")"; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 609 } |
| 610 | 610 |
| 611 // Close the window once all pending window messages are processed. | 611 // Close the window once all pending window messages are processed. |
| 612 HWND window = reinterpret_cast<HWND>(wparam); | 612 HWND window = reinterpret_cast<HWND>(wparam); |
| 613 LOG(WARNING) << "RDP: closing a window: " << std::hex << window; | 613 LOG(WARNING) << "RDP: closing a window: " << std::hex << window; |
| 614 ::PostMessage(window, WM_CLOSE, 0, 0); | 614 ::PostMessage(window, WM_CLOSE, 0, 0); |
| 615 return 0; | 615 return 0; |
| 616 } | 616 } |
| 617 | 617 |
| 618 } // namespace remoting | 618 } // namespace remoting |
| OLD | NEW |