title: LockFileEx returns success, but seems to have no effect
body: <p>I'm trying to lock a file, because it is sitting on a network drive, and multiple instances of a program from multiple computers need to edit it. To prevent damage, I intend to set it up so that only one of the instances has rights to it at a time.</p>
  
  <p>I implemented a lock, which would theoretically lock the first 100 bytes of the file from any access. I'm using Qt with its own file handling, but it has a method of returning a generic file handle.</p>
  
  <pre class="lang-c++ prettyprint-override"><code>QFile file(path);
  HANDLE handle = (HANDLE)_get_osfhandle(file.handle());
  OVERLAPPED ov1;
  memset(&amp;ov1, 0, sizeof(ov1));
  ov1.Offset = 0;
  ov1.OffsetHigh = 0;
  if (handle == INVALID_HANDLE_VALUE)
  {
      // error
      return;
  }
  
  LockFileEx(handle, LOCKFILE_FAIL_IMMEDIATELY | LOCKFILE_EXCLUSIVE_LOCK, 0, 100, 0, &amp;ov1);
  qDebug() &lt;&lt; file.readLine();
  </code></pre>
  
  <p><code>LockFileEx()</code> returns <code>1</code>, so it seems to have been successful. However, if I run the program in multiple instances, all of them can read and print the first line of the file. More than this, I can freely edit the file with any text editor.
  Being a network file is not an issue, as it behaves similarly with a local file.</p>