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 "sandbox/win/src/service_resolver.h" | 5 #include "sandbox/win/src/service_resolver.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "sandbox/win/src/sandbox_nt_util.h" | 8 #include "sandbox/win/src/sandbox_nt_util.h" |
9 #include "sandbox/win/src/win_utils.h" | 9 #include "sandbox/win/src/win_utils.h" |
10 | 10 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 161 } |
162 | 162 |
163 // Save the verified code. | 163 // Save the verified code. |
164 memcpy(local_thunk, &function_code, sizeof(function_code)); | 164 memcpy(local_thunk, &function_code, sizeof(function_code)); |
165 | 165 |
166 return true; | 166 return true; |
167 } | 167 } |
168 | 168 |
169 NTSTATUS ServiceResolverThunk::PerformPatch(void* local_thunk, | 169 NTSTATUS ServiceResolverThunk::PerformPatch(void* local_thunk, |
170 void* remote_thunk) { | 170 void* remote_thunk) { |
171 ServiceFullThunk* full_local_thunk = | |
172 reinterpret_cast<ServiceFullThunk*>(local_thunk); | |
173 ServiceFullThunk* full_remote_thunk = | |
174 reinterpret_cast<ServiceFullThunk*>(remote_thunk); | |
175 | |
176 // Patch the original code. | 171 // Patch the original code. |
177 ServiceEntry local_service; | 172 ServiceEntry local_service; |
178 DCHECK_NT(GetInternalThunkSize() >= sizeof(local_service)); | 173 DCHECK_NT(GetInternalThunkSize() >= sizeof(local_service)); |
179 if (!SetInternalThunk(&local_service, sizeof(local_service), NULL, | 174 if (!SetInternalThunk(&local_service, sizeof(local_service), NULL, |
180 interceptor_)) | 175 interceptor_)) |
181 return STATUS_UNSUCCESSFUL; | 176 return STATUS_UNSUCCESSFUL; |
182 | 177 |
183 // Copy the local thunk buffer to the child. | 178 // Copy the local thunk buffer to the child. |
184 SIZE_T actual; | 179 SIZE_T actual; |
185 if (!::WriteProcessMemory(process_, remote_thunk, local_thunk, | 180 if (!::WriteProcessMemory(process_, remote_thunk, local_thunk, |
(...skipping 17 matching lines...) Expand all Loading... |
203 | 198 |
204 return STATUS_SUCCESS; | 199 return STATUS_SUCCESS; |
205 } | 200 } |
206 | 201 |
207 bool Wow64ResolverThunk::IsFunctionAService(void* local_thunk) const { | 202 bool Wow64ResolverThunk::IsFunctionAService(void* local_thunk) const { |
208 NOTREACHED_NT(); | 203 NOTREACHED_NT(); |
209 return false; | 204 return false; |
210 } | 205 } |
211 | 206 |
212 } // namespace sandbox | 207 } // namespace sandbox |
OLD | NEW |