我正在使用autohotkey编写一个脚本来切换麦克风的“收听此设备”:
的数据
有两个步骤来实现这一点,首先我需要找出什么注册表项正在修改,我能够完成这一使用RegShot。
密钥存在于:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{My-Microphone's-UUID}\Properties
字符串
这个键叫做{24dbb0fc-9311-4b3d-9cf0-18ff155639d4},1
(不只是我的笔记本电脑,而是所有的电脑)。
切换“Listen to this device”时的值会像这样变化:(0的值变为f)
xxxxxxxxxxxxxxxx0000xxxx
xxxxxxxxxxxxxxxxffffxxxx
型
第二步是我的问题所在,当我检查GUI时,我看到“Listen to this device”tickbox已经被勾选,但我实际上听不到麦克风的任何声音,当我取消勾选它然后点击应用并重新勾选它并点击应用时,我听到我的麦克风。这意味着我需要某种DllCall或PostMessage,但这是我非常欠缺的地方:
我不知道如何使windows了解此设置已更改,我需要找出什么消息被发送或什么动态链接库被称为当我点击“应用”。
所以我在谷歌上搜索了List of Windows Messages,我真的发布了页面上存在的每一个hex,就像这样:
PostMessage, 0x0000,,,,A
...
PostMessage, 0xcccd,,,,A
型
当然,这并不起作用,这是在黑暗中拍摄。
在Sound GUI和from this article上使用Autohotkey的WindowSpy,我发现shell32.dll
可能涉及到这一点,所以使用nirsoft的DLL导出查看器,我复制了shell32
中存在的所有函数,并使用Autohotkey调用所有函数,如下所示:
DllCall("shell32\Control_RunDLL")
...
型
但这也不管用。
起初我想,这是一个编程问题,它可以用Autohotkey和它的工具来回答,所以我在SO上问了这个问题,但我已经要求将它移到RE上,因为下面的评论给了我更多的见解。
请教我如何正确地进行逆向工程。
1条答案
按热度按时间fnx2tebb1#
感谢RE上的this answer,我能够提出一个适当的代码示例来设置是否启用/禁用监听,以及应该在哪个设备上监听-包括“默认播放设备”设置。
这是在python中使用pycaw和comtypes,但我认为它可以很容易地用其他具有coreaudio库的语言来完成。
字符串