Old 27th March 2009, 08:21   #41
silo5
Junior Member
 
Join Date: Mar 2009
Posts: 16
JP, sorry but I can't give you a script to reproduce this issue. I have chopped down my installer script to a bare minimum that I thought would reproduce but it doesn't.
silo5 is offline   Reply With Quote
Old 27th March 2009, 17:27   #42
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Quote:
sorry but I can't give you a script to reproduce this issue. I have chopped down my installer script to a bare minimum that I thought would reproduce but it doesn't.
Hmm, then I'm sorry as well, because I can't reproduce this either, and as far as I can see, there is nothing wrong with the plugin code .

Quote:
When you do, check also that if "text" starts with a number it is taken to be "true" instead of being "text". I have this comment in my notes from a while ago, I did not check if you've already fixed this issue in the latest version.
Hmmm, I'm not able to reproduce this as well.
Maybe you can provide a script for this?

By the way, what version of NSIS are you using, the normal or the Unicode version?

JP
jpderuiter is offline   Reply With Quote
Old 29th March 2009, 08:32   #43
silo5
Junior Member
 
Join Date: Mar 2009
Posts: 16
I'm using the standard version.
Possiby you've alaready fixed the number vs. true issue in a recent update, like I said, I had this issue marked in my notes from a previous version, then I upgraded the plugin.
silo5 is offline   Reply With Quote
Old 30th March 2009, 10:11   #44
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Quote:
Possiby you've already fixed the number vs. true issue in a recent update, like I said
Yes, you're right.
Appearently I fixed this when I made the Unicode version.
(Though I wasn't aware of this issue...)
I will upload a new version with the "only checks for a 'true' and doesn't expect a 'false'" issue fix later today.

Regards,
JP
jpderuiter is offline   Reply With Quote
Old 30th March 2009, 21:17   #45
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
I uploaded a new version of the LogEx plugin, with the fix for "false" as a value for a boolean parameter.
http://nsis.sourceforge.net/LogEx_plug-in
jpderuiter is offline   Reply With Quote
Old 1st April 2009, 08:16   #46
silo5
Junior Member
 
Join Date: Mar 2009
Posts: 16
Thank you JP, tested here and it works fine.
I really appreciate your work.
FYI, to simplify my installer I rely on an undocumented behavior of your plugin. I call LogEx::Close even if the logfile hasn't been opened. Apparently this call is harmless and leaves the stack in good shape.
silo5 is offline   Reply With Quote
Old 1st April 2009, 17:38   #47
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Hi silo5,

thanks for your feedback.

What do you mean with an "undocumented behavior of your plugin"?
Do you use it to deal with the problem that you can't delete the log file after closing the plugin?
Using LogEx::Close without a previous LogEx::Init won't do anything, since the LogEx::Close function does not find a logfile handle, and thus skips the Close call.

Please note that you need a LogEx::Close call after calling LogEx::Init, even if you didn't write anything to the logfile at all, because the Init function creates and opens the logfile.

Regards,
JP
jpderuiter is offline   Reply With Quote
Old 2nd April 2009, 14:06   #48
silo5
Junior Member
 
Join Date: Mar 2009
Posts: 16
Quote:
Originally posted by jpderuiter
What do you mean with an "undocumented behavior of your plugin"?
That you had not explicitly said that is it OK to call LogEx::Close without a previous LogEx::Init. But now you have said it, so this behavior isn't undocumented anymore.
Quote:
Do you use it to deal with the problem that you can't delete the log file after closing the plugin?
No, I worked around that problem in my code.
silo5 is offline   Reply With Quote
Old 2nd April 2009, 18:30   #49
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Quote:
That you had not explicitly said that is it OK to call LogEx::Close without a previous LogEx::Init.
Well, since it's good programming practice to check variables and stack before continuing a function, I don't think I should document this behaviour.
What to document when a function doesn't do anything at all anyway?

And what purpose has this behaviour for you?
Why do you do this at all?
jpderuiter is offline   Reply With Quote
Old 3rd April 2009, 13:20   #50
silo5
Junior Member
 
Join Date: Mar 2009
Posts: 16
It simplifies the code of my installer by keeping fewer state variables and writing less conditional code. I can't give a general example, because this simplification is specific to my installer code.
silo5 is offline   Reply With Quote
Old 3rd April 2009, 13:33   #51
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
OK, so I guess you only open a logfile when it's needed, but you don't want to check whether you opened the logfile before at the end of the script, so you always close the logfile.

Well, you can do that indeed, as explained before.
jpderuiter is offline   Reply With Quote
Old 25th August 2010, 11:01   #52
matthiasb
Junior Member
 
Join Date: Aug 2008
Location: Austria
Posts: 8
I'm not entirely sure if it's a bug, wrong usage or caused by something different but calling LogEx::Write crashes the installer when using long strings.
Everything works as expected as long given string does not exceed 999 chars.
When trying to log a string with 1000 chars (1023 should be possible?) my application crashes.

Can someone confirm this?
matthiasb is offline   Reply With Quote
Old 25th August 2010, 12:23   #53
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Hi Matthias,

this is a bug indeed.
I assigned a TCHAR size of 1000, thinking that would be enough...
I will fix the plugin as soon as possible, but since I'm on vacation, this will be half september...

You can fix it yourself if you need it sooner, but then you'll have to recompile the plugin.
Change "TCHAR buf[1000];" to "TCHAR buf[NSIS_MAX_STRLEN];" in the Write function (line 146).

Sorry for the inconvenience.

jpderuiter
jpderuiter is offline   Reply With Quote
Old 25th August 2010, 12:54   #54
matthiasb
Junior Member
 
Join Date: Aug 2008
Location: Austria
Posts: 8
Thanks for the fast response.
Since i have to log the stdout of an application untrimmed i'm going to use redirection instead for this one.
For everything else LogEx is fine as it is now.
matthiasb is offline   Reply With Quote
Old 25th August 2010, 15:58   #55
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
@jpderuiter You should ideally be using the string_size plug-in function variable and not a compile time define (so people can use the 8192 string build without recompiling). You would also have to allocate the memory using GlobalAlloc.

Stu
Afrow UK is offline   Reply With Quote
Old 25th August 2010, 22:05   #56
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Thanks, will do that.
jpderuiter is offline   Reply With Quote
Old 5th September 2010, 14:26   #57
gringoloco023
Member
 
Join Date: Nov 2009
Posts: 52
using the string_size plug-in function variable ?

Would this be the right-way of using the string_size plug-in function variable:
PHP Code:
TCHAR *buf=GlobalAlloc(GPTRstring_size sizeof(TCHAR)); 
instead of:
PHP Code:
TCHAR buf[NSIS_MAX_STRLEN]; 
gringoloco023 is offline   Reply With Quote
Old 5th September 2010, 18:16   #58
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Just missing the cast:
code:
TCHAR* buf = (TCHAR*)GlobalAlloc(GPTR, string_size * sizeof(TCHAR));

You could also use PTCHAR instead of TCHAR* which I always use nowadays. Note I also use TCHAR* buf as opposed to TCHAR *buf. Having the * next to the type as opposed to the variable name to me just makes more sense. Also don't forget GlobalFree.

Stu
Afrow UK is offline   Reply With Quote
Old 7th September 2010, 20:02   #59
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Hi all,

unfortunately I'm getting a bunch of winntl.h compile errors.
This is the first time I see these errors, and I have no clue what's causing it.
Maybe something is wrong in the platform SDK, so maybe I'll have to reinstall everything.

But I do not have the spare time to do that...
Maybe somebody else can recompile it?
All that need to be changed is mentioned in the previous posts.

Thanks in advance.

jpderuiter
jpderuiter is offline   Reply With Quote
Old 7th September 2010, 20:22   #60
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
What are the errors?

When I'm building there are a couple of things:
1. Linker -> Input -> Ignore All Default Libraries
Set to Yes. Removes linkage to CRT (but does not remove dependency; see 2).
2. Linker -> Manifest File -> Generate Manifest
Set to Disabled otherwise your DLL will have a run time error if the required Microsoft Visual C Run Time library isn't installed (even though you're not using it).
3. C/C++ -> Code Generation -> Buffer Security Check
Set to No if you get "unresolved external symbol __security_cookie" link errors.
4. C/C++ -> Optimization -> Optimization
Set to Disabled if you get "unresolved external symbol _memset" link errors.

