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

Side by Side Diff: sandbox/win/src/eat_resolver.cc

Issue 1119783002: vs2015: fix narrowing warnings in sandbox/win/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2015-printing-emf
Patch Set: Created 5 years, 7 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
« no previous file with comments | « sandbox/win/src/broker_services.cc ('k') | no next file » | 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) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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 "sandbox/win/src/eat_resolver.h" 5 #include "sandbox/win/src/eat_resolver.h"
6 6
7 #include "base/win/pe_image.h" 7 #include "base/win/pe_image.h"
8 #include "sandbox/win/src/sandbox_nt_util.h" 8 #include "sandbox/win/src/sandbox_nt_util.h"
9 9
10 namespace sandbox { 10 namespace sandbox {
(...skipping 27 matching lines...) Expand all
38 38
39 if (!SetInternalThunk(thunk_storage, storage_bytes, target_, interceptor_)) 39 if (!SetInternalThunk(thunk_storage, storage_bytes, target_, interceptor_))
40 return STATUS_BUFFER_TOO_SMALL; 40 return STATUS_BUFFER_TOO_SMALL;
41 41
42 AutoProtectMemory memory; 42 AutoProtectMemory memory;
43 ret = memory.ChangeProtection(eat_entry_, sizeof(DWORD), PAGE_READWRITE); 43 ret = memory.ChangeProtection(eat_entry_, sizeof(DWORD), PAGE_READWRITE);
44 if (!NT_SUCCESS(ret)) 44 if (!NT_SUCCESS(ret))
45 return ret; 45 return ret;
46 46
47 // Perform the patch. 47 // Perform the patch.
48 #pragma warning(push) 48 *eat_entry_ = static_cast<DWORD>(reinterpret_cast<uintptr_t>(thunk_storage)) -
49 #pragma warning(disable: 4311) 49 static_cast<DWORD>(reinterpret_cast<uintptr_t>(target_module));
50 // These casts generate warnings because they are 32 bit specific.
51 *eat_entry_ = reinterpret_cast<DWORD>(thunk_storage) -
52 reinterpret_cast<DWORD>(target_module);
53 #pragma warning(pop)
54 50
55 if (NULL != storage_used) 51 if (NULL != storage_used)
56 *storage_used = GetThunkSize(); 52 *storage_used = GetThunkSize();
57 53
58 return ret; 54 return ret;
59 } 55 }
60 56
61 NTSTATUS EatResolverThunk::ResolveTarget(const void* module, 57 NTSTATUS EatResolverThunk::ResolveTarget(const void* module,
62 const char* function_name, 58 const char* function_name,
63 void** address) { 59 void** address) {
(...skipping 17 matching lines...) Expand all
81 77
82 size_t EatResolverThunk::GetThunkSize() const { 78 size_t EatResolverThunk::GetThunkSize() const {
83 #if defined(_WIN64) 79 #if defined(_WIN64)
84 return GetInternalThunkSize() * 2; 80 return GetInternalThunkSize() * 2;
85 #else 81 #else
86 return GetInternalThunkSize(); 82 return GetInternalThunkSize();
87 #endif 83 #endif
88 } 84 }
89 85
90 } // namespace sandbox 86 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/broker_services.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698