Einzelnen Beitrag anzeigen

gore

Registriert seit: 9. Jun 2006
Ort: Magdeburg
29 Beiträge
 
Delphi 7 Professional
 
#23

AW: Windows 7 64Bit Redirection

  Alt 15. Nov 2010, 12:47
64Bit Redirection? Wieso immer gleich mit Kanonen auf Spatzen schießen? Die erste Antwort von jfheins ist Microsoft konform.

Zitat:
32-bit applications can access the native system directory by substituting %windir%\Sysnative for %windir%\System32. WOW64 recognizes Sysnative as a special alias used to indicate that the file system should not redirect the access. This mechanism is flexible and easy to use, therefore, it is the recommended mechanism to bypass file system redirection. Note that 64-bit applications cannot use the Sysnative alias as it is a virtual directory not a real one.

Solange man mit Delphi keine 64bit Programme erzeugen kann, reicht folgendes:
  if IsProcess32OnWin64(GetCurrentProcess) then Exe:='%WinDir%\Sysnative\osk.exeelse Exe:='%WinDir%\system32\osk.exe';

IsProcess32OnWin64 ist gleichbedeutend mit Deiner Is64BitViaRegistry (und ist auch Microsoft konform).
Delphi-Quellcode:
function IsProcess32OnWin64(ProcessHandle:THandle):boolean;
type
  TIsWow64Process = function(Handle: THandle; var Res: BOOL): BOOL; stdcall; // Type of IsWow64Process API fn
var
  IsWow64Result: BOOL; // Result from IsWow64Process
  IsWow64Process: TIsWow64Process; // IsWow64Process fn reference
begin
  result:=false;
  IsWow64Process := GetProcAddress( GetModuleHandle('kernel32.dll'), 'IsWow64Process' );
  if Assigned(IsWow64Process) then begin
    if IsWow64Process(ProcessHandle,IsWow64Result) AND IsWow64Result then result:=true;
  end; // google: Running 32-bit Applications (Windows)
end;

function IsProcess64bit(ProcessHandle:THandle):boolean;
begin
  result:= IsWin64bit AND not IsProcess32OnWin64(ProcessHandle);
end;
  Mit Zitat antworten Zitat