Created
February 1, 2020 13:49
-
-
Save shelld0n/405ea7ad34309d56becd6c807fcdd91d to your computer and use it in GitHub Desktop.
OpenProcessToken_codeblock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Duplicate Tokens for system process and store them in tokenHandle | |
Console.WriteLine("your journey just started"); | |
IntPtr test = myAPI.OpenProcess(myAPI.ProcessAccessFlags.QueryInformation, true, pid); | |
if (test == IntPtr.Zero) Console.WriteLine("No Handle to process !"); | |
IntPtr tokenHandle; | |
bool result_token = myAPI.OpenProcessToken(test, myAPI.TOKEN_READ | myAPI.TOKEN_IMPERSONATE | myAPI.TOKEN_DUPLICATE, out tokenHandle); | |
Console.WriteLine(result_token); | |
//End of getting the handle of token of SYSTEM process |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment