Solved

Make my app impossible to exit

Posted on 2001-08-31
18
219 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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
 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

803 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