OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 #ifndef CRASHPAD_UTIL_WIN_REGISTRATION_PROTOCOL_WIN_H_ |
| 16 #define CRASHPAD_UTIL_WIN_REGISTRATION_PROTOCOL_WIN_H_ |
| 17 |
| 18 #include <windows.h> |
| 19 #include <stdint.h> |
| 20 |
| 21 #include "base/strings/string16.h" |
| 22 #include "util/win/address_types.h" |
| 23 |
| 24 namespace crashpad { |
| 25 |
| 26 #pragma pack(push, 1) |
| 27 |
| 28 //! \brief Structure read out of the client process by the crash handler when an |
| 29 //! exception occurs. |
| 30 struct ExceptionInformation { |
| 31 //! \brief The address of an EXCEPTION_POINTERS structure in the client |
| 32 //! process that describes the exception. |
| 33 WinVMAddress exception_pointers; |
| 34 |
| 35 //! \brief The thread on which the exception happened. |
| 36 DWORD thread_id; |
| 37 }; |
| 38 |
| 39 //! \brief A client registration request. |
| 40 struct RegistrationRequest { |
| 41 //! \brief The address, in the client process address space, of an |
| 42 //! ExceptionInformation structure. |
| 43 WinVMAddress exception_information; |
| 44 |
| 45 //! \brief The PID of the client process. |
| 46 DWORD client_process_id; |
| 47 }; |
| 48 |
| 49 //! \brief A message only sent to the server by itself to trigger shutdown. |
| 50 struct ShutdownRequest { |
| 51 //! \brief A randomly generated token used to validate the the shutdown |
| 52 //! request was not sent from another process. |
| 53 uint64_t token; |
| 54 }; |
| 55 |
| 56 //! \brief The message passed from client to server by |
| 57 //! SendToCrashHandlerServer(). |
| 58 struct ClientToServerMessage { |
| 59 //! \brief Indicates which field of the union is in use. |
| 60 enum Type : uint32_t { |
| 61 //! \brief For RegistrationRequest. |
| 62 kRegister, |
| 63 //! \brief For ShutdownRequest. |
| 64 kShutdown, |
| 65 } type; |
| 66 |
| 67 union { |
| 68 RegistrationRequest registration; |
| 69 ShutdownRequest shutdown; |
| 70 }; |
| 71 }; |
| 72 |
| 73 //! \brief A client registration response. |
| 74 //! |
| 75 //! See <a |
| 76 //! href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa384203">Int
erprocess |
| 77 //! Communication Between 32-bit and 64-bit Applications</a> for details on |
| 78 //! communicating handle values between processes of varying bitness. |
| 79 struct RegistrationResponse { |
| 80 //! \brief An event `HANDLE`, valid in the client process, that should be |
| 81 //! signaled to request a crash report. 64-bit clients should convert the |
| 82 //! value to a `HANDLE` using sign-extension. |
| 83 uint32_t request_report_event; |
| 84 }; |
| 85 |
| 86 //! \brief The response sent back to the client via SendToCrashHandlerServer(). |
| 87 union ServerToClientMessage { |
| 88 RegistrationResponse registration; |
| 89 }; |
| 90 |
| 91 #pragma pack(pop) |
| 92 |
| 93 //! \brief Connect over the given \a pipe_name, passing \a message to the |
| 94 //! server, storing the server's reply into \a response. |
| 95 //! |
| 96 //! Typically clients will not use this directly, instead using |
| 97 //! CrashpadClient::SetHandler(). |
| 98 //! |
| 99 //! \sa CrashpadClient::SetHandler() |
| 100 bool SendToCrashHandlerServer(const base::string16& pipe_name, |
| 101 const ClientToServerMessage& message, |
| 102 ServerToClientMessage* response); |
| 103 |
| 104 } // namespace crashpad |
| 105 |
| 106 #endif // CRASHPAD_UTIL_WIN_REGISTRATION_PROTOCOL_WIN_H_ |
OLD | NEW |