当前位置:网站首页>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
边栏推荐
- AI 视频云 VS 窄带高清,谁是视频时代的宠儿
- On using go language to create websocket service
- A graphic designer's fantasy world | ones characters
- 基于卷积神经网络的遥感影像分类识别系统
- 【每日一题】棋盘问题
- 一个平面设计师的异想世界|ONES 人物
- php生成json处理中文
- Flash project cross domain interception and DBM database learning [Baotou cultural and creative website development]
- uni-app 原生APP-本地打包集成极光推送(JG-JPUSH)详细教程
- 编程辅助工具推荐:图片工具snipaste
猜你喜欢
随机推荐
BUUCTF WEB [GXYCTF2019]禁止套娃
Buuctf Web [bjdctf2020] zjctf, but so
Qt双缓冲绘图
C set Logo Icon and shortcut icon
Kubernets Getting started tutoriel
I changed to a programmer at the age of 31. Now I'm 34. Let me talk about my experience and some feelings
Windows2008系统如何切换PHP版本
数组---
论文解读(CGC)《CGC: Contrastive Graph Clustering for Community Detection and Tracking》
Luogu p5540 [balkanoi2011] timeismoney | minimum product spanning tree problem solution
对话PostgreSQL作者Bruce:“转行”是为了更好地前行
QT draw image
Hard core parsing promise object (do you know these seven common APIs and seven key questions?)
Jiachen chapter Genesis "inner universe" joint Edition
0基础可以考CPDA数据分析师证书吗
Bert base Chinese Download (SMART)
AI video cloud vs narrowband HD, who is the darling of the video era
Array---
Everything can be expected in the future | one 2022 campus recruitment officially opened
如何防止网站被黑客入侵篡改