Last active
May 21, 2025 02:27
-
-
Save NaniteFactory/a4adce05a5cf7b56a584d36d3cce21b6 to your computer and use it in GitHub Desktop.
A way to get 'Windows process module (.exe) handle' of process itself in Golang.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "syscall" | |
| func main() { | |
| // equivalent to (HANDLE)GetModuleHandle(NULL); in C | |
| handle, _, _ := syscall.Syscall( | |
| syscall.NewLazyDLL("kernel32.dll").NewProc("GetModuleHandleW").Addr(), | |
| 1, 0, 0, 0, | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment