OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 #ifndef DEBUGGER_CORE_DEBUG_API_H_ | |
5 #define DEBUGGER_CORE_DEBUG_API_H_ | |
6 #include <windows.h> | |
7 #include <map> | |
8 | |
9 namespace debug { | |
10 /// This class is a very thin layer on top of Windows Debug API. | |
11 | |
12 /// Intended to simplify writing unit tests - as a base for DebugAPIMock. | |
13 /// Here' a link to Microsoft documentation: | |
14 /// http://msdn.microsoft.com/en-us/library/ms679303.aspx | |
15 class DebugAPI { | |
16 public: | |
17 DebugAPI() {} | |
18 virtual ~DebugAPI() {} | |
19 | |
20 virtual BOOL CreateProcess(LPCTSTR lpApplicationName, | |
21 LPTSTR lpCommandLine, | |
22 LPSECURITY_ATTRIBUTES lpProcessAttributes, | |
23 LPSECURITY_ATTRIBUTES lpThreadAttributes, | |
24 BOOL bInheritHandles, | |
25 DWORD dwCreationFlags, | |
26 LPVOID lpEnvironment, | |
27 LPCTSTR lpCurrentDirectory, | |
28 LPSTARTUPINFO lpStartupInfo, | |
29 LPPROCESS_INFORMATION lpProcessInformation); | |
30 | |
31 virtual BOOL CloseHandle(HANDLE hObject); | |
32 | |
33 virtual BOOL ReadProcessMemory(HANDLE hProcess, | |
34 LPCVOID lpBaseAddress, | |
35 LPVOID lpBuffer, | |
36 SIZE_T nSize, | |
37 SIZE_T *lpNumberOfBytesRead); | |
38 | |
39 virtual BOOL WriteProcessMemory(HANDLE hProcess, | |
40 LPVOID lpBaseAddress, | |
41 LPCVOID lpBuffer, | |
42 SIZE_T nSize, | |
43 SIZE_T *lpNumberOfBytesWritten); | |
44 | |
45 virtual BOOL FlushInstructionCache(HANDLE hProcess, | |
46 LPCVOID lpBaseAddress, | |
47 SIZE_T dwSize); | |
48 | |
49 | |
50 virtual BOOL GetThreadContext(HANDLE hThread, LPCONTEXT lpContext); | |
51 virtual BOOL SetThreadContext(HANDLE hThread, CONTEXT *lpContext); | |
52 | |
53 virtual BOOL WaitForDebugEvent(LPDEBUG_EVENT lpDebugEvent, | |
54 DWORD dwMilliseconds); | |
55 | |
56 virtual BOOL ContinueDebugEvent(DWORD dwProcessId, | |
57 DWORD dwThreadId, | |
58 DWORD dwContinueStatus); | |
59 | |
60 virtual BOOL TerminateThread(HANDLE hThread, DWORD dwExitCode); | |
61 virtual BOOL DebugBreakProcess(HANDLE Process); | |
62 | |
63 virtual BOOL Wow64GetThreadContext(HANDLE hThread, PWOW64_CONTEXT lpContext); | |
64 virtual BOOL Wow64SetThreadContext(HANDLE hThread, | |
65 const WOW64_CONTEXT* lpContext); | |
66 virtual BOOL IsWoW64Process(HANDLE hProcess, PBOOL Wow64Process); | |
67 virtual BOOL DebugActiveProcess(DWORD dwProcessId); | |
68 virtual BOOL DebugActiveProcessStop(DWORD dwProcessId); | |
69 | |
70 private: | |
71 DebugAPI(const DebugAPI&); // DISALLOW_COPY_AND_ASSIGN | |
72 void operator=(const DebugAPI&); | |
73 }; | |
74 } // namespace debug | |
75 #endif // DEBUGGER_CORE_DEBUG_API_H_ | |
76 | |
OLD | NEW |