List Info

Thread: How to unlock file




How to unlock file
user name
2006-04-04 10:01:01
Hi Jarek,
unlocking a locked file is not supported by any operating system.
When an application locks a file for access (ie. write) it protects itself from modifications made
by other applications. The OS guarantees, that this will work as assumed.
If you need to open a file which is opened by another app. try to open it as read-only and/or use
an appropiate share-mode (deny none). Have a look into delphi's help for "FileOpen".
Have fun
Bob

;    I need to force unlock file open by other applicaton. Can you suggest
>     any idea how to do this?
>;    
>          ;           ;      Jarek

How to unlock file
user name
2006-04-04 10:35:52
Hi Bob
you are right in that sense that it isn't oficially supported.
Nevertheless it is possible - lets have a look at
http://ccollomb.free.fr/unlocker/   or
http://sourceforge.net/project/showfiles.php?group_id=151239. But how it
is done ?

 ;           ;          Jarek

j.meierjmeiersoftware.de wrote
>; Hi Jarek,
> unlocking a locked file is not supported by any operating system.
> When an application locks a file for access (ie. write) it protects
> itself from modifications made
> by other applications. The OS guarantees, that this will work as assumed.
> If you need to open a file which is opened by another app. try to open
> it as read-only and/or use
> an appropiate share-mode (deny none). Have a look into delphi's help
> for "FileOpen".
> Have fun
> Bob
>
> >   ;  I need to force unlock file open by other applicaton. Can you
> suggest
> >   ;  any idea how to do this?
>; >   ;
> >   ;           ;           ;  Jarek
>;
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>
>
>; ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>;
>     *  Visit your group "delphi-en
>  ; &nbsp; &nbsp; <http://groups.yahoo.com/group/delphi-en>;" on the web.
>  ; &nbsp; &nbsp; 
>&nbsp; &nbsp;  *  To unsubscribe from this group, send an email to:
>&nbsp;   ; &nbsp;  delphi-en-unsubscribe@yahoogroups.com
>  ; &nbsp; &nbsp; <mailto:delphi-en-unsubscribe@yahoogroups.com?subject=Unsubscribe>
&gt; &nbsp; &nbsp; &nbsp; 
>&nbsp; &nbsp;  *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>&nbsp; &nbsp;   ; Service <http://docs.yahoo.com/info/terms/>.
&gt;
>
&gt; ------------------------------------------------------------------------
&gt;
>
&gt;
> __________ NOD32 Informacje 1.1469 (20060404) __________
>
>; Wiadomosc zostala sprawdzona przez System Antywirusowy NOD32
>; http://www.nod32.com lub http://www.nod32.pl

How to unlock file
user name
2006-04-04 10:51:58
Well, obviously, you could have a glimpse on the sourcecode of the
SourceForge-based project, now couldn't you?

Cheers
Mike

&nbsp;   ;   &nbsp; &nbsp; 
___________________________________________________________
Yahoo! Photos – NEW, now offering a quality print service from just 8p a photo http://uk.photos.yahoo.com
How to unlock file
user name
2006-04-04 11:43:08
I've seek sourceforge in the hope to find something but yhe problem is
that DeleteFileLock project on sourcrforge is only as windows exe :-(

&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; Jarek

Michał Woźniak wrote:
&gt; Well, obviously, you could have a glimpse on the sourcecode of the
> SourceForge-based project, now couldn't you?
>
&gt; Cheers
&gt; Mike
>
; &nbsp; &nbsp; &nbsp; &nbsp;  
> ___________________________________________________________
> Yahoo! Photos � NEW, now offering a quality print service from just 8p
> a photo http://uk.photos.yahoo.com
>;
>
&gt; -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
>
>
>; ------------------------------------------------------------------------
&gt; YAHOO! GROUPS LINKS
>;
>&nbsp; &nbsp;  *  Visit your group "delphi-en
>  ; &nbsp; &nbsp; <http://groups.yahoo.com/group/delphi-en>;" on the web.
>  ; &nbsp; &nbsp; 
>&nbsp; &nbsp;  *  To unsubscribe from this group, send an email to:
>&nbsp;   ; &nbsp;  delphi-en-unsubscribe@yahoogroups.com
>  ; &nbsp; &nbsp; <mailto:delphi-en-unsubscribe@yahoogroups.com?subject=Unsubscribe>
&gt; &nbsp; &nbsp; &nbsp; 
>&nbsp; &nbsp;  *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>&nbsp; &nbsp;   ; Service <http://docs.yahoo.com/info/terms/>.
&gt;
>
&gt; ------------------------------------------------------------------------
&gt;
>
&gt;
> __________ NOD32 Informacje 1.1469 (20060404) __________
>
>; Wiadomosc zostala sprawdzona przez System Antywirusowy NOD32
>; http://www.nod32.com lub http://www.nod32.pl

How to unlock file
user name
2006-04-04 14:30:35
Duży Królik wrote:
&gt; Hi Bob
> you are right in that sense that it isn't oficially supported.
> Nevertheless it is possible - lets have a look at
> http://ccollomb.free.fr/unlocker/ &nbsp; or
> http://sourceforge.net/project/showfiles.php?group_id=151239. But how it
> is done ?
>
>&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  Jarek

Well, I can think of several ways:

1)  Get direct access to the table of all file handles in the system.
Requires kernel-mode privileges.  And lots of "hand waving&quot;.

2)&nbsp; Inject a small bit of executable code into another process' space
using CreateRemoteThread() and related kin.  Once inside the process
space, execute CloseHandle() on the desired handle.&nbsp; You can probably
enumerate another process' file handles without injecting anything.

3)  Inject a kernel API monitor (hooks API calls) and watch all calls to
and from the kernel.&nbsp; Then attempt to replicate the procedure and pull
lots of hair out trying to figure out what went wrong.&nbsp; Best to use this
approach with a program that has had most of the bugs stamped out of it:

http://www.sysinternals.com/Utilities/ProcessExplorer.html


Ran a quick Google search and came up with this (very hacky) partial
solution:

http://vmsone.com/~decuslib/vmssig/vmslt97a/ntstuff/enumhand.txt

If you don't mind a full solution being NT-only (i.e. not Win9x/Me), you
can combine the above partial solution with this:

http://www.codeguru.com/Cpp/W-P/files/fileio/article.php/c1287/

IMPORTANT:  The first link depends on the Windows DDK, which can be
obtained for free via slightly questionable means (KMDF):

http://www.microsoft.com/whdc/driver/wdf/KMDF.mspx
http://download.microsoft.com/download/3/b/5/3b519887-c4af-4ab3-9578-cec48cc84d94/WDFv10.iso

(Usually you have to pay for the [Server 2003 SP1] DDK.  Second link is
a direct download link to the 263MB ISO image).

--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

Safe C++ Design Principles (First Edition)
Learn how to write memory leak-free, secure,
portable, and user-friendly software.

Learn more and view a sample chapter:
http://www.CubicleSoft.com/SafeCPPDesign/

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )