Skip to content

Commit

Permalink
dependency cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorgimenez committed Feb 12, 2024
1 parent c04250d commit 11e201f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ require (
github.com/beefsack/go-astar v0.0.0-20200827232313-4ecf9e304482
github.com/bwmarrin/discordgo v0.27.1
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1
github.com/hectorgimenez/d2go v0.0.0-20240204054823-23600ecb0a6f
github.com/hectorgimenez/d2go v0.0.0-20240212022119-de5d7c115748
github.com/lxn/win v0.0.0-20210218163916-a377121e959e
github.com/winlabs/gowin32 v0.0.0-20221003142512-0d265587d3c9
golang.org/x/sync v0.6.0
golang.org/x/sys v0.17.0
gopkg.in/yaml.v3 v3.0.1
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1/go.mod h1:A2S0CWkNylc2
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/hectorgimenez/d2go v0.0.0-20240204054823-23600ecb0a6f h1:AEyTnBYVnxiGQEkYUDUeufrL83+SzRaMj/GKLSPPfrE=
github.com/hectorgimenez/d2go v0.0.0-20240204054823-23600ecb0a6f/go.mod h1:QXuKJYL7/gh0dnwHu/f8bqEWDAOy1QP51RV1I0mjUKM=
github.com/hectorgimenez/d2go v0.0.0-20240212022119-de5d7c115748 h1:e52sPiL5z5LqzxOZvDHy1VZG7hMZ0gFuGjrwgdQHRO8=
github.com/hectorgimenez/d2go v0.0.0-20240212022119-de5d7c115748/go.mod h1:UqWDuAc3lyiNo/zhBWa9J5ZecTYhg+3ljJoJB6vDoG8=
github.com/lxn/win v0.0.0-20210218163916-a377121e959e h1:H+t6A/QJMbhCSEH5rAuRxh+CtW96g0Or0Fxa9IKr4uc=
github.com/lxn/win v0.0.0-20210218163916-a377121e959e/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/winlabs/gowin32 v0.0.0-20221003142512-0d265587d3c9 h1:U8aCPFEMnxAEyj9IonhMVV1gSL4nzelh8uvoXp0hrq0=
github.com/winlabs/gowin32 v0.0.0-20221003142512-0d265587d3c9/go.mod h1:N51TYkG9JGR5sytj0EoPl31Xg2kuB507lxEmrwSNvfQ=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
Expand Down
11 changes: 4 additions & 7 deletions internal/memory/injection.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"encoding/binary"
"errors"
"fmt"
"github.com/hectorgimenez/d2go/pkg/memory"
"github.com/lxn/win"
"github.com/winlabs/gowin32"
"golang.org/x/sys/windows"
"strings"
"syscall"
Expand All @@ -30,19 +30,16 @@ func InjectorInit(pid uint32) error {
}
handle = pHandle

modules, err := gowin32.GetProcessModules(pid)
modules, err := memory.GetProcessModules(pid)
if err != nil {
return fmt.Errorf("error getting process modules: %w", err)
}

_, err = syscall.LoadLibrary("USER32.dll")
if err != nil {
return fmt.Errorf("error loading USER32.dll: %w", err)
}
syscall.MustLoadDLL("USER32.dll")

for _, module := range modules {
// GetCursorPos
if strings.EqualFold(module.ModuleName, "USER32.dll") {
if strings.Contains(strings.ToLower(module.ModuleName), "user32.dll") {
getCursorPosAddr, err = syscall.GetProcAddress(module.ModuleHandle, "GetCursorPos")
getKeyStateAddr, _ = syscall.GetProcAddress(module.ModuleHandle, "GetKeyState")
trackMouseEventAddr, _ = syscall.GetProcAddress(module.ModuleHandle, "TrackMouseEvent")
Expand Down

0 comments on commit 11e201f

Please sign in to comment.