win-app
win-app copied to clipboard
Replace SetDefaultDllDirectories call with Assembly attribute
Currently ProtonVPN.Service sets the DLL import search path to LOAD_LIBRARY_SEARCH_DEFAULT_DIRS using a P/Invoke call to kernel32.dll. I believe the intention is to prevent DLLs being loaded from PATH?
In that case, it is possible to do this with an Assembly attribute instead:
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)]
This should be identical in behaviour, since SafeDirectories and LOAD_LIBRARY_SEARCH_DEFAULT_DIRS both have the value 0x1000.
The ProtonVPN.Native module becomes redundant this way, since it only contained the P/Invoke binding. Therefore I have removed it.