当前位置:网站首页>Use source insight to view and edit source code
Use source insight to view and edit source code
2022-04-23 12:37:00 【dvlinker】
Catalog
2、 establish Source Insight engineering , take reactos Add project files to the project
3、 Use Source Insight Look at the code
3.1、 see reactos The internal implementation of an interface in
Sometimes we need to look at the open source code of some large projects , But these open source projects do not support the use of our daily IDE Development tools to open , Which tool should I choose to view the source code at this time ?Source Insight Tools are definitely a good choice , In this article, we will introduce how to use Source Insight Tools to view and edit the source code .
1、Source Insight Introduce
Source Insight It's the simplest 、 One of the most powerful lightweight code browsing editors , Fast start 、 Easy to use , Many programmers should have used ! It supports almost all languages , such as C、C++、ASM assembly 、HTML etc. , Can create and maintain its high-performance symbol database , Include function 、 Variable 、 Structure 、 Class and other symbols , Especially for reading the code of large-scale engineering projects, it is very convenient . however Source Insight Just a code browsing editor , No compiler included , So there is no ability to compile code .
This article is to see reactos Open source operating system source code For example , How to use Source Insight Editor .
2、 establish Source Insight engineering , take reactos Add project files to the project
Click on the menu bar Project->New Project Initiate the creation of the project . Enter the project name in the pop-up window reactos-2, As shown below :
Click on OK, Enter the configuration page of the project . In the configuration page , Set up reactos Source directory , also Check “store function-local symbols in database” Options , As shown below :
After checking this option ,Source Insight Will automatically 、 Save symbols such as variables to the database , You can continue to use... The next time you open the project .
Click on OK Back entry “Add and Remove Project Files” page :
The source directory selected in the previous step will be selected by default in this page , Click on the right “Add Tree” Button , Add all files in the project directory to reactos-2 In Engineering .
If there are many files in the project directory , The progress bar for adding files will be displayed :
Source Insight It is through the symbol information in these added files that the symbol database is constructed , To facilitate the reference of the code . Click on Close The project creation button is completed .
Source Insight Each time you start, the last opened project will be opened by default , If you create multiple projects , Want to see another project , You can click on the Project->Close Project Close the currently open project , Then click Project->Open Project, Open another project to view .
3、 Use Source Insight Look at the code
Before looking at the code , You can click... On the right first “Project Symbol List” Button :
Display the function symbols in all files in the project in the list , To facilitate searching and viewing in the list . If there are many files in the project directory , This process will also be relatively slow , A progress bar will also be displayed :
Wait for it to finish searching .
3.1、 see reactos The internal implementation of an interface in
Suppose we take a look at SetUnhandledExceptionFilter Internal implementation of function , You can click the following buttons in the toolbar :
Type... In the pop-up window SetUnhandledExceptionFilter, And then click Search Button to search , Search for the following results :
Find a random item in the search results , Click the switch button on the left , Jump to the line number of the corresponding file and code :
Click the switch button on the left in the source code , You can switch back to the search list .
Then left click SetUnhandledExceptionFilter At function , The view below will automatically jump to SetUnhandledExceptionFilter The implementation code inside the function :
Double click the display SetUnhandledExceptionFilter View of internal implementation , You can jump to SetUnhandledExceptionFilter Function internal implementation :
So through the above method , We can check the internal implementation of any interface in the system library , and reactos In the implementation of , and Windows NT The implementation of the kernel is very similar , So by looking at reactos The code in , It can be roughly seen that Windows Some internal implementations of the system .
3.2、 adopt regsvr32 The program corresponds to .c Source file view regsvr32 The internal implementation of the program
Previously, we encountered loading when registering controls in the installation package dll The problem of control library failure , Manual use regsvr32 Can be in windows Of cmd The window can be loaded manually and registered successfully , So I want to see regsvr32 How to load... In the program dll Control library , And how to register controls with the system .
regsvr32 The program is an independent exe, He has independent main function , There are corresponding .c Source file , So click... On the right “Project File List” Button :
Switch to the file list page , Then try this in the search box above Input regsvr32 keyword , It turned out that regsvr32.c Source file :
Double click to enter regsvr32.c In the source file , eureka regsvr32 programmatic main function _tWinMain, Keep looking down _tWinMain Internal implementation of function , See two key points :
One is to call LoadLibraryEx Function to load dll Library , Into LOAD_WITH_ALTERED_SEARCH_PATH Parameters ; The second is to obtain the information in the library DllRegisterServer Interface to register the control with the system .
So later we will load the code of the library from LoadLibrary Switch to LoadLibraryEx( And pass in LOAD_WITH_ALTERED_SEARCH_PATH Parameters ) It will solve our problem .
4、 Last
This article is just a brief introduction to how to create a project , And some details that should be paid attention to in the process of creating the project . The article also introduces how to view the code , And give two practical examples of viewing the code . This article just introduces some main points , For reference only , More details need to be used and discovered by readers themselves .
版权声明
本文为[dvlinker]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231233378300.html
边栏推荐
猜你喜欢
编程辅助工具推荐:图片工具snipaste
实现一个盒子在父盒子中水平垂直居中的几种“姿势”
A graphic designer's fantasy world | ones characters
NPDP | how can product managers not be excluded by programmers?
XinChaCha Trust SSL Organization Validated
Xinwangda announced that the price of battery products had been increased, and the investment of "weixiaoli" exceeded 1 billion
NPDP|产品经理如何做到不会被程序员排斥?
免费试用一个月的服务器,并附上教程
传统企业如何应对数字化转型?这些书给你答案
How to solve the computer system card?
随机推荐
SQL exercise (I)
Flash project cross domain interception and DBM database learning [Baotou cultural and creative website development]
论文解读(CGC)《CGC: Contrastive Graph Clustering for Community Detection and Tracking》
[daily question] chessboard question
BUUCTF WEB [BJDCTF2020]ZJCTF,不过如此
STM32CubeProgrammer基础使用说明
Debug Jest test cases in VSCode, debug Jest test cases in VSCode, middle note basedir=$(dirname "$" (echo "$0" sed -e -e, s, \ \, / "-e").
Luogu p5540 [balkanoi2011] timeismoney | minimum product spanning tree problem solution
Source code analysis of synchronousqueue
Analysis of InnoDB execution process in MySQL
标签与路径
What are the forms of attack and tampering on the home page of the website
Introduction to metalama 4 Use fabric to manipulate items or namespaces
Metalama简介4.使用Fabric操作项目或命名空间
Lesson 23 temporary objects
flask项目跨域拦截处理以及dbm数据库学习【包头文创网站开发】
uni-app 原生APP-本地打包集成极光推送(JG-JPUSH)详细教程
为什么要有包装类,顺便说一说基本数据类型、包装类、String类该如何转换?
Plato Farm-以柏拉图为目标的农场元宇宙游戏
Fastjson 2 is coming, the performance continues to improve, and it can fight for another ten years