Page 1 of 1
Verifying match between Source.bas and Run.exe
Posted: Thu Jan 29, 2009 4:24 pm
I have been asked to modify a QB45 program. The author is deceased. The .exe program is used to generate some complicated manufacturing process parameters. I have a .bas module with the same name and a time stamp within seconds of the .exe, but when I compile it and compare the .exe to the original that is is production, they are not the same. I have tried the compile under XP, 95, and 98 which is where I think it was originally compiled, but I can not get a identical .exe to prove I have the correct source.bas. Any information about how the compile environment might affect the .exe that results from the compile would be appreciated.
Posted: Thu Jan 29, 2009 5:31 pm
Does the BAS run the same as the EXE? That's all that matters! QB's compiler naturally changes the code to machine code. Why would you try to read the EXE? Notepad or another editor will not display EXE code correctly anyhow.
With the time stamp, I would assume it is the correct BAS file.
Posted: Thu Jan 29, 2009 8:19 pm
Some time ago, I tried what you are trying to do. The .EXE files were not the same.
Then I took a program of mine, compiled it, and saved the .EXE. Then I re-compiled the program again and compared the new .EXE to the one saved. The were not equal. Apparently, the compiler gives different results, I don't know exactly why. Maybe the compiler grabs different values for certain blocks of memory, which will be different on each compilation. However, the .EXE files run exactly the same, and as Ted says, that's what is important.
Posted: Fri Jan 30, 2009 9:28 am
As I mentioned this is a rather complex and complicated manufacturing process, and the cost of doing it wrong are high. Trying to test every path through the code would be a daunting task, so it is difficult to say if they run the same. The time stamps would suggest that I probably have the right source code... but you know the old saying about assuming.
It's not just QBasic
Posted: Fri Jan 30, 2009 10:07 am
A few weeks ago, I had a similar question about a C program for a PIC microcontroller. Wrapped together in one folder were two .HEX files for programming the chips, two main programs, and numerous sub-modules of various dates. There wasn't even any information indicating what compiler had been used. (The free development system supplied by the PIC manufacturer only supported assembly language for the particular model, so that wasn't it.)
Hey, now I know why they fired that programmer!
Posted: Fri Jan 30, 2009 2:25 pm
Well.........If you cannot test the program with fake readings then I suggest you don't mess with it! All you can do is mess it up.
The BAS file should be capable of doing the SAME things that the EXE does. It should be tested in REAL conditions before any alterations are made to it. What exactly is wrong with the old EXE?
Posted: Fri Jan 30, 2009 9:17 pm
MrBill, it is possible that the original EXE may have different libraries linked in. Also, one might be compiled for use with BRUN45, and the other standalone. These two details can produce EXEs of different sizes. How large of a discrepancy are you talking about though?
Posted: Mon Feb 02, 2009 9:46 am
It was definitely compiled to run stand alone without debug? that is the only way the size will come out right. As a matter of fact when I do the compile stand alone I get the exact same size? there are just a few dozen bytes toward the end, scattered among the literals (readable print characters) that are different. I would love not to mess with it, but there are things that need to be done. I am ok with the changes that I will make, but I am concerned that some other unintended change may be introduced if I don?t have the correct source. In an attempt to reproduce the environment in which the original .exe was compiled I went back to the PC on which the source .bas was found and compiled it there, but still the differences. I have no idea what may have changed on the PC since the production .exe was created in 2004, or if it is the same PC. There is also a .obj that is created during the compile? what is its role in this process?
Posted: Mon Feb 02, 2009 1:22 pm
OBJ files are created after every compile. OBJ files can be used to create QB libraries. I usually just delete them.
Posted: Mon Feb 02, 2009 6:35 pm
The OBJ files are the object code that the compiler generates. They're used at the link phase to produce the final executable. Once the EXE is built, you no longer have a need for them, and can delete them.
Posted: Mon Feb 02, 2009 8:38 pm
I wouldn't waste any more time trying to figure out the differences with the .EXEs. The minute you start making any needed modifications to the source code, the program will be your total responsibility from then on.
I would start out by doing some good testing with the original .EXE to learn how the program operates. Hopefully you have some specifications on the program. Then start making some changes, compiling, and testing again, to make sure that your changes didn't screw something up. Good luck.
Posted: Fri Feb 06, 2009 5:54 pm
I found this works like the checksum on an eprom, this size difference is caused by fragmentation in the pagefile meaning you have to view a bigger chunk than is nessicery to contain the file durring compile so you need to fix it so that the compile happens in a relitivly free memory perhaps freeing up some resources by closing progs on the bottom right of the screen or by using start run config or msconfig.exe.
1 compile on a relitivly empty machine after defragmenting religiously for a few days till it says theres nothing to defrag. this might work streight up.
2 if the file is smaller than is required you can allocate more memory from the program untill you hit the perfect mark..
if neither of these works out you may need to write a program to allocate memory for the compile and convert it to qlb and include it after.
there is a basic source file that exist out there somewhere I used once prewritten for this unfortunatly I don't remember its name.
Im guessing you are attempting a TSR?
Posted: Wed Mar 11, 2009 8:09 pm
Hogwash! GO AWAY.........