// Copyright 2014 The Crashpad Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef CRASHPAD_MINIDUMP_MINIDUMP_MISC_INFO_WRITER_H_ #define CRASHPAD_MINIDUMP_MINIDUMP_MISC_INFO_WRITER_H_ #include <windows.h> #include <dbghelp.h> #include <stdint.h> #include <sys/types.h> #include <time.h> #include <wchar.h> #include <string> #include "build/build_config.h" #include "minidump/minidump_stream_writer.h" #include "minidump/minidump_writable.h" namespace crashpad { class ProcessSnapshot; namespace internal { //! \brief Returns the string to set in MINIDUMP_MISC_INFO_4::DbgBldStr. //! //! dbghelp produces strings like `"dbghelp.i386,6.3.9600.16520"` and //! `"dbghelp.amd64,6.3.9600.16520"`. This function mimics that format, and adds //! the OS that wrote the minidump along with any relevant platform-specific //! data describing the compilation environment. //! //! This function is an implementation detail of //! MinidumpMiscInfoWriter::InitializeFromSnapshot() and is only exposed for //! testing purposes. std::string MinidumpMiscInfoDebugBuildString(); } // namespace internal //! \brief The writer for a stream in the MINIDUMP_MISC_INFO family in a //! minidump file. //! //! The actual stream written will be a MINIDUMP_MISC_INFO, //! MINIDUMP_MISC_INFO_2, MINIDUMP_MISC_INFO_3, MINIDUMP_MISC_INFO_4, or //! MINIDUMP_MISC_INFO_5 stream. Later versions of MINIDUMP_MISC_INFO are //! supersets of earlier versions. The earliest version that supports all of the //! information that an object of this class contains will be used. class MinidumpMiscInfoWriter final : public internal::MinidumpStreamWriter { … }; //! \brief Conversion functions from a native UTF16 C-string to a char16_t //! C-string. No-op where the native UTF16 string is std::u16string. #if defined(WCHAR_T_IS_16_BIT) || DOXYGEN inline const char16_t* AsU16CStr(const wchar_t* str) { return reinterpret_cast<const char16_t*>(str); } inline char16_t* AsU16CStr(wchar_t* str) { return reinterpret_cast<char16_t*>(str); } #else inline const char16_t* AsU16CStr(const char16_t* str) { … } inline char16_t* AsU16CStr(char16_t* str) { … } #endif } // namespace crashpad #endif // CRASHPAD_MINIDUMP_MINIDUMP_MISC_INFO_WRITER_H_