RegSvr32退出代码文档?
我使用 RegSvr32.exe
注册一个COM服务器并获得下一个退出代码:
I played with RegSvr32.exe
to register a COM Server and got next exit codes:
0
- 正常注册正常的DLL Com Server
0
- when registering properly normal DLL Com Server
3
当尝试注册假的DLL Com Server(简单的文本文件重命名为.DLL
3
- when try registering fake DLL Com Server (simple text file renamed to .DLL
4
- 尝试注册简单的DLL ,不是Com服务器
4
- when try registering simple DLL, not Com Server
问题:在哪里可以找到所有可能的退出代码及其含义的官方(或非官方但不错的)描述?
Question: where I can find official (or non-official but good) description of all possible exit codes and their meaning?
在互联网上搜索没有给我结果,因此我发现这个主题在哪里写出退出代码与Windows系统错误代码相同,但是我不明白为什么当尝试注册不良文件时我正在获取代码= 3
= ERROR_PATH_NOT_FOUND
,注册非COM DLL时 - 4
= ERROR_TOO_MANY_OPEN_F ILES
?
对我来说,这听起来不是逻辑上的。
Search on internet didn't give me result, on SO I found this topic where is written that exit codes are the same with windows system error code, but I didn't understand why then when try registering bad file I am obtaining code = 3
= ERROR_PATH_NOT_FOUND
, and when registering non-COM DLL - 4
= ERROR_TOO_MANY_OPEN_FILES
?
For me it doesn't sound logically.
退出代码没有记录。文档在这里:
The exit codes are not documented. The documentation is here:
- http://technet.microsoft.com/en-us/library/bb490985.aspx
然而,版本REGSVR32.EXE的源代码随Visual Studio 2008一起提供。它的版本为4.0.0,所以与报告版本6的Windows不同。
However, the source code for a version REGSVR32.EXE is shipped with Visual Studio 2008. This gives its version as 4.0.0, so is not the same as the one shipped with windows, which reports version 6.
- http://msdn.microsoft.com/en-us/library/ms177531(v=vs.90).aspx
快速查看显示这些:
#define FAIL_ARGS 1 // Invalid Argument
#define FAIL_OLE 2 // OleInitialize Failed
#define FAIL_LOAD 3 // LoadLibrary Failed
#define FAIL_ENTRY 4 // GetProcAddress failed
#define FAIL_REG 5 // DllRegisterServer or DllUnregisterServer failed.
阅读源代码表明,在任何情况下都不会返回任何其他代码,而不是以上的代码为了成功,这证明它与Windows不一样。
Reading the source code suggests that under no circumstances does it return any other code than the ones above and zero for success, which proves it isn't the same as the Windows one.
我怀疑返回码的区别是如果它与GetProcAddress一样远,那么从它调用的函数返回退出代码,而不是总是返回5。
I suspect that the difference in return codes is if it gets as far as GetProcAddress, it then returns the exit code from the function it calls, instead of just always returning 5.
理想情况下,他们会使用GetLastError获取更有用的退出代码,但是怀疑有太多的工具(例如第三方安装程序),现在依赖于退出代码2-4,更改它太迟了。
Ideally they would have made it use GetLastError to get a more useful exit code, but I suspect there are too many tools (e.g. third party install programs) which now depend on exit codes 2-4, and it is too late to change it.