RE: Kernel32.dll Beep Function 04-06-2013, 02:17 PM
#5
(04-06-2013, 10:42 AM)Psycho_Coder Wrote: Wow great info.But in the code
Code:GetProcAddress( GetModuleHandle(L"kernel32.dll"), "Beep" );
I think there is an extra L, within the braces, its misprinted, it should be GetModuleHandle("kernel32.dll")
and have you compiled the asm code to get the beep sound.I think there is a functon in C sound(anynumber); that does the same job, though Beep() allows us to adjust the delay time as well.
lol, Nope this is not C... There's a reason why I had the L there.
This is just basic C++. That L serves a purpose however. The parameter expects a type of LPCWSTRLP: long pointer
C: constant
W: wide
STR: string.
Otherwise it's just a const char* and not even unicode (16 bits), but rather 8 bit or 1 byte per char.
And yes that inline asm (if that's what you are talking about) gives me the beep sound from the Beep function in kernel32.dll.
That's not the point of the thread though, the point was to use the ASM disassembly to get the shellcode for doing this, so I could compile and run that directly perhaps by injection elsewhere. Anyways, I also added onto the instructions, a ret, to avoid a segmentation fault from happening after running the set of byte instructions.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)