📄 waruserauthdatawin32nt.cpp
字号:
#include "StdAfx.h"#include "WarUserAuthDataWin32Nt.h" // class implemented#include "WarUtf8.h"#include "WarSvrPath.h"#include "WarSvrProperties.h"#include "WarOptionWin32.h"#ifndef WAR_INCLUDED_TCHAR_H# define WAR_INCLUDED_TCHAR_H# include <tchar.h>#endif#ifndef WAR_FUNCTION_PROFILER_H# include "WarFunctionProfiler.h"#endif#ifndef WAR_IF_PATH_LIST_H# include "WarIfPathList.h"#endif#ifndef WAR_LOG_H# include "WarLog.h"#endif/////////////////////////////// PUBLIC /////////////////////////////////////////============================= LIFECYCLE ====================================//============================= OPERATORS ====================================//============================= OPERATIONS ===================================void WarUserAuthDataWin32Nt::BeginImpersonate()throw(WarException){ WAR_PROFILE_FUNC(WAR_FP_WarUserAuthDataWin32Nt_BeginImpersonate); if (NULL == mLogonHandle) return; if (!::ImpersonateLoggedOnUser(mLogonHandle)) { WarLog err_log(WARLOG_ERROR, "WarUserAuthDataWin32Nt::BeginImpersonate()"); WarSystemError sys_err; err_log << "Failed to impersonate user " << GetUserName() << sys_err << war_endl; WarThrow(sys_err, NULL); } ++mImpersonateCnt;} void WarUserAuthDataWin32Nt::EndImpersonate()throw(WarException){ WAR_PROFILE_FUNC(WAR_FP_WarUserAuthDataWin32Nt_EndImpersonate); if (0 < mImpersonateCnt) { --mImpersonateCnt; ::RevertToSelf(); assert(0 == mImpersonateCnt); }}void WarUserAuthDataWin32Nt::MergeProperties( WarSvrProperties& effectiveProperties){ // Load File Systems WarIfPathList my_paths(mRegRoot); my_paths.EnumPaths(effectiveProperties.mPaths); // Load options WarWin32Registry reg_svr_options; reg_svr_options.Open(mRegRoot.GetRef(WAR_WINNT_REG_OPTIONS)); effectiveProperties.mOptions = mOptions; return;}//============================= ACCESS ===================================//============================= INQUIRY ===================================/////////////////////////////// PROTECTED ///////////////////////////////////void WarUserAuthDataWin32Nt::LoadOptions(const WarOptionList& inheritOptions){ mOptions = inheritOptions; WarWin32Registry reg_svr_options; reg_svr_options.Create(mRegRoot.GetRef(WAR_WINNT_REG_OPTIONS)); reg_svr_options >> mOptions;}/////////////////////////////// PRIVATE ///////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -