OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains unit tests for ServiceResolverThunk. | 5 // This file contains unit tests for ServiceResolverThunk. |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "sandbox/src/resolver.h" | 10 #include "sandbox/src/resolver.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 ret = resolver->Setup(ntdll_base, NULL, function, NULL, function_entry, | 113 ret = resolver->Setup(ntdll_base, NULL, function, NULL, function_entry, |
114 thunk.get(), thunk_size, &used); | 114 thunk.get(), thunk_size, &used); |
115 CheckJump(service, thunk.get()); | 115 CheckJump(service, thunk.get()); |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 return ret; | 119 return ret; |
120 } | 120 } |
121 | 121 |
122 sandbox::ServiceResolverThunk* GetTestResolver(bool relaxed) { | 122 sandbox::ServiceResolverThunk* GetTestResolver(bool relaxed) { |
123 if (base::win::OSInfo::GetInstance()->wow64_status() == | 123 if (base::win::GetWOW64Status() == base::win::WOW64_ENABLED) |
124 base::win::OSInfo::WOW64_ENABLED) | |
125 return new Wow64ResolverTest(relaxed); | 124 return new Wow64ResolverTest(relaxed); |
126 if (!sandbox::IsXPSP2OrLater()) | 125 if (!sandbox::IsXPSP2OrLater()) |
127 return new Win2kResolverTest(relaxed); | 126 return new Win2kResolverTest(relaxed); |
128 return new WinXpResolverTest(relaxed); | 127 return new WinXpResolverTest(relaxed); |
129 } | 128 } |
130 | 129 |
131 NTSTATUS PatchNtdll(const char* function, bool relaxed) { | 130 NTSTATUS PatchNtdll(const char* function, bool relaxed) { |
132 sandbox::ServiceResolverThunk* resolver = GetTestResolver(relaxed); | 131 sandbox::ServiceResolverThunk* resolver = GetTestResolver(relaxed); |
133 | 132 |
134 NTSTATUS ret = PatchNtdllWithResolver(function, relaxed, resolver); | 133 NTSTATUS ret = PatchNtdllWithResolver(function, relaxed, resolver); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 ::GetLastError(); | 196 ::GetLastError(); |
198 | 197 |
199 ret = PatchNtdllWithResolver("NtMapViewOfSection", true, resolver); | 198 ret = PatchNtdllWithResolver("NtMapViewOfSection", true, resolver); |
200 EXPECT_EQ(STATUS_SUCCESS, ret) << "NtMapViewOfSection, last error: " << | 199 EXPECT_EQ(STATUS_SUCCESS, ret) << "NtMapViewOfSection, last error: " << |
201 ::GetLastError(); | 200 ::GetLastError(); |
202 delete resolver; | 201 delete resolver; |
203 #endif | 202 #endif |
204 } | 203 } |
205 | 204 |
206 } // namespace | 205 } // namespace |
OLD | NEW |