http://stackoverflow.com/questions/336633/how-to-detect-windows-64-bit-platform-with-net
IntPtr.Size won't return the correct value if running in 32-bit .NET Framework 2.0 on 64-bit Windows (it would return 32-bit).
As Microsoft's Raymond Chen describes, you have to first check if running in a 64-bit process (I think in .NET you can do so by checking IntPtr.Size), and if you are running in a 32-bit process, you still have to call the Win API function IsWow64Process. If
this returns true, you are running in a 32-bit process on 64-bit Windows.
Microsoft's Raymond Chen:How
to detect programmatically whether you are running on 64-bit Windows
My solution:
bool is64BitProcess = (IntPtr.Size == 8);
bool is64BitOperatingSystem = is64BitProcess || InternalCheckIsWow64();
[DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool IsWow64Process(
[In] IntPtr hProcess,
[Out] out bool wow64Process
);
public static bool InternalCheckIsWow64()
{
if ((Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1) ||
Environment.OSVersion.Version.Major >= 6)
{
using (Process p = Process.GetCurrentProcess())
{
bool retVal;
if (!IsWow64Process(p.Handle, out retVal))
{
return false;
}
return retVal;
}
}
else
{
return false;
}
}
分享到:
相关推荐
HOW TO DETECT OPEN PORTS, PROTOCOLS AND SERVICES
Learning to Detect Video Saliency With HEVC Features[J]. Image Processing, IEEE Transactions on, 2017, 26(1):369-385. 文献级别 提交SCI 提交EI 提交ISTP 提交1A 提交1B 提交其它 文献价值 提交最高 提交高...
This research papers shows how to detect and track an object
He has contributed to several other Syngress publications, including Penetration Tester's Open Source Toolkit (ISBN: 1-5974490210), Stealing the Network: How to Own an Identity (ISBN: 1597490067), ...
Chapter 1, Introduction, discusses the concept of shellcode, buffer...Chapter 12, Detection and Prevention, discusses the techniques and algorithms you need to detect and prevent buffer overflow attacks.
You will understand how you can now develop on and deploy to Windows, Mac OS X, and Linux using cross-platform tools, such as Visual Studio Code. Style and approach Starting with a drill down into ...
国外研究成果,主要是描述RFID相关的攻击技术等。对于理论研究很有帮助。
ssd_detect.ipynb可用版,可用于ssd下检测单张图片,放在example/之下
This is a complete guide to programming AI-powered mixed reality apps with the Windows Mixed Reality platform. Step by step, Dawid Borycki guides you through every type of mixed reality development, ...
Chapter 4, Detecting and Tracking Different Body Parts, shows how to detect and track faces in a live video stream. We will discuss the face detection pipeline and see how we can use it to detect and...
Sample04-Winforms: How to use OpenCVSharp in a WindowsForms application. Sample05: How to use OpenCVSharp in a WPF application. Sample06: How to use VideoCapture and WebCams. Sample07: How to access ...
Sample04-Winforms: How to use OpenCVSharp in a WindowsForms application. Sample05: How to use OpenCVSharp in a WPF application. Sample06: How to use VideoCapture and WebCams. Sample07: How to access ...
经典的图像显著性的一篇文章 很有要下载来学习
Sample04-Winforms: How to use OpenCVSharp in a WindowsForms application. Sample05: How to use OpenCVSharp in a WPF application. Sample06: How to use VideoCapture and WebCams. Sample07: How to access ...
- Get to grips with the practicality of the new changes with .NET 4.5, such as improving communications with WCF and Visual Studio 2012 - Detect duplicate code and develop Portable Class Libraries ...
How Web Forms Differ from Windows Forms 464 Why Web Forms Are Better Than Classic ASP 465 Adding Controls to Web Forms 467 Exercise 10.2 Adding Web Controls to a Web Form 468 Code Behind 473 NOTE...
Offers an introduction to computer vision, with enough theory to make clear how the various algorithms work but with an emphasis on practical programming issues Provides enough material for a one ...
Using Modernizr to detect HTML5 and CSS3 browser support
It will also help you learn how to use Haar cascades for tracking faces and to detect foreground and background regions with the help of a Kinect device. It will even give you insights into server-...
Find out how to write Kotlin code without overhead and how to use different profiling tools and bytecode viewer to inspect expressions of Kotlin language. Key Features Learn memory optimization, ...