通過非同步過程呼叫 APC 注入DLL

2021-07-07 08:10:52 字數 991 閱讀 1277

關於apc的介紹,可以參考msdn對asynchronous procedure calls的介紹(索引apcs),下面是簡單翻譯的一段文字。

apc(asynchronous procedure calls,非同步過程呼叫)是指在乙個特定的執行緒環境中非同步的執行**。當乙個apc被新增到乙個執行緒的apc佇列的時候,系統會產生乙個軟中斷;當執行緒下一次被排程的時候apc函式將被執行。作業系統產生的apc稱為核心模式apc,應用程式產生的apc稱為使用者模式apc。只有當執行緒處於可喚醒狀態(alertable state),使用者模式的apc才會被執行。

如果要通過queueuserapc來注入dll模組,可以向指定程序的每乙個執行緒(增加執行機會)都插入乙個apc,然後把loadlibrary作為apc函式的過程函式,把dll路徑字串作為過程函式的引數。

示例**:

#include #include #include #include #define check_null_ret(bcondition) if (!bcondition) goto exit0

bool enabledebugprivilege(void)

bool apcinject(dword dwpid, char *pszdllpath)

} te32.dwsize = sizeof(threadentry32);

bret = thread32next(hsnapshot, &te32); }

exit0:

// virtualfreeex

closehandle(hsnapshot);

closehandle(hprocess);

// do not check this value

return bret;}

int main(int argc, char **argv)

apcinject(atoi(argv[1]), argv[2]);

return 0;

}

通過非同步過程呼叫 APC 注入DLL

關於apc的介紹,可以參考msdn對asynchronous procedure calls的介紹 索引apcs 下面是簡單翻譯的一段文字。apc asynchronous procedure calls,非同步過程呼叫 是指在乙個特定的執行緒環境中非同步的執行 當乙個apc被新增到乙個執行緒的ap...

通過非同步過程呼叫 APC 注入DLL

關於apc的介紹,可以參考msdn對asynchronous procedure calls的介紹 索引apcs 下面是簡單翻譯的一段文字。apc asynchronous procedure calls,非同步過程呼叫 是指在乙個特定的執行緒環境中非同步的執行 當乙個apc被新增到乙個執行緒的ap...

核心中通過給執行緒插apc注入dll

void apcloaddll pvoid normalcontext,pvoid systemargument1,pvoid systemargument2 void apcloaddllend pmdl pmdl null void apckernelroutine in struct kapc...