Quantcast

Jump to content

» «
Photo

EXE FEATURES AND EDITING

  • This topic is locked This topic is locked
105 replies to this topic
Hammer83
  • Hammer83

    Hustler

  • Members
  • Joined: 11 Jan 2003

#31

Posted 26 March 2004 - 02:50 AM

Save managing is avoidable, but some other things proposed here require EXE editing, or at least memory hacking a-la MTA. I think the way I did it (not supplying the modified exe, but using a launcher that patches EXE for the duration of the program) is good enough. Also, there is less chance of saves getting messed up, because neither EXE, nor launcher ever touches Vice City User Files folder. If you try to manage the files before and after the execution of vice city and in the middle the computer reboots, the data will be inconsistent.

JasonB
  • JasonB

    GTA-SA/GTA-VC/GTA3 Modder Extraordinaire

  • Members
  • Joined: 24 Aug 2002
  • None

#32

Posted 26 March 2004 - 04:44 AM Edited by JasonB, 29 March 2004 - 05:58 AM.

Update on my program (geez how many are there, smithers, hammers and mine):
im smoothing out a few bugs and should have the first version of it out today (not with all the features)
EDIT:
Well obviously i didnt release it, due to major problems. Rather than renaming folders i decided to take Hammers approach and do a quick change to the EXE, simple enough. ANd after the changes are made it closes the file and runs it. The Problem: the game is invisible ie its not in the taskbar and you cant alt-tab or even get in the game. But if you run the game manually it works fine. At first i thought that the Shell command in VB wouldnt work if the EXEs modified date had chnaged wso i whipped up some code to tackle that, its worked before but to no avail this time.

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#33

Posted 26 March 2004 - 02:40 PM

QUOTE (Hammer83 @ Mar 25 2004, 21:50)
Save managing is avoidable, but some other things proposed here require EXE editing, or at least memory hacking a-la MTA. I think the way I did it (not supplying the modified exe, but using a launcher that patches EXE for the duration of the program) is good enough. Also, there is less chance of saves getting messed up, because neither EXE, nor launcher ever touches Vice City User Files folder. If you try to manage the files before and after the execution of vice city and in the middle the computer reboots, the data will be inconsistent.

Quite well put overall. Rather akin to my own views on it all.

oetlul
  • oetlul

    still learning...

  • Members
  • Joined: 07 Apr 2004

#34

Posted 07 April 2004 - 02:49 PM

Hi all,

this looks like a very nice mod you guys are building,
and I would like to help. I know a little something about .SCM coding and .IMG and TXD editing and so on, but how can you edit the EXE-file? What program do you need to do that?
and there already exists a program that can adjust the limits of the EXE,and I think you all probably know it, but I'm gonna post it anyway: VCLIMITADJUSTER, search for it on google and you will find it.
But please tell me how to edit the EXE-file.
Right now I'm just messing around with some language files to create a proggie that can make vice city in all sorts of languages.

Opius
  • Opius

    General

  • Feroci Racing
  • Joined: 27 Jun 2002

#35

Posted 07 April 2004 - 03:02 PM

Now here's something useful!

Open up your gta-vc.exe with a hex editor, and search for "user". Look at the first result. Note the \GTA Vice City User Files. Edit that to whatever, I'd go with GTA Liberty City Data, making sure to pad the rest of the space with periods (00).

Now, whenever you start the game, it will make a new folder in My Documents with that name. This means you can have a completely seperate and functioning set of saved games and settings for GTA:LC!

Very useful.

Hammer83
  • Hammer83

    Hustler

  • Members
  • Joined: 11 Jan 2003

#36

Posted 07 April 2004 - 04:45 PM

QUOTE (Opius @ Apr 7 2004, 11:02)
Now here's something useful!

Open up your gta-vc.exe with a hex editor, and search for "user". Look at the first result. Note the \GTA Vice City User Files. Edit that to whatever, I'd go with GTA Liberty City Data, making sure to pad the rest of the space with periods (00).

Now, whenever you start the game, it will make a new folder in My Documents with that name. This means you can have a completely seperate and functioning set of saved games and settings for GTA:LC!

Very useful.

That's precisely what my program does, but only for the time of execution and so it works independently of what exe you use. smile.gif I'm also thinking of changing the title of the window in the task bar to GTA Liberty City instead of Vice City. This does not even need to be EXE modification. Just use SetWindowText API...

JamesSHF
  • JamesSHF

    :wub: GTA:LC

  • Members
  • Joined: 20 Dec 2003

