title: MoveFileEx not working properly?
body: <p>I have tried several ways to get <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa365240%28v=vs.85%29.aspx" rel="nofollow">MoveFileEx</a> working with the DELAY_UNTIL_REBOOT flag without success. The FileRenameOperations key in the registry also shows that the method did not execute properly. What could be the cause?</p>
  
  <p>I call my MoveFileEx function like this: </p>
  
  <pre><code>MoveFileEx(localFile, oldFile, MoveFileFlags.MOVEFILE_DELAY_UNTIL_REBOOT);
  </code></pre>
  
  <p>My WINAPI code is as follows:</p>
  
  <pre><code>[DllImport("kernel32.dll", EntryPoint = "MoveFileEx")]
  internal static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags);
  
  internal enum MoveFileFlags
  {
      MOVEFILE_REPLACE_EXISTING = 1,
      MOVEFILE_COPY_ALLOWED = 2,
      MOVEFILE_DELAY_UNTIL_REBOOT = 4,
      MOVEFILE_WRITE_THROUGH = 8
  }
  </code></pre>
  
  <p>This application is run under admin account. Could this be because I'm using 4 instead of 0x4 or is it some 64bit problem? Thanks!</p>
  
  <p><strong>EDIT:</strong> The Operation returns false and error code of 3.</p>