Results 1 to 4 of 4
  1. #1
    Albzter's Avatar
    Join Date
    Oct 2016
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    0

    How do I enable SeDebugPrivilege?

    OK, so I need SeDebugPrivilege enabled. I've been googling and searching around and I found some code that enables it but I have no idea how it works. If someone could post the code heavily documented or a link to where it is documented I'd be really happy .

    -Edit- And yes I have read the MSDN code. -Edit-
    Last edited by Albzter; 02-12-2017 at 01:29 AM.

  2. #2
    SMBB's Avatar
    Join Date
    May 2015
    Gender
    male
    Location
    127.0.0.1
    Posts
    57
    Reputation
    10
    Thanks
    6
    My Mood
    Lurking
    What do you not understand, how to implement it or how to attach to your process?

  3. #3
    Kickupx's Avatar
    Join Date
    Dec 2016
    Gender
    male
    Location
    Sweden
    Posts
    7
    Reputation
    10
    Thanks
    0
    My Mood
    Breezy
    I am gonna assume you know about the language and it is only the part of SeDebugPrivilege which is the problem.
    Else ignore this.

    The changing of SeDebugPrivilege is split up into these parts:
    - Get an access token (Meaning the id of the actual user session on the computer)
    - Get the numeric id from the the string of the new privilege. Eg. SE_DEBUG_NAME (LookupPrivilegeValue)
    - Get current privileges (AdjustTokenPrivileges)
    - Adjust those privileges (AdjustTokenPrivileges)

    The real thing here to note is that AdjustTokenPrivileges is used for both getting and actually changing privileges.
    If you take a look at this url
    https:// support .microsoft .com /en-us/help/131065/how-to-obtain-a-handle-to-any-process-with-sedebugprivilege

    and search for the first call to AdjustTokenPrivileges you will see that by setting the tp variable as they do.
    The tpPrevious variable will (if that call succeeds) be filled with the current privileges.
    Then they use the tpPrevious variable and fill it with new privileges and then calls AdjustTokenPrivileges again.

  4. #4
    Tightmarrow's Avatar
    Join Date
    Dec 2016
    Gender
    male
    Posts
    40
    Reputation
    31
    Thanks
    21
    BOOL SetDebugPrivilege() {
    HANDLE hToken = nullptr;
    if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &hToken)) return FALSE;
    TOKEN_PRIVILEGES TokenPrivileges = { 0 };
    TokenPrivileges.PrivilegeCount = 1;
    TokenPrivileges.Privileges[0].Attributes = TRUE ? SE_PRIVILEGE_ENABLED : 0;
    if (!LookupPrivilegeValueA(nullptr, "SeDebugPrivilege", &TokenPrivileges.Privileges[0].Luid)){
    CloseHandle(hToken);
    return FALSE;
    }

    if (!AdjustTokenPrivileges(hToken, FALSE, &TokenPrivileges, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr)){
    CloseHandle(hToken);
    return FALSE;
    }
    CloseHandle(hToken);
    return TRUE;
    This is untested so if it doesn't act like it should, that is the problem

Similar Threads

  1. [Tutorial] How To Make/Enable Custom Sprays
    By Hannibal in forum CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    Replies: 15
    Last Post: 02-06-2022, 02:10 AM
  2. [Help] Is still No Recoil o Spread available and how do i enable them
    By Relok in forum Crysis 2 Hacks / Cheats
    Replies: 7
    Last Post: 05-15-2011, 05:48 AM
  3. [Help] how do you enable cheats
    By cod1 in forum Call of Duty 5 - World at War Hacks
    Replies: 12
    Last Post: 11-07-2010, 02:24 PM
  4. how te re-enable regisry files?
    By a_z_king in forum Suggestions, Requests & General Help
    Replies: 0
    Last Post: 06-05-2010, 06:01 PM
  5. Replies: 0
    Last Post: 01-22-2009, 01:56 AM