#37

Posted 07 April 2004 - 08:36 PM

QUOTE (Opius @ Apr 7 2004, 15:02)
Now here's something useful!

Open up your gta-vc.exe with a hex editor, and search for "user". Look at the first result. Note the \GTA Vice City User Files. Edit that to whatever, I'd go with GTA Liberty City Data, making sure to pad the rest of the space with periods (00).

Now, whenever you start the game, it will make a new folder in My Documents with that name. This means you can have a completely seperate and functioning set of saved games and settings for GTA:LC!

Very useful.

I did this a while ago, it was decided against because the settings from Vice City couldn't be shared, which is fair enough.
Plus, of course, distributing the modified EXE (and even modifying it) is against the game's EULA.

JasonB
  • JasonB

    GTA-SA/GTA-VC/GTA3 Modder Extraordinaire

  • Members
  • Joined: 24 Aug 2002
  • None

#38

Posted 08 April 2004 - 05:52 AM

QUOTE (Hammer83 @ Apr 8 2004, 02:45)
QUOTE (Opius @ Apr 7 2004, 11:02)
Now here's something useful!

Open up your gta-vc.exe with a hex editor, and search for "user". Look at the first result. Note the \GTA Vice City User Files. Edit that to whatever, I'd go with GTA Liberty City Data, making sure to pad the rest of the space with periods (00).

Now, whenever you start the game, it will make a new folder in My Documents with that name. This means you can have a completely seperate and functioning set of saved games and settings for GTA:LC!

Very useful.

That's precisely what my program does, but only for the time of execution and so it works independently of what exe you use. smile.gif I'm also thinking of changing the title of the window in the task bar to GTA Liberty City instead of Vice City. This does not even need to be EXE modification. Just use SetWindowText API...

as does mine, now as soon as i figure out why VB does not weant to run Vice properly i could release the damn thing, but no whenever i click play it decides to make Vice city invisible and totally unaccesable. bah ill figure it out eventually

Luke
  • Luke

    suckmyrocket

  • Inactive Staff
  • Joined: 01 Dec 2003
  • None

#39

Posted 08 April 2004 - 10:08 AM

thats exactly the same problem that i had with my little save game thing... that never got released because of this.

The only way I can think of, is to run a MS-DOS batch file to run the program or something absurd like that confused.gif .

I tried every VB command to get it to work.

kipo
  • kipo

    Square Civilian

  • Members
  • Joined: 21 Dec 2003

#40

Posted 08 April 2004 - 07:10 PM Edited by kipo, 08 April 2004 - 07:17 PM.

you guys are right, the regular methods to launch programs don't work in vice city, you can try calling the Run dialog and calling vc from there.

CODE

Private Sub Command1_Click()
Dim objShell, c As String
       
Set objShell = CreateObject("Shell.Application")
objShell.FileRun

Set objShell = Nothing

c = ("C:\Rockstar Games\Grand Theft Auto Vice City\gta-vc.exe")
AppActivate ("Run")
SendKeys c & "{ENTER}"
End Sub


btw, this line: AppActivate ("Run"), depends on the name of your Run dialog, which might be different if you are running windows in another country.

JamesSHF
  • JamesSHF

    :wub: GTA:LC

  • Members
  • Joined: 20 Dec 2003

#41

Posted 08 April 2004 - 07:32 PM

I don't know a lot about VB, or Vice City's unwillingness to actually work properly with it, but can't you use VB to launch a shortcut to Vice City?

Hammer83
  • Hammer83

    Hustler

  • Members
  • Joined: 11 Jan 2003

#42

Posted 08 April 2004 - 08:36 PM

QUOTE (JasonB @ Apr 8 2004, 01:52)
as does mine, now as soon as i figure out why VB does not weant to run Vice properly i could release the damn thing, but no whenever i click play it decides to make Vice city invisible and totally unaccesable. bah ill figure it out eventually

I suggest using CreateProcess() Windows API. That's what I used, but mine is in Delphi.

kipo
  • kipo

    Square Civilian

  • Members
  • Joined: 21 Dec 2003

#43

Posted 09 April 2004 - 12:36 AM Edited by kipo, 09 April 2004 - 01:01 AM.

QUOTE (Hammer83 @ Apr 8 2004, 20:36)
QUOTE (JasonB @ Apr 8 2004, 01:52)
as does mine, now as soon as i figure out why VB does not weant to run Vice properly i could release the damn thing, but no whenever i click play it decides to make Vice city invisible and totally unaccesable. bah ill figure it out eventually

