Hola que tal con todos, he aqui tengo un problema, al compilar mi injector en delphi xe , me da los siguientes errores :
"E2033 Types of actual and formal var parameters must be identical"
En versiones anteriores si compila y funciona perfectamente el codigo.
PD :Aca les dejo el codigo con el cual tengo error al compilarlo en delphi xe !
Código Delphi
[-] function processName(exeFileName: string): string;
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
ProcessID : Cardinal;
ProcessHandle : Cardinal;
ModuleHandles : array[0..256] of DWORD;
nBytes : Cardinal;
ModuleName :array[0..259] of Char;
begin
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
Result := '';
while Integer(ContinueLoop) <> 0 do
begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
UpperCase(ExeFileName))) then
begin
ProcessID := FProcessEntry32.th32ProcessID;
ProcessHandle := OpenProcess(PROCESS_ALL_ACCESS, TRUE, ProcessID);
EnumProcessModules(ProcessHandle, @ModuleHandles, 256 * 4, nBytes);
GetModuleFileNameEx(ProcessHandle, ModuleHandles[0], ModuleName, 256);
result := string(ModuleName);
end;
ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;
function RandomPassword(PLen: Integer): string;
var
str: string;
begin
Randomize;
str := '1234567890QWERTYUIOP{}ASDFGHJKLZXCVBNM<>?abcdefghijklmnopqrstuvwxyz-@#&$@&!(';
Result := '';
repeat
Result := Result + str[Random(Length(str)) + 1];
until (Length(Result) = PLen)
end;
function ProcessExists(FProcess: string): Boolean;
const
PROCESS_TERMINATE = $0001;
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
Result := False;
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
while Integer(ContinueLoop) <> 0 do
begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(FProcess))
or (UpperCase(FProcessEntry32.szExeFile) = UpperCase(FProcess)))
then
begin
Result := True;
Break;
end;
ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;
function ModulInjectByDen(ModulePath: PAnsiChar; ProcessID: DWORD): Boolean;
var
hSnapshot: THandle;
ModuleEntry32: TModuleEntry32;
begin
Result := False;
hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, ProcessID);
if (hSnapshot <> -1) then
begin
ModuleEntry32.dwSize := SizeOf(TModuleEntry32);
if (Module32First(hSnapshot, ModuleEntry32)) then
repeat
if string(ModuleEntry32.szExePath) = string(ModulePath) then
begin
Result := True;
Break;
end;
until
not Module32Next(hSnapshot, ModuleEntry32);
CloseHandle(hSnapshot);
end;
end;
function GetOSVersion: Cardinal;
var
OSVersionInfo: TOSVersionInfo;
begin
Result := 0;
FillChar(OSVersionInfo, Sizeof(OSVersionInfo), 0);
OSVersionInfo.dwOSVersionInfoSize := SizeOf(OSVersionInfo);
if GetVersionEx(OSVersionInfo) then
begin
if OSVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_NT then
begin
if OSVersionInfo.dwMajorVersion = 5 then
begin
if OSVersionInfo.dwMinorVersion = 0 then
Result := 50 else if OSVersionInfo.dwMinorVersion = 2 then
Result := 52 else if OSVersionInfo.dwMinorVersion = 1 then
Result := 51 end;
if OSVersionInfo.dwMajorVersion = 6 then
begin
if OSVersionInfo.dwMinorVersion = 0 then
Result := 60 else if OSVersionInfo.dwMinorVersion = 1 then
Result := 61; end;
end;
end;
end;
function InjectIDMetod(ModulePath: PAnsiChar; ProcessID: DWORD): Boolean;
type
TNtCreateThreadEx = function(
ThreadHandle: PHANDLE;
DesiredAccess: ACCESS_MASK;
ObjectAttributes: Pointer;
ProcessHandle: THANDLE;
lpStartAddress: Pointer;
lpParameter: Pointer;
CreateSuspended: BOOL;
dwStackSize: DWORD;
Unknown1: Pointer;
Unknown2: Pointer;
Unknown3: Pointer): HRESULT; stdcall;
var
lpStartAddress, lpParameter: Pointer;
dwSize: Integer;
hProcess, hThread, lpThreadId, lpExitCode, lpBytesWritten: Cardinal;
NtCreateThreadEx: TNtCreateThreadEx;
begin
Result := False;
if ModulInjectByDen(ModulePath, ProcessID) = True then
Exit;
hProcess := 0;
hProcess := OpenProcess(MAXIMUM_ALLOWED, False, ProcessID);
if hProcess = 0 then
Exit;
dwSize := StrLen(ModulePath) + 1;
lpParameter := VirtualAllocEx(hProcess, nil, dwSize, MEM_COMMIT, PAGE_READWRITE);
if (lpParameter = nil) then
begin
if hProcess <> 0 then
CloseHandle(hProcess);
Exit;
end;
if GetOSVersion >= 60 then
NtCreateThreadEx := GetProcAddress(GetModuleHandleW('ntdll'), 'NtCreateThreadEx');
lpStartAddress := GetProcAddress(GetModuleHandleW('kernel32'), 'LoadLibraryA');
if (lpStartAddress = nil) then
Exit;
if GetOSVersion >= 60 then
if (@NtCreateThreadEx = nil) then
Exit;
lpBytesWritten := 0;
if (WriteProcessMemory(hProcess, lpParameter, ModulePath, dwSize, lpBytesWritten) = False) then
begin
VirtualFreeEx(hProcess, lpParameter, 0, MEM_RELEASE);
if hProcess <> 0 then
CloseHandle(hProcess);
Exit;
end;
hThread := 0;
lpThreadId := 0;
if GetOSVersion >= 60 then
NtCreateThreadEx(@hThread, MAXIMUM_ALLOWED, nil, hProcess, lpStartAddress, lpParameter, false, 0, 0, 0, 0)
else
hThread := CreateRemoteThread(hProcess, nil, 0, lpStartAddress, lpParameter, 0, lpThreadId);
if (hThread = 0) then
begin
VirtualFreeEx(hProcess, lpParameter, 0, MEM_RELEASE);
CloseHandle(hProcess);
Exit;
end;
GetExitCodeThread(hThread, lpExitCode);
if hProcess <> 0 then
CloseHandle(hProcess);
if hThread <> 0 then
CloseHandle(hThread);
Result := True;
end;
Espero que puedan ayudarme, muchas gracias , saludos
