Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Unable to Hook Ctrl+Alt+Delete

Unable to Hook Ctrl+Alt+Delete

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alexinuk
    wrote on last edited by
    #1

    Hi, I'm having a problem getting my hooks to work. I can successfully hook Keyboard and System messages (WH_KEYBOARD and WH_SYSMSGFILTER) but can't seem to be able to prevent Ctrl+Alt+Delete or MSGF_NEXTWINDOW from doing what they normally do. I'm trying to prevent users of my app from accessing windows (definately not what i'd want, i know, but clients are clients), and i've got a feeling that part of the problem is the differences between 95/98 and 2k/XP? any ideas? Thanks in advance to anyone who can help, Alex

    J 1 Reply Last reply
    0
    • A Alexinuk

      Hi, I'm having a problem getting my hooks to work. I can successfully hook Keyboard and System messages (WH_KEYBOARD and WH_SYSMSGFILTER) but can't seem to be able to prevent Ctrl+Alt+Delete or MSGF_NEXTWINDOW from doing what they normally do. I'm trying to prevent users of my app from accessing windows (definately not what i'd want, i know, but clients are clients), and i've got a feeling that part of the problem is the differences between 95/98 and 2k/XP? any ideas? Thanks in advance to anyone who can help, Alex

      J Offline
      J Offline
      Joan M
      wrote on last edited by
      #2

      You'll never be able to hook that keystroke using a system wide hook or any other technique... In order to do that you must create a GINA.DLL that handles that keystroke as you want... Hope this helps...

      https://www.robotecnik.com freelance robots, PLC and CNC programmer.

      A 1 Reply Last reply
      0
      • J Joan M

        You'll never be able to hook that keystroke using a system wide hook or any other technique... In order to do that you must create a GINA.DLL that handles that keystroke as you want... Hope this helps...

        A Offline
        A Offline
        Alexinuk
        wrote on last edited by
        #3

        Joan Murt wrote: You'll never be able to hook that keystroke using a system wide hook or any other technique... In order to do that you must create a GINA.DLL that handles that keystroke as you want... I've been told this before - do you mean MSGINA.DLL? My version of Win98 doesn't have this dll present, but apparently WinNT does. does this matter? Have you got any idea where I can look to find out a few clues on how to do this? Cheers for the response, Alex

        X H 2 Replies Last reply
        0
        • A Alexinuk

          Joan Murt wrote: You'll never be able to hook that keystroke using a system wide hook or any other technique... In order to do that you must create a GINA.DLL that handles that keystroke as you want... I've been told this before - do you mean MSGINA.DLL? My version of Win98 doesn't have this dll present, but apparently WinNT does. does this matter? Have you got any idea where I can look to find out a few clues on how to do this? Cheers for the response, Alex

          X Offline
          X Offline
          xxhimanshu
          wrote on last edited by
          #4

          hi It is possible to hook Ctrl+Alt+Del combination by replacing the definition to Msgina.DLL in the registry by your own dll that is handling all the keyboard messages and forwarding all allowed key combinations to the original msgina.dll. The easiest way to prevent unauthorized process kills is to use the VC++ resource editor, open msgina.dll and by making all buttons in the task manager dialog box disabled except Cancel. This is not a very beautiful method, but it works... i saw an article on CP last days..search for it..it was on hooking ctrl + alt + del.. type something.. hope this works.. Himanshu

          A 1 Reply Last reply
          0
          • A Alexinuk

            Joan Murt wrote: You'll never be able to hook that keystroke using a system wide hook or any other technique... In order to do that you must create a GINA.DLL that handles that keystroke as you want... I've been told this before - do you mean MSGINA.DLL? My version of Win98 doesn't have this dll present, but apparently WinNT does. does this matter? Have you got any idea where I can look to find out a few clues on how to do this? Cheers for the response, Alex

            H Offline
            H Offline
            HENDRIK R
            wrote on last edited by
            #5

            Win95 + 98 don't have a MSGINA.DLL. Hooking can be done by setting the screensaver state programatically. The call

            SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, lpvoid, 0)

            blocks the keys, and

            SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE, lpvoid, 0)

            re-enables them. For replacing MSGINA.DLL you should search the MSDN. There're some good examples and explanations.

            A 1 Reply Last reply
            0
            • H HENDRIK R

              Win95 + 98 don't have a MSGINA.DLL. Hooking can be done by setting the screensaver state programatically. The call

              SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, lpvoid, 0)

              blocks the keys, and

              SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE, lpvoid, 0)

              re-enables them. For replacing MSGINA.DLL you should search the MSDN. There're some good examples and explanations.

              A Offline
              A Offline
              Alexinuk
              wrote on last edited by
              #6

              Thanks for that. I'd figured out the screensaver bits but was unsure if that was the accepted way of doing it. Basically it sounds like such a muck-about to do all this that i'm probably going to try and get my boss to persuade the clients that they don't realy want this feature after all. If there were one way for all versions of Windows, then perhaps it would work, but I would also need to disable the Windows Key, Alt+Tab, Alt+Esc and Ctrl+Tab to actually prevent anyone using the app from accessing the desktop. All in all I'd never implement something like this through choice:(. Thanks for the support though! -Alex

              1 Reply Last reply
              0
              • X xxhimanshu

                hi It is possible to hook Ctrl+Alt+Del combination by replacing the definition to Msgina.DLL in the registry by your own dll that is handling all the keyboard messages and forwarding all allowed key combinations to the original msgina.dll. The easiest way to prevent unauthorized process kills is to use the VC++ resource editor, open msgina.dll and by making all buttons in the task manager dialog box disabled except Cancel. This is not a very beautiful method, but it works... i saw an article on CP last days..search for it..it was on hooking ctrl + alt + del.. type something.. hope this works.. Himanshu

                A Offline
                A Offline
                Alexinuk
                wrote on last edited by
                #7

                If I were to go a step further and prevent the Task Manager from even being shown, would I be able to write my own GINA.DLL (instead of changing microsoft's and just disabling buttons), and if so how easy is this to do and where would I start to look to do it? Thanks for the reply! -Alex

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups