scoped_clear_last_error_win.cc 495 B

1234567891011121314151617181920
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "base/scoped_clear_last_error.h"
  5. #include <windows.h>
  6. namespace base {
  7. ScopedClearLastError::ScopedClearLastError()
  8. : ScopedClearLastErrorBase(), last_system_error_(GetLastError()) {
  9. SetLastError(0);
  10. }
  11. ScopedClearLastError::~ScopedClearLastError() {
  12. SetLastError(last_system_error_);
  13. }
  14. } // namespace base