应天论坛

 找回密码
 参与我们

QQ登录

只需一步,快速开始

搜索
查看: 1400|回复: 0

[Windows] Why is regsvr32 exiting with code 3?

[复制链接]

276

主题

303

帖子

3197

积分

管理员

湘南小侠客

Rank: 9Rank: 9Rank: 9

积分
3197

优质服务勋章论坛元老

QQ
发表于 2019-6-2 19:11:44 | 显示全部楼层 |阅读模式
A customer had a script to set up a virtual machine, but this call was failing:
regsvr32 /s /n /i:u Awesome.dll
The DLL failed to register, and regsvr32 exited with code 3.
Last time, we saw exit code 3 means that the Load­Library call failed. The customer reported that the error was not consistent, and they’ve been working around it by waiting a little while and retrying the operation. But sometimes, even after a few retries, the operation still fails.
The were running regsvr32 in silent mode, so no error messages were displayed to the user.
According to the table from last time, step 3 is the Load­Library step. Since the problem was random and sometimes cleared up after a few retries, this ruled out systematic errors like copying the file to the wrong directory, or copying the wrong version of the file. Those types of errors would result in the operation failing consistently, rather than randomly.
I suspected that the Load­Library failed because the file was still in use, either because it was still being copied to the VM, or because it was being scanned or blocked by anti-malware software running in the VM.
One option for digging further is to run regsvr32 one last time in non-silent mode, so that the error details are on the screen. They could write an automation client that scrapes the message before dismissing the dialog box. If they go the automation client route, they may as well always run regsvr32 in non-silent mode.
If the team doesn’t have experience with writing automation, they could just set a watchdog on regsvr32. Pick a generous amount of time to cover typical running time of regsvr32 in the success cases. If regsvr32 has not returned by then, then take a screen shot and then terminate the regsvr32proces.
Or they could write their own program that tries to Load­Library their DLL and captures the Get­Last­Error. Run the custom program once the first regsvr32 fails. They could even turn on loader snaps to get extremely detailed information about the Load­Library operation; that information will pinpoint exactly where it went wrong.
Another option is to run regsvr32 under the debugger with loader snaps enabled and tell the debugger to log all output to a file.
cdb -Ggx -logo log.txt regsvr32 /s /n i:u Awesome.dll
If the DLL registers successfully, then delete the log file. If it fails, then save the log file somewhere for analysis.
Yet another possibility is that the exit code of 3 is a red herring. Perhaps something went wrong in a way that led to the C runtime calling the abort() function, which exits the program with code 3.

每次见你穿短裤打领带,还穿个拖鞋,下次再这样穿不要从我家门口过了!
http://gsh.yzqz.cn/CassettePlayer/index.html

天之道,损有余而补不足.人之道则不然,损不足以奉有余.孰能有余以奉天下,唯有道者.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 参与我们

本版积分规则

QQ|Archiver|手机版|小黑屋|应天社区 ( 湘ICP备17015224号 )

GMT+8, 2024-12-22 12:56 , Processed in 0.062500 second(s), 28 queries .

Powered by Discuz!

© 2001-2017 Comsenz Inc.


免责声明:
本站所发布的第三方软件及资源(包括但不仅限于文字/图片/音频/视频等仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢某程序或某个资源,请支持正版软件及版权方利益,注册或购买,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To: admin@yzqz.cn

快速回复 返回顶部 返回列表