Dark Byte Site Admin
  Reputation: 470
  Joined: 09 May 2003 Posts: 25807 Location: The netherlands
  | 
		
			
				 Posted: Sun Nov 15, 2020 3:23 pm    Post subject: Add comment range to the AOB and FullInjection templates | 
				       | 
			 
			
				
  | 
			 
			
				This will replace the old AOB and FullInjection templates with a version that requests a variable comment length.
 
 
I'm sure you can figure out how to hardcode it to any length you like
 
 
 	  | Code: | 	 		  
 
--handy helper function
 
function forEachAndFutureForm(classname, func)
 
  local i
 
  for i=0,getFormCount()-1 do
 
    local f
 
    f=getForm(i)
 
    if f.ClassName==classname then
 
      func(f) 
 
    end
 
  end
 
 
  registerFormAddNotification(function(f)
 
    if classname==f.ClassName then
 
      func(f)
 
    end
 
  end)
 
end
 
 
forEachAndFutureForm('TfrmAutoInject',function(f)
 
  f.registerCreateCallback(function(f)
 
    if f.ScriptMode=='smAutoAssembler' then
 
      f.menuAOBInjection.OnClick=function(s)
 
        local address=getNameFromAddress(getMemoryViewForm().DisassemblerView.SelectedAddress)
 
        address=inputQuery('Code inject template+', 'On what address do you want the jump?', address)
 
        if address==nil then return end
 
 
        local name='INJECT'                
 
        local counter=1
 
        while f.assemblescreen.Lines.Text:find(name..':') do
 
          counter=counter+1
 
          name='INJECT'..counter
 
        end
 
        name=inputQuery('Code inject template+', 'What do you want to name the symbol for the injection point?', name)
 
        if name==nil then return end
 
 
        local radius=10
 
        radius=tonumber(inputQuery('Code inject template+', 'Comment radius?', radius));
 
        if radius==nil then radius=10 end
 
        
 
 
        generateAOBInjectionScript(f.assemblescreen.Lines, name, address, radius)
 
        
 
      end
 
 
      f.menuFullInjection.OnClick=function(s)
 
        local address=getNameFromAddress(getMemoryViewForm().DisassemblerView.SelectedAddress)
 
        address=inputQuery('Code inject template+', 'On what address do you want the jump?', address)
 
        if address==nil then return end
 
 
        local radius=10
 
        radius=tonumber(inputQuery('Code inject template+', 'Comment radius?', radius));
 
        if radius==nil then radius=10 end        
 
 
        generateFullInjectionScript(f.assemblescreen.Lines, address, radius)        
 
      end
 
    end
 
  end)
 
end)
 
 | 	  
 
 
edit: fixed menuFullInjection
 _________________
 Do not ask me about online cheats. I don't know any and wont help finding them.
 
 
Like my help? Join me on Patreon so i can keep helping 
  Last edited by Dark Byte on Mon Nov 16, 2020 3:11 am; edited 3 times in total | 
			 
		  |