title: SeDebugPrivilege and OpenProcess on another account
body: <p>I'm trying to open a process running on another user account, when I run my application as Administrator (right click > run as admin), I successfully get it, but I need the app to self-elevate the privilege, this is what I have so far:</p>
  
  <pre><code>procedure ChangePrivilege;
  var
    NewState: TTokenPrivileges;
    luid: TLargeInteger;
    hToken: THandle;
    ReturnLength: DWord;
  begin
    if OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, hToken) then
    begin
     if LookupPrivilegeValue(nil, PChar('SeDebugPrivilege'), luid) then
     begin
      NewState.PrivilegeCount:= 1;
      NewState.Privileges[0].Luid := luid;
      NewState.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
      if AdjustTokenPrivileges(hToken, False, NewState, 0, nil, ReturnLength) then
        WriteLn('Privileged');
     end;
      CloseHandle(hToken);
    end;
  end;
  </code></pre>
  
  <p>This function executes nicely and I get the "Privileged" output, but on my OpenProcess, I don't see the process name running on the other account:</p>
  
  <pre><code>procedure ProcEnum;
  var
    Snapshot, ProcessPID: THandle;
    pe: TProcessEntry32;
  begin
    Snapshot := CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
    try
      pe.dwSize := SizeOf(pe);
      if Process32First(Snapshot, pe) then
        while Process32Next(Snapshot, pe) do
        begin
          try
            ProcessPID:= OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_OPERATION or
                                          PROCESS_VM_READ, false, pe.th32ProcessID);
  
            if (ProcessPID &lt;&gt; 0) then
              WriteLn(pe.szExeFile);
          finally
            ProcessPID:= 0;
            CloseHandle(ProcessPID);
          end;
        end;
    finally
      CloseHandle(Snapshot);
    end;
  end;
  </code></pre>
  
  <p>Is there something that I'm missing?
  I just tried this same code on Windows 2008 Server, and it worked. But while working on Windows 10, the problem persists. </p>