Home | Reviews | GUIpedia | Forum | Fun500


tacodrake95Exe files
Does anyone know how to find the part of an exe that holds the commands?
2010-11-2712:28 AM

ToddRe:Exe files
Commands? You mean like built in functions or function calls?
2010-11-2712:50 AM

tacodrake95Re:Exe files
i'm talking about the machine code part that tells the processor what to do.
2010-11-2712:56 AM

ToddRe:Exe files
You'd have to run the EXE through a disassembler which can detect parts of the EXE that contain program code. Some use ".text" sections although EXE linkers are different and can put the code into a different layout. You'll also need a good understanding of computer architecture and low-level programming (i.e. Assembly) to know what the code does. The commands are low-level instructions that interact with the CPU and parts of memory where arbitrary subroutines and data exist for use by the operating system and its programs.
2010-11-271:09 AM

tacodrake95Re:Exe files
So is there any header information that tells where in the file the Machine commands are?
2010-11-271:11 AM

ToddRe:Exe files
You'd have to look up a manual on PE executable formats. It can vary according to how the linker arranges the EXE to run and where it specifies those headers. I'd take a look at this: http://www.phreedom.org/solar/code/tinype/ It's for making tiny PE EXE files but the guy explains different sections of the PE file format.
2010-11-271:23 AM

tacodrake95Re:Exe files
I wanted to know so that i can take and run an exe through basic with the raw machine code and run that throught call interrupt
2010-11-271:28 AM

ToddRe:Exe files
You can't run code directly through interrupts. Interrupts are not for CPU-based instructions but rather for interacting with hardware (e.g. mouse, monitor, etc.). Depending on which OS you use, it might not let you embed machine code into your program and then run it directly.
2010-11-271:34 AM

tacodrake95Re:Exe files
well, if it had the device to display it to, such as the monitor, it could just use the machine code and put it into the monitor interrupt.
2010-11-271:41 AM

ToddRe:Exe files
I'm not sure what you're trying to do. Interrupts do these things however they are based on what data exists in specific registers before being called. You would need to trace a program entirely to know what the registers would be populated with before it called interrupts. Most of the time these days, executables don't call interrupts directly but only indirectly through the operating system.
2010-11-271:47 AM

DickRe:Exe files
Disassembling QB exes will probably get you nowhere, but you can view asm output of QB programs. for examble: test.bas: SCREEN 13
COLOR 10
PRINT "hello world"
CIRCLE (160, 100), 10, 10

running BC.EXE (basic compiler): BC.EXE test.bas /A test.obj test.txt test.txt will be asm ouput: 0030 0006 0030 0006 0030 0006 SCREEN 13 0030 0006 0030 0006 0030 0006 COLOR 10 0030 0006 0030 0006 PRINT "hello world" 0030 0006 0030 0006 CIRCLE (160, 100), 10, 10 0030 ** I00002: mov ax,0001h 0033 ** push ax 0034 ** mov ax,000Dh 0037 ** push ax 0038 ** mov ax,0002h 003B ** push ax 003C ** call B$CSCN 0041 ** mov ax,0001h 0044 ** push ax 0045 ** mov ax,000Ah 0048 ** push ax 0049 ** mov ax,0002h 004C ** push ax 004D ** call B$COLR 0052 ** mov ax,offset 0055 ** push ax 0056 ** call B$PESD 005B ** mov ax,00A0h 005E ** push ax 005F ** mov ax,0064h 0062 ** push ax 0063 ** call B$N1I2 0068 ** push <00002041> 006C ** push <00002041> 0070 ** mov ax,000Ah 0073 ** push ax 0074 ** call B$CIRC 0079 0006 0079 0006 0079 ** call B$CENP 007E 0006 44029 Bytes Available 43704 Bytes Free
You can actually write your own asm routines that use QB's circle / color / print statement and link them with your QB program. If you want to run other exes from QB you can use SHELL and CHAIN statements.  You can also use CALL ABSOLUTE to run raw machine code but not exes.  Also remember QB's memory limits.
2010-11-271:48 AM

tacodrake95Re:Exe files
I want to try and run dos and win32 apps that are windowed within QB.
2010-11-271:53 AM

DickRe:Exe files
Sounds like you'll need to write an emulator.
2010-11-271:58 AM

tacodrake95Re:Exe files
Exactly. i just forgot the word for it. would you happen to know how to do that? i'm going to start the emulator idea on a new thread.
2010-11-271:59 AM

Other


2021 Brandon Cornell