Old 21st May 2009, 17:28   #1
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
Call::DLL ???

HI there,

I really need help for this section :

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

PHP Code:
Processed 1 filewriting output:
Adding plug-ins initializing function... Done!
Errorresolving install function "Crypto::GeneratePWDSecutityString(v) .EncryptionKey" in unnamed install section (1)
Noteuninstall functions must begin with "un.", and install functions must not
Error 
aborting creation process 
I'm waiting your answers!

Thanks!

Last edited by Inazad; 21st May 2009 at 17:51.
Inazad is offline   Reply With Quote
Old 21st May 2009, 18:21   #2
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
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
Inazad is offline   Reply With Quote
Old 21st May 2009, 19:36   #3
DrO
 
Join Date: Sep 2003
Posts: 27,873
[moderation]
threads merged due to posting in the translation sub-forum as well.
[/moderation]

-daz
DrO is offline   Reply With Quote
Old 22nd May 2009, 09:32   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd May 2009, 11:43   #5
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
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,

Last edited by Inazad; 22nd May 2009 at 12:11.
Inazad is offline   Reply With Quote
Old 22nd May 2009, 13:39   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 22nd May 2009, 13:49   #7
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
Unhappy

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 ?

Last edited by Inazad; 22nd May 2009 at 14:14.
Inazad is offline   Reply With Quote
Old 22nd May 2009, 14:12   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I have edited my post above.

Stu
Afrow UK is offline   Reply With Quote
Old 22nd May 2009, 14:17   #9
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
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

Do you have IM like MSN or Gaim ?

THanks
Inazad is offline   Reply With Quote
Old 22nd May 2009, 14:35   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Where is the dll being extracted to?

Stu
Afrow UK is offline   Reply With Quote
Old 22nd May 2009, 14:49   #11
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
it in the same directory of the .nsi file...

THere is a another place to put it ?

Thanks
Inazad is offline   Reply With Quote
Old 22nd May 2009, 14:57   #12
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 22nd May 2009, 15:10   #13
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
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
Inazad is offline   Reply With Quote
Old 22nd May 2009, 15:31   #14
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
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..
Inazad is offline   Reply With Quote
Old 22nd May 2009, 18:00   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Assuming SetOutPath "$AppData\${Company}\" was the last SetOutPath instruction then you're extracting Crypto.dll there too.

Stu
Afrow UK is offline   Reply With Quote
Old 22nd May 2009, 19:38   #16
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
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,
Inazad is offline   Reply With Quote
Old 23rd May 2009, 11:54   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Extract to $PLUGINSDIR. That's where the System plugin is so it'll find your dll when it's in the same folder.

Stu
Afrow UK is offline   Reply With Quote
Old 23rd May 2009, 17:02   #18
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
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
Inazad is offline   Reply With Quote
Old 25th May 2009, 13:49   #19
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
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,
Inazad is offline   Reply With Quote
Old 25th May 2009, 15:46   #20
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
$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
Afrow UK is offline   Reply With Quote
Old 25th May 2009, 15:49   #21
Inazad
Junior Member
 
Join Date: May 2009
Posts: 12
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.
Inazad 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