🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10760

Obtaining process id

#10760
From: Chris ( Val )
Date: Wed, 24 Mar 2004 14:31
28 lines
1457 bytes
Hi everyone.

I'm going nuts trying to find a way to get the PID
of a locked file. Here is what I would like to do
with a code sample:

long GetPID( const char* filename )
 {
  long PID( 0 );

  // Do what ever it takes to get the process id
  // for the filename passed in, which is in an
  // locked state.

  return PID;
 }

Is this at all possible ?

My ultimate goal is to find out which application is
locking a particular file, and log the process id and
the offending application(exe) name into the database
for further analysis.

Any help appreciated.

Cheers.
Chris Val
Technical Details
Message-ID: <40619ba9@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,8f802efbcb83e75e,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-03-24 06:40:45 PST
From: "Chris \( Val \)" <chrisval@bigpond.com.au>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Obtaining process id
Date: Thu, 25 Mar 2004 01:31:03 +1100
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 144.139.97.89
Message-ID: <40619ba9@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1080138665 144.139.97.89 (24 Mar 2004 06:31:05 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail