提交 eb725259 编写于 作者: Peacoor Zomboss's avatar Peacoor Zomboss

Must require admin

上级 26ad1174
......@@ -5,8 +5,16 @@
int main(int argc, char *argv[])
{
bool isadmin = IsUserAnAdmin();
DWORD pid = 0;
int msgres = 0;
if (!isadmin) {
retry_runas:
if (runas_admin(argv[0])) // 成功运行就退出自己
return 0;
msgres = MessageBoxW(0, L"请允许管理员权限", L"错误", MB_ICONERROR | MB_RETRYCANCEL);
if (msgres == IDRETRY)
goto retry_runas;
}
DWORD pid = 0;
HMODULE module_handle = 0;
pid = get_civ6_proc();
if (pid == 0) {
......@@ -18,24 +26,8 @@ int main(int argc, char *argv[])
MessageBoxW(0, L"当前没有注入DLL", L"错误", MB_ICONERROR);
return 0;
}
retry_remove:
if (remove_module(pid, module_handle)) {
if (remove_module(pid, module_handle))
MessageBoxW(0, L"成功移除DLL!", L"成功", MB_OK);
return 0;
}
if (isadmin) {
msgres = MessageBoxW(0, L"移除失败", L"错误", MB_RETRYCANCEL | MB_ICONERROR);
if (msgres == IDRETRY)
goto retry_remove;
return 0;
}
msgres = MessageBoxW(0, L"移除失败,是否以管理员权限重试?", L"错误", MB_ICONERROR | MB_RETRYCANCEL);
if (msgres == IDRETRY) {
retry_runas:
if (runas_admin(argv[0])) // 成功运行就退出自己
return 0;
msgres = MessageBoxW(0, L"请在弹出的窗口中点击“是”", L"错误", MB_ICONERROR | MB_RETRYCANCEL);
if (msgres == IDRETRY)
goto retry_runas;
}
else
msgres = MessageBoxW(0, L"移除失败", L"错误", MB_ICONERROR);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册