Quick Tip: CreateFile() Network Writing Performance

If you’ve found a file opened with CreateFile() for writing only to be slow over a network, try instead opening for reading and writing. I ran up against this today and found it about 100 times faste.

From MSDN:

When an application creates a file across a network, it is better to use GENERIC_READ | GENERIC_WRITE for dwDesiredAccess than to use GENERIC_WRITE alone. The resulting code is faster, because the redirector can use the cache manager and send fewer SMBs with more data. This combination also avoids an issue where writing to a file across a network can occasionally return ERROR_ACCESS_DENIED.