Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.5 KiB

  1. /****************************************************************************
  2. PROGRAM: SECEDIT.C
  3. PURPOSE: Displays the usrs current token and eventually allows the user
  4. to edit parts of it.
  5. ****************************************************************************/
  6. #include "hookdll.h"
  7. /****************************************************************************
  8. FUNCTION: KeyboardHookProc
  9. PURPOSE: Handles keyboard input
  10. RETURNS: 1 if message should be discarded, 0 for normal processing
  11. ****************************************************************************/
  12. LRESULT
  13. APIENTRY
  14. KeyboardHookProc(
  15. INT nCode,
  16. WPARAM wParam,
  17. LPARAM lParam
  18. )
  19. {
  20. HWND hwndNotify;
  21. HWND hwndEdit;
  22. if (nCode < 0) {
  23. return(CallNextHookEx(NULL, nCode, wParam, lParam));
  24. }
  25. // Is F11 being pressed ?
  26. if ((wParam == VK_F11) && ((lParam & (1<<31)) == 0)) {
  27. // Yes, notify our parent app
  28. hwndNotify = FindWindow(NULL, "Security Context Editor");
  29. hwndEdit = GetActiveWindow();
  30. if (hwndNotify != NULL) {
  31. PostMessage(hwndNotify, WM_SECEDITNOTIFY, (WPARAM)hwndEdit, 0);
  32. return(1); // Stop anyone else getting this key press
  33. } else {
  34. DbgPrint("SECEDIT: Keyboard hook could not find app window\n");
  35. }
  36. }
  37. return(CallNextHookEx(NULL, nCode, wParam, lParam));
  38. }