SPONSORS:






User Tag List

Results 1 to 6 of 6
  1. #1
    Senior Member
    Join Date
    Nov 1999
    Location
    Eagle, ID,USA
    Posts
    1,035
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Killing a process

    I need to figure a way to kill a child process using SilkTest. For example: if the application under test crash's, I need to be able to terminate all the process's that the application launch's. I am able to kill the process for the application using the GetWindowThreadProcessId API call but that doesn't work for any lingering process's created when invoking the app.
    Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.

  2. #2
    Senior Member
    Join Date
    Nov 1999
    Location
    Eagle, ID,USA
    Posts
    1,035
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Killing a process

    That would be one way to do it. I would just prefer to do it behind the scenes. I have experienced instances using SilkTest where the tool would randomly fail to do what was requested for some unexplainable reason. Doing an API call seemed to be the most reliable way. I have found a couple of API's called EnumProcesses and GetModuleBaseName from psapi.h that appears to be the answer to my problem but I'm having trouble implementing them in SilkTest as my knowledge of c++ is very limited and I'm not completely understanding the functions. psapi.h is installed with Microsoft's platform sdk
    Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.

  3. #3
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Killing a process

    Why not declare TaskManager and create some methods to kill the process you'd like...

    I know I did that a few years ago.

    ------------------
    AJ Alhait
    BetaSoft Inc.
    AJ Alhait
    BetaSoft Inc.

  4. #4
    Senior Member
    Join Date
    Oct 1999
    Location
    Tyngsborough, MA
    Posts
    211
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Killing a process

    I've been using GetAppID() and kill.exe to kill a process. It sounds like you're situation is a bit more complicated? If you know the list of process that are spawned, you can certainly use kill.exe. I agree strongly about doing things behind the scenes, definitely the way to go. I'm thinking about posting a request for people to share their WinAPI declarations. It would be really cool to have such a resource.

  5. #5
    Senior Member
    Join Date
    Nov 1999
    Location
    Eagle, ID,USA
    Posts
    1,035
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Killing a process

    I'm unfamiliar with kill.exe. Can you explain further? I agree with your idea of sharing API code. Let me know if you get anywhere on this.
    Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.

  6. #6
    Junior Member
    Join Date
    Aug 2000
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Killing a process

    Did this get their? Hmmm, post again I guess.

    [ ] use "msw32.inc"
    [+] dll "kernel32.dll"
    [ ] // added by ShaneD wellsfargo
    [ ] // Used in kill browser
    [ ] //
    [ ] BOOL TerminateProcess(HWND hProcess, UINT uExitCode)
    [ ] HWND OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD wProcessId)
    [ ] BOOL CloseHandle(HWND hObject)
    [ ]
    [-] boolean KillBrowser ()
    [ ] // By getting the pid of the browser application
    [ ] // we can kill it. Since just closing a window may
    [ ] // not be enough.
    [ ] //
    [ ] const LONG PROCESS_ALL_ACCESS = 0x000F0000 | 0x00100000 | 0xFFF
    [ ]
    [ ] boolean Result = False
    [ ]
    [+] if (True == Browser.Exists())
    [ ] integer ProcessID = Browser.GetAppId( )
    [ ] HWND hProcess = OpenProcess (PROCESS_ALL_ACCESS, 0, ProcessID)
    [ ]
    [+] if (hProcess)
    [+] if (TerminateProcess (hProcess, 99))
    [ ] CloseHandle (hProcess)
    [ ] Result = True
    [ ]
    [ ] Sleep(2)
    [ ]
    [ ] return Result
    [ ]
    [ ]

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:32 PM.

Copyright BetaSoft Inc.