'Reverse engineer Listen to this device on Windows - Reverse Engineer Windows When There's No API

I'm using autohotkey to write a script to toggle "Listen to this device" of my microphone:

listen to this device

There are two steps to accomplish this, first I needed to find out what Registry key is being modified, I was able to accomplish this using RegShot.

The key exists in:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{My-Microphone's-UUID}\Properties

The key is called {24dbb0fc-9311-4b3d-9cf0-18ff155639d4},1 (Not just my laptop but for all computers).

And the value when toggling the "Listen to this device" changes like this: (The 0's change to f's)

xxxxxxxxxxxxxxxx0000xxxx
xxxxxxxxxxxxxxxxffffxxxx

Step two is where my problem lies, when I check the GUI, I see that the "Listen to this device" tickbox has been ticked but I can't actually hear anything from my microphone, when I untick it then hit apply and re-tick it and click apply, I hear my mic. This means that I need some sort of DllCall or PostMessage here, but this is where I fall very short:

I don't know how to make windows understand that this setting has changed, I need to find out what messaged was sent or what dll was called when I click "apply".

So I googled List of Windows Messages and I literally posted every single one of the hexes that exist on the page like this:

PostMessage, 0x0000,,,,A
...
PostMessage, 0xcccd,,,,A

And it didn't work of course, it was a shot in the dark.

Using Autohotkey's WindowSpy on the Sound GUI and from this article I found out that shell32.dll might be involved in this, so using nirsoft's DLL Export Viewer I copied all functions that exist in shell32 and I called all of them using Autohotkey like this:

DllCall("shell32\Control_RunDLL")
...

But this also didn't work.

At first I thought, this is a programming question where it can be answered with Autohotkey and it's tools, so I asked this question on SO, but I've asked to move it to RE as comments below gave me more insight.

Please teach me how I can reverse engineer this properly.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source