I am trying to keep the explorer.exe KILLED till an event.
I mean i have an xml file which i read from my windows service background worker. It waits for a value, till than the explorer.exe should not execute, its for security purpose.
I have tried till now :
While (True)
Dim doc As New XmlDocument
doc.Load("C:\Users\Alpha-Guy\AppData\Local\Packages\new-design_sa0tb4645bqbp\LocalState\metadata.xml")
Dim list = doc.GetElementsByTagName("authenticated")
var_auth = list(0).InnerText
If var_auth = "0" Then
Dim pro As Process
pro = Process.GetProcessesByName("explorer")(0)
If pro IsNot Nothing Then
pro.Kill()
End If
End If
If var_auth = "1" Then
Dim pro As Process
pro = Process.GetProcessesByName("explorer")(0)
If pro Is Nothing Then
Process.Start("c:\windows\explorer.exe")
End If
End If
End While
this code is written in backgroundWorker's doWork() event.
my windows service will check for a value in xml database, if its 0 then it will check if explorer.exe is started or not, if yes than kill it.
if the value in xml file i found 1 than it will check if explorer.exe is started or not, if not than start it.
Problem : when i start the service, it kills the explorer.exe once, but explorer.exe open automatically and the service fails to kill it again.
Error : Accecss is denied.
if its some permission problem than how would it killed first time ??
Is there any problem with the code ???