RegSvr和RegServer有什么区别? [英] What is difference between RegSvr and RegServer?

查看:364
本文介绍了RegSvr和RegServer有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

/ RegServer / RegSvr 是否相同或不同,如果不同,为什么/如何?

Are /RegServer and /RegSvr the same or different, if different why/how?

例如,我见过(例如从32位操作系统中)这种样式:

For example I have seen (example from a 32-bit OS) this style:

RegSvr32 COM.exe

RegSvr32 COM.dll

或者作为替代方案(在64位操作系统上):

Or as an alternative (which was on a 64-bit OS):

COM.exe /RegServer
COM.exe /RegSvr

这些不同的方法是否在做相同的事情?

Are these different approaches doing the same thing?

推荐答案

COM服务器在32位64位操作系统中的注册方式相同。这个问题与自我注册有关,这是注册COM服务器的最直接方法-通过要求服务器分别更新HKLM / HKCR注册中心。

COM servers are registered the same way in 32- bit 64-bit operating systems. The question is related to self-registration, the most straightforward way to register COM server - by asking the server to update HKLM/HKCR registry respectively.

由于您无法运行直接使用DLL,您可以使用辅助程序 regsvr32 应用程序。长话短说,它看起来是DLL是32位还是64位,并使用应用程序的相应版本。然后它会加载DLL并传递控制权来进行注册。

As you cannot run a DLL directly, you use a helper regsvr32 application. To cut long story short it looks whether DLL is 32- or 64-bit and uses respective version of the application. Then it loads the DLL and passes control to do registration.

EXE COM服务器可以直接运行,因此您可以通过它们传递/ regserver或/ unregserver参数。

EXE COM servers can be run directly, so this is what you do passing them /regserver or /unregserver parameters.

该方法对32位和64位COM服务器,32位和64位操作系统有效。

The methods are valid for 32- and 64-bit COM servers, for 32- and 64-bit operating systems.

进一步阅读-自动注册


如果服务器打包在DLL模块中,则DLL必须导出函数DllRegisterServer和DllUnregisterServer。任何希望指示服务器进行自身注册的应用程序(即其所有CLSID和类型库ID)都可以通过GetProcAddress函数获得指向DllRegisterServer的指针。在DllRegisterServer中,DLL创建所有必需的注册表项,为所有InprocServer32或InprocHandler32项存储DLL的正确路径。

If the server is packaged in a DLL module, the DLL must export the functions DllRegisterServer and DllUnregisterServer. Any application that wishes to instruct the server to register itself (that is, all its CLSIDs and type library IDs) can obtain a pointer to DllRegisterServer through the GetProcAddress function. Within DllRegisterServer, the DLL creates all its necessary registry entries, storing the correct path to the DLL for all InprocServer32 or InprocHandler32 entries.

当应用程序希望从中删除组件时在系统上,它应该通过调用DllUnregisterServer来取消注册该组件。在此调用中,服务器将完全删除它先前在DllRegisterServer中创建的那些条目。服务器不应盲目删除其类的所有条目,因为其他软件可能已经存储了其他条目,例如TreatAs密钥。

When an application wishes to remove the component from the system, it should unregister that component by calling DllUnregisterServer. Within this call, the server removes exactly those entries it previously created in DllRegisterServer. The server should not blindly remove all entries for its classes because other software may have stored additional entries, such as a TreatAs key.

如果服务器打包在EXE模块中,则希望注册服务器的应用程序将使用命令行参数/ RegServer或-RegServer(不区分大小写)启动EXE服务器。如果应用程序希望注销服务器,它将使用命令行参数/ UnregServer或-UnregServer启动EXE。自注册EXE会检测到这些命令行参数,并分别调用与DLL在DllRegisterServer和DllUnregisterServer中的DLL相同的操作,将其模块路径注册在LocalServer32而不是InprocServer32或InprocHandler32下。

If the server is packaged in an EXE module, the application wishing to register the server launches the EXE server with the command-line argument /RegServer or -RegServer (case-insensitive). If the application wishes to unregister the server, it launches the EXE with the command-line argument /UnregServer or -UnregServer. The self-registering EXE detects these command-line arguments and invokes the same operations as a DLL would within DllRegisterServerand DllUnregisterServer, respectively, registering its module path under LocalServer32 instead of InprocServer32 or InprocHandler32.

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

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