RE: Kernel32.dll Beep Function 09-05-2026, 11:59 PM
#8
Interesting read. The part that stands out is the distinction between the assembly being correct and the way the resulting bytes were being interpreted/executed. Hard-coding a `GetProcAddress` result also explains why the approach is tied to a particular process/environment rather than being truly portable.
The later revision using smaller immediates is a nice example of reducing unnecessary null bytes, but I think the more important lesson is understanding the calling convention, pointer size, and address resolution rather than just copying the byte sequence. On modern x64 Windows, those assumptions change considerably, so a universal version would need to account for the platform rather than relying on a fixed `kernel32` address.
Good debugging example overall—especially the point about checking the registers instead of assuming the disassembly tells the whole story.
The later revision using smaller immediates is a nice example of reducing unnecessary null bytes, but I think the more important lesson is understanding the calling convention, pointer size, and address resolution rather than just copying the byte sequence. On modern x64 Windows, those assumptions change considerably, so a universal version would need to account for the platform rather than relying on a fixed `kernel32` address.
Good debugging example overall—especially the point about checking the registers instead of assuming the disassembly tells the whole story.




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