|
21 | 21 | !include "Utf8Converter.nsh"
|
22 | 22 |
|
23 | 23 | !include "WinVer.nsh"
|
24 |
| - |
| 24 | +!include "Ports.nsh" |
25 | 25 | !insertmacro VersionCompare
|
26 | 26 |
|
27 | 27 | ;--------------------------------
|
@@ -746,45 +746,57 @@ Function ChecExistInstall
|
746 | 746 | ${if} $1 != ""
|
747 | 747 | StrCpy $Locale_text $1
|
748 | 748 | ${endif}
|
749 |
| - |
750 |
| - ; calculate free num port - use EnumRegKey |
| 749 | + |
| 750 | + ; tcp-port auto selector |
751 | 751 | ${if} $TextPort_text == ""
|
752 |
| - ; todo: compatibility with pg-installers family |
753 |
| - StrCpy $0 0 |
754 |
| - StrCpy $2 5432 |
755 |
| - |
756 |
| - ;SetRegView 32 |
757 |
| - SetRegView 64 |
758 |
| - ${While} 1 = 1 |
759 |
| - EnumRegKey $1 HKLM "SOFTWARE\PostgreSQL\Services" $0 |
760 |
| - ${if} $1 == "" |
761 |
| - ${ExitWhile} |
762 |
| - ${endif} |
763 |
| - ReadRegDWORD $3 HKLM "SOFTWARE\PostgreSQL\Services\$1" "Port" |
764 |
| - ${if} $3 >= $2 |
765 |
| - IntOp $2 $3 + 1 |
766 |
| - ${endif} |
767 |
| - IntOp $0 $0 + 1 |
768 |
| - ${EndWhile} |
769 |
| - SetRegView 32 |
770 |
| - StrCpy $0 0 |
771 |
| - ${While} 1 = 1 |
772 |
| - EnumRegKey $1 HKLM "SOFTWARE\PostgreSQL\Services" $0 |
773 |
| - ${if} $1 == "" |
774 |
| - ${ExitWhile} |
775 |
| - ${endif} |
776 |
| - ReadRegDWORD $3 HKLM "SOFTWARE\PostgreSQL\Services\$1" "Port" |
777 |
| - ${if} $3 >= $2 |
778 |
| - IntOp $2 $3 + 1 |
| 752 | + StrCpy $TextPort_text 5432 |
| 753 | + ${while} 1 = 1 |
| 754 | + ${if} ${TCPPortOpen} $TextPort_text |
| 755 | + IntOp $TextPort_text $TextPort_text + 1 |
| 756 | + ${else} |
| 757 | + ${exitwhile} |
779 | 758 | ${endif}
|
780 |
| - |
781 |
| - IntOp $0 $0 + 1 |
782 |
| - ${EndWhile} |
783 |
| - |
784 |
| - ${if} $IsTextPortInIni != 1 ;port can be send in ini file |
785 |
| - StrCpy $TextPort_text $2 |
786 |
| - ${endif} |
| 759 | + ${endwhile} |
787 | 760 | ${endif}
|
| 761 | + |
| 762 | + ; calculate free num port - use EnumRegKey |
| 763 | + ; ${if} $TextPort_text == "" |
| 764 | + ; ; todo: compatibility with pg-installers family |
| 765 | + ; StrCpy $0 0 |
| 766 | + ; StrCpy $2 5432 |
| 767 | + |
| 768 | + ; ;SetRegView 32 |
| 769 | + ; SetRegView 64 |
| 770 | + ; ${While} 1 = 1 |
| 771 | + ; EnumRegKey $1 HKLM "SOFTWARE\PostgreSQL\Services" $0 |
| 772 | + ; ${if} $1 == "" |
| 773 | + ; ${ExitWhile} |
| 774 | + ; ${endif} |
| 775 | + ; ReadRegDWORD $3 HKLM "SOFTWARE\PostgreSQL\Services\$1" "Port" |
| 776 | + ; ${if} $3 >= $2 |
| 777 | + ; IntOp $2 $3 + 1 |
| 778 | + ; ${endif} |
| 779 | + ; IntOp $0 $0 + 1 |
| 780 | + ; ${EndWhile} |
| 781 | + ; SetRegView 32 |
| 782 | + ; StrCpy $0 0 |
| 783 | + ; ${While} 1 = 1 |
| 784 | + ; EnumRegKey $1 HKLM "SOFTWARE\PostgreSQL\Services" $0 |
| 785 | + ; ${if} $1 == "" |
| 786 | + ; ${ExitWhile} |
| 787 | + ; ${endif} |
| 788 | + ; ReadRegDWORD $3 HKLM "SOFTWARE\PostgreSQL\Services\$1" "Port" |
| 789 | + ; ${if} $3 >= $2 |
| 790 | + ; IntOp $2 $3 + 1 |
| 791 | + ; ${endif} |
| 792 | + |
| 793 | + ; IntOp $0 $0 + 1 |
| 794 | + ; ${EndWhile} |
| 795 | + |
| 796 | + ; ${if} $IsTextPortInIni != 1 ;port can be send in ini file |
| 797 | + ; StrCpy $TextPort_text $2 |
| 798 | + ; ${endif} |
| 799 | + ; ${endif} |
788 | 800 |
|
789 | 801 | FunctionEnd
|
790 | 802 |
|
|
0 commit comments