Skip to content

Commit

Permalink
chore: improve comment in library entrypoint file
Browse files Browse the repository at this point in the history
  • Loading branch information
f1zm0 committed Apr 11, 2023
1 parent 4c0a173 commit 432af39
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions acheron.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ type options struct {
hasher hashing.HashFunction
}

// WithHashFunction returns an Option that sets a custom hashing (or obfuscation)
// function that will be used when resolving native api procedures by hash.
// WithHashFunction returns an Option that sets a custom hashing or obfuscation function.
func WithHashFunction(f hashing.HashFunction) Option {
return func(o *options) {
o.hasher = f
}
}

// New returns a new Acheron instance that can be used as a proxy to perform
// indirect syscalls for native api functions, or an error if the initialization fails.
// New returns a new Acheron instance with the given options, or an error if initialization fails.
func New(opts ...Option) (*Acheron, error) {
options := &options{
hasher: hashing.DJB2,
Expand All @@ -49,8 +47,8 @@ func New(opts ...Option) (*Acheron, error) {
}
}

// Syscall executes a syscall with the given function hash and arguments.
// Returns the error code and an error if the syscall failed.
// Syscall executes an indirect syscall with the given function hash and arguments.
// Returns the error code returned by the syscall is something goes wrong.
func (a *Acheron) Syscall(fnHash uint64, args ...uintptr) error {
sys, err := a.resolver.GetSyscall(fnHash)
if err != nil {
Expand All @@ -62,6 +60,4 @@ func (a *Acheron) Syscall(fnHash uint64, args ...uintptr) error {
return nil
}

// execIndirectSyscall function signature for go-asm impelementation.
// returns 0 if the syscall was successful or an error code if the operation failed.
func execIndirectSyscall(ssn uint16, gateAddr uintptr, argh ...uintptr) (errcode uint32)

0 comments on commit 432af39

Please sign in to comment.