I suggest using CreateProcess() Windows API. That's what I used, but mine is in Delphi.

the CreateProcess API causes the same bug described by jasonb, must be a problem with vice city and vbasic only, it's weird.

JasonB
  • JasonB

    GTA-SA/GTA-VC/GTA3 Modder Extraordinaire

  • Members
  • Joined: 24 Aug 2002
  • None

#44

Posted 09 April 2004 - 01:22 AM

indeed it is, i tried everything to get Vice to run, but nothing apart from an external call could ever get it to run. Now there is another oddity, my program changes vice so it uses a different save game folder, it used to work but now when i run the game it has the same settings as before but no save games and there is no savegame folder anywhere, and if i remove every .set file and save game on the computer it still has the same settings? What THe? the games defaults are very different to my settings, this is getting more annoying by the minute

Cray
  • Cray

    MTA Developer

  • Members
  • Joined: 01 Jul 2002

#45

Posted 11 April 2004 - 03:59 PM

As Hammer stated, CreateProcess is the way to go when attempting to create an external loader for the game.

You are starting to leak over to what we are doing in MTA, with the loading and all, so if you run into issues or need some help just toss me a line anytime and I will see what I can do.

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#46

Posted 11 April 2004 - 05:52 PM

That's a very generous offer! Thank you very much on behalf of the entire LC effort! colgate.gif

Hammer83
  • Hammer83

    Hustler

  • Members
  • Joined: 11 Jan 2003

#47

Posted 12 April 2004 - 05:29 AM

JasonB, do you use VB .NET or VB6? I just ran the following code on VB .NET and had no trouble what so ever. BTW, I took it directly from MSDN:

CODE

Private Sub btnLaunch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLaunch.Click
   If dlgOpen.ShowDialog = DialogResult.OK Then
       Dim p As System.Diagnostics.Process = New Process
       p.StartInfo.FileName = dlgOpen.FileName
       p.StartInfo.WindowStyle = ProcessWindowStyle.Normal
       p.StartInfo.UseShellExecute = False
       p.Start()
       p.WaitForExit()
       MsgBox("Vice City Finished!")
   End If
End Sub

JasonB
  • JasonB

    GTA-SA/GTA-VC/GTA3 Modder Extraordinaire

  • Members
  • Joined: 24 Aug 2002
  • None

#48

Posted 12 April 2004 - 10:11 AM

i cant stand VB .NET so i still use good ol VB6, and they completely changed the syntax and everything in the .NET version and i dont want to have to learn it again, but perhaps i should. VB6 is getting outdated rather quickly now.

Luke
  • Luke

    suckmyrocket

  • Inactive Staff
  • Joined: 01 Dec 2003
  • None

#49

Posted 12 April 2004 - 11:21 PM Edited by Smithers2, 12 April 2004 - 11:39 PM.

This code uses the CreateProcess API and SuperShell to run it, it works wow.gif

Visual Basic 6 Code.

CODE
Const INFINITE = &HFFFF
Const STARTF_USESHOWWINDOW = &H1
Private Enum enSW
   SW_HIDE = 0
   SW_NORMAL = 1
   SW_MAXIMIZE = 3
   SW_MINIMIZE = 6
End Enum
Private Type PROCESS_INFORMATION
   hProcess As Long
   hThread As Long
   dwProcessId As Long
   dwThreadId As Long
End Type
Private Type STARTUPINFO
   cb As Long
   lpReserved As String
   lpDesktop As String
   lpTitle As String
   dwX As Long
   dwY As Long
   dwXSize As Long
   dwYSize As Long
   dwXCountChars As Long
   dwYCountChars As Long
   dwFillAttribute As Long
   dwFlags As Long
   wShowWindow As Integer
   cbReserved2 As Integer
   lpReserved2 As Byte
   hStdInput As Long
   hStdOutput As Long
   hStdError As Long
End Type
Private Type SECURITY_ATTRIBUTES
   nLength As Long
   lpSecurityDescriptor As Long
   bInheritHandle As Long
End Type
Private Enum enPriority_Class
   NORMAL_PRIORITY_CLASS = &H20
   IDLE_PRIORITY_CLASS = &H40
   HIGH_PRIORITY_CLASS = &H80
