news 2026/7/7 2:06:54

板凳----------(枯藤 )vs2026+win10(第五章-2)

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
板凳----------(枯藤 )vs2026+win10(第五章-2)

致谢:
VS2026配置x86/x64调用32位和64位汇编语言动态库环境 参考
https://blog.csdn.net/chenyijun/article/details/148952640

Lrvine64.obj 外部库可以在这里下载 链接: https://pan.baidu.com/s/1ljbseUDxpBcG_rrnhAiMEA 提取码: skbd;----------------------------------------;Procedure Prototypes;---------------------------------------- CloseFile PROTO;close afilehandle Clrscr PROTO;clearthescreenCreateOutputFile PROTO;createfileforwriting Crlf PROTO;output carriage-return / linefeed Delay PROTO;delayforn milliseconds DumpMem PROTO;display memory dump DumpRegs PROTO;display register dump GetCommandTail PROTO;get command-line string GetDateTime PROTO,;get systemdateandtimestartTime:PTR QWORD GetMaxXY PROTO;get console rows and columns GetMseconds PROTO;get milliseconds past midnight GetTextColor PROTO;Get the console window's color attributes. Gotoxy PROTO;setthe cursor position IsDigit PROTO;returnZF=1ifAL is a decimal digit MsgBox PROTO;display popup message box MsgBoxAsk PROTO;display popup yes/no question box OpenInputFile PROTO;openfileininput mode ParseDecimal32 PROTO;convert unsigned decimal string to32-bit binary ParseInteger32 PROTO;convert signed decimal string to32-bit binary Randomize PROTO;reseed random number generator RandomRange PROTO;generate random integerinspecified range Random32 PROTO;generate32-bit random integer ReadInt PROTO;readsigned decimal integer from console ReadChar PROTO;reach single character from console ReadDec PROTO;readunsigned decimal integer from console ReadFloat PROTO;readfloating-point value from keyboard ReadFromFile PROTO;readbuffer from inputfileReadHex PROTO;readhexadecimal integer from console ReadKey PROTO;Reads keyboard inputifavailable(4/6/03)ReadKeyFlush PROTO;Flush ReadKey buffer and repeat counter(4/6/03)ReadString PROTO;readstring from console SetTextColor PROTO;setconsole text color ShowFPUStack PROTO;writefloating-point stack to console window StrLength PROTO;returns the length of a string WaitMsg PROTO;displaywaitmessage,waitforEnter key WriteBin PROTO;writeinteger to outputinbinaryformatWriteBinB PROTO;writebinary integerinbyte, word,or doublewordformatWriteChar PROTO;writesingle character to output WriteDec PROTO;writeunsigned decimal integer to output WriteFloat PROTO;writeST(0)to consoleinfloating-pointformatWriteHex PROTO;writehexadecimal integer to output WriteHexB PROTO;writehexadecimal integerinword or doublewordformatWriteInt PROTO;writesigned integer to output;WriteStackFrame;writestack frame data(James Brink--see proto laterinthisfile);WriteStackFrameName;writestack frame data with proc name(James Brink)WriteString PROTO;writenull-terminated string to output WriteToFile PROTO;writea buffer to an outputfileWriteWindowsMsg PROTO;writelast error message generated by MS-Windows
;call32lib.asm INCLUDE Irvine32.inc .data filename BYTE"newfile.txt",0 array DWORD1,2,3,4,5,6,7,8,9,0Ah,0Bh .code main PROC;==========等待,清屏===========;call Crlf;call Clrscr;call WaitMsg;"Press any key...";===========创建新文件==========;mov edx, OFFSET filename;call CreateOutputFile;=============暂停2秒=========;mov eax,2000;2;call Delay;============产生十六进制形式显示内存一段数据===;mov esi, OFFSET array;mov ecx, LENGTHOF array;mov ebx, TYPE array;call DumpMem;=========十六进制形式显示寄存器和EFLAGS内容===;CALL DumpRegs INVOKE ExitProcess,0main ENDP END main
INCLUDE Irvine32.inc;加密密钥 KEY=5.data;待加密数组 array DWORD1,2,3,4,5,6,7,8,9,0Ah,0Bh;提示信息 msgBefore BYTE"加密前数组:",0 msgAfter BYTE"加密后数组:",0 .code main PROC;==========显示加密前数组==========mov edx, OFFSET msgBefore call WriteString call Crlf mov esi, OFFSET array;数组首地址 mov ecx, LENGTHOF array;数组长度(循环次数) call PrintArray;调用打印数组过程;==========调用加密过程==========mov esi, OFFSET array;传递数组首地址 mov ecx, LENGTHOF array;传递数组长度 call Encrypt;调用加密过程(无直接参数,通过寄存器传参);==========显示加密后数组==========mov edx, OFFSET msgAfter call WriteString call Crlf mov esi, OFFSET array mov ecx, LENGTHOF array call PrintArray;退出程序 INVOKE ExitProcess,0main ENDP;==========自定义加密过程(异或加密)==========;输入:ESI=数组首地址,ECX=数组长度;功能:对DWORD数组每个元素异或KEY加密 Encrypt PROC push esi;保护寄存器(可选) push ecx EncryptLoop: xor DWORD PTR[esi], KEY;数组元素异或密钥addesi,4;下一个DWORD元素(4字节) loop EncryptLoop pop ecx pop esi ret Encrypt ENDP;==========辅助:打印DWORD数组==========;输入:ESI=数组首地址,ECX=数组长度 PrintArray PROC push esi push ecx PrintLoop: mov eax,[esi];取当前元素 call WriteDec;打印十进制数 mov al,' ';空格分隔 call WriteCharaddesi,4;下一个元素 loop PrintLoop call Crlf;换行 pop ecx pop esi ret PrintArray ENDP END main========================加密前数组:1234567891011加密后数组:476103213121514

