Use IntPtr(-1) for INVALID_HANDLE_VALUE instead of IntPtr.Zero (#3544)
- Fix incorrect handling of 'GetCurrentProcess()' API return value in 'IsWow64()' function (MainEntry.cpp) - Remove unused INVALID_HANDLE_VALUE field from 'ProcessNativeMethods' class (Process.cs)
This commit is contained in:
parent
4ad4b194fc
commit
47ec6b2a86
|
@ -2608,7 +2608,6 @@ namespace Microsoft.PowerShell.Commands
|
|||
internal static class ProcessNativeMethods
|
||||
{
|
||||
// Fields
|
||||
internal static readonly IntPtr INVALID_HANDLE_VALUE = IntPtr.Zero;
|
||||
internal static UInt32 GENERIC_READ = 0x80000000;
|
||||
internal static UInt32 GENERIC_WRITE = 0x40000000;
|
||||
internal static UInt32 FILE_ATTRIBUTE_NORMAL = 0x80000000;
|
||||
|
|
|
@ -558,7 +558,7 @@ namespace System.Management.Automation
|
|||
#if !UNIX
|
||||
|
||||
// Fields
|
||||
internal static readonly IntPtr INVALID_HANDLE_VALUE = IntPtr.Zero;
|
||||
internal static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
|
||||
internal static UInt32 GENERIC_READ = 0x80000000;
|
||||
internal static UInt32 GENERIC_WRITE = 0x40000000;
|
||||
internal static UInt32 FILE_ATTRIBUTE_NORMAL = 0x80000000;
|
||||
|
|
|
@ -1139,11 +1139,6 @@ BOOL IsWow64()
|
|||
{
|
||||
HANDLE hCurrentProc = GetCurrentProcess();
|
||||
|
||||
if (INVALID_HANDLE_VALUE == hCurrentProc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL isWow64Process = FALSE;
|
||||
BOOL ret = IsWow64Process(hCurrentProc, &isWow64Process);
|
||||
|
||||
|
@ -1152,7 +1147,7 @@ BOOL IsWow64()
|
|||
return isWow64Process;
|
||||
}
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
|
Loading…
Reference in a new issue