End Enum
Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Function SuperShell(ByVal App As String, ByVal WorkDir As String, dwMilliseconds As Long, ByVal start_size As enSW, ByVal Priority_Class As enPriority_Class) As Boolean
   Dim pclass As Long
   Dim sinfo As STARTUPINFO
   Dim pinfo As PROCESS_INFORMATION
   Dim sec1 As SECURITY_ATTRIBUTES
   Dim sec2 As SECURITY_ATTRIBUTES
   sec1.nLength = Len(sec1)
   sec2.nLength = Len(sec2)
   sinfo.cb = Len(sinfo)
   sinfo.dwFlags = STARTF_USESHOWWINDOW
   sinfo.wShowWindow = start_size
   pclass = Priority_Class
   If CreateProcess(vbNullString, App, sec1, sec2, False, pclass, _
   0&, WorkDir, sinfo, pinfo) Then
       'Wait
       WaitForSingleObject pinfo.hProcess, dwMilliseconds
       SuperShell = True
   Else
       SuperShell = False
   End If
End Function
Private Sub Form_Load()
   Dim VicePath As String
   VicePath = "E:\Games\GTA Liberty City Project\"

   SuperShell VicePath & "gta-vc.exe", VicePath, 0, SW_NORMAL, HIGH_PRIORITY_CLASS
   End
End Sub


Kinda long, you could cut some of the types out if you really wanted, but it could all live quite happily in a module.

JasonB
  • JasonB

    GTA-SA/GTA-VC/GTA3 Modder Extraordinaire

  • Members
  • Joined: 24 Aug 2002
  • None

#50

Posted 14 April 2004 - 03:11 AM

hmmm i tried it and it still did the same thing as before, odd

Luke
  • Luke

    suckmyrocket

  • Inactive Staff
  • Joined: 01 Dec 2003
  • None

#51

Posted 14 April 2004 - 10:40 AM

It does work, just make sure all of the paths are set, and have the same slashes etc as mine, because if it cant find the program, it wont warn you. It will just carry on.

I have a strange path to mine cos i have about 20 installs of vice now, and this particular one is on the E drive. It definitely works though.

JasonB
  • JasonB

    GTA-SA/GTA-VC/GTA3 Modder Extraordinaire

  • Members
  • Joined: 24 Aug 2002
  • None

#52

Posted 15 April 2004 - 12:38 AM

No it did the exact same thing as before, gta-vc.exe would appear in the task manager but it was impossible to actually get into the game.

GTA Firefighter
  • GTA Firefighter

    Crackhead

  • Members
  • Joined: 10 Apr 2004

#53

Posted 21 April 2004 - 07:25 PM

this seems like a good idea, has anybody got it to work? I'm not a programmer, but this looks promising! smile.gif

Hammer83
  • Hammer83

    Hustler

  • Members
  • Joined: 11 Jan 2003

#54

Posted 30 April 2004 - 08:03 PM

I've been messing a lot with EXE last little while and came to conclusion that the mission coding is going nowhere without EXE editing. Even if managing saves folder can be done without editing the executable, there are still many hardcoded things that need and can be modified. Here is what I'm talking about:

1. load_wav opcode load wavs not based on the file name (as I originally thought), but on the table which associates the string you specify as opcode parameter to the file name. This table is stored in the exe and can be easily modified to comply with GTA3 sounds.
2. A lot of dynamic objects are hardcoded, for example garage doors. For now, to get them working we have to modify the model names of gta3 to VC equivalents: that's editing ide, ipl, col, dff and consequently img files. A much easier approach would be to just change a a few characters in the exe.
3. Cut scenes. I know it's a longshot to ever get them working but the format of IFP files is exactly the same as VC. The problem is that models are structured differently so the bending and animation produces distortion effects. Anyway, that's not the point. What I was getting at is that cutscene names and mp3 associated with them are also stored in the exe. So to play cutscene audio we must edit exe.
4. Hadcoded limits. We are already unable to run the game without Limit Adjuster so editing one value or editing 100 values, what's the difference I don't think R* will mind.

There are some other things that will pop-up I'm pretty sure as the conversion goes along, so I think we need to decide what to do with exe.

So our alternatives are:
1. Make the dll a-la MTA that does all this in memory and never touches the exe. I think it's feasable. I was looking at idle's VCDbg code and it's very simple to attach our own dll to VC. Problem with this approach is that we have to hardcode the addresses, which differ in 1.0 and 1.1
2. Make a launcher. It will modify the exe before starting and undo the changes afterwards. Advantage: we can search for the required text to replace and not hardcode the addresses. Disadvantage: well obviously we are modifying the exe. But we are not redistributing anything illegal, so I see no problems.
3. Redistribute the modified exe. Advantage: no hustle, no possible screw ups because the modifications are static and not done on the fly. Disadvantage: it is against agreement with R*. So I guess this option is out.

