Microsoft's CopyFileEx error.

Posted on 2011-10-25
Last Modified: 2012-05-12

I am using Microsoft's CopyFileEx method to copy  files.
I am coping from one server to another and the file located in share folder and i am using UNC.
i get an error 999. I was able to find the ‘999’ error on Microsoft’s Technet site. The copies are failing because of an “Error performing inpage operation.”
According to the following Microsoft kb article found at , some of the causes of  “Error performing inpage operation” are:
“Errors caused by network connectivity can cause these errors. Mismatched MTU sizes or truncation of a packet at a router can result in this error when files larger than the largest packet size are copied over the network. In essence, the network connection is the media that has the physical problem.”

but after some investigation i saw that the file are small and I couldnt fint network issue.

I am desperate for idea...
Question by:dpatel_team
    LVL 32

    Accepted Solution

    the article you mentioned describes the problem:

    small files copied with CopyFile (or CopyFileEx) are not really copied but are mapped to local memory as a (so-called) memory-mapped-file. unfortunately that means in your case that normal read-errors like error 2, file not found, or errors because files were opened exclusively at the server you copy from, were not reported as file errors but as memory (in)page errors.

    you could try SHFileOperation as alternative to CopyFileEx though i don't know whether it can handle UNC paths on remote servers.

    or you open the file with CreateFile and do the copy operation yourself.


    LVL 10

    Expert Comment

    Would the FileSystemObject accomplish what you want?

    Author Closing Comment

    only provide way to debug

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now