OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/verify_config_window_win.h" | 5 #include "remoting/host/verify_config_window_win.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlwin.h> | 8 #include <atlwin.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 y = std::min(y, area_rect.bottom - width); | 101 y = std::min(y, area_rect.bottom - width); |
102 | 102 |
103 SetWindowPos(NULL, x, y, -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); | 103 SetWindowPos(NULL, x, y, -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
104 } | 104 } |
105 | 105 |
106 bool VerifyConfigWindowWin::VerifyHostSecretHash() { | 106 bool VerifyConfigWindowWin::VerifyHostSecretHash() { |
107 CWindow pin_edit(GetDlgItem(IDC_PIN)); | 107 CWindow pin_edit(GetDlgItem(IDC_PIN)); |
108 | 108 |
109 // Get the PIN length. | 109 // Get the PIN length. |
110 int pin_length = pin_edit.GetWindowTextLength(); | 110 int pin_length = pin_edit.GetWindowTextLength(); |
111 scoped_ptr<char16[]> pin(new char16[pin_length + 1]); | 111 scoped_ptr<base::char16[]> pin(new base::char16[pin_length + 1]); |
112 | 112 |
113 // Get the PIN making sure it is NULL terminated even if an error occurs. | 113 // Get the PIN making sure it is NULL terminated even if an error occurs. |
114 int result = pin_edit.GetWindowText(pin.get(), pin_length + 1); | 114 int result = pin_edit.GetWindowText(pin.get(), pin_length + 1); |
115 pin[std::min(result, pin_length)] = 0; | 115 pin[std::min(result, pin_length)] = 0; |
116 | 116 |
117 return VerifyHostPinHash(host_secret_hash_, host_id_, UTF16ToUTF8(pin.get())); | 117 return VerifyHostPinHash(host_secret_hash_, host_id_, UTF16ToUTF8(pin.get())); |
118 } | 118 } |
119 | 119 |
120 } // namespace remoting | 120 } // namespace remoting |
OLD | NEW |