Archive: Call::DLL ???


Call::DLL ???
  HI there,

I really need help for this section :


Section -BD   

Call CreateDatabaseAndBasicData

System
::Call 'Crypto::GeneratePWDSecutityString(v) .EncryptionKey'
System::Call 'Crypto::EncodePWDEx(t,t) t(.BdUser,.EncryptionKey)'
System::Call 'Crypto::EncodePWDEx(t,t) t(.BdPass,.EncryptionKey)'

WriteINIStr "$PathIniFile\${IniFile}.INI" "sql" "Nom_Database" $BdName
WriteINIStr"$PathIniFile\${IniFile}.INI" "sql" "IP" $BdHost
WriteINIStr"$PathIniFile\${IniFile}.INI" "sql" "g" $BdUser
WriteINIStr"$PathIniFile\${IniFile}.INI" "sql" "e" $BdPass
WriteINIStr"$PathIniFile\${IniFile}.INI" "sql" "f" $EncryptionKey
WriteINIStr "$PathIniFile\${IniFile}.INI" "sql" "Type" "15632"
>SectionEnd
>
My installer crashes and do not compile with these error log :


Processed 1 file, writing output:

>Adding plug-ins initializing function... Done!
>Error: resolving install function "Crypto::GeneratePWDSecutityString(v) .EncryptionKey" in unnamed install section (1)
>Note: uninstall functions must begin with "un.", and install functions must not
Error- aborting creation process
>
I'm waiting your answers!

Thanks!

Call DLL ??
  Section -BD
Call CreateDatabaseAndBasicData

File Crypto.dll
System::Call 'Crypto::GeneratePWDSecurityString(v) (v).EncryptionKey'
System::Call 'Crypto::EncodePWDEx(t, t) t(.BdUser, .EncryptionKey).BdUser'
System::Call 'Crypto::EncodePWDEx(t, t) t(.BdPass, .EncryptionKey).BdPass'

SectionEnd

There is the declaration of my dll' functions :

string GeneratePWDSecurityString();
string EncodePWDEx(string, string);

My installers is crashing... Don't know why :( Do I have the good syntax because my code compiles well...

Thanks


[moderation]
threads merged due to posting in the translation sub-forum as well.
[/moderation]

-daz


You have to quote that BdUser and EncryptionKey strings if they are strings. If those are actually variables, then replace them with one of the regular variables because that's all System supports.


Do you have an example ??

Because I'm new in this and I want that section works..

I wrote this line of code and my installer crashes :

System::Call 'Crypto::EncodePWDEx(t, t) t(.BdUser, .EncryptionKey).BdUser'

This line takes my var BdUser and EncryptionKey and encode it. I want the result back into BdUser.

There is a way to check if our DLL is correctly builded ?

Thanks,


Like this:
System::Call 'Crypto::EncodePWDEx(t, t) t("$BdUser", "$EncryptionKey").s'
Pop $BdUser

But if that's a .NET dll then you have to call it using the CLR plugin.

For the System plugin you can't just use .BdUser in there for the input/output - you can only use what is specified in the System plugin readme (like r0, R0 etc).

Stu


I wrote my dll in delphi with the Crypto' functions to encrypt data.

Maybe its the code or maybe its the dll... how to know ? :cry:


I have edited my post above.

Stu


I have these lines in my code :
Section -BD
Call CreateDatabaseAndBasicData

File "Crypto.dll"

;System::Call 'Crypto::GeneratePWDSecutityString() .s'

StrCpy $EncryptionKey "oKQ2N0mLjxEX8WT4"
;StrCpy $EncryptionKey ""

System::Call 'Crypto::EncodePWDEx(t, t) t("$BdUser", "$EncryptionKey").s'
Pop $BdUser
;System::Call 'Crypto::EncodePWDEx(t.BdPass, t.EncryptionKey) .BdPass's
;System::Call 'Crypto::EncodePWDEx(t.BdUser,t.EncryptionKey).r0'

WriteINIStr "$PathIniFile\${IniFile}.INI" "sql" "Nom_Database" $BdName
WriteINIStr "$PathIniFile\${IniFile}.INI" "sql" "IP" $BdHost
WriteINIStr "$PathIniFile\${IniFile}.INI" "sql" "g" $BdUser
WriteINIStr "$PathIniFile\${IniFile}.INI" "sql" "e" $BdPass
WriteINIStr "$PathIniFile\${IniFile}.INI" "sql" "f" $EncryptionKey
WriteINIStr "$PathIniFile\${IniFile}.INI" "sql" "Type" "15632"
SectionEnd

Don't know if its the DLL or the code :mad:

Do you have IM like MSN or Gaim ?

THanks


Where is the dll being extracted to?

Stu


it in the same directory of the .nsi file...

THere is a another place to put it ?

Thanks


No, I said where are you extracting to on the user's machine? You have no SetOutPath instruction in that code which is why I ask. You may be extracting it to a location that the System plugin doesn't look in.

Stu


There ??

Section -Main
SetOverwrite try
SetShellVarContext all # Pour tous les utilisateurs
StrCpy $PathIniFile "$AppData\${Company}\${ProjectGroup}\Instances\$TxtInstanceValue"
SetOutPath "$INSTDIR" # Pour copier l'exécutable du service
File "Z:\Application\PRD\${IniFile}.exe"

