Auto elevate for Windows UAC and screen lock #4130

This commit is contained in:
Xinyu Hou 2014-10-27 16:39:18 +00:00
parent 4d3fd14ada
commit d2191b6b93
12 changed files with 352 additions and 54 deletions

View file

@ -171,3 +171,21 @@ CMSWindowsSession::nextProcessEntry(HANDLE snapshot, LPPROCESSENTRY32 entry)
return gotEntry;
}
CString
CMSWindowsSession::getActiveDesktopName()
{
CString result;
HDESK hd = OpenInputDesktop(0, TRUE, GENERIC_READ);
if (hd != NULL) {
DWORD size;
GetUserObjectInformation(hd, UOI_NAME, NULL, 0, &size);
TCHAR* name = (TCHAR*)alloca(size + sizeof(TCHAR));
GetUserObjectInformation(hd, UOI_NAME, name, size, &size);
result = name;
CloseDesktop(hd);
}
return result;
}