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 "base/win/win_util.h" | 5 #include "base/win/win_util.h" |
6 | 6 |
7 #include <aclapi.h> | 7 #include <aclapi.h> |
8 #include <lm.h> | 8 #include <lm.h> |
9 #include <powrprof.h> | 9 #include <powrprof.h> |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 UNKNOWN); | 363 UNKNOWN); |
364 } | 364 } |
365 | 365 |
366 return g_domain_state == ENROLLED; | 366 return g_domain_state == ENROLLED; |
367 } | 367 } |
368 | 368 |
369 void SetDomainStateForTesting(bool state) { | 369 void SetDomainStateForTesting(bool state) { |
370 g_domain_state = state ? ENROLLED : NOT_ENROLLED; | 370 g_domain_state = state ? ENROLLED : NOT_ENROLLED; |
371 } | 371 } |
372 | 372 |
| 373 bool MaybeHasSHA256Support() { |
| 374 const base::win::OSInfo* os_info = base::win::OSInfo::GetInstance(); |
| 375 |
| 376 if (os_info->version() == base::win::VERSION_PRE_XP) |
| 377 return false; // Too old to have it and this OS is not supported anyway. |
| 378 |
| 379 if (os_info->version() == base::win::VERSION_XP) |
| 380 return os_info->service_pack().major >= 3; // Windows XP SP3 has it. |
| 381 |
| 382 // Assume it is missing in this case, although it may not be. This category |
| 383 // includes Windows XP x64, and Windows Server, where a hotfix could be |
| 384 // deployed. |
| 385 if (os_info->version() == base::win::VERSION_SERVER_2003) |
| 386 return false; |
| 387 |
| 388 DCHECK(os_info->version() >= base::win::VERSION_VISTA); |
| 389 return true; // New enough to have SHA-256 support. |
| 390 } |
| 391 |
373 } // namespace win | 392 } // namespace win |
374 } // namespace base | 393 } // namespace base |
375 | 394 |
376 #ifdef _MSC_VER | 395 #ifdef _MSC_VER |
377 | 396 |
378 // There are optimizer bugs in x86 VS2012 pre-Update 1. | 397 // There are optimizer bugs in x86 VS2012 pre-Update 1. |
379 #if _MSC_VER == 1700 && defined _M_IX86 && _MSC_FULL_VER < 170051106 | 398 #if _MSC_VER == 1700 && defined _M_IX86 && _MSC_FULL_VER < 170051106 |
380 | 399 |
381 #pragma message("Relevant defines:") | 400 #pragma message("Relevant defines:") |
382 #define __STR2__(x) #x | 401 #define __STR2__(x) #x |
383 #define __STR1__(x) __STR2__(x) | 402 #define __STR1__(x) __STR2__(x) |
384 #define __PPOUT__(x) "#define " #x " " __STR1__(x) | 403 #define __PPOUT__(x) "#define " #x " " __STR1__(x) |
385 #if defined(_M_IX86) | 404 #if defined(_M_IX86) |
386 #pragma message(__PPOUT__(_M_IX86)) | 405 #pragma message(__PPOUT__(_M_IX86)) |
387 #endif | 406 #endif |
388 #if defined(_M_X64) | 407 #if defined(_M_X64) |
389 #pragma message(__PPOUT__(_M_X64)) | 408 #pragma message(__PPOUT__(_M_X64)) |
390 #endif | 409 #endif |
391 #if defined(_MSC_FULL_VER) | 410 #if defined(_MSC_FULL_VER) |
392 #pragma message(__PPOUT__(_MSC_FULL_VER)) | 411 #pragma message(__PPOUT__(_MSC_FULL_VER)) |
393 #endif | 412 #endif |
394 | 413 |
395 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1") | 414 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1") |
396 #error Must install Update 1 to Visual Studio 2012. | 415 #error Must install Update 1 to Visual Studio 2012. |
397 #endif | 416 #endif |
398 | 417 |
399 #endif // _MSC_VER | 418 #endif // _MSC_VER |
400 | 419 |
OLD | NEW |