lanyus Posted October 30, 2005 Posted October 30, 2005 (edited) 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, 2005 by lanyus
lanyus Posted October 30, 2005 Author Posted October 30, 2005 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?
lanyus Posted October 30, 2005 Author Posted October 30, 2005 It's ravel out,too.not OpenProcessToken(GetCurrentProcess,TOKEN_QUERY,Token)=====not OpenProcessToken(GetCurrentProcess,TOKEN_ADJUST_PRIVILEGES,Token)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now