1

Our application requires running in a "secure kiosk mode" on Windows. We have a variety of ways we block various actions. One thing that we do is listen for the use of hotkeys using SetWindowsHookEx to register a WH_GETMESSAGE hook, then when a WM_HOTKEY message comes through we change it to WM_NULL (see code below). This works great in most cases but we recently uncovered an issue. On a 64-bit machine, if the application listening and responding to the hotkey is a 64-bit application we cannot block it with our 32-bit application.

We're trying to find ways to solve this and the only option I can think of is spawning a background 64-bit process to handle this hook for 64-bit applications. Are there other (more simple) alternatives?

Setting up the hook:

HHOOK getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, GetMessageProc, hInst, 0);

GetMsgProc:

LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam)
{
    switch (nCode)
    {
        case HC_ACTION:
        {
            MSG *msg = (MSG *) lParam;
            if (msg->message == WM_HOTKEY)
            {
                // A hotkey was pressed, changed the message to WM_NULL
                msg->message = WM_NULL;
            }
            break;
        }

        default:
            break;
    }
    return CallNextHookEx(NULL, nCode, wParam, lParam);
}
GDefender
  • 511
  • 5
  • 10
  • possible duplicate of [SetWindowsHook to support both 32 bit and 64 bit application](http://stackoverflow.com/questions/8575736/setwindowshook-to-support-both-32-bit-and-64-bit-application) – Mike Kwan Jan 13 '12 at 19:02
  • 1
    Wouldn't it just be easier to run in kiosk mode? – David Heffernan Jan 13 '12 at 20:08

0 Answers0