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.

74 lines
2.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: srothint.cxx
  7. //
  8. // Contents: Implementation of classes used in implementing the ROT hint
  9. // table in the SCM.
  10. //
  11. // History: 20-Jan-95 Ricksa Created
  12. //
  13. //--------------------------------------------------------------------------
  14. #include "act.hxx"
  15. //+-------------------------------------------------------------------------
  16. //
  17. // Member: CScmRotHintTable::CScmRotHintTable
  18. //
  19. // Synopsis: Create SCM ROT hint table
  20. //
  21. // Arguments: [pwszName] - name for shared memory
  22. // [psid] - security ID
  23. //
  24. // Algorithm: Create and map in shared memory for the hint table
  25. //
  26. // History: 20-Jan-95 Ricksa Created
  27. //
  28. //--------------------------------------------------------------------------
  29. CScmRotHintTable::CScmRotHintTable(WCHAR *pwszName)
  30. {
  31. BOOL fCreated;
  32. PSECURITY_DESCRIPTOR pRotSecurityDescriptor = NULL;
  33. SID_IDENTIFIER_AUTHORITY SidAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
  34. PSID pSid;
  35. pSid = 0;
  36. fCreated = AllocateAndInitializeSid(
  37. &SidAuthWorld, 1, 0, 0, 0, 0, 0, 0, 0, 0, &pSid );
  38. ASSERT(fCreated && "CRotHintTable::CRotHintTable No SID");
  39. if ( ! fCreated || ! pSid )
  40. return;
  41. CAccessInfo AccessInfo(pSid);
  42. pRotSecurityDescriptor = AccessInfo.IdentifyAccess (
  43. TRUE,
  44. FILE_MAP_READ,
  45. FILE_MAP_ALL_ACCESS
  46. );
  47. _hSm = CreateSharedFileMapping(pwszName,
  48. SCM_HASH_SIZE,
  49. SCM_HASH_SIZE,
  50. NULL,
  51. pRotSecurityDescriptor,
  52. PAGE_READWRITE,
  53. (void **) &_pbHintArray,
  54. &fCreated);
  55. ASSERT(_hSm && "CRotHintTable::CRotHintTable create SM failed");
  56. ASSERT(fCreated && "CRotHintTable::CRotHintTable Memory not created");
  57. FreeSid( pSid );
  58. if (_pbHintArray != NULL)
  59. {
  60. memset(_pbHintArray, 0, SCM_HASH_SIZE);
  61. }
  62. }