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

查看:21
本文介绍了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"调用 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_USERSoftwareClasses"中相应的注册表项已被删除.

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

推荐答案

DllInstall() 的文档 解释了不同之处:

DllInstall 仅用于应用程序安装和设置.它不应由应用程序调用.它的目的类似于DllRegisterServer 或 DllUnregisterServer.与这些功能不同,DllInstall 接受一个输入字符串,该字符串可用于指定一个各种不同的动作.这允许将 DLL 安装在不止一种方式,基于任何适当的标准.

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.

要将 DllInstall 与 regsvr32 一起使用,请添加一个/i"标志,后跟一个冒号(:) 和一个字符串.该字符串将作为pszCmdLine 参数.如果省略冒号和字符串,pszCmdLine将被设置为 NULL.以下示例将用于安装动态链接库.

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_1" dllname.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_1" dllname.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_1" dllname.dll

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

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

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