Source Insight插件与配置

Recently, I’ve been experimenting with a few development-related tools that can be considered artifacts. As the saying goes, “A workman must sharpen his tools before he can work well.” I’ll take some time to organize and write about it.

Using Visual Studio and Sublime Text to write code is undoubtedly enjoyable, but they fall short when it comes to more lightweight and accurate code analysis. Writing code in VS is very comfortable with its smart suggestions and debugging features; however, as a pure code reading tool, it’s a bit too bulky, and its support for code symbols isn’t great (installing VA can solve that). But if you’re just looking to read code, a lightweight solution is better. Sublime Text is indeed a great text editor; I use it for coding as well, but the biggest problem when reading code with it is the inconvenience of jumping between projects, and it lacks symbol analysis (not considering plugins). The solution to the above problems is—using Source Insight!

Here’s a brief introduction to Source Insight:

Source Insight can analyze your source code and dynamically maintain its own symbol database while you’re working, automatically displaying useful contextual information. Source Insight is not just a powerful program editor; it can also show reference trees, class inheritance diagrams, and call trees. Source Insight provides the fastest navigation of source code and source information of any program editor.

Without further ado, here’s an image.

You can conveniently see various information in the code, with the upper window containing code symbols, editor, project files, context window, and association window.

What I like most are the context window and association window, which allow for easy jumping within projects. The code analysis is very accurate, and after a few days of use, I feel I can’t live without it! Haha.

You should try it out yourself; my review of it is: a reading artifact for code, no doubt about it!

Now, let’s talk about some issues with this software.

Source Insight does not support UTF-8 by default, so if your code comments contain Chinese characters, they will display as garbled text. I tried many solutions that weren’t perfect until I came across this article—Source Insight 3.X New Loader Plugin Release. If you don’t want to read the article, you can directly click here to download the compiled plugin by the author.

Usage: Unzip it directly into the Source Insight installation directory.
The author has written two plugins that enable Source Insight to support UTF-8 encoding and multiple tabs (the multiple tabs function is very useful).

The author implemented this plugin using DLL injection. If you’re interested, you can check out this series of articles: Creating a Plugin for Source Insight.

There are also several articles on DLL hijacking and injection, which mostly use the same method; feel free to research them.

  1. DLL Hijacking and Injection on Win7
  2. Summary of DLL Injection Methods Under Ring3
  3. DLL Injection Techniques to Hijack Process Creation Injection
  4. Several Methods for DLL Injection (I): Windows Hooks
  5. Several Methods for DLL Injection (II): CreateRemoteThread And More

However, I encountered a bug with this author’s plugin. I used Source Insight to read the code of his multi-tab plugin over the past couple of days (reading code with Source Insight is just amazing), and I made some modifications, including English localization of the plugin and tweaks to suit my preferences.
The original author’s code can be found at: sihook
My modified code: fixsihook, which fixes a few minor issues and adds some comments. You can download the three compiled versions of sihook.dll I created here (the tabs may vary, choose according to your preference).

The main feature of the multi-tabs in the sihook project is implemented in Tabctl.c, but you can also read all of his code and modify it based on your preferences.

The above sihook projects are all built using Code::Block and compiled with GCC. If you want to set up your own compilation environment, you can go to the Code::Block official website and download a binary version installation package with the compiler (Mingw/GCC), or compile directly using makefile.

Additionally, here’s a self-made configuration for Source Insight (especially the editor color scheme, which took me a long time)——click here to download.
After downloading, you can choose Options - Load Configuration in Source Insight and select the downloaded SourceInsightSettings.CF3.

The latest version of Source Insight and the Chinese localization program/personal settings—download packaged version.

There’s also a similar tool called Understand; I’ll try it out when I have time.

The article is finished. If you have any questions, please comment and communicate.

Scan the QR code on WeChat and follow me.

Title:Source Insight插件与配置
Author:LIPENGZHA
Publish Date:2016/08/14 08:08
Word Count:3.9k Words
Link:https://en.imzlp.com/posts/42068/
License: CC BY-NC-SA 4.0
Reprinting of the full article is prohibited.
Your donation will encourage me to keep creating!