25 #pragma warning(disable:4290
)
26 #pragma warning(disable:4284
)
36 ::InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
37 sa.nLength=
sizeof(SECURITY_ATTRIBUTES);
38 sa.lpSecurityDescriptor=&sd;
39 sa.bInheritHandle=
true;
60 ::InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
61 sa.nLength=
sizeof(SECURITY_ATTRIBUTES);
62 sa.lpSecurityDescriptor=&sd;
63 sa.bInheritHandle=
true;
66 ::InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
67 sa.nLength=
sizeof(SECURITY_ATTRIBUTES);
68 sa.lpSecurityDescriptor=&sd;
69 sa.bInheritHandle=
true;
73 SECURITY_ATTRIBUTES sa;
82 ::SetSecurityDescriptorDacl(&sd,
true, (ACL *)NULL,
false);
85 ::SetSecurityDescriptorDacl(&sd,
true, (ACL *)NULL,
false);
90 static_cast<SecuritySettings &>(*
this).operator=(ess);
91 ::SetSecurityDescriptorDacl(&sd,
true, (ACL *)NULL,
false);
98 inline __stdcall SecurityID(
const TCHAR *usr,
const TCHAR *mc = NULL)
99 : user(usr), machine(mc ? mc :
_T(
"")) {
110 return reinterpret_cast<
SID *>(
sid.
get());
112 inline const TCHAR *
__fastcall Domain(
void)
const noexcept(
true) {
118 std::auto_ptr<BYTE> sid;
121 inline void __fastcall Create(
void) {
124 SID_NAME_USE sid_use;
125 ::LookupAccountName(machine.empty() ? NULL : machine.c_str(), user.c_str(), NULL, &sid_size, NULL, &domain_size, &sid_use);
126 assert(sid_size && domain_size);
127 sid=std::auto_ptr<BYTE>(
new BYTE[sid_size]);
128 domain=std::auto_ptr<
TCHAR>(
new TCHAR[domain_size]);
129 ::LookupAccountName(machine.empty() ? NULL : machine.c_str(), user.c_str(), sid.get(), &sid_size, domain.get(), &domain_size, &sid_use);
130 assert(sid_use!=SidTypeInvalid);
144 wchar_t *user_name=NULL;
145 const HRESULT hr=::CoQueryClientBlanket(NULL, NULL, NULL, NULL, NULL,
reinterpret_cast<
void **>(&user_name), NULL);
146 JMMCG_TRACE(
_T(
"CurrentSecurityID::CurrentSecurityID(): ::CoQueryClientBlanket(...) return code: ")<<win_exception::StrFromWinErr(hr));
148 current_sid=std::auto_ptr<SecurityID>(
new SecurityID(NTUtils::WStringToTString(user_name).c_str()));
169 #pragma warning(default:4290
)
170 #pragma warning(default:4284
)