codeconqueror
asked on
Interrupt Handler for 0x19 (Ctrl+Alt+Del) in VB6
I want to implement an interrupt handler for interrupt 0x19 to catch Ctrl+Alt+Del. I believe Ctrl+Alt+Del generates an interrupt 0x19, which is not routed as a keyboard message. Can anyone come up with some sample code on how I might be able to intercept and block that message? I have tried to use hooks but since it doesn't generate a normal keyboard message, these efforts have been in vain. I have already disabled all the buttons on the Ctrl+Alt+Del screen, but now I want to disable bringing up the screen altogether. I know most people believe it isn't possible to do this, but there is a product that I can purchase to do it, but it costs $300 (http://www.meliorasoft.com/kits/keyboard/), so I know there must be a way. Any help would be GREATLY appreciated.
ASKER
Okay, well I'd be willing to write a library that I can implement from VB (i.e. a C DLL that I can call from VB 6) in another language. Any ideas on how I could do that (sample code)? Thanks.
You have to replace the MSGINA.DLL:
http://www.microsoft.com/windows2000/techinfo/administration/security/msgina.asp
http://www.microsoft.com/windows2000/techinfo/administration/security/msgina.asp
try this:
Dim pay as Integer
pay = CInt(InputBox("How much are you paid in (money units) per hour?"))
Dim days as Integer
days = CInt(InputBox("Approximate ly how many days of coding, testing do you think it would take to rewrite the keyboard driver at the HAL layer in windows, install it and have it produce custom messages for the 0h19 interrupt?")) * 2
If pay * days * 24 > 300 then MsgBox "It would be more cost effective to just buy the meliorasoft.com product"
Dim pay as Integer
pay = CInt(InputBox("How much are you paid in (money units) per hour?"))
Dim days as Integer
days = CInt(InputBox("Approximate
If pay * days * 24 > 300 then MsgBox "It would be more cost effective to just buy the meliorasoft.com product"
ASKER
Ha ha. Come on, not trying to a d*ck, but give me something useful or nothing at all cjard. :)
I'm not spending days and days on this, I've looked into, can't do it, this method shows some promise and if someone can help me get it done quickly, great, if not, obviously I'll have to break down and buy the component.
Vinnyd79, thanks for posting something useful and trying to help. I'm checking that out and will post back. :)
I'm not spending days and days on this, I've looked into, can't do it, this method shows some promise and if someone can help me get it done quickly, great, if not, obviously I'll have to break down and buy the component.
Vinnyd79, thanks for posting something useful and trying to help. I'm checking that out and will post back. :)
ASKER
Well, replacing the MSGINA.DLL seems a little involved. I'll keep looking into since some places offer replacements with source code, but you or anyone else have any other ideas?
I found this a while back.
Remember to put it all back when your application ends.
There is an undocumented way to disable the Ctrl Alt Del key sequence on Windows NT/2000/XP using the registry.
The key, 'HKEY_LOCAL_MACHINE\SOFTWA RE\Microso ft\Windows NT\CurrentVersion\Winlogon : AutoAdminLogon (REG_SZ)' has only two legal values, according to Microsoft: "0" and "1". 0 disables automatic logon of the account stored, and 1 enables it. The strange thing is that if you set the key to "2", it will enable automatic logon AND disable CTRL + ALT + DEL sequence registration by windows on boot, effectively disabling Task Manager, etc... Of course for this to work you will have to set the "DefaultUserName" and "DefaultPassword" keys to the username to automatically logon.
I've found this the easiest way to kill the Ctrl-Alt-Del sequence.
Again, here are the keys needed to be set:
HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\Windows NT\CurrentVersion\Winlogon : AutoAdminLogon = "2"
HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\Windows NT\CurrentVersion\Winlogon : DefaultUserName = "(the username to automatically logon)"
HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\Windows NT\CurrentVersion\Winlogon : DefaultPassword = "(password for default username)"
Remember to put it all back when your application ends.
There is an undocumented way to disable the Ctrl Alt Del key sequence on Windows NT/2000/XP using the registry.
The key, 'HKEY_LOCAL_MACHINE\SOFTWA
I've found this the easiest way to kill the Ctrl-Alt-Del sequence.
Again, here are the keys needed to be set:
HKEY_LOCAL_MACHINE\SOFTWAR
HKEY_LOCAL_MACHINE\SOFTWAR
HKEY_LOCAL_MACHINE\SOFTWAR
Found this one also buried in some of my old code.
Public Declare Function SystemParametersInfo2 Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
Public Const SPI_SCREENSAVERRUNNING = 97
Public Sub CtrlAltDel_Disable()
Dim syssend As Long
syssend& = SystemParametersInfo2(SPI_ SCREENSAVE RRUNNING, True, False, 0)
End Sub
Public Sub CtrlAltDel_Enable()
Dim syssend As Long
syssend& = SystemParametersInfo2(SPI_ SCREENSAVE RRUNNING, False, True, 0)
End Sub
Public Declare Function SystemParametersInfo2 Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
Public Const SPI_SCREENSAVERRUNNING = 97
Public Sub CtrlAltDel_Disable()
Dim syssend As Long
syssend& = SystemParametersInfo2(SPI_
End Sub
Public Sub CtrlAltDel_Enable()
Dim syssend As Long
syssend& = SystemParametersInfo2(SPI_
End Sub
ASKER
BenClark, I'm going to test this out right now. Will post back in a bit. If this works the way I want it to I will be SOOOOO happy!!! Thanks.
ASKER
That last one will only work for Windows 98. I've got that one in my code in case their running 98, but I'm looking to disable it fro 2000/XP. I will try the registry keys you pointed to and post back in a bit.
ASKER
:( Unfortunately the registry keys won't work. I was hoping I could edit the keys, put in the current user's information, set the value to 2, run GPUPDATE /Force like I do for a lot of the other Windows rights (i.e. Shutdown) but that doesn't work for those keys. Thanks anyways. Any other ideas?
ASKER
My software has user rights that an admin can define. So when the user logs into my software, it applies the Windows rights assigned by the admin for that user (edit the registry, then run GPUPDATE /FORCE, reset registry upon exiting of application or on error). This way I can say that user A cannot access the desktop and cannot shutdown the pc while user B can while running my program. So in this case, I need to say that user A cannot press Ctrl+Alt+Del. The logins are handled by my application, not through Windows. I think coming up with a library (in any language) that can intercept interrupt 0x19 and can be called somehow from my VB6 app is the only way. Any one else have any ideas?
I just did a little research.
It seems that in 2K and XP, the ONLY way to trap the Ctrl+Alt+Del is by
writing a new GINA.DLL.
I written one before. There not that hard.
However, you can't write one in VB.
It seems that in 2K and XP, the ONLY way to trap the Ctrl+Alt+Del is by
writing a new GINA.DLL.
I written one before. There not that hard.
However, you can't write one in VB.
ASKER
I know you can write one in C, I was looking a pGina (http://pgina.xpasystems.com/) but am still waiting on an answer from them if that library will be suitable to do what I want to do in the way I want to do it. Thanks to all so far.
If you can give me a little more detail on what you need it to do,
AND you don't mind waiting a few days, I can make a GINA.DLL for you.
No Charge.
Other than points here. :-)
AND you don't mind waiting a few days, I can make a GINA.DLL for you.
No Charge.
Other than points here. :-)
ASKER
BenClark, if you can do that for me I would be eternally grateful and give you as many points as EE will allow! :)
Here's the detailed spec of what I'm looking to do:
I have a program that has it's own user login functionality. The user logs into Windows, then runs my program. When they log into my program, I assign various Windows rights to that user. So, an Admin logs in and sets up UserA. UserA has rights X, Y, and Z in my program and is not allowed to shutdown the pc and is not allowed to press Ctrl+Alt+Del. Now, when UserA logs in, it backs up the current registry entries, edits the registry (or other necessary functions) to block access to the Shutdown option and the Ctrl+Alt+Del option, then runs GPUPDATE /FORCE to apply those new settings from the registry. This works great. However, for 2000/XP I cannot disable the pressing of Ctrl+Alt+Del. So I need a GINA.DLL file that I can disable/enable pressing of Ctrl+Alt+Del on the fly. I also need to be able to install the new GINA.DLL file as part of my program's installation (I'm using Wise For Windows Installer - latest version) without screwing up anything that they might already be doing with their network logins (some might be running Novell, some might be using a domain, some might just be single stations, or simple peer-to-peer).
Thanks for your help thus far! :->
Here's the detailed spec of what I'm looking to do:
I have a program that has it's own user login functionality. The user logs into Windows, then runs my program. When they log into my program, I assign various Windows rights to that user. So, an Admin logs in and sets up UserA. UserA has rights X, Y, and Z in my program and is not allowed to shutdown the pc and is not allowed to press Ctrl+Alt+Del. Now, when UserA logs in, it backs up the current registry entries, edits the registry (or other necessary functions) to block access to the Shutdown option and the Ctrl+Alt+Del option, then runs GPUPDATE /FORCE to apply those new settings from the registry. This works great. However, for 2000/XP I cannot disable the pressing of Ctrl+Alt+Del. So I need a GINA.DLL file that I can disable/enable pressing of Ctrl+Alt+Del on the fly. I also need to be able to install the new GINA.DLL file as part of my program's installation (I'm using Wise For Windows Installer - latest version) without screwing up anything that they might already be doing with their network logins (some might be running Novell, some might be using a domain, some might just be single stations, or simple peer-to-peer).
Thanks for your help thus far! :->
The easiest way to disable CTRL + ALT + DELETE is to just open the taskmgr!!
Private Sub Command1_Click()
'Enable CTRL ALT DELETE
Close #1
End Sub
Private Sub Form_Load()
'Disable CTRL ALT DELETE
Open "c:\windows\system32\taskm gr.exe" For Binary As #1
End Sub
Private Sub Command1_Click()
'Enable CTRL ALT DELETE
Close #1
End Sub
Private Sub Form_Load()
'Disable CTRL ALT DELETE
Open "c:\windows\system32\taskm
End Sub
lalalalalala PERFECTION
That will only disable task Manager, not CTRL + ALT + DEL.
ASKER
I just tried that egl1044, but I can still Ctrl+Alt+Del. Any other ideas?
what else does ctrl alt delete do? I thought it brings up taskmgr
CodeConqueror,
Would you send me an emal at <email removed by sirbounty>?
I will send you some sample code for your GINA.DLL along with some explanations.
Would you send me an emal at <email removed by sirbounty>?
I will send you some sample code for your GINA.DLL along with some explanations.
ASKER
egl1044, that's only in Windows 98. In NT/2000/XP it brings up a screen allowing you to: Lock the Workstation, Logoff, Shutdown, Change Password, Task Manager, or Cancel.
BenClark, I'm emailing you right now. Thanks. :)
BenClark, I'm emailing you right now. Thanks. :)
ASKER
BenClark, is this something you'll definitely be able to do? It will be able to turn the Ctrl+Alt+Del function on/off on demand? If so, I'll give you the points and close the question. Thanks. In the meantime, if anyone else has any ideas, by all means, speak up. :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
For future reference to users who may want to accomplish a similar task, could you perhaps post the DLL code here ?
Thanks :)
Thanks :)
ASKER
As soon as I have this ironed out and have a definite usable solution I will make sure to post the exact instructions on what to do and how here. Thanks to everyone for all your help. I know that if we can figure this out it will help a lot of people out there. I've run across countless posts from various places with people looking to do exactly this with no solution.
ASKER
I think that BenClark so far has the best idea and we are trying to work out the proper code for the modified GINA.DLL file. I am still interested in trying to intercept Interrupt 0x19 though, so if anyone has any ideas in that direction please let me know.
ASKER
Also, the way that meliorasoft is doing it is with a keyboard driver, so if anyone knows (or has) a keyboard driver that can be modified to not report the Ctrl+Alt+Del sequence, that would be of great interest as well.
ASKER
There is a program from http://www.phord.com/keyblock.html which does exactly what I want, but it's a program you run, and I'm not sure if its something you can integrate with. But he is blocking the keys on the fly with no problems. I wan't to know what he's doing, but he's not going to tell me and make it unnessary for me to buy his software. Grrr, it's so frustrating to know it can be done, I just don't know how. :(
ASKER
FINALLY!!! I'VE GOT IT!!!! YAY YAY. The following link will let you download a free dll and example and source code to disable it on the fly. Here you go everyone, enjoy!!
http://www.codeproject.com/win32/AntonioWinLock.asp
Once you have the DLL in your project's path or in WIndows\System32, just call it using:
<CODE SNIPPET>
Private Declare Function CtrlAltDel_Enable_Disable Lib "WinLockDll.dll" (ByVal bEnableDisable As Boolean) As Integer
Private Sub Command1_Click()
CtrlAltDel_Enable_Disable False '**** Disable use of Ctrl+Alt+Del
End Sub
Private Sub Command2_Click()
CtrlAltDel_Enable_Disable True '**** Enable use of Ctrl+Alt+Del
End Sub
</CODE SNIPPET>
http://www.codeproject.com/win32/AntonioWinLock.asp
Once you have the DLL in your project's path or in WIndows\System32, just call it using:
<CODE SNIPPET>
Private Declare Function CtrlAltDel_Enable_Disable Lib "WinLockDll.dll" (ByVal bEnableDisable As Boolean) As Integer
Private Sub Command1_Click()
CtrlAltDel_Enable_Disable False '**** Disable use of Ctrl+Alt+Del
End Sub
Private Sub Command2_Click()
CtrlAltDel_Enable_Disable True '**** Enable use of Ctrl+Alt+Del
End Sub
</CODE SNIPPET>
The URL gives me a 404. Does some have copy of the content provided in the link?
Thanks
Thanks
the correct url is:
http://www.codeproject.com/win32/AntonioWinLock.aspx
It's an ASP.NET page, not an old ASP page
AW
http://www.codeproject.com/win32/AntonioWinLock.aspx
It's an ASP.NET page, not an old ASP page
AW
Interupt handlers operate MUCH TOO close to the operating syste/hardware.
AW