Login Register




Kernel32.dll Beep Function filter_list
Author
Message
RE: Kernel32.dll Beep Function #6
I imrpoved the byte code a bit by splitting the register into a 16 bit portion to hold the smaller integer value. This trims off the 0x0's effectively, which is a good thing, and because the params given will probably never be up to the size of a 32 bit (4 byte) integer value, there's no need for it. I thought of storing the full value in a register, and then pushing the high and low off on the stack separately before, which should work. Unless I go with higher values. 8 bits is really small though... So unless I'm dealing with really small values, it would be stupid to do that.

I could have probably even utilized some bitshifting tricks to get rid of some 0x0's... This is good enough though, a value such as 0x3E8 is a bit too big for an 8 bit storage space however, so 16 bits was the next step up.

Anyways here's what I came up with:
Code:
__asm { mov ecx, dword ptr 0x755631AF xor eax, eax mov ax, 0x320 push eax mov ax, 0x450 push eax call ecx }

Which would be:
Code:
0xB9 0xAF 0x31 0x56 0x75 0x33 0xC0 0x66 0xB8 0x20 0x03 0x50 0x66 0xB8 0x50 0x04 0x50 0xFF 0xD1 0xC3​

And all works fine, no 0x0's. The above byte code is with one added byte for the return, in addition to the instructions from the above C++ code. I'm getting tired of having to find the address of the function each time though, although it makes things a bit simpler once you have the address... I would like to create a more "universal" revision. Smile
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply





Messages In This Thread
Kernel32.dll Beep Function - by ArkPhaze - 04-05-2013, 04:32 AM
RE: Kernel32.dll Beep Function - by ray_22 - 04-12-2023, 10:39 AM
RE: Kernel32.dll Beep Function - by hacxx - 09-05-2026, 11:59 PM
Kernel32.dll Beep Function - by ArkPhaze - 04-05-2013, 04:32 AM