├── .editorconfig ├── .github └── workflows │ └── cmake.yml ├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── application ├── CMakeLists.txt ├── CobaltFusion │ ├── CMakeLists.txt │ ├── CircularBuffer.cpp │ ├── Executor.cpp │ ├── ExecutorClient.cpp │ ├── GuiExecutor.cpp │ ├── Throttle.cpp │ ├── Timer.cpp │ ├── fusionassert.cpp │ └── stringformat.cpp ├── CobaltFusionTest │ ├── CMakeLists.txt │ ├── CobaltFusionTest.cpp │ ├── TestExecutor.cpp │ └── TestGuiExecutor.cpp ├── DbgMsgSrc │ ├── CMakeLists.txt │ ├── DbgMsgSrc.cpp │ ├── Timer.cpp │ ├── Timer.h │ └── dbgstream.h ├── DebugViewConsole │ ├── CMakeLists.txt │ └── DebugViewConsole.cpp ├── DebugViewpp │ ├── AboutDlg.cpp │ ├── AboutDlg.h │ ├── CLogViewTabItem2.cpp │ ├── CLogViewTabItem2.h │ ├── CMakeLists.txt │ ├── DebugView++.cpp │ ├── DebugView++.rc │ ├── DebugView++.rgs │ ├── DropTargetSupport.cpp │ ├── DropTargetSupport.h │ ├── FileOptionDlg.cpp │ ├── FileOptionDlg.h │ ├── FilterDlg.cpp │ ├── FilterDlg.h │ ├── FilterPage.cpp │ ├── FilterPage.h │ ├── Filters │ │ └── SystemnoiseFilter.xml │ ├── FindDlg.cpp │ ├── FindDlg.h │ ├── Grid.cpp │ ├── Grid.h │ ├── HistoryDlg.cpp │ ├── HistoryDlg.h │ ├── LogView.cpp │ ├── LogView.h │ ├── MainFrame.cpp │ ├── MainFrame.h │ ├── PropertyColorItem.h │ ├── RegExDlg.cpp │ ├── RegExDlg.h │ ├── RenameProcessDlg.cpp │ ├── RenameProcessDlg.h │ ├── RunDlg.cpp │ ├── RunDlg.h │ ├── SourceDlg.cpp │ ├── SourceDlg.h │ ├── SourcesDlg.cpp │ ├── SourcesDlg.h │ ├── UpdateBuildNr.cmd │ ├── Version.rc2 │ ├── atleverything.h │ ├── crashpad.h │ ├── res │ │ ├── Bookmark.ico │ │ ├── DebugView++.ico │ │ ├── DragDrop.cur │ │ └── Toolbar.bmp │ ├── resource.h │ ├── version.h │ └── version.wxi ├── DebugViewppLib │ ├── AnyFileReader.cpp │ ├── BinaryFileReader.cpp │ ├── CMakeLists.txt │ ├── CTimelineView.cpp │ ├── Colors.cpp │ ├── Conversions.cpp │ ├── DBWinBuffer.cpp │ ├── DBWinReader.cpp │ ├── DBWinWriter.cpp │ ├── DbgviewReader.cpp │ ├── DebugView++Lib.h │ ├── FileIO.cpp │ ├── FileReader.cpp │ ├── FileWriter.cpp │ ├── Filter.cpp │ ├── FilterType.cpp │ ├── Line.cpp │ ├── LineBuffer.cpp │ ├── LogFile.cpp │ ├── LogFilter.cpp │ ├── LogSource.cpp │ ├── LogSources.cpp │ ├── Loopback.cpp │ ├── MatchType.cpp │ ├── NewlineFilter.cpp │ ├── PipeReader.cpp │ ├── PolledLogSource.cpp │ ├── ProcessInfo.cpp │ ├── ProcessMonitor.cpp │ ├── ProcessReader.cpp │ ├── SocketReader.cpp │ ├── SourceType.cpp │ ├── TestSource.cpp │ ├── TimelineDC.cpp │ └── VectorLineBuffer.cpp ├── DebugViewppTest │ ├── CMakeLists.txt │ ├── DebugView++Test.cpp │ └── run.bat ├── GDIGraphicsPOC │ ├── AtlWinExt.h │ ├── CMainFrame2.cpp │ ├── CMainFrame2.h │ ├── CMakeLists.txt │ ├── Logview.cpp │ ├── Logview.h │ ├── MainFrame.cpp │ ├── MainFrame.h │ ├── TabItem.h │ ├── TabbingFramework │ │ ├── CustomTabCtrl.h │ │ ├── DotNetTabCtrl.h │ │ ├── DynamicDialogTemplate.h │ │ ├── ImageUtil.h │ │ ├── ListViewNoFlicker.h │ │ ├── PlainTextView.h │ │ ├── SimpleDlgTabCtrls.h │ │ ├── SimpleTabCtrls.h │ │ ├── TabbedDockingWindow.h │ │ ├── TabbedFrame.h │ │ ├── TabbedMDI.h │ │ ├── TabbedMDIMessages.h │ │ ├── TabbedMDISave.cpp │ │ ├── TabbedMDISave.h │ │ └── atlgdix.h │ ├── resource.h │ └── resource.rc ├── IndexedStorageLib │ ├── CMakeLists.txt │ └── IndexedStorage.cpp ├── Libraries │ ├── CMakeLists.txt │ ├── PropertyGrid │ │ ├── CMakeLists.txt │ │ ├── PropertyControlTest.cpp │ │ ├── PropertyControlTest.rc │ │ ├── PropertyControlTest.sln │ │ ├── include │ │ │ ├── ColorCombo.h │ │ │ ├── PropertyGrid.h │ │ │ ├── PropertyItem.h │ │ │ ├── PropertyItemEditors.h │ │ │ ├── PropertyItemImpl.h │ │ │ ├── PropertyList.h │ │ │ ├── PropertyTree.h │ │ │ └── permissive_fixes.h │ │ ├── maindlg.h │ │ ├── res │ │ │ ├── PropertyControlTest.exe.manifest │ │ │ ├── PropertyControlTest.ico │ │ │ └── PropertyTree.bmp │ │ └── resource.h │ ├── README.txt │ ├── TabbingFramework │ │ ├── CMakeLists.txt │ │ ├── CustomTabCtrl.h │ │ ├── DotNetTabCtrl.h │ │ ├── DynamicDialogTemplate.h │ │ ├── ImageUtil.h │ │ ├── ListViewNoFlicker.h │ │ ├── PlainTextView.h │ │ ├── SimpleDlgTabCtrls.h │ │ ├── SimpleTabCtrls.h │ │ ├── TabbedDockingWindow.h │ │ ├── TabbedFrame.h │ │ ├── TabbedMDI.h │ │ ├── TabbedMDIMessages.h │ │ ├── TabbedMDISave.cpp │ │ ├── TabbedMDISave.h │ │ ├── atlgdix.h │ │ └── license.txt │ └── docopt.cpp │ │ ├── CMakeLists.txt │ │ ├── LICENSE-Boost-1.0 │ │ ├── LICENSE-MIT │ │ ├── README.rst │ │ ├── docopt-config.cmake │ │ ├── docopt.cpp │ │ ├── docopt.h │ │ ├── docopt.pc.in │ │ ├── docopt_private.h │ │ ├── docopt_util.h │ │ ├── docopt_value.h │ │ └── main.cpp ├── Win32Lib │ ├── CMakeLists.txt │ ├── Com.cpp │ ├── Process.cpp │ ├── Registry.cpp │ ├── Socket.cpp │ ├── Utilities.cpp │ ├── Win32Lib.cpp │ └── Window.cpp ├── _clang-format ├── include │ ├── CobaltFusion │ │ ├── AtlWinExt.h │ │ ├── CircularBuffer.h │ │ ├── Executor.h │ │ ├── ExecutorClient.h │ │ ├── GuiExecutor.h │ │ ├── JobDispatcher.h │ │ ├── Math.h │ │ ├── Str.h │ │ ├── SynchronizedQueue.h │ │ ├── Throttle.h │ │ ├── Timer.h │ │ ├── dbgstream.h │ │ ├── fusionassert.h │ │ ├── hstream.h │ │ ├── lazy_vector.h │ │ ├── noncopyable.h │ │ ├── scope_guard.h │ │ ├── stringbuilder.h │ │ ├── stringformat.h │ │ ├── thread.h │ │ └── tohex.h │ ├── DebugViewppLib │ │ ├── AnyFileReader.h │ │ ├── BinaryFileReader.h │ │ ├── CTimelineView.h │ │ ├── Colors.h │ │ ├── Conversions.h │ │ ├── DBWinBuffer.h │ │ ├── DBWinReader.h │ │ ├── DBWinWriter.h │ │ ├── DbgviewReader.h │ │ ├── FileIO.h │ │ ├── FileReader.h │ │ ├── FileWriter.h │ │ ├── Filter.h │ │ ├── FilterType.h │ │ ├── Line.h │ │ ├── LineBuffer.h │ │ ├── LogFile.h │ │ ├── LogFilter.h │ │ ├── LogSource.h │ │ ├── LogSources.h │ │ ├── Loopback.h │ │ ├── MatchType.h │ │ ├── NewlineFilter.h │ │ ├── PipeReader.h │ │ ├── PolledLogSource.h │ │ ├── ProcessInfo.h │ │ ├── ProcessMonitor.h │ │ ├── ProcessReader.h │ │ ├── SocketReader.h │ │ ├── SourceType.h │ │ ├── TestSource.h │ │ ├── TimelineDC.h │ │ └── VectorLineBuffer.h │ ├── IndexedStorageLib │ │ └── IndexedStorage.h │ ├── Win32 │ │ ├── Com.h │ │ ├── Process.h │ │ ├── Registry.h │ │ ├── Socket.h │ │ ├── Utilities.h │ │ ├── Win32Lib.h │ │ └── Window.h │ └── boost │ │ └── test │ │ └── unit_test_gui.hpp └── nuget │ ├── DebugViewpp-nuget.cpp │ ├── DebugViewpp-nuget.sln │ ├── DebugViewpp-nuget.vcxproj │ ├── DebugViewpp-nuget.vcxproj.filters │ ├── framework.h │ ├── packages.config │ ├── pch.cpp │ └── pch.h ├── art ├── ClassDiagram.png ├── DebugViewProjects.png ├── StarUml class diagram.uml ├── TimeDebuggerMockup.png ├── backtrace_logo.png ├── bug256.png ├── bug256_merged.pdn ├── bug256_merged_glow.pdn ├── filterdialog.png ├── incredi_logo.png ├── logcat_example.png ├── regexgroups.png ├── resharpercpp_logo.png ├── syntax_high.png ├── timedoc_screenshot.png └── vs2017_options.png ├── azure-pipelines.yml ├── build.bat ├── build_with_ninja.bat ├── cmake ├── CMakeLists.buildnumber.cmake ├── CMakeLists.nuget.cmake └── build_number.txt ├── companions ├── DebugViewppSetup │ ├── DebugViewppSetup.sln │ ├── DebugViewppSetup.wixproj │ └── Product.wxs ├── OutputForwarder2022 │ ├── Forwarder.cs │ ├── OutputForwarder2022.csproj │ ├── OutputForwarder2022Package.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── source.extension.vsixmanifest ├── OutputForwarderVSIX │ ├── Forwarder.cs │ ├── ForwarderPackage.cs │ ├── ForwarderPackage.vsct │ ├── Key.snk │ ├── OutputForwarderVSIX.csproj │ ├── OutputForwarderVSIX.csproj.user │ ├── OutputForwarderVSIX.sln │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Forwarder.png │ │ └── ForwarderPackage.ico │ ├── VSPackage.resx │ ├── packages.config │ └── source.extension.vsixmanifest ├── cs │ └── HttpMonitor │ │ ├── HttpMonitor.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ └── app.config └── java │ └── hellojar │ ├── HelloJar.jar │ ├── Manifest.txt │ ├── compile.bat │ ├── jna-4.1.0.jar │ ├── nl │ └── cobaltfusion │ │ └── debugviewpp │ │ ├── DebugViewPP.java │ │ └── HelloJar.java │ └── run.bat ├── dbgview_testfiles ├── UTF-8-demo.txt └── UTF-8-test.txt ├── doc ├── DesignOverview.md ├── Understanding Win32 _OutputDebugString_.html ├── Understanding Win32 _OutputDebugString__files │ ├── feed-icon-14x14.png │ ├── steve-email.gif │ ├── unixwiz-logo-140x80.gif │ └── unixwiz.css ├── classdiagram.plantuml ├── example_usage.md └── readme.txt └── utils ├── apply-clang-format.py ├── build_boost.txt ├── bzip2.dll ├── clang-format.exe ├── createzip.bat ├── nuget.exe ├── upx.exe ├── zip.exe └── zip32z64.dll /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | [*] 5 | trim_trailing_whitespace = true 6 | insert_final_newline = true 7 | end_of_line = crlf 8 | charset = latin1 9 | 10 | [*.cpp] 11 | indent_style = space 12 | indent_size = 4 13 | 14 | [*.h] 15 | indent_style = space 16 | indent_size = 4 17 | 18 | [*.rc] 19 | indent_style = space 20 | indent_size = 4 21 | 22 | [*.yml] 23 | indent_style = space 24 | indent_size = 4 25 | -------------------------------------------------------------------------------- /.github/workflows/cmake.yml: -------------------------------------------------------------------------------- 1 | name: CMake 2 | 3 | on: 4 | push: 5 | branches: [ "develop" ] 6 | pull_request: 7 | branches: [ "develop" ] 8 | 9 | env: 10 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) 11 | BUILD_TYPE: Release 12 | 13 | jobs: 14 | build: 15 | # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. 16 | # You can convert this to a matrix build if you need cross-platform coverage. 17 | # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix 18 | runs-on: windows-2022 19 | 20 | steps: 21 | - uses: actions/checkout@v3 22 | 23 | - name: Configure CMake 24 | # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. 25 | # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type 26 | run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} 27 | 28 | - name: Build 29 | # Build your program with the given configuration 30 | run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} 31 | 32 | - name: Test 33 | working-directory: ${{github.workspace}}/build 34 | # Execute tests defined by the CMake configuration. 35 | # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail 36 | run: ctest -C ${{env.BUILD_TYPE}} 37 | 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | vs2022/ 3 | build/ 4 | out/ 5 | bin/ 6 | packages/ 7 | bin 8 | obj/ 9 | Testing/ 10 | install/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /application/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(CobaltFusion) 2 | add_subdirectory(CobaltFusionTest) 3 | add_subdirectory(DbgMsgSrc) 4 | add_subdirectory(DebugViewpp) 5 | add_subdirectory(DebugViewppLib) 6 | add_subdirectory(DebugViewppTest) 7 | add_subdirectory(DebugViewConsole) 8 | add_subdirectory(GDIGraphicsPOC) 9 | add_subdirectory(IndexedStorageLib) 10 | add_subdirectory(Win32Lib) 11 | add_subdirectory(Libraries EXCLUDE_FROM_ALL) 12 | 13 | set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME ALL) 14 | set(CPACK_PACKAGE_VERSION "${DEBUGVIEW_VERSION}") 15 | set(CPACK_GENERATOR "ZIP") 16 | 17 | # this include needs to be after all install() rules 18 | include(CPack) 19 | -------------------------------------------------------------------------------- /application/CobaltFusion/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(CobaltFusion) 2 | 3 | add_library(${PROJECT_NAME} 4 | CircularBuffer.cpp 5 | Executor.cpp 6 | ExecutorClient.cpp 7 | fusionassert.cpp 8 | GuiExecutor.cpp 9 | Throttle.cpp 10 | Timer.cpp 11 | stringformat.cpp 12 | ) 13 | add_library(dv::cobaltfusion ALIAS ${PROJECT_NAME}) 14 | 15 | target_link_libraries(${PROJECT_NAME} 16 | PRIVATE 17 | project::definitions 18 | project::compile_features 19 | project::compile_options 20 | nuget::boost 21 | dv::win32 22 | ) 23 | 24 | target_include_directories(${PROJECT_NAME} PUBLIC 25 | $ 26 | ) 27 | -------------------------------------------------------------------------------- /application/CobaltFusion/Throttle.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2016. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | #include "CobaltFusion/Throttle.h" 8 | #include "CobaltFusion/stringbuilder.h" 9 | 10 | namespace fusion { 11 | 12 | using namespace std::chrono_literals; 13 | 14 | Throttle::Throttle(IExecutor& executor, int callsPerSecond, std::function fn) : 15 | m_delta(1000ms / callsPerSecond), 16 | m_callPending(false), 17 | m_fn(std::move(fn)), 18 | m_executor(executor) 19 | { 20 | } 21 | 22 | void Throttle::operator()() 23 | { 24 | auto now = Clock::now(); 25 | std::unique_lock lock(m_mutex); 26 | m_lastCallTime = now; 27 | if (!m_callPending) 28 | { 29 | m_lastSchedulingTime = now; 30 | m_callPending = true; 31 | lock.unlock(); 32 | m_executor.CallAt(now + m_delta, [this] { PendingCall(); }); 33 | } 34 | } 35 | 36 | void Throttle::PendingCall() 37 | { 38 | m_fn(); 39 | auto now = Clock::now(); 40 | std::unique_lock lock(m_mutex); 41 | if (m_lastCallTime > m_lastSchedulingTime) 42 | { 43 | m_lastSchedulingTime = now; 44 | lock.unlock(); 45 | m_executor.CallAt(now + m_delta, [this] { PendingCall(); }); 46 | } 47 | else 48 | { 49 | m_callPending = false; 50 | } 51 | } 52 | 53 | } // namespace fusion 54 | -------------------------------------------------------------------------------- /application/CobaltFusion/Timer.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "CobaltFusion/Timer.h" 7 | 8 | #include 9 | 10 | #include "windows.h" 11 | 12 | namespace fusion { 13 | 14 | Timer::Timer() : 15 | m_timerUnit(0.0), 16 | m_init(false), 17 | m_offset(0) 18 | { 19 | LARGE_INTEGER li; 20 | QueryPerformanceFrequency(&li); 21 | if (li.QuadPart == 0) 22 | { 23 | throw std::runtime_error("QueryPerformanceCounter not supported!"); 24 | } 25 | m_timerUnit = 1. / li.QuadPart; 26 | } 27 | 28 | void Timer::Reset() 29 | { 30 | m_offset = 0; 31 | m_init = false; 32 | } 33 | 34 | double Timer::Get() 35 | { 36 | auto ticks = GetTicks(); 37 | std::lock_guard lock(m_mutex); 38 | if (!m_init) 39 | { 40 | m_offset = ticks; 41 | m_init = true; 42 | } 43 | return (ticks - m_offset) * m_timerUnit; 44 | } 45 | 46 | long long Timer::GetTicks() 47 | { 48 | LARGE_INTEGER li; 49 | QueryPerformanceCounter(&li); 50 | return li.QuadPart; 51 | } 52 | 53 | } // namespace fusion 54 | -------------------------------------------------------------------------------- /application/CobaltFusion/fusionassert.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "CobaltFusion/fusionassert.h" 7 | #include "CobaltFusion/stringbuilder.h" 8 | #include "CobaltFusion/stringformat.h" 9 | #include "Win32/Win32Lib.h" 10 | 11 | #include 12 | 13 | namespace fusion { 14 | 15 | void errormessage(const std::string& message, const std::string& caption) 16 | { 17 | MessageBoxA(nullptr, message.c_str(), caption.c_str(), MB_OK | MB_ICONERROR); 18 | } 19 | 20 | void errormessage(const std::wstring& message, const std::wstring& caption) 21 | { 22 | MessageBoxW(nullptr, message.c_str(), caption.c_str(), MB_OK | MB_ICONERROR); 23 | } 24 | 25 | void assertmessage(const std::string& assertion, const std::string& message, const char* location) 26 | { 27 | errormessage(stringbuilder() << "Assertion '" << assertion << "' failed (" << message << ") at " << location, "Exception occurred"); 28 | } 29 | 30 | void exceptionmessage(const char* what, const char* location) 31 | { 32 | errormessage(stringbuilder() << "Exception '" << strip(what, "\r\n\t") << "' occured at " << location, "Exception occurred"); 33 | } 34 | 35 | void exceptionmessage(const std::exception& ex, const char* location) 36 | { 37 | exceptionmessage(ex.what(), location); 38 | } 39 | 40 | } // namespace fusion 41 | -------------------------------------------------------------------------------- /application/CobaltFusion/stringformat.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Jan Wilmans 2022. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | #include 8 | 9 | namespace fusion { 10 | 11 | std::vector split(std::string_view value, char separator) 12 | { 13 | std::vector result; 14 | std::size_t start = 0; 15 | auto current = start; 16 | 17 | while ((current = value.find(separator, start)) != std::string::npos) 18 | { 19 | auto view = value.substr(start, current - start); 20 | if (view.begin() != view.end()) 21 | { 22 | result.emplace_back(view.begin(), view.end()); 23 | } 24 | start = current + 1; 25 | } 26 | auto view = value.substr(start); 27 | if (view.begin() != view.end()) 28 | { 29 | result.emplace_back(view.begin(), view.end()); 30 | } 31 | return result; 32 | } 33 | 34 | std::string join(const std::vector& values, const std::string& separator) 35 | { 36 | std::string result; 37 | for (const auto& value : values) 38 | { 39 | result.append(value); 40 | result.append(separator); 41 | } 42 | auto end = result.size() - separator.size(); 43 | return result.substr(0, end); 44 | } 45 | 46 | std::string ltrim(std::string str, const std::string& chars) 47 | { 48 | str.erase(0, str.find_first_not_of(chars)); 49 | return str; 50 | } 51 | 52 | std::string rtrim(std::string str, const std::string& chars) 53 | { 54 | str.erase(str.find_last_not_of(chars) + 1); 55 | return str; 56 | } 57 | 58 | std::string strip(std::string str, const std::string& chars) 59 | { 60 | str.erase(0, str.find_first_not_of(chars)); 61 | str.erase(str.find_last_not_of(chars) + 1); 62 | return str; 63 | } 64 | 65 | } // namespace fusion 66 | -------------------------------------------------------------------------------- /application/CobaltFusionTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(CobaltFusionTest) 2 | 3 | add_executable(${PROJECT_NAME} CobaltFusionTest.cpp TestExecutor.cpp TestGuiExecutor.cpp) 4 | 5 | target_link_libraries(${PROJECT_NAME} 6 | PRIVATE 7 | project::definitions 8 | project::compile_features 9 | project::compile_options 10 | nuget::boost_test 11 | CobaltFusion 12 | ) 13 | 14 | target_include_directories(${PROJECT_NAME} PUBLIC 15 | $ 16 | ) 17 | 18 | add_test(${PROJECT_NAME} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}" WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 19 | -------------------------------------------------------------------------------- /application/CobaltFusionTest/TestExecutor.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2015. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #define BOOST_TEST_NO_GUI_INIT 7 | #include 8 | #include "CobaltFusion/Executor.h" 9 | 10 | namespace fusion { 11 | 12 | BOOST_AUTO_TEST_SUITE(TestExecutor) 13 | 14 | BOOST_AUTO_TEST_CASE(TestExecutor) 15 | { 16 | using namespace std::chrono_literals; 17 | 18 | ActiveExecutor exec; 19 | 20 | BOOST_CHECK_EQUAL(exec.Call([]() { return 1 + 1; }), 2); 21 | auto f = exec.CallAsync([]() { return 2 + 2; }); 22 | BOOST_CHECK_EQUAL(f.get(), 4); 23 | 24 | auto now = ActiveExecutor::Clock::now(); 25 | 26 | std::vector vec; 27 | auto timer = exec.CallAt(now + 600ms, [&vec]() { vec.push_back(10); }); 28 | exec.CallAt(now + 504ms, [&vec]() { vec.push_back(4); }); 29 | exec.CallAt(now + 501ms, [&vec]() { vec.push_back(1); }); 30 | exec.CallAt(now + 503ms, [&vec]() { vec.push_back(3); }); 31 | exec.CallAt(now + 502ms, [&vec]() { vec.push_back(2); }); 32 | exec.Call([&vec]() { vec.push_back(0); }); 33 | 34 | // Cancel needs to excute within 600 ms. The 600ms needs to elapse within the 1 s sleep. 35 | // If not, the additional 10 will be appended to vec. 36 | // Longer delays help for test robustness but slows down testing. 37 | timer.Cancel(); 38 | std::this_thread::sleep_for(1s); 39 | 40 | int results[] = {0, 1, 2, 3, 4}; 41 | BOOST_CHECK_EQUAL_COLLECTIONS(std::begin(vec), std::end(vec), std::begin(results), std::end(results)); 42 | } 43 | 44 | BOOST_AUTO_TEST_SUITE_END() 45 | 46 | } // namespace fusion 47 | -------------------------------------------------------------------------------- /application/DbgMsgSrc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(DbgMsgSrc) 2 | 3 | add_executable(${PROJECT_NAME} DbgMsgSrc.cpp Timer.cpp) 4 | 5 | target_link_libraries(${PROJECT_NAME} 6 | PRIVATE 7 | project::definitions 8 | project::compile_features 9 | project::compile_options 10 | project::console_link_options 11 | nuget::boost 12 | dv::cobaltfusion 13 | dv::library 14 | dv::win32 15 | ) 16 | 17 | target_include_directories(${PROJECT_NAME} PUBLIC 18 | $ 19 | ) 20 | 21 | # not part of the release? 22 | #install(TARGETS ${PROJECT_NAME} DESTINATION bin) 23 | -------------------------------------------------------------------------------- /application/DbgMsgSrc/Timer.cpp: -------------------------------------------------------------------------------- 1 | #include "Timer.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "windows.h" 7 | 8 | #define MICROSECONDS (1e6 / li.QuadPart) 9 | 10 | Timer::Timer() : 11 | m_timerUnit(0.0) 12 | { 13 | LARGE_INTEGER li; 14 | QueryPerformanceFrequency(&li); 15 | if (li.QuadPart == 0) 16 | throw std::runtime_error("QueryPerformanceCounter not supported!"); 17 | m_timerUnit = MICROSECONDS; 18 | } 19 | 20 | std::chrono::steady_clock::time_point Timer::now() const 21 | { 22 | return std::chrono::steady_clock::time_point(std::chrono::microseconds(static_cast(GetTicks() * m_timerUnit))); 23 | } 24 | 25 | long long Timer::GetTicks() const 26 | { 27 | LARGE_INTEGER li; 28 | QueryPerformanceCounter(&li); 29 | return li.QuadPart; 30 | } 31 | -------------------------------------------------------------------------------- /application/DbgMsgSrc/Timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class Timer 7 | { 8 | public: 9 | Timer(); 10 | std::chrono::steady_clock::time_point now() const; 11 | 12 | static double ToMs(std::chrono::steady_clock::duration duration) 13 | { 14 | return static_cast(std::chrono::duration_cast(duration).count()) / 1000.0; 15 | } 16 | 17 | private: 18 | long long GetTicks() const; 19 | double m_timerUnit; 20 | }; 21 | -------------------------------------------------------------------------------- /application/DebugViewConsole/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(DebugViewConsole) 2 | 3 | add_executable(DebugViewConsole DebugViewConsole.cpp) 4 | 5 | target_link_libraries(DebugViewConsole 6 | PRIVATE 7 | project::definitions 8 | project::compile_features 9 | project::compile_options 10 | nuget::boost_test 11 | dv::library 12 | dv::indexedstorage 13 | CobaltFusion 14 | docopt 15 | ) 16 | 17 | install(TARGETS DebugViewConsole RUNTIME DESTINATION bin) 18 | 19 | target_include_directories(DebugViewConsole PUBLIC 20 | $ 21 | ) 22 | 23 | add_custom_command( 24 | TARGET DebugViewConsole 25 | POST_BUILD 26 | COMMAND ${CMAKE_COMMAND} -E copy 27 | $ 28 | ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DebugViewConsole-small.exe 29 | ) 30 | 31 | install(CODE " 32 | execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DebugViewConsole.exe ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DebugViewConsole-small.exe) 33 | execute_process(COMMAND ${PROJECT_UTILS_DIRECTORY}/upx.exe ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DebugViewConsole-small.exe) 34 | ") 35 | 36 | INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DebugViewConsole-small.exe DESTINATION bin) -------------------------------------------------------------------------------- /application/DebugViewpp/AboutDlg.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "Win32/Utilities.h" 7 | #include "CobaltFusion/stringbuilder.h" 8 | #include "resource.h" 9 | #include "version.h" 10 | #include "AboutDlg.h" 11 | 12 | #include 13 | 14 | namespace fusion { 15 | namespace debugviewpp { 16 | 17 | BOOL CAboutDlg::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) 18 | { 19 | CenterWindow(GetParent()); 20 | m_srclink.SubclassWindow(GetDlgItem(IDC_DEBUGVIEW_SRC_URL)); 21 | m_link.SubclassWindow(GetDlgItem(IDC_DEBUGVIEW_URL)); 22 | std::array version = {VERSION}; 23 | SetDlgItemText(IDC_VERSION, WStr(wstringbuilder() << L"DebugView++ V" << version[0] << L"." << version[1] << L"." << version[2] << L"." << version[3])); 24 | SetDlgItemText(IDC_DATE, _T(__DATE__)); 25 | return TRUE; 26 | } 27 | 28 | void CAboutDlg::OnCloseCmd(UINT /*uNotifyCode*/, int nID, CWindow /*wndCtl*/) 29 | { 30 | EndDialog(nID); 31 | } 32 | 33 | } // namespace debugviewpp 34 | } // namespace fusion 35 | -------------------------------------------------------------------------------- /application/DebugViewpp/AboutDlg.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "CobaltFusion/AtlWinExt.h" 9 | #include "resource.h" 10 | 11 | #include "atleverything.h" 12 | 13 | namespace fusion { 14 | namespace debugviewpp { 15 | 16 | class CAboutDlg : public CDialogImpl 17 | { 18 | public: 19 | enum 20 | { 21 | IDD = IDD_ABOUTBOX 22 | }; 23 | 24 | BEGIN_MSG_MAP(CAboutDlg) 25 | MSG_WM_INITDIALOG(OnInitDialog) 26 | COMMAND_ID_HANDLER_EX(IDOK, OnCloseCmd) 27 | COMMAND_ID_HANDLER_EX(IDCANCEL, OnCloseCmd) 28 | END_MSG_MAP() 29 | 30 | BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); 31 | void OnCloseCmd(UINT uNotifyCode, int nID, CWindow wndCtl); 32 | 33 | private: 34 | CHyperLink m_srclink; 35 | CHyperLink m_link; 36 | }; 37 | 38 | } // namespace debugviewpp 39 | } // namespace fusion 40 | -------------------------------------------------------------------------------- /application/DebugViewpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(Debugviewpp) 2 | 3 | add_executable(Debugviewpp 4 | AboutDlg.cpp 5 | CLogViewTabItem2.cpp 6 | DebugView++.cpp 7 | DropTargetSupport.cpp 8 | FileOptionDlg.cpp 9 | FilterDlg.cpp 10 | FilterPage.cpp 11 | FindDlg.cpp 12 | Grid.cpp 13 | HistoryDlg.cpp 14 | LogView.cpp 15 | MainFrame.cpp 16 | RegExDlg.cpp 17 | RenameProcessDlg.cpp 18 | RunDlg.cpp 19 | SourceDlg.cpp 20 | SourcesDlg.cpp 21 | DebugView++.rc 22 | ) 23 | 24 | target_link_libraries(Debugviewpp 25 | PRIVATE 26 | project::definitions 27 | project::compile_features 28 | project::compile_options 29 | project::gui_link_options 30 | nuget::boost 31 | nuget::wtl 32 | dv::cobaltfusion 33 | dv::tabbingframework 34 | dv::propertygrid 35 | dv::indexedstorage 36 | dv::library 37 | dv::win32 38 | ) 39 | 40 | install(TARGETS Debugviewpp DESTINATION bin) 41 | 42 | target_include_directories(Debugviewpp PUBLIC 43 | $ 44 | ) 45 | 46 | install(CODE " 47 | execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debugviewpp.exe ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debugviewpp-small.exe) 48 | execute_process(COMMAND ${PROJECT_UTILS_DIRECTORY}/upx.exe ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debugviewpp-small.exe) 49 | ") 50 | 51 | INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debugviewpp-small.exe DESTINATION bin) 52 | -------------------------------------------------------------------------------- /application/DebugViewpp/DebugView++.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | } 4 | -------------------------------------------------------------------------------- /application/DebugViewpp/DropTargetSupport.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace fusion { 13 | namespace debugviewpp { 14 | class ATL_NO_VTABLE DropTargetSupport 15 | : public CComObjectRootEx 16 | , public IDropTarget 17 | { 18 | public: 19 | BEGIN_COM_MAP(DropTargetSupport) 20 | COM_INTERFACE_ENTRY(IDropTarget) 21 | END_COM_MAP() 22 | 23 | DropTargetSupport(); 24 | virtual ~DropTargetSupport() = default; 25 | void Register(HWND hwnd); 26 | void Unregister(); 27 | 28 | STDMETHOD(DragEnter)(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override; 29 | STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override; 30 | STDMETHOD(DragLeave)() override; 31 | STDMETHOD(Drop)(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override; 32 | 33 | using DroppedSignal = boost::signals2::signal; 34 | boost::signals2::connection SubscribeToDropped(DroppedSignal::slot_type slot); 35 | 36 | private: 37 | HWND m_hwnd = nullptr; 38 | DroppedSignal m_onDropped; 39 | }; 40 | 41 | } // namespace debugviewpp 42 | } // namespace fusion 43 | -------------------------------------------------------------------------------- /application/DebugViewpp/FileOptionDlg.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "atleverything.h" 7 | #include "Dlgs.h" 8 | #include "FileOptionDlg.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | CFileOptionDlg::CFileOptionDlg( 14 | BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs 15 | LPCTSTR lpszOptionLabel, 16 | LPCTSTR lpszDefExt, 17 | LPCTSTR lpszFileName, 18 | DWORD dwFlags, 19 | LPCTSTR lpszFilter, 20 | HWND hWndParent) : 21 | CFileDialogImpl(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent), 22 | m_label(lpszOptionLabel), 23 | m_option(false) 24 | { 25 | } 26 | 27 | bool CFileOptionDlg::Option() const 28 | { 29 | return m_option; 30 | } 31 | 32 | BOOL CFileOptionDlg::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) 33 | { 34 | // customize file dialog, using "Explorer-Style Control Identifiers", see: 35 | // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646960(v=vs.85).aspx 36 | 37 | SetControlText(chx1, m_label.c_str()); 38 | return TRUE; 39 | } 40 | 41 | void CFileOptionDlg::OnDestroy() 42 | { 43 | m_option = GetReadOnlyPref() != FALSE; 44 | } 45 | 46 | } // namespace debugviewpp 47 | } // namespace fusion 48 | -------------------------------------------------------------------------------- /application/DebugViewpp/FileOptionDlg.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "CobaltFusion/AtlWinExt.h" 10 | 11 | #include "atleverything.h" 12 | 13 | namespace fusion { 14 | namespace debugviewpp { 15 | 16 | class CFileOptionDlg : public CFileDialogImpl 17 | { 18 | public: 19 | CFileOptionDlg( 20 | BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs 21 | LPCTSTR lpszOptionLabel, 22 | LPCTSTR lpszDefExt = nullptr, 23 | LPCTSTR lpszFileName = nullptr, 24 | DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, 25 | LPCTSTR lpszFilter = nullptr, 26 | HWND hWndParent = nullptr); 27 | 28 | bool Option() const; 29 | 30 | BEGIN_MSG_MAP(CFileOpenDlg) 31 | MSG_WM_INITDIALOG(OnInitDialog) 32 | MSG_WM_DESTROY(OnDestroy) 33 | CHAIN_MSG_MAP(CFileDialogImpl) 34 | END_MSG_MAP() 35 | 36 | private: 37 | BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); 38 | void OnDestroy(); 39 | 40 | std::wstring m_label; 41 | bool m_option; 42 | }; 43 | 44 | } // namespace debugviewpp 45 | } // namespace fusion 46 | -------------------------------------------------------------------------------- /application/DebugViewpp/Filters/SystemnoiseFilter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | View 4 | 5 | 6 | true 7 | AfxDllCanUnloadNow returning S_OK 8 | Simple 9 | Exclude 10 | 11 | 255 12 | 255 13 | 255 14 | 15 | 16 | 0 17 | 0 18 | 0 19 | 20 | 21 | 22 | true 23 | Creating dialog from within a COleControlModule application is not a supported scenario 24 | Simple 25 | Exclude 26 | 27 | 255 28 | 255 29 | 255 30 | 31 | 32 | 0 33 | 0 34 | 0 35 | 36 | 37 | 38 | 39 | 40 | true 41 | devenv.exe 42 | Simple 43 | Exclude 44 | 45 | 255 46 | 255 47 | 255 48 | 49 | 50 | 0 51 | 0 52 | 0 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /application/DebugViewpp/FindDlg.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "resource.h" 7 | #include "MainFrame.h" 8 | #include "FindDlg.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | CFindDlg::CFindDlg(CMainFrame& mainFrame) : 14 | m_mainFrame(mainFrame) 15 | { 16 | } 17 | 18 | BOOL CFindDlg::PreTranslateMessage(MSG* pMsg) 19 | { 20 | return IsDialogMessage(pMsg); 21 | } 22 | 23 | BOOL CFindDlg::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) 24 | { 25 | DlgResize_Init(); 26 | 27 | // register object for message filtering and idle updates 28 | CMessageLoop* pLoop = _Module.GetMessageLoop(); 29 | ATLASSERT(pLoop != nullptr); 30 | pLoop->AddMessageFilter(this); 31 | 32 | return TRUE; 33 | } 34 | 35 | void CFindDlg::OnDestroy() 36 | { 37 | // register object for message filtering and idle updates 38 | CMessageLoop* pLoop = _Module.GetMessageLoop(); 39 | if (pLoop != nullptr) 40 | { // shutdown bug found by PVS studio 41 | pLoop->RemoveMessageFilter(this); 42 | } 43 | } 44 | 45 | void CFindDlg::OnNext(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/) const 46 | { 47 | m_mainFrame.FindNext(Win32::GetDlgItemText(*this, IDC_TEXT)); 48 | } 49 | 50 | void CFindDlg::OnPrevious(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/) const 51 | { 52 | m_mainFrame.FindPrevious(Win32::GetDlgItemText(*this, IDC_TEXT)); 53 | } 54 | 55 | } // namespace debugviewpp 56 | } // namespace fusion 57 | -------------------------------------------------------------------------------- /application/DebugViewpp/FindDlg.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "CobaltFusion/AtlWinExt.h" 9 | #include "resource.h" 10 | 11 | namespace fusion { 12 | namespace debugviewpp { 13 | 14 | class CMainFrame; 15 | 16 | class CFindDlg : public CDialogImpl, 17 | public CMessageFilter, 18 | public CDialogResize 19 | { 20 | public: 21 | explicit CFindDlg(CMainFrame& mainFrame); 22 | 23 | enum 24 | { 25 | IDD = IDD_FIND 26 | }; 27 | 28 | BEGIN_MSG_MAP(CFindDlg) 29 | MSG_WM_INITDIALOG(OnInitDialog) 30 | MSG_WM_DESTROY(OnDestroy) 31 | COMMAND_ID_HANDLER_EX(IDOK, OnNext) 32 | COMMAND_ID_HANDLER_EX(IDC_NEXT, OnNext) 33 | COMMAND_ID_HANDLER_EX(IDC_PREVIOUS, OnPrevious) 34 | CHAIN_MSG_MAP(CDialogResize) 35 | END_MSG_MAP() 36 | 37 | BEGIN_DLGRESIZE_MAP(CFindDlg) 38 | DLGRESIZE_CONTROL(IDC_TEXT, DLSZ_SIZE_X) 39 | DLGRESIZE_CONTROL(IDC_NEXT, DLSZ_MOVE_X) 40 | DLGRESIZE_CONTROL(IDC_PREVIOUS, DLSZ_MOVE_X) 41 | END_DLGRESIZE_MAP() 42 | 43 | // Handler prototypes (uncomment arguments if needed): 44 | // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 45 | // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 46 | // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) 47 | 48 | BOOL PreTranslateMessage(MSG* pMsg) override; 49 | void OnDestroy(); 50 | BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); 51 | void OnPrevious(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/) const; 52 | void OnNext(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/) const; 53 | 54 | private: 55 | CMainFrame& m_mainFrame; 56 | }; 57 | 58 | } // namespace debugviewpp 59 | } // namespace fusion 60 | -------------------------------------------------------------------------------- /application/DebugViewpp/Grid.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "Grid.h" 7 | 8 | namespace fusion { 9 | namespace debugviewpp { 10 | 11 | std::wstring GetGridItemText(const CPropertyGridCtrl& grid, int iItem, int iSubItem) 12 | { 13 | const int BufSize = 4192; 14 | wchar_t buf[BufSize]; 15 | if (grid.GetItemText(iItem, iSubItem, buf, BufSize) != 0) 16 | { 17 | return buf; 18 | } 19 | return L""; 20 | } 21 | 22 | } // namespace debugviewpp 23 | } // namespace fusion 24 | -------------------------------------------------------------------------------- /application/DebugViewpp/Grid.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "atleverything.h" 9 | 10 | #pragma warning(push, 3) 11 | #pragma warning(disable : 4838) 12 | #include "PropertyGrid.h" 13 | #include "PropertyColorItem.h" 14 | #pragma warning(pop) 15 | 16 | #include 17 | 18 | namespace fusion { 19 | namespace debugviewpp { 20 | 21 | std::wstring GetGridItemText(const CPropertyGridCtrl& grid, int iItem, int iSubItem); 22 | 23 | template 24 | ItemType& GetGridItem(const CPropertyGridCtrl& grid, int iItem, int iSubItem) 25 | { 26 | return dynamic_cast(*grid.GetProperty(iItem, iSubItem)); 27 | } 28 | 29 | template 30 | CPropertyListItem* CreateEnumTypeItem(const wchar_t* name, const Enum* types, size_t count, Enum value) 31 | { 32 | std::vector items(count + 1); 33 | int index = 0; 34 | for (size_t i = 0; i < count; ++i) 35 | { 36 | items[i] = EnumToWCharPtr(types[i]); 37 | if (types[i] == value) 38 | { 39 | index = static_cast(i); 40 | } 41 | } 42 | items[count] = nullptr; 43 | auto pItem = PropCreateList(name, items.data()); 44 | pItem->SetValue(CComVariant(index)); 45 | return pItem; 46 | } 47 | 48 | template 49 | CPropertyListItem* CreateEnumTypeItem(const wchar_t* name, const Enum (&types)[N], Enum value) 50 | { 51 | return CreateEnumTypeItem(name, types, N, value); 52 | } 53 | 54 | } // namespace debugviewpp 55 | } // namespace fusion 56 | -------------------------------------------------------------------------------- /application/DebugViewpp/HistoryDlg.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "CobaltFusion/AtlWinExt.h" 7 | #include "CobaltFusion/Str.h" 8 | #include "CobaltFusion/fusionassert.h" 9 | #include "Win32/Utilities.h" 10 | #include "HistoryDlg.h" 11 | 12 | namespace fusion { 13 | namespace debugviewpp { 14 | 15 | BEGIN_MSG_MAP2(CHistoryDlg) 16 | MSG_WM_INITDIALOG(OnInitDialog) 17 | COMMAND_ID_HANDLER_EX(IDC_UNLIMITED, OnUnlimited) 18 | COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel) 19 | COMMAND_ID_HANDLER_EX(IDOK, OnOk) 20 | REFLECT_NOTIFICATIONS() 21 | END_MSG_MAP() 22 | 23 | CHistoryDlg::CHistoryDlg(size_t historySize, bool unlimited) : 24 | m_historySize(static_cast(historySize)), 25 | m_unlimited(unlimited) 26 | { 27 | } 28 | 29 | void CHistoryDlg::OnException() const 30 | { 31 | FUSION_REPORT_EXCEPTION("Unknown Exception"); 32 | } 33 | 34 | void CHistoryDlg::OnException(const std::exception& ex) const 35 | { 36 | FUSION_REPORT_EXCEPTION(ex.what()); 37 | } 38 | 39 | BOOL CHistoryDlg::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) 40 | { 41 | SetDlgItemInt(IDC_HISTORY, m_historySize); 42 | 43 | CButton unlimited(GetDlgItem(IDC_UNLIMITED)); 44 | unlimited.SetCheck(static_cast(m_unlimited)); 45 | UpdateUi(); 46 | 47 | CenterWindow(GetParent()); 48 | 49 | return TRUE; 50 | } 51 | 52 | void CHistoryDlg::OnUnlimited(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/) 53 | { 54 | CButton unlimited(GetDlgItem(IDC_UNLIMITED)); 55 | m_unlimited = unlimited.GetCheck() == BST_CHECKED; 56 | UpdateUi(); 57 | } 58 | 59 | void CHistoryDlg::UpdateUi() const 60 | { 61 | GetDlgItem(IDC_HISTORY).EnableWindow(static_cast(!m_unlimited)); 62 | } 63 | 64 | void CHistoryDlg::OnCancel(UINT /*uNotifyCode*/, int nID, CWindow /*wndCtl*/) 65 | { 66 | EndDialog(nID); 67 | } 68 | 69 | void CHistoryDlg::OnOk(UINT /*uNotifyCode*/, int nID, CWindow /*wndCtl*/) 70 | { 71 | m_historySize = GetDlgItemInt(IDC_HISTORY); 72 | // m_unlimited = fusion::GetDlgItemText(*this, IDC_ARGUMENTS); 73 | 74 | EndDialog(nID); 75 | } 76 | 77 | int CHistoryDlg::GetHistorySize() const 78 | { 79 | return m_historySize; 80 | } 81 | 82 | } // namespace debugviewpp 83 | } // namespace fusion 84 | -------------------------------------------------------------------------------- /application/DebugViewpp/HistoryDlg.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "CobaltFusion/AtlWinExt.h" 9 | #include "resource.h" 10 | 11 | #include "atleverything.h" 12 | 13 | namespace fusion { 14 | namespace debugviewpp { 15 | 16 | class CHistoryDlg : public CDialogImpl, 17 | public ExceptionHandler 18 | { 19 | public: 20 | enum 21 | { 22 | IDD = IDD_HISTORY 23 | }; 24 | 25 | CHistoryDlg(size_t historySize, bool unlimited); 26 | int GetHistorySize() const; 27 | 28 | private: 29 | DECLARE_MSG_MAP() 30 | 31 | void OnException() const; 32 | void OnException(const std::exception& ex) const; 33 | BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/); 34 | void OnUnlimited(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/); 35 | void OnCancel(UINT /*uNotifyCode*/, int nID, CWindow /*wndCtl*/); 36 | void OnOk(UINT /*uNotifyCode*/, int nID, CWindow /*wndCtl*/); 37 | void UpdateUi() const; 38 | 39 | int m_historySize; 40 | bool m_unlimited; 41 | }; 42 | 43 | } // namespace debugviewpp 44 | } // namespace fusion 45 | -------------------------------------------------------------------------------- /application/DebugViewpp/RegExDlg.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "CobaltFusion/Str.h" 7 | #include "CobaltFusion/AtlWinExt.h" 8 | #include "CobaltFusion/fusionassert.h" 9 | #include "Win32/Utilities.h" 10 | #include "RegExDlg.h" 11 | 12 | namespace fusion { 13 | namespace debugviewpp { 14 | 15 | BEGIN_MSG_MAP2(CRegExDlg) 16 | MSG_WM_INITDIALOG(OnInitDialog) 17 | COMMAND_ID_HANDLER_EX(IDCANCEL, OnClose) 18 | COMMAND_ID_HANDLER_EX(IDOK, OnClose) 19 | REFLECT_NOTIFICATIONS() 20 | END_MSG_MAP() 21 | 22 | void CRegExDlg::OnException() const 23 | { 24 | FUSION_REPORT_EXCEPTION("Unknown Exception"); 25 | } 26 | 27 | void CRegExDlg::OnException(const std::exception& ex) const 28 | { 29 | FUSION_REPORT_EXCEPTION(ex.what()); 30 | } 31 | 32 | BOOL CRegExDlg::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) 33 | { 34 | CenterWindow(GetParent()); 35 | return TRUE; 36 | } 37 | 38 | void CRegExDlg::OnClose(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/) 39 | { 40 | ShowWindow(SW_HIDE); 41 | } 42 | 43 | } // namespace debugviewpp 44 | } // namespace fusion 45 | -------------------------------------------------------------------------------- /application/DebugViewpp/RegExDlg.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "CobaltFusion/AtlWinExt.h" 9 | #include "resource.h" 10 | 11 | #include "atleverything.h" 12 | 13 | namespace fusion { 14 | namespace debugviewpp { 15 | 16 | class CRegExDlg : public CDialogImpl, 17 | public ExceptionHandler 18 | { 19 | public: 20 | enum 21 | { 22 | IDD = IDD_REGEX 23 | }; 24 | 25 | private: 26 | DECLARE_MSG_MAP() 27 | 28 | void OnException() const; 29 | void OnException(const std::exception& ex) const; 30 | 31 | BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/); 32 | void OnClose(UINT /*uNotifyCode*/, int nID, CWindow /*wndCtl*/); 33 | }; 34 | 35 | } // namespace debugviewpp 36 | } // namespace fusion 37 | -------------------------------------------------------------------------------- /application/DebugViewpp/RenameProcessDlg.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "CobaltFusion/AtlWinExt.h" 7 | #include "CobaltFusion/fusionassert.h" 8 | #include "RenameProcessDlg.h" 9 | 10 | #include 11 | #include "CobaltFusion/Str.h" 12 | #include "CobaltFusion/fusionassert.h" 13 | 14 | namespace fusion { 15 | namespace debugviewpp { 16 | 17 | BEGIN_MSG_MAP2(CRenameProcessDlg) 18 | MSG_WM_INITDIALOG(OnInitDialog) 19 | COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel) 20 | COMMAND_ID_HANDLER_EX(IDOK, OnOk) 21 | COMMAND_HANDLER_EX(IDC_TYPE, CBN_SELCHANGE, OnTypeSelChange) 22 | END_MSG_MAP() 23 | 24 | CRenameProcessDlg::CRenameProcessDlg(std::wstring name) : 25 | m_name(std::move(name)) 26 | { 27 | } 28 | 29 | std::wstring CRenameProcessDlg::GetName() const 30 | { 31 | return m_name; 32 | } 33 | 34 | void CRenameProcessDlg::OnException() 35 | { 36 | FUSION_REPORT_EXCEPTION("Unknown Exception"); 37 | } 38 | 39 | void CRenameProcessDlg::OnException(const std::exception& ex) 40 | { 41 | FUSION_REPORT_EXCEPTION(ex.what()); 42 | } 43 | 44 | BOOL CRenameProcessDlg::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) 45 | { 46 | CenterWindow(GetParent()); 47 | SetDlgItemText(IDC_NAME, m_name.c_str()); 48 | return TRUE; 49 | } 50 | 51 | void CRenameProcessDlg::OnCancel(UINT /*uNotifyCode*/, int nID, CWindow /*wndCtl*/) 52 | { 53 | EndDialog(nID); 54 | } 55 | 56 | void CRenameProcessDlg::OnOk(UINT /*uNotifyCode*/, int nID, CWindow /*wndCtl*/) 57 | { 58 | m_name = Win32::GetDlgItemText(*this, IDC_NAME); 59 | EndDialog(nID); 60 | } 61 | 62 | void CRenameProcessDlg::OnTypeSelChange(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/) 63 | { 64 | } 65 | 66 | } // namespace debugviewpp 67 | } // namespace fusion 68 | -------------------------------------------------------------------------------- /application/DebugViewpp/RenameProcessDlg.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "CobaltFusion/AtlWinExt.h" 9 | #include "resource.h" 10 | 11 | #include "atleverything.h" 12 | 13 | namespace fusion { 14 | namespace debugviewpp { 15 | 16 | class CRenameProcessDlg : public CDialogImpl, 17 | public ExceptionHandler 18 | { 19 | public: 20 | explicit CRenameProcessDlg(std::wstring name); 21 | 22 | enum 23 | { 24 | IDD = IDD_RENAMEPROCESS 25 | }; 26 | 27 | std::wstring GetName() const; 28 | 29 | private: 30 | DECLARE_MSG_MAP() 31 | 32 | void OnException(); 33 | void OnException(const std::exception& ex); 34 | BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); 35 | void OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl); 36 | void OnOk(UINT uNotifyCode, int nID, CWindow wndCtl); 37 | void OnTypeSelChange(UINT uNotifyCode, int nID, CWindow wndCtl); 38 | 39 | std::wstring m_name; 40 | }; 41 | 42 | } // namespace debugviewpp 43 | } // namespace fusion 44 | -------------------------------------------------------------------------------- /application/DebugViewpp/RunDlg.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "CobaltFusion/AtlWinExt.h" 9 | #include "resource.h" 10 | 11 | #include "atleverything.h" 12 | 13 | #include 14 | 15 | namespace fusion { 16 | namespace debugviewpp { 17 | 18 | class CRunDlg : public CDialogImpl, 19 | public CDialogResize, 20 | public ExceptionHandler 21 | { 22 | public: 23 | enum 24 | { 25 | IDD = IDD_RUN 26 | }; 27 | 28 | std::wstring GetPathName() const; 29 | void SetPathName(const std::wstring& pathNamde); 30 | std::wstring GetArguments() const; 31 | 32 | BEGIN_DLGRESIZE_MAP(CRunDlg) 33 | DLGRESIZE_CONTROL(IDC_RUN, DLSZ_SIZE_X) 34 | DLGRESIZE_CONTROL(IDC_ARGUMENTS, DLSZ_SIZE_X | DLSZ_SIZE_Y) 35 | DLGRESIZE_CONTROL(IDC_BROWSE, DLSZ_MOVE_X) 36 | DLGRESIZE_CONTROL(IDOK, DLSZ_MOVE_X | DLSZ_MOVE_Y) 37 | DLGRESIZE_CONTROL(IDCANCEL, DLSZ_MOVE_X | DLSZ_MOVE_Y) 38 | END_DLGRESIZE_MAP() 39 | 40 | private: 41 | DECLARE_MSG_MAP() 42 | 43 | void OnException(); 44 | void OnException(const std::exception& ex); 45 | BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/); 46 | void OnBrowse(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/); 47 | void OnCancel(UINT /*uNotifyCode*/, int nID, CWindow /*wndCtl*/); 48 | void OnOk(UINT /*uNotifyCode*/, int nID, CWindow /*wndCtl*/); 49 | 50 | std::wstring m_pathName; 51 | std::wstring m_arguments; 52 | }; 53 | 54 | } // namespace debugviewpp 55 | } // namespace fusion 56 | -------------------------------------------------------------------------------- /application/DebugViewpp/SourceDlg.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "CobaltFusion/AtlWinExt.h" 9 | #include "DebugViewppLib/LogSource.h" 10 | #include "resource.h" 11 | 12 | #include 13 | 14 | #include "atleverything.h" 15 | 16 | namespace fusion { 17 | namespace debugviewpp { 18 | 19 | class CSourceDlg : public CDialogImpl, 20 | public ExceptionHandler 21 | { 22 | public: 23 | CSourceDlg(std::wstring name, SourceType::type sourceType, std::wstring address, int port); 24 | 25 | enum 26 | { 27 | IDD = IDD_SOURCE 28 | }; 29 | 30 | std::wstring GetName() const; 31 | SourceType::type GetSourceType() const; 32 | std::wstring GetAddress() const; 33 | int GetPort() const; 34 | 35 | private: 36 | DECLARE_MSG_MAP() 37 | 38 | void OnException(); 39 | void OnException(const std::exception& ex); 40 | BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); 41 | void OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl); 42 | void OnOk(UINT uNotifyCode, int nID, CWindow wndCtl); 43 | void OnTypeSelChange(UINT uNotifyCode, int nID, CWindow wndCtl); 44 | void UpdateUI(); 45 | 46 | std::wstring m_name; 47 | SourceType::type m_sourceType; 48 | std::wstring m_address; 49 | int m_port; 50 | }; 51 | 52 | } // namespace debugviewpp 53 | } // namespace fusion 54 | -------------------------------------------------------------------------------- /application/DebugViewpp/SourcesDlg.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "CobaltFusion/AtlWinExt.h" 10 | #include "DebugViewppLib/LogSources.h" 11 | #include "Grid.h" 12 | #include "PropertyColorItem.h" 13 | #include "resource.h" 14 | #include "Filter.h" 15 | 16 | namespace fusion { 17 | namespace debugviewpp { 18 | 19 | class CSourcesDlg : public CDialogImpl, 20 | public CDialogResize, 21 | public ExceptionHandler 22 | { 23 | public: 24 | explicit CSourcesDlg(std::vector sourceInfos); 25 | 26 | enum 27 | { 28 | IDD = IDD_SOURCES 29 | }; 30 | 31 | BEGIN_DLGRESIZE_MAP(CSourcesDlg) 32 | DLGRESIZE_CONTROL(IDADD, DLSZ_MOVE_Y) 33 | DLGRESIZE_CONTROL(IDOK, DLSZ_MOVE_X | DLSZ_MOVE_Y) 34 | DLGRESIZE_CONTROL(IDCANCEL, DLSZ_MOVE_X | DLSZ_MOVE_Y) 35 | DLGRESIZE_CONTROL(IDC_SOURCES_GRID, DLSZ_SIZE_X | DLSZ_SIZE_Y) 36 | END_DLGRESIZE_MAP() 37 | 38 | std::vector GetSourceInfos(); 39 | 40 | private: 41 | DECLARE_MSG_MAP() 42 | 43 | void OnException(); 44 | void OnException(const std::exception& ex); 45 | BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); 46 | void OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl); 47 | void OnOk(UINT uNotifyCode, int nID, CWindow wndCtl); 48 | void OnAdd(UINT uNotifyCode, int nID, CWindow wndCtl); 49 | LRESULT OnClickItem(NMHDR* pnmh); 50 | 51 | bool GetSourceEnable(int iItem) const; 52 | std::wstring GetSourceText(int iItem) const; 53 | SourceType::type GetSourceType(int iItem) const; 54 | void UpdateGrid(); 55 | 56 | CPropertyGridCtrl m_grid; 57 | std::vector m_sourceInfos; 58 | }; 59 | 60 | } // namespace debugviewpp 61 | } // namespace fusion 62 | -------------------------------------------------------------------------------- /application/DebugViewpp/UpdateBuildNr.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo UpdateBuildNr.cmd updating %1 4 | echo UpdateBuildNr.cmd updating %2 5 | 6 | set file=%1 7 | set xmlfile=%2 8 | for /f "tokens=3,4,5,* delims=, " %%i in (%file%) do ( 9 | set major=%%i 10 | set minor=%%j 11 | set inc=%%k 12 | set /a buildnr=%%l+1 13 | goto break 14 | ) 15 | :break 16 | echo #define VERSION %major%,%minor%,%inc%,%buildnr% > %file% 17 | echo #define VERSION_STR "%major%.%minor%.%inc%.%buildnr%" >> %file% 18 | echo ^ > %xmlfile% 19 | echo ^ >> %xmlfile% 20 | echo ^ >> %xmlfile% 21 | echo ^ >> %xmlfile% 22 | echo ^ >> %xmlfile% 23 | echo ^ >> %xmlfile% 24 | echo ^ >> %xmlfile% 25 | echo ^ >> %xmlfile% 26 | 27 | -------------------------------------------------------------------------------- /application/DebugViewpp/Version.rc2: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "version.h" 7 | 8 | ///////////////////////////////////////////////////////////////////////////// 9 | // 10 | // Version 11 | // 12 | 13 | VS_VERSION_INFO VERSIONINFO 14 | FILEVERSION VERSION 15 | PRODUCTVERSION VERSION 16 | FILEFLAGSMASK 0x3fL 17 | #ifdef _DEBUG 18 | FILEFLAGS 0x1L 19 | #else 20 | FILEFLAGS 0x0L 21 | #endif 22 | FILEOS 0x40004L 23 | FILETYPE 0x1L 24 | FILESUBTYPE 0x0L 25 | BEGIN 26 | BLOCK "StringFileInfo" 27 | BEGIN 28 | BLOCK "040904B0" 29 | BEGIN 30 | VALUE "CompanyName", "Cobalt Fusion" 31 | VALUE "FileDescription", "DebugView++" 32 | VALUE "FileVersion", VERSION_STR 33 | VALUE "LegalCopyright", "(c) 2014 Cobalt Fusion. All rights reserved." 34 | VALUE "InternalName", "DebugView++" 35 | VALUE "OriginalFilename", "DebugView++" 36 | VALUE "ProductName", "DebugView++" 37 | VALUE "ProductVersion", VERSION_STR 38 | END 39 | END 40 | BLOCK "VarFileInfo" 41 | BEGIN 42 | VALUE "Translation", 0x409, 1200 43 | END 44 | END 45 | -------------------------------------------------------------------------------- /application/DebugViewpp/atleverything.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #define _CRT_NON_CONFORMING_SWPRINTFS 9 | #define _WTL_NO_CSTRING 10 | 11 | #include 12 | #include 13 | 14 | #include "windows.h" 15 | #include "ShellApi.h" 16 | 17 | #pragma warning(push) 18 | #pragma warning(disable : 4091) // 'typedef ': ignored on left of 'tagGPFIDL_FLAGS' when no variable is declared 19 | #pragma warning(disable : 4838) // conversion from 'int' to 'UINT' requires a narrowing conversion 20 | #pragma warning(disable : 4838) // conversion from 'int' to 'UINT' requires a narrowing conversion 21 | #pragma warning(disable : 4458) // declaration of 'pButtons' hides class member 22 | 23 | #define _ATL_NO_DEBUG_CRT 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #pragma warning(pop) 39 | 40 | #undef _CRT_NON_CONFORMING_SWPRINTFS 41 | 42 | #include "atlgdi.h" 43 | #include "atlgdix.h" 44 | #include "atlcoll.h" 45 | 46 | extern CAppModule _Module; 47 | 48 | #if defined _M_IX86 49 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 50 | #elif defined _M_IA64 51 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") 52 | #elif defined _M_X64 53 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 54 | #else 55 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 56 | #endif 57 | 58 | #include 59 | #include 60 | #include 61 | -------------------------------------------------------------------------------- /application/DebugViewpp/res/Bookmark.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/application/DebugViewpp/res/Bookmark.ico -------------------------------------------------------------------------------- /application/DebugViewpp/res/DebugView++.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/application/DebugViewpp/res/DebugView++.ico -------------------------------------------------------------------------------- /application/DebugViewpp/res/DragDrop.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/application/DebugViewpp/res/DragDrop.cur -------------------------------------------------------------------------------- /application/DebugViewpp/res/Toolbar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/application/DebugViewpp/res/Toolbar.bmp -------------------------------------------------------------------------------- /application/DebugViewpp/version.h: -------------------------------------------------------------------------------- 1 | #define VERSION 1,9,0,56 2 | #define VERSION_STR "1.9.0.56" 3 | -------------------------------------------------------------------------------- /application/DebugViewpp/version.wxi: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /application/DebugViewppLib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(DebugView++Lib) 2 | 3 | add_library(${PROJECT_NAME} 4 | AnyFileReader.cpp 5 | BinaryFileReader.cpp 6 | Colors.cpp 7 | Conversions.cpp 8 | CTimelineView.cpp 9 | DbgviewReader.cpp 10 | DBWinBuffer.cpp 11 | DBWinReader.cpp 12 | DBWinWriter.cpp 13 | FileIO.cpp 14 | FileReader.cpp 15 | FileWriter.cpp 16 | Filter.cpp 17 | FilterType.cpp 18 | Line.cpp 19 | LineBuffer.cpp 20 | LogFile.cpp 21 | LogFilter.cpp 22 | LogSource.cpp 23 | LogSources.cpp 24 | Loopback.cpp 25 | MatchType.cpp 26 | NewlineFilter.cpp 27 | PipeReader.cpp 28 | PolledLogSource.cpp 29 | ProcessInfo.cpp 30 | ProcessMonitor.cpp 31 | ProcessReader.cpp 32 | SocketReader.cpp 33 | SourceType.cpp 34 | TestSource.cpp 35 | TimelineDC.cpp 36 | VectorLineBuffer.cpp 37 | ) 38 | 39 | add_library(dv::library ALIAS ${PROJECT_NAME}) 40 | 41 | target_link_libraries(${PROJECT_NAME} 42 | PRIVATE 43 | project::definitions 44 | project::compile_features 45 | project::compile_options 46 | nuget::boost 47 | nuget::wtl 48 | dv::cobaltfusion 49 | dv::win32 50 | ) 51 | 52 | target_include_directories(${PROJECT_NAME} PUBLIC 53 | $ 54 | ) 55 | -------------------------------------------------------------------------------- /application/DebugViewppLib/Colors.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | // #include "stdafx.h" 7 | #include 8 | #include "DebugViewppLib/Colors.h" 9 | #include "CobaltFusion/Math.h" 10 | 11 | namespace fusion { 12 | namespace debugviewpp { 13 | 14 | namespace Colors { 15 | 16 | extern const COLORREF Auto = 0x80808080; 17 | extern const COLORREF BackGround = GetSysColor(COLOR_WINDOW); 18 | extern const COLORREF Text = GetSysColor(COLOR_WINDOWTEXT); 19 | extern const COLORREF Highlight = RGB(255, 255, 55); 20 | extern const COLORREF Selection = RGB(128, 255, 255); 21 | extern const COLORREF ItemHighlight = GetSysColor(COLOR_HIGHLIGHT); 22 | extern const COLORREF ItemHighlightText = GetSysColor(COLOR_HIGHLIGHTTEXT); 23 | 24 | } // namespace Colors 25 | 26 | COLORREF HsvToRgb(double h, double s, double v) 27 | { 28 | int hi = FloorTo(h * 6); 29 | double f = h * 6 - hi; 30 | int vi = FloorTo(256 * v); 31 | int pi = FloorTo(256 * v * (1 - s)); 32 | int qi = FloorTo(256 * v * (1 - f * s)); 33 | int ti = FloorTo(256 * v * (1 - (1 - f) * s)); 34 | switch (hi) 35 | { 36 | case 0: return RGB(vi, ti, pi); 37 | case 1: return RGB(qi, vi, pi); 38 | case 2: return RGB(pi, vi, ti); 39 | case 3: return RGB(pi, qi, vi); 40 | case 4: return RGB(ti, pi, vi); 41 | case 5: return RGB(vi, pi, qi); 42 | default: break; 43 | } 44 | return 0; 45 | } 46 | 47 | COLORREF GetRandomColor(double s, double v) 48 | { 49 | static bool randomize = (std::srand(GetTickCount()), true); 50 | static const double ratio = (1 + std::sqrt(5.)) / 2 - 1; 51 | // use golden ratio 52 | static double h = static_cast(std::rand()) / (RAND_MAX + 1); 53 | 54 | h += ratio; 55 | if (h >= 1) 56 | { 57 | h = h - 1; 58 | } 59 | return HsvToRgb(h, s, v); 60 | } 61 | 62 | COLORREF GetRandomBackColor() 63 | { 64 | return GetRandomColor(0.5, 0.95); 65 | } 66 | 67 | COLORREF GetRandomTextColor() 68 | { 69 | return GetRandomColor(0.9, 0.7); 70 | } 71 | 72 | COLORREF GetRandomProcessColor() 73 | { 74 | return GetRandomColor(0.20, 0.95); 75 | } 76 | 77 | } // namespace debugviewpp 78 | } // namespace fusion 79 | -------------------------------------------------------------------------------- /application/DebugViewppLib/DBWinBuffer.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "Win32/Win32Lib.h" 7 | #include "DebugViewppLib/DBWinBuffer.h" 8 | 9 | namespace fusion { 10 | namespace debugviewpp { 11 | 12 | // this method is used to prevent acquiring the global DBWIN_BUFFER on XP, which will otherwise popup a MessageBox with a tip to 'Run As Administator' 13 | // however, as there are no 'global' messages there, this does not apply to WindowsXP 14 | bool IsWindowsVistaOrGreater() 15 | { 16 | // consider using ::AtlIsOldWindows? needs to be tested on XP 17 | OSVERSIONINFO osvi = {}; 18 | osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 19 | // http://stackoverflow.com/questions/27246562/how-to-get-the-os-version-in-win8-1-as-getversion-getversionex-are-deprecated 20 | // it looks like we can safely suppress this warning 21 | #pragma warning(suppress : 4996) 22 | GetVersionEx(&osvi); 23 | return (osvi.dwMajorVersion > 5); 24 | } 25 | 26 | bool IsDBWinViewerActive() 27 | { 28 | Win32::Handle hMap(::OpenFileMapping(FILE_MAP_READ, 0, L"DBWIN_BUFFER")); 29 | return hMap != nullptr; 30 | } 31 | 32 | bool HasGlobalDBWinReaderRights() 33 | { 34 | Win32::Handle hMap(::CreateFileMapping(nullptr, nullptr, PAGE_READWRITE, 0, sizeof(DbWinBuffer), L"Global\\DBWIN_BUFFER")); 35 | return hMap != nullptr; 36 | } 37 | 38 | } // namespace debugviewpp 39 | } // namespace fusion 40 | -------------------------------------------------------------------------------- /application/DebugViewppLib/DBWinWriter.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | #include "DebugViewppLib/DBWinBuffer.h" 8 | #include "DebugViewppLib/DBWinWriter.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | DBWinWriter::DBWinWriter() : 14 | m_hBuffer(::OpenFileMapping(FILE_MAP_WRITE, 0, L"DBWIN_BUFFER")), 15 | m_dbWinBufferReady(::OpenEvent(SYNCHRONIZE, 0, L"DBWIN_BUFFER_READY")), 16 | m_dbWinDataReady(::OpenEvent(EVENT_MODIFY_STATE, 0, L"DBWIN_DATA_READY")), 17 | m_dbWinView(m_hBuffer.get(), FILE_MAP_WRITE, 0, 0, sizeof(DbWinBuffer)) 18 | { 19 | } 20 | 21 | void DBWinWriter::Write(DWORD pid, const std::string& message) 22 | { 23 | if (!Win32::WaitForSingleObject(m_dbWinBufferReady.get(), 10000)) 24 | { 25 | return; 26 | } 27 | 28 | auto pData = static_cast(m_dbWinView.Ptr()); 29 | pData->processId = pid; 30 | size_t length = std::min(message.size(), sizeof(pData->data) - 1); 31 | std::copy(message.data(), message.data() + length, pData->data); 32 | pData->data[length] = '\0'; 33 | 34 | Win32::SetEvent(m_dbWinDataReady); 35 | } 36 | 37 | } // namespace debugviewpp 38 | } // namespace fusion 39 | -------------------------------------------------------------------------------- /application/DebugViewppLib/DebugView++Lib.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "../DBWinBufferLib/DBWinBufferLib.h" 9 | 10 | #include "FileIO.h" 11 | #include "FileReader.h" 12 | #include "Filter.h" 13 | #include "FilterType.h" 14 | #include "LogFile.h" 15 | #include "LogFilter.h" 16 | #include "LogSources.h" 17 | #include "MatchType.h" 18 | #include "PipeReader.h" 19 | #include "Process.h" 20 | #include "ProcessReader.h" 21 | 22 | #pragma comment(lib, "DebugView++Lib.lib") 23 | -------------------------------------------------------------------------------- /application/DebugViewppLib/FileWriter.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "DebugViewppLib/LogFile.h" 7 | #include "DebugViewppLib/FileIO.h" 8 | #include "DebugViewppLib/FileWriter.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | FileWriter::FileWriter(const std::wstring& filename, LogFile& logfile) : 14 | m_logfile(logfile) 15 | { 16 | OpenLogFile(m_ofstream, filename, OpenMode::Append); 17 | m_thread = std::thread(&FileWriter::Run, this); 18 | } 19 | 20 | void FileWriter::Run() 21 | { 22 | //todo: we need locking on Logfile, think of ClearLog() 23 | int writeIndex = 0; 24 | for (;;) 25 | { 26 | while (writeIndex < m_logfile.Count()) 27 | { 28 | auto msg = m_logfile[writeIndex]; 29 | ++writeIndex; 30 | WriteLogFileMessage(m_ofstream, msg.time, msg.systemTime, msg.processId, msg.processName, msg.text); 31 | } 32 | m_ofstream.flush(); 33 | std::this_thread::sleep_for(std::chrono::seconds(1)); 34 | } 35 | } 36 | 37 | } // namespace debugviewpp 38 | } // namespace fusion 39 | -------------------------------------------------------------------------------- /application/DebugViewppLib/FilterType.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | #include 8 | #include "DebugViewppLib/FilterType.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | int FilterTypeToInt(FilterType::type value) 14 | { 15 | #define FILTER_TYPE(f, id) \ 16 | case FilterType::f: return id; 17 | switch (value) 18 | { 19 | FILTER_TYPES() 20 | default: assert(!"Unexpected FilterType"); break; 21 | } 22 | #undef FILTER_TYPE 23 | 24 | throw std::invalid_argument("bad FilterType!"); 25 | } 26 | 27 | FilterType::type IntToFilterType(int value) 28 | { 29 | #define FILTER_TYPE(f, id) \ 30 | case id: return FilterType::f; 31 | switch (value) 32 | { 33 | FILTER_TYPES() 34 | default: assert(!"Unexpected FilterType"); break; 35 | } 36 | #undef FILTER_TYPE 37 | 38 | throw std::invalid_argument("bad FilterType!"); 39 | } 40 | 41 | std::string FilterTypeToString(FilterType::type value) 42 | { 43 | #define FILTER_TYPE(f, id) \ 44 | case FilterType::f: return #f; 45 | switch (value) 46 | { 47 | FILTER_TYPES() 48 | default: assert(!"Unexpected FilterType"); break; 49 | } 50 | #undef FILTER_TYPE 51 | 52 | throw std::invalid_argument("bad FilterType!"); 53 | } 54 | 55 | const wchar_t* EnumToWCharPtr(FilterType::type value) 56 | { 57 | #define FILTER_TYPE(f, id) \ 58 | case FilterType::f: return L## #f; 59 | switch (value) 60 | { 61 | FILTER_TYPES() 62 | default: assert(!"Unexpected FilterType"); break; 63 | } 64 | #undef FILTER_TYPE 65 | 66 | throw std::invalid_argument("bad FilterType!"); 67 | } 68 | 69 | FilterType::type StringToFilterType(const std::string& s) 70 | { 71 | #define FILTER_TYPE(f, id) \ 72 | if (s == #f) \ 73 | return FilterType::f; 74 | FILTER_TYPES() 75 | #undef FILTER_TYPE 76 | 77 | throw std::invalid_argument("bad FilterType!"); 78 | } 79 | 80 | } // namespace debugviewpp 81 | } // namespace fusion 82 | -------------------------------------------------------------------------------- /application/DebugViewppLib/Line.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "Win32/Win32Lib.h" 7 | #include "DebugViewppLib/Line.h" 8 | 9 | namespace fusion { 10 | namespace debugviewpp { 11 | 12 | Line::Line(double time, FILETIME systemTime, HANDLE handle, const std::string& message, const LogSource* pLogSource) : 13 | time(time), 14 | systemTime(systemTime), 15 | handle(handle), 16 | pid(0), 17 | message(message), 18 | pLogSource(pLogSource) 19 | { 20 | } 21 | 22 | Line::Line(double time, FILETIME systemTime, DWORD pid, const std::string& processName, const std::string& message, const LogSource* pLogSource) : 23 | time(time), 24 | systemTime(systemTime), 25 | handle(nullptr), 26 | pid(pid), 27 | processName(processName), 28 | message(message), 29 | pLogSource(pLogSource) 30 | { 31 | } 32 | 33 | } // namespace debugviewpp 34 | } // namespace fusion 35 | -------------------------------------------------------------------------------- /application/DebugViewppLib/LineBuffer.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "DebugViewppLib/LineBuffer.h" 7 | 8 | namespace fusion { 9 | namespace debugviewpp { 10 | 11 | ILineBuffer::~ILineBuffer() = default; 12 | 13 | } // namespace debugviewpp 14 | } // namespace fusion 15 | -------------------------------------------------------------------------------- /application/DebugViewppLib/LogFile.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | #include "CobaltFusion/Str.h" 8 | #include "Win32/Utilities.h" 9 | #include "DebugViewppLib/LogFile.h" 10 | 11 | namespace fusion { 12 | namespace debugviewpp { 13 | 14 | Message::Message(double time, FILETIME systemTime, DWORD pid, const std::string& processName, const std::string& msg, COLORREF color) : 15 | time(time), 16 | systemTime(systemTime), 17 | processId(pid), 18 | processName(processName), 19 | text(msg), 20 | color(color) 21 | { 22 | } 23 | 24 | bool LogFile::Empty() const 25 | { 26 | return m_messages.empty(); 27 | } 28 | 29 | void LogFile::Clear() 30 | { 31 | m_messages.clear(); 32 | m_messages.shrink_to_fit(); 33 | m_storage.Clear(); 34 | m_storage.shrink_to_fit(); 35 | m_processInfo.Clear(); 36 | } 37 | 38 | void LogFile::Add(const Message& msg) 39 | { 40 | auto props = m_processInfo.GetProcessProperties(msg.processId, WStr(msg.processName).str()); 41 | m_messages.emplace_back(InternalMessage(msg.time, msg.systemTime, props.uid)); 42 | m_storage.Add(msg.text); 43 | } 44 | 45 | int LogFile::BeginIndex() const 46 | { 47 | return 0; 48 | } 49 | 50 | int LogFile::EndIndex() const 51 | { 52 | return static_cast(m_messages.size()); 53 | } 54 | 55 | int LogFile::Count() const 56 | { 57 | return static_cast(m_messages.size()); 58 | } 59 | 60 | Message LogFile::operator[](int i) const 61 | { 62 | auto& msg = m_messages[i]; 63 | auto props = m_processInfo.GetProcessProperties(msg.uid); 64 | return Message(msg.time, msg.systemTime, props.pid, Str(props.name).str(), m_storage[i], props.color); 65 | } 66 | 67 | int LogFile::GetHistorySize() const 68 | { 69 | return m_historySize; 70 | } 71 | 72 | void LogFile::SetHistorySize(int size) 73 | { 74 | m_historySize = size; 75 | } 76 | 77 | void LogFile::Append(const LogFile& logfile, int beginIndex, int endIndex) 78 | { 79 | for (int i = beginIndex; i <= endIndex; ++i) 80 | { 81 | Add(logfile[i]); 82 | } 83 | } 84 | 85 | } // namespace debugviewpp 86 | } // namespace fusion 87 | -------------------------------------------------------------------------------- /application/DebugViewppLib/Loopback.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "DebugViewppLib/Loopback.h" 7 | 8 | namespace fusion { 9 | namespace debugviewpp { 10 | 11 | Loopback::Loopback(Timer& timer, ILineBuffer& linebuffer) : 12 | LogSource(timer, SourceType::System, linebuffer) 13 | { 14 | SetDescription(L"Loopback"); 15 | } 16 | 17 | Loopback::~Loopback() = default; 18 | 19 | bool Loopback::GetAutoNewLine() const 20 | { 21 | return true; 22 | } 23 | 24 | void Loopback::PreProcess(Line& line) const 25 | { 26 | if (line.message.empty()) 27 | { 28 | line.message = "\n"; 29 | } 30 | } 31 | 32 | } // namespace debugviewpp 33 | } // namespace fusion 34 | -------------------------------------------------------------------------------- /application/DebugViewppLib/NewlineFilter.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "CobaltFusion/stringbuilder.h" 7 | #include "DebugViewppLib/LogSource.h" 8 | #include "DebugViewppLib/ProcessInfo.h" 9 | #include "DebugViewppLib/NewlineFilter.h" 10 | #include 11 | 12 | namespace fusion { 13 | namespace debugviewpp { 14 | 15 | Lines NewlineFilter::Process(const Line& line) 16 | { 17 | auto& message = m_lineBuffers[line.pid]; 18 | message.reserve(512); 19 | 20 | Lines lines; 21 | for (auto c : line.message) 22 | { 23 | if (c == '\r') 24 | { 25 | continue; 26 | } 27 | 28 | if (c == '\n') 29 | { 30 | Line outputLine(line.time, line.systemTime, line.pid, line.processName, "", line.pLogSource); 31 | std::swap(outputLine.message, message); 32 | lines.emplace_back(std::move(outputLine)); 33 | } 34 | else 35 | { 36 | message.push_back(c); 37 | } 38 | } 39 | 40 | if (!message.empty()) 41 | { 42 | if (line.pLogSource->GetAutoNewLine() || message.size() > 8192) // 8k line limit prevents stack overflow in handling code 43 | { 44 | Line outputLine(line.time, line.systemTime, line.pid, line.processName, "", line.pLogSource); 45 | std::swap(outputLine.message, message); 46 | lines.emplace_back(std::move(outputLine)); 47 | } 48 | } 49 | return lines; 50 | } 51 | 52 | Lines NewlineFilter::FlushLinesFromTerminatedProcess(DWORD pid, HANDLE /*handle*/) // todo: why is handle unused? 53 | { 54 | Lines lines; 55 | if (m_lineBuffers.find(pid) != m_lineBuffers.end()) 56 | { 57 | if (!m_lineBuffers[pid].empty()) 58 | { 59 | // timestamp not filled, this will be done by the loopback source 60 | lines.push_back(Line(0, FILETIME(), pid, "", m_lineBuffers[pid], nullptr)); 61 | } 62 | m_lineBuffers.erase(pid); 63 | } 64 | return lines; 65 | } 66 | 67 | } // namespace debugviewpp 68 | } // namespace fusion 69 | -------------------------------------------------------------------------------- /application/DebugViewppLib/PipeReader.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "Win32/Win32Lib.h" 7 | #include "CobaltFusion/stringbuilder.h" 8 | #include "DebugViewppLib/PipeReader.h" 9 | #include "DebugViewppLib/LineBuffer.h" 10 | #include 11 | 12 | namespace fusion { 13 | namespace debugviewpp { 14 | 15 | PipeReader::PipeReader(Timer& timer, ILineBuffer& linebuffer, HANDLE hPipe, DWORD pid, const std::string& processName, long pollFrequency) : 16 | PolledLogSource(timer, SourceType::Pipe, linebuffer, pollFrequency), 17 | m_hPipe(hPipe), 18 | m_pid(pid), 19 | m_process(processName) 20 | { 21 | SetDescription(wstringbuilder() << L"Piped from " << processName); 22 | StartThread(); 23 | } 24 | 25 | PipeReader::~PipeReader() = default; 26 | 27 | bool PipeReader::AtEnd() const 28 | { 29 | return LogSource::AtEnd() || PeekNamedPipe(m_hPipe, nullptr, 0, nullptr, nullptr, nullptr) == FALSE; 30 | } 31 | 32 | void PipeReader::Poll() 33 | { 34 | Poll(*this); 35 | } 36 | 37 | void PipeReader::Poll(PolledLogSource& logsource) 38 | { 39 | std::array buf; 40 | 41 | // copy m_buffer into 'buf', set 'start' to the position one past the last element copied 42 | char* start = std::copy(m_buffer.data(), m_buffer.data() + m_buffer.size(), buf.data()); 43 | 44 | DWORD avail = 0; 45 | while ((PeekNamedPipe(m_hPipe, nullptr, 0, nullptr, &avail, nullptr) != 0) && avail > 0) 46 | { 47 | auto size = static_cast(buf.data() + sizeof(buf) - start); 48 | DWORD read = 0; 49 | ReadFile(m_hPipe, start, size, &read, nullptr); 50 | 51 | char* begin = buf.data(); 52 | char* end = start + read; 53 | char* p = start; 54 | while (p != end) 55 | { 56 | if (*p == '\0' || *p == '\n' || p - begin > 4000) 57 | { 58 | logsource.AddMessage(m_pid, m_process, std::string(begin, p)); 59 | begin = p + 1; 60 | } 61 | ++p; 62 | } 63 | start = std::copy(begin, end, buf.data()); 64 | } 65 | // keep remainer of line for next poll() 66 | m_buffer = std::string(buf.data(), start); 67 | } 68 | 69 | 70 | } // namespace debugviewpp 71 | } // namespace fusion 72 | -------------------------------------------------------------------------------- /application/DebugViewppLib/ProcessReader.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "CobaltFusion/Str.h" 7 | #include "DebugViewppLib/PolledLogSource.h" 8 | #include "DebugViewppLib/ProcessReader.h" 9 | #include "DebugViewppLib/LineBuffer.h" 10 | 11 | namespace fusion { 12 | namespace debugviewpp { 13 | 14 | ProcessReader::ProcessReader(Timer& timer, ILineBuffer& linebuffer, const std::wstring& pathName, const std::wstring& args) : 15 | PolledLogSource(timer, SourceType::Pipe, linebuffer, 40), 16 | m_process(pathName, args), 17 | m_stdout(timer, linebuffer, m_process.GetStdOut(), m_process.GetProcessId(), Str(m_process.GetName()).str() + ":stdout", 0), 18 | m_stderr(timer, linebuffer, m_process.GetStdErr(), m_process.GetProcessId(), Str(m_process.GetName()).str() + ":stderr", 0) 19 | { 20 | SetDescription(m_process.GetName() + L" stdout/stderr"); 21 | AddMessage(Win32::DuplicateHandle(m_process.GetProcessHandle()), "Started capturing output of stdout/stderr"); 22 | Signal(); 23 | StartThread(); 24 | } 25 | 26 | ProcessReader::~ProcessReader() = default; 27 | 28 | void ProcessReader::Abort() 29 | { 30 | AddMessage(m_process.GetProcessId(), Str(m_process.GetName()).str(), ""); 31 | Signal(); 32 | PolledLogSource::Abort(); 33 | } 34 | 35 | bool ProcessReader::AtEnd() const 36 | { 37 | return m_stdout.AtEnd() && m_stderr.AtEnd(); 38 | } 39 | 40 | void ProcessReader::Poll() 41 | { 42 | m_stdout.Poll(*this); 43 | m_stderr.Poll(*this); 44 | } 45 | 46 | } // namespace debugviewpp 47 | } // namespace fusion 48 | -------------------------------------------------------------------------------- /application/DebugViewppLib/SourceType.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | #include 8 | #include "DebugViewppLib/SourceType.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | SourceInfo::SourceInfo(const std::wstring& description, SourceType::type type) : 14 | enabled(false), 15 | description(description), 16 | type(type), 17 | port(0) 18 | { 19 | } 20 | 21 | SourceInfo::SourceInfo(const std::wstring& description, SourceType::type type, const std::wstring& address, int port) : 22 | enabled(false), 23 | description(description), 24 | type(type), 25 | address(address), 26 | port(port) 27 | { 28 | } 29 | 30 | int SourceTypeToInt(SourceType::type value) 31 | { 32 | #define SOURCE_TYPE(en, id, name) \ 33 | case SourceType::en: return id; 34 | switch (value) 35 | { 36 | SOURCE_TYPES() 37 | default: assert(!"Unexpected SourceType"); break; 38 | } 39 | #undef SOURCE_TYPE 40 | 41 | throw std::invalid_argument("bad SourceType!"); 42 | } 43 | 44 | SourceType::type IntToSourceType(int value) 45 | { 46 | #define SOURCE_TYPE(en, id, name) \ 47 | case id: return SourceType::en; 48 | switch (value) 49 | { 50 | SOURCE_TYPES() 51 | default: assert(!"Unexpected SourceType"); break; 52 | } 53 | #undef SOURCE_TYPE 54 | 55 | throw std::invalid_argument("bad SourceType!"); 56 | } 57 | 58 | std::string SourceTypeToString(SourceType::type value) 59 | { 60 | #define SOURCE_TYPE(en, id, name) \ 61 | case SourceType::en: return name; 62 | switch (value) 63 | { 64 | SOURCE_TYPES() 65 | default: assert(!"Unexpected SourceType"); break; 66 | } 67 | #undef SOURCE_TYPE 68 | 69 | throw std::invalid_argument("bad SourceType!"); 70 | } 71 | 72 | SourceType::type StringToSourceType(const std::string& s) 73 | { 74 | #define SOURCE_TYPE(en, id, name) \ 75 | if (s == name) \ 76 | return SourceType::en; 77 | SOURCE_TYPES() 78 | #undef SOURCE_TYPE 79 | 80 | throw std::invalid_argument("bad SourceType!"); 81 | } 82 | 83 | } // namespace debugviewpp 84 | } // namespace fusion 85 | -------------------------------------------------------------------------------- /application/DebugViewppLib/TestSource.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "DebugViewppLib/TestSource.h" 7 | 8 | namespace fusion { 9 | namespace debugviewpp { 10 | 11 | TestSource::TestSource(Timer& timer, ILineBuffer& linebuffer) : 12 | LogSource(timer, SourceType::System, linebuffer) 13 | { 14 | } 15 | 16 | bool TestSource::AtEnd() const 17 | { 18 | return false; 19 | } 20 | 21 | HANDLE TestSource::GetHandle() const 22 | { 23 | return INVALID_HANDLE_VALUE; 24 | } 25 | 26 | void TestSource::Notify() 27 | { 28 | } 29 | 30 | } // namespace debugviewpp 31 | } // namespace fusion 32 | -------------------------------------------------------------------------------- /application/DebugViewppLib/VectorLineBuffer.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "DebugViewppLib/ProcessInfo.h" 7 | #include "DebugViewppLib/VectorLineBuffer.h" 8 | 9 | namespace fusion { 10 | namespace debugviewpp { 11 | 12 | // unused argument to allow this class to be a drop-in replacement for LineBuffer 13 | VectorLineBuffer::VectorLineBuffer(size_t /*unused*/) 14 | { 15 | } 16 | 17 | void VectorLineBuffer::Add(double time, FILETIME systemTime, HANDLE handle, const std::string& message, const LogSource* pSource) 18 | { 19 | std::lock_guard lock(m_linesMutex); 20 | m_buffer.emplace_back(time, systemTime, handle, message, pSource); 21 | } 22 | 23 | void VectorLineBuffer::Add(double time, FILETIME systemTime, DWORD pid, const std::string& processName, const std::string& message, const LogSource* pSource) 24 | { 25 | std::lock_guard lock(m_linesMutex); 26 | m_buffer.emplace_back(time, systemTime, pid, processName, message, pSource); 27 | } 28 | 29 | // returning a 'const Lines&' here might be an performance improvement, however, tests reveiled no measureable difference. 30 | Lines VectorLineBuffer::GetLines() 31 | { 32 | // the swap trick used here is very important to unblock the calling process asap. 33 | m_backingBuffer.clear(); 34 | { 35 | std::lock_guard lock(m_linesMutex); 36 | m_buffer.swap(m_backingBuffer); 37 | } 38 | return m_backingBuffer; 39 | } 40 | 41 | bool VectorLineBuffer::Empty() const 42 | { 43 | return m_buffer.empty(); 44 | } 45 | 46 | } // namespace debugviewpp 47 | } // namespace fusion 48 | -------------------------------------------------------------------------------- /application/DebugViewppTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(DebugviewppTest) 2 | 3 | add_executable(${PROJECT_NAME} DebugView++Test.cpp) 4 | 5 | target_link_libraries(${PROJECT_NAME} 6 | PRIVATE 7 | project::definitions 8 | project::compile_features 9 | project::compile_options 10 | nuget::boost_test 11 | dv::library 12 | dv::indexedstorage 13 | CobaltFusion 14 | ) 15 | 16 | target_include_directories(${PROJECT_NAME} PUBLIC 17 | $ 18 | ) 19 | 20 | add_test(${PROJECT_NAME} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}" WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 21 | -------------------------------------------------------------------------------- /application/DebugViewppTest/run.bat: -------------------------------------------------------------------------------- 1 | @echo on 2 | set 3 | echo. 4 | 5 | dir %BUILD_BINARIESDIRECTORY% 6 | dir %BUILD_SOURCESDIRECTORY% 7 | echo. 8 | 9 | %BUILD_SOURCESDIRECTORY%\Release\CobaltFusionTest.exe 2>&1 10 | %BUILD_SOURCESDIRECTORY%\Release\DebugView++Test.exe 2>&1 11 | 12 | -------------------------------------------------------------------------------- /application/GDIGraphicsPOC/CMainFrame2.cpp: -------------------------------------------------------------------------------- 1 | #include "windows.h" 2 | 3 | #include "CMainFrame2.h" 4 | 5 | #include 6 | 7 | LRESULT fusion::CMainFrame2::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 8 | { 9 | DestroyWindow(); 10 | return 0; 11 | } 12 | 13 | LRESULT fusion::CMainFrame2::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 14 | { 15 | PostQuitMessage(0); 16 | return 0; 17 | } 18 | 19 | LRESULT fusion::CMainFrame2::OnSize(UINT /*nType*/, CSize Extent) 20 | { 21 | cdbg << "OnSize:: " << Extent.cx << ", " << Extent.cy << "\n"; 22 | UpdateLayout(); 23 | return 1; 24 | } 25 | 26 | LRESULT fusion::CMainFrame2::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 27 | { 28 | auto rect = RECT(); 29 | GetClientRect(&rect); 30 | rect.bottom = 540; // 40x 13 = 520, + 20 for column header 31 | 32 | m_logview.Create(*this, rect); 33 | AddDummyContent(m_logview); 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /application/GDIGraphicsPOC/CMainFrame2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "resource.h" 4 | 5 | #include // base ATL classes 6 | #include // base WTL classes 7 | extern CAppModule _Module; // WTL version of CComModule 8 | #include // ATL GUI classes 9 | #include // WTL frame window classes 10 | #include // WTL enhanced msg map macros 11 | #include 12 | 13 | // CustomTabCtrl.h prerequisites 14 | #include "atlctrls.h" 15 | #include "atlgdix.h" 16 | #include "atlcoll.h" 17 | 18 | #pragma warning(push, 3) 19 | #pragma warning(disable : 4838) 20 | 21 | #include "CustomTabCtrl.h" 22 | #include "TabbedFrame.h" 23 | 24 | #pragma warning(pop) 25 | 26 | #include "AtlWinExt.h" 27 | 28 | #include "Logview.h" 29 | #include "TabItem.h" 30 | 31 | namespace fusion { 32 | 33 | class CMainFrame2 : public WTL::CFrameWindowImpl 34 | { 35 | public: 36 | DECLARE_FRAME_WND_CLASS(_T("First WTL window"), IDR_MAINFRAME) 37 | 38 | BEGIN_MSG_MAP(CMainFrame2) 39 | MESSAGE_HANDLER(WM_CREATE, OnCreate) 40 | MESSAGE_HANDLER(WM_CLOSE, OnClose) 41 | MESSAGE_HANDLER(WM_DESTROY, OnDestroy) 42 | MSG_WM_SIZE(OnSize) 43 | CHAIN_MSG_MAP(CFrameWindowImpl) 44 | DEFAULT_REFLECTION_HANDLER() 45 | REFLECT_NOTIFICATIONS() 46 | END_MSG_MAP() 47 | 48 | LRESULT OnSize(UINT nType, CSize Extent); 49 | LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 50 | LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 51 | LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 52 | 53 | private: 54 | CLogView m_logview; 55 | }; 56 | 57 | } // namespace fusion 58 | -------------------------------------------------------------------------------- /application/GDIGraphicsPOC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GDIGraphicsPOC) 2 | 3 | add_executable(${PROJECT_NAME} 4 | resource.rc 5 | MainFrame.cpp 6 | CMainFrame2.cpp 7 | Logview.cpp 8 | ) 9 | 10 | target_link_libraries(${PROJECT_NAME} 11 | PRIVATE 12 | project::definitions 13 | project::compile_features 14 | project::compile_options 15 | project::gui_link_options 16 | nuget::boost 17 | nuget::wtl 18 | dv::cobaltfusion 19 | dv::tabbingframework 20 | dv::propertygrid 21 | dv::library 22 | dv::win32 23 | ) 24 | 25 | target_include_directories(${PROJECT_NAME} PUBLIC 26 | $ 27 | ) 28 | -------------------------------------------------------------------------------- /application/GDIGraphicsPOC/MainFrame.cpp: -------------------------------------------------------------------------------- 1 | #include "MainFrame.h" 2 | #include "CMainFrame2.h" 3 | 4 | CAppModule _Module; 5 | 6 | int WINAPI WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hInstPrev*/, LPSTR /*szCmdLine*/, int nCmdShow) 7 | { 8 | // CMainFrame is a CTabbedFrameImpl<> and does not render as intended 9 | // CMainFrame2 is a CFrameWindowImpl<> and _does_ render as intended 10 | 11 | fusion::CMainFrame2 wndMain; 12 | 13 | // Create & show our main window 14 | if (nullptr == wndMain.Create(nullptr, CWindow::rcDefault, _T("WTL Frame"), WS_OVERLAPPEDWINDOW)) 15 | { 16 | // Bad news, window creation failed 17 | return 1; 18 | } 19 | 20 | wndMain.ShowWindow(nCmdShow); 21 | wndMain.UpdateWindow(); 22 | 23 | // Run the message loop 24 | MSG msg; 25 | while (GetMessage(&msg, nullptr, 0, 0) > 0) 26 | { 27 | TranslateMessage(&msg); 28 | DispatchMessage(&msg); 29 | } 30 | return int(msg.wParam); 31 | } 32 | 33 | namespace fusion { 34 | 35 | LRESULT CMainFrame::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 36 | { 37 | DestroyWindow(); 38 | return 0; 39 | } 40 | 41 | LRESULT CMainFrame::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 42 | { 43 | PostQuitMessage(0); 44 | return 0; 45 | } 46 | 47 | LRESULT CMainFrame::OnSize(UINT /*nType*/, CSize Extent) 48 | { 49 | cdbg << "OnSize:: " << Extent.cx << ", " << Extent.cy << "\n"; 50 | UpdateLayout(); 51 | return 1; 52 | } 53 | 54 | void CMainFrame::AddTab(const std::wstring name) 55 | { 56 | auto lvi = std::make_shared(); 57 | m_tabitems.push_back(lvi); // InsertItem takes ownership of the raw pointer, so this is not correct 58 | lvi->SetText(name.c_str()); 59 | lvi->Create(*this); 60 | 61 | int newIndex = GetTabCtrl().GetItemCount(); 62 | GetTabCtrl().InsertItem(newIndex, lvi.get()); 63 | GetTabCtrl().SetCurSel(newIndex); 64 | } 65 | 66 | LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 67 | { 68 | CreateTabWindow(*this, CWindow::rcDefault, CTCS_CLOSEBUTTON | CTCS_DRAGREARRANGE); 69 | AddTab(L"Tab1"); 70 | AddTab(L"Tab2"); 71 | ShowTabControl(); 72 | return 0; 73 | } 74 | 75 | } // namespace fusion 76 | -------------------------------------------------------------------------------- /application/GDIGraphicsPOC/MainFrame.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // base ATL classes 4 | #include // base WTL classes 5 | extern CAppModule _Module; // WTL version of CComModule 6 | #include // ATL GUI classes 7 | #include // WTL frame window classes 8 | #include // WTL enhanced msg map macros 9 | #include 10 | 11 | // CustomTabCtrl.h prerequisites 12 | #include "atlctrls.h" 13 | #include "atlgdix.h" 14 | #include "atlcoll.h" 15 | 16 | #pragma warning(push, 3) 17 | #pragma warning(disable : 4838) 18 | 19 | #include "CustomTabCtrl.h" 20 | #include "TabbedFrame.h" 21 | 22 | #pragma warning(pop) 23 | 24 | #include "AtlWinExt.h" 25 | #include "Logview.h" 26 | #include "TabItem.h" 27 | 28 | namespace fusion { 29 | 30 | 31 | class CMainFrame : public CTabbedFrameImpl> 32 | { 33 | public: 34 | DECLARE_WND_CLASS(_T("CMainFrame Class")) 35 | 36 | BEGIN_MSG_MAP(CMainFrame) 37 | MESSAGE_HANDLER(WM_CREATE, OnCreate) 38 | MESSAGE_HANDLER(WM_CLOSE, OnClose) 39 | MESSAGE_HANDLER(WM_DESTROY, OnDestroy) 40 | MSG_WM_SIZE(OnSize) 41 | REFLECT_NOTIFICATIONS(); 42 | DEFAULT_REFLECTION_HANDLER() 43 | END_MSG_MAP() 44 | 45 | LRESULT OnSize(UINT nType, CSize Extent); 46 | void AddTab(const std::wstring name); 47 | LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 48 | LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 49 | LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 50 | 51 | private: 52 | std::vector> m_tabitems; 53 | }; 54 | 55 | } // namespace fusion 56 | -------------------------------------------------------------------------------- /application/GDIGraphicsPOC/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by GDIGraphicsPOC.rc 4 | // 5 | 6 | #define IDS_APP_TITLE 103 7 | 8 | #define IDR_MAINFRAME 128 9 | #define IDD_GDIGRAPHICSPOC_DIALOG 102 10 | #define IDD_ABOUTBOX 103 11 | #define IDM_ABOUT 104 12 | #define IDM_EXIT 105 13 | #define IDI_GDIGRAPHICSPOC 107 14 | #define IDI_SMALL 108 15 | #define IDC_GDIGRAPHICSPOC 109 16 | #define IDC_MYICON 2 17 | #ifndef IDC_STATIC 18 | #define IDC_STATIC -1 19 | #endif 20 | // Next default values for new objects 21 | // 22 | #ifdef APSTUDIO_INVOKED 23 | #ifndef APSTUDIO_READONLY_SYMBOLS 24 | 25 | #define _APS_NO_MFC 130 26 | #define _APS_NEXT_RESOURCE_VALUE 129 27 | #define _APS_NEXT_COMMAND_VALUE 32771 28 | #define _APS_NEXT_CONTROL_VALUE 1000 29 | #define _APS_NEXT_SYMED_VALUE 110 30 | #endif 31 | #endif 32 | -------------------------------------------------------------------------------- /application/GDIGraphicsPOC/resource.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/application/GDIGraphicsPOC/resource.rc -------------------------------------------------------------------------------- /application/IndexedStorageLib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(IndexedStorageLib) 2 | 3 | add_library(${PROJECT_NAME} IndexedStorage.cpp) 4 | add_library(dv::indexedstorage ALIAS ${PROJECT_NAME}) 5 | 6 | target_link_libraries(${PROJECT_NAME} 7 | PRIVATE 8 | project::definitions 9 | project::compile_features 10 | project::compile_options 11 | nuget::snappy 12 | dv::win32 13 | ) 14 | 15 | target_include_directories(${PROJECT_NAME} PUBLIC 16 | $ 17 | ) 18 | -------------------------------------------------------------------------------- /application/Libraries/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(docopt.cpp) 2 | add_subdirectory(PropertyGrid) 3 | add_subdirectory(TabbingFramework) 4 | -------------------------------------------------------------------------------- /application/Libraries/PropertyGrid/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(PropertyGrid) 2 | 3 | add_library(${PROJECT_NAME} INTERFACE) 4 | add_library(dv::propertygrid ALIAS ${PROJECT_NAME}) 5 | 6 | target_include_directories(${PROJECT_NAME} INTERFACE $/include) 7 | 8 | #add_executable(PropertyControlTest PropertyControlTest.cpp PropertyControlTest.rc) 9 | 10 | #target_link_libraries(PropertyControlTest 11 | # PRIVATE 12 | # project_definitions 13 | # project_compile_features 14 | # project_compile_options 15 | # nuget::wtl 16 | # dv::propertygrid 17 | # dv::tabbingframework 18 | #) 19 | -------------------------------------------------------------------------------- /application/Libraries/PropertyGrid/PropertyControlTest.cpp: -------------------------------------------------------------------------------- 1 | // PropertyControlTest.cpp : main source file for PropertyControlTest.exe 2 | // 3 | 4 | // #include "stdafx.h" 5 | 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | CAppModule _Module; 16 | 17 | #include "resource.h" 18 | #include "maindlg.h" 19 | 20 | 21 | int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/) 22 | { 23 | HRESULT hRes = ::CoInitialize(NULL); 24 | ATLASSERT(SUCCEEDED(hRes)); 25 | 26 | AtlInitCommonControls(ICC_WIN95_CLASSES | ICC_DATE_CLASSES); 27 | 28 | hRes = _Module.Init(NULL, hInstance); 29 | ATLASSERT(SUCCEEDED(hRes)); 30 | 31 | CMainDlg dlgMain; 32 | int nRet = dlgMain.DoModal(); 33 | 34 | _Module.Term(); 35 | ::CoUninitialize(); 36 | 37 | return nRet; 38 | } 39 | -------------------------------------------------------------------------------- /application/Libraries/PropertyGrid/PropertyControlTest.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26606.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PropertyControlTest", "PropertyControlTest.vcxproj", "{2908FD7B-8C58-437B-A915-BF5A1101A60C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {2908FD7B-8C58-437B-A915-BF5A1101A60C}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {2908FD7B-8C58-437B-A915-BF5A1101A60C}.Debug|Win32.Build.0 = Debug|Win32 16 | {2908FD7B-8C58-437B-A915-BF5A1101A60C}.Release|Win32.ActiveCfg = Release|Win32 17 | {2908FD7B-8C58-437B-A915-BF5A1101A60C}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /application/Libraries/PropertyGrid/include/permissive_fixes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define DECLARE_WND_SUPERCLASS_WORKAROUND(WndClassName, OrigWndClassName) \ 4 | static ATL::CWndClassInfo& GetWndClassInfo() \ 5 | { \ 6 | static ATL::CWndClassInfo wc = \ 7 | { \ 8 | {sizeof(WNDCLASSEX), 0, this->StartWindowProc, \ 9 | 0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName, NULL}, \ 10 | OrigWndClassName, NULL, NULL, TRUE, 0, _T("")}; \ 11 | return wc; \ 12 | } 13 | 14 | #define DECLARE_FRAME_WND_CLASS_EX_WORKAROUND(WndClassName, uCommonResourceID, style, bkgnd) \ 15 | static WTL::CFrameWndClassInfo& GetWndClassInfo() \ 16 | { \ 17 | static WTL::CFrameWndClassInfo wc = \ 18 | { \ 19 | {sizeof(WNDCLASSEX), style, this->StartWindowProc, \ 20 | 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName, NULL}, \ 21 | NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID}; \ 22 | return wc; \ 23 | } 24 | -------------------------------------------------------------------------------- /application/Libraries/PropertyGrid/res/PropertyControlTest.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | PropertyControlTest Application 11 | 12 | 13 | 14 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /application/Libraries/PropertyGrid/res/PropertyControlTest.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/application/Libraries/PropertyGrid/res/PropertyControlTest.ico -------------------------------------------------------------------------------- /application/Libraries/PropertyGrid/res/PropertyTree.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/application/Libraries/PropertyGrid/res/PropertyTree.bmp -------------------------------------------------------------------------------- /application/Libraries/PropertyGrid/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by PropertyControlTest.rc 4 | // 5 | #define IDD_ABOUTBOX 100 6 | #define IDR_MAINFRAME 128 7 | #define IDD_MAINDLG 129 8 | #define IDS_TRUE 129 9 | #define IDS_FALSE 130 10 | #define IDB_PROPERTYTREE 201 11 | #define IDC_LIST1 1000 12 | #define IDC_TREE1 1002 13 | #define IDC_LISTVIEW1 1003 14 | 15 | // Next default values for new objects 16 | // 17 | #ifdef APSTUDIO_INVOKED 18 | #ifndef APSTUDIO_READONLY_SYMBOLS 19 | #define _APS_NEXT_RESOURCE_VALUE 202 20 | #define _APS_NEXT_COMMAND_VALUE 32772 21 | #define _APS_NEXT_CONTROL_VALUE 1004 22 | #define _APS_NEXT_SYMED_VALUE 101 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /application/Libraries/README.txt: -------------------------------------------------------------------------------- 1 | These libraries are included in the archive: 2 | 3 | PropertyGrid is written by Bjarke Viksoe. 4 | See: http://www.viksoe.dk/code/propertygrid.htm 5 | 6 | TabbingFramework is written by Bjarke Viksoe and Daniel Bowen. 7 | See: http://www.codeproject.com/Articles/2431/Custom-Tab-Controls-Tabbed-Frame-and-Tabbed-MDI 8 | -------------------------------------------------------------------------------- /application/Libraries/TabbingFramework/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(TabbingFramework) 2 | 3 | add_library(${PROJECT_NAME} INTERFACE) 4 | add_library(dv::tabbingframework ALIAS ${PROJECT_NAME}) 5 | 6 | target_include_directories(${PROJECT_NAME} INTERFACE $) 7 | -------------------------------------------------------------------------------- /application/Libraries/TabbingFramework/license.txt: -------------------------------------------------------------------------------- 1 | // Written by Daniel Bowen (dbowen@es.com). 2 | // Copyright (c) 2001-2004 Daniel Bowen. 3 | // 4 | // This code may be used in compiled form in any way you desire. This 5 | // file may be redistributed by any means PROVIDING it is 6 | // not sold for profit without the authors written consent, and 7 | // providing that this notice and the authors name is included. 8 | // 9 | // This file is provided "as is" with no expressed or implied warranty. 10 | // The author accepts no liability if it causes any damage to you or your 11 | // computer whatsoever. It's free, so don't hassle me about it. 12 | // 13 | // Beware of bugs. -------------------------------------------------------------------------------- /application/Libraries/docopt.cpp/LICENSE-Boost-1.0: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /application/Libraries/docopt.cpp/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Vladimir Keleshev, 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the Software 6 | without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, 8 | and/or sell copies of the Software, and to permit persons to 9 | whom the Software is furnished to do so, subject to the 10 | following conditions: 11 | 12 | The above copyright notice and this permission notice shall 13 | be included in all copies or substantial portions of the 14 | Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 17 | KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 18 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 19 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 22 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /application/Libraries/docopt.cpp/docopt-config.cmake: -------------------------------------------------------------------------------- 1 | include("${CMAKE_CURRENT_LIST_DIR}/docopt-targets.cmake") 2 | -------------------------------------------------------------------------------- /application/Libraries/docopt.cpp/docopt.pc.in: -------------------------------------------------------------------------------- 1 | libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ 2 | includedir=@CMAKE_INSTALL_PREFIX@/include/docopt 3 | 4 | Name: docopt.cpp 5 | Description: C++11 port of docopt 6 | Version: @PROJECT_VERSION@ 7 | Requires: 8 | Libs: -L${libdir} -ldocopt 9 | Cflags: -I${includedir} 10 | -------------------------------------------------------------------------------- /application/Libraries/docopt.cpp/main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // main.cpp 3 | // docopt 4 | // 5 | // Created by Jared Grubb on 2013-10-03. 6 | // Copyright (c) 2013 Jared Grubb. All rights reserved. 7 | // 8 | 9 | #include "docopt.h" 10 | 11 | int main(int argc, const char * argv[]) 12 | { 13 | 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /application/Win32Lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(win32lib) 2 | 3 | add_library(${PROJECT_NAME} Com.cpp Process.cpp Registry.cpp Socket.cpp Utilities.cpp Win32Lib.cpp Window.cpp) 4 | add_library(dv::win32 ALIAS ${PROJECT_NAME}) 5 | 6 | target_link_libraries(${PROJECT_NAME} 7 | PRIVATE 8 | project::definitions 9 | project::compile_features 10 | project::compile_options 11 | ) 12 | 13 | target_include_directories(win32lib PUBLIC 14 | $ 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /application/Win32Lib/Com.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "Win32/Win32Lib.h" 7 | #include "Win32/Com.h" 8 | #include 9 | 10 | namespace fusion { 11 | namespace Win32 { 12 | 13 | ComInitialization::ComInitialization() 14 | { 15 | // OleInitialize/OleUninitialize is used instead of CoInitializeEx/CoUninitialize because it is required for use of IDropTarget's Drag and Drop functions 16 | HRESULT hr = OleInitialize(nullptr); 17 | if (FAILED(hr)) 18 | { 19 | throw Win32Error(hr, "OleInitialize"); 20 | } 21 | } 22 | 23 | ComInitialization::~ComInitialization() 24 | { 25 | OleUninitialize(); 26 | } 27 | 28 | } // namespace Win32 29 | } // namespace fusion 30 | -------------------------------------------------------------------------------- /application/Win32Lib/Utilities.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | #include 8 | #include "Win32/Win32Lib.h" 9 | 10 | namespace fusion { 11 | namespace win32 { 12 | 13 | std::wstring LoadWString(int id) 14 | { 15 | CString cs; 16 | if (cs.LoadString(id) == 0) 17 | { 18 | Win32::ThrowLastError("LoadString"); 19 | } 20 | return static_cast(cs); 21 | } 22 | 23 | } // namespace win32 24 | } // namespace fusion 25 | -------------------------------------------------------------------------------- /application/Win32Lib/Window.cpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include "windowsx.h" 7 | #include "Win32/Win32Lib.h" 8 | #include "Win32/Window.h" 9 | 10 | namespace fusion { 11 | namespace Win32 { 12 | 13 | WINDOWPLACEMENT GetWindowPlacement(HWND hwnd) 14 | { 15 | WINDOWPLACEMENT placement; 16 | placement.length = sizeof(placement); 17 | if (::GetWindowPlacement(hwnd, &placement) == 0) 18 | { 19 | ThrowLastError("GetWindowPlacement"); 20 | } 21 | return placement; 22 | } 23 | 24 | POINT GetMessagePos() 25 | { 26 | DWORD pos = ::GetMessagePos(); 27 | POINT pt = {GET_X_LPARAM(pos), GET_Y_LPARAM(pos)}; 28 | return pt; 29 | } 30 | 31 | POINT GetCursorPos() 32 | { 33 | POINT pos; 34 | if (GetCursorPos(&pos) == 0) 35 | { 36 | ThrowLastError("GetCursorPos"); 37 | } 38 | return pos; 39 | } 40 | 41 | } // namespace Win32 42 | } // namespace fusion 43 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/CircularBuffer.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include "noncopyable.h" 11 | 12 | #pragma comment(lib, "CobaltFusion.lib") 13 | 14 | namespace fusion { 15 | 16 | class CircularBuffer : fusion::noncopyable 17 | { 18 | public: 19 | explicit CircularBuffer(size_t capacity); 20 | size_t Capacity() const; 21 | 22 | bool Empty() const; 23 | bool Full() const; 24 | size_t Available() const; 25 | size_t Size() const; 26 | 27 | // Performance can be improved by doing block-operations, for example using a Duff-device 28 | char Read(); 29 | std::string ReadStringZ(); 30 | void Write(char value); 31 | void WriteStringZ(const char* message); 32 | 33 | void Clear(); 34 | void Swap(CircularBuffer& cb); 35 | void DumpStats() const; 36 | 37 | private: 38 | size_t NextPosition(size_t offset) const; 39 | const char* ReadPointer() const; 40 | char* WritePointer() const; 41 | void IncreaseReadPointer(); 42 | void IncreaseWritePointer(); 43 | 44 | size_t m_capacity; // important: m_buffer must be initialized after m_capacity 45 | std::unique_ptr m_buffer; 46 | size_t m_readOffset; 47 | size_t m_writeOffset; 48 | }; 49 | 50 | } // namespace fusion 51 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/ExecutorClient.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2015. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include "Executor.h" 11 | 12 | namespace fusion { 13 | 14 | class IExecutor 15 | { 16 | public: 17 | using Clock = std::chrono::steady_clock; 18 | virtual void Call(std::function fn) = 0; 19 | virtual void CallAsync(std::function fn) = 0; 20 | virtual ScheduledCall CallAfter(const Clock::duration& interval, std::function fn) = 0; 21 | virtual ScheduledCall CallAt(const Clock::time_point& timepoint, std::function fn) = 0; 22 | virtual bool IsExecutorThread() const = 0; 23 | virtual void Synchronize() = 0; 24 | 25 | // shall cancel all scheduled calls that are not in progress 26 | virtual void Cancel() = 0; 27 | 28 | virtual ~IExecutor() = default; 29 | }; 30 | 31 | class GuiExecutor; 32 | 33 | class GuiExecutorClient : public IExecutor 34 | { 35 | public: 36 | GuiExecutorClient(); 37 | virtual ~GuiExecutorClient() = default; 38 | void Call(std::function fn) override; 39 | void CallAsync(std::function fn) override; 40 | ScheduledCall CallAfter(const Clock::duration& interval, std::function fn) override; 41 | ScheduledCall CallAt(const Clock::time_point& timepoint, std::function fn) override; 42 | bool IsExecutorThread() const override; 43 | void Synchronize() override; 44 | void Cancel() override; 45 | 46 | private: 47 | std::unique_ptr m_executor; 48 | }; 49 | 50 | class ActiveExecutor; 51 | 52 | class ActiveExecutorClient : public IExecutor 53 | { 54 | public: 55 | ActiveExecutorClient(); 56 | virtual ~ActiveExecutorClient() = default; 57 | void Call(std::function fn) override; 58 | void CallAsync(std::function fn) override; 59 | ScheduledCall CallAfter(const Clock::duration& interval, std::function fn) override; 60 | ScheduledCall CallAt(const Clock::time_point& timepoint, std::function fn) override; 61 | bool IsExecutorThread() const override; 62 | void Synchronize() override; 63 | void Cancel() override; 64 | 65 | private: 66 | std::unique_ptr m_executor; 67 | }; 68 | 69 | } // namespace fusion 70 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/Math.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace fusion { 11 | 12 | template 13 | T FloorTo(double value) 14 | { 15 | return static_cast(std::floor(value)); 16 | } 17 | 18 | template 19 | T CeilTo(double value) 20 | { 21 | return static_cast(std::ceil(value)); 22 | } 23 | 24 | template 25 | T RoundTo(double value) 26 | { 27 | return static_cast(std::round(value)); 28 | } 29 | 30 | } // namespace fusion 31 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/Str.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include "Win32/Win32Lib.h" 11 | 12 | namespace fusion { 13 | 14 | //todo: add string_cast<> and create unittests 15 | 16 | class Str 17 | { 18 | public: 19 | explicit Str(std::wstring_view s) : 20 | m_str(Win32::WideCharToMultiByte(s)) 21 | { 22 | } 23 | 24 | // usefull to convert a stringbuilder() into an string when the function needs a char* 25 | explicit Str(std::string s) : 26 | m_str(s) 27 | { 28 | } 29 | 30 | // replace these with string_cast<> 31 | std::string str() const 32 | { 33 | return m_str; 34 | } 35 | 36 | // replace these with string_cast<> 37 | operator std::string() const 38 | { 39 | return m_str; 40 | } 41 | 42 | operator const char*() const 43 | { 44 | return m_str.c_str(); 45 | } 46 | 47 | private: 48 | std::string m_str; 49 | }; 50 | 51 | class WStr 52 | { 53 | public: 54 | // replace these with string_cast<> 55 | explicit WStr(std::string_view s) : 56 | m_str(Win32::MultiByteToWideChar(s)) 57 | { 58 | } 59 | 60 | // usefull to convert a wstringbuilder() into an wstring when the function needs a wchar_t* 61 | explicit WStr(std::wstring s) : 62 | m_str(s) 63 | { 64 | } 65 | 66 | // replace these with string_cast<> 67 | std::wstring str() const 68 | { 69 | return m_str; 70 | } 71 | 72 | // replace these with string_cast<> 73 | operator std::wstring() const 74 | { 75 | return m_str; 76 | } 77 | 78 | // nice to have a temporary WStr decay into a wchar_t* but also easy to use wrong like "const wchar_t* p = WStr(msg.text);" is very wrong. 79 | operator const wchar_t*() const 80 | { 81 | return m_str.c_str(); 82 | } 83 | 84 | private: 85 | std::wstring m_str; 86 | }; 87 | 88 | } // namespace fusion 89 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/Throttle.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include "CobaltFusion/ExecutorClient.h" 12 | 13 | namespace fusion { 14 | 15 | class Throttle 16 | { 17 | public: 18 | using Clock = std::chrono::steady_clock; 19 | using Duration = Clock::duration; 20 | 21 | Throttle(IExecutor& executor, int callsPerSecond, std::function fn); 22 | 23 | void operator()(); 24 | void PendingCall(); 25 | 26 | private: 27 | Clock::duration m_delta; 28 | Clock::time_point m_lastCallTime; 29 | Clock::time_point m_lastSchedulingTime; 30 | bool m_callPending; 31 | std::function m_fn; 32 | std::mutex m_mutex; 33 | IExecutor& m_executor; 34 | }; 35 | 36 | } // namespace fusion 37 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/Timer.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace fusion { 12 | 13 | class Timer 14 | { 15 | public: 16 | Timer(); 17 | 18 | void Reset(); 19 | double Get(); 20 | 21 | private: 22 | static long long GetTicks(); 23 | 24 | double m_timerUnit; 25 | bool m_init; 26 | long long m_offset; 27 | std::mutex m_mutex; 28 | }; 29 | 30 | } // namespace fusion 31 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/fusionassert.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | // clang-format off 11 | #define STRINGIZE(x) STRINGIZE2(x) 12 | #define STRINGIZE2(x) #x 13 | #define LINE_STRING STRINGIZE(__LINE__) 14 | #define SOURCE_LOCATION __FILE__ ## ":" ## LINE_STRING 15 | 16 | #ifdef NDEBUG 17 | #define FUSION_ASSERT(cond, msg) ((void)0) 18 | #else 19 | #define FUSION_ASSERT(cond, msg) if (!(cond)) fusion::assertmessage(#cond, msg, SOURCE_LOCATION); 20 | #endif 21 | 22 | #define FUSION_ASSERT_ALWAYS(cond, msg) if (!(cond)) fusion::assertmessage(#cond, msg, SOURCE_LOCATION); 23 | #define FUSION_REPORT_EXCEPTION(ex) fusion::exceptionmessage(ex, SOURCE_LOCATION); 24 | // clang-format on 25 | 26 | namespace fusion { 27 | 28 | void errormessage(const std::string& message, const std::string& caption); 29 | void errormessage(const std::wstring& message, const std::wstring& caption); 30 | void assertmessage(const std::string& assertion, const std::string& message, const char* location); 31 | void exceptionmessage(const char* what, const char* location); 32 | void exceptionmessage(const std::exception& ex, const char* location); 33 | 34 | } // namespace fusion 35 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/noncopyable.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | namespace fusion { 9 | 10 | class noncopyable 11 | { 12 | protected: 13 | noncopyable() = default; 14 | ~noncopyable() = default; 15 | 16 | public: 17 | noncopyable(const noncopyable&) = delete; 18 | noncopyable& operator=(const noncopyable&) = delete; 19 | }; 20 | 21 | } // namespace fusion 22 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/scope_guard.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "noncopyable.h" 9 | 10 | #include 11 | #include 12 | 13 | namespace fusion { 14 | 15 | template 16 | class scope_guard : fusion::noncopyable 17 | { 18 | public: 19 | explicit scope_guard(const F& x) : 20 | m_action(x), 21 | m_released(false) 22 | { 23 | } 24 | 25 | scope_guard(scope_guard&& rhs) : 26 | m_action(std::move(rhs.m_action)), 27 | m_released(rhs.m_released) 28 | { 29 | rhs.m_released = true; 30 | } 31 | 32 | void release() 33 | { 34 | m_released = true; 35 | } 36 | 37 | ~scope_guard() 38 | { 39 | if (m_released) 40 | return; 41 | 42 | // Catch any exceptions and continue during guard clean up 43 | try 44 | { 45 | m_action(); 46 | } 47 | catch (...) 48 | { 49 | assert(false && "exception in guard clean up"); 50 | } 51 | } 52 | 53 | private: 54 | F m_action; 55 | bool m_released; 56 | }; 57 | 58 | template 59 | scope_guard make_guard(F f) 60 | { 61 | return scope_guard(f); 62 | } 63 | 64 | } // namespace fusion 65 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/stringbuilder.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include "CobaltFusion/Str.h" 11 | 12 | namespace fusion { 13 | 14 | class stringbuilder 15 | { 16 | public: 17 | template 18 | stringbuilder& operator<<(const T& t) 19 | { 20 | m_ss << t; 21 | return *this; 22 | } 23 | 24 | stringbuilder& operator<<(std::wstring_view str) 25 | { 26 | m_ss << Str(str); // replace with string_cast<> 27 | return *this; 28 | } 29 | 30 | stringbuilder& operator<<(const std::wstring& str) 31 | { 32 | m_ss << Str(str); // replace with string_cast<> 33 | return *this; 34 | } 35 | 36 | operator std::string() const 37 | { 38 | return m_ss.str(); 39 | } 40 | 41 | private: 42 | std::stringstream m_ss; 43 | }; 44 | 45 | class wstringbuilder 46 | { 47 | public: 48 | template 49 | wstringbuilder& operator<<(const T& t) 50 | { 51 | m_ss << t; 52 | return *this; 53 | } 54 | 55 | wstringbuilder& operator<<(const std::string& str) 56 | { 57 | m_ss << WStr(str); 58 | return *this; 59 | } 60 | 61 | operator std::wstring() const 62 | { 63 | return m_ss.str(); 64 | } 65 | 66 | private: 67 | std::wstringstream m_ss; 68 | }; 69 | 70 | 71 | } // namespace fusion 72 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/stringformat.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Jan Wilmans 2022. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | #include 8 | 9 | namespace fusion { 10 | 11 | [[nodiscard]] std::vector split(std::string_view value, char separator); 12 | [[nodiscard]] std::string join(const std::vector& values, const std::string& separator); 13 | 14 | static constexpr const char whitespace[] = "\t\n\v\f\r "; 15 | // remove characters from beginning or end of a string, or both 16 | [[nodiscard]] std::string ltrim(std::string str, const std::string& chars = whitespace); 17 | [[nodiscard]] std::string rtrim(std::string str, const std::string& chars = whitespace); 18 | [[nodiscard]] std::string strip(std::string str, const std::string& chars = whitespace); 19 | 20 | } // namespace fusion 21 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/thread.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2016. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace fusion { 12 | 13 | class thread : private std::thread 14 | { 15 | public: 16 | explicit thread(std::function fn) : 17 | std::thread(fn) 18 | { 19 | } 20 | 21 | ~thread() 22 | { 23 | assert(!joinable() && "Always join the thread before releasing it"); 24 | } 25 | 26 | void join() 27 | { 28 | if (joinable()) 29 | std::thread::join(); 30 | } 31 | 32 | void detach() 33 | { 34 | assert(!joinable() && "Cannot detach an unjoinable thread"); 35 | std::thread::detach(); 36 | } 37 | 38 | id get_id() const 39 | { 40 | return std::thread::get_id(); 41 | } 42 | }; 43 | 44 | } // namespace fusion 45 | -------------------------------------------------------------------------------- /application/include/CobaltFusion/tohex.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace fusion { 13 | 14 | // takes an address and a size and return the hexadecimal values of the bytes as "[xx xx ...]" 15 | template 16 | auto to_hex(const T* value, size_t size_in_bytes) 17 | { 18 | std::ostringstream ss; 19 | 20 | auto to_hex = [&ss](std::byte value) -> std::ostringstream& { 21 | ss << std::setw(2) << std::setfill('0') << std::hex << static_cast(value); 22 | return ss; 23 | }; 24 | 25 | ss << "["; 26 | const std::byte* data = reinterpret_cast(value); 27 | size_t lastIndex = size_in_bytes - 1; 28 | for (size_t i = 0; i < lastIndex; ++i) 29 | { 30 | to_hex(data[i]) << " "; 31 | } 32 | to_hex(data[lastIndex]) << "]"; 33 | return ss.str(); 34 | }; 35 | 36 | template 37 | auto to_hex(const T& container) 38 | { 39 | return to_hex(container.data(), container.size() * sizeof(container[0])); 40 | } 41 | } // namespace fusion 42 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/AnyFileReader.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "DebugviewppLib/Conversions.h" 9 | #include "DebugviewppLib/FileReader.h" 10 | #include 11 | 12 | namespace fusion { 13 | namespace debugviewpp { 14 | 15 | class ILineBuffer; 16 | 17 | class AnyFileReader : public FileReader 18 | { 19 | public: 20 | AnyFileReader(Timer& timer, ILineBuffer& lineBuffer, FileType::type fileType, const std::wstring& filename, bool keeptailing); 21 | 22 | void AddLine(const std::string& line) override; 23 | void PreProcess(Line& line) const override; 24 | 25 | private: 26 | void GetRelativeTime(Line& line); 27 | long m_linenumber; 28 | FILETIME m_firstFiletime; 29 | USTimeConverter m_converter; 30 | std::wstring m_filenameOnly; 31 | }; 32 | 33 | } // namespace debugviewpp 34 | } // namespace fusion 35 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/BinaryFileReader.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "DebugviewppLib/Conversions.h" 10 | #include "DebugviewppLib/LogSource.h" 11 | #include 12 | 13 | namespace fusion { 14 | namespace debugviewpp { 15 | 16 | class ILineBuffer; 17 | 18 | class BinaryFileReader : public LogSource 19 | { 20 | public: 21 | BinaryFileReader(Timer& timer, ILineBuffer& linebuffer, FileType::type filetype, const std::wstring& filename); 22 | ~BinaryFileReader() override; 23 | 24 | void Initialize() override; 25 | HANDLE GetHandle() const override; 26 | void Notify() override; 27 | void PreProcess(Line& line) const override; 28 | void AddLine(const std::string& line); 29 | 30 | using UpdateSignal = boost::signals2::signal; 31 | boost::signals2::connection SubscribeToUpdate(UpdateSignal::slot_type slot); 32 | 33 | protected: 34 | std::wstring m_filename; 35 | std::string m_name; 36 | FileType::type m_fileType; 37 | 38 | private: 39 | void ReadUntilEof(); 40 | 41 | Win32::ChangeNotificationHandle m_handle; 42 | std::wifstream m_wifstream; 43 | std::wstring m_filenameOnly; 44 | bool m_initialized; 45 | UpdateSignal m_update; 46 | }; 47 | 48 | } // namespace debugviewpp 49 | } // namespace fusion 50 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/Colors.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "windows.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | namespace Colors { 14 | 15 | extern const COLORREF Auto; 16 | extern const COLORREF BackGround; 17 | extern const COLORREF Text; 18 | extern const COLORREF Highlight; 19 | extern const COLORREF Selection; 20 | extern const COLORREF ItemHighlight; 21 | extern const COLORREF ItemHighlightText; 22 | 23 | } // namespace Colors 24 | 25 | COLORREF GetRandomBackColor(); 26 | COLORREF GetRandomTextColor(); 27 | COLORREF GetRandomProcessColor(); 28 | 29 | } // namespace debugviewpp 30 | } // namespace fusion 31 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/Conversions.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include "Win32/Win32Lib.h" 11 | 12 | namespace fusion { 13 | namespace debugviewpp { 14 | 15 | std::string GetTimeText(double time); 16 | std::string GetDateText(const SYSTEMTIME& st); 17 | std::string GetDateText(const FILETIME& ft); 18 | std::string GetDateTimeText(const FILETIME& filetime); 19 | std::string GetTimeText(const SYSTEMTIME& st); 20 | std::string GetTimeText(const FILETIME& ft); 21 | 22 | template 23 | std::basic_string TabsToSpaces(const std::basic_string& s, int tabsize = 4) 24 | { 25 | std::basic_string result; 26 | result.reserve(s.size() + static_cast(3) * tabsize); 27 | for (auto c : s) 28 | { 29 | if (c == CharT('\t')) 30 | result.append(tabsize - result.size() % tabsize, CharT(' ')); 31 | else 32 | result.push_back(c); 33 | } 34 | return result; 35 | } 36 | 37 | template 38 | int SkipTabOffset(const std::basic_string& s, int offset, int tabsize = 4) 39 | { 40 | int pos = 0; 41 | for (auto it = s.begin(); it != s.end() && pos < offset; ++it) 42 | { 43 | if (*it == CharT('\t')) 44 | pos += tabsize - pos % tabsize; 45 | else 46 | ++pos; 47 | } 48 | return pos; 49 | } 50 | 51 | template 52 | int ExpandedTabOffset(const std::basic_string_view& s, int offset, int tabsize = 4) 53 | { 54 | int i = 0; 55 | int pos = 0; 56 | for (auto it = s.begin(); it != s.end() && i < offset; ++it, ++i) 57 | { 58 | if (*it == CharT('\t')) 59 | pos += tabsize - pos % tabsize; 60 | else 61 | ++pos; 62 | } 63 | return pos; 64 | } 65 | 66 | class USTimeConverter 67 | { 68 | public: 69 | USTimeConverter(); 70 | 71 | bool ReadLocalTimeUSRegion(const std::string& text, FILETIME& ft); 72 | bool ReadLocalTimeUSRegionMs(const std::string& text, FILETIME& ft); 73 | 74 | private: 75 | FILETIME USTimeToFiletime(WORD h, WORD m, WORD s, WORD ms); 76 | FILETIME m_lastFileTime; 77 | bool m_firstValue; 78 | }; 79 | 80 | } // namespace debugviewpp 81 | } // namespace fusion 82 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/DBWinBuffer.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "windows.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | struct DbWinBuffer 14 | { 15 | DWORD processId; 16 | // Total size must be 4KB (processID + data) 17 | char data[4096 - sizeof(DWORD)]; 18 | }; 19 | 20 | static_assert(sizeof(DbWinBuffer) == 4096, "DBWIN_BUFFER size must be 4096"); 21 | 22 | bool IsWindowsVistaOrGreater(); 23 | bool IsDBWinViewerActive(); 24 | bool HasGlobalDBWinReaderRights(); 25 | 26 | } // namespace debugviewpp 27 | } // namespace fusion 28 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/DBWinReader.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "Win32/Win32Lib.h" 9 | #include "LogSource.h" 10 | 11 | namespace fusion { 12 | namespace debugviewpp { 13 | 14 | class ILineBuffer; 15 | 16 | struct DBWinMessage 17 | { 18 | double time; 19 | FILETIME systemTime; 20 | DWORD pid; 21 | std::string message; 22 | HANDLE handle; 23 | }; 24 | 25 | struct DbWinBuffer; 26 | 27 | class DBWinReader : public LogSource 28 | { 29 | public: 30 | DBWinReader(Timer& timer, ILineBuffer& lineBuffer, bool global); 31 | 32 | HANDLE GetHandle() const override; 33 | void Notify() override; 34 | 35 | private: 36 | Win32::Handle m_hBuffer; 37 | Win32::Handle m_dbWinBufferReady; 38 | Win32::Handle m_dbWinDataReady; 39 | Win32::MappedViewOfFile m_mappedViewOfFile; 40 | const DbWinBuffer* m_dbWinBuffer; 41 | }; 42 | 43 | } // namespace debugviewpp 44 | } // namespace fusion 45 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/DBWinWriter.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "Win32/Win32Lib.h" 10 | 11 | namespace fusion { 12 | namespace debugviewpp { 13 | 14 | class DBWinWriter 15 | { 16 | public: 17 | DBWinWriter(); 18 | 19 | void Write(DWORD pid, const std::string& message); 20 | 21 | private: 22 | Win32::Handle m_hBuffer; 23 | Win32::Handle m_dbWinBufferReady; 24 | Win32::Handle m_dbWinDataReady; 25 | Win32::MappedViewOfFile m_dbWinView; 26 | }; 27 | 28 | } // namespace debugviewpp 29 | } // namespace fusion 30 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/DbgviewReader.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "PolledLogSource.h" 10 | 11 | namespace fusion { 12 | namespace debugviewpp { 13 | 14 | class ILineBuffer; 15 | 16 | template 17 | T Read(S& is) 18 | { 19 | T t = T(); 20 | is.read(reinterpret_cast(&t), sizeof(t)); 21 | return t; 22 | } 23 | 24 | template 25 | void Write(S& is, T t) 26 | { 27 | is.write(reinterpret_cast(&t), sizeof(t)); 28 | } 29 | 30 | class DbgviewReader : public PolledLogSource 31 | { 32 | public: 33 | DbgviewReader(Timer& timer, ILineBuffer& linebuffer, const std::string& hostname); 34 | 35 | void SetAutoNewLine(bool value) override; 36 | void Abort() override; 37 | 38 | private: 39 | void Loop(); 40 | std::string m_hostname; 41 | boost::asio::ip::tcp::iostream m_iostream; 42 | 43 | std::thread m_thread; 44 | }; 45 | 46 | } // namespace debugviewpp 47 | } // namespace fusion 48 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/FileReader.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "FileIO.h" 10 | #include "Win32/Win32Lib.h" 11 | #include "DebugviewppLib/LogSource.h" 12 | #include 13 | 14 | namespace fusion { 15 | namespace debugviewpp { 16 | 17 | class ILineBuffer; 18 | 19 | class FileReader : public LogSource 20 | { 21 | public: 22 | FileReader(Timer& timer, ILineBuffer& linebuffer, FileType::type filetype, const std::wstring& filename, bool keeptailing); 23 | ~FileReader() override; 24 | 25 | void Initialize() override; 26 | using UpdateSignal = boost::signals2::signal; 27 | boost::signals2::connection SubscribeToUpdate(UpdateSignal::slot_type slot); 28 | 29 | void Abort() override; 30 | HANDLE GetHandle() const override; 31 | void Notify() override; 32 | void PreProcess(Line& line) const override; 33 | 34 | protected: 35 | virtual void AddLine(const std::string& line); 36 | std::string m_filename; 37 | std::string m_name; 38 | FileType::type m_fileType; 39 | 40 | private: 41 | void SafeAddLine(const std::string& line); 42 | void ReadUntilEof(); 43 | void PollThread(); 44 | 45 | Win32::ChangeNotificationHandle m_handle; 46 | std::ifstream m_ifstream; 47 | std::string m_filenameOnly; 48 | bool m_initialized; 49 | std::string m_line; 50 | bool m_keeptailing; 51 | UpdateSignal m_update; 52 | std::thread m_thread; 53 | }; 54 | 55 | } // namespace debugviewpp 56 | } // namespace fusion 57 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/FileWriter.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace fusion { 13 | namespace debugviewpp { 14 | 15 | std::ostream& operator<<(std::ostream& os, const FILETIME& ft); 16 | 17 | class LogFile; 18 | 19 | class FileWriter 20 | { 21 | public: 22 | FileWriter(const std::wstring& filename, LogFile& logfile); 23 | 24 | private: 25 | void Run(); 26 | 27 | std::ofstream m_ofstream; 28 | LogFile& m_logfile; 29 | std::thread m_thread; 30 | }; 31 | 32 | } // namespace debugviewpp 33 | } // namespace fusion 34 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/Filter.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "MatchType.h" 9 | #include "FilterType.h" 10 | 11 | #include "atlbase.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #pragma comment(lib, "DebugView++Lib.lib") 19 | 20 | namespace fusion { 21 | namespace debugviewpp { 22 | 23 | using MatchColors = std::unordered_map; 24 | 25 | struct Filter 26 | { 27 | Filter(); 28 | Filter(const std::string& text, MatchType::type matchType, FilterType::type filterType, COLORREF bgColor = RGB(255, 255, 255), COLORREF fgColor = RGB(0, 0, 0), bool enable = true, bool matched = false); 29 | 30 | std::string text; 31 | std::regex re; 32 | MatchType::type matchType; 33 | FilterType::type filterType; 34 | COLORREF bgColor; 35 | COLORREF fgColor; 36 | bool enable; 37 | bool matched; 38 | }; 39 | 40 | struct LogFilter 41 | { 42 | std::vector messageFilters; 43 | std::vector processFilters; 44 | }; 45 | 46 | void SaveFilterSettings(const std::vector& filters, CRegKey& reg); 47 | void LoadFilterSettings(std::vector& filters, CRegKey& reg); 48 | 49 | bool IsIncluded(std::vector& filters, const std::string& text, MatchColors& matchColors); 50 | bool MatchFilterType(const std::vector& filters, FilterType::type type, const std::string& text); 51 | 52 | std::string MatchKey(const std::smatch& match, MatchType::type matchType); 53 | 54 | // Temporary backward compatibilty for loading FilterType::MatchColor: 55 | Filter MakeFilter(const std::string& text, MatchType::type matchType, FilterType::type filterType, COLORREF bgColor = RGB(255, 255, 255), COLORREF fgColor = RGB(0, 0, 0), bool enable = true, bool matched = false); 56 | 57 | } // namespace debugviewpp 58 | } // namespace fusion 59 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/FilterType.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | // Do not change existing values, these number are stored in files to represent the FilterType enum 14 | // Extend with new FilterType values at the end. 15 | // See FilterTypeToInt() and IntToFilterType() for conversion to/from FilterType enum 16 | #define FILTER_TYPES() \ 17 | FILTER_TYPE(Include, 0) \ 18 | FILTER_TYPE(Exclude, 1) \ 19 | FILTER_TYPE(Highlight, 2) \ 20 | FILTER_TYPE(Token, 3) \ 21 | FILTER_TYPE(Stop, 4) \ 22 | FILTER_TYPE(Track, 5) \ 23 | FILTER_TYPE(Once, 6) \ 24 | FILTER_TYPE(Clear, 7) \ 25 | FILTER_TYPE(Beep, 8) \ 26 | FILTER_TYPE(MatchColor, 9) \ 27 | FILTER_TYPE(Bookmark, 10) 28 | 29 | struct FilterType 30 | { 31 | #define FILTER_TYPE(f, id) f, 32 | enum type 33 | { 34 | FILTER_TYPES() 35 | }; 36 | #undef FILTER_TYPE 37 | }; 38 | 39 | int FilterTypeToInt(FilterType::type value); 40 | 41 | FilterType::type IntToFilterType(int value); 42 | 43 | std::string FilterTypeToString(FilterType::type value); 44 | 45 | const wchar_t* EnumToWCharPtr(FilterType::type value); 46 | 47 | FilterType::type StringToFilterType(const std::string& s); 48 | 49 | } // namespace debugviewpp 50 | } // namespace fusion 51 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/Line.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | #include "windows.h" 12 | 13 | namespace fusion { 14 | namespace debugviewpp { 15 | 16 | class LogSource; 17 | 18 | struct Line 19 | { 20 | Line(double time, FILETIME systemTime, HANDLE handle, const std::string& message, const LogSource* pLogSource); 21 | explicit Line(double time = 0.0, FILETIME systemTime = FILETIME(), DWORD pid = 0, const std::string& processName = std::string(), const std::string& message = std::string(), const LogSource* pLogSource = nullptr); 22 | 23 | Line(const Line&) = default; 24 | Line& operator=(const Line&) = delete; 25 | 26 | Line(Line&&) = default; 27 | Line& operator=(Line&&) = default; 28 | 29 | double time; 30 | FILETIME systemTime; 31 | HANDLE handle; 32 | DWORD pid; 33 | std::string processName; 34 | std::string message; 35 | const LogSource* pLogSource; 36 | }; 37 | 38 | using Lines = std::vector; 39 | 40 | } // namespace debugviewpp 41 | } // namespace fusion 42 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/LineBuffer.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "LogSource.h" 10 | 11 | namespace fusion { 12 | namespace debugviewpp { 13 | 14 | class LogSource; 15 | 16 | class ILineBuffer 17 | { 18 | public: 19 | virtual ~ILineBuffer() = 0; 20 | 21 | virtual void Add(double time, FILETIME systemTime, HANDLE handle, const std::string& message, const LogSource* pLogSource) = 0; 22 | virtual void Add(double time, FILETIME systemTime, DWORD pid, const std::string& processName, const std::string& message, const LogSource* pLogSource) = 0; 23 | virtual Lines GetLines() = 0; 24 | virtual bool Empty() const = 0; 25 | }; 26 | 27 | } // namespace debugviewpp 28 | } // namespace fusion 29 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/LogFile.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include "DebugviewppLib/Colors.h" 11 | #include "DebugviewppLib/ProcessInfo.h" 12 | #include "IndexedStorageLib/IndexedStorage.h" 13 | 14 | namespace fusion { 15 | namespace debugviewpp { 16 | 17 | struct Message 18 | { 19 | Message(double time, FILETIME systemTime, DWORD pid, const std::string& processName, const std::string& msg, COLORREF color = Colors::BackGround); 20 | 21 | double time; 22 | FILETIME systemTime; 23 | DWORD processId; 24 | std::string processName; 25 | std::string text; 26 | COLORREF color; 27 | }; 28 | 29 | class LogFile 30 | { 31 | public: 32 | bool Empty() const; 33 | void Clear(); 34 | void Add(const Message& msg); 35 | void Append(const LogFile& logfile, int beginIndex, int endIndex); 36 | int BeginIndex() const; 37 | int EndIndex() const; 38 | int Count() const; 39 | Message operator[](int i) const; 40 | int GetHistorySize() const; 41 | void SetHistorySize(int size); 42 | 43 | private: 44 | struct InternalMessage 45 | { 46 | InternalMessage(double time, FILETIME systemTime, DWORD uid) : 47 | time(time), 48 | systemTime(systemTime), 49 | uid(uid) 50 | { 51 | } 52 | 53 | double time; 54 | FILETIME systemTime; 55 | DWORD uid; 56 | }; 57 | 58 | std::vector m_messages; 59 | ProcessInfo m_processInfo; 60 | mutable indexedstorage::SnappyStorage m_storage; 61 | // indexedstorage::VectorStorage m_storage; 62 | int m_historySize = 0; 63 | }; 64 | 65 | } // namespace debugviewpp 66 | } // namespace fusion 67 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/LogFilter.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "Filter.h" 10 | 11 | namespace fusion { 12 | namespace debugviewpp { 13 | 14 | struct FilterData 15 | { 16 | std::string name; 17 | LogFilter filter; 18 | }; 19 | 20 | boost::property_tree::ptree MakePTree(const std::vector& filters); 21 | std::vector MakeFilters(const boost::property_tree::ptree& pt); 22 | 23 | void SaveXml(const std::string& fileName, const std::string& name, const LogFilter& filter); 24 | void SaveJson(const std::string& fileName, const std::string& name, const LogFilter& filter); 25 | FilterData LoadXml(const std::string& fileName); 26 | FilterData LoadJson(const std::string& fileName); 27 | 28 | } // namespace debugviewpp 29 | } // namespace fusion 30 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/Loopback.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "DebugviewppLib/LogSource.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | class ILineBuffer; 14 | 15 | class Loopback : public LogSource 16 | { 17 | public: 18 | Loopback(Timer& timer, ILineBuffer& lineBuffer); 19 | virtual ~Loopback(); 20 | 21 | HANDLE GetHandle() const override { throw std::exception("should never be called"); } 22 | void Notify() override {} 23 | 24 | bool GetAutoNewLine() const override; 25 | void PreProcess(Line& line) const override; 26 | }; 27 | 28 | } // namespace debugviewpp 29 | } // namespace fusion 30 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/MatchType.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | // Do not change existing values, these number are stored in files to represent the MatchType enum 14 | // Extend with new MatchType values at the end. 15 | // See MatchTypeToInt() and IntToMatchType() for conversion to/from MatchType enum 16 | #define MATCH_TYPES() \ 17 | MATCH_TYPE(Simple, 0) \ 18 | MATCH_TYPE(Wildcard, 1) \ 19 | MATCH_TYPE(Regex, 2) \ 20 | MATCH_TYPE(RegexGroups, 3) \ 21 | MATCH_TYPE(RegexCase, 4) 22 | 23 | struct MatchType 24 | { 25 | #define MATCH_TYPE(m, id) m, 26 | enum type 27 | { 28 | MATCH_TYPES() 29 | }; 30 | #undef MATCH_TYPE 31 | }; 32 | 33 | std::string MakePattern(MatchType::type type, const std::string& text); 34 | 35 | int MatchTypeToInt(MatchType::type value); 36 | 37 | MatchType::type IntToMatchType(int value); 38 | 39 | std::string MatchTypeToString(MatchType::type value); 40 | 41 | const wchar_t* EnumToWCharPtr(MatchType::type value); 42 | 43 | MatchType::type StringToMatchType(const std::string& s); 44 | 45 | } // namespace debugviewpp 46 | } // namespace fusion 47 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/NewlineFilter.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace fusion { 12 | namespace debugviewpp { 13 | 14 | struct Line; 15 | 16 | class NewlineFilter 17 | { 18 | public: 19 | Lines Process(const Line& line); 20 | Lines FlushLinesFromTerminatedProcess(DWORD pid, HANDLE handle); 21 | 22 | private: 23 | std::unordered_map m_lineBuffers; 24 | }; 25 | 26 | } // namespace debugviewpp 27 | } // namespace fusion 28 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/PipeReader.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "PolledLogSource.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | class ILineBuffer; 14 | 15 | class PipeReader : public PolledLogSource 16 | { 17 | public: 18 | PipeReader(Timer& timer, ILineBuffer& lineBuffer, HANDLE hPipe, DWORD pid, const std::string& processName, long pollFrequency); 19 | virtual ~PipeReader(); 20 | 21 | bool AtEnd() const override; 22 | void Poll() override; 23 | void Poll(PolledLogSource& logSource); 24 | 25 | private: 26 | HANDLE m_hPipe; 27 | DWORD m_pid; 28 | std::string m_process; 29 | std::string m_buffer; 30 | }; 31 | 32 | } // namespace debugviewpp 33 | } // namespace fusion 34 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/PolledLogSource.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "Win32/Win32Lib.h" 10 | #include "LogSource.h" 11 | 12 | namespace fusion { 13 | namespace debugviewpp { 14 | 15 | class ILineBuffer; 16 | 17 | struct PollLine 18 | { 19 | PollLine(Win32::Handle handle, const std::string& message, const LogSource* pLogSource); 20 | PollLine(DWORD pid, const std::string& processName, const std::string& message, const LogSource* pLogSource); 21 | PollLine(double time, FILETIME systemTime, DWORD pid, const std::string& processName, const std::string& message, const LogSource* pLogSource); 22 | 23 | bool timesValid; 24 | double time; 25 | FILETIME systemTime; 26 | Win32::Handle handle; 27 | DWORD pid; 28 | std::string processName; 29 | std::string message; 30 | const LogSource* pLogSource; 31 | }; 32 | 33 | class PolledLogSource : public LogSource 34 | { 35 | public: 36 | PolledLogSource(Timer& timer, SourceType::type sourceType, ILineBuffer& lineBuffer, long pollFrequency); 37 | ~PolledLogSource() override; 38 | 39 | HANDLE GetHandle() const override; 40 | void Notify() override; 41 | virtual void Poll(); 42 | void Abort() override; 43 | 44 | // in contrast to the LogSource::Add methdods, these methods are de-coupled using m_backBuffer so they 45 | // can be used to add messages from any thread. The typical use-case are messages from the UI thread. 46 | void AddMessage(Win32::Handle handle, const std::string& message); 47 | void AddMessage(DWORD pid, const std::string& processName, const std::string& message); 48 | void AddMessage(const std::string& message); 49 | void AddMessage(double time, FILETIME systemTime, DWORD pid, const std::string& processName, const std::string& message); 50 | 51 | void Signal(); 52 | void StartThread(); 53 | 54 | long GetMicrosecondInterval() const; 55 | 56 | private: 57 | void Loop(); 58 | 59 | std::vector m_lines; 60 | std::vector m_backBuffer; 61 | std::chrono::microseconds m_microsecondInterval; 62 | Win32::Handle m_handle; 63 | std::mutex m_mutex; 64 | std::unique_ptr m_thread; 65 | }; 66 | 67 | } // namespace debugviewpp 68 | } // namespace fusion 69 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/ProcessInfo.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | #include "windows.h" 12 | 13 | #pragma comment(lib, "DebugView++Lib.lib") 14 | 15 | namespace fusion { 16 | namespace debugviewpp { 17 | 18 | struct InternalProcessProperties 19 | { 20 | InternalProcessProperties(); 21 | InternalProcessProperties(DWORD pid, const std::wstring& name, COLORREF color); 22 | 23 | DWORD pid; // system processId 24 | std::wstring name; 25 | COLORREF color; 26 | }; 27 | 28 | struct ProcessProperties 29 | { 30 | explicit ProcessProperties(const InternalProcessProperties& iprops); 31 | 32 | DWORD uid; // unique id 33 | DWORD pid; // system processId 34 | std::wstring name; 35 | COLORREF color; 36 | }; 37 | 38 | class ProcessInfo 39 | { 40 | public: 41 | ProcessInfo(); 42 | void Clear(); 43 | static size_t GetPrivateBytes(); 44 | static std::wstring GetProcessName(HANDLE handle); 45 | static std::wstring GetStartTime(HANDLE handle); 46 | static std::wstring GetProcessNameByPid(DWORD processId); 47 | 48 | DWORD GetUid(DWORD processId, const std::wstring& processName); 49 | ProcessProperties GetProcessProperties(DWORD processId, const std::wstring& processName); 50 | ProcessProperties GetProcessProperties(DWORD uid) const; 51 | 52 | private: 53 | std::unordered_map m_processProperties; 54 | DWORD m_unqiueId; 55 | }; 56 | 57 | } // namespace debugviewpp 58 | } // namespace fusion 59 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/ProcessMonitor.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include "Win32/Win32Lib.h" 12 | #include "CobaltFusion/SynchronizedQueue.h" 13 | 14 | namespace fusion { 15 | namespace debugviewpp { 16 | 17 | using PidMap = std::unordered_map; 18 | 19 | class ProcessMonitor 20 | { 21 | public: 22 | using ProcessEnded = boost::signals2::signal; 23 | 24 | ProcessMonitor(); 25 | ~ProcessMonitor(); 26 | 27 | void Add(DWORD pid, HANDLE handle); 28 | boost::signals2::connection ConnectProcessEnded(ProcessEnded::slot_type slot); 29 | void Abort(); 30 | 31 | private: 32 | struct ProcessInfo 33 | { 34 | explicit ProcessInfo(DWORD pid = 0, HANDLE handle = nullptr); 35 | 36 | DWORD pid; 37 | HANDLE handle; 38 | }; 39 | 40 | void Run(); 41 | 42 | bool m_end; 43 | Win32::Handle m_event; 44 | ProcessEnded m_processEnded; 45 | std::vector m_processes; 46 | SynchronizedQueue> m_q; 47 | std::thread m_thread; 48 | }; 49 | 50 | } // namespace debugviewpp 51 | } // namespace fusion 52 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/ProcessReader.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "PipeReader.h" 9 | #include "PolledLogSource.h" 10 | #include "Win32/Process.h" 11 | 12 | namespace fusion { 13 | namespace debugviewpp { 14 | 15 | class ILineBuffer; 16 | 17 | class ProcessReader : public PolledLogSource 18 | { 19 | public: 20 | ProcessReader(Timer& timer, ILineBuffer& linebuffer, const std::wstring& pathName, const std::wstring& args); 21 | ~ProcessReader() override; 22 | void Abort() override; 23 | bool AtEnd() const override; 24 | 25 | private: 26 | void Poll() override; 27 | 28 | Win32::Process m_process; 29 | PipeReader m_stdout; 30 | PipeReader m_stderr; 31 | }; 32 | 33 | } // namespace debugviewpp 34 | } // namespace fusion 35 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/SocketReader.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "Win32/Win32Lib.h" 10 | #include "Win32/Socket.h" 11 | #include "LogSource.h" 12 | 13 | namespace fusion { 14 | namespace debugviewpp { 15 | 16 | class ILineBuffer; 17 | 18 | class SocketReader : public LogSource 19 | { 20 | public: 21 | SocketReader(Timer& timer, ILineBuffer& lineBuffer, int port); 22 | 23 | [[nodiscard]] HANDLE GetHandle() const override; 24 | void Notify() override; 25 | 26 | private: 27 | int BeginReceive(); 28 | int CompleteReceive(); 29 | [[nodiscard]] std::string GetProcessText() const; 30 | 31 | Win32::WinsockInitialization m_wsa; 32 | Win32::Socket m_socket; 33 | Win32::Handle m_event; 34 | std::array m_buffer; 35 | WSAOVERLAPPED m_overlapped = WSAOVERLAPPED(); 36 | WSABUF m_wsaBuf[1]{}; 37 | sockaddr_in m_from = sockaddr_in(); 38 | int m_fromLen; 39 | bool m_busy; 40 | }; 41 | 42 | } // namespace debugviewpp 43 | } // namespace fusion 44 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/SourceType.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | class LogSource; 14 | 15 | #define SOURCE_TYPES() \ 16 | SOURCE_TYPE(System, 0, "System") \ 17 | SOURCE_TYPE(Pipe, 1, "Pipe") \ 18 | SOURCE_TYPE(File, 2, "File") \ 19 | SOURCE_TYPE(Udp, 3, "UDP Socket") \ 20 | SOURCE_TYPE(Tcp, 4, "TCP Socket") \ 21 | SOURCE_TYPE(DebugViewAgent, 5, "DbgView Agent") 22 | 23 | struct SourceType 24 | { 25 | #define SOURCE_TYPE(en, id, name) en, 26 | enum type 27 | { 28 | SOURCE_TYPES() 29 | }; 30 | #undef SOURCE_TYPE 31 | }; 32 | 33 | struct SourceInfo 34 | { 35 | SourceInfo(const std::wstring& description, SourceType::type sourceType); 36 | SourceInfo(const std::wstring& description, SourceType::type sourceType, const std::wstring& address, int port); 37 | 38 | bool enabled; 39 | std::wstring description; 40 | SourceType::type type; 41 | std::wstring address; 42 | int port; 43 | }; 44 | 45 | int SourceTypeToInt(SourceType::type value); 46 | 47 | SourceType::type IntToSourceType(int value); 48 | 49 | std::string SourceTypeToString(SourceType::type value); 50 | 51 | SourceType::type StringToSourceType(const std::string& s); 52 | 53 | } // namespace debugviewpp 54 | } // namespace fusion 55 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/TestSource.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "LogSource.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | class ILineBuffer; 14 | 15 | class TestSource : public LogSource 16 | { 17 | public: 18 | TestSource(Timer& timer, ILineBuffer& linebuffer); 19 | 20 | bool AtEnd() const override; 21 | HANDLE GetHandle() const override; 22 | void Notify() override; 23 | }; 24 | 25 | } // namespace debugviewpp 26 | } // namespace fusion 27 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/TimelineDC.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2016. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "windows.h" 9 | #include 10 | #include "atlapp.h" 11 | #include "atlgdi.h" 12 | #include 13 | #include 14 | 15 | namespace fusion { 16 | namespace gdi { 17 | 18 | // see http://www.informit.com/articles/article.aspx?p=328647&seqNum=2 19 | 20 | using Pixel = int; 21 | static const Pixel s_leftTextAreaBorder = Pixel{150}; // reserved space to put the name of the timeline 22 | 23 | using ManagedCDC = CDCT; 24 | 25 | class TimelineDC : public ManagedCDC 26 | { 27 | using ManagedCDC::ManagedCDC; 28 | 29 | public: 30 | [[nodiscard]] RECT GetClientArea() const; 31 | void DrawTextOut(const std::wstring& str, int x, int y); 32 | void DrawPolygon(const std::vector& points); 33 | void DrawTimeline(const std::wstring& name, int x, int y, int width, COLORREF color); 34 | void DrawFlag(const std::wstring& /* tooltip */, int x, int y); 35 | void DrawSolidFlag(const std::wstring& /* tooltip */, int x, int y); 36 | void DrawSolidFlag(const std::wstring& /* tooltip */, int x, int y, COLORREF border, COLORREF fill); 37 | void DrawFlag(const std::wstring& /* tooltip */, int x, int y, COLORREF color, bool solid); 38 | }; 39 | 40 | 41 | } // namespace gdi 42 | } // namespace fusion 43 | -------------------------------------------------------------------------------- /application/include/DebugViewppLib/VectorLineBuffer.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "LineBuffer.h" 9 | 10 | namespace fusion { 11 | namespace debugviewpp { 12 | 13 | class VectorLineBuffer : public ILineBuffer 14 | { 15 | public: 16 | explicit VectorLineBuffer(size_t size); 17 | 18 | void Add(double time, FILETIME systemTime, HANDLE handle, const std::string& message, const LogSource* pSource) override; 19 | void Add(double time, FILETIME systemTime, DWORD pid, const std::string& processName, const std::string& message, const LogSource* pSource) override; 20 | [[nodiscard]] Lines GetLines() override; 21 | [[nodiscard]] bool Empty() const override; 22 | 23 | private: 24 | std::mutex m_linesMutex; 25 | Lines m_buffer; 26 | Lines m_backingBuffer; 27 | }; 28 | 29 | using LineBuffer = VectorLineBuffer; 30 | 31 | } // namespace debugviewpp 32 | } // namespace fusion 33 | -------------------------------------------------------------------------------- /application/include/IndexedStorageLib/IndexedStorage.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #pragma comment(lib, "IndexedStorageLib.lib") 13 | 14 | namespace fusion { 15 | namespace indexedstorage { 16 | 17 | inline constexpr size_t UNSET_VALUE = std::numeric_limits::max(); 18 | 19 | class VectorStorage 20 | { 21 | public: 22 | [[nodiscard]] bool Empty() const; 23 | void Clear(); 24 | size_t Add(const std::string& value); 25 | [[nodiscard]] size_t Count() const; 26 | std::string operator[](size_t i) const; 27 | void shrink_to_fit(); 28 | 29 | private: 30 | std::vector m_storage; 31 | }; 32 | 33 | class SnappyStorage 34 | { 35 | public: 36 | SnappyStorage() = default; 37 | 38 | [[nodiscard]] bool Empty() const; 39 | void Clear(); 40 | size_t Add(const std::string& value); 41 | [[nodiscard]] size_t Count() const; 42 | std::string operator[](size_t i); 43 | 44 | [[nodiscard]] std::string Compress(const std::vector& value) const; 45 | static std::vector Decompress(const std::string& value); 46 | void shrink_to_fit(); 47 | 48 | private: 49 | static size_t GetBlockIndex(size_t index); 50 | static size_t GetRelativeIndex(size_t index); 51 | std::string GetString(size_t index); 52 | 53 | size_t m_writeBlockIndex = 0; 54 | size_t m_readBlockIndex = UNSET_VALUE; 55 | std::vector m_readList; 56 | std::vector m_writeList; 57 | std::vector m_storage; 58 | }; 59 | 60 | } // namespace indexedstorage 61 | } // namespace fusion 62 | -------------------------------------------------------------------------------- /application/include/Win32/Com.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include "atlbase.h" 9 | #include "atlcom.h" 10 | 11 | namespace fusion { 12 | namespace Win32 { 13 | 14 | class ComInitialization 15 | { 16 | public: 17 | explicit ComInitialization(); 18 | ~ComInitialization(); 19 | }; 20 | 21 | template 22 | class ComObjectPtr 23 | { 24 | public: 25 | ComObjectPtr() : 26 | ptr(nullptr) 27 | { 28 | } 29 | 30 | ComObjectPtr(const ComObjectPtr& p) : 31 | ptr(p) 32 | { 33 | ptr->AddRef(); 34 | } 35 | 36 | const ComObjectPtr& operator=(const ComObjectPtr& p) 37 | { 38 | if (ptr != nullptr) 39 | ptr->Release(); 40 | ptr = p.ptr; 41 | if (ptr != nullptr) 42 | ptr->AddRef(); 43 | return *this; 44 | } 45 | 46 | const ComObjectPtr& operator=(const ATL::CComObject* p) 47 | { 48 | if (ptr != nullptr) 49 | ptr->Release(); 50 | ptr = p; 51 | if (ptr != nullptr) 52 | ptr->AddRef(); 53 | return *this; 54 | } 55 | 56 | ComObjectPtr(ATL::CComObject* p) : 57 | ptr(p) 58 | { 59 | ptr->AddRef(); 60 | } 61 | 62 | ~ComObjectPtr() 63 | { 64 | ptr->Release(); 65 | } 66 | 67 | T* operator->() const 68 | { 69 | return ptr; 70 | } 71 | 72 | private: 73 | ATL::CComObject* ptr; 74 | }; 75 | 76 | template 77 | ATL::CComPtr GetInterface(ComObjectPtr ptr) 78 | { 79 | ATL::CComPtr pItf; 80 | ptr->QueryInterface(&pItf); 81 | return pItf; 82 | } 83 | 84 | template 85 | ATL::CComPtr GetInterface(T* ptr) 86 | { 87 | ATL::CComPtr pItf; 88 | ptr->QueryInterface(&pItf); 89 | return pItf; 90 | } 91 | 92 | template 93 | ComObjectPtr CreateComObject() 94 | { 95 | ATL::CComObject* ptr; 96 | CComObject::CreateInstance(&ptr); 97 | return ComObjectPtr(ptr); 98 | } 99 | 100 | } // namespace Win32 101 | } // namespace fusion 102 | -------------------------------------------------------------------------------- /application/include/Win32/Process.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include "Win32/Win32Lib.h" 11 | #include 12 | 13 | namespace fusion { 14 | namespace Win32 { 15 | 16 | std::wstring GetModuleFilename(); 17 | std::wstring GetExecutionPath(); 18 | std::wstring GetModuleFilenameUnspoofable(); 19 | 20 | class Process 21 | { 22 | public: 23 | Process(const std::wstring& pathName, const std::vector& args); 24 | Process(const std::wstring& pathName, const std::wstring& args); 25 | 26 | std::wstring GetName() const; 27 | HANDLE GetStdIn() const; 28 | HANDLE GetStdOut() const; 29 | HANDLE GetStdErr() const; 30 | HANDLE GetProcessHandle() const; 31 | HANDLE GetThreadHandle() const; 32 | unsigned long GetProcessId() const; 33 | unsigned long GetThreadId() const; 34 | 35 | bool IsRunning() const; 36 | void Wait() const; 37 | 38 | private: 39 | void Run(const std::wstring& pathName, const std::wstring& args); 40 | 41 | std::wstring m_name; 42 | Handle m_stdIn; 43 | Handle m_stdOut; 44 | Handle m_stdErr; 45 | Handle m_hProcess; 46 | Handle m_hThread; 47 | unsigned long m_processId; 48 | unsigned long m_threadId; 49 | }; 50 | 51 | } // namespace Win32 52 | } // namespace fusion 53 | -------------------------------------------------------------------------------- /application/include/Win32/Registry.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | namespace fusion { 12 | namespace Win32 { 13 | 14 | std::wstring RegGetStringValue(HKEY hKey, const wchar_t* valueName = nullptr); 15 | std::wstring RegGetStringValue(HKEY hKey, const wchar_t* valueName, const wchar_t* defaultValue); 16 | 17 | DWORD RegGetDWORDValue(HKEY hKey, const wchar_t* valueName = nullptr); 18 | DWORD RegGetDWORDValue(HKEY hKey, const wchar_t* valueName, DWORD defaultValue); 19 | 20 | } // namespace Win32 21 | } // namespace fusion 22 | -------------------------------------------------------------------------------- /application/include/Win32/Socket.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "winsock2.h" 10 | #include "Win32/Win32Lib.h" 11 | 12 | namespace fusion { 13 | namespace Win32 { 14 | 15 | class WinsockInitialization : noncopyable 16 | { 17 | public: 18 | explicit WinsockInitialization(int major = 2, int minor = 2); 19 | ~WinsockInitialization(); 20 | }; 21 | 22 | void WSAThrowLastError(const std::string& what); 23 | 24 | struct SocketDeleter 25 | { 26 | using pointer = SOCKET; 27 | 28 | void operator()(pointer p) const; 29 | }; 30 | 31 | using Socket = std::unique_ptr; 32 | 33 | Socket WSASocket(int af, int type, int protocol); 34 | Socket WSASocket(int af, int type, int protocol, const WSAPROTOCOL_INFO* pProtocolInfo, GROUP g, DWORD flags); 35 | 36 | void bind(Socket& socket, const sockaddr_in& sa); 37 | 38 | bool WSARecvFrom(Socket& s, const WSABUF buffers[], DWORD bufferCount, DWORD* pNumberOfBytesRecvd, DWORD* pFlags, sockaddr_in& from, int& fromLen, WSAOVERLAPPED* pOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE pCompletionRoutine); 39 | 40 | DWORD WSAGetOverlappedResult(Socket& s, WSAOVERLAPPED& overlapped, bool wait, DWORD& flags); 41 | 42 | } // namespace Win32 43 | } // namespace fusion 44 | -------------------------------------------------------------------------------- /application/include/Win32/Utilities.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace fusion { 11 | namespace win32 { 12 | 13 | std::wstring LoadWString(int id); 14 | 15 | static const int False = 0; 16 | static const int True = 1; 17 | 18 | } // namespace win32 19 | } // namespace fusion 20 | -------------------------------------------------------------------------------- /application/include/Win32/Window.h: -------------------------------------------------------------------------------- 1 | // (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma once 7 | 8 | namespace fusion { 9 | namespace Win32 { 10 | 11 | WINDOWPLACEMENT GetWindowPlacement(HWND hwnd); 12 | POINT GetMessagePos(); 13 | POINT GetCursorPos(); 14 | 15 | } // namespace Win32 16 | } // namespace fusion 17 | -------------------------------------------------------------------------------- /application/nuget/DebugViewpp-nuget.cpp: -------------------------------------------------------------------------------- 1 | // DebugViewpp-nuget.cpp : Defines the functions for the dummy static library. 2 | 3 | #include "pch.h" 4 | #include "framework.h" 5 | 6 | void fnDebugViewppnuget() 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /application/nuget/DebugViewpp-nuget.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33205.214 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DebugViewpp-nuget", "DebugViewpp-nuget.vcxproj", "{EC9CF28D-42D6-40C9-B8D2-E63AE0D85A67}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {EC9CF28D-42D6-40C9-B8D2-E63AE0D85A67}.Debug|x64.ActiveCfg = Debug|x64 17 | {EC9CF28D-42D6-40C9-B8D2-E63AE0D85A67}.Debug|x64.Build.0 = Debug|x64 18 | {EC9CF28D-42D6-40C9-B8D2-E63AE0D85A67}.Debug|x86.ActiveCfg = Debug|Win32 19 | {EC9CF28D-42D6-40C9-B8D2-E63AE0D85A67}.Debug|x86.Build.0 = Debug|Win32 20 | {EC9CF28D-42D6-40C9-B8D2-E63AE0D85A67}.Release|x64.ActiveCfg = Release|x64 21 | {EC9CF28D-42D6-40C9-B8D2-E63AE0D85A67}.Release|x64.Build.0 = Release|x64 22 | {EC9CF28D-42D6-40C9-B8D2-E63AE0D85A67}.Release|x86.ActiveCfg = Release|Win32 23 | {EC9CF28D-42D6-40C9-B8D2-E63AE0D85A67}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {B1812ADB-7EAC-4F8A-A4D2-0863AF56D7FA} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /application/nuget/DebugViewpp-nuget.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /application/nuget/framework.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 4 | -------------------------------------------------------------------------------- /application/nuget/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /application/nuget/pch.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp: source file corresponding to the pre-compiled header 2 | 3 | #include "pch.h" 4 | 5 | // When you are using pre-compiled headers, this source file is necessary for compilation to succeed. 6 | -------------------------------------------------------------------------------- /application/nuget/pch.h: -------------------------------------------------------------------------------- 1 | // pch.h: This is a precompiled header file. 2 | // Files listed below are compiled only once, improving build performance for future builds. 3 | // This also affects IntelliSense performance, including code completion and many code browsing features. 4 | // However, files listed here are ALL re-compiled if any one of them is updated between builds. 5 | // Do not add files here that you will be updating frequently as this negates the performance advantage. 6 | 7 | #ifndef PCH_H 8 | #define PCH_H 9 | 10 | // add headers that you want to pre-compile here 11 | #include "framework.h" 12 | 13 | #endif //PCH_H 14 | -------------------------------------------------------------------------------- /art/ClassDiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/ClassDiagram.png -------------------------------------------------------------------------------- /art/DebugViewProjects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/DebugViewProjects.png -------------------------------------------------------------------------------- /art/TimeDebuggerMockup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/TimeDebuggerMockup.png -------------------------------------------------------------------------------- /art/backtrace_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/backtrace_logo.png -------------------------------------------------------------------------------- /art/bug256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/bug256.png -------------------------------------------------------------------------------- /art/bug256_merged.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/bug256_merged.pdn -------------------------------------------------------------------------------- /art/bug256_merged_glow.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/bug256_merged_glow.pdn -------------------------------------------------------------------------------- /art/filterdialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/filterdialog.png -------------------------------------------------------------------------------- /art/incredi_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/incredi_logo.png -------------------------------------------------------------------------------- /art/logcat_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/logcat_example.png -------------------------------------------------------------------------------- /art/regexgroups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/regexgroups.png -------------------------------------------------------------------------------- /art/resharpercpp_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/resharpercpp_logo.png -------------------------------------------------------------------------------- /art/syntax_high.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/syntax_high.png -------------------------------------------------------------------------------- /art/timedoc_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/timedoc_screenshot.png -------------------------------------------------------------------------------- /art/vs2017_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/art/vs2017_options.png -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # Universal Windows Platform 2 | # Build a Universal Windows Platform project using Visual Studio. 3 | # Add steps that test and distribute an app, save build artifacts, and more: 4 | # https://aka.ms/yaml 5 | 6 | trigger: 7 | - master 8 | 9 | pool: 10 | vmImage: 'windows-2022' 11 | 12 | variables: 13 | solution: 'vs2022\DebugViewpp.sln' 14 | buildPlatform: 'x64' 15 | buildConfiguration: 'Release' 16 | appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\\' 17 | 18 | steps: 19 | - checkout: self 20 | 21 | - task: CMake@1 22 | inputs: 23 | workingDirectory: '.' 24 | cmakeArgs: '-DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release -G Ninja -B build .' 25 | 26 | - task: CMake@1 27 | inputs: 28 | workingDirectory: '.' 29 | cmakeArgs: '--build build' 30 | 31 | - task: VSTest@2 32 | inputs: 33 | testSelector: 'testAssemblies' 34 | testAssemblyVer2: '**\*test.exe' 35 | searchFolder: '$(System.DefaultWorkingDirectory)' 36 | 37 | - task: CopyFiles@2 38 | inputs: 39 | sourceFolder: '$(Build.SourcesDirectory)' 40 | contents: '$(buildPlatform)/$(BuildConfiguration)/(D*.exe|*.zip|*.pdb|*.msi|*.vsix)' 41 | targetFolder: $(Build.ArtifactStagingDirectory) 42 | 43 | - task: PublishBuildArtifacts@1 44 | inputs: 45 | pathtoPublish: '$(Build.ArtifactStagingDirectory)' 46 | artifactName: DebugView++ 47 | 48 | #- task: GithubRelease@0 49 | # displayName: 'Create GitHub Release' 50 | # inputs: 51 | # githubConnection: janwilmans 52 | # repositoryName: CobaltFusion/DebugViewPP 53 | # assets: $(Build.ArtifactStagingDirectory)/(Debug*.exe|Debug.zip|Debug.msi|*.vsix) -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | cmake -DCMAKE_INSTALL_PREFIX=install -G "Visual Studio 17 2022" -B vs2022 . 2 | start "" vs2022\debugviewpp.sln 3 | -------------------------------------------------------------------------------- /build_with_ninja.bat: -------------------------------------------------------------------------------- 1 | cmake -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release -G Ninja -B build . 2 | ninja -C build 3 | -------------------------------------------------------------------------------- /cmake/CMakeLists.buildnumber.cmake: -------------------------------------------------------------------------------- 1 | 2 | execute_process( 3 | COMMAND cmd /C UpdateBuildNr.cmd version.h version.wxi 4 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Application/DebugviewPP/" 5 | COMMAND_ERROR_IS_FATAL ANY 6 | ) 7 | 8 | file(READ "${CMAKE_SOURCE_DIR}/application/DebugViewpp/version.h" VERSION_FILE_CONTENTS) 9 | 10 | # Regular expression to extract VERSION_STR 11 | string(REGEX MATCH "#define VERSION_STR \"([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)\"" VERSION_STR_MATCH "${VERSION_FILE_CONTENTS}") 12 | 13 | # Extract the version string from the matched content 14 | if(VERSION_STR_MATCH) 15 | set(VERSION_STR ${CMAKE_MATCH_1}) 16 | else() 17 | message(FATAL_ERROR "Failed to extract VERSION_STR from version.h") 18 | endif() 19 | 20 | # Set the build number as a CMake variable 21 | set(DEBUGVIEW_VERSION "${VERSION_STR}" CACHE INTERNAL "") 22 | 23 | MESSAGE("Retrieved version: ${VERSION_STR} from version.h") -------------------------------------------------------------------------------- /cmake/CMakeLists.nuget.cmake: -------------------------------------------------------------------------------- 1 | set(NUGET_SOLUTION ${CMAKE_SOURCE_DIR}/application/nuget/DebugViewpp-nuget.sln) 2 | 3 | if (NOT EXISTS ${NUGET_SOLUTION}) 4 | MESSAGE(FATAL_ERROR " NUGET solution ${NUGET_SOLUTION} not found!") 5 | else() 6 | execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/nuget.exe restore ${NUGET_SOLUTION} COMMAND_ERROR_IS_FATAL ANY) 7 | endif() 8 | 9 | set(NUGET_PACKAGES_PATH ${CMAKE_SOURCE_DIR}/application/nuget/packages CACHE PATH "Directory containing nuget packages") 10 | 11 | add_library(nuget_boost INTERFACE) 12 | target_include_directories(nuget_boost INTERFACE "${NUGET_PACKAGES_PATH}/boost.1.80.0/lib/native/include") 13 | target_link_directories(nuget_boost INTERFACE "${NUGET_PACKAGES_PATH}/boost_date_time-vc143.1.80.0/lib/native") 14 | target_link_directories(nuget_boost INTERFACE "${NUGET_PACKAGES_PATH}/boost_regex-vc143.1.80.0/lib/native") 15 | target_link_directories(nuget_boost INTERFACE "${NUGET_PACKAGES_PATH}/boost_system-vc143.1.80.0/lib/native") 16 | add_library(nuget::boost ALIAS nuget_boost) 17 | 18 | add_library(nuget_boost_test INTERFACE) 19 | target_include_directories(nuget_boost_test INTERFACE "${NUGET_PACKAGES_PATH}/boost.1.80.0/lib/native/include") 20 | target_link_directories(nuget_boost_test INTERFACE "${NUGET_PACKAGES_PATH}/boost_unit_test_framework-vc143.1.80.0/lib/native") 21 | add_library(nuget::boost_test ALIAS nuget_boost_test) 22 | 23 | add_library(nuget_snappy "${NUGET_PACKAGES_PATH}/Snappy.1.1.1.7/lib/native/src/snappy-single-file.cpp") 24 | target_compile_definitions(nuget_snappy PUBLIC SNAPPY_STATIC) 25 | target_include_directories(nuget_snappy PUBLIC "${NUGET_PACKAGES_PATH}/Snappy.1.1.1.7/lib/native/include") 26 | add_library(nuget::snappy ALIAS nuget_snappy) 27 | 28 | add_library(nuget_wtl INTERFACE) 29 | target_include_directories(nuget_wtl INTERFACE "${NUGET_PACKAGES_PATH}/wtl.10.0.10320/lib/native/include") 30 | add_library(nuget::wtl ALIAS nuget_wtl) 31 | 32 | -------------------------------------------------------------------------------- /cmake/build_number.txt: -------------------------------------------------------------------------------- 1 | 45 -------------------------------------------------------------------------------- /companions/DebugViewppSetup/DebugViewppSetup.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33205.214 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "DebugViewppSetup", "DebugViewppSetup.wixproj", "{5663D355-17BA-42AE-9EE1-598CE0662341}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {5663D355-17BA-42AE-9EE1-598CE0662341}.Debug|x64.ActiveCfg = Release|x64 15 | {5663D355-17BA-42AE-9EE1-598CE0662341}.Debug|x64.Build.0 = Release|x64 16 | {5663D355-17BA-42AE-9EE1-598CE0662341}.Release|x64.ActiveCfg = Release|x64 17 | {5663D355-17BA-42AE-9EE1-598CE0662341}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {F16638FB-5119-444C-9AEE-90706501F667} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /companions/DebugViewppSetup/DebugViewppSetup.wixproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Release 5 | x64 6 | 3.10 7 | 5663d355-17ba-42ae-9ee1-598ce0662341 8 | 2.0 9 | DebugViewppSetup 10 | Package 11 | 12 | 13 | bin\$(Platform)\$(Configuration)\ 14 | obj\$(Platform)\$(Configuration)\ 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 32 | -------------------------------------------------------------------------------- /companions/DebugViewppSetup/Product.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /companions/OutputForwarder2022/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("OutputForwarder2022")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OutputForwarder2022")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /companions/OutputForwarder2022/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OutputForwarder2022 6 | This extention is a companion to DebugView++ that forwards visual studio 2022's output window to the Trace API, effectively forwarding messages from the application being debugged to DebugView++ (or similar application) 7 | There are no setup steps, just install and enjoy. 8 | Updated to work with VS2022 9 | 10 | 11 | 12 | amd64 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /companions/OutputForwarderVSIX/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/companions/OutputForwarderVSIX/Key.snk -------------------------------------------------------------------------------- /companions/OutputForwarderVSIX/OutputForwarderVSIX.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /companions/OutputForwarderVSIX/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("OutputForwarderVSIX")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OutputForwarderVSIX")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /companions/OutputForwarderVSIX/Resources/Forwarder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/companions/OutputForwarderVSIX/Resources/Forwarder.png -------------------------------------------------------------------------------- /companions/OutputForwarderVSIX/Resources/ForwarderPackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/companions/OutputForwarderVSIX/Resources/ForwarderPackage.ico -------------------------------------------------------------------------------- /companions/OutputForwarderVSIX/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | CobaltFusion Output Window Forwarding 5 | CobaltFusion 6 | 1.1 7 | This extention is a companion to DebugView++ that forwards visual studio's output window to the OutputDebugString API, effectively forwarding messages from the application being debugged to DebugView++ (or similar application). 8 | 1033 9 | 10 | 11 | Pro 12 | 13 | 14 | Pro 15 | 16 | 17 | Pro 18 | 19 | 20 | Community 21 | Pro 22 | 23 | 24 | Community 25 | Pro 26 | 27 | 28 | Community 29 | Pro 30 | 31 | 32 | Community 33 | Pro 34 | 35 | 36 | 37 | 38 | 39 | |%CurrentProject%;PkgdefProjectOutputGroup| 40 | |%CurrentProject%| 41 | 42 | 43 | -------------------------------------------------------------------------------- /companions/cs/HttpMonitor/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("HttpMonitor")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("HttpMonitor")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e600c38b-7eb6-417e-a29b-ea6e002e981b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /companions/cs/HttpMonitor/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /companions/java/hellojar/HelloJar.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/companions/java/hellojar/HelloJar.jar -------------------------------------------------------------------------------- /companions/java/hellojar/Manifest.txt: -------------------------------------------------------------------------------- 1 | Main-Class: nl.cobaltfusion.debugviewpp.HelloJar 2 | Class-Path: jna-4.1.0.jar 3 | -------------------------------------------------------------------------------- /companions/java/hellojar/compile.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd %~dp0 3 | SETLOCAL 4 | 5 | set BIN="C:\Program Files\Java\jdk1.7.0_40\bin" 6 | 7 | %BIN%\javac -cp ".;*" nl/cobaltfusion/debugviewpp/*.java 8 | %BIN%\jar cmvf Manifest.txt HelloJar.jar nl/cobaltfusion/debugviewpp/*.class jna-4.1.0.jar 9 | 10 | ENDLOCAL 11 | -------------------------------------------------------------------------------- /companions/java/hellojar/jna-4.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/companions/java/hellojar/jna-4.1.0.jar -------------------------------------------------------------------------------- /companions/java/hellojar/nl/cobaltfusion/debugviewpp/DebugViewPP.java: -------------------------------------------------------------------------------- 1 | package nl.cobaltfusion.debugviewpp; 2 | 3 | import com.sun.jna.Library; 4 | import com.sun.jna.Native; 5 | 6 | public class DebugViewPP 7 | { 8 | public interface Kernel32 extends Library 9 | { 10 | public void OutputDebugStringA(String Text); 11 | } 12 | 13 | /** 14 | * This method makes a Kernel32 Call and sends the debugstring to the 15 | * KernelConsole. 16 | */ 17 | static void println(String message) 18 | { 19 | Kernel32 lib = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class); 20 | lib.OutputDebugStringA(message); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /companions/java/hellojar/nl/cobaltfusion/debugviewpp/HelloJar.java: -------------------------------------------------------------------------------- 1 | package nl.cobaltfusion.debugviewpp; 2 | 3 | import nl.cobaltfusion.debugviewpp.DebugViewPP; 4 | 5 | public class HelloJar { 6 | 7 | public static void main(String[] args) { 8 | 9 | System.out.println("Arguments:"); 10 | DebugViewPP.println("HelloJar from java!"); 11 | 12 | for (String arg : args) { 13 | System.out.println(arg); 14 | DebugViewPP.println(arg); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /companions/java/hellojar/run.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd %~dp0 3 | java -jar HelloJar.jar cmdlinearg1 cmdlinearg2 cmdlinearg3 4 | -------------------------------------------------------------------------------- /dbgview_testfiles/UTF-8-test.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/dbgview_testfiles/UTF-8-test.txt -------------------------------------------------------------------------------- /doc/DesignOverview.md: -------------------------------------------------------------------------------- 1 | Project dependencies 2 | -------------------- 3 | 4 | ![DebugView++ Projects](art/DebugViewProjects.png "DebugView++ Projects") 5 | 6 | 1. Project **DebugViewCmd** 7 | CommandLine version of debugview++, 8 | enables piping debugview output into another process. 9 | 10 | 2. Project **DebugView** 11 | Main project, contains all WTL/ UI specific code 12 | 13 | 3. Project **DebugView++Lib** 14 | All infrastructure a 'debugview'-like application needs, 15 | but nothing UI-related,for example: filters, FileIO, PipeReader, LogSources 16 | 17 | 4. Project **CobaltFusion** 18 | Anything that is reusable beyond DebugView and has no dependencies other then C++11 19 | (and boost while we are using vs2010) 20 | 21 | 5. Project **Win32Lib** 22 | Anything that is reusable beyond DebugView but is win32 specific 23 | It now also contains left-overs, of which some might be better moved into DebugView++/Win32Support.cpp 24 | 25 | 6. Project **IndexedStorageLib** 26 | Contains VectorStorage and SnappyStorage, two 27 | indexed-string-storage classes 28 | 29 | 30 | Current state of implementation: 31 | -------------------------------- 32 | 33 | - class LogSources is now a container and not using the circular buffer yet 34 | - m_autoNewline should be a per-logsource setting 35 | 36 | - LogSource::Notify() is called from LogSources::Run 37 | when WaitForMultipleObjects returns and indicated that the corresponding HANDLE is signaled. 38 | 39 | - LogSource::Notify() then adds a Line to the circular buffer, 40 | or in case of autonewLine = false, into a fixed 8kb buffer of the LogSource 41 | 42 | -------------------------------------------------------------------------------- /doc/Understanding Win32 _OutputDebugString__files/feed-icon-14x14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/doc/Understanding Win32 _OutputDebugString__files/feed-icon-14x14.png -------------------------------------------------------------------------------- /doc/Understanding Win32 _OutputDebugString__files/steve-email.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/doc/Understanding Win32 _OutputDebugString__files/steve-email.gif -------------------------------------------------------------------------------- /doc/Understanding Win32 _OutputDebugString__files/unixwiz-logo-140x80.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/doc/Understanding Win32 _OutputDebugString__files/unixwiz-logo-140x80.gif -------------------------------------------------------------------------------- /doc/classdiagram.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | class LogSource { 4 | ILineBuffer 5 | m_timer 6 | } 7 | 8 | class ProcessReader 9 | { 10 | PipeReader m_stdout 11 | PipeReader m_stderr 12 | } 13 | 14 | class LogSources 15 | { 16 | AddMessage(const std::string& message); 17 | } 18 | 19 | class CMainFrame 20 | { 21 | LogSources m_logSources; 22 | } 23 | 24 | class CLogView 25 | { 26 | deque m_logLines 27 | } 28 | 29 | class CLogViewTabItem 30 | { 31 | std::shared_ptr m_pView; 32 | } 33 | 34 | class CLogViewTabItem2 35 | { 36 | std::shared_ptr m_pView; 37 | CHorSplitterWindow m_split; 38 | CMyPaneContainer m_top; 39 | CMyPaneContainer m_bottom; 40 | gdi::CTimelineView m_timelineView; 41 | ViewPort m_viewPort; 42 | } 43 | 44 | CCustomTabItem <|-- CTabViewTabItem 45 | CTabViewTabItem <|-- CLogViewTabItem 46 | CTabViewTabItem <|--- CLogViewTabItem2 47 | 48 | CTabbedFrameImpl <|-- CMainFrame 49 | CMainFrame --> LogSources 50 | CMainFrame -> CLogView 51 | 'CLogView -> CLogViewTabItem 52 | CLogView -> CLogViewTabItem2 53 | LogSources --> LogSource 54 | 55 | CLogViewTabItem2 --> CTimelineView 56 | 57 | class CTimelineView 58 | { 59 | +PaintScale() 60 | +PaintCursors() 61 | +PaintTimelines() 62 | } 63 | 64 | class TimelineDC 65 | { 66 | DrawTextOut() 67 | DrawPolygon() 68 | DrawTimeline() 69 | DrawSolidFlag() 70 | DrawFlag() 71 | } 72 | 73 | CTimelineView -> Line 74 | Line -> Artifact 75 | CTimelineView --> TimelineDC 76 | 77 | 78 | LogSource <|--- Loopback 79 | LogSource <|--- TestSource 80 | LogSource <|--- PolledLogSource 81 | LogSource <|--- SocketReader 82 | LogSource <|-- DBWinReader 83 | LogSource <|-- FileReader 84 | LogSource <|-- BinaryFileReader 85 | 86 | PolledLogSource <|-- PipeReader 87 | PolledLogSource <|-- DbgviewReader 88 | PolledLogSource <|-- ProcessReader 89 | 90 | CListViewCtrl <|-- CLogView 91 | 92 | @enduml -------------------------------------------------------------------------------- /doc/readme.txt: -------------------------------------------------------------------------------- 1 | https://plantuml-editor.kkeisuke.com/# 2 | -------------------------------------------------------------------------------- /utils/build_boost.txt: -------------------------------------------------------------------------------- 1 | # Building boost is nolonger needed to build debugview++ 2 | # Use nuget package manager to get boost 1.63 v140 from Nuget, these libraries are binaries compatible with both vs2015 and vs2017 3 | 4 | ********************************************************************** 5 | ** Visual Studio 2017 Developer Command Prompt v15.0.26228.4 6 | ** Copyright (c) 2017 Microsoft Corporation 7 | ********************************************************************** 8 | [vcvarsall.bat] Environment initialized for: 'x86' 9 | 10 | C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>d: 11 | 12 | D:\project\boost_1_63_0\boost_1_63_0>bootstrap.bat 13 | Building Boost.Build engine 14 | 15 | 16 | 1) ./bootstrap.bat 17 | 18 | 2) look at project-config.jam, and set the path to visual studio: 19 | 20 | import option ; 21 | 22 | using msvc : 14.0 : "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24728\bin\HostX64\x64\cl.exe"; 23 | 24 | option.set keep-going : false ; 25 | 26 | 3) Run b2 from the visual studio command prompt 27 | 28 | 32bit: b2 toolset=msvc-14.0 address-model=32 --build-type=complete stage install 29 | 64bit: b2 toolset=msvc-14.0 address-model=64 --build-type=complete stage install 30 | 31 | rem this output its results into c:\boost 32 | rem however, static libs are found in a boost-subdirectory and must be copied manually 33 | 34 | 35 | 36 | notes: 37 | "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\setenv.cmd" /Release /x64 38 | 39 | 40 | - boost 1.63: see the install.sh in the boost archive 41 | - install visual studio 2015 42 | - open developer console (cmd.exe + run C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat) 43 | - unzip boost_1_63_0.zip to c:\downloads\boost_1_63_0 44 | - cd c:\downloads\boost_1_63_0 45 | - run c:\downloads\boost_1_63_0\bootstrap.bat (~1 minute) 46 | - b2.exe --build-type=complete stage install (~45 minutes) 47 | - find the results in c:\boost 48 | - copy C:\boost\include\boost-1_63\boost -> DebugViewpp\Libraries\boost\boost 49 | - copy C:\Boost\lib -> DebugViewPP\Libraries\Boost\lib\win32 50 | - for some reason I have to copy boost_1_63_0\stage\lib\*.* to \Libraries\boost\lib\win32\*.* to get the vc???-mt-sgd libraries. 51 | - "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\setenv.cmd" /Release /x64 52 | - b2.exe address-model=64 --build-type=complete stage install 53 | - copy C:\Boost\lib -> DebugViewPP\Libraries\Boost\lib\x64 54 | -------------------------------------------------------------------------------- /utils/bzip2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/utils/bzip2.dll -------------------------------------------------------------------------------- /utils/clang-format.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/utils/clang-format.exe -------------------------------------------------------------------------------- /utils/createzip.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | pushd %~dp0 3 | 4 | setlocal 5 | 6 | if [%1] == [] ( 7 | echo Usage: createzip ^ ^ 8 | goto exit 9 | ) 10 | if [%2] == [] ( 11 | echo Usage: createzip ^ ^ 12 | goto exit 13 | ) 14 | 15 | set bin_dir=%1 16 | set project_dir=%2 17 | 18 | :: paths can be absolute or relative to the location of this batch file 19 | set zip_bin=.\zip.exe 20 | set upx_bin=.\upx.exe 21 | 22 | if not exist %zip_bin% ( 23 | echo %zip_bin% does not exist, zipfile creation skipped 24 | goto exit 25 | ) 26 | 27 | if not exist %upx_bin% ( 28 | echo %upx_bin% does not exist, exe compression skipped 29 | goto zip 30 | ) 31 | 32 | :: UPX compresses executables in place about 40%, has no decompressing memory overhead and is extremely fast 33 | %upx_bin% %bin_dir%\DebugView++.exe 34 | %upx_bin% %bin_dir%\DebugViewConsole.exe 35 | 36 | :: notice we pack the win32 .vsix in any case (so also in x64 builds), and this is correct. 37 | 38 | :zip 39 | %zip_bin% -j %bin_dir%\DebugView++.zip %bin_dir%\DebugView++.exe %bin_dir%\DebugView++*.pdb %bin_dir%\DebugViewConsole.exe %project_dir%\release\*.vsix 40 | 41 | :exit -------------------------------------------------------------------------------- /utils/nuget.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/utils/nuget.exe -------------------------------------------------------------------------------- /utils/upx.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/utils/upx.exe -------------------------------------------------------------------------------- /utils/zip.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/utils/zip.exe -------------------------------------------------------------------------------- /utils/zip32z64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CobaltFusion/DebugViewPP/805756dac8047c16842fde493eda36ec8df88f13/utils/zip32z64.dll --------------------------------------------------------------------------------