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.

67 lines
1.0 KiB

  1. //
  2. // Copyright � Microsoft Corporation. All rights reserved.
  3. //
  4. // CAutoImpRevert class header
  5. // Created: 10/4/2000
  6. // Author: khughes
  7. #pragma once
  8. #pragma warning( disable : 4290 )
  9. class CAutoImpRevert;
  10. class CAutoImpError;
  11. class CAutoImpRevert
  12. {
  13. public:
  14. CAutoImpRevert(
  15. BOOL fOpenAsSelf = TRUE) throw(CAutoImpError);
  16. virtual ~CAutoImpRevert();
  17. DWORD LastError() const;
  18. private:
  19. bool GetCurrentImpersonation(
  20. BOOL fOpenAsSelf);
  21. bool Revert();
  22. HANDLE m_hOriginalUser;
  23. DWORD m_dwLastError;
  24. };
  25. class CAutoImpError
  26. {
  27. public:
  28. CAutoImpError(
  29. LPCWSTR wstrDescription)
  30. {
  31. m_chstrDescription = wstrDescription;
  32. }
  33. CAutoImpError(const CAutoImpError& err)
  34. {
  35. m_chstrDescription = err.m_chstrDescription;
  36. }
  37. virtual ~CAutoImpError() {}
  38. CHString GetDescription() const
  39. {
  40. return m_chstrDescription;
  41. }
  42. private:
  43. CHString m_chstrDescription;
  44. };