Solved

Make my app impossible to exit

Posted on 2001-08-31
18
212 Views
Last Modified: 2008-02-01
Hi!

I'm developing an application that has two parts, a client and a server. The purpose is to make one person able to "lock" all connected computers. It can be used for example in schools where teachers doesn't want the pupils to surf the web or something in the middle of a lesson.

Of course it should be impossible (or almost) to exit the client app. I have secured the application in many ways but I still have one problem.

The problem: The process can be killed with the help of a process manager (either win2k process list or a standalone app).

My question: Is it possible to deny all kill requests? Like make it a "critical system process" or something?

300 points to the one who provide a solution :-)

Best regards,
David
0
Comment
Question by:svanlund
  • 5
  • 3
  • 3
  • +4
18 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 6445489
Just some thoughts....

If you make the app impossible to exit, then Windows will not be able to shut it down, meaning it will always have residual problems with it (possibly requiring a system check on each startup.)

Alternately, what you seem to want is a controlled environment where the only thing the user can do is use the app.  You should be able to control this through Win2000 by setting *permissions* and startup things.  You basically give the users their own environments where at start-up, your chosen app begins and the only other thing they have access to on the system is the Start|Shutdown|Logoff feature.  Using this, you could even give different permissions to different students or different groups, such as start the chosen app with certain parameters, or run different apps, etc.
0
 

Expert Comment

by:agzis
ID: 6445501
Try to explore Win32 API function 'CreateProcess', 'TerminateProcess' together with security settings in MSDN topic:
  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/hh/winbase/prothred_68ab.asp
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6445520
Have you tried this?

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
   Cancel = true
End Sub
0
 

Author Comment

by:svanlund
ID: 6445549
0
 

Author Comment

by:svanlund
ID: 6445568
0
 

Expert Comment

by:agzis
ID: 6445578
Dave_Greene you can easy kill it in 'task manager'
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6445644
1.if form uload event you can shell the same application.

2. but i my case we created a policy do disable ie and other application, but you can create a policy to disable task manager.
0
 

Expert Comment

by:agzis
ID: 6445661
I have  different suggestion. You can write your application like Windows NT Service with good security settings and nobody can kill it from 'task manager'. But a problem is to write NTservice in VB. It's beeter to do it in C++.
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6445679
to agzis - windows sdk has kill.exe with kill.exe you can kill any process or service.

0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6445688
You could also disable the Task Manager (and the command prompt) using some security settings...
0
 

Author Comment

by:svanlund
ID: 6445711
I don't want to disable anything, just make the app impossible to exit. The program is intended to be sold. That's why security policies and so on doesn't fit here.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6445735
I have seen once that you can make your application being kept activated, so that no other application could be started (even not TaskManager)... I would have to search for it, but the Search Engine at EE is terrible ...
i think it was an API about Shell wide Events or so...

Cheers
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6445767
you can try to call
Declare Function FindWindow& Lib "user32" Alias "FindWindowA" (ByVal _
lpClassName As String, ByVal lpWindowName As String)

every .5 to locate taskmanager and kill it or

or you can call this api to keep your window on top

Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long)

or you can try reboot user's pc if they deside to close your app.

0
 

Author Comment

by:svanlund
ID: 6445841
It seems like it is impossible, or at least very hard, to deny access to kill the process. But I can at least try to make it as hard to exit as possible.

If there isn't any other suggestions it seems like I will do it this way: I add an action that runs when the app is going to be exited (by task manager) to prevent it in some way. It will still be possible to kill the app with a process manager, but it seems like I have to live with that. Or?
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 6445924
You should be able to hide your app from the task manager if it is a formless application.

App.TaskVisible= False

If your application does have any forms (even hidden ones) this will not work, but there is another trick you can use to hide it from the task manager.  I seem to remember it involves registering the program as a service.  If I can find that information, I'll post it here.
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 300 total points
ID: 6445992
Found it, posted by Ajay Chadha originally:

" Remove application from CTRL-ALT-DEL list "

Public Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Public Declare Function GetCurrentProcess Lib "kernel32" () As Long
Public Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType
As Long) As Long
Public Const RSP_SIMPLE_SERVICE = 1
Public Const RSP_UNREGISTER_SERVICE = 0

'To remove your program from the Ctrl+Alt+Delete list, call the MakeMeService procedure:
Public Sub RemoveProgramFromList()
   Dim lngProcessID As Long
   Dim lngReturn As Long
   
   lngProcessID = GetCurrentProcessId()
   lngReturn = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
End Sub

'To restore your application to the Ctrl+Alt+Delete list, call the UnMakeMeService procedure:
Public Sub AddProgramToList()
   Dim lngProcessID As Long
   Dim lngReturn As Long
   
   lngProcessID = GetCurrentProcessId()
   lngReturn = RegisterServiceProcess(pid, RSP_UNREGISTER_SERVICE)
End Sub

Good Luck...

Ajay Chadha ..:-)
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 6445998
Original question that it shows in is here:

http://www.experts-exchange.com/jsp/qShow.jsp?qid=20092272

And there was one correction:

From: PaulHews  Date: 03/15/2001 12:14PM PST  
It took a small change to correct that.  It's the process id obtained from the previous call.  Very
nice code Ajay!:

Public Sub RemoveProgramFromList()
  Dim lngProcessID As Long
  Dim lngReturn As Long
 
  lngProcessID = GetCurrentProcessId()
  lngReturn = RegisterServiceProcess(lngProcessID, RSP_SIMPLE_SERVICE)
End Sub

'To restore your application to the Ctrl+Alt+Delete list, call the UnMakeMeService procedure:
Public Sub AddProgramToList()
  Dim lngProcessID As Long
  Dim lngReturn As Long
 
  lngProcessID = GetCurrentProcessId()
  lngReturn = RegisterServiceProcess(lngProcessID, RSP_UNREGISTER_SERVICE)
End Sub
 
0
 

Author Comment

by:svanlund
ID: 6446033
This answer doesn't solve my problem to 100%, but it makes it harder for the user to exit my application. The user needs some extra knowledge to do that. But I think this will be a good solution in combination with some other stuff. Thank you!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now