电脑互动吧

 找回密码
 注册
查看: 8856|回复: 0

[技术资讯] Regsvr32 用法和错误消息的说明

[复制链接]
发表于 2013-5-16 20:01:25 | 显示全部楼层 |阅读模式
对于那些可以自行注册的对象链接和嵌入 (OLE) 控件,例如动态链接库 (DLL) 文件或 ActiveX 控件 (OCX) 文件,您可以使用 Regsvr32 工具 (Regsvr32.exe) 来将它们注册和取消注册。; W+ j# i5 F6 m3 C% t$ d
6 ^8 e! q. G3 p& Q& r" p1 S
Regsvr32.exe 的用法
- e9 R* \8 M' q" ?2 h4 C# F/ V( U6 U6 s4 k7 p1 Z1 |
RegSvr32.exe 具有以下命令行选项: Regsvr32 [/n] [/i[:cmdline]] dllname ' E/ V" A$ Y+ H6 P( }

6 r$ K6 R9 U& P( t, @   /u - Unregister server<BR/>
/ \0 H( M8 B- V$ j8 b   /i - Call DllInstall passing it an optional [cmdline];
; e; H' I- U6 O        when used with /u calls dll uninstall
0 I/ v7 Q. V2 K$ Q8 }- [) G1 W6 f  l$ J   /n - do not call DllRegisterServer; this option must
7 t' n. C: l/ i) c) `7 B  I        be used with /i
' F" B3 R; V) D! A5 g- W; S, c
/ s% N8 m5 M7 G- Z当您使用 Regsvr32.exe 时,它会尝试加载该组件并调用它的 DLLSelfRegister 函数。如果此尝试成功,Regsvr32.exe 会显示一个指示成功的对话框。如果此尝试失败,Regsvr32.exe 会返回一条错误消息,其中可能会包括一个 Win32 错误代码。要查看 Win32 错误代码的列表,请参见下面的 Microsoft Web 站点:  
  X6 J6 A) U! w+ f' l& Fhttp://msdn.microsoft.com/librar ... n32_error_codes.asp  
# b6 B$ z8 ]! x% K1 C, K) B" _% g0 q; C2 ^) J9 i/ `8 A
例如,要手动注册 Sample.ocx ActiveX 控件,请在 MS-DOS 提示符处键入以下命令:  ' |2 g9 I$ i0 U8 Y
c:\regsvr32.exe sample.ocx 1 n2 ]: L) v3 V( W4 [
" I" ]. d, t5 p
Regsvr32.exe 错误消息
3 ~0 e; P2 \' R5 u
+ h% w( j: g0 F% w, r以下列表介绍了 RegSvr32 错误消息和可能的原因。  1 a) F7 \* W7 s# H# A

* v2 h$ ]2 @, ?3 K, YUnrecognized flag:/invalid_flag " F. P2 ^0 ]; f3 p# g" B

8 Y! X4 A8 R) g0 g键入的标志或开关组合无效(请参阅本文中的“Regsvr32.exe 的用法”一节)。  
4 P: o+ Q$ [8 F4 C' \; V7 a& D' j" ~" f1 @7 p  o" Y; N
No DLL name specified.
1 i$ k6 [! K! b0 F2 y, a3 J3 W2 U6 b' |4 }
未包括 .dll 文件名(请参阅本文中的“Regsvr32.exe 的用法”一节)。  
/ W, z1 y/ V+ Y1 X. ^
+ a/ ~* O: [+ w! z2 V8 \" ^- xDllname was loaded, but the DllRegisterServer or DllUnregisterServer entry point was not found.
9 x2 H. F/ o. W$ a- t" D# y3 ^* ~; v5 V. Y9 S
Dllname 不是 .dll 或 .ocx 文件。例如,键入 regsvr32 wjview.exe 就会生成该错误消息。  4 ]/ u- O: a7 d1 k. t" I

; m6 U* c; B- rDllname is not an executable file and no registration helper is registered for this file type. 7 \: R0 }' I, W" `* N
* d6 u  l/ n+ P4 z4 Y8 Y7 i' r
Dllname 不是可执行文件(.exe、.dll 或 .ocx)。例如,键入 regsvr32 autoexec.bat 就会生成该错误消息。 4 w, m. h9 ]. H* |

# Z; B  ~0 v) pDllname was loaded, but the DllRegisterServer or DllUnregisterServer entry point was not found. . A6 B! M% {0 ~% D- l! M

