openfiles.exe uses NtQuerySystemInformation (mainly with SystemExtendedHandleInformation),
so it is complicated and it is easier to parse the output of openfiles.exe...
VB.net Get username of locked file in network location
et3ishak a
1
Reputation point
Hello I am attempting to find a way in .Net that gives the name of a user who has a file open in a network location. I prefer to use a .Net library and avoid wrapping openfiles.exe.
Any help is apprecited!
2 answers
Sort by: Most helpful
-
Castorix31 84,471 Reputation points
2021-06-10T14:26:18.837+00:00 -
Xiaopo Yang - MSFT 12,721 Reputation points Microsoft Vendor
2021-06-29T06:42:55.367+00:00 We open file with FILE_READ_ATTRIBUTES and call NtQueryInformationFile with FileProcessIdsUsingFileInformation. on return we got FILE_PROCESS_IDS_USING_FILE_INFORMATION structure where list of ProcessId which hold this file. Here is a sample.