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.

60 lines
1.4 KiB

  1. #include "stdinc.h"
  2. #include "regpaths.h"
  3. #include "protectedstore.h"
  4. CProtectedStoreDetails::~CProtectedStoreDetails()
  5. {
  6. const DWORD dwLastError = ::GetLastError();
  7. this->Reset();
  8. SetLastError(dwLastError);
  9. }
  10. void
  11. CProtectedStoreDetails::Reset()
  12. {
  13. m_FileSystemPath.Clear();
  14. m_SecDescBacking.Reset();
  15. }
  16. BOOL
  17. CProtectedStoreDetails::ResolveStore(
  18. LPCGUID pGuid,
  19. CProtectedStoreDetails *pTarget
  20. )
  21. {
  22. BOOL fSuccess = FALSE;
  23. CStringBuffer PathToRegistry;
  24. CStringBuffer FormattedGuid;
  25. CStringPair StringPairs[5];
  26. if (pTarget) {
  27. pTarget->Reset();
  28. }
  29. if ((pTarget == NULL) || (pGuid == NULL)) {
  30. ::SetLastError(ERROR_INVALID_PARAMETER);
  31. goto Exit;
  32. }
  33. if (!FormatGuid(pGuid, FormattedGuid)) {
  34. goto Exit;
  35. }
  36. //
  37. // Look in the registry for information on the store in question. Form up a path to the
  38. // keys
  39. //
  40. StringPairs[0].SetPointerAndCount(SXS_REGPATH_INSTALLATIONS, NUMBER_OF(SXS_REGPATH_INSTALLATIONS) - 1);
  41. StringPairs[1].SetPointerAndCount(L"\\", 1);
  42. StringPairs[2].SetPointerAndCount(SXS_REGKEYNAME_GACS, NUMBER_OF(SXS_REGKEYNAME_GACS) - 1);
  43. StringPairs[3].SetPointerAndCount(L"\\", 1);
  44. StringPairs[4] = StringPair(FormattedGuid);
  45. PathToRegistry.AssignArray(NUMBER_OF(StringPairs), StringPairs);
  46. fSuccess = TRUE;
  47. Exit:
  48. return fSuccess;
  49. }