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
67 lines
1.0 KiB
//
|
|
// Copyright © Microsoft Corporation. All rights reserved.
|
|
//
|
|
// CAutoImpRevert class header
|
|
// Created: 10/4/2000
|
|
// Author: khughes
|
|
|
|
#pragma once
|
|
#pragma warning( disable : 4290 )
|
|
|
|
|
|
class CAutoImpRevert;
|
|
class CAutoImpError;
|
|
|
|
|
|
|
|
class CAutoImpRevert
|
|
{
|
|
public:
|
|
CAutoImpRevert(
|
|
BOOL fOpenAsSelf = TRUE) throw(CAutoImpError);
|
|
|
|
virtual ~CAutoImpRevert();
|
|
|
|
DWORD LastError() const;
|
|
|
|
private:
|
|
bool GetCurrentImpersonation(
|
|
BOOL fOpenAsSelf);
|
|
|
|
bool Revert();
|
|
|
|
HANDLE m_hOriginalUser;
|
|
DWORD m_dwLastError;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CAutoImpError
|
|
{
|
|
public:
|
|
|
|
CAutoImpError(
|
|
LPCWSTR wstrDescription)
|
|
{
|
|
m_chstrDescription = wstrDescription;
|
|
}
|
|
|
|
CAutoImpError(const CAutoImpError& err)
|
|
{
|
|
m_chstrDescription = err.m_chstrDescription;
|
|
}
|
|
|
|
virtual ~CAutoImpError() {}
|
|
|
|
CHString GetDescription() const
|
|
{
|
|
return m_chstrDescription;
|
|
}
|
|
|
|
|
|
private:
|
|
CHString m_chstrDescription;
|
|
|
|
};
|