BUG: CopyFile Fails with Read-Only Files

This article was previously published under Q145935
This article has been archived. It is offered "as is" and will no longer be updated.
The CopyFile function fails and GetLastError returns ERROR_ACCESS_DENIEDwhen you try to copy a read-only file to a core SMB server (such as a LANManager for UNIX server) or to a Netware server when the client computeruses real-mode network drivers. The destination file is created as aread-only file and is zero in length.
This error message occurs because there is a mismatch between the way thatthe Windows 95 or Windows 98 redirector accesses files and the way that these servers expect this access.
Remove the read-only attribute before calling the CopyFile function toallow the file to be copied correctly. After the copy is complete, thenthe read-only attribute can be restored.
Microsoft has confirmed this to be a bug in the Microsoft products listedat the beginning of this article. We are researching this problem and willpost new information here in the Microsoft Knowledge Base as it becomesavailable.

Article ID: 145935 - Last Review: 01/16/2015 18:21:23 - Revision: 3.2

  • Microsoft Win32 Application Programming Interface
  • kbnosurvey kbarchive kbapi kbbug kbkernbase KB145935