ParseFileWithConfig parses the PE given the file system path and the config which is usually read from the YAML file. Config flags are converted to parser options.
(path string, config Config)
| 160 | // which is usually read from the YAML file. Config flags are converted to parser |
| 161 | // options. |
| 162 | func ParseFileWithConfig(path string, config Config) (*PE, error) { |
| 163 | if !config.Enabled { |
| 164 | return nil, nil |
| 165 | } |
| 166 | var opts []Option |
| 167 | if len(config.ExcludedImages) > 0 { |
| 168 | opts = append(opts, WithExcludedImages(config.ExcludedImages)) |
| 169 | } |
| 170 | if config.ReadSections { |
| 171 | opts = append(opts, WithSections()) |
| 172 | } |
| 173 | if config.ReadSymbols { |
| 174 | opts = append(opts, WithSymbols()) |
| 175 | } |
| 176 | if config.ReadResources { |
| 177 | opts = append(opts, WithVersionResources()) |
| 178 | } |
| 179 | return ParseFile(path, opts...) |
| 180 | } |
| 181 | |
| 182 | // ParseBytes tries to parse the PE from the given byte slice and parser options. |
| 183 | func ParseBytes(data []byte, opts ...Option) (*PE, error) { |
no test coverage detected