Archive: Problem: GetTempFileName & Upgrade Shared-DLLs


Problem: GetTempFileName & Upgrade Shared-DLLs
Hi All,

My OS is Windows 9x, and in my autoexec.bat has (red) lines :

SET TEMP=C:\WINDOWS\TEMP
:temp=c:\windows\temp is default by Windows, but I re-set for sure an existing TEMP environment
:then remove all temporary files in TEMP folder that countn't be deleted because PC halted, Software halted or bad softwares have been created
IF NOT EXIST %TEMP%\*.* GOTO endbat
ECHO Y | DEL %TEMP%\*.* > NUL
:endbat


In .NSI:

Push $SYSDIR\xyz.dll
!insermacro UpgradeDLL xyz.dll
;Reboot

After running installer, I found in WININIT.INI, such as

[rename]
C:\WINDOWS\SYSTEM\xyz.dll=C:\WINDOWS\TEMP\nst_unique.TMP

After restarting computer, the file nst_unique.TMP in C:\WINDOWS\TEMP has been deleted (ensuant on the autoexec.bat) before Windows loads. And the file xyz.dll cannot be upgraded.

I think, the best of this case is never copy nst_unique.TMP to $TEMP
If and when GetTempFileName only assigned to user-var a value "filename.tmp" instead of "$TEMP\filename.tmp", then I want, I'll use such as "$SYSDIR\filename.tmp", "$INSDIR\filename.tmp", "$TEMP\filename.tmp", etc.
In the meantime, can get "filename.tmp":

GetTempFileName $0
Push $0 ; ex: $0 = C:\WINDOWS\TEMP\nst_unique.TMP
Call Filename
Pop $0 ; ---> $0 = nst_unique.TMP

Function Filename
; You are easy to write this code
FunctionEnd


Sorry my bad English... too. :cry:
So I hope you understand what I mean.


Simply change the output file from the result of GetTempFile to the filename plus .onreboot or something alike. Put it in the same directory and it won't be deleted on reboot.

For example, if you had in the macro:
GetTempFileName $0
File /oname=$0 $R0 ; $R0 being the variable holding the filename

Replace it with:
File /oname=$R0.onreboot $R0


Windows-Temp
Hi!

I made the experience, that deleting the Windows %temp% directory in Autoexec.bat is making troubles anyway. Windows is using this directory as a system part. Therefore installers will write temporary files, which are used after restarting the system.

May be it's better to delete the temp directory in a batch file in the autostart group of the Windows. Tasks for installing applications needing a Windows restart should have executed all operations before and hopefully delete all temporary stuff!


I agree with what you say. But I don't know users which using my installer, in their autoexec.bat has been deleting temp folder.


To Kichik : Thank you for quick reply. I'll try now.