Jump to content

Problem about adjust process privilege,help


Recommended Posts

Delphi code

---------------------------------------------------------

procedure TForm1.N1Click(Sender: TObject);

var

Token:Cardinal;

TokenPri:TOKEN_PRIVILEGES;

ProcessDest:int64;

begin

if not OpenProcessToken(GetCurrentProcess,TOKEN_QUERY,Token) then

RaiseLastOSError

else

begin

if LookupPrivilegeValue(nil,'SeDebugPrivilege',ProcessDest) then

begin

TokenPri.PrivilegeCount:=1;

TokenPri.Privileges[0].Attributes:=SE_PRIVILEGE_ENABLED;

TokenPri.Privileges[0].Luid:=ProcessDest;

if AdjustTokenPrivileges(Token,False,TokenPri,sizeof(TokenPri),nil,nil) then

showmessage('successfully')

else

showmessage('faid');

end;

end;

--------------------------------------------------------------------

When I completed these code,it had an error,the error information is "There is no overload version of "AdjustTokenPrivilege" that can be called with these arguments". Who can help me?? TKS.

Edited by lanyus
Link to comment
Share on other sites


It's ravel out.

AdjustTokenPrivileges(Token,False,TokenPri,sizeof(

TokenPri),nil,nil);

The last variant must be a DWORD variant. But it had another problem,It can't Adjust process privilege,when I run it ,it will showmessage "faid".. Can somebody help me?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...