kallan06
7th August 2007 09:08 UTC
PAssDialog + Number.txt
Hi all ! Please i need help :(
It's possible with passDialog to verify serial number with table, .txt or other...
I explain my problem :
I've an .txt file with 1000 serials,
Number
.txt
1111-1111-1111-1111-1111
2222-2222-2222-2222-2222
3333-3333-3333-3333-3333
>......
Is it possible to integrate these 1000 serials in nsis script?
Is it possible with passDialog to compare the serial entered with 1000 serials list? If yes, how ?
Please help me :)
Afrow UK
7th August 2007 15:40 UTC
PassDialog doesn't do the comparing, you have to do it in your NSIS code.
Stu
ClayDowling
7th August 2007 23:32 UTC
kallan06,
Use the file functions to read the data from the file. That will work very well.
Anders
8th August 2007 02:37 UTC
What is going to stop a user from just looking at the text file in $plugins dir(I assume you would put it there) ?
ClayDowling
8th August 2007 02:43 UTC
I would assume that there is nothing to prevent them from doing that. Since decompiling an NSIS script isn't a major challenge either, I would expect cracks of this app to be circulating fairly quickly. It's possible though that it's considered a low-value target.
There is a registration component which I wrote that might be a happier solution. You can find it in the plugins section. I won't claim that it's rock-solid though, just better than a list of valid serials in a text file.
kallan06
8th August 2007 15:24 UTC
that works perfectly if is in MUI
Name "Serial"
>OutFile "Serial.exe"
>## Include headers
>!include MUI.nsh
>!include LogicLib.nsh
>## Pages
>!insertmacro MUI_PAGE_WELCOME
Page custom SerialPageShow SerialPageLeave
>;!define MUI_PAGE_CUSTOMFUNCTION_SHOW ComponentsPageShow
>!insertmacro MUI_PAGE_COMPONENTS
>!insertmacro MUI_PAGE_INSTFILES
>## Languages
>!insertmacro MUI_LANGUAGE English
>## Displays the serial dialog
>Function SerialPageShow
>!insertmacro MUI_HEADER_TEXT "Enter Serial Code" "Enter the software serial code to continue."
>PassDialog:: Dialog Serial
/HEADINGTEXT 'Please enter the serial code located on the software CD case...'
/CENTER
/BOXDASH 12 70 4 ''
/BOXDASH 92 70 4 ''
/BOXDASH 172 70 4 ''
/BOXDASH 252 70 4 ''
/BOX 332 70 4 ''
Pop $R0 # success, back, cancel or error
>FunctionEnd
>## Validate serial numbers
>Function SerialPageLeave
## Pop values from stack
Pop $R0
Pop $R1
Pop $R2
Pop $R3
Pop $R4
## A bit of validation
>;StrCpy '$5' '$R0-$R1-$R2-$R3-$R4'
>StrCpy '$5' '$R0-$R1-$R2-$R3-$R4$\r$\n'
>StrCpy $6 0
Loop:
>IntOp $6 $6 + 1
StrCmp$6 500 Bad ;1 more than the # serials in file
>Push $6 ;line number to read from
File/oname=$PLUGINSDIRserial.txt "Numbers.txt"
>Push "$PLUGINSDIR\serial.txt" ;text file to read
Call ReadFileLine
Pop$0 ;output string (read from file.txt)
>StrCmp $0 $5 Good
Goto Loop
Bad:
>MessageBox MB_OK|MB_ICONEXCLAMATION "The entered username or password is incorrect!"
>Delete "$PLUGINSDIR\serial.txt"
>Abort
Good:
>Delete "$PLUGINSDIR\serial.txt"
>FunctionEnd
>Function ReadFileLine
Exch$0 ;file
Exch
Exch$1 ;line number
Push$2
Push$3
FileOpen$2 $0 r
StrCpy$3 0
Loop:
>IntOp $3 $3 + 1
ClearErrors
FileRead$2 $0
IfErrors+2
StrCmp$3 $1 0 loop
FileClose$2
Pop$3
Pop$2
Pop$1
Exch$0
FunctionEnd
>## Just a dummy section
>Section 'A section'
>SectionEnd
>
You have and idea why "SerialPageLeave" don't display with XPUI mode
anandharaja
7th March 2009 02:17 UTC
iam searching a script like this thanks. hai friend i want a script like this for UltraModernUI Serial number page. please give script.
Manchut
14th February 2013 06:23 UTC
I look this script and somebody know how must look files: serial.txt and numbers.txt? Thanks for help