当前位置:网站首页>MASM32v11编程调用Process32First失败: 程序发出命令,但命令长度不正确
MASM32v11编程调用Process32First失败: 程序发出命令,但命令长度不正确
2022-07-30 14:34:00 【51CTO】
一位网友发来邮件反映说用MASM32写GUI版的netstat-NetViewG.exe不能在Windows 10上运行。
试了一下,NetViewG.exe在Windows 10上运行确实会给出一个出错提示,不能在窗口里显示协议统计信息和当前 TCP/IP 网络连接信息。
原因是NetViewG.exe是2008年写的,所使用的API函数 AllocateAndGetTcpExTableFromStack和AllocateAndGetUdpExTableFromStack, 从Windows 7开始iphlpapi.dll已经不再支持,也就是说NetViewG.exe只能在Windows XP上正常运行。
利用周末空闲更新一下吧。
找了一下,只找到NetViewC.exe的的源代码。
重新汇编连接NetViewC,遇到提示:
这两个函数是在MASM32中是在kernel32.inc定义的,怎么会没定义?
打开kernel32.inc查找:
怎么只有Unicode版本的,没有ANSI版本的?
那就用Unicode版本的看看,汇编连接顺利完成,但程序运行到Process32First()时返回FALSE,增加以下showErrMsg()来获取出错信息:
得到的出错信息是:
估计是用Unicode版本引发的。
上MASM32论坛一看,已经有国外网友rsala发现了这个问题,他指出:MASM32 V11版本中的kernel32.inc和Kernel32.lib中的Module32First / Module32Next and Process32First / Process32Next这两对函数信息存在bug。按照Microsoft MSDN,这两对函数的ANSI版本不是Module32FirstA / Module32NextA nor Process32FirstA / Process32NextA,而是 Module32First / Module32Next and Process32First / Process32Next,在程序中调用以上两对函数的ANSI版时将会出现问题。
热心的网友并且提供了修正的kernel32.inc、Kernel32.lib和kernl32p.inc、kernl32p.lib文件下载。
边栏推荐
- Chapter6 : Has Artificial Intelligence Impacted Drug Discovery?
- ToDesk版本更新,引入RTC传输技术,是否早以替代向日葵远程控制?
- 3 years of software testing experience, the interview requires a monthly salary of 22K, obviously he has memorized a lot of interview questions...
- 5. DOM
- 怎么判断两个字符串是否相等?
- 如何在 TiDB Cloud 上使用 Databricks 进行数据分析 | TiDB Cloud 使用指南
- 使用 protobuf 进行数据序列化
- DocuWare 文件管理与工作流程自动化案例研究——DocuWare 工作流程功能使在家工作的员工能够保持沟通和高效工作,支持混合环境
- v-model组件化编程应用
- 阿里CTO程立:阿里巴巴的开源历程、理念和实践
猜你喜欢
随机推荐
怎么判断两个字符串是否相等?
Chapter6 : Has Artificial Intelligence Impacted Drug Discovery?
LeetCode_数位枚举_困难_233.数字 1 的个数
Fink异步IO的实战(关联维表)
v-model组件化编程应用
Some thoughts on String
智能合约安全——私有数据访问
关于MySQL主从复制的数据同步延迟问题
Our company has used gateway services for 6 years, dynamic routing, authentication, current limiting, etc., a stable batch!
关于容器的小案例
The highest level of wiring in the computer room, the beauty is suffocating
Meta首份元宇宙白皮书9大看点,瞄准80万亿美元市场
Allure Advanced - Dynamically Generate Report Content
00 testers of seasoning after nearly a year, whether to change careers or to learn the software testing students summarized the following heart advice
容器排序案例
Understand the Chisel language. 29. Chisel advanced communication state machine (1) - communication state machine: take the flash as an example
The use and principle of distributed current limiting reduction RRateLimiter
惊艳!京东T8纯手码的Redis核心原理手册,基础与源码齐下
吃透Chisel语言.28.Chisel进阶之有限状态机(二)——Mealy状态机及与Moore状态机的对比
PyQt5快速开发与实战 9.1 使用PyInstaller打包项目生成exe文件









