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.

83 lines
1.0 KiB

  1. /*
  2. * User.c
  3. *
  4. * Author: BreenH
  5. *
  6. * User account utilities.
  7. */
  8. /*
  9. * Includes
  10. */
  11. #include "precomp.h"
  12. #include "tsutil.h"
  13. #include "tsutilnt.h"
  14. /*
  15. * Function Implementations
  16. */
  17. BOOL WINAPI
  18. CreateAdminSid(
  19. PSID *ppAdminSid
  20. )
  21. {
  22. BOOL fRet;
  23. NTSTATUS Status;
  24. Status = NtCreateAdminSid(ppAdminSid);
  25. if (NT_SUCCESS(Status))
  26. {
  27. fRet = TRUE;
  28. }
  29. else
  30. {
  31. fRet = FALSE;
  32. SetLastError(RtlNtStatusToDosError(Status));
  33. }
  34. return(fRet);
  35. }
  36. BOOL WINAPI
  37. CreateSystemSid(
  38. PSID *ppSystemSid
  39. )
  40. {
  41. BOOL fRet;
  42. NTSTATUS Status;
  43. Status = NtCreateSystemSid(ppSystemSid);
  44. if (NT_SUCCESS(Status))
  45. {
  46. fRet = TRUE;
  47. }
  48. else
  49. {
  50. fRet = FALSE;
  51. SetLastError(RtlNtStatusToDosError(Status));
  52. }
  53. return(fRet);
  54. }
  55. BOOL WINAPI
  56. IsUserMember(
  57. PSID pSid
  58. )
  59. {
  60. BOOL fMember;
  61. BOOL fRet;
  62. ASSERT(pSid != NULL);
  63. fMember = FALSE;
  64. fRet = CheckTokenMembership(NULL, pSid, &fMember);
  65. return(fRet && fMember);
  66. }