procedure TForm1.FormCreate(Sender: TObject);
begin
   AdjustProcessPrivilege(GetCurrentProcess,'SeDebugPrivilege');
end;

function AdjustProcessPrivilege(Processhandle:Thandle;Token_Name:pchar):boolean;
var
    Token:cardinal;
    TokenPri:_TOKEN_PRIVILEGES;
    processDest:int64;
    i:DWORD;
begin
    Result:=false;
    if OpenProcessToken(Processhandle,TOKEN_ADJUST_PRIVILEGES,Token) then
    begin
        if LookupPrivilegeValue(nil,Token_Name,processDest) then
        begin
            TokenPri.PrivilegeCount:=1;
            TokenPri.Privileges[0].Attributes:=SE_PRIVILEGE_ENABLED;
            TokenPri.Privileges[0].Luid:=processDest;
            i:=0;
            if AdjustTokenPrivileges(Token,false,TokenPri,sizeof(TokenPri),nil,i) then
                Result:=true;
        end;
    end;
end;

 

 

今天要寫程式上網找資料,無意中被我找到。

4月4日詭異的數字,值得紀念的日子。

 

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 arvin1129 的頭像
    arvin1129

    阿罵尼 ` Station

    arvin1129 發表在 痞客邦 留言(0) 人氣()