SetOutPath "$INSTDIR\..\" # Pour copier l'exécutable de configuration du service
File "Z:\Application\PRD\${ConfFile}.exe"

SetOutPath $PathIniFile # Pour copier les fichiers ini
File "${IniFile}.INI"

SetOutPath "$AppData\${Company}\"
File /r "..\..\_Commun\Traduction\*.mo"

CreateShortCut "$DESKTOP\${AppName}.lnk" "$INSTDIR\..\${ConfFile}.exe" "-s$TxtInstanceValue"
SectionEnd

Thanks


This is the top of my code, maybe you'll find what you're searching for ???

!define AppName "Blf Agent Unistim"
!define ProjectGroup "BlfAgent"
!define Company "Komutel"
!define IniFile "BlfAgent_Unistim"
!define ConfFile "BlfAgent_Configuration"

!define ServiceName "BlfAgentUnistim"
!define ServiceDescription "Busy Lamp Field Service"
!define ServiceRegSearch "BlfAgent"

# Variables
Var StartMenuGroup
Var PathIniFile
Var InstanceCount

# General Symbol Definitions
!define REGKEY "SOFTWARE\${AppName}"

# MUI Symbol Definitions
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${REGKEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${AppName}"
!define MUI_UNICON "..\Commun\App_Icons\sit-final.ico"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_LANGDLL_REGISTRY_ROOT HKLM
!define MUI_LANGDLL_REGISTRY_KEY "${REGKEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage

# Included files
!include Sections.nsh
!include MUI2.nsh
!include LogicLib.nsh
!include nsDialogs.nsh
;!include ..\Commun\Crypto.nsh
!include ..\Commun\ServiceLib.nsh
!include ..\Commun\frmInstance.nsh
!include ..\Commun\frmUnInstance.nsh
!include ..\Commun\frmMsde.nsh
!include ..\Commun\frmConfigBd.nsh
!include ..\Commun\frmUnistimConfig.nsh
!include ..\Commun\SqlServerScriptBd.nsh

#________Pages d'installation____________________________________________________________________________________________________
!insertmacro MUI_PAGE_WELCOME
Page custom FrmInstanceShow FrmInstanceClose
Page Custom frmMsdeShow frmMsdeClose
Page Custom frmConfigBdShow frmConfigBdClose
!define MUI_PAGE_CUSTOMFUNCTION_PRE JumpThisPage ;Fonction qui me permet de valider si j'exécute la page suivante
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_PRE JumpThisPage ;Fonction qui me permet de valider si j'exécute la page suivante
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
Page custom frmUnistimConfigServiceShow frmUnistimConfigServiceClose
!insertmacro MUI_PAGE_FINISH
#___________________________________________________________________________________________________________________________

#________Pages de désinstallation__________________________________________________________________________________________________
!insertmacro MUI_UNPAGE_CONFIRM
UninstPage custom un.FrmUnInstanceShow un.FrmUnInstanceClose
!insertmacro MUI_UNPAGE_INSTFILES
#___________________________________________________________________________________________________________________________

# Macro pour les langues
!insertmacro MUI_RESERVEFILE_LANGDLL
!insertmacro MUI_LANGUAGE English
!insertmacro MUI_LANGUAGE French

# Installer attributes
Name "${AppName}"
OutFile "${AppName} Setup.exe"
InstallDir "$PROGRAMFILES\${Company}\${ProjectGroup}\${AppName}\"
CRCCheck on
XPStyle on
ShowInstDetails show
InstallDirRegKey HKLM "${REGKEY}" "Path"
ShowUninstDetails show
RequestExecutionLevel admin



PS: Sorry for the post in double..


Assuming SetOutPath "$AppData\${Company}\" was the last SetOutPath instruction then you're extracting Crypto.dll there too.

Stu


So if the Installer Create a Directory into C:\Program Files\ and the company name is Hello, I have to put my dll into :

C:\Program Files\Hello ?

Thanks,


Extract to $PLUGINSDIR. That's where the System plugin is so it'll find your dll when it's in the same folder.

Stu


OK I'll test it Monday, at my office.

Can we specify an absolute path like :

File "Z:\Dev\Commun\Crypto.dll" ?

Thanks for your support!

JS


I've put the DLL into the $PLUGINSDIR of NSIS.

I don't get error while installing but my DLL do not do his job correctly because I'm getting the string "error" in my INI file ....

There is a way to track or debug a NSIS installer ???

Thanks,


$PLUGINSDIR has nothing to do with the NSIS plugins folder.

Try this:
SetOutPath $PLUGINSDIR
File Crypto.dll

When you use the NSIS plugin call syntax such as System::Call or nsDialogs::Create NSIS actually includes the plugin DLL and extracts it at run-time to $PLUGINSDIR. If you look in your %TEMP% folder you will find a ns*.tmp folder with the DLL files in it. Having said that, for the System plugin to find the DLL you want to call, it either needs to be in PATH (i.e. $SYSDIR) or in the same folder as System.dll ($PLUGINSDIR). Hopefully that makes sense as I don't think you get it!

Stu


I've made an executable in Delphi who do the same as my dll...

Now I just want to call the executable with this following string :

$PathIniFile\${IniFile}.INI

My executable name is : Cypher.exe

Thanks to you.