prefix
asked on
Make a patcher program.
How to make a patcher program,please?
I need it to compare two Exe Files,then find out the differences between them,then patch the object file to the source file. And need it can create a exe file to patch automatically.
Two functions must in the program:
1.Patch a exe file.
2.Create a exe file, the file can patch the object file automatically.
Thanks!!
I need it to compare two Exe Files,then find out the differences between them,then patch the object file to the source file. And need it can create a exe file to patch automatically.
Two functions must in the program:
1.Patch a exe file.
2.Create a exe file, the file can patch the object file automatically.
Thanks!!
The best way to do this is during the initial programming stages is to create your forms but instead of placing the code with the forms you create classes for each of the forms with the code inside. When you have completed your form, build the class into a DLL.
When you have an update you simply replace the DLL. *This will only work if you change coding not the Form it self. But with no code in the forms other than the Class Calls it make the EXE very small and flexible. If you do change a form for any reason you would submit the changed EXE and if any coding you submit the DLL. I have found it makes updates very easy for myself and my clients..
As for File Dates and so forth play with the following example.
Dim fso As New FileSystemObject, FileDef As File
Set FileDef = fso.GetFile("c:\tmp.txt") '<--- Your file
Debug.Print FileDef.DateLastModified
' FileDef has a more options to use
When you have an update you simply replace the DLL. *This will only work if you change coding not the Form it self. But with no code in the forms other than the Class Calls it make the EXE very small and flexible. If you do change a form for any reason you would submit the changed EXE and if any coding you submit the DLL. I have found it makes updates very easy for myself and my clients..
As for File Dates and so forth play with the following example.
Dim fso As New FileSystemObject, FileDef As File
Set FileDef = fso.GetFile("c:\tmp.txt") '<--- Your file
Debug.Print FileDef.DateLastModified
' FileDef has a more options to use
Although I use jonder's technique myself, pathcher programs are available if you have a search around. It's a lot less effor than writing one yourself.
Check out http://www.funduc.com/pamain1.htm
for just one example.
Check out http://www.funduc.com/pamain1.htm
for just one example.
just a note: neither of these two seem to really 'patch' the original file - they just replace it, albeit compressed, with a nice setup program.
I'd be interested too if anybody finds a patcher program which does a proper patch, ie just replace the changed bytes within the original. I'd love to be able to patch my setup.cab file to save my client downloading 2MBs worth.
I'd be interested too if anybody finds a patcher program which does a proper patch, ie just replace the changed bytes within the original. I'd love to be able to patch my setup.cab file to save my client downloading 2MBs worth.
ASKER
mcrider:
the reason is: sometimes I need to write a program that some functions are not available before somebody register it,after registering, I can patch the EXE to a full version. And there's only a little diference between the two version. Replacing an EXE with a new one I don't think it's OK if the new EXE if too big.
the reason is: sometimes I need to write a program that some functions are not available before somebody register it,after registering, I can patch the EXE to a full version. And there's only a little diference between the two version. Replacing an EXE with a new one I don't think it's OK if the new EXE if too big.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mcrider:
I need a source program to do that, give me a example? I know I can do like you said, but I don't know how to implement.
Come on...OK?
I need a source program to do that, give me a example? I know I can do like you said, but I don't know how to implement.
Come on...OK?
Here you go... In the above example, we used a hex dumping program like "Quick View Plus" to find the "NOP!" definition at offset hex 000840. You would manually locate this string in your program, and then set the "PatchOffset" constant below. in the example, I am using the hex 840. This will patch the "YEP!" string over the "NOP!" string...
Const PatchOffset = &H840
Dim fNum As Long
Dim FileName As String
fNum = FreeFile
FileName = "c:\windows\desktop\testfi le.exe"
Open FileName For Binary As #fNum
Seek #fNum, PatchOffset + 1
Put #fNum, , Chr$(&H59)
Put #fNum, , Chr$(&H0)
Put #fNum, , Chr$(&H45)
Put #fNum, , Chr$(&H0)
Put #fNum, , Chr$(&H50)
Put #fNum, , Chr$(&H0)
Put #fNum, , Chr$(&H21)
Close fNum
Cheers!®©
Const PatchOffset = &H840
Dim fNum As Long
Dim FileName As String
fNum = FreeFile
FileName = "c:\windows\desktop\testfi
Open FileName For Binary As #fNum
Seek #fNum, PatchOffset + 1
Put #fNum, , Chr$(&H59)
Put #fNum, , Chr$(&H0)
Put #fNum, , Chr$(&H45)
Put #fNum, , Chr$(&H0)
Put #fNum, , Chr$(&H50)
Put #fNum, , Chr$(&H0)
Put #fNum, , Chr$(&H21)
Close fNum
Cheers!®©
ASKER
Yes,great!
But I don't why must "Put #fNum, , Chr$(&H0)" and "Put #fNum, , Chr$(&H21)". What are their meaning?
Cheers!
But I don't why must "Put #fNum, , Chr$(&H0)" and "Put #fNum, , Chr$(&H21)". What are their meaning?
Cheers!
Well, you don't have to do the last two... the &H21 is the exclamation point (!) on "YEP!"
Thanks for the points...
Cheers!®©
Thanks for the points...
Cheers!®©
ASKER
But the &H0? Why to put it?
In the EXE, "NOP!" is actually stored like this:
4E 00 4F 00 50 00 21
N O P !
Cheers!®©
4E 00 4F 00 50 00 21
N O P !
Cheers!®©
Cheers!®©