MCPcopy Create free account
hub / github.com/EasyIME/PIME / getProcessOwnerSids

Function getProcessOwnerSids

PIMELauncher/PipeSecurity.cpp:71–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71static bool getProcessOwnerSids(std::wstring& ownerSidStr, std::wstring& groupSidStr) {
72 PSID ownerSid = nullptr;
73 PSID groupSid = nullptr;
74 PSECURITY_DESCRIPTOR sd = nullptr;
75 DWORD ret = ::GetSecurityInfo(::GetCurrentProcess(),
76 SE_KERNEL_OBJECT, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION,
77 &ownerSid, &groupSid, nullptr, nullptr, &sd);
78 if (ret == ERROR_SUCCESS) {
79 // FIXME: Do we need to free the SIDs here?
80 ownerSidStr = sidToStr(ownerSid);
81 groupSidStr = sidToStr(groupSid);
82 ::LocalFree(sd);
83 return true;
84 }
85 return false;
86}
87
88PipeSecurityAttributes::PipeSecurityAttributes():
89 securittyDescriptor_(nullptr) {

Callers 1

Calls 1

sidToStrFunction · 0.85

Tested by

no test coverage detected