So, what are your thoughts?

PS: As a demo of powers of EXE editing, here is a video that shows the converted Marty Chonks' first mission: Download (14 Mb). I recommend right-clicking and using "Save Target As..." because direct buffering in Media Player will take forever.

spaceeinstein
  • spaceeinstein

    巧克力

  • Members
  • Joined: 17 Jul 2003
  • None

#55

Posted 01 May 2004 - 02:16 AM Edited by spaceeinstein, 01 May 2004 - 09:10 PM.

---

Knaxia
  • Knaxia

    ex-GTA:LC co-leader (sounds lame now)

  • Members
  • Joined: 09 Sep 2003

#56

Posted 01 May 2004 - 02:58 PM

He told it:

3. Cut scenes. I know it's a longshot to ever get them working but the format of IFP files is exactly the same as VC. The problem is that models are structured differently so the bending and animation produces distortion effects. Anyway, that's not the point. What I was getting at is that cutscene names and mp3 associated with them are also stored in the exe. So to play cutscene audio we must edit exe.

btrw, this is an awesome job! I like it , missions biggrin.gif

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#57

Posted 01 May 2004 - 03:02 PM

First and foremost, ALL of your efforts are appreciated and indeed invaluable. smile.gif

QUOTE (Hammer83 @ Apr 30 2004, 15:03)
3. Cut scenes. I know it's a longshot to ever get them working but the format of IFP files is exactly the same as VC. The problem is that models are structured differently so the bending and animation produces distortion effects. Anyway, that's not the point. What I was getting at is that cutscene names and mp3 associated with them are also stored in the exe. So to play cutscene audio we must edit exe.
My understanding was that the cutscenes were off limits not only for all the reasons you specified, but also because of the way the models are constructed. Two sides of the coin both near a reality. A possibility in the near future?

QUOTE (Hammer83 @ Apr 30 2004, 15:03)
4. Hadcoded limits. We are already unable to run the game without Limit Adjuster
notify.gif My EXE is a generic VC noCD EXE. It works fine (except no GTA3 radio stations).

QUOTE (Hammer83 @ Apr 30 2004, 15:03)
1. Make the dll a-la MTA that does all this in memory and never touches the exe. I think it's feasable. I was looking at idle's VCDbg code and it's very simple to attach our own dll to VC. Problem with this approach is that we have to hardcode the addresses, which differ in 1.0 and 1.1
Not that I feel this option is our best. Just wanted to point out that the 1.1 patch was to accomodate graphical glitches that most updated drivers address, making the 1.1 patch obsolete. This is based solely on things I've heard.

QUOTE (Hammer83 @ Apr 30 2004, 15:03)
3. Redistribute the modified exe. Advantage: no hustle, no possible screw ups because the modifications are static and not done on the fly. Disadvantage: it is against agreement with R*. So I guess this option is out.
Well I agree with you that one modification or 100 should make no difference so long as we're not allowing somebody to play the game without purchasing it. For this reason along with the progress you've been making, I think it's time to look into sanctioning. It will take a few days minimum, but let me see what I can do...

QUOTE (Hammer83 @ Apr 30 2004, 15:03)
PS: As a demo of powers of EXE editing, here is a video that shows the converted Marty Chonks' first mission: Download (14 Mb). I recommend right-clicking and using "Save Target As..." because direct buffering in Media Player will take forever.
This video shows several things that are good to see. Only comment is that code simulating the crusher is one things I want to do. Hopefully it will be done in a way that will allow it to free function as well as being available for the 2 missions that require it. Since it's releavant, what do you know/can you find out about the way the GTA3 crusher is triggered? And the cranes? Might it be possible to impliment them into the VC engine much the way the garage doors were? Probably not, but worth a peek. Also things the bullion pickup, etc...

chriswible
  • chriswible

    Player Hater

  • Members
  • Joined: 06 Feb 2003

#58

Posted 02 May 2004 - 12:51 AM

I'm no expert on this legal stuff... but could you make a patch an release that? the patch isn't a modified EXE, so there's no violation there. only the end-user who runs the patch violates the EULA (which I'm sure not many people would have a problem with wink.gif ). you could put a disclaimer in the patch.

