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.

32 lines
506 B

  1. /*++
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. PreserveLastError.h
  5. Abstract:
  6. Author:
  7. Jay Krell (JayKrell) October 2000
  8. Revision History:
  9. --*/
  10. #pragma once
  11. class PreserveLastError_t
  12. {
  13. public:
  14. DWORD LastError() const { return m_dwLastError; }
  15. PreserveLastError_t() : m_dwLastError(::GetLastError()) { }
  16. ~PreserveLastError_t() { Restore(); }
  17. void Restore() const { ::SetLastError(m_dwLastError); }
  18. protected:
  19. DWORD m_dwLastError;
  20. };