| |

VerySource

 Forgot password?
 Register
Search
View: 2354|Reply: 10

Problems converting .exe to .com files?

[Copy link]

3

Threads

10

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-1-27 22:00:01
| Show all posts |Read mode
exe2bin.exe makes a .com file that resides in memory.

Enter the command line under dos: exe2bin.exe D:\A (file to be converted)

But the result prompts: File cannot be converted

what is happening?
Reply

Use magic Report

0

Threads

23

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-2-23 20:00:01
| Show all posts
The file cannot be converted, that is, your .exe does not meet the conditions of .com. To be converted to .com, .exe must meet two conditions. One is that the program is executed from 0100h; the other is that it cannot have a segment address. References such as mov ax, DataSeg
Reply

Use magic Report

3

Threads

10

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-3-12 21:45:02
| Show all posts
Thank youwww_jamesfor your responses to all my questions, thank you!

turn. com file problem has been successful, but strangely, my source program contains
Mov word ptr old_print [2], es; segment address
Also successfully converted!

Here I hope to discuss withwww_james(of course, including friends who can help me understand):

1. All my questions are centered around one, modify the 17h interrupt service routine and make it always valid!

2. My .com file is a memory-resident program. I modify the interrupt address of 17h. I hope that all subsequent programs can enter my new entry program by calling int 17h.

3. The problem is that, as soon as the program I wrote ends, and then call int 17h with another assembler, the original interrupt service routine is executed again! !!

Please take a look at my code, is there anything wrong?

cseg segment
    assume cs: cseg, ds: cseg
    org 100h
   
start:
    JMP Initialize
    old_print dd?

new_print proc far; new interrupt service routine entry
    assume cs: cseg, ds: cseg
    STI
    pushf
    assume ds: nothing
    push ax
    push dx
    mov al, 'M'
    mov ah, 0
    mov dx, 0
    call dword ptr old_print
    pop dx
    pop ax
    popf
    NOP
    IRET
new_print endp

Initialize:
    assume cs: cseg, ds: cseg
    mov bx, cs
    mov ds, bx
    mov al, 17h; save original interrupt vector
    mov ah, 35h
    int 21h
    mov word ptr old_print, bx
    mov word ptr old_print [2], es

    mov dx, OFFSET new_print; set new interrupt vector
    mov al, 17h
    mov ah, 25h
    int 21h

    mov dx, offset Initialize
    int 27h; Program memory before label Initialize in memory
    
cseg ends
    end start

Thanks again!
Reply

Use magic Report

0

Threads

15

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-3-20 22:00:01
| Show all posts
Do you want to change the interrupt address in v8086?
Reply

Use magic Report

0

Threads

23

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-3-28 20:45:01
| Show all posts
> Turn. com file problem has been successful, but strangely, my source program contains
> Mov word ptr old_print [2], es; segment address
> Also successfully converted
It is not that segment registers such as es cannot be used in .com files, but that the segment address of your own program segment cannot be referenced. This is because the segment address of the program segment is due to the start address being different when the program is loaded into memory. There will be differences. Therefore, dos will adjust it based on the loaded base address to make it reference correctly. This is the so-called relocation of the exe program. There is no relocation item in the com file, so there can be no reference to the segment. The use of segment registers is possible in other ways. For example:
  mov ax, 0b800h
  mov es, ax

The above code has a problem:
new_print proc far; new interrupt service routine entry
    assume cs: cseg, ds: cseg
    STI
    pushf
    assume ds: nothing
    push ax
    push dx
    mov al, 'M'
    mov ah, 0
    mov dx, 0
    pushf; * + requires this instruction. Like int17h, the tag register needs to be pushed on the stack
    call dword ptr old_print
    pop dx
    pop ax
    popf
    NOP
    IRET
new_print endp

In addition, the resident function of this code is normal. I ran it directly in the dos window of XP, and then debug to see the interrupt vector of int17h at 0: 5c, which points to this code.
However, I have read your other post, and requested to modify the printed content. This, I am afraid that this can not be achieved. Generally speaking, the print function, sending data through int17h, may be relatively small, or directly sent to print The port is more efficient. Therefore, it may be difficult to achieve the original purpose by intercepting int17h
Reply

Use magic Report

0

Threads

23

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-4-9 14:00:02
| Show all posts
If you want to view the interception of Windows print data, through int17h is definitely useless. These functions improved by the dos window under Windows are temporarily simulated. However, I do n’t know how to implement your requirements Nothing has been done in this regard.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-4-14 22:15:01
| Show all posts
The function that the landlord wants to do can certainly be achieved, but it is necessary to write a Windows driver instead of a Dos driver.
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-4-18 10:15:01
| Show all posts
Not possible under DOS, you need to write the windows driver
Reply

Use magic Report

3

Threads

10

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-4-19 14:45:01
| Show all posts
thanks for your replies!

That is to say, even if I write the assembler in protected mode, it is impossible to modify the way of int 17h! Right!

Regarding the windows driver, friends who understand this aspect, can you give me a little specific guidance, give me a direction, so that I can do it.

Thanks again!
Reply

Use magic Report

0

Threads

12

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-5-11 11:00:01
| Show all posts
Under the DDK, look at the routine, writing the driver is still simple ...
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list