Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Hotfix/patches (http://www.go4expert.com/forums/hotfix-patches-t23948/)

kemnet 21Nov2010 20:07

Hotfix/patches
 
Hello.
Question.

Lets say I write an executable program that is supposed to do

A+B+C

but i made a mistake and it does
A+B-C

and i only discovered this error after i built the program and sold it so someone.
how do i write a separate executable / patch i can send to the person that will correct that error IN c++.
Thank YOU

virxen 21Nov2010 20:11

Re: Hotfix/patches
 
send him the executable file to overwrite the wrong one

kemnet 21Nov2010 20:12

Re: Hotfix/patches
 
well yes...but...im thinking if its a big program. Cant I just write up a little code that will do that?instead of the WHOleeeee Executable?

virxen 21Nov2010 20:23

Re: Hotfix/patches
 
then try the patch method

read both files and find the differences(what the difference is and where)
write the data in a file
and send this with an exe patcher program to issue the changes to the old program

kemnet 21Nov2010 20:26

Re: Hotfix/patches
 
ok with this patch method if you have four forms will you be able to specify that you only want to check out the code on the 1st form?

seomanju 21Nov2010 22:06

Re: Hotfix/patches
 
thanks

kemnet 21Nov2010 22:50

Re: Hotfix/patches
 
Quote:

Originally Posted by seomanju (Post 75036)
thanks

what for :)

virxen 22Nov2010 00:05

Re: Hotfix/patches
 
Quote:

Originally Posted by kemnet (Post 75030)
ok with this patch method if you have four forms will you be able to specify that you only want to check out the code on the 1st form?


you check only the executable file

kemnet 22Nov2010 00:15

Re: Hotfix/patches
 
ok so i must redo the whole executable?

virxen 22Nov2010 00:58

Re: Hotfix/patches
 
1 Attachment(s)
this is patch1.cpp
Code:

#include <stdio.h>

int main(){
    int A=1,B=2,C=0;
    C=A+B;
    printf("\nC=%d",C);
    getchar();
    return 0;
}


this patch2.cpp
Code:

#include <stdio.h>

int main(){
    int A=1,B=2,C=0;
    C=A-B;
    printf("\nC=%d",C);
    getchar();
    return 0;
}


patch2.cpp is the program with the error and patch1.cpp is the correct one

you compile both of them

if you see the executables in a hex editor and compare them with each other
you will see that most of the files are the same.
you need to change only the differences

in dos prompt you can use fc=filecompare like this
fc patch1.exe patch2.exe >differences.txt

in this text file you will see what you have to change in patch2.exe in order to become patch1.exe

see the files in the zip file.


p.s. all the above must be done programatically by you
or you can use something like this to do it automatically http://sourceforge.net/projects/jojodiff/



also another article based on what you want is here http://www.codediesel.com/tools/tran...files-quickly/


All times are GMT +5.5. The time now is 04:17.