NullDacl::NullDacl() { ZeroMemory( &mSa, sizeof(mSa) ); mSa.nLength = sizeof( mSa ); mSa.bInheritHandle = FALSE; BOOL ok = InitializeSecurityDescriptor( &mSd, SECURITY_DESCRIPTOR_REVISION ); DWORD dwErr = GetLastError(); RCF_VERIFY(ok, Exception(_RcfError_Win32ApiError("InitializeSecurityDescriptor()"), dwErr)); #pragma warning(push) #pragma warning(disable: 6248) // C6248: Setting a SECURITY_DESCRIPTOR's DACL to NULL will result in an unprotected object. ok = SetSecurityDescriptorDacl( &mSd, TRUE, (PACL) NULL, FALSE); #pragma warning(pop) dwErr = GetLastError(); RCF_VERIFY(ok, Exception(_RcfError_Win32ApiError("SetSecurityDescriptorDacl()"), dwErr)); mSa.lpSecurityDescriptor = &mSd; }
Win32ThreadImpersonator(HANDLE hToken) { BOOL ok = SetThreadToken(NULL, hToken); if (!ok) { DWORD dwErr = GetLastError(); RCF_THROW( Exception( _RcfError_Win32ApiError("SetThreadToken()"), dwErr) ); } }
NullDacl::NullDacl() { ZeroMemory( &mSa, sizeof(mSa) ); mSa.nLength = sizeof( mSa ); mSa.bInheritHandle = FALSE; BOOL ok = InitializeSecurityDescriptor( &mSd, SECURITY_DESCRIPTOR_REVISION ); DWORD dwErr = GetLastError(); RCF_VERIFY(ok, Exception(_RcfError_Win32ApiError("InitializeSecurityDescriptor()", dwErr), dwErr)); ok = SetSecurityDescriptorDacl( &mSd, TRUE, (PACL) NULL, FALSE); dwErr = GetLastError(); RCF_VERIFY(ok, Exception(_RcfError_Win32ApiError("SetSecurityDescriptorDacl()", dwErr), dwErr)); mSa.lpSecurityDescriptor = &mSd; }