1 : // Copyright 2014 Google Inc. 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 : #ifndef SYZYGY_KASKO_API_CLIENT_H_
16 : #define SYZYGY_KASKO_API_CLIENT_H_
17 :
18 : #include <windows.h>
19 :
20 : #include "base/strings/string16.h"
21 : #include "syzygy/kasko/api/crash_key.h"
22 : #include "syzygy/kasko/api/kasko_export.h"
23 : #include "syzygy/kasko/api/minidump_type.h"
24 :
25 m : namespace kasko {
26 m : namespace api {
27 :
28 : // The stream type assigned to the protobuf stream in the uploaded minidump
29 : // file. 0x4B6B is 'Kk'.
30 m : const uint32_t kProtobufStreamType = 0x4B6B0001;
31 :
32 m : struct MemoryRange {
33 : // The start of the range.
34 m : const void* base_address;
35 : // The length of the range.
36 m : size_t length;
37 m : };
38 :
39 : // Initializes a diagnostic reporting client in the current process.
40 : // @param endpoint_name The RPC endpoint name shared with the reporter process.
41 m : KASKO_EXPORT void InitializeClient(const base::char16* endpoint_name);
42 :
43 : // Shuts down and frees resources associated with the previously initialized
44 : // client.
45 m : KASKO_EXPORT void ShutdownClient();
46 :
47 : // Registers the address of an array of crash keys. These crash keys will be
48 : // included with any crash report that might be triggered. This method must only
49 : // be called once per process.
50 : // @param crash_keys An array of crash keys. Keys with empty names or values
51 : // will be ignored.
52 : // @param crash_key_count The number of entries in crash_keys.
53 m : KASKO_EXPORT void RegisterCrashKeys(const CrashKey* crash_keys,
54 m : size_t crash_key_count);
55 :
56 : // Sends a diagnostic report for the current process.
57 : // @param exception_info_address Optional exception information.
58 : // @param minidump_type The type of minidump to be included in the report.
59 : // @param protobuf An optional protobuf to be included in the report.
60 : // @param protobuf_length The length of the protobuf.
61 : // @param crash_keys An optional array of crash keys. Keys with empty names or
62 : // values will be ignored.
63 : // @param crash_key_count The number of entries in crash_keys.
64 : // @param user_selected_memory_ranges An optional array of memory ranges to be
65 : // included in the report.
66 : // @param user_selected_memory_range_count The number of entries in
67 : // user_selected_memory_ranges..
68 m : KASKO_EXPORT void SendReport(const EXCEPTION_POINTERS* exception_pointers,
69 m : MinidumpType minidump_type,
70 m : const char* protobuf,
71 m : size_t protobuf_length,
72 m : const CrashKey* crash_keys,
73 m : size_t crash_key_count,
74 m : const MemoryRange* user_selected_memory_ranges,
75 m : size_t user_selected_memory_range_count);
76 :
77 m : } // namespace api
78 m : } // namespace kasko
79 :
80 : #endif // SYZYGY_KASKO_API_CLIENT_H_
|