电脑互动吧

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

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

[复制链接]
发表于 2013-5-16 20:01:25 | 显示全部楼层 |阅读模式
对于那些可以自行注册的对象链接和嵌入 (OLE) 控件,例如动态链接库 (DLL) 文件或 ActiveX 控件 (OCX) 文件,您可以使用 Regsvr32 工具 (Regsvr32.exe) 来将它们注册和取消注册。
8 ?, i; p: L2 ?7 i/ Z, Y. i' g4 H, D
2 Z  ?6 z1 ?1 ]! PRegsvr32.exe 的用法
- \% |: ?! x) a; n& J& A( x0 m9 w& e" B# s, r# A7 j0 l7 n
RegSvr32.exe 具有以下命令行选项: Regsvr32 [/n] [/i[:cmdline]] dllname / r+ d) t& q! H" v

: U: ~$ q; ^; Y. U   /u - Unregister server<BR/> 5 f: O2 q7 G' S0 n
   /i - Call DllInstall passing it an optional [cmdline];   c' b3 r5 t% F1 i9 \8 P$ A: t
        when used with /u calls dll uninstall - _, v) _  Z5 u3 l& `& R3 ^
   /n - do not call DllRegisterServer; this option must
% [0 \9 g/ X2 H  d$ o" N+ N/ y- `        be used with /i   f' i) P! w& [+ Z  s' H+ }0 |$ Y

