#include <windows.h>
#include <tlhelp32.h>
#include <iostream>
using namespace std;
// 检查管理员权限
bool IsAdmin() {
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup;
BOOL isAdmin = AllocateAndInitializeSid(
&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorsGroup);
}
// 控制极域服务状态
bool ControlClassService(bool enable) {
SC_HANDLE scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (!scm) return false;
}
// 主控制台界面
void ShowControlPanel() {
system("cls");
cout << "=== 极域电子教室控制面板 ===" << endl;
cout << "当前状态: " << (ControlClassService(true) ? "已连接" : "已断开") << endl;
cout << "--------------------------" << endl;
cout << "按 0 临时脱控(仍可收文件)" << endl;
cout << "按 1 重新连接教师端" << endl;
cout << "按 ESC 退出程序" << endl;
cout << "--------------------------" << endl;
}
int main() {
if (!IsAdmin()) {
cout << "错误:请以管理员身份运行本程序!" << endl;
system("pause");
return 1;
}
}