Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    porhaxn's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    85
    Reputation
    10
    Thanks
    13

    [Help]If proccess starts then delete files

    Code:
    Try
    Dim TargetProcess As Process() = Process.GetProcessesByName( "EndingBanner")
    If TargetProcess.Length0 Then
    My.Computer.FileSystem.DeleteFile( "C:\Nexon\Combat Arms\Game\GUNS_M_PV_SMG.rez",FileIO.UIOption.OnlyErrorDialogs,FileIO.RecycleOp tion.DeletePermanently,FileIO.UICancelOption.DoNot hing)
    My.Computer.FileSystem.DeleteFile( "C:\Nexon\Combat Arms\Game\GUNS_T_PV_SMG.rez",FileIO.UIOption.OnlyErrorDialogs,FileIO.RecycleOp tion.DeletePermanently,FileIO.UICancelOption.DoNot hing)
    End If
    Catch ex As Exception
    'Display error message here...
    End Try

    I tried this code, it was really nice, maybe i wasn't clear enough. But i want it to be able to detect the start of proccess "Ending banner", so as soon as proccess "ending banner" starts, it starts killing files.
    Last edited by porhaxn; 06-01-2010 at 05:29 AM.
    [IMG]https://i371.photobucke*****m/albums/oo155/Remixdvd/PRMT_PorHaxn.gif[/IMG]

    MPGH respect list:
    [MPGH]Obama

  2. #2
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by porhaxn View Post
    so.. i need the codes for if proccess A.exe starts then my program deletes files A and File B. And then the program shuts down it self.

    I'll had more details if needed.

    [php]
    Dim TargetProcess As Process() = Process.GetProcessesByName(txtprocess.Text) 'substitute txtprocess with whatever'
    If TargetProcess.Length <> 0 Then
    My.Computer.FileSystem.DeleteFile("C:\Example\Exam ple") 'change this to your file path that you want to delete'
    End
    End If
    [/php]
    Oh yeah for the Process.GetProcessesByName("example") don't include .exe.

    i.e this will work
    [php]
    Dim TargetProcess As Process() = Process.GetProcessesByName("notepad")
    [/php]

    But this won't

    [php]
    Dim TargetProcess As Process() = Process.GetProcessesByName("notepad.exe")
    [/php]

    Hope that helps
    Last edited by Jason; 06-01-2010 at 12:02 AM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  3. The Following User Says Thank You to Jason For This Useful Post:

    porhaxn (06-01-2010)

  4. #3
    porhaxn's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    85
    Reputation
    10
    Thanks
    13
    thanks will take a look
    [IMG]https://i371.photobucke*****m/albums/oo155/Remixdvd/PRMT_PorHaxn.gif[/IMG]

    MPGH respect list:
    [MPGH]Obama

  5. #4
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by porhaxn View Post
    thanks will take a look
    No problems, it should work.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  6. #5
    porhaxn's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    85
    Reputation
    10
    Thanks
    13
    Can we target the proccess by location of the file?
    Edit:
    Code:
     Dim TargetProcess As Process() = Process.GetProcessesByName(notepad)
                    If TargetProcess.Length <> 0 Then
                        Kill("C:\Nexon\Combat Arms\Filename")
    
                        End
                    End If
    would this work, i mean differenct between kill and delete files
    Last edited by porhaxn; 06-01-2010 at 12:24 AM.
    [IMG]https://i371.photobucke*****m/albums/oo155/Remixdvd/PRMT_PorHaxn.gif[/IMG]

    MPGH respect list:
    [MPGH]Obama

  7. #6
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by porhaxn View Post
    Can we target the proccess by location of the file?
    Edit:
    Code:
     Dim TargetProcess As Process() = Process.GetProcessesByName(notepad)
                    If TargetProcess.Length <> 0 Then
                        Kill("C:\Nexon\Combat Arms\Filename")
    
                        End
                    End If
    would this work, i mean differenct between kill and delete files
    No, you can't. You can delete the file so that the process won't run again. But for killing (i.e; for 1 time) you need to use the process class.

  8. #7
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by porhaxn View Post
    Can we target the proccess by location of the file?
    Edit:
    Code:
     Dim TargetProcess As Process() = Process.GetProcessesByName(notepad)
                    If TargetProcess.Length <> 0 Then
                        Kill("C:\Nexon\Combat Arms\Filename")
    
                        End
                    End If
    would this work, i mean differenct between kill and delete files
    Quick question, are you trying to create an auto-clean feature for a CA cleaner by any chance?

    What exactly are you trying to kill in the CA folder? If it's not CA itself I'm pretty sure you can go with the code you've got there... dunno

    Oh yeah the first line of your code should be

    [php]
    Dim TargetProcess As Process() = Process.GetProcessesByName("notepad")
    [/php]

    That code you have there will kill("C:\Nexon\Combat Arms\Filename") whenever notepad opens.

    Oh yeah with "kill" functions you should either add a try-catch block or an

    [php]
    On Error Resume Next
    [/php]

    Because after the first time you kill the files, it will return a "cannot find this file" error and close the whole program down.
    Last edited by Jason; 06-01-2010 at 02:08 AM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  9. #8
    porhaxn's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    85
    Reputation
    10
    Thanks
    13
    Nope, not making a cleanner

    Code:
            Dim TargetProcess As Process() = Process.GetProcessesByName("EndingBanner")
            If TargetProcess.Length <> 0 Then
                Kill("C:\Nexon\Combat Arms\Game\GUNS_M_PV_SMG.rez")
                Kill("C:\Nexon\Combat Arms\Game\GUNS_T_PV_SMG.rez")
    this means if endingbanner.exe starts, these files will be deleted?

    and please fix the On error resume next for me thanks

    And how do we add exit the program itself after it deleting the files?
    Last edited by porhaxn; 06-01-2010 at 02:21 AM.
    [IMG]https://i371.photobucke*****m/albums/oo155/Remixdvd/PRMT_PorHaxn.gif[/IMG]

    MPGH respect list:
    [MPGH]Obama

  10. #9
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by porhaxn View Post
    Nope, not making a cleanner

    Code:
            Dim TargetProcess As Process() = Process.GetProcessesByName("EndingBanner")
            If TargetProcess.Length <> 0 Then
                Kill("C:\Nexon\Combat Arms\Game\GUNS_M_PV_SMG.rez")
                Kill("C:\Nexon\Combat Arms\Game\GUNS_T_PV_SMG.rez")
    this means if endingbanner.exe starts, these files will be deleted?

    and please fix the On error resume next for me thanks

    And how do we add exit the program itself after it deleting the files?
    On Error Resume Next is not a good wrapper to handle errors. Use Try...Catch Block. Anyways, here's the code you need:

    Try
    Dim TargetProcess As Process() = Process.GetProcessesByName( "EndingBanner")
    If TargetProcess.Length0 Then
    My.Computer.FileSystem.DeleteFile( "C:\Nexon\Combat Arms\Game\GUNS_M_PV_SMG.rez",FileIO.UIOption.OnlyErrorDialogs,FileIO.RecycleOp tion.DeletePermanently,FileIO.UICancelOption.DoNot hing)
    My.Computer.FileSystem.DeleteFile( "C:\Nexon\Combat Arms\Game\GUNS_T_PV_SMG.rez",FileIO.UIOption.OnlyErrorDialogs,FileIO.RecycleOp tion.DeletePermanently,FileIO.UICancelOption.DoNot hing)
    End If
    Catch ex As Exception
    'Display error message here...
    End Try

    Hope this helps !!

  11. The Following User Says Thank You to Hassan For This Useful Post:

    porhaxn (06-01-2010)

  12. #10
    porhaxn's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    85
    Reputation
    10
    Thanks
    13
    Quote Originally Posted by FLAMESABER View Post
    On Error Resume Next is not a good wrapper to handle errors. Use Try...Catch Block. Anyways, here's the code you need:

    Try
    Dim TargetProcess As Process() = Process.GetProcessesByName( "EndingBanner")
    If TargetProcess.Length0 Then
    My.Computer.FileSystem.DeleteFile( "C:\Nexon\Combat Arms\Game\GUNS_M_PV_SMG.rez",FileIO.UIOption.OnlyErrorDialogs,FileIO.RecycleOp tion.DeletePermanently,FileIO.UICancelOption.DoNot hing)
    My.Computer.FileSystem.DeleteFile( "C:\Nexon\Combat Arms\Game\GUNS_T_PV_SMG.rez",FileIO.UIOption.OnlyErrorDialogs,FileIO.RecycleOp tion.DeletePermanently,FileIO.UICancelOption.DoNot hing)
    End If
    Catch ex As Exception
    'Display error message here...
    End Try

    Hope this helps !!
    K flame, i tried your code. It was really nice, maybe i wasn't clear enough. But i want it to be able to detect the start of proccess "Ending banner", so as soon as proccess "ending banner" starts, it starts killing files.
    [IMG]https://i371.photobucke*****m/albums/oo155/Remixdvd/PRMT_PorHaxn.gif[/IMG]

    MPGH respect list:
    [MPGH]Obama

  13. #11
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    I think it's easier to just check when Engine.exe stops running O.o.

    But for EndingBanner.exe....

    I just aircoded this so It might not work 100%

    add a timer, delay 100 and enabled = True

    [php] Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    Dim TargetProcess As Process() = Process.GetProcessesByName("EndingBanner")
    If TargetProcess.Length <> 0 Then
    Try
    Kill("C:\Nexon\Combat Arms\Game\GUNS_M_PV_SMG.rez")
    Kill("C:\Nexon\Combat Arms\Game\GUNS_T_PV_SMG.rez")
    Application.Exit() 'ends your program'

    Catch ex As Exception
    'If you want it to display the error in a message box do MsgBox(ErrorToString)'

    End Try

    End If
    End Sub
    [/php]

    you can make a separate kill function to minimize repeated code but it's optional

    [php]

    Private Sub KillFile (ByVal rez as String)
    Kill("C:\Nexon\Combat Arms\" + rez + ".rez")
    End Sub

    [/php]

    Then to use it:

    [php]

    KillFile("GUNS_T_PV_SMG") 'change this to whatever rez name (don't need to include ".rez" but make sure you use the double quotes '

    [/php]

    And yeah...I think that's what you want to do?

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  14. #12
    porhaxn's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    85
    Reputation
    10
    Thanks
    13
    Thanks Deezy, and i would like to use the one which checks if engine.exe stops running, it would work out better. But it seems to be deleting files before engine.exe even starts -.-
    [IMG]https://i371.photobucke*****m/albums/oo155/Remixdvd/PRMT_PorHaxn.gif[/IMG]

    MPGH respect list:
    [MPGH]Obama

  15. #13
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Yes because it checks whether the process is running or not, and if not it will do all the crap you want. So any time that engine isn't running it will do the commands.

    To when Engine is not running AFTER it has been opened I think the most straightforward way is to incorporate 2 timers. There's other ways but this one is pretty easy.

    Okay so this timer checks whether Engine has started or not, if it has it starts the close timer running.

    Don't forget to Enable this timer.

    [php]
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
    Dim TargetProcess As Process() = Process.GetProcessesByName("Engine")
    If TargetProcess.Length <> 0 Then
    Timer1.Enabled = True
    Else : Timer2.Enabled = False
    End If
    End Sub
    [/php]

    Now for the timer that checks whether Engine has stopped running.

    [php]
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    Dim TargetProcess As Process() = Process.GetProcessesByName("Engine")
    If TargetProcess.Length = 0 Then 'note Length = 0 now, not <> 0, this is important'
    Try
    Kill("C:\Nexon\Combat Arms\Game\GUNS_M_PV_SMG.rez")
    Kill("C:\Nexon\Combat Arms\Game\GUNS_T_PV_SMG.rez")
    Application.Exit()
    Timer1.Enabled = False()
    Catch ex As Exception
    'If you want it to display the error in a message box do MsgBox(ErrorToString)'

    End Try

    End If
    End Sub
    [/php]

    Think that'll work

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  16. #14
    porhaxn's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    85
    Reputation
    10
    Thanks
    13
    I've tested the air coded endingbanner one works perfectly! I don't know how to thank you lol

    EDIT:
    for the engine.exe one do i just enable the first timer?

    and for the
    " Timer1.Enabled = False() " the FALSE part i got error
    Expression is not an array or a method, and cannot have an arguement list
    Last edited by porhaxn; 06-01-2010 at 06:00 AM.
    [IMG]https://i371.photobucke*****m/albums/oo155/Remixdvd/PRMT_PorHaxn.gif[/IMG]

    MPGH respect list:
    [MPGH]Obama

  17. #15
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    hehe don't mention it. I'm still a VB beginner too so being able to actually help someone out is nice change :P

    I created another code for you that doesn't rely on 2 timers (for Engine)

    Pretty sure this should work, haven't actually tested it.

    add this declaration to the top of your form, just under "Public Class Form1"

    [php]
    Dim i As Integer = 1
    [/php]

    Now make your timer enabled and delay of like 1-100 doesn't really matter

    [php]
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    Dim TargetProcess As Process() = Process.GetProcessesByName("Engine")


    Select Case (i)
    Case 1
    If TargetProcess.Length <> 0 Then
    i = 2
    End If

    Case 2
    If TargetProcess.Length = 0 Then
    Try
    Kill("C:\Nexon\Combat Arms\Game\GUNS_M_PV_SMG.rez")
    Kill("C:\Nexon\Combat Arms\Game\GUNS_T_PV_SMG.rez")
    i = 1
    Application.Exit()
    Catch ex As Exception
    'If you want it to display the error in a message box do MsgBox(ErrorToString)'
    End Try
    End If
    End Select


    End Sub
    [/php]

    EDIT:

    With your Timer1.Enabled = False() error

    remove the double brackets
    should be

    [php]
    Timer1.Enabled = False
    [/php]
    Last edited by Jason; 06-01-2010 at 06:08 AM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  18. The Following User Says Thank You to Jason For This Useful Post:

    porhaxn (06-01-2010)

Page 1 of 2 12 LastLast

Similar Threads

  1. [Help] Deleting files permanently[Solved]
    By nathanael890 in forum Visual Basic Programming
    Replies: 9
    Last Post: 01-21-2011, 05:58 AM
  2. Replies: 17
    Last Post: 04-06-2009, 11:44 PM
  3. Need help on how to get sorce files...
    By hockey97 in forum General Hacking
    Replies: 1
    Last Post: 07-24-2008, 06:18 PM
  4. help:error on start
    By BBXX420 in forum WarRock Korea Hacks
    Replies: 2
    Last Post: 08-15-2007, 12:55 AM
  5. Replies: 13
    Last Post: 08-08-2007, 03:03 AM