# GetModuleHandleA

GetModuleHandleA는 현재 프로세스 주소 공간에 로드된 모듈 중에서 인자로 전달된 모듈을 찾아 베이스 주소를 반환하는 함수입니다

```cpp
HMODULE GetModuleHandleA(
  [in, optional] LPCSTR lpModuleName // 모듈 이름
);
```

## Example

```cpp
#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

{% embed url="<https://learn.microsoft.com/ko-kr/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulehandlea>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.pentestwiki.com/defense-evasion/windows-api/getmodulehandlea.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
