MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2EnablePrivilege

Function Ext2EnablePrivilege

Ext2Mgr/Ext2Pipe.cpp:727–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

725/* Ext2EnablePrivilege(SE_TCB_NAME) */
726
727BOOL Ext2EnablePrivilege(LPCTSTR lpszPrivilegeName)
728{
729 TOKEN_PRIVILEGES tp = {0};
730 HANDLE token;
731 LUID luid;
732 BOOL rc;
733
734 rc = OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES |
735 TOKEN_QUERY | TOKEN_READ, &token);
736 if(!rc)
737 goto errorout;
738
739 rc = LookupPrivilegeValue(NULL, lpszPrivilegeName, &luid);
740 if(!rc)
741 goto errorout;
742
743 /* initialize token privilege */
744 tp.PrivilegeCount = 1;
745 tp.Privileges[0].Luid = luid;
746 tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
747 rc = AdjustTokenPrivileges(token, FALSE, &tp, NULL, NULL, NULL);
748 CloseHandle(token);
749
750errorout:
751
752 return rc;
753}
754
755#define KEY_WOW64_64KEY (0x0100)
756

Callers 1

Ext2StartPipeSrvFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected