[NEW_FEATURE] (Author: Andreas Jonsson) Change window title if program is running as administrator.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1115 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
dda403cc6c
commit
f552ef85a7
@ -152,6 +152,25 @@ Notepad_plus::Notepad_plus(): _mainWindowStatus(0), _pDocTab(NULL), _pEditView(N
|
|||||||
{
|
{
|
||||||
_toolBar.initTheme(toolIconsDocRoot);
|
_toolBar.initTheme(toolIconsDocRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine if user is administrator.
|
||||||
|
BOOL is_admin;
|
||||||
|
if(NppParameters::getInstance()->getWinVersion() >= WV_VISTA)
|
||||||
|
{
|
||||||
|
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
|
||||||
|
PSID AdministratorsGroup;
|
||||||
|
is_admin = AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorsGroup);
|
||||||
|
if(is_admin)
|
||||||
|
{
|
||||||
|
if(!CheckTokenMembership(NULL, AdministratorsGroup, &is_admin))
|
||||||
|
is_admin = FALSE;
|
||||||
|
FreeSid(AdministratorsGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
is_admin = false;
|
||||||
|
|
||||||
|
_isAdministrator = is_admin ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ATTENTION : the order of the destruction is very important
|
// ATTENTION : the order of the destruction is very important
|
||||||
@ -2531,6 +2550,9 @@ void Notepad_plus::setTitle()
|
|||||||
result += TEXT(" - ");
|
result += TEXT(" - ");
|
||||||
result += _pPublicInterface->getClassName();
|
result += _pPublicInterface->getClassName();
|
||||||
|
|
||||||
|
if(_isAdministrator)
|
||||||
|
result += TEXT(" [Administrator]");
|
||||||
|
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), WM_SETTEXT, 0, (LPARAM)result.c_str());
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SETTEXT, 0, (LPARAM)result.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,6 +416,7 @@ private:
|
|||||||
ButtonDlg _restoreButton;
|
ButtonDlg _restoreButton;
|
||||||
|
|
||||||
bool _isFileOpening;
|
bool _isFileOpening;
|
||||||
|
bool _isAdministrator;
|
||||||
|
|
||||||
ScintillaCtrls _scintillaCtrls4Plugins;
|
ScintillaCtrls _scintillaCtrls4Plugins;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user