OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // chrome_tab.cc : Implementation of DLL Exports. | 5 // chrome_tab.cc : Implementation of DLL Exports. |
6 | 6 |
7 // Need to include this before the ATL headers below. | 7 // Need to include this before the ATL headers below. |
8 #include "chrome_frame/chrome_tab.h" | 8 #include "chrome_frame/chrome_tab.h" |
9 | 9 |
10 #include <atlsecurity.h> | 10 #include <atlsecurity.h> |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 // Read SDDL string from backup key | 460 // Read SDDL string from backup key |
461 bool ReadBackupKey(std::wstring* sddl) { | 461 bool ReadBackupKey(std::wstring* sddl) { |
462 RegKey backup_key(HKEY_LOCAL_MACHINE, backup_key_name_.c_str(), KEY_READ); | 462 RegKey backup_key(HKEY_LOCAL_MACHINE, backup_key_name_.c_str(), KEY_READ); |
463 if (!backup_key.Valid()) | 463 if (!backup_key.Valid()) |
464 return false; | 464 return false; |
465 | 465 |
466 DWORD len = 0; | 466 DWORD len = 0; |
467 DWORD reg_type = REG_NONE; | 467 DWORD reg_type = REG_NONE; |
468 if (backup_key.ReadValue(NULL, NULL, &len, ®_type) != ERROR_SUCCESS) | 468 if (backup_key.ReadValue(NULL, NULL, &len, ®_type) != ERROR_SUCCESS) |
469 return false; | 469 return false; |
| 470 DCHECK_EQ(0u, len % sizeof(wchar_t)); |
470 | 471 |
471 if (reg_type != REG_SZ) | 472 if ((len == 0) || (reg_type != REG_SZ)) |
472 return false; | 473 return false; |
473 | 474 |
474 size_t wchar_count = 1 + len / sizeof(wchar_t); | 475 size_t wchar_count = 1 + len / sizeof(wchar_t); |
475 if (backup_key.ReadValue(NULL, WriteInto(sddl, wchar_count), &len, | 476 if (backup_key.ReadValue(NULL, WriteInto(sddl, wchar_count), &len, |
476 ®_type) != ERROR_SUCCESS) { | 477 ®_type) != ERROR_SUCCESS) { |
477 return false; | 478 return false; |
478 } | 479 } |
479 | 480 |
480 return true; | 481 return true; |
481 } | 482 } |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 HRESULT hr = CustomRegistration(ALL, FALSE, false); | 919 HRESULT hr = CustomRegistration(ALL, FALSE, false); |
919 return hr; | 920 return hr; |
920 } | 921 } |
921 | 922 |
922 // Object entries go here instead of with each object, so that we can move | 923 // Object entries go here instead of with each object, so that we can move |
923 // the objects to a lib. Also reduces magic. | 924 // the objects to a lib. Also reduces magic. |
924 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho) | 925 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho) |
925 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument) | 926 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument) |
926 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex) | 927 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex) |
927 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol) | 928 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol) |
OLD | NEW |