top of page
Search

[86] No Cost Quite Like Sunk Cost

  • Writer: Conlan Walker
    Conlan Walker
  • Jun 30, 2023
  • 2 min read

So, this week was mostly a bust, as my week or two-long work ran aground over the fact that waveOutReset just doesn't seem to do what it ought to. This effectively negates any usefulness I can derive out of the rest of waveOut's simple but effective API. waveOutReset is just about necessary if you want to close a waveOut device, as any call to waveOutClose will error if there are still pending buffers left in its internal queue. For me at least, waveOutReset simply causes its calling thread to hang indefinitely. Debugging gave mostly useless results, and a lack of forum posts on the topic leads me to believe that its just a product of a legacy component finally falling victim to bitrot.

Here's the code that works until you want to close out a device (I think I even have that portion commented out here).

The Header:

And the rest of the source:

And this is just how simple I was able to make things. (mostly modeled after how SDL's audio interface works):

This just plays a sine wave at 440 hertz for a second.



So, if I can't do anything useful with it, how about making something useless?

Basically, what this code does is start playing PCM audio data of Rick Astley's "Never Gonna Give You Up" in mono at 11.025kHz, making a message box pop up shortly before shutting off your computer. This is, by definition, malware.

Here's a video of it in action. I recorded this in .mkv format, so the video wouldn't get corrupted when the computer suddenly shuts off:

The only reason the video stops is because OBS is forcibly told to quit.

So, Next week I'll either just try out WASAPI or move on completely to GDI, so I can at least put some things on-screen.

 
 
 

Comments


bottom of page