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.

111 lines
3.0 KiB

  1. /**************************** Module Header ********************************\
  2. * Module Name: exports.c
  3. *
  4. * Copyright (c) 1985 - 1999, Microsoft Corporation
  5. *
  6. * Routines exported from winsrv.dll
  7. *
  8. * History:
  9. * 03-04-95 JimA Created.
  10. \***************************************************************************/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. /***************************************************************************\
  14. * _UserSoundSentry
  15. *
  16. * Private API for BASE to use for SoundSentry support.
  17. *
  18. * History:
  19. * 08-02-93 GregoryW Created.
  20. \***************************************************************************/
  21. BOOL
  22. _UserSoundSentry(
  23. UINT uVideoMode)
  24. {
  25. UNREFERENCED_PARAMETER(uVideoMode);
  26. return NT_SUCCESS(NtUserSoundSentry());
  27. }
  28. /***************************************************************************\
  29. * _UserTestTokenForInteractive
  30. *
  31. * Returns TRUE if the token passed represents an interactive user logged
  32. * on by winlogon, otherwise FALSE
  33. *
  34. * The token handle passed must have TOKEN_QUERY access.
  35. *
  36. * History:
  37. * 05-06-92 Davidc Created
  38. \***************************************************************************/
  39. NTSTATUS
  40. _UserTestTokenForInteractive(
  41. HANDLE Token,
  42. PLUID pluidCaller
  43. )
  44. {
  45. PTOKEN_STATISTICS pStats;
  46. ULONG BytesRequired;
  47. NTSTATUS Status;
  48. /*
  49. * Get the session id of the caller.
  50. */
  51. Status = NtQueryInformationToken(
  52. Token, // Handle
  53. TokenStatistics, // TokenInformationClass
  54. NULL, // TokenInformation
  55. 0, // TokenInformationLength
  56. &BytesRequired // ReturnLength
  57. );
  58. if (Status != STATUS_BUFFER_TOO_SMALL) {
  59. return Status;
  60. }
  61. //
  62. // Allocate space for the user info
  63. //
  64. pStats = (PTOKEN_STATISTICS)LocalAlloc(LPTR, BytesRequired);
  65. if (pStats == NULL) {
  66. return Status;
  67. }
  68. //
  69. // Read in the user info
  70. //
  71. Status = NtQueryInformationToken(
  72. Token, // Handle
  73. TokenStatistics, // TokenInformationClass
  74. pStats, // TokenInformation
  75. BytesRequired, // TokenInformationLength
  76. &BytesRequired // ReturnLength
  77. );
  78. if (NT_SUCCESS(Status)) {
  79. if (pluidCaller != NULL)
  80. *pluidCaller = pStats->AuthenticationId;
  81. /*
  82. * A valid session id has been returned. Compare it
  83. * with the id of the logged on user.
  84. */
  85. Status = NtUserTestForInteractiveUser(&pStats->AuthenticationId);
  86. #ifdef LATER
  87. if (pStats->AuthenticationId.QuadPart == pwinsta->luidUser.QuadPart)
  88. Status = STATUS_SUCCESS;
  89. else
  90. Status = STATUS_ACCESS_DENIED;
  91. #endif
  92. }
  93. LocalFree(pStats);
  94. return Status;
  95. }