Results 1 to 23 of 23

Thread: [2005] Disabling users from ending my application

  1. #1

    Thread Starter
    Member kadem's Avatar
    Join Date
    Nov 2004
    Posts
    50

    Question [2005] Disabling users from ending my application

    I've written an application to control user usage of a computer based on time, that was easy but, how can I protect my application so that user can't use the task manager to end it?
    Note that I still want the user to access the task manager.

  2. #2
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [2005] Disabling users from ending my application

    I dont know if you can, unless maybe running the app under an admin user or something and see if a regular user that doesnt have permissions are allowed to close it.

    Controlling access by time can be done through the regular windows admin functions and user policy, though, and should actually be done instead... its what user and group policies are for...

  3. #3
    Hyperactive Member Grunt's Avatar
    Join Date
    Oct 2004
    Location
    Las Vegas
    Posts
    499

    Re: [2005] Disabling users from ending my application

    well, your getting into a grey area here by doing this, but you can disable the task manager through the registry. I have done it before, but not sure which key it is.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] Disabling users from ending my application

    Using a GPO would probably be your best bet since you still need to allow access to the TM.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Re: [2005] Disabling users from ending my application

    Disable the task manager and make your own task manager

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] Disabling users from ending my application

    Better still, in 2005 you have the FormClosing event of a form with a closing e argument that you can determine the reason why its closing.

    Check for the TaskManagerClosing as the e.CloseReason value and cancel the action.


    VB Code:
    1. Private Sub Form1_FormClosing(sender as Object, e as FormClosingEventArgs) Handles Form1.FormClosing
    2.     If e.CloseReason = TaskManagerClosing Then
    3.         e.Cancel = True
    4.     End If
    5. End Sub
    Note, using this technique can lead to trouble closing your app if there is an error or some undesired behavior where the form either doesnt have or isnt working to close the form and you really do need to close it. In such a case your app will not be closable and you would have to reboot or logoff.
    Last edited by RobDog888; Oct 29th, 2006 at 03:56 PM.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] Disabling users from ending my application

    If you use RobDog's method, instead of just canceling the close, maybe you prompt for a password. If the correct password is given, you close it, if not, it stays open.

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] Disabling users from ending my application

    Good suggestion, I like it!

    I was worried about not being able to close the app yourself when you really need to like non-responses and program hangs etc.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: [2005] Disabling users from ending my application

    Here is an example on how to catch the ctrl alt delete combo, and react to the task manager.

    DisableTaskMgr

    EDIT: But you want to still be able to use the task manager.
    What level of access to the task manager is acceptable?
    For example you can disable the right click that allows the user to Terminate the process. And disable the end process button ofcourse.
    Last edited by TTn; Oct 29th, 2006 at 09:18 PM.

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] Disabling users from ending my application

    Referring to the right click: they can also select the process and click on the "End Process" button.

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: [2005] Disabling users from ending my application

    It looks funny now, because I appended my post, just as you were posting. Hehe.

    This is a specific question, which needs more than protection against the closing event. I'm sure there are a few other details, that need to be protected.

  12. #12

    Thread Starter
    Member kadem's Avatar
    Join Date
    Nov 2004
    Posts
    50

    Post Re: [2005] Disabling users from ending my application

    Quote Originally Posted by Negative0
    If you use RobDog's method, instead of just canceling the close, maybe you prompt for a password. If the correct password is given, you close it, if not, it stays open.
    Thank you guys, it seemed to be the best solution for this.

  13. #13

    Thread Starter
    Member kadem's Avatar
    Join Date
    Nov 2004
    Posts
    50

    Re: [2005] Disabling users from ending my application

    I've just tried closing the application with RobDog code using the Task Manager; it works fine the first time you end it, but if the user keep ending the task it will eventually get ended!

  14. #14
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] Disabling users from ending my application

    How do you mean? Like rapid clicking or something?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  15. #15

    Thread Starter
    Member kadem's Avatar
    Join Date
    Nov 2004
    Posts
    50

    Re: [2005] Disabling users from ending my application

    By clicking the End Process several time the application will get stuck and the End Program dialog box will pop up then just by clicking the End Now button will terminate my application.

  16. #16
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: [2005] Disabling users from ending my application

    This is why you need to use GPO. Windows 2k and after are designed to separate the OS from 3rd party software to prevent situations like the one you are trying to intentionally create. Use RobDog's method, but also use a GPO. The GPO will catch nearly everything, RobDog's will be the failsafe.
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  17. #17
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: [2005] Disabling users from ending my application via TaskMgr

    For parental control purposes only please.

    Hide a process
    Last edited by TTn; Dec 17th, 2006 at 04:27 PM.

  18. #18
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    Re: [2005] Disabling users from ending my application

    PHP Code:
    taskkill //im whatever.exe 
    from the cmd will still kill the whatever app. Even if you delete it, it can be downloaded again. If it is not XP, there are enough vbs snippets out there offering the same functionality. One is even from MS itself.

    CMD can be opened from the task manager (you said you still need it). Even if you somehow disable the Run there, any executable can be started form mIRC for example. And mIRC can be installed even on a guest account
    VB 2005, Win Xp Pro sp2

  19. #19
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: [2005] Disabling users from ending my application

    taskkill /f /im whatever.exe
    from the cmd will still kill the whatever app.
    True, providing that they know the name of the executable file.
    In my example, you can't see the executable process in the task manager.

    taskkill /f /im WhatsMyName.exe
    Is fairly inoperable.

  20. #20
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    Re: [2005] Disabling users from ending my application

    Come on man, anyone knowing about taskkill would at least know about HijackThis as well - able to show/export as text the running processes among other things
    VB 2005, Win Xp Pro sp2

  21. #21
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: [2005] Disabling users from ending my application

    Come on man, anyone knowing about taskkill would at least know about HijackThis as well - able to show/export as text the running processes among other things
    That's the point,... along with RobDogg's suggestion, this works in most situations, so that most "end users" are unaware.

  22. #22
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    Re: [2005] Disabling users from ending my application

    That is true of course, kadem should simply know what to expect and not just implement partial security. Personally I'd go with more than one services that monitor the app and restart it if needed. I had a pretty bitter experience with some trojan swarm and they were using the same tactic, restarting (in my case redownloading) each other as soon as one gets deleted/stopped by the user.
    VB 2005, Win Xp Pro sp2

  23. #23
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: [2005] Disabling users from ending my application

    I agree, with extra protection here.
    It's ironic to come full circle, and find that levels of security, can be learned from a malware, or a trojan etc!

Posting Permissions

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



Click Here to Expand Forum to Full Width