Re: Checking if a file is opened

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



hi again Frank,

I may have a more appropriate sysinternals utility for you.

Take a look at the "Process Explorer v9.25" found here:

    http://www.sysinternals.com/ProcessesAndThreadsUtilities.html

--- <quote> ---
Find out what _FILES_ (emphasis mine), registry keys and
other objects processes have open...
--- </quote> ---

I am not quite up to date with the latest version, but the v8.xx
version has an upper pane showing the processes, and a multi-
purpose "lower pane".  If you configure the lower pane to show
"system handles", and click on a particular process, then you get
a listing of system resource "handles" in the lower pane.

If you peruse through the handle listing, you will see lots of
"techy" stuff, (like mutexes and semaphores), but also the handles
of open files.  In other words it gives you a listing of files
associated with each process (i.e., each app).

Frankly, I have looked at a lot of vb source code, and not seen
anything that would produce a listing of system resource handles
like the sysinternals process explorer produces. I strongly suspect that Mark Russinovich and Bryce Cogswell have a deep-throat-
Microsoftie" who is giving them information about windows internal tables, or else Mark & Bryce have spent weeks, months, even YEARS combing through hex dumps "reverse engineering" the system internal tables to get that listing of handles.


The point is, I don't think you are going to easily find anything
like what Mark and Bryce have coded up.  Certainly not in any
scripting language or 3rd-party objects, and probably not even in
any vb code.

cheers, jw



FrankWinkler wrote:
Hi jw!

Thanks for your reply. I think you're right. It seems to be not so easy
to find out directly which file is opened by which application using a
pure script.

I think the easiest solution would be to use a script that returns a
list that is similar to the list showed on the first tab of Windows
Task Manager. In this list not only the running applications are shown,
the opened files are displayed, too. By calling such a script maybe
every 2 seconds and looking in the returned list for the interesting
file(s), it should be possible to find out if a file is opened or
closed. The delay (maybe 2 seconds) should'nt be that problem.

Of course I looked for a a solution like that. Unfortunatelly I found
only lots of scripts for getting the running processes (like second tab
in Task Manager) using Win32_process. Maybe someone here knows a
solution (script) that returns that applictaion list?

Frank

.



Relevant Pages

  • Re: [Regression: 2.6.25-rc5: Blank Screen: Intel 945]
    ... Bryce, please see below for a few more questions, thanks.] ... command when it starts that script and gets to the end. ... I haven't looked at the Ubuntu scripts before. ...
    (Linux-Kernel)
  • Re: Get the cwd of a process?
    ... COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ... puzzled by the ps listing. ... parentheses, but if I invoke a similarly-named script from the shell, ... recently where a perl script was called from an infiltrated Wordpress ...
    (freebsd-questions)
  • Re: getting around a permissions problem
    ... They have the ability here to upload ... The problem I have is that when they add a listing and the directory gets ... access, however, I also need to make it accessible to the owner via ftp so ... You could use a suid script. ...
    (comp.lang.php)
  • UNIX Scripting
    ... I'm looking to develop a UNIX script for Solaris which will give me ... Listing of SUID/SGIDs ... Password parameters ... I want to write the script, but does anyone recommend how it should be ...
    (comp.unix.admin)
  • Re: VBScript method to show all variable values?
    ... there is no convenient "pure script" method for this. ... a listing of the variables. ... "rich-text" control to colorize source code, including vbs. ... I am writing a log sub ...
    (microsoft.public.scripting.vbscript)