Search code examples
delphidebuggingdlldelphi-xe2regsvr32

how to debug a 64 bit dll registration process made with regsvr32.exe?


i have

Run time Error 216 at ADDRESS

when registering a 64 bit dll built with Delphi XE2 (I have Update 3).

from command prompt I do (note: system32 folder contains the 64bit exe!)

c:\windows\system32\regsvr32.exe My64bitdll.dll

and after a "dll succesfully installed message" i have the runtime error.

I would like to debug the registering process, somehow using Run/Parameters/host.

Could anyone post the correct procedure? In some other questions like this one a bug is mentioned, but it seems fixed now, i have a delphi build older than this one.

Update: Also any comment on the RunTime error is welcome.


Solution

    1. Load the DLL project.
    2. Modify run parameters (Run | Parameters) to specify host app as regsvr32. Note that you may need to use C:\Windows\sysnative path to defeat the 32 bit file system redirector.
    3. Include path to DLL as command line arguments.
    4. Perhaps enable Debug DCUs, in case the error is raised in the Delphi COM self-registration code.

    enter image description here

    Then debug the DLL like any other DLL.

    Runtime error 216 is an access violation.