Files
lsgo/third_party/peinfo-go/peinfo/initialize.go
lordwelch b5d007c865 Add ability to create a git repository from a BG3 install
Add library to parse version info from a windows PE executable
There are issues with go-git, will change to a wrapper library
2021-02-15 21:47:38 -08:00

32 lines
569 B
Go

package peinfo
import (
"debug/pe"
"os"
"path/filepath"
)
// Initialize returns the config for execution
func Initialize(filePath string, verbose bool, rootCertDir string, extractCert bool) (ConfigT, error) {
fh, err := os.Open(filePath)
if nil != err {
return ConfigT{}, err
}
tempPE, err := pe.NewFile(fh)
if nil != err {
return ConfigT{}, err
}
file := ConfigT{
FileName: filepath.Base(filePath),
OSFile: fh,
PEFile: tempPE,
Verbose: verbose,
ExtractCert: extractCert,
RootCertDir: rootCertDir,
}
return file, nil
}