I have not come across any solution for this at all apart from a registry key in the registry that disables it but i am not sure where it lies. However i am using Windows XP Home Edition, Version 2004, Service Pack 2. Is there anyway i can disable it in VB, if so how? Also if there is a regsitry key that does, where is it located.
If you want to disable the key combination you change/create the following key:
"Software\Microsoft\Windows\CurrentVersion\Policies\System" DisableTaskMgr = 1
If you want to disable the task manager you could use this code
VB Code:
'Before you lock it, make sure the task manager isn't running
Open "C:\Windows\System32\taskmgr.exe" For Binary Access Read Lock Read Write As #1
You may have to create the key. I 've just tried it. It brings up a messagebox telling you task manager is disabled (by your administrator!). Merge the attached reg file if you want to try it.
Last edited by schoolbusdriver; Jun 4th, 2006 at 02:14 PM.
No, I just used a .reg file. (Just in case...) To create it, make a plain text file (with a .reg extension) containing:-
Code:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"DisableTaskMgr"=dword:00000001
Double-click on it and you'll get a messagebox asking if you want to add it to the registry.
To remove it:-
Code:
Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"DisableTaskMgr"=dword:00000001
and do the same.
I could write a procedure to add/remove the key in VB, but someone else will probably beat me to it. Lots of API calls. I DO have it somewhwere. If nobody else has posted it before I find it....
Last edited by schoolbusdriver; Jun 4th, 2006 at 02:39 PM.
i dunno what you want these things for, but there is one slight side-effect on that registry method... the problem is that you need to reboot your system, or at least log off and on again
Public Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As Long, phkResult As Long, lpdwDisposition As Long) As Long
Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Public Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Public Const REG_OPTION_NON_VOLATILE = 0 ' Key is preserved when system is rebooted
Public Const HKEY_CURRENT_USER = &H80000001
Public Const REG_DWORD = 4 ' 32-bit number
Public Const ERROR_SUCCESS = 0&
Public Const STANDARD_RIGHTS_ALL = &H1F0000
Public Const KEY_QUERY_VALUE = &H1
Public Const KEY_SET_VALUE = &H2
Public Const KEY_CREATE_SUB_KEY = &H4
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const KEY_NOTIFY = &H10
Public Const KEY_CREATE_LINK = &H20
Public Const SYNCHRONIZE = &H100000
Public Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))
Form:- This is just the bare bones. Needs error handling.
I just tried it, TheBigB. Didn't have to do anything except create and delete the key to disable/enable. Maybe because I'm the only user - as admin ? Dunno
if you email me I can send you an example project that takes control of the computer .. you click exit to gain control again .. anyway disables everything .. no registry stuff .. found the procs on the web and changed it to be reusable .. i also use the same code in a program which mimicks the desktop run in its own custom shell (not explorer.exe) and has the vbAccelerator.com menu code to create a Start Menu with Custom Programs .. i started writing a customized version of this also .. just havent finished yet .. lets you track programs you open, also shows the icons in its own system tray .. etc etc ..
The registry entry works great . Thanks alot you guys that really helped. Thanks to you to schoolbusdriver. Would you be able to post the code to delete the key please?
I just tried it, TheBigB. Didn't have to do anything except create and delete the key to disable/enable. Maybe because I'm the only user - as admin ? Dunno
Ok Jenova. Here we go. I've added some basic error checking and the facility to change the key's value rather than simply deleting it - although that's there too. I've tidied it up a bit (my original code archive was for strings, not 32-bit numbers...) - it might make a bit more sense now (or as much as any api can) Take a GOOD look at the WARNING!
.bas module
VB Code:
Option Explicit
Public Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias _
"RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _
ByVal Reserved As Long, ByVal lpClass As String, _
ByVal dwOptions As Long, ByVal samDesired As Long, _
lpSecurityAttributes As Long, phkResult As Long, _
lpdwDisposition As Long) As Long
Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" _
(ByVal hKey As Long, ByVal lpSubKey As String) As Long
Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" _
(ByVal hKey As Long, ByVal lpValueName As String) As Long
Public Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" _
(ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, _
ByVal samDesired As Long, phkResult As Long) As Long
Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" _
(ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, _
ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Public Const ERROR_SUCCESS = 0&
Public Const HKEY_CURRENT_USER = &H80000001
Public Const REG_DWORD = 4
Public Const REG_OPTION_NON_VOLATILE = 0
Public Const KEY_QUERY_VALUE = &H1
Public Const KEY_SET_VALUE = &H2
Public Const KEY_CREATE_SUB_KEY = &H4
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const KEY_NOTIFY = &H10
Public Const KEY_CREATE_LINK = &H20
Public Const STANDARD_RIGHTS_ALL = &H1F0000
Public Const SYNCHRONIZE = &H100000
Public Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or _
KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or _
KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))
If RegOpenKeyEx(HKEY_CURRENT_USER, sDelKey, 0&, KEY_SET_VALUE, keyhandle) _
<> ERROR_SUCCESS Then GoTo DelKeyError
If RegDeleteKey(keyhandle, sSubKey) <> ERROR_SUCCESS Then GoTo DelKeyError
RetVal = RegCloseKey(keyhandle)
Case vbNo
MsgBox "A wise choice!"
Exit Sub
End Select
Exit Sub
DelKeyError:
RetVal = RegCloseKey(keyhandle) 'Close the key if it end up here...
MsgBox "Cannot delete the key. It may have already been deleted."
Exit Sub
End Sub
TheBigB, I'm sure I've read somewhere about needing to reboot too, but can't think where. It doesn't seem to make any difference when I try it. Oh well - it works! Time for coffee....
Last edited by schoolbusdriver; Jun 5th, 2006 at 05:05 AM.
Reason: Minor formatting/display error
Try looking up the Kernal32 virus on Symantec.com, it does the same thing and the instructions to remove it should lead you right there.
Visit here to learn to make the VB interface fit you!.
"I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison
"The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners" -- Ernst Jan Plugge