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.

47 lines
1.2 KiB

  1. //
  2. // csecattr.cpp
  3. //
  4. #include "private.h"
  5. #include "osver.h"
  6. #include "csecattr.h"
  7. extern TCHAR g_szUserSidString[];
  8. extern BOOL g_fUserSidString;
  9. extern BOOL InitUserSidString();
  10. //----------------------------------------------------------------------------
  11. //
  12. // CreateProperSecurityDescriptor
  13. //
  14. //----------------------------------------------------------------------------
  15. BOOL CreateProperSecurityDescriptor(HANDLE hToken, PSECURITY_DESCRIPTOR * ppsdec)
  16. {
  17. PSECURITY_DESCRIPTOR psdec = NULL;
  18. PSECURITY_DESCRIPTOR psdAbs = NULL;
  19. DWORD dwSizeSdec = 0;
  20. BOOL bRet = FALSE;
  21. TCHAR strDesc[MAX_PATH];
  22. if (!InitUserSidString())
  23. return FALSE;
  24. //construct the descriptor as "O:(user SID)G:DU:(A;;GA;;;SY)(A;;GA;;;BA)(A;;GA;;;(user SID))"
  25. lstrcpy(strDesc, "O:");
  26. lstrcat(strDesc, g_szUserSidString);
  27. lstrcat(strDesc, "D:(A;;GA;;;BA)(A;;GA;;;RC)(A;;GA;;;SY)(A;;GA;;;");
  28. lstrcat(strDesc, g_szUserSidString);
  29. lstrcat(strDesc, ")");
  30. if (ConvertStringSecurityDescriptorToSecurityDescriptor(strDesc,
  31. SDDL_REVISION_1,
  32. &psdec,
  33. &dwSizeSdec))
  34. {
  35. *ppsdec = psdec;
  36. bRet = TRUE;
  37. }
  38. return bRet;
  39. }