Advertisement
Guest User

x86/x64 Beep

a guest
Mar 30th, 2017
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.05 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <CheatTable>
  3.   <CheatEntries>
  4.     <CheatEntry>
  5.       <ID>147</ID>
  6.       <Description>"x86/x64 Beep"</Description>
  7.       <LastState/>
  8.       <VariableType>Auto Assembler Script</VariableType>
  9.       <AssemblerScript>/*
  10. https://msdn.microsoft.com/en-us/library/windows/desktop/ms679277(v=vs.85).aspx
  11. BOOL WINAPI Beep(
  12.   _In_ DWORD dwFreq,
  13.   _In_ DWORD dwDuration
  14. );
  15. */
  16.  
  17. globalalloc(dobeep,1000)
  18. [ENABLE]
  19. dobeep:
  20.   // align stack (ce will automatically use ebp/esp for 32 bit, at least in this test lol)
  21.   mov  rbp, rsp
  22.   and  rsp, -10
  23. {$lua}
  24.   if targetIs64Bit() then
  25.     return [[//code for if it is a 64bit application
  26.       mov rcx, #300 // dwFreq
  27.       mov rdx, #750 // dwDuration
  28.     ]]
  29.   else
  30.     return [[//code for if it is a 32bit application
  31.       push #750 // dwDuration
  32.       push #300 // dwFreq
  33.     ]]
  34.   end
  35. {$asm}
  36.   call beep
  37.   // restore stack pointer
  38.   mov rsp, rbp
  39.   ret
  40.  
  41. createThread(dobeep)
  42.  
  43. [DISABLE]
  44.  
  45. </AssemblerScript>
  46.     </CheatEntry>
  47.   </CheatEntries>
  48. </CheatTable>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement