windows下DLL庫里如何獲取動態庫檔名稱

2021-10-07 17:43:36 字數 612 閱讀 9491

windows給我們提供了另乙個api可以獲取到這個dll庫的hmodule,即 getmodulehandleex。

該函式原型如下:

winbaseapi

bool

winapi

getmodulehandleexa

( _in_ dword dwflags,

_in_opt_ lpcstr lpmodulename,

_out_ hmodule* phmodule

);

其中,第三個引數是輸出引數,即我們想知道的hmodule。第二個引數填寫乙個這個abc.dll庫裡面的函式名即可。

完整示例**如下:

string g_strfullpathname;

string g_strfullpath;

string g_strdllnameext;

string g_strdllname;

intinit

(/*some param*/);

//動態庫宣告的api函式

void

parsemodulename()

}

windows下 遠端DLL注入

核心函式 createtoolhelp32snapshot createtoolhelp32snapshot函式為指定的程序 程序使用的堆 heap 模組 module 執行緒 thread 建立乙個快照 snapshot handle winapi createtoolhelp32snapshot...

windows下lib與dll關係

1.lib與dll 區別 1 lib是編譯時需要的,dll是執行時需要的。如果要完成源 的編譯,有lib就夠了。如果也使動態連線的程式執行起來,有dll就夠了。在開發和除錯階段,當然最好都有。2 一般的動態庫程式有lib檔案和dll檔案。lib檔案是必須在編譯期就連線到應用程式中的,而dll檔案是執...

windows下dll開發雜記《一》

在目前的專案中,發現原子業務的匯出沒有使用extern c 關鍵字,而業務dll匯出函式中使用了extern c 關鍵字,仔細思考了下,什麼情況下需要使用extern c 一.在c 中呼叫的c的函式,需要先extern c 宣告,二.宣告c 的函式為extern c 提供給c呼叫,使用extern ...