Win32 files locked for reading: how to find out who's locking them

后端 未结 2 396
情深已故
情深已故 2020-12-10 17:08

In C++ (specifically on Visual C++), sometimes you cannot open a file because another executable has it opened and is not sharing it for reads. If I try to open such a file

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-10 17:31

    In Windows 2000 and higher, you cannot do this without using a kernel-mode driver. Process Explorer and other similar tools load a driver automatically to accomplish this. This is because the file handles are in kernel space and not accessible by user-mode applications (EXE files).

    If you are really interested in doing this, take a look at this project.

提交回复
热议问题