Stu
Afrow UK is offline   Reply With Quote
Old 7th September 2010, 20:42   #61
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
I'm building on VC6, so not all settings are available.
Changing the ones I can doesn't fix it.
This is part of the errorlog:
Quote:
NOTE: WINVER has been defined as 0x0500 or greater which enables
Windows NT 5.0 and Windows 98 features. When these headers were released,
Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions.
For this release when WINVER is defined as 0x0500 or greater, you can only
build beta or test applications. To build a retail application,
set WINVER to 0x0400 or visit http://www.microsoft.com/msdn/sdk
to see if retail Windows NT 5.0 or Windows 98 headers are available.
See the SDK release notes for more information.
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1050) : error C2081: 'LONG_PTR' : name in formal parameter list illegal
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1051) : error C2081: 'LONG_PTR' : name in formal parameter list illegal
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1052) : error C2081: 'LONG_PTR' : name in formal parameter list illegal
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1061) : error C2081: 'LONG_PTR' : name in formal parameter list illegal
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1062) : error C2081: 'LONG_PTR' : name in formal parameter list illegal
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1063) : error C2081: 'LONG_PTR' : name in formal parameter list illegal
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1217) : error C2146: syntax error : missing ')' before identifier 'UINT'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1217) : error C2491: 'IsValidCodePage' : definition of dllimport function not allowed
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1217) : error C2059: syntax error : ')'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1217) : error C2085: 'CodePage' : not in formal parameter list
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1222) : error C2085: 'GetACP' : not in formal parameter list
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1227) : error C2085: 'GetOEMCP' : not in formal parameter list
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1233) : error C2146: syntax error : missing ')' before identifier 'UINT'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1233) : error C2085: 'GetCPInfo' : not in formal parameter list
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1233) : error C2146: syntax error : missing ',' before identifier 'UINT'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1233) : error C2146: syntax error : missing ',' before identifier 'CodePage'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1234) : error C2085: '__out' : not in formal parameter list
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1234) : error C2146: syntax error : missing ',' before identifier 'LPCPINFO'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1234) : error C2146: syntax error : missing ',' before identifier 'lpCPInfo'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1234) : error C2059: syntax error : ')'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1240) : error C2146: syntax error : missing ')' before identifier 'UINT'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1240) : error C2085: 'GetCPInfoExA' : not in formal parameter list
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1240) : error C2146: syntax error : missing ',' before identifier 'UINT'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1240) : error C2146: syntax error : missing ',' before identifier 'CodePage'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1241) : warning C4042: '__in' : has bad storage class
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1241) : error C2146: syntax error : missing ',' before identifier 'DWORD'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1241) : error C2146: syntax error : missing ',' before identifier 'dwFlags'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1242) : error C2085: '__out' : not in formal parameter list
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1242) : error C2146: syntax error : missing ',' before identifier 'LPCPINFOEXA'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1242) : error C2146: syntax error : missing ',' before identifier 'lpCPInfoEx'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1242) : error C2059: syntax error : ')'
...
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\winnls.h(1312) : fatal error C1003: error count exceeds 100; stopping compilation
jpderuiter is offline   Reply With Quote
Old 7th September 2010, 20:46   #62
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Maybe the file is damaged? You could try reinstalling or upgrading.

