| OLD | NEW |
| 1 // Copyright (c) 2011 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 "net/base/test_root_certs.h" | 5 #include "net/base/test_root_certs.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <wincrypt.h> | 8 #include <wincrypt.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // This is never called, because this object is intentionally leaked. | 82 // This is never called, because this object is intentionally leaked. |
| 83 // Certificate verification happens on a non-joinable worker thread, which | 83 // Certificate verification happens on a non-joinable worker thread, which |
| 84 // may still be running when ~AtExitManager is called, so the LazyInstance | 84 // may still be running when ~AtExitManager is called, so the LazyInstance |
| 85 // must be leaky. | 85 // must be leaky. |
| 86 ~CryptoAPIInjector() { | 86 ~CryptoAPIInjector() { |
| 87 original_function = NULL; | 87 original_function = NULL; |
| 88 CryptFreeOIDFunctionAddress(original_handle, NULL); | 88 CryptFreeOIDFunctionAddress(original_handle, NULL); |
| 89 } | 89 } |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 base::LazyInstance<CryptoAPIInjector, | 92 base::LazyInstance<CryptoAPIInjector>::Leaky |
| 93 base::LeakyLazyInstanceTraits<CryptoAPIInjector> > | |
| 94 g_capi_injector = LAZY_INSTANCE_INITIALIZER; | 93 g_capi_injector = LAZY_INSTANCE_INITIALIZER; |
| 95 | 94 |
| 96 BOOL WINAPI InterceptedOpenStoreW(LPCSTR store_provider, | 95 BOOL WINAPI InterceptedOpenStoreW(LPCSTR store_provider, |
| 97 DWORD encoding, | 96 DWORD encoding, |
| 98 HCRYPTPROV crypt_provider, | 97 HCRYPTPROV crypt_provider, |
| 99 DWORD flags, | 98 DWORD flags, |
| 100 const void* store_name, | 99 const void* store_name, |
| 101 HCERTSTORE memory_store, | 100 HCERTSTORE memory_store, |
| 102 PCERT_STORE_PROV_INFO store_info) { | 101 PCERT_STORE_PROV_INFO store_info) { |
| 103 // If the high word is all zeroes, then |store_provider| is a numeric ID. | 102 // If the high word is all zeroes, then |store_provider| is a numeric ID. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 204 |
| 206 void TestRootCerts::Init() { | 205 void TestRootCerts::Init() { |
| 207 empty_ = true; | 206 empty_ = true; |
| 208 temporary_roots_ = CertOpenStore( | 207 temporary_roots_ = CertOpenStore( |
| 209 CERT_STORE_PROV_MEMORY, 0, NULL, | 208 CERT_STORE_PROV_MEMORY, 0, NULL, |
| 210 CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL); | 209 CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL); |
| 211 DCHECK(temporary_roots_); | 210 DCHECK(temporary_roots_); |
| 212 } | 211 } |
| 213 | 212 |
| 214 } // namespace net | 213 } // namespace net |
| OLD | NEW |