mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 13:04:37 +03:00
wip: tun privilege
This commit is contained in:
@@ -4,8 +4,9 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
void Windows_QWidget_SetForegroundWindow(QWidget* w) {
|
||||
void Windows_QWidget_SetForegroundWindow(QWidget *w) {
|
||||
HWND hForgroundWnd = GetForegroundWindow();
|
||||
DWORD dwForeID = ::GetWindowThreadProcessId(hForgroundWnd, NULL);
|
||||
DWORD dwCurID = ::GetCurrentThreadId();
|
||||
@@ -13,3 +14,11 @@ void Windows_QWidget_SetForegroundWindow(QWidget* w) {
|
||||
::SetForegroundWindow((HWND) w->winId());
|
||||
::AttachThreadInput(dwCurID, dwForeID, FALSE);
|
||||
}
|
||||
|
||||
int isThisAdmin = -1; // cached
|
||||
|
||||
bool Windows_IsInAdmin() {
|
||||
if (isThisAdmin >= 0) return isThisAdmin;
|
||||
isThisAdmin = IsUserAnAdmin();
|
||||
return isThisAdmin;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user