-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Description
INVALID_HANDLE_VALUE
should be defined as IntPtr(-1)
and not as IntPtr.Zero
(It is declared as ((HANDLE)-1)
in Windows SDK headers).
-
In PlatformInvokes.cs file, it is declared as
IntPtr.Zero
. This value is used in SSHConnectionInfo.GetNamedPipeHandle(string pipeName) method, and, if for some reason,CreateFile
fails, it will be unable to detect error condition. Attempt to use invalid named pipe handle will certainly not go well. -
In Process.cs file, it is declared as
IntPtr.Zero
. Fortunately, this value is not used anywhere else, but, nonetheless, it is invalid. -
In MainEntry.cpp file, in
IsWow64()
function, a pseudo-handle returned fromGetCurrentProcess()
Win32 API function is compared toINVALID_HANDLE_VALUE
. This time value is correct, but its usage is incorrect, becauseGetCurrentProcess()
pseudo-handle is exactly same as value ofINVALID_HANDLE_VALUE
: both are((HANDLE)-1)
. Because of thisIsWow64()
function always returnsFALSE
.IsWow64()
function is used to decide correct file paths of Start Menu shortcuts for PowerShell and PowerShell ISE. Since FullCLR build is not supported currently, I can't verify this, but, just by reading code, it seems that shortcut targets will be messed up.
Environment data
> $PSVersionTable
Name Value
---- -----
SerializationVersion 1.1.0.1
PSVersion 6.0.0-alpha
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSEdition Core
BuildVersion 3.0.0.0
CLRVersion
GitCommitId v6.0.0-alpha.18-9-g8d4db01a5d4b5dcd981ef216d3d7f24b484c7c60-dirty
PSRemotingProtocolVersion 2.3
WSManStackVersion 3.0