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.

104 lines
2.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: validate.c
  7. //
  8. // Contents: Validation stuff
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 7-14-94 RichardW Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #include "testgina.h"
  18. HANDLE hWlxHandle;
  19. PVOID pWlxContext;
  20. #define ACTION_LOGON ((1) << (WLX_SAS_ACTION_LOGON))
  21. #define ACTION_NONE ((1) << (WLX_SAS_ACTION_NONE))
  22. #define ACTION_LOCK_WKSTA ((1) << (WLX_SAS_ACTION_LOCK_WKSTA))
  23. #define ACTION_LOGOFF ((1) << (WLX_SAS_ACTION_LOGOFF))
  24. #define ACTION_SHUTDOWN ((1) << (WLX_SAS_ACTION_SHUTDOWN))
  25. #define ACTION_PWD_CHANGED ((1) << (WLX_SAS_ACTION_PWD_CHANGED))
  26. #define ACTION_TASKLIST ((1) << (WLX_SAS_ACTION_TASKLIST))
  27. #define ACTION_UNLOCK_WKSTA ((1) << (WLX_SAS_ACTION_UNLOCK_WKSTA))
  28. #define ACTION_FORCE_LOGOFF ((1) << (WLX_SAS_ACTION_FORCE_LOGOFF))
  29. #define ACTION_SHUTDOWN_POW ((1) << (WLX_SAS_ACTION_SHUTDOWN_POWER_OFF))
  30. #define ACTION_SHUTDOWN_REB ((1) << (WLX_SAS_ACTION_SHUTDOWN_REBOOT))
  31. DWORD ValidReturnCodes[] = {
  32. 0, // Negotiate
  33. 0, // Initialize
  34. 0, // DisplaySAS
  35. ACTION_LOGON | ACTION_NONE | ACTION_SHUTDOWN |
  36. ACTION_SHUTDOWN_POW | ACTION_SHUTDOWN_REB, // LoggedOutSAS
  37. 0, // ActivateUserShell
  38. ACTION_LOCK_WKSTA | ACTION_LOGOFF | ACTION_FORCE_LOGOFF |
  39. ACTION_SHUTDOWN | ACTION_PWD_CHANGED |
  40. ACTION_TASKLIST | ACTION_SHUTDOWN_POW |
  41. ACTION_SHUTDOWN_REB | ACTION_NONE, // LoggedOnSAS
  42. 0, // DisplayLockedNotice
  43. ACTION_NONE | ACTION_UNLOCK_WKSTA |
  44. ACTION_FORCE_LOGOFF, // WkstaLockedSAS
  45. 0, // Logoff
  46. 0 }; // Shutdown
  47. BOOL
  48. AssociateHandle(HANDLE hWlx)
  49. {
  50. hWlxHandle = hWlx;
  51. return(TRUE);
  52. }
  53. BOOL
  54. VerifyHandle(HANDLE hWlx)
  55. {
  56. return(hWlx == hWlxHandle);
  57. }
  58. BOOL
  59. StashContext(PVOID pvContext)
  60. {
  61. pWlxContext = pvContext;
  62. return(TRUE);
  63. }
  64. PVOID
  65. GetContext(VOID)
  66. {
  67. return(pWlxContext);
  68. }
  69. BOOL
  70. ValidResponse(
  71. DWORD ApiNum,
  72. DWORD Response)
  73. {
  74. DWORD Test = (1) << Response;
  75. if (Response > 11)
  76. {
  77. LastRetCode = 0;
  78. }
  79. else
  80. {
  81. LastRetCode = Response;
  82. }
  83. UpdateStatusBar( );
  84. if (ValidReturnCodes[ApiNum] & Test)
  85. {
  86. return(TRUE);
  87. }
  88. return(FALSE);
  89. }