RegSvr32.exe的/ n和/ i参数有什么不同? [英] What is the different between /n and /i parameters of RegSvr32.exe?

查看:797
本文介绍了RegSvr32.exe的/ n和/ i参数有什么不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要注册COM服务器,我们在提升模式下运行:

To register a COM server, we run something like in elevated mode:

regsvr32.exe com.dll

要执行每用户注册,请在用户帐户中执行:

To perform per-user registration, execute in user account:

regsvr32.exe /n /i:user com.dll

regsvr32.exe支持以下参数:

regsvr32.exe support these parameters:

/u - Unregister server 
/i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall 
/n - do not call DllRegisterServer; this option must be used with /i 
/s – Silent; display no message boxes (added with Windows XP and Windows Vista)

在Delphi中创建COM服务器时,这些方法导出:

When create a COM server in Delp these methods were exported:

exports
  DllGetClassObject,
  DllCanUnloadNow,
  DllRegisterServer,
  DllUnregisterServer,
  DllInstall;

我注意到这些会发生:


  1. regsvr32.exe com.dll调用DllRegisterServer。

  2. regsvr32.exe / u com.dll调用DllUnregisterServer。

  3. regsvr32.exe / n / i:user com.dll调用DllInstall。

  4. regsvr32.exe / u / n / i:user com.dll

  1. "regsvr32.exe com.dll" invoke DllRegisterServer.
  2. "regsvr32.exe /u com.dll" invoke DllUnregisterServer.
  3. "regsvr32.exe /n /i:user com.dll" invoke DllInstall.
  4. "regsvr32.exe /u /n /i:user com.dll" invoke DllInstall.

我混淆参数/ n和/ i以及DllUnregisterServer和DllInstall。有什么不同吗?

I am confuse with parameters /n and /i as well as DllUnregisterServer and DllInstall. Is there any different?

此外,为什么/ u / n / i:user调用Dllinstall?我注意到HKEY_CURRENT_USER\Software \Classes中的相应注册表项已删除。

Also, why "/u /n /i:user" invoke Dllinstall? I notice the corresponding registry entry in "HKEY_CURRENT_USER\Software\Classes" was removed.

推荐答案

DllInstall()的文档解释了区别:


DllInstall仅用于应用程序的安装和设置。它
不应该被应用程序调用。它的目的类似于
DllRegisterServer或DllUnregisterServer。与这些函数不同,
DllInstall接受一个输入字符串,可以用来指定
种不同的动作。

DllInstall is used only for application installation and setup. It should not be called by an application. It is similar in purpose to DllRegisterServer or DllUnregisterServer. Unlike these functions, DllInstall takes an input string which can be used to specify a variety of different actions. This allows a DLL to be installed in more than one way, based on any criteria that is appropriate.

若要在regsvr32中使用DllInstall,请在
中添加一个/ i标志后跟冒号
(:)和一个字符串。该字符串将作为
pszCmdLine参数传递给DllInstall。如果省略冒号和字符串,pszCmdLine
将设置为NULL。以下示例将用于安装
DLL。

To use DllInstall with regsvr32, add a "/i" flag followed by a colon (:) and a string. The string will be passed to DllInstall as the pszCmdLine parameter. If you omit the colon and string, pszCmdLine will be set to NULL. The following example would be used to install a DLL.

regsvr32 / i:Install_1dllname.dll

regsvr32 /i:"Install_1" dllname.dll

使用
调用DllInstall bInstall设置为TRUE,pszCmdLine设置为Install_1。要卸载
DLL,请使用以下命令:

DllInstall is invoked with bInstall set to TRUE and pszCmdLine set to "Install_1". To uninstall a DLL, use the following:

regsvr32 / u / i:Install_1dllname.dll

regsvr32 /u /i:"Install_1" dllname.dll

对于
,上面的例子,DllRegisterServer或DllUnregisterServer
也将被调用。要仅调用DllInstall,请添加一个/ n标志。

With both of the above examples, DllRegisterServer or DllUnregisterServer will also be called. To call DllInstall only, add a "/n" flag.

regsvr32 / n / i:Install_1dllname.dll

regsvr32 /n /i:"Install_1" dllname.dll

这篇关于RegSvr32.exe的/ n和/ i参数有什么不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