Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: base/file_util_win.cc

Issue 3836005: Move pe_image and registry from base to base/win and use the namespace. It re... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/base.gypi ('k') | base/pe_image.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/file_util.h" 5 #include "base/file_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <propvarutil.h> 8 #include <propvarutil.h>
9 #include <psapi.h> 9 #include <psapi.h>
10 #include <shellapi.h> 10 #include <shellapi.h>
11 #include <shlobj.h> 11 #include <shlobj.h>
12 #include <time.h> 12 #include <time.h>
13 #include <string> 13 #include <string>
14 14
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
18 #include "base/pe_image.h" 18 #include "base/win/pe_image.h"
19 #include "base/win/scoped_handle.h" 19 #include "base/win/scoped_handle.h"
20 #include "base/string_number_conversions.h" 20 #include "base/string_number_conversions.h"
21 #include "base/string_util.h" 21 #include "base/string_util.h"
22 #include "base/time.h" 22 #include "base/time.h"
23 #include "base/utf_string_conversions.h" 23 #include "base/utf_string_conversions.h"
24 #include "base/win_util.h" 24 #include "base/win_util.h"
25 #include "base/win/scoped_comptr.h" 25 #include "base/win/scoped_comptr.h"
26 #include "base/win/windows_version.h" 26 #include "base/win/windows_version.h"
27 27
28 namespace file_util { 28 namespace file_util {
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 // what we want so instead we pull the pages into memory by loading 1044 // what we want so instead we pull the pages into memory by loading
1045 // the DLL and touching pages at a stride. 1045 // the DLL and touching pages at a stride.
1046 HMODULE dll_module = ::LoadLibraryExW( 1046 HMODULE dll_module = ::LoadLibraryExW(
1047 file_path, 1047 file_path,
1048 NULL, 1048 NULL,
1049 LOAD_WITH_ALTERED_SEARCH_PATH | DONT_RESOLVE_DLL_REFERENCES); 1049 LOAD_WITH_ALTERED_SEARCH_PATH | DONT_RESOLVE_DLL_REFERENCES);
1050 1050
1051 if (!dll_module) 1051 if (!dll_module)
1052 return false; 1052 return false;
1053 1053
1054 PEImage pe_image(dll_module); 1054 base::win::PEImage pe_image(dll_module);
1055 PIMAGE_NT_HEADERS nt_headers = pe_image.GetNTHeaders(); 1055 PIMAGE_NT_HEADERS nt_headers = pe_image.GetNTHeaders();
1056 size_t actual_size_to_read = size_to_read ? size_to_read : 1056 size_t actual_size_to_read = size_to_read ? size_to_read :
1057 nt_headers->OptionalHeader.SizeOfImage; 1057 nt_headers->OptionalHeader.SizeOfImage;
1058 volatile uint8* touch = reinterpret_cast<uint8*>(dll_module); 1058 volatile uint8* touch = reinterpret_cast<uint8*>(dll_module);
1059 size_t offset = 0; 1059 size_t offset = 0;
1060 while (offset < actual_size_to_read) { 1060 while (offset < actual_size_to_read) {
1061 uint8 unused = *(touch + offset); 1061 uint8 unused = *(touch + offset);
1062 offset += step_size; 1062 offset += step_size;
1063 } 1063 }
1064 FreeLibrary(dll_module); 1064 FreeLibrary(dll_module);
1065 } 1065 }
1066 1066
1067 return true; 1067 return true;
1068 } 1068 }
1069 1069
1070 } // namespace file_util 1070 } // namespace file_util
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/pe_image.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698