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.

76 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. security.c
  5. Abstract
  6. Security routines.
  7. Note: This file uses NTDDK.H, which is blocked out by WDM.H .
  8. So it does not include PCH.H et al.
  9. Author:
  10. Ervin P.
  11. Environment:
  12. Kernel mode only
  13. Revision History:
  14. --*/
  15. #include "pch.h"
  16. #if !WIN95_BUILD
  17. /*
  18. * Copied from ntrtl.h, which won't compile here.
  19. */
  20. __inline LUID RtlConvertLongToLuid(LONG Long)
  21. {
  22. LUID TempLuid;
  23. LARGE_INTEGER TempLi;
  24. TempLi = RtlConvertLongToLargeInteger(Long);
  25. TempLuid.LowPart = TempLi.LowPart;
  26. TempLuid.HighPart = TempLi.HighPart;
  27. return(TempLuid);
  28. }
  29. NTKERNELAPI BOOLEAN SeSinglePrivilegeCheck(LUID PrivilegeValue, KPROCESSOR_MODE PreviousMode);
  30. #endif
  31. BOOLEAN MyPrivilegeCheck(PIRP Irp)
  32. {
  33. BOOLEAN result;
  34. #if DBG
  35. if (dbgSkipSecurity){
  36. return TRUE;
  37. }
  38. #endif
  39. #if WIN95_BUILD
  40. result = TRUE;
  41. #else
  42. {
  43. #ifndef SE_TCB_PRIVILEGE
  44. #define SE_TCB_PRIVILEGE (7L)
  45. #endif
  46. LUID priv = RtlConvertLongToLuid(SE_TCB_PRIVILEGE);
  47. result = SeSinglePrivilegeCheck(priv, Irp->RequestorMode);
  48. }
  49. #endif
  50. return result;
  51. }