if it was done really well, it could patch any EXE- the original or a no-cd... so that could be used also... and again, that is all on the end-user, so it shouldn't get you guys into any hot water.

just an idea.

Hammer83
  • Hammer83

    Hustler

  • Members
  • Joined: 11 Jan 2003

#59

Posted 02 May 2004 - 01:15 AM

Personally I prefer alternative 1. But I'm used to Delphi and attaching and hacking memory is better done with C (or lets say that I have to idea how to convert idle's code to Delphi). If somebody else could try to program an attaching dll it would be great. I have all offsets that need to be modified, just don't know how to approach the problem.

On the other hand, there are already several launchers that are in works (including my own). I could develop it further and make it modify the above mentioned sound and cut scene tables.

Demarest, I'm not sure how you can run LC without Limit Adjuster. The numebr of buildings and dummies of LC exceeds the default numbers set in generic exe and the game just crashes at start if you don't expand them.

About crusher, I think it's off limits. It was too hardcoded to be reimplemented as is in VC. Moreover all opcodes relating to it cause VC to crash. If you could simulate the car moving inside it would be great. But for now I think, a good old destroy_car would do smile.gif

Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#60

Posted 11 May 2004 - 02:58 PM

A launcher is completly legal, if you're editing memory (like a trainer) and not the actual exe file... from the sound of the posts though, it seems like you're editing the exe, loading the game and when the game closes, restoring the exe. This isn't needed because you can just patch it in memory right after its been executed. Here it is step by step...

Quoting my post on this thread...
QUOTE (Spooky @ Dec 19 2003, 05:41)
Editing the EXE will be illegal but it is possible to change it without changing the file at all, this will require a bit of programming knowledge but it's not hard to grasp...

First create the game process with the CreateProcess() Windows API call, specifying the CREATE_SUSPENDED flag.

Next you can edit the exe thats now loaded into memory using WriteProcessMemory(), using the process handle in the PROCESS_INFORMATION structure returned by CreateProcess.

Finally ResumeThread() using the thread handle again returned in the PROCESS_INFORMATION structure returned by CreateProcess.

Since this is only editing memory like a trainer, it's not illegal. Theres a few things that might need checking, such as the code section of the game's memory space not being write-enabled, use VirtualProtectEx to sort that.


This creates the vice city process (loads the exe from file into memory) but doesn't execute it. You can then edit anything that needs to be edited within the exe and finally let the program run. Doing this doesn't edit any files what so ever, it's just memory, as soon as the process is dead, it's the changes are gone.

Heres a little Delphi program todo just that...
CODE
program vcloader;

uses
 Windows;

var
 hProcess, hThread: THandle;

procedure WriteBytes(Address: DWord; Bytes: Array Of Byte);
var
 iWritten: Cardinal;
begin
 WriteProcessMemory(hProcess, Ptr(Address), @Bytes[0], Length(Bytes), iWritten);
end;


function RunGame: Boolean;
var
 xStartInfo: TStartupInfo;
 xProcInfo: TProcessInformation;
begin
 FillChar(xStartInfo, SizeOf(TStartupInfo), 0);
 FillChar(xProcInfo, SizeOf(TProcessInformation), 0);
 xStartInfo.cb:= SizeOf(TStartupInfo);
 Result:= CreateProcess(nil, 'gta-vc.exe', nil, nil, True,
          CREATE_SUSPENDED or NORMAL_PRIORITY_CLASS,
          nil, nil, xStartInfo, xProcInfo);
 If Result Then Begin
   hProcess:= xProcInfo.hProcess;
   hThread:= xProcInfo.hThread;
 End;
end;

begin
 if not RunGame then begin
   MessageBox(0, 'Unable to launch game', 'Error', MB_ICONERROR);
   ExitProcess(0);
 end;

 // Insert all the calls to WriteBytes here. The syntax is
 // WriteBytes(Address,BytesToWrite);
 // e.g.  WriteBytes($12345678, [$12, $23, $56, $78, $90]);
 // would write 0x12, 0x23, 0x56, 0x78, 0x90 to 0x12345678

 ResumeThread(hThread);
end.


WriteBytes(); wants an address (where to write the change) and the bytes to actually change to. The bytes are a dynamic array, so it could be one byte (e.g. [$90], or a million bytes [$AA, $BB, $CC, ...]).

Hope this helps smile.gif

p.s. It's not a great idea to write a million bytes in 1 call though biggrin.gif




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users