MCPcopy Create free account
hub / github.com/antonioCoco/RogueWinRM / EnablePriv

Function EnablePriv

RogueWinRM.cpp:579–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577}
578
579BOOL EnablePriv(HANDLE hToken, LPCTSTR priv)
580{
581 TOKEN_PRIVILEGES tp;
582 LUID luid;
583
584 if (!LookupPrivilegeValue(NULL, priv, &luid))
585 {
586 printf("Priv Lookup FALSE\n");
587 return FALSE;
588 }
589
590 tp.PrivilegeCount = 1;
591 tp.Privileges[0].Luid = luid;
592 tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
593 if (!AdjustTokenPrivileges(
594 hToken,
595 FALSE,
596 &tp,
597 sizeof(TOKEN_PRIVILEGES),
598 (PTOKEN_PRIVILEGES)NULL,
599 (PDWORD)NULL))
600 {
601 printf("Priv Adjust FALSE\n");
602 return FALSE;
603 }
604
605 return TRUE;
606}
607
608int IsTokenSystem(HANDLE tok)
609{

Callers 1

RunRogueWinRMFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected