所以我写了一个小工具,随机发送一个随机持续时间的按键,以解决自动注销问题,因为某些游戏不活跃。 我今天写了它,但在测试我的电脑突然给了我一个BSOD(KMODE_Exception_Not_Handled)。这是我遇到的第一个BSOD,所以我认为这可能是因为我的程序。
主C ++文件:
using namespace std;
class Activator;
int main()
{
Activator *a = new Activator();
cout << "It sends a random amount of arrow keypresses to the RSClient at random intervals." << endl
<< "Because of the randomness of this program it will be fairly safe to use but I take no responsability for your actions, after all it's still macroing/botting!" << endl
<< "Press any key to start KeepRSActive..." << endl;
_getch();
system("cls");
for (size_t i = 10; i > 0; i--)
{
cout << "Please click inside of your RS client" << endl << "The program will start in: " << i << " seconds." << endl;
Sleep(1000);
system("cls");
}
cout << "You will no longer be bothered by automatic logouts!" << endl << "Simply close the console window to stop.";
//Main program loop
while (true)
{
Sleep(33); //30 TPS, Basically a simple repeatable timer.
a->tick();
}
delete a;
return 0;
}
Activator.cpp
Activator::Activator()
{
// Easier to randomise later on
m_KeyList[0] = VK_LEFT;
m_KeyList[1] = VK_RIGHT;
m_KeyList[2] = VK_UP;
m_KeyList[3] = VK_DOWN;
}
Activator::~Activator()
{
}
void Activator::tick()
{
// Random key selected from m_KeyList
setUpNewKeypress(rand() % ARRAYSIZE(m_KeyList) - 1);
// Random amount of time between key presses
Sleep((rand() % 200000) + 20000);
}
void Activator::setUpNewKeypress(WORD key)
{
//Set up the keypress
INPUT input;
// Set up a keyboard event.
input.type = INPUT_KEYBOARD;
input.ki.wScan = 0;
input.ki.time = 0;
input.ki.dwExtraInfo = 0;
// Press the key
input.ki.wVk = key; // virtual-key code for left arrow key
input.ki.dwFlags = 0; // 0 for key press
SendInput(1, &input, sizeof(INPUT));
// Keep the key held down for a random amount of time
Sleep((rand() % 5000) + 500);
// Release the key
input.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release
SendInput(1, &input, sizeof(INPUT));
}
当我搜索该BSOD代码时,99%的结果与启动或有故障的硬件/驱动程序有关,但字面上我的PC上唯一改变的是我写的这个程序。也许这是无限循环?我不确定..