MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / FormatUserName

Function FormatUserName

Explorer++/Helper/Helper.cpp:269–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269BOOL FormatUserName(PSID sid, TCHAR *userName, size_t cchMax)
270{
271 BOOL success = FALSE;
272
273 TCHAR accountName[512];
274 DWORD accountNameLength = SIZEOF_ARRAY(accountName);
275 TCHAR domainName[512];
276 DWORD domainNameLength = SIZEOF_ARRAY(domainName);
277 SID_NAME_USE eUse;
278 BOOL bRet = LookupAccountSid(NULL, sid, accountName, &accountNameLength,
279 domainName, &domainNameLength, &eUse);
280
281 if(bRet)
282 {
283 StringCchPrintf(userName, cchMax, _T("%s\\%s"), domainName, accountName);
284 success = TRUE;
285 }
286 else
287 {
288 LPTSTR stringSid;
289 bRet = ConvertSidToStringSid(sid, &stringSid);
290
291 if(bRet)
292 {
293 StringCchCopy(userName, cchMax, stringSid);
294
295 LocalFree(stringSid);
296 success = TRUE;
297 }
298 }
299
300 return success;
301}
302
303BOOL CheckGroupMembership(GroupType_t groupType)
304{

Callers 2

GetProcessOwnerFunction · 0.85
GetFileOwnerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected