SHARE
TWEET

Untitled

a guest Jun 2nd, 2016 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Variables----------------------------------------------------------------------------------------
  2.  
  3. local DNOPTable = {}
  4.  
  5. --Functions----------------------------------------------------------------------------------------
  6.  
  7. function toggleDNOP(memoryViewForm)
  8.     local minAddr = math.min(memoryViewForm.DisassemblerView.SelectedAddress,memoryViewForm.DisassemblerView.SelectedAddress2)
  9.     local maxAddr = math.max(memoryViewForm.DisassemblerView.SelectedAddress,memoryViewForm.DisassemblerView.SelectedAddress2)
  10.     if DNOPTable[minAddr] ~= nil then
  11.         deleteDNOP(memoryViewForm)
  12.         return
  13.     end
  14.     debug_setBreakpoint(minAddr)
  15.     if (minAddr == maxAddr) then maxAddr = minAddr+getInstructionSize(minAddr) end
  16.     DNOPTable[minAddr] = maxAddr
  17. end
  18.  
  19. function debugger_onBreakpoint()
  20.     local bitMode = targetIs64Bit()
  21.     for i,j in pairs(DNOPTable) do
  22.         if bitMode then
  23.             if i == RIP then
  24.                 RIP = j
  25.             end
  26.         else
  27.             if i == EIP then
  28.                 EIP = j
  29.                                  debug_continueFromBreakpoint(co_run)
  30.   return 1
  31.             end
  32.         end
  33.     end
  34. end
  35.  
  36. function deleteDNOP(memoryViewForm)
  37.     local minAddr = math.min(memoryViewForm.DisassemblerView.SelectedAddress,memoryViewForm.DisassemblerView.SelectedAddress2)
  38.     if DNOPTable[minAddr] ~= nil then
  39.         debug_removeBreakpoint(minAddr)
  40.         DNOPTable[minAddr] = nil
  41.         debug_continueFromBreakpoint(co_run)
  42.     end
  43. end
  44.  
  45. function AddItemMenuInMemoryViewForm(memoryViewForm, nameItemMenu, shortcut, functionItemClick)
  46.     local dv = memoryViewForm.DisassemblerView
  47.  
  48.     local popupmenu = dv.PopupMenu
  49.     local mi = createMenuItem(popupmenu)
  50.     mi.Caption = nameItemMenu
  51.  
  52.     mi.onClick =
  53.     function ()
  54.         functionItemClick(memoryViewForm)
  55.     end
  56.     mi.Shortcut = shortcut
  57.  
  58.     popupmenu.Items.add(mi)
  59. end
  60.  
  61. function AddItemMenuSeparatorInMemoryViewForm(memoryViewForm)
  62.     local dv = memoryViewForm.DisassemblerView
  63.  
  64.     local popupmenu = dv.PopupMenu
  65.     local mi = createMenuItem(popupmenu)
  66.     mi.Caption = '-'
  67.     popupmenu.Items.add(mi)
  68. end
  69.  
  70. function addPopUpMenuEntry(memoryViewForm)
  71.     if memoryViewForm.ClassName~="TMemoryBrowser" then
  72.         return
  73.     else
  74.         local timer=createTimer()
  75.         timer.Interval=100
  76.         timer.OnTimer = function (t)
  77.             t.destroy()
  78.             AddItemMenuSeparatorInMemoryViewForm(memoryViewForm)
  79. AddItemMenuInMemoryViewForm(getMemoryViewForm(), 'Set/Unset DNOP Breakpoint', nil, toggleDNOP)
  80.         end
  81.     end
  82. end
  83.  
  84. --Main---------------------------------------------------------------------------------------------
  85.  
  86. registerFormAddNotification(addPopUpMenuEntry)
  87. AddItemMenuSeparatorInMemoryViewForm(getMemoryViewForm())
  88. AddItemMenuInMemoryViewForm(getMemoryViewForm(), 'Set/Unset DNOP Breakpoint', nil, toggleDNOP)
  89.  
  90. --Events-------------------------------------------------------------------------------------------
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top