GetModuleHandleA
GetModuleHandleA는 현재 프로세스 주소 공간에 로드된 모듈 중에서 인자로 전달된 모듈을 찾아 베이스 주소를 반환하는 함수입니다
HMODULE GetModuleHandleA(
[in, optional] LPCSTR lpModuleName // 모듈 이름
);Example
#include <windows.h>
#include <iostream>
int main() {
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
if (!hKernel32) {
std::cout << "kernel32.dll not loaded\n";
return 1;
}
std::cout << "kernel32.dll base address: 0x"
<< std::hex << hKernel32 << std::endl;
return 0;
}References
Last updated