[Bug 45118] New: Microsoft Windows PowerShell 6.x reports ' PowerShell Gallery is currently unavailable.' ( WinHttpSetOption returns incorrect lasterror on unsupported options)
wine-bugs at winehq.org
wine-bugs at winehq.org
Wed May 2 17:06:57 CDT 2018
https://bugs.winehq.org/show_bug.cgi?id=45118
Bug ID: 45118
Summary: Microsoft Windows PowerShell 6.x reports 'PowerShell
Gallery is currently unavailable.' (WinHttpSetOption
returns incorrect lasterror on unsupported options)
Product: Wine
Version: 3.7
Hardware: x86-64
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: winhttp
Assignee: wine-bugs at winehq.org
Reporter: focht at gmx.net
Distribution: ---
Hello folks,
as it says.
Prerequisites:
* 32-bit WINEPREFIX
* .NET Framework 4.5 -> 'winetricks -q dotnet45'
* PowerShell 6.0 unpack to: 'c:\\Program Files\\PowerShell' (no install)
https://github.com/PowerShell/PowerShell/releases/download/v6.0.0/PowerShell-6.0.0-win-x86.zip
Start PowerShell.
NOTE: PowerShell relies on extended CUI functionality (screen buffer) it needs
to be run with with 'wineconsole' which provides this. A bare console can't
work by design here.
--- snip ---
$ pwd
/home/focht/.wine/drive_c/Program Files/PowerShell
$ wineconsole ./pwsh.exe
...
--- snip ---
Register PowerShell Gallery repo:
--- snip ---
PS C:\Program Files\PowerShell> Register-PSRepository -Name PSGallery
-SourceLocation https://www.powershellgallery.com/api/v2/
-PackageManagementProvider NuGet -PublishLocation https://
www.powershellgallery.com/api/v2/package/ -ScriptSourceLocation
https://www.powershellgallery.com/api/v2/items/psscript/ -ScriptPublishLocation
https://www.powershellgallery.com/api/v2/p
ackage/
Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable.
Please try again later.
At C:\Program Files\PowerShell\Modules\PowerShellGet\1.6.0\PSModule.psm1:4515
char:9
+ Get-PSGalleryApiAvailability -Repository $Name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-PSGalleryApiAvailability],
InvalidOperationException
+ FullyQualifiedErrorId :
PowerShellGalleryUnavailable,Get-PSGalleryApiAvailability
Register-PSRepository : Use 'Register-PSRepository -Default' to register the
PSGallery repository.
At line:1 char:1
+ Register-PSRepository -Name PSGallery -SourceLocation https://www.pow ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (PSGallery:String)
[Register-PSRepository], ArgumentException
+ FullyQualifiedErrorId :
UseDefaultParameterSetOnRegisterPSRepository,Register-PSRepository
--- snip ---
Relevant part of MS .NET Core Framework reference impl.:
https://github.com/dotnet/corefx/blob/71cc1ae8ba02b7b71878cb69a50c667c8ed0f50f/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs
--- snip ---
...
uint optionAssuredNonBlockingTrue = 1; // TRUE
if (!Interop.WinHttp.WinHttpSetOption(
sessionHandle,
Interop.WinHttp.WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS,
ref optionAssuredNonBlockingTrue,
(uint)sizeof(uint)))
{
// This option is not available on downlevel Windows versions. While it
improves
// performance, we can ignore the error that the option is not
available.
int lastError = Marshal.GetLastWin32Error();
if (lastError != Interop.WinHttp.ERROR_WINHTTP_INVALID_OPTION)
{
throw WinHttpException.CreateExceptionUsingError(lastError,
nameof(Interop.WinHttp.WinHttpSetOption));
}
}
...
--- snip ---
-> relies on lasterror being 'ERROR_WINHTTP_INVALID_OPTION', otherwise throws
managed CLR exception.
https://github.com/dotnet/corefx/blob/71cc1ae8ba02b7b71878cb69a50c667c8ed0f50f/src/Common/src/Interop/Windows/winhttp/Interop.winhttp_types.cs#L19
--- snip ---
public const uint ERROR_WINHTTP_INVALID_OPTION = 12009;
--- snip ---
https://github.com/dotnet/corefx/blob/71cc1ae8ba02b7b71878cb69a50c667c8ed0f50f/src/Common/src/Interop/Windows/winhttp/Interop.winhttp_types.cs#L151
--- snip ---
public const uint WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS = 111;
--- snip ---
You can use the definitions there to advance Wine's WINHTTP_LAST_OPTION
further, matching all the MSDN option flags:
https://msdn.microsoft.com/de-de/library/windows/desktop/aa384066(v=vs.85).aspx
Wine source:
https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/winhttp/session.c#l892
--- snip ---
892 static BOOL request_set_option( object_header_t *hdr, DWORD option, LPVOID
buffer, DWORD buflen )
893 {
894 request_t *request = (request_t *)hdr;
895
896 switch (option)
897 {
...
1025 default:
1026 FIXME("unimplemented option %u\n", option);
1027 set_last_error( ERROR_INVALID_PARAMETER );
1028 return TRUE;
1029 }
1030 }
--- snip ---
$ wine --version
wine-3.7-31-gdbce559df6
Regards
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list