limelect 48 Posted April 26 Unlocker by Cedrick Collomb is an excellent program It unlocks a file by releasing the unlock situation without closing the process The program DOES NOT CLOSE (from lock situation) THE PROCESS ONLY THE FILE most other sources in C and Delphi close the process (exe) which I do not want. What I achieved I know if a file is locked - detect all locked files in a folder I know the process name (which I do not want to kill) that locks the file I use RmStartSession RmRegisterResources RmGetList for process name detection What I want is to release the link between a process and the locked file All sources in C and Delphi I have seen, close the process This is the easy way of doing things. This is not what I want. If you can help thanks P.S There is a source in Delphi that does not work Share this post Link to post
FPiette 383 Posted April 26 IMO it is not a good idea to unlock an locked file. Usually, a program lock a file because it is doing operation on the file which requires an exclusive access. Unlocking the file without shutting the program down will probably result in corrupted file or file in an inconsistent state when you access it (for example copy the file elsewhere). 3 Share this post Link to post
limelect 48 Posted April 26 @FPiette It is all known but still for the answer? any idea? I cannot find the handle of a file, not a process then maybe I will be able to fix my source Share this post Link to post
limelect 48 Posted April 27 (edited) @FPiette P.S. How many times you had to close the IDE to release the LOCKED database? I had to do this many times while in development. This is a small example. Edited April 27 by limelect Share this post Link to post
FPiette 383 Posted April 27 18 minutes ago, limelect said: How many times you had to close the IDE to release the LOCKED database? Never! Which database are you using? Which database access component are you using? Share this post Link to post
limelect 48 Posted April 27 (edited) FD and SQLite But this is not important as it is one example of many. I have to close programs often as they lock files needed to change I use the above program to do that so I can keep working on a program locking a file The above program Unlocker by Cedrick Collomb is excellent but is not that friendly so I wanted to do my own P.S/ some time the lock condition stay even if you close the application associated wit the file Edited April 27 by limelect Share this post Link to post
limelect 48 Posted April 27 (edited) P.S To us professionals clear the lock condition is important as we know what we are doing 50 years in the business !!!!!!!!!!!!!!!! actually lost count Edited April 27 by limelect Share this post Link to post
DelphiUdIT 176 Posted April 27 Other than Unlocker there is also a SysInternals utility that should do that, HANDLE: https://learn.microsoft.com/en-us/sysinternals/downloads/handle You can do some search to identify the Windows API that can release an handle: HANDLE of SysInternals use the PID of process to do this without close the thread or process the lock the file (or handle in general). Share this post Link to post
limelect 48 Posted April 27 (edited) 14 minutes ago, DelphiUdIT said: Other than Unlocker there is also a SysInternals utility that should do that, HANDLE: https://learn.microsoft.com/en-us/sysinternals/downloads/handle I have it I need software not applications as I know them all I need something very specific about the link (locked file ) between the process and the file Edited April 27 by limelect Share this post Link to post
limelect 48 Posted April 27 Does anyone know the mechanism behind the lock of a file? What happens between the process and the file? I do not know. Any theory? I could not find Share this post Link to post
limelect 48 Posted April 27 (edited) OK guys thanks I did succeed BUT with some tricks Now how can I find the handle of a file,(locked file), not a process All CREATE do not help some give me errors others -1 I do not want to go through all the process or handles it take time Edited April 27 by limelect Share this post Link to post
KodeZwerg 54 Posted April 28 (edited) There are many possibilities that could "lock" a file. - a file is currently accessed - a filehandle with non-share rights is created - a region lock is set - a system driver prevent access - account deny access For all counts the same rule, blast the "lock" away could have more consequences than imaginable at that moment ps: for me https://lockhunter.com/ was always doing the job in a way that I like but using I do that tool like .... once in a leap year? Edited April 28 by KodeZwerg Share this post Link to post