Search code examples
winapicomvb6cmdregsvr32

difference between regsvr32 with /i and without parameter


I am able to register a COM-DLL (written in VB6) dowFct.dll succesfully with

regsvr32 dowFct.dll

But when I try to do it with

regsvr32 dowFct.dll /i

I am getting the Error (translated from german to english):

The module dowfct.dll was loaded but the DllInstall entry point was not found.

I am asking me, if it is not the same to use regsvr32 with /i and without any additional parameter? Can someone help me in this case whats going wrong? - Thanks.


Solution

    • Without the /i option, regsvr32 loads the DLL and calls the exported function DllRegisterServer.
    • With the /i option, regsvr32 loads the DLL and calls the exported function DllInstall.

    Clearly your DLL does not export DllInstall and so it would seem likely that it expects to be registered by a call to DllRegisterServer. So, omit the /i option when calling regsvr32.

    The documentation for DllInstall explains the difference between these two functions:

    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.

    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

    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

    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