Archive: CopyFiles problem in Vista


CopyFiles problem in Vista
While running my installer on Vista, I've run into a problem with CopyFiles. I basically have a folder called Custom that sits next to my main installer. At the end of installation, I copy all contents from Custom, if their are any, to my installation directory recursively (gets rid of having to re-compile my installer for very minor fixes to our code base). Anyways, on Vista, the installer crashes whenever it gets to this CopyFiles command, which will work on WinXP Home/Pro (only other two that I've tried it on). Is this a known issue or is this a new bug? Note, that I've tried it with and without the /SILENT parameter.


!include "LogicLib.nsh"
...
Section -
${If} ${FileExists} "$EXEDIR\Custom\*.*"
CopyFiles /SILENT "$EXEDIR\Custom\*.*" "$INSTDIR"
${EndIf}
SectionEnd
...

Which Windows Vista Version and build? If you want me to take a look at it please provide a small example script. Will test on Vists Beta2 Build 5308.

Note that Windows Vista beta2 still contains a LOT of strange defects.


Try the following and let me know if it works. The code should copy C:\autoexec.bat to C:\autoexec.dat. If it works, it might be the linking problem all over again.

!define FO_COPY 0x2
!define FOF_NOCONFIRMATION 0x10
!define FOF_NOCONFIRMMKDIR 0x200
!define FOF_NOERRORUI 0x400
!define FLAGS ${FOF_NOCONFIRMATION}|${FOF_NOCONFIRMMKDIR}|${FOF_NOERRORUI}
System::Call '*(&t16 "C:\autoexec.bat", &i1 0) i .r0'
System::Call '*(&t16 "C:\autoexec.dat", &i1 0) i .r1'
System::Call '*(i $HWNDPARENT, i ${FO_COPY}, i r0, i r1, i ${FLAGS}, i, i, i) i .r2'
System::Call 'shell32::SHFileOperation(i r2)'

This is being tested on build 5381.

kichik: I ran the code above and it didn't work. It came up with a Vista message saying that the program failed to install correctly.


Then I'd say it's a problem with that build of Vista. To be absolutely sure a small program, that does nothing more than calling SHFileOperation needs to be tested.


Okay. Thanks for the help.


Hi, I could not see any problem in Vista, see screenshots and script.

And, yes we should NOT copy files in the root in Windows Vista ofcourse in a reali installer, I know. I is just and example you see ;)


Oh, this was the script used, save it as testme.nsi and make sure there is a txt file called C:\mytest.txt in your rootdrive (if it is C: at all...)

---

!define FO_COPY 0x2
!define FOF_NOCONFIRMATION 0x10
!define FOF_NOCONFIRMMKDIR 0x200
!define FOF_NOERRORUI 0x400
!define FLAGS ${FOF_NOCONFIRMATION}|${FOF_NOCONFIRMMKDIR}|${FOF_NOERRORUI}
outfile "c:\test.exe"

section .oninit
System::Call '*(&t16 "C:\mytest.txt", &i1 0) i .r0'
System::Call '*(&t16 "C:\mytest.ini", &i1 0) i .r1'
System::Call '*(i $HWNDPARENT, i ${FO_COPY}, i r0, i r1, i ${FLAGS}, i, i, i) i .r2'
System::Call 'shell32::SHFileOperation(i r2)'
sectionend

---