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.

37 lines
690 B

  1. /*++
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. CSxsPreserveLastError.h
  5. Abstract:
  6. Author:
  7. Jay Krell (a-JayK, JayKrell) October 2000
  8. Revision History:
  9. --*/
  10. #pragma once
  11. #include "fusionlastwin32error.h"
  12. //
  13. // The idea here is to avoid hitting breakpoints on ::SetLastError
  14. // or data breakpoints on NtCurrentTeb()->LastErrorValue.
  15. //
  16. class CSxsPreserveLastError
  17. {
  18. public:
  19. DWORD LastError() const { return m_dwLastError; }
  20. inline CSxsPreserveLastError() { ::FusionpGetLastWin32Error(&m_dwLastError); }
  21. inline void Restore() const { ::FusionpSetLastWin32Error(m_dwLastError); }
  22. protected:
  23. DWORD m_dwLastError;
  24. };