OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Crashpad Authors. All rights reserved. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 | |
15 #include "snapshot/client/crashpad_annotations_win.h" | |
16 | |
17 #include <psapi.h> | |
18 | |
19 #include "snapshot/win/process_reader_win.h" | |
20 #include "snapshot/win/pe_image_reader.h" | |
21 #include "snapshot/win/pe_image_annotations_reader.h" | |
22 | |
23 namespace crashpad { | |
24 | |
25 bool ReadCrashpadAnnotations(HANDLE process, | |
26 HMODULE module, | |
27 std::map<std::string, std::string>* annotations) { | |
28 ProcessReaderWin process_reader; | |
29 if (!process_reader.Initialize(process, ProcessSuspensionState::kRunning)) | |
scottmg
2016/01/13 19:12:42
Would it be a good idea to suspend the process bef
Patrick Monette
2016/01/13 22:59:39
If you think it's a good idea, I don't see any obj
| |
30 return false; | |
31 | |
32 MODULEINFO module_info = {}; | |
scottmg
2016/01/13 19:12:42
I don't think this needs to be initialized, as it'
Patrick Monette
2016/01/13 22:59:39
Done.
| |
33 if (!::GetModuleInformation( | |
scottmg
2016/01/13 19:12:42
No :: prefix in Crashpad unless it's necessary to
scottmg
2016/01/13 19:12:42
I believe this needs the GET_FUNCTION_REQUIRED dan
Patrick Monette
2016/01/13 22:59:39
Done.
Patrick Monette
2016/01/13 22:59:40
Done.
| |
34 process, module, &module_info, sizeof(module_info))) | |
35 return false; | |
scottmg
2016/01/13 19:12:42
PLOG(ERROR) << "GetModuleInformation" here.
Patrick Monette
2016/01/13 22:59:39
Done.
| |
36 | |
37 PEImageReader image_reader; | |
38 if (!image_reader.Initialize( | |
39 &process_reader, | |
40 reinterpret_cast<crashpad::WinVMAddress>(module_info.lpBaseOfDll), | |
41 module_info.SizeOfImage, | |
42 "")) | |
43 return false; | |
44 | |
45 PEImageAnnotationsReader annotations_reader( | |
46 &process_reader, &image_reader, L""); | |
47 | |
48 *annotations = annotations_reader.SimpleMap(); | |
49 return true; | |
50 } | |
51 | |
52 } // namespace crashpad | |
OLD | NEW |