帮忙改写成DELPHI!!!在线等待!!!急急急急急急急急急急急急急急急急急急急急急急急急急急急急!!!!!!!!!!!!!!!!!!!! (50分)

  • 主题发起人 主题发起人 wangwei200208
  • 开始时间 开始时间
W

wangwei200208

Unregistered / Unconfirmed
GUEST, unregistred user!
BOOL bThreadToken = FALSE;<br>HANDLE hThreadToken1, hThreadToken2;<br>if( OpenThreadToken(GetCurrentThread(), TOKEN_IMPERSONATE, FALSE, &amp;hThreadToken1) )<br>{<br>&nbsp; &nbsp;RevertToSelf();<br>&nbsp; &nbsp;bThreadToken = TRUE;<br>}<br><br>LogonUser(...);<br>ImpersonateLoggedOnUser(...);<br>if( bThreadToken )<br>{<br>&nbsp; &nbsp;hThreadToken2 = GetCurrentThread();<br>&nbsp; &nbsp;SetThreadToken( &amp;hThreadToken2, hThreadToken1 );<br>&nbsp; &nbsp;CloseHandle( hThreadToken1 );<br>}
 
是不是这个?没有仔细看功能,所以拿不准。<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; bThreadToken: Boolean;<br>&nbsp; hThreadToken1, hThreadToken2: THandle;<br>begin<br>&nbsp; if OpenThreadToken(GetCurrentThread, TOKEN_IMPERSONATE, FALSE, hThreadToken1) then<br>&nbsp; begin<br>&nbsp; &nbsp; RevertToSelf();<br>&nbsp; &nbsp; bThreadToken := TRUE;<br>&nbsp; end;<br>&nbsp; //LogonUser(...);<br>&nbsp; //ImpersonateLoggedOnUser(...);<br>&nbsp; if bThreadToken then<br>&nbsp; begin<br>&nbsp; &nbsp; hThreadToken2 := GetCurrentThread();<br>&nbsp; &nbsp; SetThreadToken(@hThreadToken2, hThreadToken1);<br>&nbsp; &nbsp; CloseHandle(hThreadToken1);<br>&nbsp; end;<br>end;<br>
 
接受答案了.
 

Similar threads

I
回复
0
查看
856
import
I
I
回复
0
查看
790
import
I
I
回复
0
查看
785
import
I
回复
5
查看
391
新来的菜鸟
后退
顶部