0

I have installed the OS in VirtualBox 4.3.8

I have compiled the Code that calls the CopyFile/CopyFileEx function in VC6, and VS2012 (for v10 and v11), but it refuses to work.

I am running the app in console mode, as Administrator. It gives error 2: The system cannot find the file specified.

However, this code works fine for both functions on XP, Server 2003, and Windows 7.

What is the problem? Is it permissions? How can I find out what the problem is?

T.Coutlakis
  • 2,436
  • 1
  • 19
  • 19
  • 2
    The problem is that the file that you named does not exist. – David Heffernan Mar 11 '14 at 11:43
  • 1
    Please add some code, and some info about source and target (is one of them a network location)? Are you able to copy the according file from the console manually? – sb9 Mar 11 '14 at 11:47
  • @sb9 +1, `copy C:\Temp\a.txt C:\Temp\b.txt` isn't working in the console. – T.Coutlakis Mar 11 '14 at 11:54
  • What error message? Does `c:\temp\a.txt` exist, if so is it readable? What about `c:\temp\b.txt`, does it exist and if s, is it writable? If copying from the console is not working it of course won't work from your app as well... (+1 went to David) – sb9 Mar 11 '14 at 11:59
  • +1 to you both, thanks, the problem was my own, the source file did not exist, and the reason I didn't know, was because in 2008 they added the "feature" 'Hide extensions for known file types.', which I forgot to uncheck, so I coudln't see that the filename was wrong. Thanks sb9 for providing me with helpful debug steps. – T.Coutlakis Mar 11 '14 at 12:40
  • The very sad part, is that I had tested to see if this file existed, by pasting "C:\Temp\a.txt" into Windows Explorer address bar and pressing return, and it opened it in notepad. You can reproduce this right now. ('Hide extensions for known file types.' must be checked.) This is very disturbing. – T.Coutlakis Mar 11 '14 at 12:57

2 Answers2

0

Altough you don't give much info about the code, I recommend to download and run Process Monitor in background (you can filter your process).

You will see more detailed info such us if the folder really exists, etc.

Mauro H. Leggieri
  • 1,084
  • 11
  • 25
0

This is ERROR_FILE_NOT_FOUND. It's hard to look beyond the obvious explanation that the file name that you are providing when calling CopyFile refers to a file that does not exist.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490