Open ffalcinelli opened 8 years ago
Since pip
has the sole purpose to manage python package, the task to stop service in an uninstall hook is something would never be managed by pip
itself, and should not even if an hacky way was available.
So, I think the best solution right now would be to demand this duty to the application or to the developer wanting to uninstall:
Windivert.unregister()
before it quitsMaybe this needs to be reported in documentation, or readme
Yes, that should certainly be part of the PyDivert README/docs. This seems to be an issue in the WinDivert documentation as well:
To uninstall, simply delete the WinDivert.dll, WinDivert32.sys, and WinDivert64.sys files. If already running, the WinDivert driver will be automatically uninstalled during the next machine reboot.
@basil00, can you shed some light on this? :blush:
The uninstaller should not stop the driver since other unrelated WinDivert applications may still be using it.
I was unable to reproduce the problem -- I tried deleting the .sys
files that were still in use, and it worked as expected (tested with Win7, WinDivert1.2, and admin privileges). That is, the files were gone and the WinDivert service was still running.
Thanks for the super fast reply, @basil00! I can reproduce the issue with WinDivert 1.1 and Windows 10. What system are you on, @ffalcinelli?
I'm on Windows 10 too, and maybe it's related to it. This evening I'll be back and I'll try on a Windows 7 virtual machine and let you know.
I've not modified the readme nor documentation since the intended behaviour is as @basil00 stated.
Thank you both :wink:
Well seems like on a Windows 7 x86 virtual machine it works fine.
What I find really weird:
pip
so it will move the package in that folder and only after everything is fine pip
will actually remove files (but we get the error on W10)pip install pydivert
again, use the the binding and then pip uninstall pydivert
for the second time, it's all fine.So is this a Win10 issue, or a python+Win10 issue? (I do not have a Win10 test box handy)
This is a Windows 10 issue, unrelated of Python. I cannot delete WinDivert64.sys
as long as WinDivert 1.1.8 is running. "access denied" -> sc stop
-> "success"
In that case it appears that Windows has changed its semantics regarding deleting .sys
files that are currently running. This complicates the WinDivert uninstall process, since as mentioned earlier, stopping the WinDivert service is not correct either. Probably "delete-on-reboot" is needed.
Seems like driver needs to be unregistered before uninstalling the binding.
SYS files are still in use by the Windows Kernel, and trying to remove them results in an Access Denied error (WinError 5).
To delete those files, we must stop the service before using
pip
The WinDivert documentation states that is possible to remove SYS and DLL files and driver will be uninstalled at next reboot, or manually by typing