Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 7th August 2007, 08:08   #1
kallan06
Junior Member
 
Join Date: Jul 2007
Posts: 20
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,
PHP Code:
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
kallan06 is offline   Reply With Quote
Old 7th August 2007, 14:40   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
PassDialog doesn't do the comparing, you have to do it in your NSIS code.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 7th August 2007, 22:32   #3
ClayDowling
Junior Member
 
Join Date: Nov 2005
Location: Flint, MI
Posts: 21
Send a message via AIM to ClayDowling
kallan06,

Use the file functions to read the data from the file. That will work very well.
ClayDowling is offline   Reply With Quote
Old 8th August 2007, 01:37   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,779
What is going to stop a user from just looking at the text file in $plugins dir(I assume you would put it there) ?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 8th August 2007, 01:43   #5
ClayDowling
Junior Member
 
Join Date: Nov 2005
Location: Flint, MI
Posts: 21
Send a message via AIM to ClayDowling
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.
ClayDowling is offline   Reply With Quote
Old 8th August 2007, 14:24   #6
kallan06
Junior Member
 
Join Date: Jul 2007
Posts: 20
that works perfectly if is in MUI

PHP Code:
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 $$1
StrCmp 
$6 500 Bad ;1 more than the # serials in file
Push $;line number to read from 
File 
/oname=$PLUGINSDIRserial.txt "Numbers.txt"
Push "$PLUGINSDIR\serial.txt" ;text file to read 
Call ReadFileLine 
Pop 
$;output string (read from file.txt
StrCmp $$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 
$;file
Exch
Exch 
$;line number
Push 
$2
Push 
$3

  FileOpen 
$$0 r
 StrCpy 
$3 0
Loop
:
 
IntOp $$1
  ClearErrors
  FileRead 
$$0
  IfErrors 
+2
 StrCmp 
$$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
kallan06 is offline   Reply With Quote
Old 7th March 2009, 01:17   #7
anandharaja
Member
 
Join Date: Mar 2009
Posts: 50
iam searching a script like this thanks. hai friend i want a script like this for UltraModernUI Serial number page. please give script.
anandharaja is offline   Reply With Quote
Old 14th February 2013, 05:23   #8
Manchut
Junior Member
 
Join Date: Oct 2012
Posts: 21
I look this script and somebody know how must look files: serial.txt and numbers.txt? Thanks for help
Manchut is offline   Reply With Quote
Reply
Go Back   Winamp 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