! c% \; l' ^! V5 X  ?' jDllname 可能未导出,或者内存中可能有损坏的 Dllname 版本。请考虑使用 Pview 来检测该文件并删除它。  0 X' t' `) A( W0 G4 W7 j) n
4 C+ s3 x& a0 g3 a! N
Dllname is not self-registerable or a corrupted version is in memory.
. h( T; L/ S+ ~5 z. w1 E4 Z' T( L2 T" c% d
例如,键入 regsvr32 icwdial.dll 后就会返回该错误消息,因为 Icwdial.dll 文件不能自行注册。如果您怀疑内存中有损坏的 Dllname 版本,请尝试重新启动计算机,或重新提取该文件的原始版本。如果您运行的是 Windows NT,可能需要使用 Microsoft Windows NT Server 4.0 资源工具包 中的 Kill 或 Pview 工具。有关其他信息,请单击以查看以下 Microsoft 知识库文章:  
! W$ l/ b! ]$ Y' H8 [) Z# Q% n* D& Q! P197155 如何终止孤立进程  * D: ]! F' u9 a2 j* ]/ N* }* |
$ r- P) g0 Y: w6 m! Y+ S/ M
OleInitialize failed (or OleUninitialize failed). , c+ x# P! J  N2 b5 i2 T5 M

9 s, d  i6 x6 N, ZRegsvr32 必须先初始化 COM 库,然后才能调用所需的 COM 库函数并在关闭时撤消对该库的初始化。如果对 COM 库进行初始化或撤消初始化的尝试失败,就会出现这些错误消息。例如,Ole32.dll 文件可能已经损坏,或者其版本有误。  " I4 G- b" p- _" c
8 w- l8 x* p* B" I8 X
LoadLibrary("Dllname") failed.GetlastError returns 0x00000485 / e/ z$ ]; n) |+ e$ s

' j+ t! r+ g: T( T在 Winerror.h 中,0x00000485 = 1157 (ERROR_DLL_NOT_FOUND),表示“找不到运行该应用程序所需的某个库文件”。例如,键入 regsvr32 missing.dll 后,如果找不到 Missing.dll 文件,就会返回该错误消息。  
# s* j/ t, A' \; T5 U, t+ m, k% S! `/ [* j- f( \5 p- ]) H. a' }1 n, ^
LoadLibrary("Dllname") failed.GetLastError returns 0x00000002
: @4 n) |2 x7 o
) y% P% g% E& R8 a) @8 r" S0 c在 Winerror.h 中,0x00000002 = 2 (ERROR_FILE_NOT_FOUND),表示“系统找不到指定的文件”。换言之,系统找不到相关的 DLL。例如,如果键入 regsvr32 icwdial.dll,而此时缺少 Tapi32.dll(依赖项),就会返回该错误消息。  9 E1 k- L6 B8 v( w% x- [/ E

. \# ^3 L2 e0 l2 W( l: b7 nLoadLibrary("dskmaint.dll") failed.GetLastError returns 0x000001f 5 u( V% j4 q; Y- a  Z
/ Q3 U9 J; @- q3 u! a- N
在 Winerror.h 中,0x000001f = 31 (ERROR_GEN_FAILURE),表示“附加到系统上的设备不能正常工作”。如果您尝试注册 Win16 .dll 文件,就会发生此现象。例如,键入 regsvr32 dskmaint.dll 会返回该错误消息。  
& X' X0 P! u' U! e6 L. x$ m! z# d* P1 R3 F( _: B/ E: J! D9 ^
DllRegisterServer (or DllUnregisterServer)in Dllname failed.返回代码是:字符串
' z7 @! n  z/ z& H
/ q: i9 b( \/ t在 Winerror.h 中搜索字符串。  
9 p' p7 V, \* G* J* wRegsvr32.exe 和依赖项 ' U0 [, C) _; w, D8 y1 P( i3 F
RegSvr32.exe 依赖于 Kernel32.dll、User32.dll 和 Ole32.dll 文件(在 Windows NT 中,还依赖于 Msvcrt.dll 和 Advapi32.dll 文件)。Regsvr32.exe 会加载您尝试注册或撤消注册的文件及其所有依赖项。如果缺少必需的文件或者它们已损坏,该进程可能会失败。  ) e. B& M. I) F3 n- z  s

' N' B' D( P! x- Z; x  J您可以使用 Depends.exe 来确定您尝试注册或撤消注册的文件的依赖项。在 Microsoft Windows 98 资源工具包 和 Microsoft Windows NT 4.0 资源工具包 支持工具中都提供了 Depends.exe。
- h. N# N6 W$ Y$ a# B& p  }3 D247024 Tools Included with the Microsoft Windows 98 Resource Kit  
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系我们|手机版|小黑屋|Archiver|电脑互动吧 ( 浙ICP备13037409号 )

浙公网安备 33032402001025号

GMT+8, 2026-8-1 07:00 , Processed in 0.223319 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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