8 d4 N) k& X5 x( l+ [1 A+ Z! w; ]7 a当您使用 Regsvr32.exe 时,它会尝试加载该组件并调用它的 DLLSelfRegister 函数。如果此尝试成功,Regsvr32.exe 会显示一个指示成功的对话框。如果此尝试失败,Regsvr32.exe 会返回一条错误消息,其中可能会包括一个 Win32 错误代码。要查看 Win32 错误代码的列表,请参见下面的 Microsoft Web 站点:  9 z! u& ]  t) c
http://msdn.microsoft.com/librar ... n32_error_codes.asp  3 T5 j* B4 L4 A  x- @
. ^, ?# b+ i4 ^( {! B/ S8 [" k
例如,要手动注册 Sample.ocx ActiveX 控件,请在 MS-DOS 提示符处键入以下命令:  7 `9 d( X8 W3 M( M
c:\regsvr32.exe sample.ocx 2 _! W6 w& k. l7 r( p: N, }

; V) A0 Y& a  U9 H% u- |6 s, J- T7 }) vRegsvr32.exe 错误消息 9 ~; u" r3 L  d% H  G
- ?* }% F6 p. I% d5 u  {7 y7 p/ {( i5 `& X
以下列表介绍了 RegSvr32 错误消息和可能的原因。  
- k& }4 i; I) }# u& u! E: Z- d/ X( w/ _5 t6 J% o
Unrecognized flag:/invalid_flag 9 I% i0 g2 P: ~$ m! t5 Q. Y
$ M: a. o& N; p
键入的标志或开关组合无效(请参阅本文中的“Regsvr32.exe 的用法”一节)。  1 b, V, s; p6 `; }. J% x8 o% m8 U

: R: m: a* {* X1 {; |- q* oNo DLL name specified.
+ r% d( y8 w' e* W
) s. S3 @. ~! B3 R3 m; A4 f未包括 .dll 文件名(请参阅本文中的“Regsvr32.exe 的用法”一节)。  9 i" _! q8 Y- I! l) B
) C3 T- V7 T! o
Dllname was loaded, but the DllRegisterServer or DllUnregisterServer entry point was not found. 1 j  h9 g- _; @3 [+ U0 N+ @
* b- ~* n0 k9 N+ W9 a
Dllname 不是 .dll 或 .ocx 文件。例如,键入 regsvr32 wjview.exe 就会生成该错误消息。  ! |" j5 S6 p1 c# o
% E* s5 m0 }! j' }/ i  C
Dllname is not an executable file and no registration helper is registered for this file type. 6 t( a/ _% ~! D" ~% H$ G: v1 [5 H3 ^1 Z. f
: }) O' x4 q- e2 \3 w
Dllname 不是可执行文件(.exe、.dll 或 .ocx)。例如,键入 regsvr32 autoexec.bat 就会生成该错误消息。
, }" ]1 m( [) N2 _) O  D+ D* i. N9 k# ]3 ]" _8 p$ M3 g+ Y$ [; ^. G# {# ]
Dllname was loaded, but the DllRegisterServer or DllUnregisterServer entry point was not found.
! s  I' m& W1 \* r1 n: H7 w  y, Y0 p8 w. x  @' x! @5 ]. y7 ~8 w
Dllname 可能未导出,或者内存中可能有损坏的 Dllname 版本。请考虑使用 Pview 来检测该文件并删除它。  
- T9 w/ P3 Q7 I& n' a
+ k; b* B; y+ Z5 s9 s; p$ W+ JDllname is not self-registerable or a corrupted version is in memory.
  }3 S4 g5 \; S7 b/ S$ ^4 O
/ Q- `4 \- P4 j: F  e例如,键入 regsvr32 icwdial.dll 后就会返回该错误消息,因为 Icwdial.dll 文件不能自行注册。如果您怀疑内存中有损坏的 Dllname 版本,请尝试重新启动计算机,或重新提取该文件的原始版本。如果您运行的是 Windows NT,可能需要使用 Microsoft Windows NT Server 4.0 资源工具包 中的 Kill 或 Pview 工具。有关其他信息,请单击以查看以下 Microsoft 知识库文章:  
- a' c3 O2 |9 N9 \8 _! l3 z197155 如何终止孤立进程  5 P' i, x# V$ C* [
% G" n' Q# `7 h/ d+ [5 L# _7 |9 z
OleInitialize failed (or OleUninitialize failed).
3 s4 \. C# T6 V  q
8 w+ ^+ V6 _/ F7 GRegsvr32 必须先初始化 COM 库,然后才能调用所需的 COM 库函数并在关闭时撤消对该库的初始化。如果对 COM 库进行初始化或撤消初始化的尝试失败,就会出现这些错误消息。例如,Ole32.dll 文件可能已经损坏,或者其版本有误。  
( ?! Z9 \8 M9 U1 U4 B
, T! J5 K* A: iLoadLibrary("Dllname") failed.GetlastError returns 0x00000485
% Y7 Z3 v& v. ~% s9 w& l! D$ [9 ]; K0 [1 P
在 Winerror.h 中,0x00000485 = 1157 (ERROR_DLL_NOT_FOUND),表示“找不到运行该应用程序所需的某个库文件”。例如,键入 regsvr32 missing.dll 后,如果找不到 Missing.dll 文件,就会返回该错误消息。  
* J, v2 j& }, I8 L
+ Y) G1 r9 e& CLoadLibrary("Dllname") failed.GetLastError returns 0x00000002 & d( ?2 v8 @+ ^
3 z; m+ c5 ^4 C% u3 E! S/ S
在 Winerror.h 中,0x00000002 = 2 (ERROR_FILE_NOT_FOUND),表示“系统找不到指定的文件”。换言之,系统找不到相关的 DLL。例如,如果键入 regsvr32 icwdial.dll,而此时缺少 Tapi32.dll(依赖项),就会返回该错误消息。  
  o5 _2 Y% u. t( y' P( o* |4 c+ F; w/ ]8 E4 y! q7 Y8 Y+ H/ p9 R+ Z
LoadLibrary("dskmaint.dll") failed.GetLastError returns 0x000001f
2 y5 |$ j+ ]9 d* [( A
9 S& N7 w! n1 c# r" r5 Z在 Winerror.h 中,0x000001f = 31 (ERROR_GEN_FAILURE),表示“附加到系统上的设备不能正常工作”。如果您尝试注册 Win16 .dll 文件,就会发生此现象。例如,键入 regsvr32 dskmaint.dll 会返回该错误消息。  - {  p$ T7 t3 j3 R2 c
0 W% ]5 N# ?5 U7 Q  `
DllRegisterServer (or DllUnregisterServer)in Dllname failed.返回代码是:字符串 $ H4 L+ H" K0 U$ y/ c. m' w

4 o" ^6 _, O3 `/ E! C在 Winerror.h 中搜索字符串。  
* N9 ?# I, n6 G* M. C( v4 ORegsvr32.exe 和依赖项 - B6 X, S  K" X; M
RegSvr32.exe 依赖于 Kernel32.dll、User32.dll 和 Ole32.dll 文件(在 Windows NT 中,还依赖于 Msvcrt.dll 和 Advapi32.dll 文件)。Regsvr32.exe 会加载您尝试注册或撤消注册的文件及其所有依赖项。如果缺少必需的文件或者它们已损坏,该进程可能会失败。  0 W/ e: Y3 K# U7 F

8 A1 Y2 F6 m8 c) c2 H9 K您可以使用 Depends.exe 来确定您尝试注册或撤消注册的文件的依赖项。在 Microsoft Windows 98 资源工具包 和 Microsoft Windows NT 4.0 资源工具包 支持工具中都提供了 Depends.exe。 + \& @1 _- T  X- B* b  a
247024 Tools Included with the Microsoft Windows 98 Resource Kit  
回复

使用道具 举报

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

本版积分规则

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

浙公网安备 33032402001025号

GMT+8, 2026-5-1 05:12 , Processed in 0.052356 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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