Are /RegServer
and /RegSvr
the same or different, if different why/how?
For example I have seen (example from a 32-bit OS) this style:
RegSvr32 COM.exe
or
RegSvr32 COM.dll
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 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.
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 servers can be run directly, so this is what you do passing them /regserver or /unregserver parameters.
The methods are valid for 32- and 64-bit COM servers, for 32- and 64-bit operating systems.
Further reading - Self-Registration:
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With