Source code of Windows XP (NT5)
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.

79 lines
3.1 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: PowerButton.h
  3. //
  4. // Copyright (c) 2000, Microsoft Corporation
  5. //
  6. // Header file that declares the class that implements the ACPI power button
  7. // functionality.
  8. //
  9. // History: 2000-04-17 vtan created
  10. // --------------------------------------------------------------------------
  11. #ifndef _PowerButton_
  12. #define _PowerButton_
  13. #include "Thread.h"
  14. #include "TurnOffDialog.h"
  15. // --------------------------------------------------------------------------
  16. // CPowerButton
  17. //
  18. // Purpose: A class to handle the power button being pressed. This is
  19. // implemented as a thread to allow the desktop to be changed so
  20. // interaction with the user is possible.
  21. //
  22. // History: 2000-04-18 vtan created
  23. // --------------------------------------------------------------------------
  24. class CPowerButton : public CThread
  25. {
  26. private:
  27. CPowerButton (void);
  28. const CPowerButton& operator = (const CPowerButton& assignObject);
  29. public:
  30. CPowerButton (void *pWlxContext, HINSTANCE hDllInstance);
  31. virtual ~CPowerButton (void);
  32. static bool IsValidExecutionCode (DWORD dwGinaCode);
  33. protected:
  34. virtual DWORD Entry (void);
  35. private:
  36. DWORD ShowDialog (void);
  37. static INT_PTR CALLBACK DialogProc (HWND hwndDialog, UINT uMsg, WPARAM wParam, LPARAM lParam);
  38. INT_PTR Handle_WM_READY (HWND hwndDialog);
  39. private:
  40. void* _pWlxContext;
  41. const HINSTANCE _hDllInstance;
  42. HANDLE _hToken;
  43. CTurnOffDialog* _pTurnOffDialog;
  44. bool _fCleanCompletion;
  45. };
  46. // --------------------------------------------------------------------------
  47. // CPowerButtonExecution
  48. //
  49. // Purpose: A class to execute the power button action in a separate
  50. // thread so the SASWndProc thread is not blocked.
  51. //
  52. // History: 2000-04-18 vtan created
  53. // --------------------------------------------------------------------------
  54. class CPowerButtonExecution : public CThread
  55. {
  56. private:
  57. CPowerButtonExecution (void);
  58. CPowerButtonExecution (const CPowerButtonExecution& copyObject);
  59. const CPowerButtonExecution& operator = (const CPowerButtonExecution& assignObject);
  60. public:
  61. CPowerButtonExecution (DWORD dwShutdownRequest);
  62. ~CPowerButtonExecution (void);
  63. protected:
  64. virtual DWORD Entry (void);
  65. private:
  66. const DWORD _dwShutdownRequest;
  67. HANDLE _hToken;
  68. };
  69. #endif /* _PowerButton_ */