| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/install_verification/win/loaded_modules_snapshot.h" | 5 #include "chrome/browser/install_verification/win/loaded_modules_snapshot.h" |
| 6 | 6 |
| 7 #include <Psapi.h> | 7 #include <Psapi.h> |
| 8 #include <stddef.h> |
| 8 | 9 |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 | 11 |
| 11 bool GetLoadedModulesSnapshot(std::vector<HMODULE>* snapshot) { | 12 bool GetLoadedModulesSnapshot(std::vector<HMODULE>* snapshot) { |
| 12 DCHECK(snapshot); | 13 DCHECK(snapshot); |
| 13 DCHECK_EQ(0u, snapshot->size()); | 14 DCHECK_EQ(0u, snapshot->size()); |
| 14 snapshot->resize(1); | 15 snapshot->resize(1); |
| 15 | 16 |
| 16 HANDLE process = ::GetCurrentProcess(); | 17 HANDLE process = ::GetCurrentProcess(); |
| 17 | 18 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 41 return false; | 42 return false; |
| 42 } else { | 43 } else { |
| 43 // Buffer size was too small. Try again with a larger buffer. | 44 // Buffer size was too small. Try again with a larger buffer. |
| 44 snapshot->resize(num_modules, NULL); | 45 snapshot->resize(num_modules, NULL); |
| 45 } | 46 } |
| 46 } while (--retries_remaining); | 47 } while (--retries_remaining); |
| 47 | 48 |
| 48 DLOG(ERROR) << "Failed to enumerate modules."; | 49 DLOG(ERROR) << "Failed to enumerate modules."; |
| 49 return false; | 50 return false; |
| 50 } | 51 } |
| OLD | NEW |