# Interface: com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.IEStateHooks

Memory hooks.

## Method: onAllocMemory
- parameter: `state`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.EState`
- parameter: `address`, type: `long`
- parameter: `size`, type: `int`
- parameter: `protection`, type: `int`
- return type: `java.lang.Long`

Description: Invoked before a memory\-alloc operation.
parameter: state: 
parameter: address: requested address
parameter: size: requested size \(may be adjusted\)
parameter: protection: 
return: null to let the operation proceed; else, a memory address \(the result of the         allocation operation\)

## Method: onAllocMemoryPost
- parameter: `state`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.EState`
- parameter: `address`, type: `long`
- parameter: `size`, type: `int`
- parameter: `protection`, type: `int`
- return type: `java.lang.Long`

Description: Invoked after a memory\-alloc operation.
parameter: state: 
parameter: address: the allocated address
parameter: size: the adjusted allocated size
parameter: protection: 
return: null to let the operation proceed; else, a memory address \(the result of the         allocation operation\)

## Method: onFreeMemory
- parameter: `state`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.EState`
- parameter: `address`, type: `long`
- parameter: `size`, type: `int`
- return type: `java.lang.Boolean`

Description: Invoked before a memory\-free operation.
parameter: state: 
parameter: address: the allocated address
parameter: size: the amount of bytes to be freed
return: null to let the operation proceed; else, a success indicator

## Method: onReadMemory
- parameter: `state`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.EState`
- parameter: `address`, type: `long`
- parameter: `buffer`, type: `byte[]`
- return type: `java.lang.Integer`

Description: Invoked before a memory\-read operation.
parameter: state: the state
parameter: address: memory address
parameter: buffer: output buffer \(contents may be written by the hook; make sure to return a            non\-null code if so\)
return: null to process with the read; else, a read operation return code \(one of:         [EState#MEMREAD_OK](EState#MEMREAD_OK), [EState#MEMREAD_FAILED](EState#MEMREAD_FAILED),         [EState#MEMREAD_BADDATA](EState#MEMREAD_BADDATA)\)

## Method: onReadMemoryPost
- parameter: `state`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.EState`
- parameter: `address`, type: `long`
- parameter: `buffer`, type: `byte[]`
- parameter: `retcode`, type: `int`
- return type: `java.lang.Integer`

Description: Invoked after a memory\-read operation.
parameter: state: the state
parameter: address: memory address
parameter: buffer: read bytes \(may be modified by the hook\)
parameter: retcode: the return code provided by the read operation \(one of:            [EState#MEMREAD_OK](EState#MEMREAD_OK), [EState#MEMREAD_FAILED](EState#MEMREAD_FAILED),            [EState#MEMREAD_BADDATA](EState#MEMREAD_BADDATA)\)
return: null or a a read operation return code override \(one of: [EState#MEMREAD_OK](EState#MEMREAD_OK),         [EState#MEMREAD_FAILED](EState#MEMREAD_FAILED), [EState#MEMREAD_BADDATA](EState#MEMREAD_BADDATA)\)

## Method: onWriteMemory
- parameter: `state`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.EState`
- parameter: `address`, type: `long`
- parameter: `buffer`, type: `byte[]`
- return type: `java.lang.Boolean`

Description: Invoked before a memory write.
parameter: state: the state
parameter: address: memory address
parameter: buffer: bytes to be written \(may be modified by the hook\)
return: null to let the write operation proceed; else, a success code

