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.

74 lines
1.2 KiB

  1. /*
  2. * UserNt.c
  3. *
  4. * Author: BreenH
  5. *
  6. * User account utilities in the NT flavor.
  7. */
  8. /*
  9. * Includes
  10. */
  11. #include "precomp.h"
  12. #include "tsutilnt.h"
  13. /*
  14. * Function Implementations
  15. */
  16. NTSTATUS NTAPI
  17. NtCreateAdminSid(
  18. PSID *ppAdminSid
  19. )
  20. {
  21. NTSTATUS Status;
  22. PSID pSid;
  23. SID_IDENTIFIER_AUTHORITY SidAuthority = SECURITY_NT_AUTHORITY;
  24. ASSERT(ppAdminSid != NULL);
  25. Status = RtlAllocateAndInitializeSid(
  26. &SidAuthority,
  27. 2,
  28. SECURITY_BUILTIN_DOMAIN_RID,
  29. DOMAIN_ALIAS_RID_ADMINS,
  30. 0, 0, 0, 0, 0, 0,
  31. &pSid
  32. );
  33. if (NT_SUCCESS(Status))
  34. {
  35. *ppAdminSid = pSid;
  36. }
  37. return(Status);
  38. }
  39. NTSTATUS NTAPI
  40. NtCreateSystemSid(
  41. PSID *ppSystemSid
  42. )
  43. {
  44. NTSTATUS Status;
  45. PSID pSid;
  46. SID_IDENTIFIER_AUTHORITY SidAuthority = SECURITY_NT_AUTHORITY;
  47. ASSERT(ppSystemSid != NULL);
  48. Status = RtlAllocateAndInitializeSid(
  49. &SidAuthority,
  50. 1,
  51. SECURITY_LOCAL_SYSTEM_RID,
  52. 0, 0, 0, 0, 0, 0, 0,
  53. &pSid
  54. );
  55. if (NT_SUCCESS(Status))
  56. {
  57. *ppSystemSid = pSid;
  58. }
  59. return(Status);
  60. }