| 

.NET C# Java Javascript Exception

4
Die Ausführung der 32-Bit-Anwendungen erfolgt systemintern über das Subsystem WOW64 (Microsoft Windows-32-on-Windows-64), das in allen 64-Bit-Varianten von Windows enthalten ist. Wie ermittle ich bei einem bereits ausgeführten Prozess, ob dieser im 32-Bit
19.04.2011
Markus Streibl 41 1 2
2 Antworten
7
MSDN: IsWow64Process

Beispiel von pinvoke.net:

[DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsWow64Process(
[In] Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid hProcess,
[Out, MarshalAs(UnmanagedType.Bool)] out bool wow64Process
);
[DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsWow64Process([In] IntPtr processHandle,
[Out, MarshalAs(UnmanagedType.Bool)] out bool wow64Process);

//...

isWow64 = false;
if ((System.Environment.OSVersion.Version.Major == 5 && System.Environment.OSVersion.Version.Minor >= 1) ||
System.Environment.OSVersion.Version.Major > 5)
{
SafeProcessHandle processHandle = GetProcessHandle((uint)System.Diagnostics.Process.GetCurrentProcess().Id);
bool retVal;
if (!NativeMethods.IsWow64Process(processHandle, out retVal))
{
throw new Win32Exception(Marshal.GetLastWin32Error());
}
isWow64 = retVal;
}
19.04.2011
Floyd 14,6k 3 9
Floyd 14,6k 3 9
0
Oder unter .NET 4, wenn ich das richtig verstanden habe.

Environment.Is64BitProcess
19.04.2011
GENiALi 2,5k 1 2 8
Leider nein, er will wissen ob ein anderer Process als 32Bit ausgeführt wird oder nicht. Wenn ich das richtig verstanden haben.
Floyd 20.04.2011
OK. Mal schauen was wir da richtig verstanden haben. :-)
GENiALi 20.04.2011

Stelle deine .net-Frage jetzt!
TOP TECHNOLOGIES CONSULTING GmbH