October 30, 200520 yr Delphi code---------------------------------------------------------procedure TForm1.N1Click(Sender: TObject);varToken:Cardinal;TokenPri:TOKEN_PRIVILEGES;ProcessDest:int64;beginif not OpenProcessToken(GetCurrentProcess,TOKEN_QUERY,Token) then RaiseLastOSErrorelsebegin 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 October 30, 200520 yr by lanyus
October 30, 200520 yr Author 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?
October 30, 200520 yr Author It's ravel out,too.not OpenProcessToken(GetCurrentProcess,TOKEN_QUERY,Token)=====not OpenProcessToken(GetCurrentProcess,TOKEN_ADJUST_PRIVILEGES,Token)
Create an account or sign in to comment