Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling applications from a service

Status
Not open for further replies.

Guern

Programmer
Jun 22, 2001
91
GB
Hi,

I tested this code running it in the console and it works fine, but if I run the same code from a service, the application runs, but the arguments never get passed.

Does anyone know a way to get this to work?

Dim psi As New System.Diagnostics.ProcessStartInfo("C:\program files\ClamWin\bin\clamscan")
psi.RedirectStandardOutput = True
psi.WindowStyle = ProcessWindowStyle.Hidden
psi.CreateNoWindow = True
psi.UseShellExecute = False
Dim VirusScan As System.Diagnostics.Process
psi.Arguments = "-d=" & Chr(34) & "c:\documents and settings\all users\.clamwin\db" & Chr(34) & " " & Chr(34) & FileObject & Chr(34) & " --infected --debug"
VirusScan = System.Diagnostics.Process.Start(psi)

logger.add("XX", "Calling ClamAV with " & psi.Arguments, False)

Dim myOutput As System.IO.StreamReader = VirusScan.StandardOutput
VirusScan.WaitForExit()
If VirusScan.HasExited Then
output = myOutput.ReadToEnd
logger.add("XX",output)
End If
logger.add("XX", "Clam returned " & VirusScan.ExitCode(), True)
 
Services don't run on a (or any) desktop, so there's no user interface available. Some programs don't like this.

I'm curious, though. Most virus scan products are designed to run as a service, as that's the only way for them to get hooks into the filesystem & network stacks. Why does this one need help in this regard?

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Real time scanning does not work for my application, nor is it needed/wanted. I have the service set to 'interact with the desktop', so I don't think that's the problem. The software does work, it's just that the .net call does not pass the parameters when the application is run as a service.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top