This native implementation of UAC (User Account Control) operations in Notepad++ is designed not only to substitute the deprecated & problematic NppSaveAsAdminPlugin - which interferes with the FlushFileBuffers WINAPI used by Notepad++ - but also to support any future Notepad++ feature which may require elevated privileges.
When a user attempts an operation that fails due to indufficient rights, the system performs only that specific requested action with elevated privileges. After completing it, the elevated Notepad++ instance immediately exits, returning the user to his/her original Notepad++ instance seamlessly, as if nothing unusual occured.
This mechanism is independent of any Notepad++ features such as backup-snapshot or multi-instance mode. All UAC-related operations are executed at the very beginning of the wWinMain function, ensuring they are not affected by mutex handling, or other internal logic.
Importantly, this approach eliminates the need for a separate signed helper executable like NppAdminAcess.exe. Everything is handled within the main Notepad++ project, just as before.
In this commit, the NPP_UAC_SAVE, NPP_UAC_SETFILEATTRIBUTES & NPP_UAC_MOVEFILE are implemented.
Summary of the changes:
added last _dwErrorCode in:
.\PowerEditor\src\MISC\Common\FileInterface.h
.\PowerEditor\src\MISC\Common\FileInterface.cpp
FileManager::saveBuffer adjustment for the NPP_UAC_SAVE_SIGN in:
.\PowerEditor\src\ScintillaComponent\Buffer.cpp
N++ UAC ops signatures definitions & new invokeNppUacOp common func, toggleReadOnlyFlagFromFileAttributes func adjustment for the NPP_UAC_SETFILEATTRIBUTES_SIGN in:
.\PowerEditor\src\MISC\Common\Common.h
.\PowerEditor\src\MISC\Common\Common.cpp
only to fix Notepad_plus::doSave for isEndSessionCritical() in:
.\PowerEditor\src\NppIO.cpp
added getLastFileErrorState() & m_dwLastFileError in:
.\PowerEditor\src\Utf8_16.h
.\PowerEditor\src\Utf8_16.cpp
UAC ops handling at the very start of wWinMain + added new NPP_UAC_ handling nppUacSave and nppUacSetFileAttributes funcs in:
.\PowerEditor\src\winmain.cpp
Fix#886, fix#8655, fix#9561, fix#10302, fix#14990, fix#15008, fix#15137, fix#15323, close#16933
1. Change the order of GUI items to make the insert mode (dec/hex/oct/bin) more explicit.
2. Reduce the showing time of the warning baloon tip from ~10 seconds to 3.5 seconds.
3. Use ESC keystroke to cancel the warning baloon tip.
ref: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/16931#issuecomment-3236582042
Note that while the baloon tip showing then clicking on the upper-right 'X', the dialog won't be closed. Instead, the baloon tip will be cancel.
Curiously, clicking on the "Cancel" button under the same context closes the dialog.
The reason could be, while the "Cancel" button being clicked, the focus is changed and the system hides the baloon tip. Whereas the click on the upper-right 'X' doesn't make the focus changed, then the system does nothing.
Anyway such behaviour is a bug, but can happen very rarily.
Close#16959
1. More understandable naming: "javascript.js" to "JavaScript".
2. Disassociate the value of Embedded JS & JavaScript, and remove Embedded JS from the list.
3. Prevent from eventual crash due to null pointer.
Fix#16884, close #16885
* The search input length has been extended from (2048 - 1) up to (16384 - 1) characters.
* For saving find input history, only search strings shorter than 2048 characters will be stored for the next session.
* The tooltip warning is displayed in both cases above.
Fix#16749, fix#1088, close#16855
Info:
```
Microsoft Visual Studio Community 2022
Version 17.14.0
VisualStudio.17.Release/17.14.0+36109.1
Microsoft .NET Framework
Version 4.8.09032
Installed Version: Community
Visual C++ 2022 00482-90000-00000-AA924
Microsoft Visual C++ 2022
...
```
Close#16581