Stu
Afrow UK is offline   Reply With Quote
Old 8th February 2011, 00:21   #63
steinbohrer
Junior Member
 
Join Date: Feb 2011
Posts: 1
NULL-char at the end of each line

Hi jpderuiter,

I've just tried your LogEx-plugin and there is one minor flaw.
I use your Unicode version and there is an NULL-char at the end of each line in the log-file.

code:

LogEx::Init false "$EXEDIR\InstallLog.txt"
LogEx::Write true true "<> Dies ist ein äöüÄÖÜß LogEintrag!"
LogEx::Close



Please have a look at the picture:


If I'm correct, the plugin is written in C and C uses ASCIIZ-strings.
Do you strip the end-marker off the string before you copy it to the log-file?

Is there any chance you can fix this in the near future?

Thank you very much,
Michael.
steinbohrer is offline   Reply With Quote
Old 8th February 2011, 18:43   #64
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Fortunately I suddenly saw the light, and found that I had to put the SDK include Library at the top of the list of include directories in vs6.0.

Anyway, I compiled a new version of this plugin, check the wiki:
http://nsis.sourceforge.net/LogEx_plug-in

I fixed both bugs, the one from matthiasb (mentioned 25th august 2010) and the one from steinbohrer.
I don't have time to test it thoroughly, so if you find any problems, please tell me.

