Stuck in "Administrator" mode...how to get out?



  • Re-enabling UAC fixed this issue for me. Unfortunately, probably due to all the uninstalls and reinstalls I made while trying to fix it, NPP seems to have lost my saved session. Still I’m glad to have it working again, so thanks a lot people.



  • side note to @Alan-Kilborn, as this thread was resurfaced by @Ilkka-Lindblom :

    i guess my evil upvote finger’s incubation period for “Thanks for everyone’s efforts so far…” is over.
    my hooked, crooked finger just went haywire on that damned button … and i sincerely hope you won’t notice it at all 😉



  • So an update to this thread…

    I’m still in Notepad++ 7.5.x land for my day-to-day Notepad++ usage, but recently I had reason to grab a portable 7.6.4…and I noted that running this one it DOES NOT end up in Administrator mode. By this I mean no [Administrator] in the title bar, and able to drag-n-drop files from a non-admin Explorer window.

    So just a little nicety waiting for me when I get around to making the Plugin Mgr -> Plugin Admin chasm jump! :)

    I don’t know what changed in N++ so that this now happens, but I’m going to mark this thread SOLVED if I can.



  • hi @Alan-Kilborn

    aaahhhhh … the upvote thread, lol
    i love revisiting things like these 💚
    i’ve got a big smile on my face right now 😃

    ps:
    very intriguing … if 7.6.4 and above don’t trigger administrator mode, but 7.6.3 and below do, could it be that it gets triggered by the existence of a code signing cert on the older versions on your system ?

    i have never heard about a behaviour like this if something is code signed, but 7.6.4 was the first release without windows code signing. ⁉️



  • @Meta-Chuh

    I did not do exhaustive testing, but I just went back and tried 7.6.3 and 7.6.2 portable versions. Both of these showed [Administrator] in the title bar. Trying 7.6.4 again…still no [Administrator] there! :)



  • good lord the source code determining if the application should launch in administrator is ugly.

    here is a clarified version of it :

    Notepad_plus::Notepad_plus()
    :   _isAdministrator (false)
    {
        // Determine if user is administrator.
        winVer ver = NppParameters::getInstance()->getWinVersion();
        if (ver >= WV_VISTA || ver == WV_UNKNOWN)
        {
            SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
            PSID AdministratorsGroup;
            if(AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorsGroup))
            {
                BOOL isAdmin;
                if(CheckTokenMembership(NULL, AdministratorsGroup, &isAdmin))
                    _isAdministrator = isAdmin;
                FreeSid(AdministratorsGroup);
            }
        }
    }
    

    Sorry i couldn’t resist.



  • @anselme16 said:

    here is a clarified version

    I’m confused – why is it ugly? Looking at the existing code (below) I’m struggling to see any significant ugliness or even any real differences between it and your version:

    Notepad_plus::Notepad_plus()
        /* ... */
    {
        /* ... */
        
        // Determine if user is administrator.
        BOOL is_admin;
        winVer ver = NppParameters::getInstance()->getWinVersion();
        if (ver >= WV_VISTA || ver == WV_UNKNOWN)
        {
            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;
    }
    


  • I have also experienced this issue and I was able to resolve it.

    First, I got into this situation with Notepad++ itself. I tried to edit a file in the Program Files tree and was prompted by Notepad++ that I needed to be in admin mode to do that and did I want to restart Notepad++ in admin mode. I clicked Yes and have been in admin mode ever since.

    As noted above, drag and drop from a non-admin explorer doesn’t work, but the context menu Open with Notepad++ does, so it wasn’t too much of a hardship. However, it is annoying, so I tried to find out how to turn it off. There is no setting within Notepad++ for it, nor is the compatibility mode tab on the properties sheet checked.

    I did a google search and found this thread. One of the suggestions was to search the registry for Notepad++. I tried this and found the magic key. Under HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatability Assistant\Store there was a value named C:\Program Files\Notepad++\notepad++.exe. I deleted this value and restarted Notepad++ and it is in normal mode again.

    I have been able to repeat this by dragging a file from the Program Files tree into Notepad++ which works fine, but when you try to save it, the reopen in admin mode prompt appears.

    Thanks for the help.



  • @Alex-Boyce

    thx for the information.
    Because you ended with Thanks for the help. I’m unsure if you expect an answer
    on an implicit question, which I was not able to identify (non-native speaker).



  • Similar discussion relating to the original topic here is continued IN-THIS-THREAD


Log in to reply