views:

50

answers:

3
regsvr32 filename.ax

I just see it said something installed successfully,but what's the whole story?

A: 

regsvr32 registers DLL's and EXEs into the Windows Registry (usually COM Type Libraries, Class IDs, Interface IDs etc). You can use regedit to navigate the registry.

nonnb
But how does it work? What kinda affect does it have?
wamp
+3  A: 

COM that is widely used in Windows relies on registration. A component will provide type libraries, interfaces and classes. Each of these are defined by a GUID to uniquely name them. COM components can also defined ProgID's that are kind of shortcuts to the unwieldy GUID's.

All this information is stored in a special registry hive on the computer named HKEY_CLASSES_ROOT. Use RegEdit.exe to view it. In particular you can find type libraries in HKEY_CLASSES_ROOT\TypeLib, interfaces in HKEY_CLASSES_ROOT\Interface and classes in HKEY_CLASSES_ROOT\CLSID. Some of the information in the registry will contain the path of the actual DLL with the component allowing Windows to locate and load the component when it is requested.

When you install a COM component it is necessary to create the correct registry information. By convention the DLL can provide two exported functions:

When you execute RegSvr32.exe MyComponent.dll the RegSvr32.exe executable will attempt to call DllRegisterServer in MyComponent.dll. The DLL is then supposed to create all the necessary registry entries to allow the component to be used.

In a similar way you can use RegSvr32.exe /u MyComponent.dll to unregister the component. That will remove all the information previously added to the registry.

Windows relies heavily on COM and it is very important that COM registrations are up to date. Unfortunately there is nothing that blocks you from deleting an already registered COM component. This will leave dangling pointers in the registry pointing to the no longer existing DLL. You can't even unregister it since it no longer exists.

Another problem is when two different applications requires different versions of the same component. The registry can only point to one of the two versions, and this may cause one of the applications to fail.

Microsoft has created fixes for these problems. It is much better to provide an installer for the COM component that is able to repair and uninstall the component if it has been deleted. You are also able to create side-by-side installation of the same component in different versions.

Martin Liversage
+1  A: 

It basically calls into your dll (named filename.ax in this case) and call its "DllRegisterServer" method.

In the case of directshow filters, it might "register" those filters in the windows registry so that directshow knows about them.

ex: http://github.com/rdp/directshow-demo-audio-input-source/blob/master/acam/virt_audio_all.cpp#L698 calls http://github.com/rdp/directshow-demo-audio-input-source/blob/master/acam/virt_audio_all.cpp#L631

Though there are more simple versions out there.

rogerdpack