Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: sfx/level2/main.pas
- ===================================================================
- --- sfx/level2/main.pas (wersja 1134)
- +++ sfx/level2/main.pas (kopia robocza)
- @@ -5,12 +5,58 @@
- interface
- uses
- - windows, Classes, SysUtils, zstream;
- + jwawindows, windows, Classes, SysUtils, zstream;
- procedure launch;
- implementation
- +function GetParentProcessFileName(PID : THandle): String;
- +var
- + HandleSnapShot : THandle;
- + EntryParentProc : TProcessEntry32;
- + HandleParentProc : THandle;
- + ParentPID : THandle;
- + ParentProcessFound : Boolean;
- + ParentProcPath : PChar;
- +begin
- + ParentProcessFound := False;
- + HandleSnapShot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
- + GetMem(ParentProcPath, MAX_PATH);
- + try
- + if HandleSnapShot <> INVALID_HANDLE_VALUE then
- + begin
- + EntryParentProc.dwSize := SizeOf(EntryParentProc);
- + if Process32First(HandleSnapShot, EntryParentProc) then
- + begin
- + repeat
- + if EntryParentProc.th32ProcessID = PID then
- + begin
- + ParentPID := EntryParentProc.th32ParentProcessID;
- + HandleParentProc := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False,ParentPID);
- + ParentProcessFound:= HandleParentProc <> 0;
- + if ParentProcessFound then
- + begin
- + GetModuleFileNameEx(HandleParentProc, 0, ParentProcPath, MAX_PATH);
- + CloseHandle(HandleParentProc);
- + end;
- + break;
- + end;
- + until not Process32Next(HandleSnapShot, EntryParentProc);
- + end;
- + CloseHandle(HandleSnapShot);
- + end;
- +
- + if ParentProcessFound then
- + Result := ParentProcPath
- + else
- + Result := ''; //not found
- + finally
- + FreeMem(ParentProcPath);
- + end;
- +end;
- +
- +
- function DeleteFolder(dir: string) : boolean;
- var
- DirInfo: TSearchRec;
- @@ -72,7 +118,16 @@
- filelist:=TStringList.create;
- + filename:=StringReplace(GetParentProcessFileName(GetCurrentProcessID),
- + ExtractFileName(GetModuleName(0)),'',[]);
- + if Length(filename)>0 then
- + begin
- + outfile:=tfilestream.Create(launchdir+'TrainerRealPath.txt', fmCreate);
- + outfile.Write(filename[1],Length(filename));
- + outfile.free;
- + end;
- +
- if FileExists(archivename) then
- begin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement