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
32 lines
506 B
/*++
|
|
|
|
Copyright (c) Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
PreserveLastError.h
|
|
|
|
Abstract:
|
|
|
|
Author:
|
|
|
|
Jay Krell (JayKrell) October 2000
|
|
|
|
Revision History:
|
|
|
|
--*/
|
|
#pragma once
|
|
|
|
class PreserveLastError_t
|
|
{
|
|
public:
|
|
DWORD LastError() const { return m_dwLastError; }
|
|
|
|
PreserveLastError_t() : m_dwLastError(::GetLastError()) { }
|
|
~PreserveLastError_t() { Restore(); }
|
|
void Restore() const { ::SetLastError(m_dwLastError); }
|
|
|
|
protected:
|
|
DWORD m_dwLastError;
|
|
|
|
};
|