View Full Version : XCopyFile and CopyFile is Failing

07-26-2002, 10:52 AM
I am in WinNT 4.0 platform and using XCopyFile and CopyFile command to copy a file from network to my local drive. It fails. The CopyFile fails with error # -2147024894. Can anybody give me any clue about whats happening?

07-26-2002, 01:55 PM
When I pass that return code into the InstallScript function called FormatMessage, it returns the following:

"The function cannot find the file specified"

This return code will commonly occur if the path to the file is incorrect, or you don't have read/write access to that location.

07-26-2002, 02:07 PM
Thanks for the sharp reply. But I am printing out my source path and its showing correct path. About read/write access, my install program knows that I am an Administrator on this WinNT machine (I tested it with SYSINFO.WINNT.bAdmin_Logged_On function). The file property is not set as "Read-only," I confirmed it going to the property of the file. Any idea? By the by, these XCopyFile and CopyFile functions worked fully OK in Win9x platform. Now, in WINNT40 & WIN2000 platform, none of my XCopyFile & CopyFile is working. I am in BIG trouble !! Can you help me?

Carsten Segieth
07-26-2002, 02:16 PM
I'm quite sure you're using Dev7.04?!? If so, please have a look to this thread, I had the same problem: Problem with CopyFile() after upgrade from 7.02 to 7.04 (http://community.installshield.com/showthread.php?s=&threadid=99635)

07-26-2002, 02:21 PM
I am using InstallShield 7.03 (Includes Maintenance Pack 3).

Carsten Segieth
07-26-2002, 02:23 PM
And I thought, this was a new error for 7.04. But perhaps the same work around would help you: move the copyfile to other functions. At an other place one said, that it always fails in FeatureEvent functions.

07-26-2002, 02:35 PM
Thanks Carsten. I just visited the thread you mentioned. In my case, I guess, I can't put all of my XCopyFile & CopyFile commands into either OnFirstUIBefore or OnFirstUIAfter beacuse my copy depends on which feature the user chooses and what kind of database (Sybase or MSSQL) they have. So, its a conditional copy. Any idea?

Carsten Segieth
07-26-2002, 02:50 PM
no, only that you try it BEFORE the files are installed. I was told from the IS support to try this, but as it worked for me in the other functions I didn't test this.
Perhaps ypou need to add something like
if FeatureInstalled( F_MAINPROG ) then CopyFile...

07-26-2002, 03:17 PM
I will try your way. Meanwhile, I have another problem, none of my LaunchAppAndWait functions to launch third-party programs are working now in WinNT40 and Win2000; they ran well in Win9x. For example, I have a checkbox for the user to install Adobe Acrobar Reader. In my install script, I added -

function InstallAdobeAcrobat()
STRING szAcroLoc;
szAcroLoc = SRCDIR ^ "\\AdobeAcrobatReader\\ar505enu.exe";

if(LaunchAppAndWait(szAcroLoc, "", WAIT) < 0) then
MessageBox("Adobe Acrobat Reader installation failed", SEVERE);

The SRCDIR is a network location and I confirmed that the exe file is there. This isn't working now. What went wrong? Any clue?

Carsten Segieth
07-29-2002, 02:16 AM
perhaps it's the same problem. Before you try to move this to another function, e.g. to "OnEnd()", just copy your whole "CD" to a local temp folder and install from there. If this works I assume it's the same kind of problem like with [X]CopyFile().

07-29-2002, 01:11 PM
[X]CopyFile C: to C: works but [X]CopyFile Network: to C: doesn't work. Now even FindFile() from a network location isn't working!!

07-29-2002, 01:45 PM
We are installing our software from netowork. I am in Novel Netware. I do have administrative privilage to network, to my WinNT40 and Win2000 machine. I am logged in to my machine and Nevel as administrator privilage. None of my LaunchAppAndWait, FindFile, [X]CopyFile is working! Is this because of network installtion. Can't I do it? I am using InstallShield 7.03 (with Service Pack 3) and my installation is a standard project.

07-29-2002, 02:05 PM
for LaunchAppAndWait problem, try this

ChangeDirectory(SRCDIR ^ "\\AdobeAcrobatReader);
LaunchAppAndWait("ar505enu", WAIT);

but you will still have a problem with it not waiting properly. For that you need to get script from installshield (_WaitForSetup).


08-27-2002, 11:33 AM
Hello All,

I do believe I've found the problem/fix. I did some digging and found that if you call LongPathToQuote(svPath, FALSE); this error occurs.

I removed all references to the above function call and now both my XCopyFile() & CopyFile() functions work !!!!