MSFN Forum: Problem about adjust process privilege,help - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problem about adjust process privilege,help Rate Topic: -----

#1 User is offline   lanyus 

  • Newbie
  • Group: Members
  • Posts: 24
  • Joined: 04-October 05

Posted 29 October 2005 - 10:18 PM

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.

This post has been edited by lanyus: 29 October 2005 - 10:19 PM



#2 User is offline   lanyus 

  • Newbie
  • Group: Members
  • Posts: 24
  • Joined: 04-October 05

Posted 29 October 2005 - 11:12 PM

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?

#3 User is offline   lanyus 

  • Newbie
  • Group: Members
  • Posts: 24
  • Joined: 04-October 05

Posted 29 October 2005 - 11:30 PM

It's ravel out,too.

not OpenProcessToken(GetCurrentProcess,TOKEN_QUERY,Tok
en)=====not OpenProcessToken(GetCurrentProcess,TOKEN_ADJUST_PRIVILEGES,Tok
en)

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy