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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 y = std::min(y, area_rect.bottom - width); | 120 y = std::min(y, area_rect.bottom - width); |
121 | 121 |
122 SetWindowPos(NULL, x, y, -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); | 122 SetWindowPos(NULL, x, y, -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
123 } | 123 } |
124 | 124 |
125 bool VerifyConfigWindowWin::VerifyHostSecretHash() { | 125 bool VerifyConfigWindowWin::VerifyHostSecretHash() { |
126 CWindow pin_edit(GetDlgItem(IDC_PIN)); | 126 CWindow pin_edit(GetDlgItem(IDC_PIN)); |
127 | 127 |
128 // Get the PIN length. | 128 // Get the PIN length. |
129 int pin_length = pin_edit.GetWindowTextLength(); | 129 int pin_length = pin_edit.GetWindowTextLength(); |
130 scoped_array<char16> pin(new char16[pin_length + 1]); | 130 scoped_ptr<char16[]> pin(new char16[pin_length + 1]); |
131 | 131 |
132 // Get the PIN making sure it is NULL terminated even if an error occurs. | 132 // Get the PIN making sure it is NULL terminated even if an error occurs. |
133 int result = pin_edit.GetWindowText(pin.get(), pin_length + 1); | 133 int result = pin_edit.GetWindowText(pin.get(), pin_length + 1); |
134 pin[std::min(result, pin_length)] = 0; | 134 pin[std::min(result, pin_length)] = 0; |
135 | 135 |
136 return VerifyHostPinHash(host_secret_hash_, host_id_, UTF16ToUTF8(pin.get())); | 136 return VerifyHostPinHash(host_secret_hash_, host_id_, UTF16ToUTF8(pin.get())); |
137 } | 137 } |
138 | 138 |
139 } // namespace remoting | 139 } // namespace remoting |
OLD | NEW |