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.

99 lines
1.8 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. }
  61. NTSTATUS NTAPI
  62. NtCreateAnonymousSid(
  63. PSID *ppAnonymousSid
  64. )
  65. {
  66. NTSTATUS Status;
  67. PSID pSid;
  68. SID_IDENTIFIER_AUTHORITY SidAuthority = SECURITY_NT_AUTHORITY;
  69. ASSERT(ppAnonymousSid != NULL);
  70. Status = RtlAllocateAndInitializeSid(
  71. &SidAuthority,
  72. 1,
  73. SECURITY_ANONYMOUS_LOGON_RID,
  74. 0, 0, 0, 0, 0, 0, 0,
  75. &pSid
  76. );
  77. if (NT_SUCCESS(Status))
  78. {
  79. *ppAnonymousSid = pSid;
  80. }
  81. return(Status);
  82. }