Prev Previous Post   Next Post Next
Old 6th May 2012, 20:09   #1
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 114
Issues on NSIS.pas

Dear all,

my plugins should in the (near) future support unicode. The plugins are developed in Delphi 6 without any unicode support. Now I got Delphi XE2 and I refresh the current NSIS.pas from the 2.46 release to my project.

But with this update I got some strange issues:

1. My plugin crashes in the Init-Method in this line:

extrap := g_extraparameters^;

I think "g_extraparameters" is nil and this is the reason why it crashes. Without this line it works.

2. The method "LogMessage" typecasts to "PAnsiChar" in this line:

item.pszText := PAnsiChar(Msg);

This will not work in Delphi Vesions which supports Unicode by default. It must be:

item.pszText := PChar(Msg);

or

item.pszText := PWideChar(Msg);

3. After fixing the first to points in the NSIS.pas everything looks ok and my plugin works with the NSIS Unicode version without any problems. If I use the same Plugin DLL in the "ANSI"-Version of NSIS but this crashes during the execution of my NSIS-Setup.

The reason why it crashes is the following line in the method "PopString":

Result := PChar(@th.text);

If I change it to...

Result := String(PAnsiChar(@th.text));

...and it works. At this point I'm helpless because I don't understand why this works (or better why the first line doesn't work). Maybe some user of this board or another NSIS developer can give me a hint about this problem?

Maybe this can be solved in a way that NSIS.pas can be used for "ANSI"-NSIS and "Unicode"-NSIS.

As a temporarily solution I used a condition compilation.

If I want to compile for "ANSI"-NSIS I use:

Result := String(PAnsiChar(@th.text));

If I want to compile fir "Unicode"-NSIS I use:

Result := PChar(@th.text);

Kind regards

Rainer
Speed78 is offline   Reply With Quote
 
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