Runtime Error "Null pointer Exception" at the very end of the installer

134 views
Skip to first unread message

Otomatic

unread,
Sep 2, 2024, 10:46:43 AM9/2/24
to innosetup
Hi,
- Compiled under Inno Setup 6.3.3 without any errors
- File generated: "wampserver3.3.7_x64.exe" 341 MB
- Launched the installer with /LOG
- Everything went without a hitch until the very last window:
  Click Finish to exit setup
where there is an error:
Runtime error (at 46:685) Null pointer exception

in the LOG file, there is :
2024-09-02 16:11:19.971   Type: Exec
2024-09-02 16:11:19.971   Filename: E:\wamp64\bin\mysql\mysql9.0.1\bin\mysqld.exe
2024-09-02 16:11:19.971   Parameters: --install-manual wampmysqld64
2024-09-02 16:11:20.038   Process exit code: 0
2024-09-02 16:11:20.613   Need to restart Windows? No
2024-09-02 16:11:34.296   Exception message:
2024-09-02 16:11:34.296   Message box (OK):
                          Runtime error (at 46:685):                         
                          Null Pointer Exception.
2024-09-02 16:13:00.701   User chose OK.
2024-09-02 16:13:11.100   Deinitializing Setup.
2024-09-02 16:13:11.105   Stopping 64-bit helper process. (PID: 8304)
2024-09-02 16:13:11.106   Helper process exited.
2024-09-02 16:13:11.112   Log closed.2024-09-02 16:11:19.971

However, everything seems to have been installed correctly and is working without a hitch. I can turn the iss file around and around, but I can't see what could be causing this error or how to avoid it.

Martijn Laan

unread,
Sep 2, 2024, 11:32:56 AM9/2/24
to inno...@googlegroups.com
The problem will be somewhere in the [Code] you're running at the very end of the installer. You can add calls to the Log support function to determine exactly where.

Looking at the Wampserver install script from https://sourceforge.net/projects/wampserver/files/WampServer%203/WampServer%203.0.0/Install%20iss/install_wampserver3.2.6.x64.iss/download I see you're using Stream.Seek but this doesn't work in 6.3.3 (and versions before it), see the earlier discussions. Perhaps this is your problem.

BTW, you're using this to modify shortcuts to set the run as administrator bit which you also shouldn't do, again as discussed recently.

Greetings,
Martijn

Op maandag 2 september 2024 om 16:46 schreef Otomatic <domi...@ottello.net>:
--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/ebed36e7-ba8a-43bb-996b-2d3851d378d6n%40googlegroups.com.

Martijn Laan

unread,
Sep 2, 2024, 11:44:29 AM9/2/24
to inno...@googlegroups.com
Op maandag 2 september 2024 om 17:32 schreef 'Martijn Laan' via innosetup <inno...@googlegroups.com>:

 I see you're using Stream.Seek but this doesn't work in 6.3.3 (and versions before it)

Sorry, I mixed up two different stream fixes. The Stream.Seek problem was fixed in 6.3.2 so please ignore what I said about that.

The rest of my message still applies.

Greetings,
Martijn

Otomatic

unread,
Sep 2, 2024, 12:22:58 PM9/2/24
to innosetup
Wampserver 3.2.6 is very old (November 24, 2021).
I'm at Wampserver 3.3.7 which will be released with PHP 8.4.0 and a lot of things have evolved like the suppression of the modification of the shortcuts - with age, I become wiser and wiser!

Otomatic

unread,
Sep 3, 2024, 3:21:50 AM9/3/24
to innosetup
Hi,
Problem solved by transferring the code executed in:
procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpFinished then

by the same code executed under:
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then

Martijn Laan

unread,
Sep 3, 2024, 8:23:26 AM9/3/24
to inno...@googlegroups.com
Hi,

Thanks for the update but it would be helpful if you post the moved code so we could all see whats was wrong and learn from it.

Thanks in advance,
Martijn

Op dinsdag 3 september 2024 om 09:21 schreef Otomatic <domi...@ottello.net>:
--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
Message has been deleted
Message has been deleted

Otomatic

