0

I have a locked file. And I would like to figure out the process id that has this file locked. Is this possible on Windows using WinAPI or something?

Thanks very much!

Noitidart
  • 35,443
  • 37
  • 154
  • 323
  • 1
    That topic doesn't give a winapi code on how to do it :( Just shows some applications that can do it. I need to progamtically get it so i can `SetForegroundWindow` on it :( – Noitidart Aug 11 '14 at 08:41
  • The question is still a duplicate. The fact is that there isn't a simple API for this, and the tools that do offer the functionality use undocumented methods in ntdll. And anyway, if you read all the answers you'll find a link to here: http://www.codeguru.com/cpp/w-p/system/article.php/c2893/EnTeHandle.htm – David Heffernan Aug 11 '14 at 08:45
  • Ah I clicked that. But I'm a very weak weinapi and c++ person. It confuses me real fast. I'm a javascript guy. So I didn't realize it. Thanks very much for pointing out its `ntdll` I'll try to find the undocumented documentation on it. If anyone knows where I can find that please share. – Noitidart Aug 11 '14 at 16:20
  • 1
    That source code is all you need. Assuming it still works. – David Heffernan Aug 11 '14 at 16:24
  • Thanks friend I didnt know that I started looking for articles on ntdll haha thanks again! – Noitidart Aug 11 '14 at 16:39
  • Aw crap I downloaded source and its all .cpp and .h files they open fine in notepad but im not sure where to look. If anyone knows of any unofficial docs it would be awesome if u can point me to them :) This function is super important to get my idea working (where if a user clicks a profile name from another profile in firefox, it will focus that profile) – Noitidart Aug 11 '14 at 16:46
  • If you cannot read those source files and understand them you have no hope. This is highly advanced stuff. If you aren't a win32 native expert then you will struggle. – David Heffernan Aug 11 '14 at 16:48
  • Aw dang, do you know anywhere I can request someone (can pay) to make an example where I can supply a string file path and it will return to me the process id(s) that are locking it. This feature is the only way for me to acheive what I'm trying to do (identify then focus firefox profile B from profile A) – Noitidart Aug 11 '14 at 16:53
  • 2
    I'll look at it if I get a chance. – David Heffernan Aug 11 '14 at 17:19
  • Thank you friend if you get a chance! This addon of mine is a pet addon. Can I get your email please mine is noitidart@gmail.com if your more comfottable can you email me your email there please. – Noitidart Aug 12 '14 at 06:16
  • https://groups.google.com/forum/#!searchin/comp.os.ms-windows.programmer.win32/lock/comp.os.ms-windows.programmer.win32/tBboXdWuEvs/nYwJMOVPPk0J – Blagoh Aug 18 '14 at 20:13
  • Hey guys I figured it out. Can you please reopen so I can post my solution. – Noitidart Sep 28 '14 at 09:39
  • solved it guys! took 2 months! http://stackoverflow.com/questions/26082122/cannot-duplicate-handle-of-file-with-known-path-but-have-its-handle-entry-info – Noitidart Oct 01 '14 at 10:14

0 Answers0