# File lib/msf/core/exploit/seh.rb, line 52
        def generate_seh_payload(handler, opts = {})
        
                # The boilerplate this replaces always has 8 bytes for seh + addr
                seh_space = 8 + payload.nop_sled_size
                
                seh = Rex::Exploitation::Seh.new(
                                payload_badchars,
                                seh_space,
                                opts['NopGenerator'] || nop_generator)

                # Generate the record
                rec = seh.generate_seh_record(handler, datastore['DynamicSehRecord'])
                
                # Append the payload, minus the nop sled that we replaced
                rec << payload.encoded.slice(payload.nop_sled_size, payload.encoded.length)
        end