Skip to content
⌘ NSIS Forum Archive

RegDll and ERRO_SUCCESS

6 posts

Anders Hydén#

RegDll and ERRO_SUCCESS

I use the RegDLL but it does not work correct. Therefor I want to see the Error flag and to see the ERROR_SUCCESS.
  1. How should that be done?
  2. Is there any examples?
  3. Are there any obvious reasons why it does not function?
Anders#
What does not work? Post some example code.

You can't register a 64-bit dll this way, you must use Library.nsh.

RegDll will fail if the dll depends on some other dll that is not on the system.
Anders Hydén#
Here is my code:

Section "DLL-registrering"
SetOutPath $INSTDIR
RegDLL "$INSTDIR\Programs\DataFlex Reports 2019 Developer Edition API.ocx"
;ERROR_SUCCESS (=0) <<<<< this is not the code, but what I want in order to solve the problem
SectionEnd
It is not 64-bit Dll. and it is not depending on any other DLL.
When I run my project and start the printing, wich the DLL is there for, I get an error:
ActiveX component may not be properly installed or registere. Error code: 0x80040154
If I register the Dll manually with Regsv32 it all works. So I want to get the returncode from the RegDll command.
Anders#
You code does not make much sense, you do SetOutPath $INSTDIR but you access $INSTDIR\Programs!


RegDll is just LoadLibraryEx(path, 0, LOAD_WITH_ALTERED_SEARCH_PATH) + GetProcAddress. If that fails it probably means it could not load your dll.


If your dll depends on something that is not in system32 then you can try:

SetOutPath "$INSTDIR\Programs"
File "DataFlex Reports 2019 Developer Edition API.ocx"
System::Call 'kernel32::AddDllDirectory(w "$INSTDIR\Programs")'
RegDLL "$INSTDIR\Programs\DataFlex Reports 2019 Developer Edition API.ocx" 
You could also try the logging function in https://www.dependencywalker.com/
Anders Hydén#
I still do not get it to work.
My code is now:
System::Call 'kernel32::AddDllDirectory(w "$INSTDIR\Programs")'
RegDLL "$INSTDIR\Programs\DataFlex Reports 2019 Developer Edition API.ocx"
The OCX-file is already in the folder \Programs, so the File-command is not needed.

When I run the regsvr32 manually, I have to run it as Administrator. Could it be that this fails when run in this way?

The Helpfiloe in the Dependencywalker is empty, so I do not know how to run the logging function.
Anders#
I can't tell you if it needs to run as administrator or not, only the developer of that .ocx file knows. Unless it only writes to HKEY_CURRENT_USER, it needs to run as admin.

The logging function is in the Profile menu (IIRC).