title: How to get the name of the process which locks a specfic file?
body: <blockquote>
    <p><strong>Possible Duplicates:</strong><br>
    <a href="https://stackoverflow.com/questions/860656/how-does-one-figure-out-what-process-locked-a-file-using-c">How does one figure out what process locked a file using c#?</a><br>
    <a href="https://stackoverflow.com/questions/317071/how-do-i-find-out-which-process-is-locking-a-file-using-net">How do I find out which process is locking a file using .NET?</a>  </p>
  </blockquote>
  
  
  
  <p>Hi,</p>
  
  <p>i try to get the name of the process wich locks a file (not only a dll module, any file).
  For example if process "Process A" opens a file stream on "C:\temp\test.txt" this should be detected (if i try to delete the file in windows explorer it is locked till the process is killed).</p>
  
  <p>There are several examples on Stackoverflow like:
  <a href="https://stackoverflow.com/questions/860656/how-does-one-figure-out-what-process-locked-a-file-using-c">How does one figure out what process locked a file using c#?</a><br>
  <a href="https://stackoverflow.com/questions/2019236/determine-which-process-blocks-a-file-programmatically-under-windows-xp">Determine which process (b)locks a file, programmatically (under Windows >= XP)</a></p>
  
  <p>I tryed the examples above, but none of them works.</p>
  
  <p>I also read somethink about the Win32 API function <a href="http://msdn.microsoft.com/en-us/library/ms724509(VS.85).aspx" rel="nofollow noreferrer">NtQuerySystemInformation</a>, but i don't know how how to use it. Couldn't find any PInvoke code for it.</p>