dfhack/examples/suspendtest.cpp

52 lines
1.1 KiB
C++

// Test suspend/resume
#include <iostream>
#include <climits>
#include <integers.h>
#include <vector>
#include <ctime>
#include <string>
using namespace std;
#include <DFTypes.h>
#include <DFHackAPI.h>
int main (void)
{
string blah;
DFHack::API DF("Memory.xml");
if(!DF.Attach())
{
cerr << "DF not found" << endl;
return 1;
}
cout << "Attached, DF should be suspended now" << endl;
getline(cin, blah);
DF.Resume();
cout << "Resumed, DF should be running" << endl;
getline(cin, blah);
DF.Suspend();
cout << "Suspended, DF should be suspended now" << endl;
getline(cin, blah);
DF.Resume();
cout << "Resumed, testing ForceResume. Suspend using SysInternals Process Explorer" << endl;
getline(cin, blah);
2009-11-18 18:48:18 -07:00
DF.ForceResume();
cout << "ForceResumed. DF should be running." << endl;
getline(cin, blah);
2009-11-18 18:48:18 -07:00
if(!DF.Detach())
{
cerr << "Can't detach from DF" << endl;
return 1;
}
cout << "Detached, DF should be running again" << endl;
getline(cin, blah);
return 0;
}