我知道一个程序的句柄,如何得到他的路径呀???(50分)

L

l0f

Unregistered / Unconfirmed
GUEST, unregistred user!
我知道一个程序的句柄,如何得到他的路径呀???
 
是运行着的程序吗?
 
function GetProcessfilename(hand:thandle):string;<br>var<br>&nbsp; aThreadID: DWORD;<br>&nbsp; aProcessID:dword;<br>&nbsp; aProcHandle: DWORD;<br>&nbsp; chararr:array[0..127] of char;<br>&nbsp; xx:hmodule;<br>&nbsp; yy:dword;<br>begin<br>&nbsp; if hand&lt;&gt;0 then<br>&nbsp; begin<br>&nbsp; aThreadID := GetWindowThreadProcessId(hand,@aProcessID);<br><br>&nbsp; if aProcessID&lt;&gt;0 &nbsp;then<br>&nbsp; &nbsp; &nbsp;aProcHandle := OpenProcess(PROCESS_ALL_ACCESS, False, aProcessID);<br><br>&nbsp; if aProcHandle&lt;&gt;0 then<br>&nbsp; &nbsp; &nbsp;begin <br>&nbsp; &nbsp; &nbsp;enumprocessmodules(aprochandle,@xx,sizeof(xx),yy);<br>&nbsp; &nbsp; &nbsp;getmodulebasename(aprochandle,xx,chararr,127); <br>&nbsp; &nbsp; &nbsp;result:=chararr;<br>&nbsp; &nbsp; &nbsp;end;<br>&nbsp; end;<br>end;<br>
 
GetModuleFileNameEx(aprochandle,xx,chararr,127);
 
顶部