Jump to content
limelect

LOCKED FILE

Recommended Posts

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

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).

  • Like 3

Share this post


Link to post

@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
Posted (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 by limelect

Share this post


Link to post
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
Posted (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 by limelect

Share this post


Link to post
Posted (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 by limelect

Share this post


Link to post

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
Posted (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 by limelect

Share this post


Link to post
Posted (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 by KodeZwerg

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×