MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / ParseMem

Function ParseMem

pkg/pe/parser.go:194–206  ·  view source on GitHub ↗

ParseMem parses the in-memory layout of the PE header for the specified process and base address. If change protection parameter is set to true, this method will attempt to change region protection if the region is marked as inaccessible.

(pid uint32, base uintptr, changeProtection bool, opts ...Option)

Source from the content-addressed store, hash-verified

192// is set to true, this method will attempt to change region protection
193// if the region is marked as inaccessible.
194func ParseMem(pid uint32, base uintptr, changeProtection bool, opts ...Option) (*PE, error) {
195 access := windows.PROCESS_VM_READ | windows.PROCESS_QUERY_INFORMATION
196 if changeProtection {
197 access |= windows.PROCESS_VM_OPERATION
198 }
199 process, err := windows.OpenProcess(uint32(access), false, pid)
200 if err != nil {
201 return nil, err
202 }
203 defer windows.Close(process)
204 area := va.ReadArea(process, base, MaxHeaderSize, MinHeaderSize, changeProtection)
205 return ParseBytes(area, opts...)
206}
207
208func newParserOpts(opts opts) *peparser.Options {
209 return &peparser.Options{

Callers 3

GetMethod · 0.92
TestIsHeaderModifiedFunction · 0.85
TestParseMemFunction · 0.85

Calls 3

ReadAreaFunction · 0.92
ParseBytesFunction · 0.85
CloseMethod · 0.65

Tested by 2

TestIsHeaderModifiedFunction · 0.68
TestParseMemFunction · 0.68