INCLUDE Irvine32.inc .data cmdTail BYTE129DUP(0);空缓冲区 .code main PROC mov edx, OFFSET cmdTail call GetCommandTail;填充缓冲区 INVOKE ExitProcess,0 main ENDP ———————————————— 原文链接:https://blog.csdn.net/chenyijun/article/details/148927787



核心结论
cmdTail BYTE 129 DUP(0) 的内存布局规则:
0x00406038 是 cmdTail 的起始地址;
从 0x00406038 开始,连续占用 129 个字节的内存空间(这 129 字节就是 129 DUP(0) 对应的内容);
这些字节会「紧挨着」起始地址向后排布,没有间隔。
结合你的截图验证
从内存 2 窗口能看到:
起始地址 0x00406038 开始,前几个字节存储了 file1.txt file2.txt(ASCII 码:66 69 6C 65 31 2E 74 78 74 20 66 69 6C 65 32 2E 74 78 74);
后续字节直到 0x00406038 + 128(因为从 0 开始计数,129 字节的最后一个地址是 0x00406038 + 128 = 0x004060B9),全部填充为 00(对应 DUP(0) 的初始化值)。
直观的地址范围
cmdTail 的完整内存范围:
起始地址:0x00406038
结束地址:0x00406038 + 128 = 0x004060B9
这之间的 129 个字节,就是 129 DUP(0) 对应的全部内容(即使前半部分被赋值为 file1.txt file2.txt,未赋值的部分仍保留初始值 00)。
补充说明
DUP(0) 是汇编的「重复初始化」语法:
129 DUP(0) 表示「连续分配 129 个字节,每个字节初始值为 0」;
程序运行时如果给前 N 个字节赋值(比如写入 file1.txt file2.txt),剩余的 129 - N 个字节仍保持 00,但它们依然属于 cmdTail 的内存空间,且紧挨着已赋值的部分。
简单总结:129 DUP(0) 的内容就是从 0x00406038 开始,向后连续 129 个字节的区域,没有任何空隙。

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/7/7 2:47:34

车载系统开发:DeepSeek 辅助编写 ADAS 功能需求文档与测试用例

车载ADAS功能开发:需求文档与测试用例编写指南引言随着汽车智能化水平的不断提升,高级驾驶辅助系统已成为现代车辆不可或缺的核心组成部分。ADAS通过融合传感器、控制器和执行器,为驾驶员提供预警、辅助控制甚至部分自动化功能,显…

作者头像 李华
网站建设 2026/7/7 4:31:53

数据库设计全景指南:从核心原则到现代分布式实践

数据库设计全景指南:从核心原则到现代分布式实践 数据库设计是任何成功软件系统的基石。一个优秀的数据库设计不仅保证数据的准确性与完整性,也直接影响系统性能、可扩展性和维护成本。本指南提供一份全面、详尽的数据库设计详解,涵盖核心原则、设计流程、九大核心策略、现…

作者头像 李华
网站建设 2026/7/7 8:54:33

Java MQTT 开发方案全景对比与实践指南

Java MQTT 开发方案全景对比与实践指南 MQTT(Message Queuing Telemetry Transport)作为轻量级物联网消息协议,在 Java 生态中应用广泛。无论是传统后端应用,还是云端物联网平台,选择合适的 MQTT 客户端或集成方案都是项目成功的关键。本文将从核心库、Spring生态集成、云…

作者头像 李华
网站建设 2026/7/7 0:22:39

4.1.17.4.MySQL索引

1.索引为什么会加快查询?数据库文件是存储在磁盘上的,磁盘 I/O 是数据库操作中最耗时的部分之一。没有索引时,数据库会进行全表扫描(Sequential Scan),这意味着它必须读取表中的每一行数据来查找匹配的行&a…

作者头像 李华
网站建设 2026/7/6 18:39:04

三.网络版通讯录

一.回顾 上篇博客链接: https://blog.csdn.net/weixin_60668256/article/details/155931223?fromshareblogdetail&sharetypeblogdetail&sharerId155931223&sharereferPC&sharesourceweixin_60668256&sharefromfrom_link 二.环境搭建 源码库地址&#xf…

作者头像 李华
网站建设 2026/7/7 13:29:03

解决unable to connect to anthropic services问题,专注本地化Qwen图像编辑

解决 unable to connect to anthropic services 问题,专注本地化 Qwen 图像编辑 在电商运营、内容创作和数字营销的一线实践中,图像处理早已不再是“修图师Photoshop”的专属战场。如今,一个爆款商品图的诞生往往需要经历数十次微调&#xff…

作者头像 李华