Hsilgos / nppsaveasadmin

Plugin for notepad++ to save as administrator. "Offical" fork of https://sourceforge.net/projects/nppsaveasadmin/
32 stars 6 forks source link

Plugin ZIP file structure has been changed again #15

Closed dinkumoil closed 5 years ago

dinkumoil commented 5 years ago

Since the author of Notepad++ has changed the requirements for the internal structure of plugin ZIP files (see here) your current ZIP package is no longer valid and will not install properly.

chcg commented 5 years ago

@Hsilgos Thanks for providing this official version. I archived mine repo in favour of this one. Would you like to update https://npppm.bruderste.in/plugins/view/save-as-admin to this repo here or should I do it for you and then take it over to https://github.com/bruderstein/npp-plugins-x64, so the old PluginManager also knows about it.

Hsilgos commented 5 years ago

@Hsilgos Thanks for providing this official version. I archived mine repo in favour of this one. Would you like to update https://npppm.bruderste.in/plugins/view/save-as-admin to this repo here or should I do it for you and then take it over to https://github.com/bruderstein/npp-plugins-x64, so the old PluginManager also knows about it.

Unfortunately i don't have access to npppm.bruderste.in anymore and author doesn't respond, so i would appreciate if you can do it. And thank you for your work to migrate old version to x64 and Appveyor, it was usable for my version.

timea-techgirl commented 5 years ago

Is this the cause of plugin not working in latest npp?

chcg commented 5 years ago

@timeakesmarky Latest N++ is which version 7.7? In this case the underlying version of scintilla changed from 3.5.6 -> 4.1.4 and something might be needed to be adapted within this plugin.

Hsilgos commented 5 years ago

@timeakesmarky , I checked it on Notepad++ 7.7 x64 and it works. I haven't found changes in latest Scintilla which could break plugin. Could you describe:

  1. your environment: OS (including architecture x86/x64), Notepad++ version (including architecture x86/x64)
  2. What are you trying to do
  3. Expected behavior
  4. Actual behavior
timea-techgirl commented 5 years ago

Yes, v7.7 x64. The plugin didn't work for me even in 7.6.4 which I previously had. I just updated to test it. It has worked for me magically at rare occasions but 99 percent of the times, it doesn't.

OS Info: I'm running Windows 10 LTSC 2019 x64, Notepad++ v7.7 x64.

What I did: I get the administrator prompt when I press Ctrl + S and when I click "Yes", I get this: The file cannot be saved and it may be protected. Do you want to launch Notepad++ in Administrator mode?

Expected Behaviour: The file must get saved instead of failing. I just tried it on hosts file and got the same error.

Hsilgos commented 5 years ago

@timeakesmarky , it looks like plugin works (because the administration prompt appears), but permissions which are granted are not enough... Could you answer next few questions?

  1. How many users with administration permissions are registered on your computer?
  2. Is Notepad++ able to save the same file if you run it in Administration mode as it asks?
  3. Where are you trying to save file? Is it some system folder? Or just protected?

I think I can add option to choose user account to save file with if it can help, but firstly I need to understand problem.

timea-techgirl commented 5 years ago

Oh I see. I'm the administrator and my account has admin privileges. It's my personal computer. And there's one non-admin user account.

Yes, notepad++ saves it fine when it runs in admin mode.

I'm trying to save with Ctrl + S, so it's the same location as the file. For example, hosts file in system32/drivers/etc/hosts

timea-techgirl commented 5 years ago

@Hsilgos One thing, my notepad++ is portable and I have it unpacked on D drive and I use it with a desktop shortcut.

dinkumoil commented 5 years ago

I was facing the same problem when I updated to NppSaveAsAdmin v1.0.172. The reason was my AV software (Avira Anti Virus Free). It blocked the temporary DLL file the plugin creates in the %TEMP% folder and even remembered this for the whole remaining Windows session. I had to reboot and deactivate Avira to be able to use the plugin.

Thus, I reverted to NppSaveAsAdmin v1.0.0.3 from >>> the old SourceForge repo <<<.

I guess at the time when I've tried NppSaveAsAdmin v1.0.172, Avira had white-listed the old plugin version but not the new one. This was more than half a year ago, I don't know the current state of white-listing. I still use v1.0.0.3 and it works fine (Windows 7 x64 and Windows 10 Prof. v1809 x64, Notepad++ v7.5.6 x86).

timea-techgirl commented 5 years ago

Yes, I thought so too. Disabling kaspersky fixed the issue. I will try adding the plugin to kaspersky exceptions and see if it works.

timea-techgirl commented 5 years ago

Oh, I see I have already added it to exclusions but it's running from temp directory which is the cause of the issue.

Now I added the temp location and issue fixed.

@Hsilgos If it's possible, let the exe be extracted to the same directory.

Hsilgos commented 5 years ago

@timeakesmarky , @dinkumoil Great that issue is detected, thank you both for investigation. I should figure out how to solve it. Yes, it's possible to run app from the same folder if it's not protected itself. The app can be even unpacked there already at installation time. I wanted to avoid that because of some security thoughts, but i guess that i can protect it differently (it's even necessary to do this).

dinkumoil commented 5 years ago

@timeakesmarky

I would highly recommend to remove your %TEMP% folder from Kaspersky's exception list. Malware uses this folder as well. Better try to use the old plugin version (see link in my posting above) as long as @Hsilgos hasn't provided another fix.

timea-techgirl commented 5 years ago

@dinkumoil Oh yes, I know. I have just added the NppAdminAccess.exe file to the exclusions, not the temp directory itself. :)

Hsilgos commented 5 years ago

@timeakesmarky , @dinkumoil , I prepared version with static file, may be it will keep antiviruses calm. You can try it, I didn't publish it in plugin manager yet: https://github.com/Hsilgos/nppsaveasadmin/releases/tag/1.0.190

timea-techgirl commented 5 years ago

Thanks, works without adding the temp file name to exclusions. But still not friendly with antivirus. Tried removing notepad folder from exclusions and save fails.

dinkumoil commented 5 years ago

I didn't install the updated plugin (because v1.0.0.3 works fine for me) but I checked NppAdminAccess.exe and NppSaveAsAdmin.dll with Avira - no warning, considered to be clean.

timea-techgirl commented 5 years ago

Kaspersky reports it clean as well but it still interferes in the job and fails the save. I have reported the file as false-positive. If an agent answers me, I'll get the problem solved.

Hsilgos commented 5 years ago

@timeakesmarky , has agent answered you? @dinkumoil , There is a good reason to use new version: it supports "Save as..." operation. Old one doesn't.

timea-techgirl commented 5 years ago

Oh no, I didn't get any answer. I just reported it again. If I don't get an answer, I'll contact customer support.

dinkumoil commented 5 years ago

@Hsilgos

I have tested NppSaveAsAdmin v1.0.195 with Notepad++ v7.5.6 and Avira Antivirus. It worked very well, no malware warning.

Thank you for supporting Save as operation, very useful feature.

BTW: The initial reason why I've opened this issue (changes in plugin ZIP file structure required) no longer exists. I think you could close this issue.

timea-techgirl commented 5 years ago

@Hsilgos I contacted Kaspersky personally about this and they told me to add it to exclusions. I insisted that Kaspersky shouldn't block clean files from working without even notifying. The file is clean in a scan, it just doesn't save. They've taken my request.

Now the issue can be closed. :) Thanks for your contribution and kindness. :)