unread,
Sep 5, 2024, 6:12:10 AM9/5/24
to innosetup
Here is the code that has been transferred:
--------------------------------------------------------
  begin
    UpdateWampmanagerFile('\wampmanager.ini');
    //MySQL allowed ?
    if(MysqlON) then
    begin
      ReplaceString := '';
    end else
    begin
      ReplaceString := ';';
    end;
    ReplaceStringIntoFile('WAMPMYSQLOFF', ReplaceString, '\wampmanager.ini');
    //MariaDB allowed ?
    if(MariadbON) then
    begin
      ReplaceString := '';
    end else
    begin
      ReplaceString := ';';
    end;
    ReplaceStringIntoFile('WAMPMARIADBOFF', ReplaceString, '\wampmanager.ini');
    UpdateApacheFiles();
    UpdateWampmanagerFile('\alias\phpsysinfo.conf');
    UpdateWampmanagerFile('\alias\adminer.conf');
    //Update alias phpmyadmin.conf
    ReplaceStringIntoFile('WAMPPHPMYADMINVERSIONREPLACE', '', '\alias\phpmyadmin.conf');
    ReplaceStringIntoFile('WAMPPHPMYADMINVERSION', ExpandConstant('{#WAMPPHPMYADMINVERSION}'), '\alias\phpmyadmin.conf');
    UpdateWampmanagerFile(ExpandConstant('\bin\mysql\mysql{#WAMPMYSQLVERSION}\wampserver.conf'));
    UpdateWampmanagerFile(ExpandConstant('\bin\mariadb\mariadb{#WAMPMARIADBVERSION}\wampserver.conf'));

    CreateSymlinks();

    #if 'no' == xDebugDllExists84
      //- Disable xdebug for PHP 8.4
      OriString := ExpandConstant('zend_extension="{code:INSTALLDIR}/bin/php/php{#WAMPPHPVERSION84}/zend_ext/{#XDEBUGDLL84}"');
      ReplaceString := ExpandConstant(';zend_extension="{code:INSTALLDIR}/bin/php/php{#WAMPPHPVERSION84}/zend_ext/{#XDEBUGDLL84}"');
      Fichier := ExpandConstant('\bin\php\php{#WAMPPHPVERSION84}\phpForApache.ini');
      ReplaceStringIntoFile(OriString, ReplaceString, Fichier);
      Fichier := ExpandConstant('\bin\php\php{#WAMPPHPVERSION84}\php.ini');
      ReplaceStringIntoFile(OriString, ReplaceString, Fichier);
    #endif

    //--- Save original Wampserver Apache files
    CreateDir(ExpandConstant('{app}\bin\apache\apache{#WAMPAPACHEVERSION}\conf\original\wampserver'));
    FileCopy(ExpandConstant('{app}\bin\apache\apache{#WAMPAPACHEVERSION}\conf\httpd.conf'),ExpandConstant('{app}\bin\apache\apache{#WAMPAPACHEVERSION}\conf\original\wampserver\httpd.conf'),false);
    FileCopy(ExpandConstant('{app}\bin\apache\apache{#WAMPAPACHEVERSION}\conf\extra\httpd-vhosts.conf'),ExpandConstant('{app}\bin\apache\apache{#WAMPAPACHEVERSION}\conf\original\wampserver\httpd-vhosts.conf'),false);

  end;
----------------------------------------------------------------------
But I don't think the cause of the problem was in this code but rather in the modification code for a shortcut that I thought I'd deleted some time ago but which had remained in the form of an include!
-----------------------------------------------
  if ModShortcut = True then
    try
      CD := TFileStream.Create(ExpandConstant('{commondesktop}\{#MyAppName}.lnk'), fmOpenReadWrite);
      CD.Seek($15,soFromBeginning);
      CD.WriteBuffer(Chr($20), 1);
      GS := TFileStream.Create(ExpandConstant('{group}\{#MyAppName}.lnk'), fmOpenReadWrite);
      GS.Seek($15,soFromBeginning);
      GS.WriteBuffer(Chr($20), 1);
    finally
      CD.Free;
      GS.Free;
  end;
------------------------------------------------
I apologise for any confusion.

Otomatic

unread,
Sep 5, 2024, 6:12:15 AM9/5/24
to innosetup
Hi,
To confirm that it was indeed this that solved the problem, I tried several times, which took "a while": I went back to the previous sources, compiled, installed, defaulted, uninstalled, modified, compiled, installed and so on until I was sure.
In the end, I was mistaken in thinking that I had deleted the modification to the shortcut by starting as administrator some time ago, it was still there and it was by deleting this modification that the fault disappeared.
So by deleting the code below :
------------------------------------------------
procedure CurPageChanged(CurPageID: Integer);
var
   CD, GS: TFileStream;

begin
  if CurPageID = wpFinished then
    try
      CD := TFileStream.Create(ExpandConstant('{commondesktop}\{#MyAppName}.lnk'), fmOpenReadWrite);
      CD.Seek($15,soFromBeginning);
      CD.WriteBuffer(Chr($20), 1);
      GS := TFileStream.Create(ExpandConstant('{group}\{#MyAppName}.lnk'), fmOpenReadWrite);
      GS.Seek($15,soFromBeginning);
      GS.WriteBuffer(Chr($20), 1);
    finally
      CD.Free;
      GS.Free;
  end;
end;
------------------------------------------------
I apologise for any confusion.

Bill Stewart

unread,
Sep 5, 2024, 9:42:08 AM9/5/24
to innosetup
On Thursday, September 5, 2024 at 4:12:15 AM UTC-6 Otomatic wrote:

To confirm that it was indeed this that solved the problem, I tried several times, which took "a while": I went back to the previous sources, compiled, installed, defaulted, uninstalled, modified, compiled, installed and so on until I was sure.
In the end, I was mistaken in thinking that I had deleted the modification to the shortcut by starting as administrator some time ago, it was still there and it was by deleting this modification that the fault disappeared.
So by deleting the code below :
------------------------------------------------
procedure CurPageChanged(CurPageID: Integer);
var
   CD, GS: TFileStream;

begin
  if CurPageID = wpFinished then
    try
      CD := TFileStream.Create(ExpandConstant('{commondesktop}\{#MyAppName}.lnk'), fmOpenReadWrite);
      CD.Seek($15,soFromBeginning);
      CD.WriteBuffer(Chr($20), 1);
      GS := TFileStream.Create(ExpandConstant('{group}\{#MyAppName}.lnk'), fmOpenReadWrite);
      GS.Seek($15,soFromBeginning);
      GS.WriteBuffer(Chr($20), 1);
    finally
      CD.Free;
      GS.Free;
  end;
end;
------------------------------------------------
I apologise for any confusion.

It is good to remove that code: Even if it worked correctly, it's not what you should be doing in the first place.

Reply all
Reply to author
Forward
0 new messages