Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use Reflector to look how it is implemented in FW 4.0:</p> <pre><code>[DllImport("kernel32.dll", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)] private static extern IntPtr GetProcAddress(IntPtr hModule, string methodName); [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail), DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)] private static extern IntPtr GetModuleHandle(string moduleName); [DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)] internal static extern IntPtr GetCurrentProcess(); [SecurityCritical] internal static bool DoesWin32MethodExist(string moduleName, string methodName) { IntPtr moduleHandle = GetModuleHandle(moduleName); if (moduleHandle == IntPtr.Zero) { return false; } return (GetProcAddress(moduleHandle, methodName) != IntPtr.Zero); } [return: MarshalAs(UnmanagedType.Bool)] [DllImport("kernel32.dll", SetLastError=true)] internal static extern bool IsWow64Process([In] IntPtr hSourceProcessHandle, [MarshalAs(UnmanagedType.Bool)] out bool isWow64); [SecuritySafeCritical] public static bool get_Is64BitOperatingSystem() { bool flag; return (IntPtr.Size == 8) || ((DoesWin32MethodExist("kernel32.dll", "IsWow64Process") &amp;&amp; IsWow64Process(GetCurrentProcess(), out flag)) &amp;&amp; flag); } </code></pre> <p>It checks if <code>IsWow64Process()</code> function exists, and calls it.</p> <p><strong>Update:</strong> added all functions used by <code>get_Is64BitOperatingSystem()</code></p> <p><strong>Update2:</strong> fixed for 64-bit process</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload