Archive: UpgradeFile macro & GetFileVersion problem


UpgradeFile macro & GetFileVersion problem
Hi guys,

please look at the attached file which contains one simple
script and two macro definitions named good.nsh and bad.nsh.
They both use the same x18sysinfoV0.0.dll
When I run the script common.nsi with good.nsh included then
everything works fine and Method 2 returns good results.
On the other hand, when I include bad.nsh instead (the only
difference is that Method 1 is omitted!) then only the first macro usage returns the good value (the one with MSVCRT.DLL) and all the
others return empty strings, WHY?????:igor:

Any contribution to this problem is highly appreciated, thanks.

Kypec


What NSIS version are you using?


Found the problem
The code that the DLL uses in some places is taken from a Microsoft Systems Journal article. What I didn't realise is that the call to GetFileVersion is dependent on the DLL being mapped into memory and this only happens if you call DllGetVersion first. I'll post a fixed DLL in a moment.


New version
Bug fixed version:

http://www.clantpa.co.uk/nsis/x18sysinfoV0.1.zip


Great job, Sunjammer,
Version 0.1 works fine. :) Btw I've found another strange thing,
with V0.0 my macro (see attached file) didn't delete temporary
files "Delete $R1". Now, when I use V0.1 with NSIS 2.0a6 this macro works perfectly fine. :weird: Weird, isn't it?


Nah I know why that happened. The original Microsoft Systems Journal code for some bizarre reason (my fault for "trusting" it) called LoadLibrary on the file but did not call FreeLibrary() on it so Windows still had a lock on the file. This was fixed by my bug fix.

Glad to help, sorry about the original fookup.

X