取得某程序EXE路徑

2021-05-04 14:44:24 字數 831 閱讀 2971

)取得某程序exe路徑:

procedure tform1.button3click(sender: tobject);

varh:thandle; filename:string;

ilen:integer;

hmod:hmodule;

cbneeded,p:dword;

begin

temp:= listbox1.items.strings[listbox1.itemindex];

temp:=copy(temp,pos(':',temp)+1,length(temp));

p :=dword(strtoint(temp));

h := openprocess(process_all_access, false, p);      //p 為 程序id

if h > 0 then

begin

if enumprocessmodules( h, @hmod, sizeof(hmod), cbneeded) then

begin

setlength(filename, max_path);

ilen := getmodulefilenameex(h, hmod, pchar(filename), max_path);

if ilen <> 0 then

begin

setlength(filename, strlen(pchar(filename)));

memo1.lines.add(filename);

end;

end;

closehandle(h);

end;

end;

關於ark取得程序的映象檔案路徑

最近看到乙個trojan把自己拷到 站裡隱藏,然後發現我兩萬年前寫的ark取得的程序路徑還是原路徑。突然想起來很久以前看到某群的討論 拿破倫19 22 03 話說,乙個執行中的檔案,然後移動他到其他目錄 拿破倫19 22 33 有些檢測他的路徑會變成新的目錄 kkindof 19 23 05 丫的,...

java web工程各種路徑取得

request.getrealpath 這個方法已經不推薦使用了,代替方法是 request.getsession getservletcontext getrealpath 在servlet裡用this.getservletcontect getrealpath 在struts裡用this.get...

C 獲取exe的路徑

c 獲取程式路徑的方法中需要注意的地方 版本1 獲取執行程式路徑的方法主要有以下7種 system.diagnostics.process.getcurrentprocess mainmodule.filename 他獲取的是module的檔名,如果在vs2008的除錯環境中,獲取的是 程式名 vs...