Verifying match between Source.bas and Run.exe
Verifying match between Source.bas and Run.exe
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.
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
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.
Ted![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
With the time stamp, I would assume it is the correct BAS file.
Ted
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
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.
Regards..... Moneo
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.
Regards..... Moneo
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
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!
Hey, now I know why they fired that programmer!
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
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?
Ted
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?
Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
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?
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
OBJ files are created after every compile. OBJ files can be used to create QB libraries. I usually just delete them.
Ted
Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
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.
Regards..... Moneo
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.
Regards..... Moneo
-
- Veteran
- Posts: 185
- Joined: Mon Jun 30, 2008 4:10 pm
suggestion
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.
two options
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?
Good luck!
two options
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?
Good luck!
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Hogwash! GO AWAY.........
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0