| 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 // Library functions related to the OEM Deal Confirmation Code. | 5 // Library functions related to the OEM Deal Confirmation Code. |
| 6 | 6 |
| 7 #include "rlz/win/lib/machine_deal.h" | 7 #include "rlz/win/lib/machine_deal.h" |
| 8 | 8 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return true; | 50 return true; |
| 51 } | 51 } |
| 52 | 52 |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 | 55 |
| 56 // This function will remove bad rlz chars and also limit the max rlz to some | 56 // This function will remove bad rlz chars and also limit the max rlz to some |
| 57 // reasonable size. It also assumes that normalized_dcc is at least | 57 // reasonable size. It also assumes that normalized_dcc is at least |
| 58 // kMaxDccLength+1 long. | 58 // kMaxDccLength+1 long. |
| 59 void NormalizeDcc(const char* raw_dcc, char* normalized_dcc) { | 59 void NormalizeDcc(const char* raw_dcc, char* normalized_dcc) { |
| 60 int index = 0; | 60 size_t index = 0; |
| 61 for (; raw_dcc[index] != 0 && index < rlz_lib::kMaxDccLength; ++index) { | 61 for (; raw_dcc[index] != 0 && index < rlz_lib::kMaxDccLength; ++index) { |
| 62 char current = raw_dcc[index]; | 62 char current = raw_dcc[index]; |
| 63 if (IsGoodDccChar(current)) { | 63 if (IsGoodDccChar(current)) { |
| 64 normalized_dcc[index] = current; | 64 normalized_dcc[index] = current; |
| 65 } else { | 65 } else { |
| 66 normalized_dcc[index] = '.'; | 66 normalized_dcc[index] = '.'; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 normalized_dcc[index] = 0; | 70 normalized_dcc[index] = 0; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 DWORD dcc_size = arraysize(dcc); | 292 DWORD dcc_size = arraysize(dcc); |
| 293 if (dcc_key.ReadValue(kDccValueName, dcc, &dcc_size, NULL) == ERROR_SUCCESS) { | 293 if (dcc_key.ReadValue(kDccValueName, dcc, &dcc_size, NULL) == ERROR_SUCCESS) { |
| 294 ASSERT_STRING("MachineDealCode::Clear: Could not delete the DCC value."); | 294 ASSERT_STRING("MachineDealCode::Clear: Could not delete the DCC value."); |
| 295 return false; | 295 return false; |
| 296 } | 296 } |
| 297 | 297 |
| 298 return true; | 298 return true; |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace rlz_lib | 301 } // namespace rlz_lib |
| OLD | NEW |