OLD | NEW |
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 #ifndef SANDBOX_SRC_WIN_UTILS_H_ | 5 #ifndef SANDBOX_SRC_WIN_UTILS_H_ |
6 #define SANDBOX_SRC_WIN_UTILS_H_ | 6 #define SANDBOX_SRC_WIN_UTILS_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <string> | 10 #include <string> |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // protection attributes. Returns true on success. | 105 // protection attributes. Returns true on success. |
106 bool WriteProtectedChildMemory(HANDLE child_process, void* address, | 106 bool WriteProtectedChildMemory(HANDLE child_process, void* address, |
107 const void* buffer, size_t length); | 107 const void* buffer, size_t length); |
108 | 108 |
109 // Returns true if the provided path points to a pipe. | 109 // Returns true if the provided path points to a pipe. |
110 bool IsPipe(const base::string16& path); | 110 bool IsPipe(const base::string16& path); |
111 | 111 |
112 // Converts a NTSTATUS code to a Win32 error code. | 112 // Converts a NTSTATUS code to a Win32 error code. |
113 DWORD GetLastErrorFromNtStatus(NTSTATUS status); | 113 DWORD GetLastErrorFromNtStatus(NTSTATUS status); |
114 | 114 |
| 115 // Returns the address of the main exe module in memory taking in account |
| 116 // address space layout randomization. While it will work on running processes |
| 117 // it's recommended to only call this for a suspended process. Ideally also |
| 118 // a process which has not been started. There's a slim chance that a process |
| 119 // could map its own executables file multiple times, but this is pretty |
| 120 // unlikely to occur in practice. |
| 121 void* GetProcessBaseAddress(HANDLE process); |
| 122 |
115 } // namespace sandbox | 123 } // namespace sandbox |
116 | 124 |
117 // Resolves a function name in NTDLL to a function pointer. The second parameter | 125 // Resolves a function name in NTDLL to a function pointer. The second parameter |
118 // is a pointer to the function pointer. | 126 // is a pointer to the function pointer. |
119 void ResolveNTFunctionPtr(const char* name, void* ptr); | 127 void ResolveNTFunctionPtr(const char* name, void* ptr); |
120 | 128 |
121 #endif // SANDBOX_SRC_WIN_UTILS_H_ | 129 #endif // SANDBOX_SRC_WIN_UTILS_H_ |
OLD | NEW |