UPDATE 23-May-2013: Please use maperror2.zip! I accidently used LockFile instead of LockFileEx, but the problem persists.
I have attached a detailed test program that triggers a page fault
It invokes LockFile(LOCKFILE_EXCLUSIVE_LOCK) from two different threads at exactly the same time (this seems crucial) on a file located on a network drive (works fine on non-network drives). The succeeding thread may then page fault when accessing it through memory mapping.
Page fault occurs in around 1 out of 10 runs on Windows 8 + Visual Studio 2012, both in debug and release mode.