Ver Mensaje Individual
  #3  
Antiguo 21-09-2015
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.210
Reputación: 22
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Si te interesa saber si un proceso de 16 bits se ejecuta, sigue este hilo en C/C++.

En delphi:
Código Delphi [-]
function VDMEnumTaskWOWEx(dwProcessId: DWORD; fp: pointer; lparam: integer): integer; stdcall; external 'VdmDbg.dll' name 'VDMEnumTaskWOWEx';
function VDMEnumProcessWOW(fp: pointer; lparam: integer): integer; stdcall; external 'VdmDbg.dll' name 'VDMEnumProcessWOW';

type
TRuningProcess16 = record
  Name: Pchar;
  Running: boolean;
end;
PTRuningProcess16 = ^TRuningProcess16;


// Enumera procesos
function ProcessTasks(dwThreadId: DWORD; hMod16, hTask16: WORD; pszModName, pszFileName: PCHAR; PE: integer): boolean; stdcall;
begin
   if AnsiContainsText(pszFileName, PTRuningProcess16(PE).Name) then
   begin
      PTRuningProcess16(PE).Running:= true;
      Result:= true;
      exit;
   end;
   Result:= false;
end;

// Enumera Máquinas Virtuales
function ProcessVDMs(dwProcessId, dwAttrib: DWORD; PE: integer): boolean; stdcall;
begin
   VDMEnumTaskWOWEx(dwProcessId, @ProcessTasks, PE);
   Result:= PTRuningProcess16(PE).Running;
end;

function IsRunning16_(Name: string): boolean;
var
  PE: TRuningProcess16;
begin
  PE.Name:= PCHAR(Name);
  PE.Running:= false;

  // Buscando...
  VDMEnumProcessWOW(@ProcessVDMs, integer(@PE));
  Result:= PE.Running;
end;

Combinar una llamada al código de ecfisa, con otra a sRunning16_:

Código Delphi [-]
IsRunin16_32(ExeFileName: String): BOOL;
begin
  Result:= IsAppRunning(ExeFileName) or IsRunning16_(ExeFileName);
end;

Saludos.
Responder Con Cita