GetAsyncKeyState() 导致防病毒程序标记为键盘记录器 [英] GetAsyncKeyState() causes anti-virus program to flag as keylogger

查看:30
本文介绍了GetAsyncKeyState() 导致防病毒程序标记为键盘记录器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在 Windows API 中构建一个非常小的游戏,在主消息循环中,我使用 GetAsyncKeyState() 来测试用户是否按下箭头按钮.我使用它而不是 WM_KEYDOWN 因为使用 WM_KEYDOWN 在第一次按下后会有一个初始暂停,我不想修改用户的设置.我的防病毒程序将游戏标记为键盘记录程序,还有其他方法吗?

I have been building a very small game in the Windows API, and in the main message loop I use GetAsyncKeyState() to test if a user is pressing the arrow buttons. I use this instead of WM_KEYDOWN because with WM_KEYDOWN there is an initial pause after the first press, and I don't want to modify a user's settings. My antivirus program flags the game as a keylogger program, is there an alternative way about this?

推荐答案

反病毒程序应该如何猜测你是没有使用 GetAsyncKeyState() 来监视键盘和记录键?你当然告诉它,排除.如果您担心您的未来客户不会那么容易被说服,那么请返回使用 WM_KEYDOWN/UP.使用包含 256 个布尔值的数组来跟踪键状态.在 DOWN 时将其设置为 true,无论您获得多少,在 UP 时设置为 false.当您的应用失去焦点时停止调用 API 函数时,还要检查扫描仪是否满意.注意 WM_ACTIVATEAPP.

How is the anti-virus program supposed to guess that you are not using GetAsyncKeyState() to spy on the keyboard and log keys? You tell it of course, make an exclusion. If you're worried that your future customers are not so easily convinced then go back to using WM_KEYDOWN/UP. Use an array of 256 bools to keep track of the key state. Set it to true on DOWN, regardless of how many you get, false on UP. Also check if the scanner is happy when you stop calling the API function when your app loses focus. Pay attention to WM_ACTIVATEAPP.

这篇关于GetAsyncKeyState() 导致防病毒程序标记为键盘记录器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