35 lines
796 B
Go
35 lines
796 B
Go
package action
|
|
|
|
import (
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
. "ios-wrapper/internal/wrapper/ofile"
|
|
"ios-wrapper/pkg/protomodel"
|
|
)
|
|
|
|
type saveInitPointer struct{}
|
|
|
|
func (action *saveInitPointer) withMacho(mf *MachoFile) error {
|
|
init_pointers := []*protomodel.MachoInfo_InitPointer{}
|
|
for _, ptr := range mf.Context().InitFunctions() {
|
|
init_pointers = append(init_pointers,
|
|
&protomodel.MachoInfo_InitPointer{
|
|
Offset: ptr.Offset(),
|
|
Value: ptr.Value(),
|
|
})
|
|
}
|
|
log.WithFields(log.Fields{
|
|
"pointers": init_pointers,
|
|
}).Info("Saved Init Pointers")
|
|
mf.Info().InitPointers = init_pointers
|
|
return nil
|
|
}
|
|
|
|
func (action *saveInitPointer) withFat(ff *FatFile) error {
|
|
return defaultWithFat(action, ff)
|
|
}
|
|
|
|
func NewSaveInitPointerAction() *saveInitPointer {
|
|
return &saveInitPointer{}
|
|
}
|