jpderuiter
jpderuiter is offline   Reply With Quote
Old 1st June 2011, 03:18   #65
hnedka
Junior Member
 
Join Date: Dec 2010
Posts: 12
Hi, I have probably discovered a bug. In function Log::Write, you don't remove the parameter from the stack if the file handle is not correct, which leads to stack corruption. May be present in other places, haven't checked.
hnedka is offline   Reply With Quote
Old 20th June 2011, 20:01   #66
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Hi hnedka,

thanks for pointing that out.
I fixed it, and uploaded v0.9.1 to the wiki page.
jpderuiter is offline   Reply With Quote
Old 18th August 2011, 06:19   #67
SJSJ
Junior Member
 
Join Date: May 2011
Posts: 25
Timestamps in Logs?

Hi, a very useful plugin!
Is there a way to embed the timestamps when I do a LogEx::Write?
SJSJ is offline   Reply With Quote
Old 18th August 2011, 09:26   #68
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Hi,

not via the LogEx plugin, but you can get the current time with the Time plugin (http://nsis.sourceforge.net/Time_plug-in), or using the system plugin (http://stackoverflow.com/questions/2...ame-using-nsis).
jpderuiter is offline   Reply With Quote
Old 20th September 2011, 18:41   #69
absalom0
Junior Member
 
Join Date: Sep 2011
Posts: 2
I am currently doing development to test out support for Windows 8 (Windows Developer Preview). Is there any chance that LogEx will be updated to support Windows 8 (Windows version 6.2.8102) anytime soon?

Thanks
absalom0 is offline   Reply With Quote
Old 21st September 2011, 07:26   #70
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
I'm not sure what you mean.
Is the LogEx plugin not working on Windows 8?
jpderuiter is offline   Reply With Quote
Old 21st September 2011, 17:56   #71
absalom0
Junior Member
 
Join Date: Sep 2011
Posts: 2
Yeah, I had plugins and forums confused. You're good. I am apparently looking at the wrong place. ><

Thanks though.
absalom0 is offline   Reply With Quote
Old 6th July 2012, 16:50   #72
JoeSnuffie
Junior Member
 
Join Date: Jul 2012
Posts: 1
Prepend?

I'm using NSIS as a software updater for my company's applications. I am currently using an application called at the end of the NSIS application to create a log file but I would like to include this process in the NSIS application. To do this I need to be able to prepend my strings rather than append them. This will keep the latest update information at the top of the file. Can this be done?
JoeSnuffie is offline   Reply With Quote
Old 11th July 2012, 22:03   #73
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Hi Joe,

no, you cannot prepend text to an existing logfile.
What you can do is create a new logfile when the installer starts, and when finished append the previous created logfile.

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