How to check what process opened a file? RRS feed

  • Question

  • Hello

    How to check from C++ in what process the file is opened? I am interested in Win7,8,10

    I would like to implement this 


    I have already got camera, from camera I got Physical Device Object name. I checked in Process Explorer handles of process and found out that \Device\0000004d is file.

    How to check in what process the file \Device\0000004d is opened?

    Is it possible to determine by the file name the process that opened this file?

    Or I need to enumerate all the processes in system?


    Sunday, November 17, 2019 8:05 PM

All replies

  • A way is with NtQuerySystemInformation & SystemHandleInformation

    (Restart Manager doesn't seem to find Devices on my Windows 10 OS)

    • Edited by Castorix31 Sunday, November 17, 2019 8:48 PM
    Sunday, November 17, 2019 8:46 PM
  • Hello,

    Do you resolve the issue? If you resolve the issue, please "Mark as answer" or "Vote as helpful" post to the appropriate answer, so that it will help other members to find solution quickly if they faces similar issue. If not, please feel free to contact us.

    Best Regards,

    Suarez Zhou

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, November 22, 2019 3:09 AM