EPROCESS取程序全路徑

2021-06-28 08:08:37 字數 861 閱讀 7903

如果檔案被佔坑,使用file_read_attributes許可權應該能開啟

xp:peprocess->nt路徑->file handle->file object->dos路徑

boolean psgetdosname(peprocess processobject, punicode_string *dosname)

obdereferenceobject(fileobject);

}zwclose(hfile);}}

exfreepool(lpbuffer);

}} zwclose(processhandle);

} return bret;

}

使用方法:

punicode_string filename;

if (psgetdosname(process, &filename))

上面的方法很麻煩,但這是我總結出最靠譜的方法,無硬編碼。

如果是windows7以上的系統,則非常簡單,兩個函式就行了。

ntstatus

psreferenceprocessfilepointer (

in peprocess process,

out pvoid *pfilepointer

);ntstatus

ioqueryfiledosdevicename(

in pfile_object fileobject,

out pobject_name_information *objectnameinformation

);

根據WHND獲取程序的完全路徑

dword dwpid 儲存程序識別符號 getwindowthreadprocessid hfocusw,dwpid 接受乙個視窗控制代碼。dwpid儲存視窗的建立者的程序識別符號,getwindowthreadprocessid返回值是該建立者的執行緒識別符號 handle hbrowser o...

全路徑搜尋策略

1 為了能重用已有dijkstrasearcher的一些函式,新增乙個類directedgraph繼承自igraph,重寫虛函式。directedgraph中有node類和edge類。node類需要std vectoraedge ids欄位,edge類需要unsigned snode id unsi...

1009 安全路徑

題目描述 衛斯理 經常提及外星人,比如藍血人。在土星星球有很多城市,每個城市之間有一條或多條飛行通道,但是並不是所有的路都是很安全的,每一條路有乙個安全係數 s,s 是在 0和1 間的實數 包括0 1 一條從 u 到 v 的通道 p 的安全度為 safe p s e1 s e2 s ek e1,e2...