Old 22nd January 2021, 21:48   #1
Anders Hydén
Junior Member
 
Join Date: Jan 2021
Posts: 10
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 Hydén is offline   Reply With Quote
Old 23rd January 2021, 01:05   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,356
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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 23rd January 2021, 15:27   #3
Anders Hydén
Junior Member
 
Join Date: Jan 2021
Posts: 10
Here is my code:

Quote:
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:
Quote:
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 Hydén is offline   Reply With Quote
Old 24th January 2021, 04:25   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,356
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:

PHP Code:
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/

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 24th January 2021, 16:24   #5
Anders Hydén
Junior Member
 
Join Date: Jan 2021
Posts: 10
I still do not get it to work.
My code is now:
Quote:
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 Hydén is offline   Reply With Quote
Old 24th January 2021, 21:26   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,356
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).

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump