Determine whether process is running, from ISAPI DLL
$30-100 USD
En curso
Publicado hace alrededor de 19 años
$30-100 USD
Pagado a la entrega
The task is to improve the following code until it works when used from inside an ISAPI DLL running under LocalSystem on WinNT, WinXP and Win2003. "Works" means that 0 is not returned due to a Windows error such as "Access is denied", when a valid processid is provided.
function IsProcessRunning(PID: DWord): Boolean;
var
H: THandle;
begin
H := OpenProcess(STANDARD_RIGHTS_REQUIRED, True, PID);
Result := (0 <> H);
if H = 0 then
begin
{can be caused by "Access is denied" error}
Result := True;
end
else
CloseHandle(H);
// note that the process could be "hung" but still "running"
end;
Notes: 1. The code above works in normal cases, e.g. a standalone EXE. 2. The job is to make this work under Microsoft IIS ISAPI DLL using the default security conditions, which is to say, running as LocalSystem. Hint: If you would like to win this bid quickly, consider sending a DLL without source, showing the right answer. The query string could be ?PID, where "PID" is the process id to check, example /scripts/[login to view URL] and that would simply return 'yes' or 'no' depending on whether the process #2010 is running. Here is some code relating to creating a global security descriptor, which may help you:
var
//sharing across the process/service boundary with a global security record
gsa: TSecurityAttributes;
...
initialization
//setup the security record
[login to view URL]:= SizeOf(gsa);
[login to view URL]:= True;
GetMem([login to view URL],SECURITY_DESCRIPTOR_MIN_LENGTH);
InitializeSecurityDescriptor([login to view URL],1 {SECURITY_DESCRIPTOR_REVISION});
SetSecurityDescriptorDacl([login to view URL],True,nil,False); //all access
finalization
FreeMem([login to view URL],SECURITY_DESCRIPTOR_MIN_LENGTH);
[login to view URL];
NullEvent:=nil;
## Deliverables
Source code in Delphi 6 or 7. If you want to compile your sample DLL with Delphi 7 packages, that is fine. If using Delphi 6, please do not use packages.
* * *This broadcast message was sent to all bidders on Friday Feb 18, 2005 11:27:52 AM:
Note: Bidding deadline extended
## Platform
WinNT, WinXP, Win2003 Microsoft IIS (w3svc World Wide Web publishing service) The programming language is Borland Delphi 6 or 7 (Object Pascal).