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/api/module_annotations_win.h" | |
16 | |
17 #include "snapshot/win/pe_image_annotations_reader.h" | |
18 #include "snapshot/win/pe_image_reader.h" | |
19 #include "snapshot/win/process_reader_win.h" | |
20 #include "util/win/get_module_information.h" | |
21 | |
22 namespace crashpad { | |
23 | |
24 bool ReadModuleAnnotations(HANDLE process, | |
25 HMODULE module, | |
scottmg
2016/01/13 23:13:39
Reformat for indent here.
Patrick Monette
2016/01/14 22:58:53
Done.
| |
26 std::map<std::string, std::string>* annotations) { | |
27 ProcessReaderWin process_reader; | |
28 if (!process_reader.Initialize(process, ProcessSuspensionState::kRunning)) | |
29 return false; | |
30 | |
31 MODULEINFO module_info; | |
32 if (!CrashpadGetModuleInformation( | |
33 process, module, &module_info, sizeof(module_info))) { | |
34 PLOG(ERROR) << "CrashpadGetModuleInformation"; | |
35 return false; | |
36 } | |
37 | |
38 PEImageReader image_reader; | |
39 if (!image_reader.Initialize( | |
40 &process_reader, | |
41 reinterpret_cast<crashpad::WinVMAddress>(module_info.lpBaseOfDll), | |
42 module_info.SizeOfImage, | |
43 "")) | |
44 return false; | |
45 | |
46 PEImageAnnotationsReader annotations_reader( | |
47 &process_reader, &image_reader, L""); | |
48 | |
49 *annotations = annotations_reader.SimpleMap(); | |
50 return true; | |
51 } | |
52 | |
53 } // namespace crashpad | |
OLD | NEW |