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)
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)